From b9f2080894a189c118b21dc045baa26eb203a616 Mon Sep 17 00:00:00 2001 From: Wenda Date: Wed, 16 May 2018 20:57:33 +0000 Subject: [PATCH 01/20] Add noise config for PortChannel & EthernetInterface in simple-sample-graph.xml --- .../tests/simple-sample-graph.xml | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 6e351e1cd003..743719e1d52e 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -125,6 +125,11 @@ fortyGigE0/4 + + PortChannel1001 + Ethernet1;Ethernet2 + + @@ -240,7 +245,20 @@ true true 1 - fortyGigE0/1 + Ethernet1 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + true + 1 + Ethernet2 false 0 From 696e791da863d33bb2ab092ec381e25c23c3305d Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 05:46:37 +0000 Subject: [PATCH 02/20] Add noise config for PORTCHANNEL_INTERFACE in simple-sample-graph.xml Signed-off-by: Wenda --- src/sonic-config-engine/tests/simple-sample-graph.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 743719e1d52e..3865838c5c00 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -152,6 +152,16 @@ PortChannel01 FC00::71/126 + + + PortChannel1001 + 10.0.0.57/31 + + + + PortChannel1001 + FC00::72/126 + fortyGigE0/0 From b5e43d699026325543aed6ec2782a234e86b1a6c Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 19:16:24 +0000 Subject: [PATCH 03/20] Add noice config for DEVICE_NEIGHBOR in t0-sample-graph.xml Add unit test against introducing ports not existing in port_config.ini into DEVICE_NEIGHBOR Signed-off-by: Wenda --- src/sonic-config-engine/tests/t0-sample-graph.xml | 9 +++++++++ src/sonic-config-engine/tests/test_cfggen.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index ce0177d4c158..7108d614c4c4 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -338,6 +338,15 @@ switch-t0 fortyGigE0/124 + + DeviceInterfaceLink + switch-t0 + Ethernet2 + true + ARISTA05T1 + Ethernet1/33 + true + diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 901b882f7048..4e01600b6358 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -130,6 +130,15 @@ def test_minigraph_neighbors(self): output = self.run_script(argument) self.assertEqual(output.strip(), "{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") + def test_minigraph_extra_neighbors(self): + argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v DEVICE_NEIGHBOR' + output = self.run_script(argument) + self.assertEqual(output.strip(), \ + "{'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, " + "'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, " + "'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}, " + "'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}}") + def test_minigraph_bgp(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"' output = self.run_script(argument) From f3c97e01c32d2080c024d2cef0656b24ba0a5e4f Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 23:01:49 +0000 Subject: [PATCH 04/20] DeviceInterfaceLink in minigraph.xml can contain port not existing in port_config.ini but contraining non-zero Bandwidth attribute Add noice config in simple-sample-graph.xml to capture the case that such a port is leaked into config_db.json Signed-off-by: Wenda --- src/sonic-config-engine/tests/simple-sample-graph.xml | 11 +++++++++++ src/sonic-config-engine/tests/t0-sample-graph.xml | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 3865838c5c00..0d5a7b1358d8 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -208,6 +208,17 @@ fortyGigE0/8 true + + DeviceInterfaceLink + true + 10000 + switch-t0 + Ethernet2 + true + ARISTA05T1 + Ethernet1/33 + true + diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index 7108d614c4c4..a48c8e861e6e 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -340,6 +340,8 @@ DeviceInterfaceLink + true + 10000 switch-t0 Ethernet2 true From 6518266c7932da7008ee5cc4c3e2b078b0d24e94 Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 05:51:39 +0000 Subject: [PATCH 05/20] Protect PORTCHANNEL from ports not existing in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 443893c66c25..e860fdcbd845 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -474,7 +474,15 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] results['PORT'] = ports + + port_set = set(ports.keys()) + for (pc_name, mbr_map) in pcs.items(): + # remove portchannels that contain ports not existing in port_config.ini + if not set(mbr_map['members']).issubset(port_set): + del pcs[pc_name] + results['PORTCHANNEL'] = pcs + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members From 097f1e9824a941c821af06341ca8be502f840804 Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 17:02:27 +0000 Subject: [PATCH 06/20] Protect PORTCHANNEL_INTERFACE from portchannels containing ports not existing in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index e860fdcbd845..2823fe550a7e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -447,7 +447,6 @@ def parse_xml(filename, platform=None, port_config_file=None): results['INTERFACE'] = phyport_intfs results['VLAN_INTERFACE'] = vlan_intfs - results['PORTCHANNEL_INTERFACE'] = pc_intfs for port_name in port_speeds_default: # ignore port not in port_config.ini @@ -483,6 +482,14 @@ def parse_xml(filename, platform=None, port_config_file=None): results['PORTCHANNEL'] = pcs + + for pc_intf in pc_intfs.keys(): + # remove portchannels not in PORTCHANNEL dictionary + if pc_intf[0] not in pcs: + del pc_intfs[pc_intf] + + results['PORTCHANNEL_INTERFACE'] = pc_intfs + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members From 1f293e2e493e0da893392e4a69ba7644caf25379 Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 00:18:03 +0000 Subject: [PATCH 07/20] Protect DEVICE_NEIGHBOR from ports not existing in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2823fe550a7e..e2de65cd5f6a 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -493,7 +493,13 @@ def parse_xml(filename, platform=None, port_config_file=None): results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members + for nghbr in neighbors.keys(): + # remove port not in port_config.ini + if nghbr not in ports: + del neighbors[nghbr] + results['DEVICE_NEIGHBOR'] = neighbors + results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key.lower() != hostname.lower() } results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) From 6db9a0aae7b13e33ac86e30d3a0e3fb8d3facd77 Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 01:32:41 +0000 Subject: [PATCH 08/20] Add noise config Ethernet1 in DeviceInterfaceLinks in simple-sample-graph.xml as it is in PortChannel1001 Signed-off-by: Wenda --- .../tests/simple-sample-graph.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 0d5a7b1358d8..ff4001fbfc85 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -213,9 +213,20 @@ true 10000 switch-t0 - Ethernet2 + Ethernet1 true ARISTA05T1 + Ethernet1/32 + true + + + DeviceInterfaceLink + true + 10000 + switch-t0 + Ethernet2 + true + ARISTA06T1 Ethernet1/33 true From 987bc92b17feeaa4a7618b0a14b3b002402c4e97 Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 01:32:41 +0000 Subject: [PATCH 09/20] Add noise config Ethernet1 in DeviceInterfaceLinks in simple-sample-graph.xml as it is in PortChannel1001 Signed-off-by: Wenda --- .../tests/simple-sample-graph.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 0d5a7b1358d8..ff4001fbfc85 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -213,9 +213,20 @@ true 10000 switch-t0 - Ethernet2 + Ethernet1 true ARISTA05T1 + Ethernet1/32 + true + + + DeviceInterfaceLink + true + 10000 + switch-t0 + Ethernet2 + true + ARISTA06T1 Ethernet1/33 true From 9021233bfc9ea0e0a78bd3e59710d05e20180774 Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 05:51:39 +0000 Subject: [PATCH 10/20] Protect PORTCHANNEL from ports not existing in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 443893c66c25..e860fdcbd845 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -474,7 +474,15 @@ def parse_xml(filename, platform=None, port_config_file=None): ports.setdefault(port_name, {})['description'] = port_descriptions[port_name] results['PORT'] = ports + + port_set = set(ports.keys()) + for (pc_name, mbr_map) in pcs.items(): + # remove portchannels that contain ports not existing in port_config.ini + if not set(mbr_map['members']).issubset(port_set): + del pcs[pc_name] + results['PORTCHANNEL'] = pcs + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members From d6046850167b25181a140a88d7c5209d8c12bd45 Mon Sep 17 00:00:00 2001 From: Wenda Date: Thu, 17 May 2018 17:02:27 +0000 Subject: [PATCH 11/20] Protect PORTCHANNEL_INTERFACE from portchannels containing ports not existing in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index e860fdcbd845..2823fe550a7e 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -447,7 +447,6 @@ def parse_xml(filename, platform=None, port_config_file=None): results['INTERFACE'] = phyport_intfs results['VLAN_INTERFACE'] = vlan_intfs - results['PORTCHANNEL_INTERFACE'] = pc_intfs for port_name in port_speeds_default: # ignore port not in port_config.ini @@ -483,6 +482,14 @@ def parse_xml(filename, platform=None, port_config_file=None): results['PORTCHANNEL'] = pcs + + for pc_intf in pc_intfs.keys(): + # remove portchannels not in PORTCHANNEL dictionary + if pc_intf[0] not in pcs: + del pc_intfs[pc_intf] + + results['PORTCHANNEL_INTERFACE'] = pc_intfs + results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members From c9f22b32edf4bc664c901552ef98f9b7292bad5b Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 00:18:03 +0000 Subject: [PATCH 12/20] Protect DEVICE_NEIGHBOR from ports not existing in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 2823fe550a7e..e2de65cd5f6a 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -493,7 +493,13 @@ def parse_xml(filename, platform=None, port_config_file=None): results['VLAN'] = vlans results['VLAN_MEMBER'] = vlan_members + for nghbr in neighbors.keys(): + # remove port not in port_config.ini + if nghbr not in ports: + del neighbors[nghbr] + results['DEVICE_NEIGHBOR'] = neighbors + results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key.lower() != hostname.lower() } results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) From 955e4be33edd84946147da783be84dab5366dc12 Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 17:19:36 +0000 Subject: [PATCH 13/20] Correct space in minigraph.py Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index e2de65cd5f6a..bd76c1edcbee 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -414,7 +414,7 @@ def parse_xml(filename, platform=None, port_config_file=None): (port_speeds_default, port_descriptions) = parse_deviceinfo(child, hwsku) current_device = [devices[key] for key in devices if key.lower() == hostname.lower()][0] - results = {} + results = {} results['DEVICE_METADATA'] = {'localhost': { 'bgp_asn': bgp_asn, 'deployment_id': deployment_id, From 1e7965636995112cb4e930d61d731d63b779ba05 Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 17:20:33 +0000 Subject: [PATCH 14/20] Does not allow non-port_config.ini port to get into the port list Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index bd76c1edcbee..d04f81237ffc 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -459,6 +459,10 @@ def parse_xml(filename, platform=None, port_config_file=None): # if port_name is not in port_config.ini, still consider it. # and later swss will pick up and behave on-demand port break-up. # if on-deman port break-up is not supported on a specific platform, swss will return error. + # ignore port not in port_config.ini + if port_name not in ports: + continue + ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name] for port_name, port in ports.items(): From 6c3026a3cbef2d8b2ced944da96e46ac7e3c539a Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 22:32:34 +0000 Subject: [PATCH 15/20] Check PORTCHANNEL against PORT list only if port_config_file exists Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 93a0bf2177aa..1a9615d73200 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -475,11 +475,13 @@ def parse_xml(filename, platform=None, port_config_file=None): results['PORT'] = ports - port_set = set(ports.keys()) - for (pc_name, mbr_map) in pcs.items(): - # remove portchannels that contain ports not existing in port_config.ini - if not set(mbr_map['members']).issubset(port_set): - del pcs[pc_name] + if port_config_file: + port_set = set(ports.keys()) + for (pc_name, mbr_map) in pcs.items(): + # remove portchannels that contain ports not existing in port_config.ini + # when port_config.ini exists + if not set(mbr_map['members']).issubset(port_set): + del pcs[pc_name] results['PORTCHANNEL'] = pcs From 8caa0110bc2e723631c5016a77864bb76ba7ec37 Mon Sep 17 00:00:00 2001 From: Wenda Date: Fri, 18 May 2018 23:06:21 +0000 Subject: [PATCH 16/20] Correct format Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 1a9615d73200..9ff337f9561f 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -502,7 +502,6 @@ def parse_xml(filename, platform=None, port_config_file=None): del neighbors[nghbr] results['DEVICE_NEIGHBOR'] = neighbors - results['DEVICE_NEIGHBOR_METADATA'] = { key:devices[key] for key in devices if key.lower() != hostname.lower() } results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers) results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers) From 37f1f8100ff4ff3d9cad1fb96ab564969ef8c615 Mon Sep 17 00:00:00 2001 From: Wenda Date: Sat, 19 May 2018 01:41:50 +0000 Subject: [PATCH 17/20] print warning when a port coming from DeviceInterfaceLink is not in port_config.ini Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 1 + src/sonic-config-engine/tests/test_cfggen.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 9ff337f9561f..0faf86bb74af 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -458,6 +458,7 @@ def parse_xml(filename, platform=None, port_config_file=None): for port_name in port_speed_png: # not consider port not in port_config.ini if port_name not in ports: + print >> sys.stderr, "Warning: drop '%s' from enlisting in PORT list" % port_name continue ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name] diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 4e01600b6358..39387bdda923 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -79,6 +79,7 @@ def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument, True) self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" + "Warning: drop 'Ethernet2' from enlisting in PORT list\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}," From 472c499f93055192f25afb6ab7c29f15dbe10dd5 Mon Sep 17 00:00:00 2001 From: Wenda Date: Tue, 22 May 2018 23:47:08 +0000 Subject: [PATCH 18/20] Change Ethernet1 and 2 to fortyGigE0/1 and 2,respectively Signed-off-by: Wenda --- src/sonic-config-engine/tests/simple-sample-graph.xml | 2 +- src/sonic-config-engine/tests/t0-sample-graph.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index ff4001fbfc85..efa282120464 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -127,7 +127,7 @@ PortChannel1001 - Ethernet1;Ethernet2 + fortyGigE0/1;fortyGigE0/2 diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index a48c8e861e6e..fa0f9d858b92 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -343,7 +343,7 @@ true 10000 switch-t0 - Ethernet2 + fortyGigE0/1 true ARISTA05T1 Ethernet1/33 From c3c46ba3ab030f5aa86d9fe314c6bf778c076475 Mon Sep 17 00:00:00 2001 From: Wenda Date: Tue, 22 May 2018 23:47:08 +0000 Subject: [PATCH 19/20] Change Ethernet1 and 2 to fortyGigE0/1 and 2,respectively Signed-off-by: Wenda --- src/sonic-config-engine/tests/simple-sample-graph.xml | 6 +++--- src/sonic-config-engine/tests/t0-sample-graph.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index ff4001fbfc85..f5054bb084d3 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -127,7 +127,7 @@ PortChannel1001 - Ethernet1;Ethernet2 + fortyGigE0/1;fortyGigE0/2 @@ -213,7 +213,7 @@ true 10000 switch-t0 - Ethernet1 + fortyGigE0/1 true ARISTA05T1 Ethernet1/32 @@ -224,7 +224,7 @@ true 10000 switch-t0 - Ethernet2 + fortyGigE0/2 true ARISTA06T1 Ethernet1/33 diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index a48c8e861e6e..fa0f9d858b92 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -343,7 +343,7 @@ true 10000 switch-t0 - Ethernet2 + fortyGigE0/1 true ARISTA05T1 Ethernet1/33 From 293ac1aeda397fd6b5001774b09b3eaaac12ae73 Mon Sep 17 00:00:00 2001 From: Wenda Date: Wed, 23 May 2018 01:28:17 +0000 Subject: [PATCH 20/20] print warning when ignoring ports, portchannels, portchannel interfaces, and device neighbors Update t0-sample-graph.xml with interface name 'fortyGigE0/2' and the ACL_TABLE output Signed-off-by: Wenda --- src/sonic-config-engine/minigraph.py | 5 ++++- src/sonic-config-engine/tests/t0-sample-graph.xml | 2 +- src/sonic-config-engine/tests/test_cfggen.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 0faf86bb74af..595915d9bee9 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -458,7 +458,7 @@ def parse_xml(filename, platform=None, port_config_file=None): for port_name in port_speed_png: # not consider port not in port_config.ini if port_name not in ports: - print >> sys.stderr, "Warning: drop '%s' from enlisting in PORT list" % port_name + print >> sys.stderr, "Warning: ignore interface '%s' as it is not in the port_config.ini" % port_name continue ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name] @@ -482,6 +482,7 @@ def parse_xml(filename, platform=None, port_config_file=None): # remove portchannels that contain ports not existing in port_config.ini # when port_config.ini exists if not set(mbr_map['members']).issubset(port_set): + print >> sys.stderr, "Warning: ignore '%s' as part of its member interfaces is not in the port_config.ini" % pc_name del pcs[pc_name] results['PORTCHANNEL'] = pcs @@ -490,6 +491,7 @@ def parse_xml(filename, platform=None, port_config_file=None): for pc_intf in pc_intfs.keys(): # remove portchannels not in PORTCHANNEL dictionary if pc_intf[0] not in pcs: + print >> sys.stderr, "Warning: ignore '%s' interface '%s' as '%s' is not in the valid PortChannel list" % (pc_intf[0], pc_intf[1], pc_intf[0]) del pc_intfs[pc_intf] results['PORTCHANNEL_INTERFACE'] = pc_intfs @@ -500,6 +502,7 @@ def parse_xml(filename, platform=None, port_config_file=None): for nghbr in neighbors.keys(): # remove port not in port_config.ini if nghbr not in ports: + print >> sys.stderr, "Warning: ignore interface '%s' in DEVICE_NEIGHBOR as it is not in the port_config.ini" % nghbr del neighbors[nghbr] results['DEVICE_NEIGHBOR'] = neighbors diff --git a/src/sonic-config-engine/tests/t0-sample-graph.xml b/src/sonic-config-engine/tests/t0-sample-graph.xml index fa0f9d858b92..5eace767c468 100644 --- a/src/sonic-config-engine/tests/t0-sample-graph.xml +++ b/src/sonic-config-engine/tests/t0-sample-graph.xml @@ -343,7 +343,7 @@ true 10000 switch-t0 - fortyGigE0/1 + fortyGigE0/2 true ARISTA05T1 Ethernet1/33 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 39387bdda923..37b66a27b4c4 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -79,7 +79,8 @@ def test_minigraph_acl(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v ACL_TABLE' output = self.run_script(argument, True) self.assertEqual(output.strip(), "Warning: Ignoring Control Plane ACL NTP_ACL without type\n" - "Warning: drop 'Ethernet2' from enlisting in PORT list\n" + "Warning: ignore interface 'fortyGigE0/2' as it is not in the port_config.ini\n" + "Warning: ignore interface 'fortyGigE0/2' in DEVICE_NEIGHBOR as it is not in the port_config.ini\n" "{'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL'}," " 'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL'}," " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']},"