[minigraph.py]: Use default namespace for <Address> (#3695)

* [minigraph.py]: Use default namespace for <Address>
This commit is contained in:
pavel-shirshov 2019-11-01 07:36:19 -07:00 committed by Ying Xie
parent 90fb363958
commit b9b56c91ff
2 changed files with 3 additions and 3 deletions

View File

@ -359,8 +359,8 @@ def parse_cpg(cpg, hname):
'name': name,
'ip_range': ip_range_group
}
if bgpPeer.find(str(QName(ns1, "Address"))) is not None:
bgp_peers_with_range[name]['src_address'] = bgpPeer.find(str(QName(ns1, "Address"))).text
if bgpPeer.find(str(QName(ns, "Address"))) is not None:
bgp_peers_with_range[name]['src_address'] = bgpPeer.find(str(QName(ns, "Address"))).text
if bgpPeer.find(str(QName(ns1, "PeerAsn"))) is not None:
bgp_peers_with_range[name]['peer_asn'] = bgpPeer.find(str(QName(ns1, "PeerAsn"))).text
else:

View File

@ -174,7 +174,7 @@ class TestCfgGen(TestCase):
def test_minigraph_peers_with_range(self):
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)'
output = self.run_script(argument)
self.assertEqual(output.strip(), "[{'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]")
self.assertEqual(output.strip(), "[{'src_address': '10.1.0.32', 'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]")
def test_minigraph_deployment_id(self):
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"'