update to fix a bug (#58229)

Signed-off-by: xuxiaowei0512 <786018072@qq.com>
(cherry picked from commit b93411a5b2)
This commit is contained in:
YuandongXu 2019-06-29 04:03:09 +08:00 committed by Toshio Kuratomi
parent e61ea32779
commit e072a5b111

View file

@ -424,7 +424,7 @@ class InterfaceOSPF(object):
# get process base info # get process base info
root = ElementTree.fromstring(xml_str) root = ElementTree.fromstring(xml_str)
ospfsite = root.find("data/ospfv2/ospfv2comm/ospfSites/ospfSite") ospfsite = root.find("ospfv2/ospfv2comm/ospfSites/ospfSite")
if not ospfsite: if not ospfsite:
self.module.fail_json(msg="Error: ospf process does not exist.") self.module.fail_json(msg="Error: ospf process does not exist.")
@ -435,7 +435,7 @@ class InterfaceOSPF(object):
# get areas info # get areas info
ospf_info["areaId"] = "" ospf_info["areaId"] = ""
areas = root.find( areas = root.find(
"data/ospfv2/ospfv2comm/ospfSites/ospfSite/areas/area") "ospfv2/ospfv2comm/ospfSites/ospfSite/areas/area")
if areas: if areas:
for area in areas: for area in areas:
if area.tag == "areaId": if area.tag == "areaId":
@ -445,7 +445,7 @@ class InterfaceOSPF(object):
# get interface info # get interface info
ospf_info["interface"] = dict() ospf_info["interface"] = dict()
intf = root.find( intf = root.find(
"data/ospfv2/ospfv2comm/ospfSites/ospfSite/areas/area/interfaces/interface") "ospfv2/ospfv2comm/ospfSites/ospfSite/areas/area/interfaces/interface")
if intf: if intf:
for attr in intf: for attr in intf:
if attr.tag in ["ifName", "networkType", if attr.tag in ["ifName", "networkType",