backport/2.8/58207 ce_bfd_view: update to fix a bug (#58207) (#58556)

* update to fix a bug (#58207)


(cherry picked from commit 4a6c86715a)

* add a changelog fragment to PR 58556.

* Update 58207-update-ce_bfd_view-to-fix-a-bug.yml
This commit is contained in:
YuandongXu 2019-07-09 09:01:02 +08:00 committed by Toshio Kuratomi
parent db5ceb2390
commit 7f87698e79
2 changed files with 6 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ce_bfd_view - line287, line293, 'data' tag of a xpath should be removed to find a element.line500, running result judgment.

View file

@ -284,13 +284,13 @@ class BfdView(object):
root = ElementTree.fromstring(xml_str) root = ElementTree.fromstring(xml_str)
# get bfd global info # get bfd global info
glb = root.find("data/bfd/bfdSchGlobal") glb = root.find("bfd/bfdSchGlobal")
if glb: if glb:
for attr in glb: for attr in glb:
bfd_dict["global"][attr.tag] = attr.text bfd_dict["global"][attr.tag] = attr.text
# get bfd session info # get bfd session info
sess = root.find("data/bfd/bfdCfgSessions/bfdCfgSession") sess = root.find("bfd/bfdCfgSessions/bfdCfgSession")
if sess: if sess:
for attr in sess: for attr in sess:
bfd_dict["session"][attr.tag] = attr.text bfd_dict["session"][attr.tag] = attr.text
@ -497,6 +497,8 @@ class BfdView(object):
return return
self.end_state["session"] = bfd_dict.get("session") self.end_state["session"] = bfd_dict.get("session")
if self.end_state == self.existing:
self.changed = False
def work(self): def work(self):
"""worker""" """worker"""