diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 025fecb35e26..f6083853c591 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -418,6 +418,8 @@ def parse_xml(filename, platform=None, port_config_file=None): for port_name in port_speeds: ports.setdefault(port_name, {})['speed'] = port_speeds[port_name] + if port_speeds[port_name] == '100000': + ports.setdefault(port_name, {})['fec'] = 'rs' for port_name in port_descriptions: ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 6536c620f8cf..7533fb7377ef 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -22,7 +22,7 @@ }, { "PORT_TABLE:Ethernet12": { - "speed": "1000000", + "speed": "100000", "description": "Interface description" }, "OP": "SET" diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 0201aefd3b44..d42a2650321e 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -260,7 +260,7 @@ false 0 0 - 1000000 + 100000 Interface description diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 7d0c7b516cfa..3ee689622577 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -140,3 +140,6 @@ def test_minigraph_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet8\']"' output = self.run_script(argument) self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/8', 'lanes': '37,38,39,40', 'description': 'Interface description', 'speed': '40000'}") + argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' + output = self.run_script(argument) + self.assertEqual(output.strip(), "{'alias': 'fortyGigE0/12', 'lanes': '33,34,35,36', 'fec': 'rs', 'speed': '100000', 'description': 'Interface description'}")