Skip to content

Commit

Permalink
[minigraph.py]: Make mux_cable attribute true/false
Browse files Browse the repository at this point in the history
Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
  • Loading branch information
theasianpianist committed Oct 23, 2020
1 parent ff78b68 commit 191b817
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ def parse_png(png, hname):
if intf_name in port_alias_map:
intf_name = port_alias_map[intf_name]

connection_port = link.find(str(QName(ns, "StartPort"))).text
mux_cable_ports[intf_name] = connection_port
mux_cable_ports[intf_name] = "true"

return (neighbors, devices, console_dev, console_port, mgmt_dev, mgmt_port, port_speeds, console_ports, mux_cable_ports)

Expand Down
4 changes: 2 additions & 2 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ def test_minigraph_neighbor_interfaces(self):
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict(
"{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000', 'mux_cable': 'U'}, "
"{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000', 'mux_cable': 'true'}, "
"'Ethernet0': {'lanes': '29,30,31,32', 'description': 'switch-01t1:port1', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/0', 'admin_status': 'up', 'speed': '10000'}, "
"'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'mux_cable': 'L'}, "
"'Ethernet4': {'lanes': '25,26,27,28', 'description': 'fortyGigE0/4', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '25000', 'mux_cable': 'true'}, "
"'Ethernet108': {'alias': 'fortyGigE0/108', 'pfc_asym': 'off', 'lanes': '81,82,83,84', 'description': 'fortyGigE0/108', 'mtu': '9100'}, "
"'Ethernet100': {'alias': 'fortyGigE0/100', 'pfc_asym': 'off', 'lanes': '125,126,127,128', 'description': 'fortyGigE0/100', 'mtu': '9100'}, "
"'Ethernet104': {'alias': 'fortyGigE0/104', 'pfc_asym': 'off', 'lanes': '85,86,87,88', 'description': 'fortyGigE0/104', 'mtu': '9100'}, "
Expand Down
4 changes: 2 additions & 2 deletions src/sonic-config-engine/tests/test_minigraph_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ def test_minigraph_bgp_mon(self):
def test_mux_cable_parsing(self):
result = minigraph.parse_xml(self.sample_graph, port_config_file=self.port_config)

expected_mux_cable_ports = {"Ethernet4":"L", "Ethernet8":"U"}
expected_mux_cable_ports = ["Ethernet4", "Ethernet8"]
port_table = result['PORT']
for port_name, port in port_table.items():
if port_name in expected_mux_cable_ports:
self.assertEqual(port["mux_cable"], expected_mux_cable_ports[port_name])
self.assertTrue(port["mux_cable"])
else:
self.assertTrue("mux_cable" not in port)

0 comments on commit 191b817

Please sign in to comment.