Skip to content

Commit

Permalink
update to fix a bug (#58227)
Browse files Browse the repository at this point in the history
(cherry picked from commit e0f3e40)
  • Loading branch information
yuandongx authored and abadger committed Jul 17, 2019
1 parent 6491c5c commit 98725b2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/ansible/modules/network/cloudengine/ce_evpn_bd_vni.py
Expand Up @@ -248,6 +248,7 @@
sample: true
'''

import re
import copy
from xml.etree import ElementTree
from ansible.module_utils.basic import AnsibleModule
Expand All @@ -260,7 +261,7 @@
<nvo3Vni2Bds>
<nvo3Vni2Bd>
<vniId></vniId>
<bdId>%s</bdId>
<bdId></bdId>
</nvo3Vni2Bd>
</nvo3Vni2Bds>
</nvo3>
Expand Down Expand Up @@ -552,7 +553,7 @@ def get_evpn_instance_info(self):
replace('xmlns="http://www.huawei.com/netconf/vrp"', "")

root = ElementTree.fromstring(xml_str)
evpn_inst = root.find("data/evpn/evpnInstances/evpnInstance")
evpn_inst = root.find("evpn/evpnInstances/evpnInstance")
if evpn_inst:
for eles in evpn_inst:
if eles.tag in ["evpnAutoRD", "evpnRD", "evpnRTs", "evpnAutoRTs"]:
Expand Down Expand Up @@ -1006,9 +1007,9 @@ def check_params(self):
def check_vni_bd(self):
"""Check whether vxlan vni is configured in BD view"""

xml_str = CE_NC_GET_VNI_BD % self.bridge_domain_id
xml_str = CE_NC_GET_VNI_BD
xml_str = get_nc_config(self.module, xml_str)
if "<data/>" in xml_str:
if "<data/>" in xml_str or not re.findall(r'<vniId>\S+</vniId>\s+<bdId>%s</bdId>' % self.bridge_domain_id, xml_str):
self.module.fail_json(
msg='Error: The vxlan vni is not configured or the bridge domain id is invalid.')

Expand Down

0 comments on commit 98725b2

Please sign in to comment.