* update vrf to fix bugs (#57270)
* update vrf
* update vrf
(cherry picked from commit 76e06fa7c2
)
* add changelog fragment fot PR 57757.
This commit is contained in:
parent
814349c368
commit
2645c43a2b
4 changed files with 7 additions and 6 deletions
2
changelogs/fragments/57757-update-vrf-to-fix-bugs.yml
Normal file
2
changelogs/fragments/57757-update-vrf-to-fix-bugs.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- update vrf to fix bugs.(https://github.com/ansible/ansible/pull/57270 )
|
|
@ -214,7 +214,7 @@ class Vrf(object):
|
|||
|
||||
root = ElementTree.fromstring(xml_str)
|
||||
vpn_instances = root.findall(
|
||||
"data/l3vpn/l3vpncomm/l3vpnInstances/l3vpnInstance")
|
||||
"l3vpn/l3vpncomm/l3vpnInstances/l3vpnInstance")
|
||||
if vpn_instances:
|
||||
for vpn_instance in vpn_instances:
|
||||
if vpn_instance.find('vrfName').text == self.vrf:
|
||||
|
|
|
@ -568,7 +568,7 @@ class VrfAf(object):
|
|||
|
||||
# get the vpn address family and RD text
|
||||
vrf_addr_types = root.findall(
|
||||
"data/l3vpn/l3vpncomm/l3vpnInstances/l3vpnInstance/vpnInstAFs/vpnInstAF")
|
||||
"l3vpn/l3vpncomm/l3vpnInstances/l3vpnInstance/vpnInstAFs/vpnInstAF")
|
||||
if vrf_addr_types:
|
||||
for vrf_addr_type in vrf_addr_types:
|
||||
vrf_af_info = dict()
|
||||
|
|
|
@ -353,7 +353,7 @@ class VrfInterface(object):
|
|||
for l3vpn_ifinfo in l3vpn_if:
|
||||
for ele in l3vpn_ifinfo:
|
||||
if ele.tag in ['ifName']:
|
||||
if ele.text == self.vpn_interface:
|
||||
if ele.text.lower() == self.vpn_interface.lower():
|
||||
self.intf_info['vrfName'] = vpn_name
|
||||
|
||||
def get_interface_vpn(self):
|
||||
|
@ -371,14 +371,13 @@ class VrfInterface(object):
|
|||
# get global vrf interface info
|
||||
root = ElementTree.fromstring(xml_str)
|
||||
vpns = root.findall(
|
||||
"data/l3vpn/l3vpncomm/l3vpnInstances/l3vpnInstance")
|
||||
"l3vpn/l3vpncomm/l3vpnInstances/l3vpnInstance")
|
||||
if vpns:
|
||||
for vpnele in vpns:
|
||||
vpn_name = None
|
||||
for vpninfo in vpnele:
|
||||
if vpninfo.tag == 'vrfName':
|
||||
vpn_name = vpninfo.text
|
||||
|
||||
if vpninfo.tag == 'l3vpnIfs':
|
||||
self.get_interface_vpn_name(vpninfo, vpn_name)
|
||||
|
||||
|
@ -408,7 +407,7 @@ class VrfInterface(object):
|
|||
replace('xmlns="http://www.huawei.com/netconf/vrp"', "")
|
||||
|
||||
root = ElementTree.fromstring(xml_str)
|
||||
interface = root.find("data/ifm/interfaces/interface")
|
||||
interface = root.find("ifm/interfaces/interface")
|
||||
if interface:
|
||||
for eles in interface:
|
||||
if eles.tag in ["isL2SwitchPort"]:
|
||||
|
|
Loading…
Reference in a new issue