Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minigraph.py]: Add VLAN_INTERFACE attributes for dual ToR devices #5951

Merged
merged 2 commits into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,10 +1097,24 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
for intf in intfs:
if intf[0][0:4] == 'Vlan':
vlan_intfs[intf] = {}
vlan_intfs[intf[0]] = {}

if bool(results['PEER_SWITCH']):
vlan_intfs[intf[0]] = {
'proxy_arp': 'enabled',
'grat_arp': 'enabled'
}
else:
vlan_intfs[intf[0]] = {}
elif intf[0] in vlan_invert_mapping:
vlan_intfs[(vlan_invert_mapping[intf[0]], intf[1])] = {}
vlan_intfs[vlan_invert_mapping[intf[0]]] = {}

if bool(results['PEER_SWITCH']):
vlan_intfs[vlan_invert_mapping[intf[0]]] = {
'proxy_arp': 'enabled',
'grat_arp': 'enabled'
}
else:
vlan_intfs[vlan_invert_mapping[intf[0]]] = {}
elif intf[0][0:11] == 'PortChannel':
pc_intfs[intf] = {}
pc_intfs[intf[0]] = {}
Expand Down
14 changes: 13 additions & 1 deletion src/sonic-config-engine/tests/test_minigraph_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,23 @@ def test_minigraph_vlan_members(self):
output = self.run_script(argument)
self.assertEqual(output.strip(), "{('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}}")

def test_minigraph_vlan_interfaces(self):
def test_minigraph_vlan_interfaces_keys(self):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()|list"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "[('Vlan1000', '192.168.0.1/27'), 'Vlan1000']")

def test_minigraph_vlan_interfaces(self):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE"'
output = self.run_script(argument)
expected_table = {
theasianpianist marked this conversation as resolved.
Show resolved Hide resolved
'Vlan1000|192.168.0.1/27': {},
'Vlan1000': {
'proxy_arp': 'enabled',
'grat_arp': 'enabled'
}
}
self.assertEqual(utils.to_dict(output.strip()), expected_table)

def test_minigraph_portchannels(self):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v PORTCHANNEL'
output = self.run_script(argument)
Expand Down