From b84f5964b69f9a2df8087a7cc6c38416df5103e7 Mon Sep 17 00:00:00 2001 From: Prince Date: Fri, 9 Feb 2018 01:14:11 +0000 Subject: [PATCH 1/2] Set FEC to reed-solomon if the port speed is 100G --- src/sonic-config-engine/minigraph.py | 2 ++ 1 file changed, 2 insertions(+) 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] From a8544fdd0248ab812373c81964b4f82d957adff9 Mon Sep 17 00:00:00 2001 From: Prince Date: Fri, 9 Feb 2018 02:14:36 +0000 Subject: [PATCH 2/2] Added unit test --- src/sonic-config-engine/tests/sample_output/ports.json | 2 +- src/sonic-config-engine/tests/simple-sample-graph.xml | 2 +- src/sonic-config-engine/tests/test_cfggen.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) 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'}")