From 31389aa77891ee512d820d62ab564e409f229ab2 Mon Sep 17 00:00:00 2001 From: Tamer Ahmed Date: Wed, 14 Oct 2020 14:01:53 -0700 Subject: [PATCH] [cfggen] Remove NatSorted (#5601) Natural sorting of SONiC config gen output consumes lot of CPU cycles. The sole use of natsorted was to make test comparison easier and so, the natsorting logic is now relocated to the test suite. As a result sonic-cfggen gained nearly 1 sec per call since we no longer import natsorted module! singed-off-by: Tamer Ahmed --- .../data/sonic-cfggen/bgpd.conf.j2/all.conf | 12 +- .../sonic-cfggen/bgpd.main.conf.j2/all.conf | 6 +- .../bgpd.main.conf.j2/defaults.conf | 6 +- .../base.conf | 36 +- .../data/sonic-cfggen/frr.conf.j2/all.conf | 14 +- .../data/sonic-cfggen/zebra/interfaces.conf | 6 +- .../tests/data/sonic-cfggen/zebra/zebra.conf | 10 +- src/sonic-config-engine/__init__.py | 0 src/sonic-config-engine/sonic-cfggen | 44 +- src/sonic-config-engine/tests/common_utils.py | 30 + .../tests/multi_npu_data/ipinip.json | 2 +- .../tests/sample_output/bgpd_quagga.conf | 44 +- .../tests/sample_output/buffers-dell6100.json | 826 +++++++++--------- .../docker-dhcp-relay.supervisord.conf | 4 +- .../tests/sample_output/frr.conf | 4 +- .../tests/sample_output/ipinip.json | 4 +- .../tests/sample_output/l2switch.json | 392 ++++----- .../tests/sample_output/ports.json | 14 +- .../t2-chassis-fe-vni-zebra.conf | 4 +- .../sample_output/t2-chassis-fe-zebra.conf | 4 +- .../tests/sample_output/wait_for_intf.sh | 2 +- .../tests/sample_output/zebra_frr.conf | 4 +- .../tests/sample_output/zebra_quagga.conf | 4 +- src/sonic-config-engine/tests/test_cfggen.py | 284 +++--- .../tests/test_cfggen_t2_chassis_fe.py | 45 +- .../tests/test_minigraph_case.py | 27 +- .../tests/test_multinpu_cfggen.py | 46 +- 27 files changed, 1018 insertions(+), 856 deletions(-) create mode 100644 src/sonic-config-engine/__init__.py create mode 100644 src/sonic-config-engine/tests/common_utils.py diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf index e417e10d61..6d79e4c226 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf @@ -1,10 +1,12 @@ ! ! template: bgpd/bgpd.conf.j2 ! +! ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== ! generated by templates/quagga/bgpd.conf.j2 with config DB data ! file: bgpd.conf ! +! ! template: common/daemons.common.conf.j2 ! hostname new_hostname @@ -17,6 +19,8 @@ log facility local4 ! end of template: common/daemons.common.conf.j2! agentx ! +! +! ! template: bgpd/bgpd.main.conf.j2 ! ! bgp multiple-instance @@ -29,14 +33,15 @@ 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.1/24 +ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 10.10.10.1/24 ! -ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::1/64 +ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 5 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 set community local-AS ! +! router bgp 55555 ! bgp log-neighbor-changes @@ -56,10 +61,11 @@ router bgp 55555 network fc00::1/64 exit-address-family ! - network 10.10.10.1/24 address-family ipv6 network fc01::1/64 exit-address-family + network 10.10.10.1/24 +! ! address-family ipv4 redistribute connected route-map HIDE_INTERNAL diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf index c4e18c5ae2..d771ff49c9 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/all.conf @@ -11,14 +11,15 @@ 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.1/24 +ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 10.10.10.1/24 ! -ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::1/64 +ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 15 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 set community local-AS ! +! router bgp 55555 ! bgp log-neighbor-changes @@ -42,6 +43,7 @@ router bgp 55555 address-family ipv6 network fc01::1/64 exit-address-family +! ! address-family ipv4 redistribute connected route-map HIDE_INTERNAL diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf index e1f9c8489c..e9296f8627 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.main.conf.j2/defaults.conf @@ -11,14 +11,15 @@ 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.1/24 +ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 10.10.10.1/24 ! -ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::1/64 +ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 15 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 set community local-AS ! +! router bgp 55555 ! bgp log-neighbor-changes @@ -42,6 +43,7 @@ router bgp 55555 address-family ipv6 network fc01::1/64 exit-address-family +! ! address-family ipv4 redistribute connected route-map HIDE_INTERNAL diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.spine_chassis_frontend_router.conf.j2/base.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.spine_chassis_frontend_router.conf.j2/base.conf index 581eb107ec..2f54371529 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.spine_chassis_frontend_router.conf.j2/base.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.spine_chassis_frontend_router.conf.j2/base.conf @@ -1,23 +1,5 @@ ! ! Vnet BGP instance -router bgp 555 vrf First - no bgp default ipv4-unicast - bgp log-neighbor-changes - bgp bestpath as-path multipath-relax - no bgp default ipv4-unicast - bgp graceful-restart restart-time 240 - bgp graceful-restart - bgp router-id 10.20.30.40 - neighbor 10.10.10.1 remote-as 10 - neighbor 10.10.10.1 description session1 - address-family ipv4 unicast - neighbor 10.10.10.1 activate - neighbor 10.10.10.1 soft-reconfiguration inbound - maximum-paths 64 - exit-address-family - address-family l2vpn evpn - advertise ipv4 unicast - exit-address-family router bgp 555 vrf Second no bgp default ipv4-unicast bgp log-neighbor-changes @@ -36,4 +18,22 @@ router bgp 555 vrf Second address-family l2vpn evpn advertise ipv4 unicast exit-address-family +router bgp 555 vrf First + no bgp default ipv4-unicast + bgp log-neighbor-changes + bgp bestpath as-path multipath-relax + no bgp default ipv4-unicast + bgp graceful-restart restart-time 240 + bgp graceful-restart + bgp router-id 10.20.30.40 + neighbor 10.10.10.1 remote-as 10 + neighbor 10.10.10.1 description session1 + address-family ipv4 unicast + neighbor 10.10.10.1 activate + neighbor 10.10.10.1 soft-reconfiguration inbound + maximum-paths 64 + exit-address-family + address-family l2vpn evpn + advertise ipv4 unicast + exit-address-family ! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf index fa9d272eb2..277544a2be 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf @@ -3,6 +3,7 @@ ! generated by templates/frr.conf.j2 with config DB data ! file: frr.conf ! +! ! template: common/daemons.common.conf.j2 ! hostname test_hostname @@ -17,11 +18,12 @@ agentx ! ! Enable nht through default route ip nht resolve-via-default +! ! Enable link-detect (default disabled) -interface Ethernet0 +interface Ethernet4 link-detect ! -interface Ethernet4 +interface Ethernet0 link-detect ! interface PortChannel10 @@ -48,14 +50,15 @@ 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.1/24 +ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 10 permit 10.10.10.1/24 ! -ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::1/64 +ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 5 permit fc01::1/64 ! ! route-map HIDE_INTERNAL permit 10 set community local-AS ! +! router bgp 55555 ! bgp log-neighbor-changes @@ -75,10 +78,11 @@ router bgp 55555 network fc00::1/64 exit-address-family ! - network 10.10.10.1/24 address-family ipv6 network fc01::1/64 exit-address-family + network 10.10.10.1/24 +! ! address-family ipv4 redistribute connected route-map HIDE_INTERNAL diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf index d9d585b99b..6fa17fb6d2 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/interfaces.conf @@ -2,11 +2,12 @@ ! ! Enable nht through default route ip nht resolve-via-default +! ! Enable link-detect (default disabled) -interface Ethernet0 +interface Ethernet4 link-detect ! -interface Ethernet4 +interface Ethernet0 link-detect ! interface PortChannel10 @@ -15,3 +16,4 @@ link-detect interface PortChannel20 link-detect ! +! diff --git a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf index ac2d8dac88..5bff88c711 100644 --- a/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf +++ b/src/sonic-bgpcfgd/tests/data/sonic-cfggen/zebra/zebra.conf @@ -3,6 +3,7 @@ ! generated by templates/zebra/zebra.conf.j2 using config DB data ! file: zebra.conf ! +! ! template: common/daemons.common.conf.j2 ! hostname new_hostname @@ -14,19 +15,20 @@ log facility local4 ! ! end of template: common/daemons.common.conf.j2! ! +vrf Second +vni 20 +! vrf First vni 10 ! -vrf Second -vni 20 ! ! Enable nht through default route ip nht resolve-via-default ! Enable link-detect (default disabled) -interface Ethernet0 +interface Ethernet4 link-detect ! -interface Ethernet4 +interface Ethernet0 link-detect ! interface PortChannel10 diff --git a/src/sonic-config-engine/__init__.py b/src/sonic-config-engine/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/sonic-config-engine/sonic-cfggen b/src/sonic-config-engine/sonic-cfggen index e74a231433..b4a100eb47 100755 --- a/src/sonic-config-engine/sonic-cfggen +++ b/src/sonic-config-engine/sonic-cfggen @@ -31,25 +31,24 @@ import lazy_re import sys import os import argparse -import yaml -import jinja2 -import netaddr -import json import contextlib +import jinja2 +import json +import netaddr +import os.path +import sys +import yaml + +from collections import OrderedDict +from config_samples import generate_sample_config, get_available_config from functools import partial -from minigraph import minigraph_encoder -from minigraph import parse_xml -from minigraph import parse_device_desc_xml -from minigraph import parse_asic_sub_role +from minigraph import minigraph_encoder, parse_xml, parse_device_desc_xml, parse_asic_sub_role from portconfig import get_port_config from sonic_py_common.device_info import get_platform, get_system_mac from sonic_py_common.multi_asic import get_asic_id_from_name, is_multi_asic, get_asic_device_id -from config_samples import generate_sample_config -from config_samples import get_available_config from swsssdk import SonicV2Connector, ConfigDBConnector, SonicDBConfig, ConfigDBPipeConnector from redis_bcc import RedisBytecodeCache from collections import OrderedDict -from natsort import natsorted def sort_by_port_index(value): if not value: @@ -162,9 +161,7 @@ TODO(taoyl): Current version of config db only supports BGP admin states. @staticmethod def to_serialized(data, lookup_key = None): if type(data) is dict: - data = OrderedDict(natsorted(data.items())) - - if lookup_key != None: + if lookup_key is not None: newData = {} for key in data.keys(): if ((type(key) is unicode and lookup_key == key) or (type(key) is tuple and lookup_key in key)): @@ -275,7 +272,7 @@ def main(): platform = get_platform() db_kwargs = {} - if args.redis_unix_sock_file != None: + if args.redis_unix_sock_file is not None: db_kwargs['unix_socket_path'] = args.redis_unix_sock_file data = {} @@ -309,7 +306,7 @@ def main(): _process_json(args, data) - if args.minigraph != None: + if args.minigraph is not None: minigraph = args.minigraph if platform: if args.port_config != None: @@ -319,7 +316,7 @@ def main(): else: deep_update(data, parse_xml(minigraph, port_config_file=args.port_config, asic_name=asic_name)) - if args.device_description != None: + if args.device_description is not None: deep_update(data, parse_device_desc_xml(args.device_description)) for yaml_file in args.yaml: @@ -330,7 +327,7 @@ def main(): additional_data = yaml.load(stream) deep_update(data, FormatConverter.to_deserialized(additional_data)) - if args.additional_data != None: + if args.additional_data is not None: deep_update(data, json.loads(args.additional_data)) if args.from_db: @@ -379,22 +376,21 @@ def main(): for template_file, _ in args.template: paths.append(os.path.dirname(os.path.abspath(template_file))) env = _get_jinja2_env(paths) - sorted_data = sort_data(data) for template_file, dest_file in args.template: template = env.get_template(os.path.basename(template_file)) - template_data = template.render(sorted_data) + template_data = template.render(data) if dest_file == "config-db": deep_update(data, FormatConverter.to_deserialized(json.loads(template_data))) else: with smart_open(dest_file, 'w') as df: print(template_data, file=df) - if args.var != None: + if args.var is not None: template = jinja2.Template('{{' + args.var + '}}') print(template.render(data)) - if args.var_json != None and args.var_json in data: - if args.key != None: + if args.var_json is not None and args.var_json in data: + if args.key is not None: print(json.dumps(FormatConverter.to_serialized(data[args.var_json], args.key), indent=4, cls=minigraph_encoder)) else: print(json.dumps(FormatConverter.to_serialized(data[args.var_json]), indent=4, cls=minigraph_encoder)) @@ -411,7 +407,7 @@ def main(): if args.print_data: print(json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder)) - if args.preset != None: + if args.preset is not None: data = generate_sample_config(data, args.preset) print(json.dumps(FormatConverter.to_serialized(data), indent=4, cls=minigraph_encoder)) diff --git a/src/sonic-config-engine/tests/common_utils.py b/src/sonic-config-engine/tests/common_utils.py new file mode 100644 index 0000000000..f75584471e --- /dev/null +++ b/src/sonic-config-engine/tests/common_utils.py @@ -0,0 +1,30 @@ +import json +import re +import sys + + +def tuple_to_str(tuplestr): + """ Convert Python tuple '('elem1', 'elem2')' representation into string on the for "elem1|elem2" """ + def to_str(tupleobj): + tupleobj = re.sub(r"([\(\)])", '"', tupleobj.group(0)) + return re.sub(r"( *, *)", '|', tupleobj).replace("'", '') + + return re.sub(r"(\(.*?\))", to_str, tuplestr) + +def to_dict(dictstr): + """ Convert string represention of Python dict into dict """ + # handle tuple elements + dictstr = tuple_to_str(dictstr) + + return json.loads(dictstr.replace("'", '"')) + +def liststr_to_dict(liststr): + """ Convert string represention of Python list into dict with list key and sorted liststr as its value """ + # handle tuple elements + liststr = tuple_to_str(liststr) + + list_obj = json.loads("{\"list\":" + liststr.replace("'", '"') +'}') + list_obj["list"] = sorted(list_obj["list"]) + + return list_obj + diff --git a/src/sonic-config-engine/tests/multi_npu_data/ipinip.json b/src/sonic-config-engine/tests/multi_npu_data/ipinip.json index 0f8396e63b..d48dcba30b 100644 --- a/src/sonic-config-engine/tests/multi_npu_data/ipinip.json +++ b/src/sonic-config-engine/tests/multi_npu_data/ipinip.json @@ -2,7 +2,7 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.1.0.32,8.0.0.0,10.0.0.0,10.1.0.1,10.1.0.3", + "dst_ip":"8.0.0.0,10.1.0.32,10.1.0.3,10.0.0.0,10.1.0.1", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" diff --git a/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf b/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf index ebffcaa7c2..f75d9de9a3 100644 --- a/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf +++ b/src/sonic-config-engine/tests/sample_output/bgpd_quagga.conf @@ -23,19 +23,11 @@ router bgp 65100 bgp graceful-restart restart-time 240 bgp graceful-restart bgp router-id 10.1.0.32 - network 10.1.0.32/32 address-family ipv6 network fc00:1::32/64 exit-address-family + network 10.1.0.32/32 network 192.168.0.1/27 - neighbor 10.0.0.57 remote-as 64600 - neighbor 10.0.0.57 description ARISTA01T1 - address-family ipv4 - neighbor 10.0.0.57 allowas-in 1 - neighbor 10.0.0.57 activate - neighbor 10.0.0.57 soft-reconfiguration inbound - maximum-paths 64 - exit-address-family neighbor 10.0.0.59 remote-as 64600 neighbor 10.0.0.59 description ARISTA02T1 address-family ipv4 @@ -60,14 +52,6 @@ router bgp 65100 neighbor 10.0.0.63 soft-reconfiguration inbound maximum-paths 64 exit-address-family - neighbor fc00::7a remote-as 64600 - neighbor fc00::7a description ARISTA03T1 - address-family ipv6 - neighbor fc00::7a allowas-in 1 - neighbor fc00::7a activate - neighbor fc00::7a soft-reconfiguration inbound - maximum-paths 64 - exit-address-family neighbor fc00::7e remote-as 64600 neighbor fc00::7e description ARISTA04T1 address-family ipv6 @@ -76,12 +60,20 @@ router bgp 65100 neighbor fc00::7e soft-reconfiguration inbound maximum-paths 64 exit-address-family - neighbor fc00::72 remote-as 64600 - neighbor fc00::72 description ARISTA01T1 + neighbor fc00::7a remote-as 64600 + neighbor fc00::7a description ARISTA03T1 address-family ipv6 - neighbor fc00::72 allowas-in 1 - neighbor fc00::72 activate - neighbor fc00::72 soft-reconfiguration inbound + neighbor fc00::7a allowas-in 1 + neighbor fc00::7a activate + neighbor fc00::7a soft-reconfiguration inbound + maximum-paths 64 + exit-address-family + neighbor 10.0.0.57 remote-as 64600 + neighbor 10.0.0.57 description ARISTA01T1 + address-family ipv4 + neighbor 10.0.0.57 allowas-in 1 + neighbor 10.0.0.57 activate + neighbor 10.0.0.57 soft-reconfiguration inbound maximum-paths 64 exit-address-family neighbor fc00::76 remote-as 64600 @@ -92,6 +84,14 @@ router bgp 65100 neighbor fc00::76 soft-reconfiguration inbound maximum-paths 64 exit-address-family + neighbor fc00::72 remote-as 64600 + neighbor fc00::72 description ARISTA01T1 + address-family ipv6 + neighbor fc00::72 allowas-in 1 + neighbor fc00::72 activate + neighbor fc00::72 soft-reconfiguration inbound + maximum-paths 64 + exit-address-family ! maximum-paths 64 ! diff --git a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json index 5cf0472f3f..56de7500c1 100644 --- a/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json +++ b/src/sonic-config-engine/tests/sample_output/buffers-dell6100.json @@ -2,56 +2,21 @@ { "CABLE_LENGTH": { "AZURE": { - "Ethernet0": "5m", - "Ethernet1": "5m", - "Ethernet2": "5m", - "Ethernet3": "5m", - "Ethernet4": "5m", - "Ethernet5": "5m", - "Ethernet6": "5m", - "Ethernet7": "5m", "Ethernet8": "5m", "Ethernet9": "5m", - "Ethernet10": "5m", - "Ethernet11": "5m", - "Ethernet12": "5m", - "Ethernet13": "5m", - "Ethernet14": "5m", - "Ethernet15": "5m", - "Ethernet16": "5m", - "Ethernet17": "5m", - "Ethernet18": "5m", - "Ethernet19": "5m", - "Ethernet20": "5m", - "Ethernet21": "5m", - "Ethernet22": "5m", - "Ethernet23": "5m", - "Ethernet24": "5m", - "Ethernet25": "5m", - "Ethernet26": "5m", - "Ethernet27": "5m", - "Ethernet28": "5m", - "Ethernet29": "5m", - "Ethernet30": "5m", - "Ethernet31": "5m", - "Ethernet32": "5m", - "Ethernet33": "5m", - "Ethernet34": "5m", - "Ethernet35": "5m", - "Ethernet36": "5m", - "Ethernet37": "5m", - "Ethernet38": "5m", - "Ethernet39": "5m", - "Ethernet40": "5m", - "Ethernet41": "5m", - "Ethernet42": "5m", - "Ethernet43": "5m", - "Ethernet44": "5m", - "Ethernet45": "5m", + "Ethernet2": "5m", + "Ethernet3": "5m", + "Ethernet0": "5m", + "Ethernet1": "5m", + "Ethernet6": "5m", + "Ethernet7": "5m", + "Ethernet4": "5m", + "Ethernet5": "5m", "Ethernet46": "5m", - "Ethernet47": "5m", - "Ethernet48": "5m", - "Ethernet49": "5m", + "Ethernet34": "5m", + "Ethernet22": "5m", + "Ethernet58": "5m", + "Ethernet59": "5m", "Ethernet50": "5m", "Ethernet51": "5m", "Ethernet52": "5m", @@ -60,12 +25,47 @@ "Ethernet55": "5m", "Ethernet56": "5m", "Ethernet57": "5m", - "Ethernet58": "5m", - "Ethernet59": "5m", - "Ethernet60": "5m", + "Ethernet38": "5m", + "Ethernet39": "5m", + "Ethernet18": "5m", + "Ethernet19": "5m", + "Ethernet14": "5m", + "Ethernet15": "5m", + "Ethernet16": "5m", + "Ethernet17": "5m", + "Ethernet10": "5m", + "Ethernet11": "5m", + "Ethernet12": "5m", + "Ethernet35": "5m", + "Ethernet37": "5m", + "Ethernet32": "5m", + "Ethernet33": "5m", + "Ethernet30": "5m", + "Ethernet31": "5m", + "Ethernet49": "5m", + "Ethernet48": "5m", + "Ethernet47": "5m", + "Ethernet36": "5m", + "Ethernet45": "5m", + "Ethernet44": "5m", + "Ethernet43": "5m", + "Ethernet42": "5m", + "Ethernet41": "5m", + "Ethernet40": "5m", + "Ethernet29": "5m", + "Ethernet28": "5m", "Ethernet61": "5m", + "Ethernet60": "5m", + "Ethernet63": "5m", "Ethernet62": "5m", - "Ethernet63": "5m" + "Ethernet21": "5m", + "Ethernet20": "5m", + "Ethernet23": "5m", + "Ethernet13": "5m", + "Ethernet25": "5m", + "Ethernet24": "5m", + "Ethernet27": "5m", + "Ethernet26": "5m" } }, @@ -105,115 +105,31 @@ } }, "BUFFER_PG": { + "Ethernet8|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet9|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, "Ethernet0|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, "Ethernet1|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet4|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet5|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, "Ethernet6|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, "Ethernet7|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet8|0": { + "Ethernet4|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet9|0": { + "Ethernet5|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet10|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet11|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet12|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet13|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet14|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet15|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet16|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet17|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet20|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet21|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet22|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet23|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet24|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet25|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet26|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet27|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet28|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet29|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet30|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet31|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet32|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet36|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet37|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet38|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet39|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet40|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet41|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet42|0": { - "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" - }, - "Ethernet48|0": { + "Ethernet58|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, "Ethernet52|0": { @@ -234,121 +150,121 @@ "Ethernet57|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" }, - "Ethernet58|0": { + "Ethernet38|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet39|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet32|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet15|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet16|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet17|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet36|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet37|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet12|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet13|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet14|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet30|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet31|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet48|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet10|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet42|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet41|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet40|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet29|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet28|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet11|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet21|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet20|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet23|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet22|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet25|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet24|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet27|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + }, + "Ethernet26|0": { "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" } }, "BUFFER_QUEUE": { + "Ethernet8|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet9|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, "Ethernet0|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, "Ethernet1|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "Ethernet4|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet5|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, "Ethernet6|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, "Ethernet7|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "Ethernet8|3-4": { + "Ethernet4|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "Ethernet9|3-4": { + "Ethernet5|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "Ethernet10|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet11|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet12|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet13|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet14|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet15|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet16|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet17|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet20|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet21|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet22|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet23|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet24|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet25|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet26|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet27|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet28|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet29|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet30|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet31|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet32|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet36|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet37|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet38|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet39|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet40|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet41|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet42|3-4": { - "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" - }, - "Ethernet48|3-4": { + "Ethernet58|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, "Ethernet52|3-4": { @@ -369,118 +285,118 @@ "Ethernet57|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, - "Ethernet58|3-4": { + "Ethernet38|3-4": { "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" }, + "Ethernet39|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet32|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet15|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet16|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet17|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet36|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet37|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet12|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet13|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet14|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet30|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet31|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet48|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet10|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet42|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet41|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet40|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet29|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet28|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet11|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet21|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet20|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet23|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet22|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet25|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet24|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet27|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet26|3-4": { + "profile" : "[BUFFER_PROFILE|egress_lossless_profile]" + }, + "Ethernet8|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet9|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, "Ethernet0|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, "Ethernet1|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet4|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet5|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, "Ethernet6|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, "Ethernet7|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet8|0-2": { + "Ethernet4|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet9|0-2": { + "Ethernet5|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet10|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet11|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet12|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet13|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet14|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet15|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet16|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet17|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet20|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet21|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet22|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet23|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet24|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet25|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet26|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet27|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet28|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet29|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet30|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet31|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet32|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet36|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet37|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet38|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet39|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet40|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet41|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet42|0-2": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet48|0-2": { + "Ethernet58|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, "Ethernet52|0-2": { @@ -501,25 +417,91 @@ "Ethernet57|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet58|0-2": { + "Ethernet38|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet0|5-6": { + "Ethernet39|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet1|5-6": { + "Ethernet32|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet4|5-6": { + "Ethernet15|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet5|5-6": { + "Ethernet16|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet6|5-6": { + "Ethernet17|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet7|5-6": { + "Ethernet36|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet37|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet12|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet13|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet14|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet30|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet31|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet48|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet10|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet42|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet41|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet40|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet29|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet28|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet11|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet21|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet20|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet23|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet22|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet25|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet24|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet27|0-2": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet26|0-2": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, "Ethernet8|5-6": { @@ -528,91 +510,25 @@ "Ethernet9|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet10|5-6": { + "Ethernet0|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet11|5-6": { + "Ethernet1|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet12|5-6": { + "Ethernet6|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet13|5-6": { + "Ethernet7|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet14|5-6": { + "Ethernet4|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet15|5-6": { + "Ethernet5|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet16|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet17|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet20|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet21|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet22|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet23|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet24|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet25|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet26|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet27|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet28|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet29|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet30|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet31|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet32|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet36|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet37|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet38|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet39|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet40|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet41|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet42|5-6": { - "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" - }, - "Ethernet48|5-6": { + "Ethernet58|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, "Ethernet52|5-6": { @@ -633,7 +549,91 @@ "Ethernet57|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" }, - "Ethernet58|5-6": { + "Ethernet38|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet39|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet32|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet15|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet16|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet17|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet36|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet37|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet12|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet13|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet14|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet30|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet31|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet48|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet10|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet42|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet41|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet40|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet29|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet28|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet11|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet21|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet20|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet23|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet22|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet25|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet24|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet27|5-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + }, + "Ethernet26|5-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf index 3e485f4ddc..be52694b78 100644 --- a/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/docker-dhcp-relay.supervisord.conf @@ -42,7 +42,7 @@ dependent_startup_wait_for=rsyslogd:running programs=isc-dhcp-relay-Vlan1000 [program:isc-dhcp-relay-Vlan1000] -command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 192.0.0.1 192.0.0.2 +command=/usr/sbin/dhcrelay -d -m discard -a %%h:%%p %%P --name-alias-map-file /tmp/port-name-alias-map.txt -id Vlan1000 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -iu PortChannel01 192.0.0.1 192.0.0.2 priority=3 autostart=false autorestart=false @@ -56,7 +56,7 @@ dependent_startup_wait_for=start:exited programs=dhcpmon-Vlan1000 [program:dhcpmon-Vlan1000] -command=/usr/sbin/dhcpmon -id Vlan1000 -iu PortChannel01 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -im eth0 +command=/usr/sbin/dhcpmon -id Vlan1000 -iu PortChannel02 -iu PortChannel03 -iu PortChannel04 -iu PortChannel01 -im eth0 priority=4 autostart=false autorestart=false diff --git a/src/sonic-config-engine/tests/sample_output/frr.conf b/src/sonic-config-engine/tests/sample_output/frr.conf index 374b3bf5f0..08777924d1 100644 --- a/src/sonic-config-engine/tests/sample_output/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/frr.conf @@ -21,13 +21,13 @@ agentx ! Enable nht through default route ip nht resolve-via-default ! Enable link-detect (default disabled) -interface PortChannel01 +interface PortChannel03 link-detect ! interface PortChannel02 link-detect ! -interface PortChannel03 +interface PortChannel01 link-detect ! interface PortChannel04 diff --git a/src/sonic-config-engine/tests/sample_output/ipinip.json b/src/sonic-config-engine/tests/sample_output/ipinip.json index e4028ea01a..c93564de77 100644 --- a/src/sonic-config-engine/tests/sample_output/ipinip.json +++ b/src/sonic-config-engine/tests/sample_output/ipinip.json @@ -2,7 +2,7 @@ { "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"10.1.0.32,10.0.0.56,10.0.0.58,10.0.0.60,10.0.0.62,192.168.0.1", + "dst_ip":"10.1.0.32,10.0.0.58,10.0.0.60,10.0.0.62,10.0.0.56,192.168.0.1", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" @@ -13,7 +13,7 @@ { "TUNNEL_DECAP_TABLE:IPINIP_V6_TUNNEL" : { "tunnel_type":"IPINIP", - "dst_ip":"fc00:1::32,fc00::71,fc00::75,fc00::79,fc00::7d", + "dst_ip":"fc00:1::32,fc00::7d,fc00::79,fc00::71,fc00::75", "dscp_mode":"pipe", "ecn_mode":"copy_from_outer", "ttl_mode":"pipe" diff --git a/src/sonic-config-engine/tests/sample_output/l2switch.json b/src/sonic-config-engine/tests/sample_output/l2switch.json index fd83589153..1c9e0ebbcd 100644 --- a/src/sonic-config-engine/tests/sample_output/l2switch.json +++ b/src/sonic-config-engine/tests/sample_output/l2switch.json @@ -1,6 +1,11 @@ { "DEVICE_METADATA": {"localhost": {"hwsku": "Mellanox-SN2700"}}, "PORT": { + "Ethernet8": { + "alias": "fortyGigE0/8", + "lanes": "37,38,39,40", + "admin_status": "up" + }, "Ethernet0": { "alias": "fortyGigE0/0", "lanes": "29,30,31,32", @@ -11,119 +16,9 @@ "lanes": "25,26,27,28", "admin_status": "up" }, - "Ethernet8": { - "alias": "fortyGigE0/8", - "lanes": "37,38,39,40", - "admin_status": "up" - }, - "Ethernet12": { - "alias": "fortyGigE0/12", - "lanes": "33,34,35,36", - "admin_status": "up" - }, - "Ethernet16": { - "alias": "fortyGigE0/16", - "lanes": "41,42,43,44", - "admin_status": "up" - }, - "Ethernet20": { - "alias": "fortyGigE0/20", - "lanes": "45,46,47,48", - "admin_status": "up" - }, - "Ethernet24": { - "alias": "fortyGigE0/24", - "lanes": "5,6,7,8", - "admin_status": "up" - }, - "Ethernet28": { - "alias": "fortyGigE0/28", - "lanes": "1,2,3,4", - "admin_status": "up" - }, - "Ethernet32": { - "alias": "fortyGigE0/32", - "lanes": "9,10,11,12", - "admin_status": "up" - }, - "Ethernet36": { - "alias": "fortyGigE0/36", - "lanes": "13,14,15,16", - "admin_status": "up" - }, - "Ethernet40": { - "alias": "fortyGigE0/40", - "lanes": "21,22,23,24", - "admin_status": "up" - }, - "Ethernet44": { - "alias": "fortyGigE0/44", - "lanes": "17,18,19,20", - "admin_status": "up" - }, - "Ethernet48": { - "alias": "fortyGigE0/48", - "lanes": "49,50,51,52", - "admin_status": "up" - }, - "Ethernet52": { - "alias": "fortyGigE0/52", - "lanes": "53,54,55,56", - "admin_status": "up" - }, - "Ethernet56": { - "alias": "fortyGigE0/56", - "lanes": "61,62,63,64", - "admin_status": "up" - }, - "Ethernet60": { - "alias": "fortyGigE0/60", - "lanes": "57,58,59,60", - "admin_status": "up" - }, - "Ethernet64": { - "alias": "fortyGigE0/64", - "lanes": "65,66,67,68", - "admin_status": "up" - }, - "Ethernet68": { - "alias": "fortyGigE0/68", - "lanes": "69,70,71,72", - "admin_status": "up" - }, - "Ethernet72": { - "alias": "fortyGigE0/72", - "lanes": "77,78,79,80", - "admin_status": "up" - }, - "Ethernet76": { - "alias": "fortyGigE0/76", - "lanes": "73,74,75,76", - "admin_status": "up" - }, - "Ethernet80": { - "alias": "fortyGigE0/80", - "lanes": "105,106,107,108", - "admin_status": "up" - }, - "Ethernet84": { - "alias": "fortyGigE0/84", - "lanes": "109,110,111,112", - "admin_status": "up" - }, - "Ethernet88": { - "alias": "fortyGigE0/88", - "lanes": "117,118,119,120", - "admin_status": "up" - }, - "Ethernet92": { - "alias": "fortyGigE0/92", - "lanes": "113,114,115,116", - "admin_status": "up" - }, - "Ethernet96": { - "alias": "fortyGigE0/96", - "lanes": "121,122,123,124", + "Ethernet108": { + "alias": "fortyGigE0/108", + "lanes": "81,82,83,84", "admin_status": "up" }, "Ethernet100": { @@ -136,19 +31,24 @@ "lanes": "85,86,87,88", "admin_status": "up" }, - "Ethernet108": { - "alias": "fortyGigE0/108", - "lanes": "81,82,83,84", + "Ethernet68": { + "alias": "fortyGigE0/68", + "lanes": "69,70,71,72", "admin_status": "up" }, - "Ethernet112": { - "alias": "fortyGigE0/112", - "lanes": "89,90,91,92", + "Ethernet96": { + "alias": "fortyGigE0/96", + "lanes": "121,122,123,124", "admin_status": "up" }, - "Ethernet116": { - "alias": "fortyGigE0/116", - "lanes": "93,94,95,96", + "Ethernet124": { + "alias": "fortyGigE0/124", + "lanes": "101,102,103,104", + "admin_status": "up" + }, + "Ethernet92": { + "alias": "fortyGigE0/92", + "lanes": "113,114,115,116", "admin_status": "up" }, "Ethernet120": { @@ -156,9 +56,109 @@ "lanes": "97,98,99,100", "admin_status": "up" }, - "Ethernet124": { - "alias": "fortyGigE0/124", - "lanes": "101,102,103,104", + "Ethernet52": { + "alias": "fortyGigE0/52", + "lanes": "53,54,55,56", + "admin_status": "up" + }, + "Ethernet56": { + "alias": "fortyGigE0/56", + "lanes": "61,62,63,64", + "admin_status": "up" + }, + "Ethernet76": { + "alias": "fortyGigE0/76", + "lanes": "73,74,75,76", + "admin_status": "up" + }, + "Ethernet72": { + "alias": "fortyGigE0/72", + "lanes": "77,78,79,80", + "admin_status": "up" + }, + "Ethernet64": { + "alias": "fortyGigE0/64", + "lanes": "65,66,67,68", + "admin_status": "up" + }, + "Ethernet32": { + "alias": "fortyGigE0/32", + "lanes": "9,10,11,12", + "admin_status": "up" + }, + "Ethernet16": { + "alias": "fortyGigE0/16", + "lanes": "41,42,43,44", + "admin_status": "up" + }, + "Ethernet36": { + "alias": "fortyGigE0/36", + "lanes": "13,14,15,16", + "admin_status": "up" + }, + "Ethernet12": { + "alias": "fortyGigE0/12", + "lanes": "33,34,35,36", + "admin_status": "up" + }, + "Ethernet88": { + "alias": "fortyGigE0/88", + "lanes": "117,118,119,120", + "admin_status": "up" + }, + "Ethernet116": { + "alias": "fortyGigE0/116", + "lanes": "93,94,95,96", + "admin_status": "up" + }, + "Ethernet80": { + "alias": "fortyGigE0/80", + "lanes": "105,106,107,108", + "admin_status": "up" + }, + "Ethernet112": { + "alias": "fortyGigE0/112", + "lanes": "89,90,91,92", + "admin_status": "up" + }, + "Ethernet84": { + "alias": "fortyGigE0/84", + "lanes": "109,110,111,112", + "admin_status": "up" + }, + "Ethernet48": { + "alias": "fortyGigE0/48", + "lanes": "49,50,51,52", + "admin_status": "up" + }, + "Ethernet44": { + "alias": "fortyGigE0/44", + "lanes": "17,18,19,20", + "admin_status": "up" + }, + "Ethernet40": { + "alias": "fortyGigE0/40", + "lanes": "21,22,23,24", + "admin_status": "up" + }, + "Ethernet28": { + "alias": "fortyGigE0/28", + "lanes": "1,2,3,4", + "admin_status": "up" + }, + "Ethernet60": { + "alias": "fortyGigE0/60", + "lanes": "57,58,59,60", + "admin_status": "up" + }, + "Ethernet20": { + "alias": "fortyGigE0/20", + "lanes": "45,46,47,48", + "admin_status": "up" + }, + "Ethernet24": { + "alias": "fortyGigE0/24", + "lanes": "5,6,7,8", "admin_status": "up" } }, @@ -168,79 +168,16 @@ } }, "VLAN_MEMBER": { + "Vlan1000|Ethernet8": { + "tagging_mode": "untagged" + }, "Vlan1000|Ethernet0": { "tagging_mode": "untagged" }, "Vlan1000|Ethernet4": { "tagging_mode": "untagged" }, - "Vlan1000|Ethernet8": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet12": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet16": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet20": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet24": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet28": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet32": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet36": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet40": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet44": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet48": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet52": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet56": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet60": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet64": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet68": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet72": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet76": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet80": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet84": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet88": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet92": { - "tagging_mode": "untagged" - }, - "Vlan1000|Ethernet96": { + "Vlan1000|Ethernet108": { "tagging_mode": "untagged" }, "Vlan1000|Ethernet100": { @@ -249,19 +186,82 @@ "Vlan1000|Ethernet104": { "tagging_mode": "untagged" }, - "Vlan1000|Ethernet108": { + "Vlan1000|Ethernet68": { "tagging_mode": "untagged" }, - "Vlan1000|Ethernet112": { + "Vlan1000|Ethernet96": { "tagging_mode": "untagged" }, - "Vlan1000|Ethernet116": { + "Vlan1000|Ethernet124": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet92": { "tagging_mode": "untagged" }, "Vlan1000|Ethernet120": { "tagging_mode": "untagged" }, - "Vlan1000|Ethernet124": { + "Vlan1000|Ethernet52": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet56": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet76": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet72": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet64": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet32": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet16": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet36": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet12": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet88": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet116": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet80": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet112": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet84": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet48": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet44": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet40": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet28": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet60": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet20": { + "tagging_mode": "untagged" + }, + "Vlan1000|Ethernet24": { "tagging_mode": "untagged" } } diff --git a/src/sonic-config-engine/tests/sample_output/ports.json b/src/sonic-config-engine/tests/sample_output/ports.json index 36f5ad117c..0e174972fb 100644 --- a/src/sonic-config-engine/tests/sample_output/ports.json +++ b/src/sonic-config-engine/tests/sample_output/ports.json @@ -1,4 +1,11 @@ [ + { + "PORT_TABLE:Ethernet8": { + "speed": "1000", + "description": "Interface description" + }, + "OP": "SET" + }, { "PORT_TABLE:Ethernet0": { "speed": "10000", @@ -13,13 +20,6 @@ }, "OP": "SET" }, - { - "PORT_TABLE:Ethernet8": { - "speed": "1000", - "description": "Interface description" - }, - "OP": "SET" - }, { "PORT_TABLE:Ethernet12": { "speed": "100000", diff --git a/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-vni-zebra.conf b/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-vni-zebra.conf index 7b7987650d..fb441f69f6 100644 --- a/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-vni-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-vni-zebra.conf @@ -22,13 +22,13 @@ vni 9000 ! Enable nht through default route ip nht resolve-via-default ! Enable link-detect (default disabled) -interface Ethernet0 +interface Ethernet8 link-detect ! interface Ethernet4 link-detect ! -interface Ethernet8 +interface Ethernet0 link-detect ! !! diff --git a/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-zebra.conf b/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-zebra.conf index fc8a8a2fb3..908280e2dd 100644 --- a/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-zebra.conf +++ b/src/sonic-config-engine/tests/sample_output/t2-chassis-fe-zebra.conf @@ -22,13 +22,13 @@ vni 8000 ! Enable nht through default route ip nht resolve-via-default ! Enable link-detect (default disabled) -interface Ethernet0 +interface Ethernet8 link-detect ! interface Ethernet4 link-detect ! -interface Ethernet8 +interface Ethernet0 link-detect ! !! diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh index 6d90afa60a..2af5cee2f0 100644 --- a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh @@ -24,8 +24,8 @@ function wait_until_iface_ready # Wait for all interfaces with IPv4 addresses to be up and ready wait_until_iface_ready Vlan1000 192.168.0.1/27 -wait_until_iface_ready PortChannel01 10.0.0.56/31 wait_until_iface_ready PortChannel02 10.0.0.58/31 wait_until_iface_ready PortChannel03 10.0.0.60/31 wait_until_iface_ready PortChannel04 10.0.0.62/31 +wait_until_iface_ready PortChannel01 10.0.0.56/31 diff --git a/src/sonic-config-engine/tests/sample_output/zebra_frr.conf b/src/sonic-config-engine/tests/sample_output/zebra_frr.conf index f596c5579d..4024f4b340 100644 --- a/src/sonic-config-engine/tests/sample_output/zebra_frr.conf +++ b/src/sonic-config-engine/tests/sample_output/zebra_frr.conf @@ -19,13 +19,13 @@ log facility local4 ! Enable nht through default route ip nht resolve-via-default ! Enable link-detect (default disabled) -interface PortChannel01 +interface PortChannel03 link-detect ! interface PortChannel02 link-detect ! -interface PortChannel03 +interface PortChannel01 link-detect ! interface PortChannel04 diff --git a/src/sonic-config-engine/tests/sample_output/zebra_quagga.conf b/src/sonic-config-engine/tests/sample_output/zebra_quagga.conf index aa3486b016..b1b791b252 100644 --- a/src/sonic-config-engine/tests/sample_output/zebra_quagga.conf +++ b/src/sonic-config-engine/tests/sample_output/zebra_quagga.conf @@ -9,13 +9,13 @@ password zebra enable password zebra ! ! Enable link-detect (default disabled) -interface PortChannel01 +interface PortChannel03 link-detect ! interface PortChannel02 link-detect ! -interface PortChannel03 +interface PortChannel01 link-detect ! interface PortChannel04 diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 01c8f7b725..9712a019a5 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -1,8 +1,11 @@ -from unittest import TestCase import json import subprocess import os +import tests.common_utils as utils + +from unittest import TestCase + TOR_ROUTER = 'ToRRouter' BACKEND_TOR_ROUTER = 'BackEndToRRouter' @@ -85,17 +88,22 @@ class TestCfgGen(TestCase): def test_additional_json_data_level1_key(self): argument = '-a \'{"k1":{"k11":"v11","k12":"v12"}, "k2":{"k22":"v22"}}\' --var-json k1' output = self.run_script(argument) - self.assertEqual(output.strip(), '{\n "k11": "v11", \n "k12": "v12"\n}') + self.assertEqual(utils.to_dict(output.strip()), utils.to_dict('{\n "k11": "v11", \n "k12": "v12"\n}')) def test_additional_json_data_level2_key(self): argument = '-a \'{"k1":{"k11":"v11","k12":"v12"},"k2":{"k22":"v22"}}\' --var-json k1 -K k11' output = self.run_script(argument) - self.assertEqual(output.strip(), '{\n "k11": "v11"\n}') + self.assertEqual(utils.to_dict(output.strip()), utils.to_dict('{\n "k11": "v11"\n}')) def test_var_json_data(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" --var-json VLAN_MEMBER' output = self.run_script(argument) - self.assertEqual(output.strip(), '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n }\n}') + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + '{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n }\n}' + ) + ) def test_read_yaml(self): argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml') @@ -137,16 +145,20 @@ class TestCfgGen(TestCase): 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" - "{'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL', 'stage': 'ingress'}, " - "'EVERFLOW': {'stage': 'ingress', 'type': 'MIRROR', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOW'}, " - "'EVERFLOW_EGRESS': {'stage': 'egress', 'type': 'MIRROR', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOW_EGRESS'}, " - "'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT', 'stage': 'ingress'}, " - "'DATAACLINGRESS': {'stage': 'ingress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04'], 'policy_desc': 'DATAACLINGRESS'}, " - "'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'stage': 'ingress'}, " - "'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL', 'stage': 'ingress'}, " - "'DATAACLEGRESS': {'stage': 'egress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02'], 'policy_desc': 'DATAACLEGRESS'}, " - "'EVERFLOWV6': {'stage': 'ingress', 'type': 'MIRRORV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOWV6'}}") + self.assertEqual( + utils.to_dict(output.strip().replace("Warning: Ignoring Control Plane ACL NTP_ACL without type\n", '')), + utils.to_dict( + "{'NTP_ACL': {'services': ['NTP'], 'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL', 'stage': 'ingress'}, " + "'EVERFLOW': {'stage': 'ingress', 'type': 'MIRROR', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOW'}, " + "'EVERFLOW_EGRESS': {'stage': 'egress', 'type': 'MIRROR', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOW_EGRESS'}, " + "'ROUTER_PROTECT': {'services': ['SSH', 'SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'ROUTER_PROTECT', 'stage': 'ingress'}, " + "'DATAACLINGRESS': {'stage': 'ingress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04'], 'policy_desc': 'DATAACLINGRESS'}, " + "'SNMP_ACL': {'services': ['SNMP'], 'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'stage': 'ingress'}, " + "'SSH_ACL': {'services': ['SSH'], 'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL', 'stage': 'ingress'}, " + "'DATAACLEGRESS': {'stage': 'egress', 'type': 'L3', 'ports': ['PortChannel01', 'PortChannel02'], 'policy_desc': 'DATAACLEGRESS'}, " + "'EVERFLOWV6': {'stage': 'ingress', 'type': 'MIRRORV6', 'ports': ['PortChannel01', 'PortChannel02', 'PortChannel03', 'PortChannel04', 'Ethernet4', 'Ethernet100'], 'policy_desc': 'EVERFLOWV6'}}" + ) + ) # everflow portion is not used # def test_minigraph_everflow(self): @@ -157,7 +169,10 @@ class TestCfgGen(TestCase): def test_minigraph_mgmt_ports(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v MGMT_PORT' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'eth0': {'alias': 'Management0', 'admin_status': 'up'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'eth0': {'alias': 'Management0', 'admin_status': 'up'}}") + ) def test_minigraph_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "INTERFACE.keys()"' @@ -167,12 +182,20 @@ class TestCfgGen(TestCase): def test_minigraph_vlans(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}" + ) + ) def test_minigraph_vlan_members(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN_MEMBER' output = self.run_script(argument) - self.assertEqual(output.strip(), "{('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}}") + self.assertEqual( + output.strip(), + "{('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}}" + ) def test_minigraph_vlan_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"' @@ -182,27 +205,42 @@ class TestCfgGen(TestCase): def test_minigraph_portchannels(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}") + ) def test_minigraph_portchannel_with_more_member(self): argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '3', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'PortChannel01': {'admin_status': 'up', 'min_links': '3', 'members': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124'], 'mtu': '9100'}}") + ) def test_minigraph_portchannel_members(self): argument = '-m "' + self.sample_graph_pc_test + '" -p "' + self.port_config + '" -v "PORTCHANNEL_MEMBER.keys()"' output = self.run_script(argument) - self.assertEqual(output.strip(), "[('PortChannel01', 'Ethernet120'), ('PortChannel01', 'Ethernet116'), ('PortChannel01', 'Ethernet124'), ('PortChannel01', 'Ethernet112')]") + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("[('PortChannel01', 'Ethernet120'), ('PortChannel01', 'Ethernet116'), ('PortChannel01', 'Ethernet124'), ('PortChannel01', 'Ethernet112')]") + ) def test_minigraph_portchannel_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORTCHANNEL_INTERFACE.keys()"' output = self.run_script(argument) - self.assertEqual(output.strip(), "['PortChannel01', ('PortChannel01', '10.0.0.56/31'), ('PortChannel01', 'FC00::71/126')]") + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("['PortChannel01', ('PortChannel01', '10.0.0.56/31'), ('PortChannel01', 'FC00::71/126')]") + ) def test_minigraph_neighbors(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}") + ) # FIXME: This test depends heavily on the ordering of the interfaces and # it is not at all intuitive what that ordering should be. Could make it @@ -210,39 +248,57 @@ class TestCfgGen(TestCase): 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(), \ + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( "{'Ethernet124': {'name': 'ARISTA04T1', 'port': 'Ethernet1/1'}, " "'Ethernet120': {'name': 'ARISTA03T1', 'port': 'Ethernet1/1'}, " "'Ethernet4': {'name': 'Servers0', 'port': 'eth0'}, " "'Ethernet116': {'name': 'ARISTA02T1', 'port': 'Ethernet1/1'}, " "'Ethernet100': {'name': 'Servers100', 'port': 'eth0'}, " "'Ethernet112': {'name': 'ARISTA01T1', 'port': 'Ethernet1/1'}}") + ) def test_minigraph_port_description(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}") + ) def test_minigraph_port_fec_disabled(self): # Test for FECDisabled argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet4\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '100000'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'lanes': '25,26,27,28', 'description': 'Servers0:eth0', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/4', 'admin_status': 'up', 'speed': '100000'}") + ) def test_minigraph_port_rs(self): argument = '-m "' + self.sample_graph_t0 + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet124\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1: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) - self.assertEqual(output.strip(), "{'rrclient': 0, 'name': 'ARISTA02T1', 'local_addr': '10.0.0.58', 'nhopself': 0, 'holdtime': '180', 'asn': '64600', 'keepalive': '60'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'rrclient': 0, 'name': 'ARISTA02T1', 'local_addr': '10.0.0.58', 'nhopself': 0, 'holdtime': '180', 'asn': '64600', 'keepalive': '60'}") + ) def test_minigraph_peers_with_range(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v BGP_PEER_RANGE.values\(\)' output = self.run_script(argument) - self.assertEqual(output.strip(), "[{'src_address': '10.1.0.32', 'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("[{'src_address': '10.1.0.32', 'name': 'BGPSLBPassive', 'ip_range': ['10.10.10.10/26', '100.100.100.100/26']}]") + ) def test_minigraph_deployment_id(self): argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' @@ -252,86 +308,100 @@ class TestCfgGen(TestCase): 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(), "{'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}") + ) argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT[\'Ethernet12\']"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}") + ) def test_minigraph_neighbor_interfaces(self): argument = '-m "' + self.sample_graph_simple_case + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) - self.assertEqual(output.strip(), \ - "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '40000'}, " - "'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'}, " - "'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'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '10000'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") + 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'}, " + "'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'}, " + "'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'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '10000'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}" + ) + ) def test_minigraph_extra_ethernet_interfaces(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "PORT"' output = self.run_script(argument) - self.assertEqual(output.strip(), \ - "{'Ethernet8': {'lanes': '37,38,39,40', 'description': 'Interface description', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/8', 'admin_status': 'up', 'speed': '1000'}, " - "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', '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'}, " - "'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'}, " - "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " - "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " - "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " - "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " - "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " - "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " - "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " - "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " - "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " - "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " - "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " - "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " - "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " - "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}, " - "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " - "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " - "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " - "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " - "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " - "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " - "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " - "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " - "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " - "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " - "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " - "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}") + 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': '1000'}, " + "'Ethernet0': {'lanes': '29,30,31,32', 'description': 'fortyGigE0/0', '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'}, " + "'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'}, " + "'Ethernet68': {'alias': 'fortyGigE0/68', 'pfc_asym': 'off', 'lanes': '69,70,71,72', 'description': 'fortyGigE0/68', 'mtu': '9100'}, " + "'Ethernet96': {'alias': 'fortyGigE0/96', 'pfc_asym': 'off', 'lanes': '121,122,123,124', 'description': 'fortyGigE0/96', 'mtu': '9100'}, " + "'Ethernet124': {'alias': 'fortyGigE0/124', 'pfc_asym': 'off', 'lanes': '101,102,103,104', 'description': 'fortyGigE0/124', 'mtu': '9100'}, " + "'Ethernet92': {'alias': 'fortyGigE0/92', 'pfc_asym': 'off', 'lanes': '113,114,115,116', 'description': 'fortyGigE0/92', 'mtu': '9100'}, " + "'Ethernet120': {'alias': 'fortyGigE0/120', 'pfc_asym': 'off', 'lanes': '97,98,99,100', 'description': 'fortyGigE0/120', 'mtu': '9100'}, " + "'Ethernet52': {'alias': 'fortyGigE0/52', 'pfc_asym': 'off', 'lanes': '53,54,55,56', 'description': 'fortyGigE0/52', 'mtu': '9100'}, " + "'Ethernet56': {'alias': 'fortyGigE0/56', 'pfc_asym': 'off', 'lanes': '61,62,63,64', 'description': 'fortyGigE0/56', 'mtu': '9100'}, " + "'Ethernet76': {'alias': 'fortyGigE0/76', 'pfc_asym': 'off', 'lanes': '73,74,75,76', 'description': 'fortyGigE0/76', 'mtu': '9100'}, " + "'Ethernet72': {'alias': 'fortyGigE0/72', 'pfc_asym': 'off', 'lanes': '77,78,79,80', 'description': 'fortyGigE0/72', 'mtu': '9100'}, " + "'Ethernet64': {'alias': 'fortyGigE0/64', 'pfc_asym': 'off', 'lanes': '65,66,67,68', 'description': 'fortyGigE0/64', 'mtu': '9100'}, " + "'Ethernet32': {'alias': 'fortyGigE0/32', 'pfc_asym': 'off', 'lanes': '9,10,11,12', 'description': 'fortyGigE0/32', 'mtu': '9100'}, " + "'Ethernet16': {'alias': 'fortyGigE0/16', 'pfc_asym': 'off', 'lanes': '41,42,43,44', 'description': 'fortyGigE0/16', 'mtu': '9100'}, " + "'Ethernet36': {'alias': 'fortyGigE0/36', 'pfc_asym': 'off', 'lanes': '13,14,15,16', 'description': 'fortyGigE0/36', 'mtu': '9100'}, " + "'Ethernet12': {'lanes': '33,34,35,36', 'fec': 'rs', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'pfc_asym': 'off', 'speed': '100000', 'description': 'Interface description'}, " + "'Ethernet88': {'alias': 'fortyGigE0/88', 'pfc_asym': 'off', 'lanes': '117,118,119,120', 'description': 'fortyGigE0/88', 'mtu': '9100'}, " + "'Ethernet116': {'alias': 'fortyGigE0/116', 'pfc_asym': 'off', 'lanes': '93,94,95,96', 'description': 'fortyGigE0/116', 'mtu': '9100'}, " + "'Ethernet80': {'alias': 'fortyGigE0/80', 'pfc_asym': 'off', 'lanes': '105,106,107,108', 'description': 'fortyGigE0/80', 'mtu': '9100'}, " + "'Ethernet112': {'alias': 'fortyGigE0/112', 'pfc_asym': 'off', 'lanes': '89,90,91,92', 'description': 'fortyGigE0/112', 'mtu': '9100'}, " + "'Ethernet84': {'alias': 'fortyGigE0/84', 'pfc_asym': 'off', 'lanes': '109,110,111,112', 'description': 'fortyGigE0/84', 'mtu': '9100'}, " + "'Ethernet48': {'alias': 'fortyGigE0/48', 'pfc_asym': 'off', 'lanes': '49,50,51,52', 'description': 'fortyGigE0/48', 'mtu': '9100'}, " + "'Ethernet44': {'alias': 'fortyGigE0/44', 'pfc_asym': 'off', 'lanes': '17,18,19,20', 'description': 'fortyGigE0/44', 'mtu': '9100'}, " + "'Ethernet40': {'alias': 'fortyGigE0/40', 'pfc_asym': 'off', 'lanes': '21,22,23,24', 'description': 'fortyGigE0/40', 'mtu': '9100'}, " + "'Ethernet28': {'alias': 'fortyGigE0/28', 'pfc_asym': 'off', 'lanes': '1,2,3,4', 'description': 'fortyGigE0/28', 'mtu': '9100'}, " + "'Ethernet60': {'alias': 'fortyGigE0/60', 'pfc_asym': 'off', 'lanes': '57,58,59,60', 'description': 'fortyGigE0/60', 'mtu': '9100'}, " + "'Ethernet20': {'alias': 'fortyGigE0/20', 'pfc_asym': 'off', 'lanes': '45,46,47,48', 'description': 'fortyGigE0/20', 'mtu': '9100'}, " + "'Ethernet24': {'alias': 'fortyGigE0/24', 'pfc_asym': 'off', 'lanes': '5,6,7,8', 'description': 'fortyGigE0/24', 'mtu': '9100'}}" + ) + ) # everflow portion is not used # def test_metadata_everflow(self): @@ -342,12 +412,15 @@ class TestCfgGen(TestCase): def test_metadata_tacacs(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "TACPLUS_SERVER"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'10.0.10.7': {'priority': '1', 'tcp_port': '49'}, '10.0.10.8': {'priority': '1', 'tcp_port': '49'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'10.0.10.7': {'priority': '1', 'tcp_port': '49'}, '10.0.10.8': {'priority': '1', 'tcp_port': '49'}}") + ) def test_metadata_ntp(self): argument = '-m "' + self.sample_graph_metadata + '" -p "' + self.port_config + '" -v "NTP_SERVER"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}") + self.assertEqual(utils.to_dict(output.strip()), utils.to_dict("{'10.0.10.1': {}, '10.0.10.2': {}}")) def test_minigraph_vnet(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VNET"' @@ -362,7 +435,10 @@ class TestCfgGen(TestCase): def test_minigraph_bgp_mon(self): argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "BGP_MONITORS"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'10.20.30.40': {'rrclient': 0, 'name': 'BGPMonitor', 'local_addr': '10.1.0.32', 'nhopself': 0, 'holdtime': '10', 'asn': '0', 'keepalive': '3'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'10.20.30.40': {'rrclient': 0, 'name': 'BGPMonitor', 'local_addr': '10.1.0.32', 'nhopself': 0, 'holdtime': '10', 'asn': '0', 'keepalive': '3'}}") + ) def test_minigraph_sub_port_interfaces(self, check_stderr=True): try: @@ -399,14 +475,18 @@ class TestCfgGen(TestCase): # VLAN_SUB_INTERFACE argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v VLAN_SUB_INTERFACE' output = self.run_script(argument) - print output.strip() - self.assertEqual(output.strip(), \ + print(output.strip()) + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( "{('PortChannel01.10', '10.0.0.56/31'): {}, " "'Ethernet0.10': {'admin_status': 'up'}, " "('Ethernet0.10', '10.0.0.58/31'): {}, " "('PortChannel01.10', 'FC00::71/126'): {}, " "'PortChannel01.10': {'admin_status': 'up'}, " - "('Ethernet0.10', 'FC00::75/126'): {}}") + "('Ethernet0.10', 'FC00::75/126'): {}}" + ) + ) finally: print '\n Change device type back to %s' % (TOR_ROUTER) diff --git a/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py b/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py index f6de921211..3477f684ed 100644 --- a/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py +++ b/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py @@ -1,6 +1,10 @@ -from unittest import TestCase -import subprocess import os +import subprocess + +import tests.common_utils as utils + +from unittest import TestCase + class TestCfgGenT2ChassisFe(TestCase): @@ -34,24 +38,31 @@ class TestCfgGenT2ChassisFe(TestCase): def test_minigraph_t2_chassis_fe_interfaces(self): argument = '-m "' + self.sample_graph_t2_chassis_fe + '" -p "' + self.t2_chassis_fe_port_config + '" -v "INTERFACE"' output = self.run_script(argument) - self.assertEqual(output.strip(), - "{'Ethernet8': {}, " - "('Ethernet8', '172.16.0.9/30'): {}, " - "'Ethernet0': {'vnet_name': 'VnetFE'}, " - "('Ethernet4', '172.16.0.1/30'): {}, " - "('Ethernet0', '192.168.0.2/30'): {}, " - "'Ethernet4': {}}") - + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + "{'Ethernet8': {}, " + "('Ethernet8', '172.16.0.9/30'): {}, " + "'Ethernet0': {'vnet_name': 'VnetFE'}, " + "('Ethernet4', '172.16.0.1/30'): {}, " + "('Ethernet0', '192.168.0.2/30'): {}, " + "'Ethernet4': {}}" + ) + ) def test_minigraph_t2_chassis_fe_pc_interfaces(self): argument = '-m "' + self.sample_graph_t2_chassis_fe_pc + '" -p "' + self.t2_chassis_fe_port_config + '" -v "PORTCHANNEL_INTERFACE"' output = self.run_script(argument) - self.assertEqual(output.strip(), - "{'PortChannel8': {}, " - "('PortChannel0', '192.168.0.2/30'): {}, " - "('PortChannel4', '172.16.0.1/30'): {}, " - "'PortChannel4': {}, " - "('PortChannel8', '172.16.0.9/30'): {}, " - "'PortChannel0': {'vnet_name': 'VnetFE'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict( + "{'PortChannel8': {}, " + "('PortChannel0', '192.168.0.2/30'): {}, " + "('PortChannel4', '172.16.0.1/30'): {}, " + "'PortChannel4': {}, " + "('PortChannel8', '172.16.0.9/30'): {}, " + "'PortChannel0': {'vnet_name': 'VnetFE'}}" + ) + ) # Test a minigraph file where VNI is not specified # Default VNI is 8000 diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 387f58a3a6..076d0d604e 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -1,6 +1,10 @@ -from unittest import TestCase -import subprocess import os +import subprocess + +import tests.common_utils as utils + +from unittest import TestCase + class TestCfgGenCaseInsensitive(TestCase): @@ -73,7 +77,10 @@ class TestCfgGenCaseInsensitive(TestCase): def test_minigraph_vlans(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v VLAN' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'Vlan1000': {'alias': 'ab1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '1000'}}") + ) def test_minigraph_vlan_members(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v VLAN_MEMBER' @@ -88,12 +95,17 @@ class TestCfgGenCaseInsensitive(TestCase): def test_minigraph_portchannels(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v PORTCHANNEL' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'PortChannel01': {'admin_status': 'up', 'min_links': '1', 'members': ['Ethernet4'], 'mtu': '9100'}}") + ) def test_minigraph_console_port(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v CONSOLE_PORT' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'1': {'baud_rate': '9600', 'remote_device': 'managed_device', 'flow_control': 1}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'1': {'baud_rate': '9600', 'remote_device': 'managed_device', 'flow_control': 1}}")) def test_minigraph_deployment_id(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'deployment_id\']"' @@ -103,7 +115,10 @@ class TestCfgGenCaseInsensitive(TestCase): def test_minigraph_neighbor_metadata(self): argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "DEVICE_NEIGHBOR_METADATA"' output = self.run_script(argument) - self.assertEqual(output.strip(), "{'switch-01t1': {'lo_addr': '10.1.0.186/32', 'mgmt_addr': '10.7.0.196/26', 'hwsku': 'Force10-S6000', 'type': 'LeafRouter', 'deployment_id': '2'}}") + self.assertEqual( + utils.to_dict(output.strip()), + utils.to_dict("{'switch-01t1': {'lo_addr': '10.1.0.186/32', 'mgmt_addr': '10.7.0.196/26', 'hwsku': 'Force10-S6000', 'type': 'LeafRouter', 'deployment_id': '2'}}") + ) # everflow portion is not used # def test_metadata_everflow(self): diff --git a/src/sonic-config-engine/tests/test_multinpu_cfggen.py b/src/sonic-config-engine/tests/test_multinpu_cfggen.py index 0747ee2ad5..de4f1e597d 100644 --- a/src/sonic-config-engine/tests/test_multinpu_cfggen.py +++ b/src/sonic-config-engine/tests/test_multinpu_cfggen.py @@ -1,10 +1,14 @@ -import unittest -from unittest import TestCase -import subprocess -import os import json -import yaml +import os import shutil +import subprocess +import unittest +import yaml + +import tests.common_utils as utils + +from unittest import TestCase + SKU = 'multi-npu-01' ASIC_SKU = 'multi-npu-asic' @@ -136,27 +140,35 @@ class TestMultiNpuCfgGen(TestCase): def test_frontend_asic_portchannel_mem(self): argument = "-m {} -p {} -n asic0 --var-json \"PORTCHANNEL_MEMBER\"".format(self.sample_graph, self.port_config[0]) - output = json.loads(self.run_script(argument)) - self.assertListEqual(output.keys(), \ - ['PortChannel4002|Ethernet-BP8', 'PortChannel0002|Ethernet0', 'PortChannel0002|Ethernet4', 'PortChannel4002|Ethernet-BP12', 'PortChannel4001|Ethernet-BP0', 'PortChannel4001|Ethernet-BP4']) + output = self.run_script(argument) + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("['PortChannel4002|Ethernet-BP8', 'PortChannel0002|Ethernet0', 'PortChannel0002|Ethernet4', 'PortChannel4002|Ethernet-BP12', 'PortChannel4001|Ethernet-BP0', 'PortChannel4001|Ethernet-BP4']") + ) def test_backend_asic_portchannels_mem(self): argument = "-m {} -p {} -n asic3 --var-json \"PORTCHANNEL_MEMBER\"".format(self.sample_graph, self.port_config[3]) - output = json.loads(self.run_script(argument)) - self.assertListEqual(output.keys(), \ - ['PortChannel4013|Ethernet-BP384', 'PortChannel4014|Ethernet-BP392', 'PortChannel4014|Ethernet-BP396', 'PortChannel4013|Ethernet-BP388']) + output = self.run_script(argument) + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("['PortChannel4013|Ethernet-BP384', 'PortChannel4014|Ethernet-BP392', 'PortChannel4014|Ethernet-BP396', 'PortChannel4013|Ethernet-BP388']") + ) def test_frontend_asic_portchannel_intf(self): argument = "-m {} -p {} -n asic0 --var-json \"PORTCHANNEL_INTERFACE\"".format(self.sample_graph, self.port_config[0]) - output = json.loads(self.run_script(argument)) - self.assertListEqual(output.keys(), \ - ['PortChannel4001|10.1.0.1/31', 'PortChannel0002|FC00::1/126', 'PortChannel4002|10.1.0.3/31', 'PortChannel0002', 'PortChannel0002|10.0.0.0/31', 'PortChannel4001', 'PortChannel4002']) + output = self.run_script(argument) + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("['PortChannel4001|10.1.0.1/31', 'PortChannel0002|FC00::1/126', 'PortChannel4002|10.1.0.3/31', 'PortChannel0002', 'PortChannel0002|10.0.0.0/31', 'PortChannel4001', 'PortChannel4002']") + ) def test_backend_asic_portchannel_intf(self): argument = "-m {} -p {} -n asic3 --var-json \"PORTCHANNEL_INTERFACE\"".format(self.sample_graph, self.port_config[3]) - output = json.loads(self.run_script(argument)) - self.assertListEqual(output.keys(), \ - ['PortChannel4013', 'PortChannel4013|10.1.0.2/31', 'PortChannel4014', 'PortChannel4014|10.1.0.6/31']) + output = self.run_script(argument) + self.assertEqual( + utils.liststr_to_dict(output.strip()), + utils.liststr_to_dict("['PortChannel4013', 'PortChannel4013|10.1.0.2/31', 'PortChannel4014', 'PortChannel4014|10.1.0.6/31']") + ) def test_frontend_asic_ports(self): argument = "-m {} -p {} -n asic0 --var-json \"PORT\"".format(self.sample_graph, self.port_config[0])