[cfggen] Remove NatSorted

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 <tamer.ahmed@microsoft.com>
This commit is contained in:
Tamer Ahmed 2020-09-28 20:07:39 -07:00 committed by Tamer Ahmed
parent c55bb03cfc
commit 9122d16dd2
28 changed files with 1034 additions and 874 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
!

View File

@ -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
@ -15,11 +16,13 @@ log facility local4
! end of template: common/daemons.common.conf.j2!
agentx
!
!
!
! Enable link-detect (default disabled)
interface Ethernet0
interface Ethernet4
link-detect
!
interface Ethernet4
interface Ethernet0
link-detect
!
interface PortChannel10
@ -46,14 +49,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
@ -73,10 +77,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

View File

@ -1,9 +1,10 @@
!
!
! Enable link-detect (default disabled)
interface Ethernet0
interface Ethernet4
link-detect
!
interface Ethernet4
interface Ethernet0
link-detect
!
interface PortChannel10
@ -12,3 +13,4 @@ link-detect
interface PortChannel20
link-detect
!
!

View File

@ -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,17 +15,18 @@ log facility local4
!
! end of template: common/daemons.common.conf.j2!
!
vrf First
vni 10
!
vrf Second
vni 20
!
vrf First
vni 10
!
!
! Enable link-detect (default disabled)
interface Ethernet0
interface Ethernet4
link-detect
!
interface Ethernet4
interface Ethernet0
link-detect
!
interface PortChannel10

View File

View File

@ -16,8 +16,6 @@ See usage string for detail description for arguments.
"""
from __future__ import print_function
import sys
sys.path.insert(0, "/usr/local/lib/python2.7/dist-packages")
# monkey patch re.compile to do lazy regular expression compilation.
# This is done to improve import time of jinja2, yaml, natsort modules, because they
@ -28,28 +26,24 @@ sys.path.insert(0, "/usr/local/lib/python2.7/dist-packages")
# FIXME: remove this once sonic-cfggen and templates dependencies are replaced with a faster approach
import lazy_re
import sys
import os.path
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, get_breakout_mode
from redis_bcc import RedisBytecodeCache
from sonic_py_common.multi_asic import get_asic_id_from_name, is_multi_asic
from sonic_py_common import device_info
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
#TODO: Remove STR_TYPE once SONiC moves to Python 3.x
PY3x = sys.version_info >= (3, 0)
@ -166,9 +160,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 STR_TYPE and lookup_key == key) or (type(key) is tuple and lookup_key in key)):
@ -280,7 +272,7 @@ def main():
platform = device_info.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 = {}
@ -314,17 +306,17 @@ 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:
if args.port_config is not None:
deep_update(data, parse_xml(minigraph, platform, args.port_config, asic_name=asic_name, hwsku_config_file=args.hwsku_config))
else:
deep_update(data, parse_xml(minigraph, platform, asic_name=asic_name))
else:
deep_update(data, parse_xml(minigraph, port_config_file=args.port_config, asic_name=asic_name, hwsku_config_file=args.hwsku_config))
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:
@ -335,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 +371,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 +402,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))

View File

@ -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

View File

@ -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"

View File

@ -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
!

View File

@ -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]"
}
}

View File

@ -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

View File

@ -19,13 +19,13 @@ agentx
!
!
! Enable link-detect (default disabled)
interface PortChannel01
interface PortChannel03
link-detect
!
interface PortChannel02
link-detect
!
interface PortChannel03
interface PortChannel01
link-detect
!
interface PortChannel04

View File

@ -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"

View File

@ -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"
}
}

View File

@ -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",

View File

@ -20,13 +20,13 @@ vni 9000
!
!
! Enable link-detect (default disabled)
interface Ethernet0
interface Ethernet8
link-detect
!
interface Ethernet4
link-detect
!
interface Ethernet8
interface Ethernet0
link-detect
!
!!

View File

@ -20,13 +20,13 @@ vni 8000
!
!
! Enable link-detect (default disabled)
interface Ethernet0
interface Ethernet8
link-detect
!
interface Ethernet4
link-detect
!
interface Ethernet8
interface Ethernet0
link-detect
!
!!

View File

@ -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

View File

@ -17,13 +17,13 @@ log facility local4
!
!
! Enable link-detect (default disabled)
interface PortChannel01
interface PortChannel03
link-detect
!
interface PortChannel02
link-detect
!
interface PortChannel03
interface PortChannel01
link-detect
!
interface PortChannel04

View File

@ -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

View File

@ -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'
@ -94,18 +97,23 @@ 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 "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}')
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict(
'{\n "Vlan1000|Ethernet8": {\n "tagging_mode": "untagged"\n },'
' \n "Vlan2020|Ethernet12": {\n "tagging_mode": "tagged"\n }\n}'
)
)
def test_read_yaml(self):
argument = '-v yml_item -y ' + os.path.join(self.test_dir, 'test.yml')
@ -147,16 +155,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):
@ -167,7 +179,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()"'
@ -177,16 +192,22 @@ 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'}, "
"'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020'}}")
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'}, "
"'Vlan2020': {'alias': 'kk1', 'dhcp_servers': ['192.0.0.1', '192.0.0.2'], 'vlanid': '2020'}}"
)
)
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'}, "
"('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}}")
self.assertEqual(
output.strip(),
"{('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, "
"('Vlan2020', 'Ethernet12'): {'tagging_mode': 'tagged'}}"
)
def test_minigraph_vlan_interfaces(self):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VLAN_INTERFACE.keys()"'
@ -196,27 +217,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
@ -224,39 +260,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\']"'
@ -266,86 +320,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', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', 'speed': '100000', 'description': 'Interface description'}")
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict("{'lanes': '33,34,35,36', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', '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', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', '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', 'pfc_asym': 'off', 'mtu': '9100', 'alias': 'fortyGigE0/12', 'admin_status': 'up', '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):
@ -356,12 +424,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"'
@ -376,7 +447,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:
@ -414,13 +488,17 @@ class TestCfgGen(TestCase):
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(), \
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))

View File

@ -1,8 +1,12 @@
from unittest import TestCase
import subprocess
import os
import json
import ast
import json
import os
import subprocess
import tests.common_utils as utils
from unittest import TestCase
# Global Variable
PLATFORM_OUTPUT_FILE = "platform_output.json"
@ -54,12 +58,12 @@ class TestCfgGenPlatformJson(TestCase):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet8\']"'
output = self.run_script(argument)
expected = "{'index': '3', 'lanes': '8', 'description': 'Eth3/1', 'admin_status': 'up', 'mtu': '9100', 'alias': 'Eth3/1', 'pfc_asym': 'off', 'speed': '25000'}"
self.assertEqual(output.strip(), expected)
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict(expected))
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.platform_json + '" -S "' + self.hwsku_json + '" -v "PORT[\'Ethernet112\']"'
output = self.run_script(argument)
expected = "{'index': '29', 'lanes': '112', 'description': 'Eth29/1', 'admin_status': 'up', 'mtu': '9100', 'alias': 'Eth29/1', 'pfc_asym': 'off', 'speed': '25000'}"
self.assertEqual(output.strip(), expected)
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict(expected))
# Check all Interface with it's proper configuration as per platform.json
def test_platform_json_all_ethernet_interfaces(self):

View File

@ -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

View File

@ -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):

View File

@ -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(list(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(list(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(list(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(list(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])