From 4766fcf100f1709dd598def1e96d74a69db12eb4 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 3 Apr 2021 01:41:30 +0000 Subject: [PATCH 1/3] [submodule update] sonic-db-syncd df46ed418e661a9bccdb2639d8873def356f8ba0 (HEAD -> master, origin/master, origin/HEAD) Fix the LLDP_LOC_CHASSIS not getting populated if no remote neighbors are present (#39) e487532e11cc0e97cfce573b6b997fdd0beeb660 [CI] Set up CI&PR with Azure Pipelines (#38) 3c9f488490a1dbded20dbf2d8a88a5ab4dbda8df Replace swsssdk's SonicV2Connector with swsscommon's implementation (#35) Signed-off-by: Abhishek Dosi --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 5cc29a1b32d8..df46ed418e66 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 5cc29a1b32d8d1f4dfbc967bfea2727c50a49c76 +Subproject commit df46ed418e661a9bccdb2639d8873def356f8ba0 From 3e7418222a9514ff8128b5f31fcac8e7da8da8c6 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Wed, 29 Sep 2021 22:16:21 +0000 Subject: [PATCH 2/3] Initial Commit for Chassis in Packet mode and multi-asic. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Internal BGP Peering between LCx-ASICy is done using Loopback4096 • Internal BGP Peer will be classified as BGP_INTERNAL_NEIGHBOR with source updated as Loopback4096 • DEVICE_METADATA will have “switch_type” define as “chassis-packet”. We already have “voq” define. This will be used in BGP template. • Static Routes are define using SONiC schema. * Fixed Vlan Sub Interface Parsing in Graph when configured on Port-Channel. * Added Unit test cases of graph and BGP template changes. Signed-off-by: Abhishek Dosi --- .../docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 | 10 +- .../templates/internal/peer-group.conf.j2 | 11 +- src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py | 17 +- src/sonic-bgpcfgd/bgpcfgd/template.py | 4 +- .../peer-group.conf/param_chasiss_packet.json | 13 + .../result_chasiss_packet.conf | 22 + .../bgpd.main.conf.j2/packet_chassis.conf | 67 +++ .../bgpd.main.conf.j2/packet_chassis.json | 35 ++ src/sonic-bgpcfgd/tests/test_sonic-cfggen.py | 6 + src/sonic-config-engine/minigraph.py | 37 +- .../tests/sample-chassis-packet-lc-graph.xml | 456 ++++++++++++++++++ .../sample-chassis-packet-lc-port-config.ini | 60 +++ .../tests/sample-graph-resource-type.xml | 3 +- .../tests/sample-graph-subintf.xml | 3 +- .../tests/simple-sample-graph.xml | 3 +- src/sonic-config-engine/tests/test_cfggen.py | 27 +- 16 files changed, 743 insertions(+), 31 deletions(-) create mode 100644 src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json create mode 100644 src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf create mode 100644 src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf create mode 100644 src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json create mode 100644 src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml create mode 100644 src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index 7d6bc4ef04ae..1453d6fc8029 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -33,7 +33,7 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi {% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} {% set multi_asic = True %} {% endif %} -{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} route-map HIDE_INTERNAL permit 10 set community no-export {% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %} @@ -63,7 +63,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endif %} ! {# set router-id #} -{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }} {% else %} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }} @@ -71,7 +71,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {# advertise loopback #} network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32 -{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL {% endif %} ! @@ -80,7 +80,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64 exit-address-family {% endif %} -{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq'%} +{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %} address-family ipv6 network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL @@ -102,7 +102,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% endblock vlan_advertisement %} ! ! -{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} +{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} address-family ipv4 redistribute connected route-map HIDE_INTERNAL exit-address-family diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 index c0ee4d99b796..c5f3f0b2f3a9 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/internal/peer-group.conf.j2 @@ -1,10 +1,15 @@ ! ! template: bgpd/templates/internal/peer-group.conf.j2 +{% from "common/functions.conf.j2" import get_ipv4_loopback_address %} +{% from "common/functions.conf.j2" import get_ipv6_loopback_address %} ! neighbor INTERNAL_PEER_V4 peer-group neighbor INTERNAL_PEER_V6 peer-group address-family ipv4 -{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} + +{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} + neighbor INTERNAL_PEER_V4 update-source {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }} +{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} neighbor INTERNAL_PEER_V4 route-reflector-client {% endif %} neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound @@ -13,7 +18,9 @@ neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out exit-address-family address-family ipv6 -{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} +{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} + neighbor INTERNAL_PEER_V4 update-source {{ get_ipv6_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }} +{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} neighbor INTERNAL_PEER_V6 route-reflector-client {% endif %} neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py index 3ab7dba4f612..c787ae2abe69 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py @@ -125,6 +125,9 @@ def __init__(self, common_objs, db_name, table_name, peer_type, check_neig_meta) if self.check_deployment_id: deps.append(("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/deployment_id")) + if self.peer_type == 'internal': + deps.append(("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME, "Loopback4096")) + super(BGPPeerMgrBase, self).__init__( common_objs, deps, @@ -160,11 +163,17 @@ def add_peer(self, vrf, nbr, data): print_data = vrf, nbr, data bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] # - lo0_ipv4 = self.get_lo0_ipv4() + lo0_ipv4 = self.get_lo_ipv4("Loopback0|") if lo0_ipv4 is None: log_warn("Loopback0 ipv4 address is not presented yet") return False # + if self.peer_type == 'internal': + lo4096_ipv4 = self.get_lo_ipv4("Loopback4096|") + if lo4096_ipv4 is None: + log_warn("Loopback4096 ipv4 address is not presented yet") + return False + if "local_addr" not in data: log_warn("Peer %s. Missing attribute 'local_addr'" % nbr) else: @@ -299,15 +308,15 @@ def apply_op(self, cmd, vrf): self.cfg_mgr.push(cmd) return True - def get_lo0_ipv4(self): + def get_lo_ipv4(self, loopback_str): """ Extract Loopback0 ipv4 address from the Directory :return: ipv4 address for Loopback0, None if nothing found """ loopback0_ipv4 = None for loopback in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME).keys(): - if loopback.startswith("Loopback0|"): - loopback0_prefix_str = loopback.replace("Loopback0|", "") + if loopback.startswith(loopback_str): + loopback0_prefix_str = loopback.replace(loopback_str, "") loopback0_ip_str = loopback0_prefix_str[:loopback0_prefix_str.find('/')] if TemplateFabric.is_ipv4(loopback0_ip_str): loopback0_ipv4 = loopback0_ip_str diff --git a/src/sonic-bgpcfgd/bgpcfgd/template.py b/src/sonic-bgpcfgd/bgpcfgd/template.py index e88073881171..a2b476e6b2c9 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/template.py +++ b/src/sonic-bgpcfgd/bgpcfgd/template.py @@ -75,7 +75,7 @@ def prefix_attr(attr, value): return None else: try: - prefix = netaddr.IPNetwork(str(value)) + prefix = netaddr.IPNetwork(str(value).strip()) except (netaddr.NotRegisteredError, netaddr.AddrFormatError, netaddr.AddrConversionError): return None return str(getattr(prefix, attr)) @@ -105,4 +105,4 @@ def pfx_filter(value): log_err("'%s' is invalid ip address" % ip_address) else: table[key] = val - return table \ No newline at end of file + return table diff --git a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json new file mode 100644 index 000000000000..956758febcfe --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/param_chasiss_packet.json @@ -0,0 +1,13 @@ +{ + "CONFIG_DB__DEVICE_METADATA": { + "localhost": { + "type": "SpineRouter", + "sub_role": "BackEnd", + "switch_type": "chassis-packet" + } + }, + "CONFIG_DB__LOOPBACK_INTERFACE": { + "Loopback4096|10.10.10.10/32": {}, + "Loopback4096|2603:10e2:400::3/128": {} + } +} diff --git a/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf new file mode 100644 index 000000000000..08ef259e0899 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/internal/peer-group.conf/result_chasiss_packet.conf @@ -0,0 +1,22 @@ +! +! template: bgpd/templates/internal/peer-group.conf.j2 +! + neighbor INTERNAL_PEER_V4 peer-group + neighbor INTERNAL_PEER_V6 peer-group + address-family ipv4 + neighbor INTERNAL_PEER_V4 update-source 10.10.10.10 + neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V4 allowas-in 1 + neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in + neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out + exit-address-family + address-family ipv6 + neighbor INTERNAL_PEER_V4 update-source 2603:10e2:400::3 + neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound + neighbor INTERNAL_PEER_V6 allowas-in 1 + neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in + neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out + exit-address-family +! +! end of template: bgpd/templates/internal/peer-group.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf new file mode 100644 index 000000000000..b48617a6d840 --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.conf @@ -0,0 +1,67 @@ +! +! template: bgpd/bgpd.main.conf.j2 +! +! bgp multiple-instance +! +! BGP configuration +! +! TSA configuration +! +ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32 +! +ipv6 prefix-list PL_LoopbackV6 permit fc00::/64 +! +ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24 +! +ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64 +! +route-map HIDE_INTERNAL permit 10 + set community no-export +! +! +router bgp 55555 +! + bgp log-neighbor-changes + no bgp default ipv4-unicast + no bgp ebgp-requires-policy +! + bgp bestpath as-path multipath-relax +! + bgp graceful-restart restart-time 240 + bgp graceful-restart + bgp graceful-restart preserve-fw-state + bgp graceful-restart select-defer-time 45 +! + bgp router-id 55.55.55.56 +! + network 55.55.55.55/32 + network 55.55.55.56/32 route-map HIDE_INTERNAL +! + address-family ipv6 + network fc00::1/64 + exit-address-family + address-family ipv6 + network fc00::2/128 route-map HIDE_INTERNAL + exit-address-family +! + network 10.10.10.1/24 + address-family ipv6 + network fc01::1/64 + exit-address-family +! + address-family ipv4 + redistribute connected route-map HIDE_INTERNAL + exit-address-family + address-family ipv6 + redistribute connected route-map HIDE_INTERNAL + exit-address-family +! + address-family ipv4 + maximum-paths 64 + exit-address-family + address-family ipv6 + maximum-paths 64 + exit-address-family +! +! end of template: bgpd/bgpd.main.conf.j2 +! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json new file mode 100644 index 000000000000..418a62266d8d --- /dev/null +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/packet_chassis.json @@ -0,0 +1,35 @@ +{ + "DEVICE_METADATA": { + "localhost": { + "bgp_asn": "55555", + "sub_role": "FrontEnd", + "switch_type": "chassis-packet" + } + }, + "LOOPBACK_INTERFACE": { + "Loopback0|55.55.55.55/32": {}, + "Loopback0|fc00::1/128": {}, + "Loopback4096|55.55.55.56/32": {}, + "Loopback4096|fc00::2/128": {} + }, + "VLAN_INTERFACE": { + "Vlan10|10.10.10.1/24": {}, + "Vlan10|fc01::1/64": {}, + "Vlan20": {"vnet_name": "Vnet1"}, + "Vlan20|20.20.20.1/24": {}, + "Vlan20|fd01::1/64": {} + }, + "constants": { + "bgp": { + "multipath_relax": { + "enabled": true + }, + "graceful_restart": { + "enabled": true + }, + "maximum_paths": { + "enabled": true + } + } + } +} diff --git a/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py b/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py index ff9b30ea3906..30498001199d 100644 --- a/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py +++ b/src/sonic-bgpcfgd/tests/test_sonic-cfggen.py @@ -51,6 +51,12 @@ def test_bgpd_main_conf_voq_chassis(): "bgpd.main.conf.j2/voq_chassis.json", "bgpd.main.conf.j2/voq_chassis.conf") +def test_bgpd_main_conf_packet_chassis(): + run_test("Chassi packet bgpd.main.conf.j2", + "bgpd/bgpd.main.conf.j2", + "bgpd.main.conf.j2/packet_chassis.json", + "bgpd.main.conf.j2/packet_chassis.conf") + def test_tsa_isolate(): run_test("tsa/bgpd.tsa.isolate.conf.j2", "bgpd/tsa/bgpd.tsa.isolate.conf.j2", diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index fd0012fc2f6d..4e8ce22bfdcc 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -497,6 +497,7 @@ def parse_dpg(dpg, hname): nhg_int = "" nhportlist = [] dpg_ecmp_content = {} + static_routes = {} ipnhs = child.find(str(QName(ns, "IPNextHops"))) if ipnhs is not None: for ipnh in ipnhs.findall(str(QName(ns, "IPNextHop"))): @@ -508,8 +509,12 @@ def parse_dpg(dpg, hname): port_nhipv4_map[ipnhfmbr] = ipnhaddr elif ":" in ipnhaddr: port_nhipv6_map[ipnhfmbr] = ipnhaddr + elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute': + prefix = ipnh.find(str(QName(ns, "AttachTo"))).text + nexthop = ipnh.find(str(QName(ns, "Address"))).text + static_routes[prefix] = {'nexthop': nexthop } - if port_nhipv4_map is not None and port_nhipv6_map is not None: + if port_nhipv4_map and port_nhipv6_map: subnet_check_ip = list(port_nhipv4_map.values())[0] for subnet_range in ip_intfs_map: if ("." in subnet_range): @@ -701,8 +706,10 @@ def parse_dpg(dpg, hname): if mg_key in mg_tunnel.attrib: tunnelintfs[tunnel_type][tunnel_name][table_key] = mg_tunnel.attrib[mg_key] - return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content - return None, None, None, None, None, None, None, None, None, None, None, None, None + return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content, static_routes + return None, None, None, None, None, None, None, None, None, None, None, None, None, None, None + + def parse_host_loopback(dpg, hname): for child in dpg: @@ -738,10 +745,13 @@ def parse_cpg(cpg, hname, local_devices=[]): nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0 # choose the right table and admin_status for the peer - voq_chassis = session.find(str(QName(ns, "VoQChassisInternal"))) - if voq_chassis is not None and voq_chassis.text == "true": + chassis_internal_ibgp = session.find(str(QName(ns, "ChassisInternal"))) + if chassis_internal_ibgp is not None and chassis_internal_ibgp.text == "voq": table = bgp_voq_chassis_sessions admin_status = 'up' + elif chassis_internal_ibgp is not None and chassis_internal_ibgp.text == "chassis-packet": + table = bgp_internal_sessions + admin_status = 'up' elif end_router.lower() in local_devices and start_router.lower() in local_devices: table = bgp_internal_sessions admin_status = 'up' @@ -1206,6 +1216,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw is_storage_device = False local_devices = [] kube_data = {} + static_routes = {} hwsku_qn = QName(ns, "HwSku") hostname_qn = QName(ns, "Hostname") @@ -1228,7 +1239,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw for child in root: if asic_name is None: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content) = parse_dpg(child, hostname) + (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, hostname) elif child.tag == str(QName(ns, "PngDec")): @@ -1243,7 +1254,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw (port_speeds_default, port_descriptions, sys_ports) = parse_deviceinfo(child, hwsku) else: if child.tag == str(QName(ns, "DpgDec")): - (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content) = parse_dpg(child, asic_name) + (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, asic_name) host_lo_intfs = parse_host_loopback(child, hostname) elif child.tag == str(QName(ns, "CpgDec")): (bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, asic_name, local_devices) @@ -1394,12 +1405,12 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw } else: vlan_intfs[vlan_invert_mapping[intf[0]]] = {} - elif intf[0][0:11] == 'PortChannel': - pc_intfs[intf] = {} - pc_intfs[intf[0]] = {} elif VLAN_SUB_INTERFACE_SEPARATOR in intf[0]: vlan_sub_intfs[intf] = {} vlan_sub_intfs[intf[0]] = {'admin_status': 'up'} + elif intf[0][0:11] == 'PortChannel': + pc_intfs[intf] = {} + pc_intfs[intf[0]] = {} else: phyport_intfs[intf] = {} phyport_intfs[intf[0]] = {} @@ -1567,6 +1578,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs elif resource_type is not None and 'Storage' in resource_type: is_storage_device = True + elif bool(vlan_sub_intfs): + results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs + if is_storage_device: results['DEVICE_METADATA']['localhost']['storage_device'] = "true" @@ -1578,6 +1592,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw results['MUX_CABLE'] = get_mux_cable_entries(mux_cable_ports, neighbors, devices) + if static_routes: + results['STATIC_ROUTE'] = static_routes + for nghbr in list(neighbors.keys()): # remove port not in port_config.ini if nghbr not in ports: diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml new file mode 100644 index 000000000000..96726b2a3fb0 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml @@ -0,0 +1,456 @@ + + + + + + false + str2-8808-lc2-1 + 27.1.1.1 + IXIA-EBGP + 27.1.1.2 + 1 + 10 + 3 + + + false + ASIC1 + 27.1.1.1 + IXIA-EBGP + 27.1.1.2 + 1 + 10 + 3 + + + ASIC1 + 8.0.0.3 + str2-8808-lc0-ASIC1 + 8.0.0.1 + 1 + 0 + 0 + chassis-packet + + + + + 65100 + str2-8808-lc2-1 + + +
27.1.1.2
+ + + +
+
+ +
+ + 69007 + IXIA-EBGP + + + + 65100 + str2-8808-lc0-ASIC1 + + + + 65100 + ASIC1 + + +
27.1.1.2
+ + + +
+ +
8.0.0.1
+ + + +
+
+ +
+
+
+ + + + + + HostIP + Loopback0 + + 10.0.1.6/32 + + 10.0.1.6/32 + + + + + HostIP + eth0 + + 10.3.147.97/23 + + 10.3.147.97/23 + + + + + + + str2-88 + + + + + + Eth1/1/47 + 27.1.1.1/24 + + + + + + + + + + + + + HostIP + Loopback0 + + 10.0.1.6/32 + + 10.0.1.6/32 + + + HostIP1 + Loopback4096 + + 8.0.0.3/32 + + 8.0.0.3/32 + + + + + HostIP + eth0 + + 10.3.147.97/23 + + 10.3.147.97/23 + + + + + + + ASIC1 + + + PortChannel32 + Eth2504-ASIC1;Eth2508-ASIC1;Eth2510-ASIC1 + + + + PortChannel33 + Eth2320-ASIC1;Eth2502-ASIC1;Eth2506-ASIC1;Eth2518-ASIC1 + + + + + + + + + PortChannel32 + 2 + dot1q + 192.168.1.4/24 + + + + PortChannel33 + 2 + dot1q + 192.168.2.4/24 + 10 + + + + + + Eth1/1/47 + 27.1.1.1/24 + + + + + + + IPNextHop + + 8.0.0.1/32 +
192.168.1.2,192.168.2.2
+ StaticRoute +
+
+
+
+ + + + DeviceInterfaceLink + IXIA-EBGP + Ethernet1 + str2-8808-lc2-1 + Eth1/1/47 + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet1 + true + ASIC1 + Eth2502-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet2 + true + ASIC1 + Eth2504-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet3 + true + ASIC1 + Eth2506-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet4 + true + ASIC1 + Eth2508-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet5 + true + ASIC1 + Eth2510-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet6 + true + ASIC1 + Eth2516-ASIC1 + true + + + DeviceInterfaceLink + 100000 + true + str2-8808-sup + Ethernet7 + true + ASIC1 + Eth2320-ASIC1 + true + + + + + str2-8808-lc2-1 + 8800-LC-48H-O +
+ 10.0.1.6/32 +
+ + 10.3.147.97/23 + +
+ + IXIA-EBGP + IXIA +
+ 0.0.0.0/0 +
+ + 0.0.0.0/0 + +
+ + str2-8808-sup + 8800-RP-O +
+ 0.0.0.0/0 +
+ + 10.3.147.95/23 + +
+ + Asic +
+ 8.0.0.3/32 +
+ + + + + + + + + 0.0.0.0/0 + + + ASIC1 + 8800-LC-48H-O +
+
+
+ + + true + + + DeviceInterface + + true + true + 1 + Ethernet1/1/47 + + false + 47 + 0 + 100000 + Ethernet47 + + + true + 0 + 8800-LC-48H-O + + + + + + + str2-8808-lc2-1 + + + SwitchType + + chassis_packet + + + DeploymentId + + 1 + + + QosProfile + + Profile0 + + + DhcpResources + + 192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48 + + + NtpResources + + 10.20.8.129;10.20.8.130 + + + SnmpResources + + 10.3.145.98 + + + SyslogResources + + 10.3.145.8;100.127.20.21 + + + TacacsGroup + + Starlab + + + TacacsServer + + 100.127.20.21 + + + ForcedMgmtRoutes + + 10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.3.146.0/23;10.64.5.5 + + + ErspanDestinationIpv4 + + 10.20.6.16 + + + + + ASIC1 + + + SubRole + + FrontEnd + + + SwitchType + + chassis_packet + + + + + + + str2-8808-lc2-1 + 8800-LC-48H-O +
diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini b/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini new file mode 100644 index 000000000000..bf79ada23288 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini @@ -0,0 +1,60 @@ +# name lanes alias index speed asic_port_name role source_npu target_npu +Ethernet13 1280,1281,1282,1283 Eth1/1/13 13 100000 Eth13-ASIC1 Ext LC1.NPU1 - +Ethernet14 1284,1285,1286,1287 Eth1/1/14 14 100000 Eth14-ASIC1 Ext LC1.NPU1 - +Ethernet16 1288,1289,1290,1291 Eth1/1/16 16 100000 Eth16-ASIC1 Ext LC1.NPU1 - +Ethernet17 1292,1293,1294,1295 Eth1/1/17 17 100000 Eth17-ASIC1 Ext LC1.NPU1 - +Ethernet19 1024,1025,1026,1027 Eth1/1/19 19 100000 Eth19-ASIC1 Ext LC1.NPU1 - +Ethernet20 1036,1037,1038,1039 Eth1/1/20 20 100000 Eth20-ASIC1 Ext LC1.NPU1 - +Ethernet22 1028,1029,1030,1031 Eth1/1/22 22 100000 Eth22-ASIC1 Ext LC1.NPU1 - +Ethernet23 1032,1033,1034,1035 Eth1/1/23 23 100000 Eth23-ASIC1 Ext LC1.NPU1 - +Ethernet25 768,769,770,771 Eth1/1/25 25 100000 Eth25-ASIC1 Ext LC1.NPU1 - +Ethernet26 772,773,774,775 Eth1/1/26 26 100000 Eth26-ASIC1 Ext LC1.NPU1 - +Ethernet28 776,777,778,779 Eth1/1/28 28 100000 Eth28-ASIC1 Ext LC1.NPU1 - +Ethernet29 780,781,782,783 Eth1/1/29 29 100000 Eth29-ASIC1 Ext LC1.NPU1 - +Ethernet31 512,513,514,515 Eth1/1/31 31 100000 Eth31-ASIC1 Ext LC1.NPU1 - +Ethernet32 516,517,518,519 Eth1/1/32 32 100000 Eth32-ASIC1 Ext LC1.NPU1 - +Ethernet34 520,521,522,523 Eth1/1/34 34 100000 Eth34-ASIC1 Ext LC1.NPU1 - +Ethernet35 524,525,526,527 Eth1/1/35 35 100000 Eth35-ASIC1 Ext LC1.NPU1 - +Ethernet37 256,257,258,259 Eth1/1/37 37 100000 Eth37-ASIC1 Ext LC1.NPU1 - +Ethernet38 260,261,262,263 Eth1/1/38 38 100000 Eth38-ASIC1 Ext LC1.NPU1 - +Ethernet40 268,269,270,271 Eth1/1/40 40 100000 Eth40-ASIC1 Ext LC1.NPU1 - +Ethernet41 264,265,266,267 Eth1/1/41 41 100000 Eth41-ASIC1 Ext LC1.NPU1 - +Ethernet43 12,13,14,15 Eth1/1/43 43 100000 Eth43-ASIC1 Ext LC1.NPU1 - +Ethernet44 8,9,10,11 Eth1/1/44 44 100000 Eth44-ASIC1 Ext LC1.NPU1 - +Ethernet46 4,5,6,7 Eth1/1/46 46 100000 Eth46-ASIC1 Ext LC1.NPU1 - +Ethernet47 0,1,2,3 Eth1/1/47 47 100000 Eth47-ASIC1 Ext LC1.NPU1 - +Ethernet2320 16,17 Eth1/1/2320 2320 100000 Eth2320-ASIC1 Int LC1.NPU1 FC0.NPU1 +Ethernet2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int LC1.NPU1 FC4.NPU0 +Ethernet2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int LC1.NPU1 FC4.NPU0 +Ethernet2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int LC1.NPU1 FC4.NPU1 +Ethernet2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int LC1.NPU1 FC4.NPU0 +Ethernet2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int LC1.NPU1 FC4.NPU1 +Ethernet2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int LC1.NPU1 FC4.NPU1 +Ethernet2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int LC1.NPU1 FC4.NPU1 +Ethernet2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int LC1.NPU1 FC3.NPU0 +Ethernet2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int LC1.NPU1 FC3.NPU0 +Ethernet2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int LC1.NPU1 FC3.NPU1 +Ethernet2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int LC1.NPU1 FC3.NPU0 +Ethernet2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int LC1.NPU1 FC3.NPU1 +Ethernet2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int LC1.NPU1 FC3.NPU1 +Ethernet2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int LC1.NPU1 FC3.NPU1 +Ethernet2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int LC1.NPU1 FC2.NPU0 +Ethernet2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int LC1.NPU1 FC2.NPU0 +Ethernet2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int LC1.NPU1 FC1.NPU0 +Ethernet2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int LC1.NPU1 FC1.NPU1 +Ethernet2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int LC1.NPU1 FC1.NPU0 +Ethernet2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int LC1.NPU1 FC1.NPU0 +Ethernet2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int LC1.NPU1 FC2.NPU1 +Ethernet2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int LC1.NPU1 FC2.NPU1 +Ethernet2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int LC1.NPU1 FC2.NPU1 +Ethernet2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int LC1.NPU1 FC2.NPU0 +Ethernet2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int LC1.NPU1 FC2.NPU1 +Ethernet2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int LC1.NPU1 FC0.NPU1 +Ethernet2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int LC1.NPU1 FC0.NPU0 +Ethernet2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int LC1.NPU1 FC0.NPU1 +Ethernet2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int LC1.NPU1 FC0.NPU0 +Ethernet2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int LC1.NPU1 FC0.NPU0 +Ethernet2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int LC1.NPU1 FC1.NPU1 +Ethernet2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int LC1.NPU1 FC1.NPU1 +Ethernet2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int LC1.NPU1 FC1.NPU1 +Ethernet2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int LC1.NPU1 FC0.NPU1 diff --git a/src/sonic-config-engine/tests/sample-graph-resource-type.xml b/src/sonic-config-engine/tests/sample-graph-resource-type.xml index 12961059251d..ab486b51cb69 100644 --- a/src/sonic-config-engine/tests/sample-graph-resource-type.xml +++ b/src/sonic-config-engine/tests/sample-graph-resource-type.xml @@ -20,7 +20,6 @@ 1 180 60 - false switch-t0 @@ -68,7 +67,7 @@ 1 180 60 - true + voq diff --git a/src/sonic-config-engine/tests/sample-graph-subintf.xml b/src/sonic-config-engine/tests/sample-graph-subintf.xml index f487b989a138..06a6cf2fd665 100644 --- a/src/sonic-config-engine/tests/sample-graph-subintf.xml +++ b/src/sonic-config-engine/tests/sample-graph-subintf.xml @@ -20,7 +20,6 @@ 1 180 60 - false switch-t0 @@ -68,7 +67,7 @@ 1 180 60 - true + voq diff --git a/src/sonic-config-engine/tests/simple-sample-graph.xml b/src/sonic-config-engine/tests/simple-sample-graph.xml index 90abd1885bcb..e1c4b87fc3ab 100644 --- a/src/sonic-config-engine/tests/simple-sample-graph.xml +++ b/src/sonic-config-engine/tests/simple-sample-graph.xml @@ -20,7 +20,6 @@ 1 180 60 - false switch-t0 @@ -68,7 +67,7 @@ 1 180 60 - true + voq diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 5be4bb7b75c8..46cc486ff5a6 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -831,5 +831,28 @@ def test_minigraph_dhcp(self): "'Vlan2000': {'dhcpv6_servers': ['fc02:2000::3', 'fc02:2000::4']}}" ) ) - - \ No newline at end of file + + def test_minigraph_bgp_packet_chassis_peer(self): + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "BGP_INTERNAL_NEIGHBOR[\'8.0.0.1\']"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'rrclient': 0, 'name': 'str2-8808-lc0-ASIC1', 'local_addr': '8.0.0.3', 'nhopself': 0, 'admin_status': 'up', 'holdtime': '0', 'asn': '65100', 'keepalive': '0'}") + ) + + def test_minigraph_bgp_packet_chassis_static_route(self): + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "STATIC_ROUTE"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2'}}") + ) + + def test_minigraph_bgp_packet_chassis_vlan_subintf(self): + argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "VLAN_SUB_INTERFACE"' + output = self.run_script(argument) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{('PortChannel32.2', '192.168.1.4/24'): {}, 'PortChannel32.2': {'admin_status': 'up'}, ('PortChannel33.2', '192.168.2.4/24'): {}, 'PortChannel33.2': {'admin_status': 'up'}}") + ) + From 6e2fecfa6b8be3cf2605c6673438339d20902a32 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Wed, 13 Oct 2021 14:46:37 +0000 Subject: [PATCH 3/3] Some Fixes Signed-off-by: Abhishek Dosi --- .../sample-chassis-packet-lc-port-config.ini | 118 +++++++++--------- src/sonic-config-engine/tests/test_cfggen.py | 2 + 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini b/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini index bf79ada23288..ed0f52a1adf5 100644 --- a/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-port-config.ini @@ -1,60 +1,60 @@ # name lanes alias index speed asic_port_name role source_npu target_npu -Ethernet13 1280,1281,1282,1283 Eth1/1/13 13 100000 Eth13-ASIC1 Ext LC1.NPU1 - -Ethernet14 1284,1285,1286,1287 Eth1/1/14 14 100000 Eth14-ASIC1 Ext LC1.NPU1 - -Ethernet16 1288,1289,1290,1291 Eth1/1/16 16 100000 Eth16-ASIC1 Ext LC1.NPU1 - -Ethernet17 1292,1293,1294,1295 Eth1/1/17 17 100000 Eth17-ASIC1 Ext LC1.NPU1 - -Ethernet19 1024,1025,1026,1027 Eth1/1/19 19 100000 Eth19-ASIC1 Ext LC1.NPU1 - -Ethernet20 1036,1037,1038,1039 Eth1/1/20 20 100000 Eth20-ASIC1 Ext LC1.NPU1 - -Ethernet22 1028,1029,1030,1031 Eth1/1/22 22 100000 Eth22-ASIC1 Ext LC1.NPU1 - -Ethernet23 1032,1033,1034,1035 Eth1/1/23 23 100000 Eth23-ASIC1 Ext LC1.NPU1 - -Ethernet25 768,769,770,771 Eth1/1/25 25 100000 Eth25-ASIC1 Ext LC1.NPU1 - -Ethernet26 772,773,774,775 Eth1/1/26 26 100000 Eth26-ASIC1 Ext LC1.NPU1 - -Ethernet28 776,777,778,779 Eth1/1/28 28 100000 Eth28-ASIC1 Ext LC1.NPU1 - -Ethernet29 780,781,782,783 Eth1/1/29 29 100000 Eth29-ASIC1 Ext LC1.NPU1 - -Ethernet31 512,513,514,515 Eth1/1/31 31 100000 Eth31-ASIC1 Ext LC1.NPU1 - -Ethernet32 516,517,518,519 Eth1/1/32 32 100000 Eth32-ASIC1 Ext LC1.NPU1 - -Ethernet34 520,521,522,523 Eth1/1/34 34 100000 Eth34-ASIC1 Ext LC1.NPU1 - -Ethernet35 524,525,526,527 Eth1/1/35 35 100000 Eth35-ASIC1 Ext LC1.NPU1 - -Ethernet37 256,257,258,259 Eth1/1/37 37 100000 Eth37-ASIC1 Ext LC1.NPU1 - -Ethernet38 260,261,262,263 Eth1/1/38 38 100000 Eth38-ASIC1 Ext LC1.NPU1 - -Ethernet40 268,269,270,271 Eth1/1/40 40 100000 Eth40-ASIC1 Ext LC1.NPU1 - -Ethernet41 264,265,266,267 Eth1/1/41 41 100000 Eth41-ASIC1 Ext LC1.NPU1 - -Ethernet43 12,13,14,15 Eth1/1/43 43 100000 Eth43-ASIC1 Ext LC1.NPU1 - -Ethernet44 8,9,10,11 Eth1/1/44 44 100000 Eth44-ASIC1 Ext LC1.NPU1 - -Ethernet46 4,5,6,7 Eth1/1/46 46 100000 Eth46-ASIC1 Ext LC1.NPU1 - -Ethernet47 0,1,2,3 Eth1/1/47 47 100000 Eth47-ASIC1 Ext LC1.NPU1 - -Ethernet2320 16,17 Eth1/1/2320 2320 100000 Eth2320-ASIC1 Int LC1.NPU1 FC0.NPU1 -Ethernet2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int LC1.NPU1 FC4.NPU0 -Ethernet2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int LC1.NPU1 FC4.NPU0 -Ethernet2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int LC1.NPU1 FC4.NPU1 -Ethernet2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int LC1.NPU1 FC4.NPU0 -Ethernet2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int LC1.NPU1 FC4.NPU1 -Ethernet2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int LC1.NPU1 FC4.NPU1 -Ethernet2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int LC1.NPU1 FC4.NPU1 -Ethernet2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int LC1.NPU1 FC3.NPU0 -Ethernet2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int LC1.NPU1 FC3.NPU0 -Ethernet2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int LC1.NPU1 FC3.NPU1 -Ethernet2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int LC1.NPU1 FC3.NPU0 -Ethernet2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int LC1.NPU1 FC3.NPU1 -Ethernet2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int LC1.NPU1 FC3.NPU1 -Ethernet2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int LC1.NPU1 FC3.NPU1 -Ethernet2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int LC1.NPU1 FC2.NPU0 -Ethernet2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int LC1.NPU1 FC2.NPU0 -Ethernet2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int LC1.NPU1 FC1.NPU0 -Ethernet2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int LC1.NPU1 FC1.NPU1 -Ethernet2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int LC1.NPU1 FC1.NPU0 -Ethernet2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int LC1.NPU1 FC1.NPU0 -Ethernet2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int LC1.NPU1 FC2.NPU1 -Ethernet2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int LC1.NPU1 FC2.NPU1 -Ethernet2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int LC1.NPU1 FC2.NPU1 -Ethernet2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int LC1.NPU1 FC2.NPU0 -Ethernet2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int LC1.NPU1 FC2.NPU1 -Ethernet2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int LC1.NPU1 FC0.NPU1 -Ethernet2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int LC1.NPU1 FC0.NPU0 -Ethernet2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int LC1.NPU1 FC0.NPU1 -Ethernet2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int LC1.NPU1 FC0.NPU0 -Ethernet2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int LC1.NPU1 FC0.NPU0 -Ethernet2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int LC1.NPU1 FC1.NPU1 -Ethernet2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int LC1.NPU1 FC1.NPU1 -Ethernet2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int LC1.NPU1 FC1.NPU1 -Ethernet2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int LC1.NPU1 FC0.NPU1 +Ethernet13 1280,1281,1282,1283 Eth1/1/13 13 100000 Eth13-ASIC1 Ext +Ethernet14 1284,1285,1286,1287 Eth1/1/14 14 100000 Eth14-ASIC1 Ext +Ethernet16 1288,1289,1290,1291 Eth1/1/16 16 100000 Eth16-ASIC1 Ext +Ethernet17 1292,1293,1294,1295 Eth1/1/17 17 100000 Eth17-ASIC1 Ext +Ethernet19 1024,1025,1026,1027 Eth1/1/19 19 100000 Eth19-ASIC1 Ext +Ethernet20 1036,1037,1038,1039 Eth1/1/20 20 100000 Eth20-ASIC1 Ext +Ethernet22 1028,1029,1030,1031 Eth1/1/22 22 100000 Eth22-ASIC1 Ext +Ethernet23 1032,1033,1034,1035 Eth1/1/23 23 100000 Eth23-ASIC1 Ext +Ethernet25 768,769,770,771 Eth1/1/25 25 100000 Eth25-ASIC1 Ext +Ethernet26 772,773,774,775 Eth1/1/26 26 100000 Eth26-ASIC1 Ext +Ethernet28 776,777,778,779 Eth1/1/28 28 100000 Eth28-ASIC1 Ext +Ethernet29 780,781,782,783 Eth1/1/29 29 100000 Eth29-ASIC1 Ext +Ethernet31 512,513,514,515 Eth1/1/31 31 100000 Eth31-ASIC1 Ext +Ethernet32 516,517,518,519 Eth1/1/32 32 100000 Eth32-ASIC1 Ext +Ethernet34 520,521,522,523 Eth1/1/34 34 100000 Eth34-ASIC1 Ext +Ethernet35 524,525,526,527 Eth1/1/35 35 100000 Eth35-ASIC1 Ext +Ethernet37 256,257,258,259 Eth1/1/37 37 100000 Eth37-ASIC1 Ext +Ethernet38 260,261,262,263 Eth1/1/38 38 100000 Eth38-ASIC1 Ext +Ethernet40 268,269,270,271 Eth1/1/40 40 100000 Eth40-ASIC1 Ext +Ethernet41 264,265,266,267 Eth1/1/41 41 100000 Eth41-ASIC1 Ext +Ethernet43 12,13,14,15 Eth1/1/43 43 100000 Eth43-ASIC1 Ext +Ethernet44 8,9,10,11 Eth1/1/44 44 100000 Eth44-ASIC1 Ext +Ethernet46 4,5,6,7 Eth1/1/46 46 100000 Eth46-ASIC1 Ext +Ethernet47 0,1,2,3 Eth1/1/47 47 100000 Eth47-ASIC1 Ext +Ethernet2320 16,17 Eth2320-ASIC1 2320 100000 Eth2320-ASIC1 Int +Ethernet2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int +Ethernet2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int +Ethernet2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int +Ethernet2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int +Ethernet2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int +Ethernet2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int +Ethernet2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int +Ethernet2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int +Ethernet2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int +Ethernet2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int +Ethernet2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int +Ethernet2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int +Ethernet2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int +Ethernet2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int +Ethernet2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int +Ethernet2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int +Ethernet2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int +Ethernet2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int +Ethernet2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int +Ethernet2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int +Ethernet2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int +Ethernet2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int +Ethernet2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int +Ethernet2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int +Ethernet2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int +Ethernet2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int +Ethernet2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int +Ethernet2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int +Ethernet2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int +Ethernet2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int +Ethernet2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int +Ethernet2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int +Ethernet2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int +Ethernet2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 46cc486ff5a6..4f86a71fc1d1 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -32,6 +32,8 @@ def setUp(self): self.sample_resource_graph = os.path.join(self.test_dir, 'sample-graph-resource-type.xml') self.sample_subintf_graph = os.path.join(self.test_dir, 'sample-graph-subintf.xml') self.voq_port_config = os.path.join(self.test_dir, 'voq-sample-port-config.ini') + self.packet_chassis_graph = os.path.join(self.test_dir, 'sample-chassis-packet-lc-graph.xml') + self.packet_chassis_port_ini = os.path.join(self.test_dir, 'sample-chassis-packet-lc-port-config.ini') # To ensure that mock config_db data is used for unit-test cases os.environ["CFGGEN_UNIT_TESTING"] = "2"