[minigraph.py]: Parse VLAN MAC address from minigraph when present (#5726)
This commit is contained in:
parent
e0b09d0998
commit
a639021af2
@ -383,6 +383,10 @@ def parse_dpg(dpg, hname):
|
|||||||
vdhcpserver_list = vintfdhcpservers.split(';')
|
vdhcpserver_list = vintfdhcpservers.split(';')
|
||||||
vlan_attributes['dhcp_servers'] = vdhcpserver_list
|
vlan_attributes['dhcp_servers'] = vdhcpserver_list
|
||||||
|
|
||||||
|
vlanmac = vintf.find(str(QName(ns, "MacAddress")))
|
||||||
|
if vlanmac != None:
|
||||||
|
vlan_attributes['mac'] = vlanmac.text
|
||||||
|
|
||||||
sonic_vlan_name = "Vlan%s" % vlanid
|
sonic_vlan_name = "Vlan%s" % vlanid
|
||||||
if sonic_vlan_name != vintfname:
|
if sonic_vlan_name != vintfname:
|
||||||
vlan_attributes['alias'] = vintfname
|
vlan_attributes['alias'] = vintfname
|
||||||
|
@ -134,6 +134,7 @@
|
|||||||
<VlanID>1000</VlanID>
|
<VlanID>1000</VlanID>
|
||||||
<Tag>1000</Tag>
|
<Tag>1000</Tag>
|
||||||
<Subnets>192.168.0.0/27</Subnets>
|
<Subnets>192.168.0.0/27</Subnets>
|
||||||
|
<MacAddress>00:aa:bb:cc:dd:ee</MacAddress>
|
||||||
</VlanInterface>
|
</VlanInterface>
|
||||||
</VlanInterfaces>
|
</VlanInterfaces>
|
||||||
<IPInterfaces>
|
<IPInterfaces>
|
||||||
|
@ -83,7 +83,7 @@ class TestCfgGenCaseInsensitive(TestCase):
|
|||||||
output = self.run_script(argument)
|
output = self.run_script(argument)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
utils.to_dict(output.strip()),
|
utils.to_dict(output.strip()),
|
||||||
utils.to_dict("{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}")
|
utils.to_dict("{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000', 'mac': '00:aa:bb:cc:dd:ee' }}")
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_minigraph_vlan_members(self):
|
def test_minigraph_vlan_members(self):
|
||||||
|
Reference in New Issue
Block a user