[chassis-packet] minigraph parsing and BGP template changes (#8966)

1. Changes for Generation LC-Graph for packet-based chassis.
2. Added Support Ipv6 Peering on Loopback4096 for voq also
3. Updated asic topology yml files to be offset of slot
4. Made slot_num to take string slot<number> instead of number
5. Consolidated template_dpg_voq_asic.j2 into dpg_asic.j2
6. Remove Loopback4096 from asic topology and parse as dut invertory for
   multi-asic
7. Updated topo_facts parsing for asic topology_
8. Internal BGP Session rename from <VoqChassisInternal> to <ChassisInternal> and take switch_type as value.
Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
This commit is contained in:
abdosi 2021-10-18 18:44:24 -07:00 committed by GitHub
parent c971fa7ff9
commit 3bb248bd67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 745 additions and 31 deletions

View File

@ -33,7 +33,7 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} {% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
{% set multi_asic = True %} {% set multi_asic = True %}
{% endif %} {% endif %}
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} {% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
route-map HIDE_INTERNAL permit 10 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
{% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %} {% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %}
@ -63,7 +63,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% endif %} {% endif %}
! !
{# set router-id #} {# set router-id #}
{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} {% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}
{% else %} {% else %}
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }} bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}
@ -71,7 +71,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
! !
{# advertise loopback #} {# advertise loopback #}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32 network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} {% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
{% endif %} {% endif %}
! !
@ -80,7 +80,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64 network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64
exit-address-family exit-address-family
{% endif %} {% endif %}
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq'%} {% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %} {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %}
address-family ipv6 address-family ipv6
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL
@ -102,7 +102,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% endblock vlan_advertisement %} {% endblock vlan_advertisement %}
! !
! !
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %} {% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map HIDE_INTERNAL
exit-address-family exit-address-family

View File

@ -1,10 +1,15 @@
! !
! template: bgpd/templates/internal/peer-group.conf.j2 ! template: bgpd/templates/internal/peer-group.conf.j2
{% from "common/functions.conf.j2" import get_ipv4_loopback_address %}
{% from "common/functions.conf.j2" import get_ipv6_loopback_address %}
! !
neighbor INTERNAL_PEER_V4 peer-group neighbor INTERNAL_PEER_V4 peer-group
neighbor INTERNAL_PEER_V6 peer-group neighbor INTERNAL_PEER_V6 peer-group
address-family ipv4 address-family ipv4
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
{% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
neighbor INTERNAL_PEER_V4 update-source {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
neighbor INTERNAL_PEER_V4 route-reflector-client neighbor INTERNAL_PEER_V4 route-reflector-client
{% endif %} {% endif %}
neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound
@ -13,7 +18,9 @@
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} {% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
neighbor INTERNAL_PEER_V4 update-source {{ get_ipv6_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
{% elif CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
neighbor INTERNAL_PEER_V6 route-reflector-client neighbor INTERNAL_PEER_V6 route-reflector-client
{% endif %} {% endif %}
neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound

View File

@ -125,6 +125,9 @@ class BGPPeerMgrBase(Manager):
if self.check_deployment_id: if self.check_deployment_id:
deps.append(("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/deployment_id")) deps.append(("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/deployment_id"))
if self.peer_type == 'internal':
deps.append(("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME, "Loopback4096"))
super(BGPPeerMgrBase, self).__init__( super(BGPPeerMgrBase, self).__init__(
common_objs, common_objs,
deps, deps,
@ -160,11 +163,17 @@ class BGPPeerMgrBase(Manager):
print_data = vrf, nbr, data print_data = vrf, nbr, data
bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"]
# #
lo0_ipv4 = self.get_lo0_ipv4() lo0_ipv4 = self.get_lo_ipv4("Loopback0|")
if lo0_ipv4 is None: if lo0_ipv4 is None:
log_warn("Loopback0 ipv4 address is not presented yet") log_warn("Loopback0 ipv4 address is not presented yet")
return False return False
# #
if self.peer_type == 'internal':
lo4096_ipv4 = self.get_lo_ipv4("Loopback4096|")
if lo4096_ipv4 is None:
log_warn("Loopback4096 ipv4 address is not presented yet")
return False
if "local_addr" not in data: if "local_addr" not in data:
log_warn("Peer %s. Missing attribute 'local_addr'" % nbr) log_warn("Peer %s. Missing attribute 'local_addr'" % nbr)
else: else:
@ -299,15 +308,15 @@ class BGPPeerMgrBase(Manager):
self.cfg_mgr.push(cmd) self.cfg_mgr.push(cmd)
return True return True
def get_lo0_ipv4(self): def get_lo_ipv4(self, loopback_str):
""" """
Extract Loopback0 ipv4 address from the Directory Extract Loopback0 ipv4 address from the Directory
:return: ipv4 address for Loopback0, None if nothing found :return: ipv4 address for Loopback0, None if nothing found
""" """
loopback0_ipv4 = None loopback0_ipv4 = None
for loopback in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME).keys(): for loopback in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME).keys():
if loopback.startswith("Loopback0|"): if loopback.startswith(loopback_str):
loopback0_prefix_str = loopback.replace("Loopback0|", "") loopback0_prefix_str = loopback.replace(loopback_str, "")
loopback0_ip_str = loopback0_prefix_str[:loopback0_prefix_str.find('/')] loopback0_ip_str = loopback0_prefix_str[:loopback0_prefix_str.find('/')]
if TemplateFabric.is_ipv4(loopback0_ip_str): if TemplateFabric.is_ipv4(loopback0_ip_str):
loopback0_ipv4 = loopback0_ip_str loopback0_ipv4 = loopback0_ip_str

View File

@ -75,7 +75,7 @@ class TemplateFabric(object):
return None return None
else: else:
try: try:
prefix = netaddr.IPNetwork(str(value)) prefix = netaddr.IPNetwork(str(value).strip())
except (netaddr.NotRegisteredError, netaddr.AddrFormatError, netaddr.AddrConversionError): except (netaddr.NotRegisteredError, netaddr.AddrFormatError, netaddr.AddrConversionError):
return None return None
return str(getattr(prefix, attr)) return str(getattr(prefix, attr))

View File

@ -0,0 +1,13 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {
"type": "SpineRouter",
"sub_role": "BackEnd",
"switch_type": "chassis-packet"
}
},
"CONFIG_DB__LOOPBACK_INTERFACE": {
"Loopback4096|10.10.10.10/32": {},
"Loopback4096|2603:10e2:400::3/128": {}
}
}

View File

@ -0,0 +1,22 @@
!
! template: bgpd/templates/internal/peer-group.conf.j2
!
neighbor INTERNAL_PEER_V4 peer-group
neighbor INTERNAL_PEER_V6 peer-group
address-family ipv4
neighbor INTERNAL_PEER_V4 update-source 10.10.10.10
neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V4 allowas-in 1
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
exit-address-family
address-family ipv6
neighbor INTERNAL_PEER_V4 update-source 2603:10e2:400::3
neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V6 allowas-in 1
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
exit-address-family
!
! end of template: bgpd/templates/internal/peer-group.conf.j2
!

View File

@ -0,0 +1,67 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00::/64
!
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp graceful-restart preserve-fw-state
bgp graceful-restart select-defer-time 45
!
bgp router-id 55.55.55.56
!
network 55.55.55.55/32
network 55.55.55.56/32 route-map HIDE_INTERNAL
!
address-family ipv6
network fc00::1/64
exit-address-family
address-family ipv6
network fc00::2/128 route-map HIDE_INTERNAL
exit-address-family
!
network 10.10.10.1/24
address-family ipv6
network fc01::1/64
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
exit-address-family
!
address-family ipv4
maximum-paths 64
exit-address-family
address-family ipv6
maximum-paths 64
exit-address-family
!
! end of template: bgpd/bgpd.main.conf.j2
!

View File

@ -0,0 +1,35 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"sub_role": "FrontEnd",
"switch_type": "chassis-packet"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {},
"Loopback0|fc00::1/128": {},
"Loopback4096|55.55.55.56/32": {},
"Loopback4096|fc00::2/128": {}
},
"VLAN_INTERFACE": {
"Vlan10|10.10.10.1/24": {},
"Vlan10|fc01::1/64": {},
"Vlan20": {"vnet_name": "Vnet1"},
"Vlan20|20.20.20.1/24": {},
"Vlan20|fd01::1/64": {}
},
"constants": {
"bgp": {
"multipath_relax": {
"enabled": true
},
"graceful_restart": {
"enabled": true
},
"maximum_paths": {
"enabled": true
}
}
}
}

View File

@ -51,6 +51,12 @@ def test_bgpd_main_conf_voq_chassis():
"bgpd.main.conf.j2/voq_chassis.json", "bgpd.main.conf.j2/voq_chassis.json",
"bgpd.main.conf.j2/voq_chassis.conf") "bgpd.main.conf.j2/voq_chassis.conf")
def test_bgpd_main_conf_packet_chassis():
run_test("Chassi packet bgpd.main.conf.j2",
"bgpd/bgpd.main.conf.j2",
"bgpd.main.conf.j2/packet_chassis.json",
"bgpd.main.conf.j2/packet_chassis.conf")
def test_tsa_isolate(): def test_tsa_isolate():
run_test("tsa/bgpd.tsa.isolate.conf.j2", run_test("tsa/bgpd.tsa.isolate.conf.j2",
"bgpd/tsa/bgpd.tsa.isolate.conf.j2", "bgpd/tsa/bgpd.tsa.isolate.conf.j2",

View File

@ -497,6 +497,7 @@ def parse_dpg(dpg, hname):
nhg_int = "" nhg_int = ""
nhportlist = [] nhportlist = []
dpg_ecmp_content = {} dpg_ecmp_content = {}
static_routes = {}
ipnhs = child.find(str(QName(ns, "IPNextHops"))) ipnhs = child.find(str(QName(ns, "IPNextHops")))
if ipnhs is not None: if ipnhs is not None:
for ipnh in ipnhs.findall(str(QName(ns, "IPNextHop"))): for ipnh in ipnhs.findall(str(QName(ns, "IPNextHop"))):
@ -508,8 +509,12 @@ def parse_dpg(dpg, hname):
port_nhipv4_map[ipnhfmbr] = ipnhaddr port_nhipv4_map[ipnhfmbr] = ipnhaddr
elif ":" in ipnhaddr: elif ":" in ipnhaddr:
port_nhipv6_map[ipnhfmbr] = ipnhaddr port_nhipv6_map[ipnhfmbr] = ipnhaddr
elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute':
prefix = ipnh.find(str(QName(ns, "AttachTo"))).text
nexthop = ipnh.find(str(QName(ns, "Address"))).text
static_routes[prefix] = {'nexthop': nexthop }
if port_nhipv4_map is not None and port_nhipv6_map is not None: if port_nhipv4_map and port_nhipv6_map:
subnet_check_ip = list(port_nhipv4_map.values())[0] subnet_check_ip = list(port_nhipv4_map.values())[0]
for subnet_range in ip_intfs_map: for subnet_range in ip_intfs_map:
if ("." in subnet_range): if ("." in subnet_range):
@ -701,8 +706,10 @@ def parse_dpg(dpg, hname):
if mg_key in mg_tunnel.attrib: if mg_key in mg_tunnel.attrib:
tunnelintfs[tunnel_type][tunnel_name][table_key] = mg_tunnel.attrib[mg_key] tunnelintfs[tunnel_type][tunnel_name][table_key] = mg_tunnel.attrib[mg_key]
return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content return intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnelintfs, dpg_ecmp_content, static_routes
return None, None, None, None, None, None, None, None, None, None, None, None, None return None, None, None, None, None, None, None, None, None, None, None, None, None, None, None
def parse_host_loopback(dpg, hname): def parse_host_loopback(dpg, hname):
for child in dpg: for child in dpg:
@ -738,10 +745,13 @@ def parse_cpg(cpg, hname, local_devices=[]):
nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0 nhopself = 1 if session.find(str(QName(ns, "NextHopSelf"))) is not None else 0
# choose the right table and admin_status for the peer # choose the right table and admin_status for the peer
voq_chassis = session.find(str(QName(ns, "VoQChassisInternal"))) chassis_internal_ibgp = session.find(str(QName(ns, "ChassisInternal")))
if voq_chassis is not None and voq_chassis.text == "true": if chassis_internal_ibgp is not None and chassis_internal_ibgp.text == "voq":
table = bgp_voq_chassis_sessions table = bgp_voq_chassis_sessions
admin_status = 'up' admin_status = 'up'
elif chassis_internal_ibgp is not None and chassis_internal_ibgp.text == "chassis-packet":
table = bgp_internal_sessions
admin_status = 'up'
elif end_router.lower() in local_devices and start_router.lower() in local_devices: elif end_router.lower() in local_devices and start_router.lower() in local_devices:
table = bgp_internal_sessions table = bgp_internal_sessions
admin_status = 'up' admin_status = 'up'
@ -1206,6 +1216,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
is_storage_device = False is_storage_device = False
local_devices = [] local_devices = []
kube_data = {} kube_data = {}
static_routes = {}
hwsku_qn = QName(ns, "HwSku") hwsku_qn = QName(ns, "HwSku")
hostname_qn = QName(ns, "Hostname") hostname_qn = QName(ns, "Hostname")
@ -1228,7 +1239,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
for child in root: for child in root:
if asic_name is None: if asic_name is None:
if child.tag == str(QName(ns, "DpgDec")): if child.tag == str(QName(ns, "DpgDec")):
(intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content) = parse_dpg(child, hostname) (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, hostname)
elif child.tag == str(QName(ns, "CpgDec")): elif child.tag == str(QName(ns, "CpgDec")):
(bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, hostname) (bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, hostname)
elif child.tag == str(QName(ns, "PngDec")): elif child.tag == str(QName(ns, "PngDec")):
@ -1243,7 +1254,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
(port_speeds_default, port_descriptions, sys_ports) = parse_deviceinfo(child, hwsku) (port_speeds_default, port_descriptions, sys_ports) = parse_deviceinfo(child, hwsku)
else: else:
if child.tag == str(QName(ns, "DpgDec")): if child.tag == str(QName(ns, "DpgDec")):
(intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content) = parse_dpg(child, asic_name) (intfs, lo_intfs, mvrf, mgmt_intf, voq_inband_intfs, vlans, vlan_members, dhcp_relay_table, pcs, pc_members, acls, vni, tunnel_intfs, dpg_ecmp_content, static_routes) = parse_dpg(child, asic_name)
host_lo_intfs = parse_host_loopback(child, hostname) host_lo_intfs = parse_host_loopback(child, hostname)
elif child.tag == str(QName(ns, "CpgDec")): elif child.tag == str(QName(ns, "CpgDec")):
(bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, asic_name, local_devices) (bgp_sessions, bgp_internal_sessions, bgp_voq_chassis_sessions, bgp_asn, bgp_peers_with_range, bgp_monitors) = parse_cpg(child, asic_name, local_devices)
@ -1394,12 +1405,12 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
} }
else: else:
vlan_intfs[vlan_invert_mapping[intf[0]]] = {} vlan_intfs[vlan_invert_mapping[intf[0]]] = {}
elif intf[0][0:11] == 'PortChannel':
pc_intfs[intf] = {}
pc_intfs[intf[0]] = {}
elif VLAN_SUB_INTERFACE_SEPARATOR in intf[0]: elif VLAN_SUB_INTERFACE_SEPARATOR in intf[0]:
vlan_sub_intfs[intf] = {} vlan_sub_intfs[intf] = {}
vlan_sub_intfs[intf[0]] = {'admin_status': 'up'} vlan_sub_intfs[intf[0]] = {'admin_status': 'up'}
elif intf[0][0:11] == 'PortChannel':
pc_intfs[intf] = {}
pc_intfs[intf[0]] = {}
else: else:
phyport_intfs[intf] = {} phyport_intfs[intf] = {}
phyport_intfs[intf[0]] = {} phyport_intfs[intf[0]] = {}
@ -1567,6 +1578,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs
elif resource_type is not None and 'Storage' in resource_type: elif resource_type is not None and 'Storage' in resource_type:
is_storage_device = True is_storage_device = True
elif bool(vlan_sub_intfs):
results['VLAN_SUB_INTERFACE'] = vlan_sub_intfs
if is_storage_device: if is_storage_device:
results['DEVICE_METADATA']['localhost']['storage_device'] = "true" results['DEVICE_METADATA']['localhost']['storage_device'] = "true"
@ -1578,6 +1592,9 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
results['MUX_CABLE'] = get_mux_cable_entries(mux_cable_ports, neighbors, devices) results['MUX_CABLE'] = get_mux_cable_entries(mux_cable_ports, neighbors, devices)
if static_routes:
results['STATIC_ROUTE'] = static_routes
for nghbr in list(neighbors.keys()): for nghbr in list(neighbors.keys()):
# remove port not in port_config.ini # remove port not in port_config.ini
if nghbr not in ports: if nghbr not in ports:

View File

@ -0,0 +1,456 @@
<DeviceMiniGraph xmlns="Microsoft.Search.Autopilot.Evolution" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CpgDec>
<IsisRouters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<PeeringSessions>
<BGPSession>
<MacSec>false</MacSec>
<StartRouter>str2-8808-lc2-1</StartRouter>
<StartPeer>27.1.1.1</StartPeer>
<EndRouter>IXIA-EBGP</EndRouter>
<EndPeer>27.1.1.2</EndPeer>
<Multihop>1</Multihop>
<HoldTime>10</HoldTime>
<KeepAliveTime>3</KeepAliveTime>
</BGPSession>
<BGPSession>
<MacSec>false</MacSec>
<StartRouter>ASIC1</StartRouter>
<StartPeer>27.1.1.1</StartPeer>
<EndRouter>IXIA-EBGP</EndRouter>
<EndPeer>27.1.1.2</EndPeer>
<Multihop>1</Multihop>
<HoldTime>10</HoldTime>
<KeepAliveTime>3</KeepAliveTime>
</BGPSession>
<BGPSession>
<StartRouter>ASIC1</StartRouter>
<StartPeer>8.0.0.3</StartPeer>
<EndRouter>str2-8808-lc0-ASIC1</EndRouter>
<EndPeer>8.0.0.1</EndPeer>
<Multihop>1</Multihop>
<HoldTime>0</HoldTime>
<KeepAliveTime>0</KeepAliveTime>
<ChassisInternal>chassis-packet</ChassisInternal>
</BGPSession>
</PeeringSessions>
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:BGPRouterDeclaration>
<a:ASN>65100</a:ASN>
<a:Hostname>str2-8808-lc2-1</a:Hostname>
<a:Peers>
<BGPPeer>
<Address>27.1.1.2</Address>
<RouteMapIn i:nil="true"/>
<RouteMapOut i:nil="true"/>
<Vrf i:nil="true"/>
</BGPPeer>
</a:Peers>
<a:RouteMaps/>
</a:BGPRouterDeclaration>
<a:BGPRouterDeclaration>
<a:ASN>69007</a:ASN>
<a:Hostname>IXIA-EBGP</a:Hostname>
<a:RouteMaps/>
</a:BGPRouterDeclaration>
<a:BGPRouterDeclaration>
<a:ASN>65100</a:ASN>
<a:Hostname>str2-8808-lc0-ASIC1</a:Hostname>
<a:RouteMaps/>
</a:BGPRouterDeclaration>
<a:BGPRouterDeclaration>
<a:ASN>65100</a:ASN>
<a:Hostname>ASIC1</a:Hostname>
<a:Peers>
<BGPPeer>
<Address>27.1.1.2</Address>
<RouteMapIn i:nil="true"/>
<RouteMapOut i:nil="true"/>
<Vrf i:nil="true"/>
</BGPPeer>
<BGPPeer>
<Address>8.0.0.1</Address>
<RouteMapIn i:nil="true"/>
<RouteMapOut i:nil="true"/>
<Vrf i:nil="true"/>
</BGPPeer>
</a:Peers>
<a:RouteMaps/>
</a:BGPRouterDeclaration>
</Routers>
</CpgDec>
<DpgDec>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:LoopbackIPInterface>
<Name>HostIP</Name>
<AttachTo>Loopback0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
<b:IPPrefix>10.0.1.6/32</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>10.0.1.6/32</a:PrefixStr>
</a:LoopbackIPInterface>
</LoopbackIPInterfaces>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:ManagementIPInterface>
<Name>HostIP</Name>
<AttachTo>eth0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
<b:IPPrefix>10.3.147.97/23</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>10.3.147.97/23</a:PrefixStr>
</a:ManagementIPInterface>
</ManagementIPInterfaces>
<ManagementVIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>str2-88</Hostname>
<PortChannelInterfaces>
</PortChannelInterfaces>
<IPInterfaces>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>Eth1/1/47</AttachTo>
<Prefix>27.1.1.1/24</Prefix>
</IPInterface>
</IPInterfaces>
<DataAcls/>
<AclInterfaces>
</AclInterfaces>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:LoopbackIPInterface>
<Name>HostIP</Name>
<AttachTo>Loopback0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
<b:IPPrefix>10.0.1.6/32</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>10.0.1.6/32</a:PrefixStr>
</a:LoopbackIPInterface>
<a:LoopbackIPInterface>
<Name>HostIP1</Name>
<AttachTo>Loopback4096</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
<b:IPPrefix>8.0.0.3/32</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>8.0.0.3/32</a:PrefixStr>
</a:LoopbackIPInterface>
</LoopbackIPInterfaces>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:ManagementIPInterface>
<Name>HostIP</Name>
<AttachTo>eth0</AttachTo>
<a:Prefix xmlns:b="Microsoft.Search.Autopilot.Evolution">
<b:IPPrefix>10.3.147.97/23</b:IPPrefix>
</a:Prefix>
<a:PrefixStr>10.3.147.97/23</a:PrefixStr>
</a:ManagementIPInterface>
</ManagementIPInterfaces>
<ManagementVIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>ASIC1</Hostname>
<PortChannelInterfaces>
<PortChannel>
<Name>PortChannel32</Name>
<AttachTo>Eth2504-ASIC1;Eth2508-ASIC1;Eth2510-ASIC1</AttachTo>
<SubInterface/>
</PortChannel>
<PortChannel>
<Name>PortChannel33</Name>
<AttachTo>Eth2320-ASIC1;Eth2502-ASIC1;Eth2506-ASIC1;Eth2518-ASIC1</AttachTo>
<SubInterface/>
</PortChannel>
</PortChannelInterfaces>
<VlanInterfaces>
</VlanInterfaces>
<SubInterfaces>
<SubInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel32</AttachTo>
<Vlan>2</Vlan>
<Encapsulation>dot1q</Encapsulation>
<Prefix>192.168.1.4/24</Prefix>
</SubInterface>
<SubInterface>
<Name i:nil="true"/>
<AttachTo>PortChannel33</AttachTo>
<Vlan>2</Vlan>
<Encapsulation>dot1q</Encapsulation>
<Prefix>192.168.2.4/24</Prefix>
<Unit>10</Unit>
</SubInterface>
</SubInterfaces>
<IPInterfaces>
<IPInterface>
<Name i:nil="true"/>
<AttachTo>Eth1/1/47</AttachTo>
<Prefix>27.1.1.1/24</Prefix>
</IPInterface>
</IPInterfaces>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<IPNextHops>
<IPNextHop>
<ElementType>IPNextHop</ElementType>
<Name i:nil="true"/>
<AttachTo>8.0.0.1/32</AttachTo>
<Address>192.168.1.2,192.168.2.2</Address>
<Type>StaticRoute</Type>
</IPNextHop>
</IPNextHops>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<DeviceInterfaceLinks>
<DeviceLinkBase>
<ElementType>DeviceInterfaceLink</ElementType>
<EndDevice>IXIA-EBGP</EndDevice>
<EndPort>Ethernet1</EndPort>
<StartDevice>str2-8808-lc2-1</StartDevice>
<StartPort>Eth1/1/47</StartPort>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet1</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2502-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet2</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2504-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet3</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2506-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet4</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2508-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet5</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2510-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet6</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2516-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
<DeviceLinkBase i:type="DeviceInterfaceLink">
<ElementType>DeviceInterfaceLink</ElementType>
<Bandwidth>100000</Bandwidth>
<ChassisInternal>true</ChassisInternal>
<EndDevice>str2-8808-sup</EndDevice>
<EndPort>Ethernet7</EndPort>
<FlowControl>true</FlowControl>
<StartDevice>ASIC1</StartDevice>
<StartPort>Eth2320-ASIC1</StartPort>
<Validate>true</Validate>
</DeviceLinkBase>
</DeviceInterfaceLinks>
<Devices>
<Device i:type="SpineRouter">
<Hostname>str2-8808-lc2-1</Hostname>
<HwSku>8800-LC-48H-O</HwSku>
<Address xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.0.1.6/32</a:IPPrefix>
</Address>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.3.147.97/23</a:IPPrefix>
</ManagementAddress>
</Device>
<Device i:type="Ixia">
<Hostname>IXIA-EBGP</Hostname>
<HwSku>IXIA</HwSku>
<Address xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>0.0.0.0/0</a:IPPrefix>
</Address>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>0.0.0.0/0</a:IPPrefix>
</ManagementAddress>
</Device>
<Device i:type="Supervior">
<Hostname>str2-8808-sup</Hostname>
<HwSku>8800-RP-O</HwSku>
<Address xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>0.0.0.0/0</a:IPPrefix>
</Address>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>10.3.147.95/23</a:IPPrefix>
</ManagementAddress>
</Device>
<Device i:type="Asic">
<ElementType>Asic</ElementType>
<Address xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>8.0.0.3/32</a:IPPrefix>
</Address>
<AssociatedClustersStr/>
<AssociatedSliceStr/>
<AssociatedTagsStr/>
<ClusterName/>
<DeploymentId i:nil="true"/>
<DeviceLocation i:nil="true"/>
<HomeDatacenter i:nil="true"/>
<ManagementAddress xmlns:a="Microsoft.Search.Autopilot.NetMux">
<a:IPPrefix>0.0.0.0/0</a:IPPrefix>
</ManagementAddress>
<SerialNumber i:nil="true"/>
<Hostname>ASIC1</Hostname>
<HwSku>8800-LC-48H-O</HwSku>
</Device>
</Devices>
</PngDec>
<DeviceInfos>
<DeviceInfo>
<AutoNegotiation>true</AutoNegotiation>
<EthernetInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:EthernetInterface>
<ElementType>DeviceInterface</ElementType>
<AlternateSpeeds i:nil="true"/>
<EnableAutoNegotiation>true</EnableAutoNegotiation>
<EnableFlowControl>true</EnableFlowControl>
<Index>1</Index>
<InterfaceName>Ethernet1/1/47</InterfaceName>
<InterfaceType i:nil="true"/>
<MultiPortsInterface>false</MultiPortsInterface>
<PortName>47</PortName>
<Priority>0</Priority>
<Speed>100000</Speed>
<SonicName>Ethernet47</SonicName>
</a:EthernetInterface>
</EthernetInterfaces>
<FlowControl>true</FlowControl>
<Height>0</Height>
<HwSku>8800-LC-48H-O</HwSku>
<ManagementInterfaces/>
</DeviceInfo>
</DeviceInfos>
<MetadataDeclaration>
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:DeviceMetadata>
<a:Name>str2-8808-lc2-1</a:Name>
<a:Properties>
<a:DeviceProperty>
<a:Name>SwitchType</a:Name>
<a:Reference i:nil="true"/>
<a:Value>chassis_packet</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>DeploymentId</a:Name>
<a:Reference i:nil="true"/>
<a:Value>1</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>QosProfile</a:Name>
<a:Reference i:nil="true"/>
<a:Value>Profile0</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>DhcpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>192.0.0.1;192.0.0.2;192.0.0.3;192.0.0.4;192.0.0.5;192.0.0.6;192.0.0.7;192.0.0.8;192.0.0.9;192.0.0.10;192.0.0.11;192.0.0.12;192.0.0.13;192.0.0.14;192.0.0.15;192.0.0.16;192.0.0.17;192.0.0.18;192.0.0.19;192.0.0.20;192.0.0.21;192.0.0.22;192.0.0.23;192.0.0.24;192.0.0.25;192.0.0.26;192.0.0.27;192.0.0.28;192.0.0.29;192.0.0.30;192.0.0.31;192.0.0.32;192.0.0.33;192.0.0.34;192.0.0.35;192.0.0.36;192.0.0.37;192.0.0.38;192.0.0.39;192.0.0.40;192.0.0.41;192.0.0.42;192.0.0.43;192.0.0.44;192.0.0.45;192.0.0.46;192.0.0.47;192.0.0.48</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>NtpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.20.8.129;10.20.8.130</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SnmpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.3.145.98</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SyslogResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.3.145.8;100.127.20.21</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>TacacsGroup</a:Name>
<a:Reference i:nil="true"/>
<a:Value>Starlab</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>TacacsServer</a:Name>
<a:Reference i:nil="true"/>
<a:Value>100.127.20.21</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ForcedMgmtRoutes</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.3.145.98/31;10.3.145.8;100.127.20.16/28;10.3.149.170/31;40.122.216.24;13.91.48.226;10.3.145.14;10.64.246.0/24;10.3.146.0/23;10.64.5.5</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ErspanDestinationIpv4</a:Name>
<a:Reference i:nil="true"/>
<a:Value>10.20.6.16</a:Value>
</a:DeviceProperty>
</a:Properties>
</a:DeviceMetadata>
<a:DeviceMetadata>
<a:Name>ASIC1</a:Name>
<a:Properties>
<a:DeviceProperty>
<a:Name>SubRole</a:Name>
<a:Reference i:nil="true"/>
<a:Value>FrontEnd</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SwitchType</a:Name>
<a:Reference i:nil="true"/>
<a:Value>chassis_packet</a:Value>
</a:DeviceProperty>
</a:Properties>
</a:DeviceMetadata>
</Devices>
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</MetadataDeclaration>
<Hostname>str2-8808-lc2-1</Hostname>
<HwSku>8800-LC-48H-O</HwSku>
</DeviceMiniGraph>

View File

@ -0,0 +1,60 @@
# name lanes alias index speed asic_port_name role source_npu target_npu
Ethernet13 1280,1281,1282,1283 Eth1/1/13 13 100000 Eth13-ASIC1 Ext
Ethernet14 1284,1285,1286,1287 Eth1/1/14 14 100000 Eth14-ASIC1 Ext
Ethernet16 1288,1289,1290,1291 Eth1/1/16 16 100000 Eth16-ASIC1 Ext
Ethernet17 1292,1293,1294,1295 Eth1/1/17 17 100000 Eth17-ASIC1 Ext
Ethernet19 1024,1025,1026,1027 Eth1/1/19 19 100000 Eth19-ASIC1 Ext
Ethernet20 1036,1037,1038,1039 Eth1/1/20 20 100000 Eth20-ASIC1 Ext
Ethernet22 1028,1029,1030,1031 Eth1/1/22 22 100000 Eth22-ASIC1 Ext
Ethernet23 1032,1033,1034,1035 Eth1/1/23 23 100000 Eth23-ASIC1 Ext
Ethernet25 768,769,770,771 Eth1/1/25 25 100000 Eth25-ASIC1 Ext
Ethernet26 772,773,774,775 Eth1/1/26 26 100000 Eth26-ASIC1 Ext
Ethernet28 776,777,778,779 Eth1/1/28 28 100000 Eth28-ASIC1 Ext
Ethernet29 780,781,782,783 Eth1/1/29 29 100000 Eth29-ASIC1 Ext
Ethernet31 512,513,514,515 Eth1/1/31 31 100000 Eth31-ASIC1 Ext
Ethernet32 516,517,518,519 Eth1/1/32 32 100000 Eth32-ASIC1 Ext
Ethernet34 520,521,522,523 Eth1/1/34 34 100000 Eth34-ASIC1 Ext
Ethernet35 524,525,526,527 Eth1/1/35 35 100000 Eth35-ASIC1 Ext
Ethernet37 256,257,258,259 Eth1/1/37 37 100000 Eth37-ASIC1 Ext
Ethernet38 260,261,262,263 Eth1/1/38 38 100000 Eth38-ASIC1 Ext
Ethernet40 268,269,270,271 Eth1/1/40 40 100000 Eth40-ASIC1 Ext
Ethernet41 264,265,266,267 Eth1/1/41 41 100000 Eth41-ASIC1 Ext
Ethernet43 12,13,14,15 Eth1/1/43 43 100000 Eth43-ASIC1 Ext
Ethernet44 8,9,10,11 Eth1/1/44 44 100000 Eth44-ASIC1 Ext
Ethernet46 4,5,6,7 Eth1/1/46 46 100000 Eth46-ASIC1 Ext
Ethernet47 0,1,2,3 Eth1/1/47 47 100000 Eth47-ASIC1 Ext
Ethernet2320 16,17 Eth2320-ASIC1 2320 100000 Eth2320-ASIC1 Int
Ethernet2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int
Ethernet2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int
Ethernet2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int
Ethernet2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int
Ethernet2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int
Ethernet2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int
Ethernet2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int
Ethernet2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int
Ethernet2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int
Ethernet2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int
Ethernet2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int
Ethernet2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int
Ethernet2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int
Ethernet2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int
Ethernet2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int
Ethernet2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int
Ethernet2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int
Ethernet2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int
Ethernet2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int
Ethernet2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int
Ethernet2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int
Ethernet2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int
Ethernet2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int
Ethernet2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int
Ethernet2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int
Ethernet2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int
Ethernet2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int
Ethernet2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int
Ethernet2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int
Ethernet2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int
Ethernet2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int
Ethernet2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int
Ethernet2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int
Ethernet2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int

View File

@ -20,7 +20,6 @@
<Multihop>1</Multihop> <Multihop>1</Multihop>
<HoldTime>180</HoldTime> <HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime> <KeepAliveTime>60</KeepAliveTime>
<VoQChassisInternal>false</VoQChassisInternal>
</BGPSession> </BGPSession>
<BGPSession> <BGPSession>
<StartRouter>switch-t0</StartRouter> <StartRouter>switch-t0</StartRouter>
@ -68,7 +67,7 @@
<Multihop>1</Multihop> <Multihop>1</Multihop>
<HoldTime>180</HoldTime> <HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime> <KeepAliveTime>60</KeepAliveTime>
<VoQChassisInternal>true</VoQChassisInternal> <ChassisInternal>voq</ChassisInternal>
</BGPSession> </BGPSession>
</PeeringSessions> </PeeringSessions>
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"> <Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">

View File

@ -20,7 +20,6 @@
<Multihop>1</Multihop> <Multihop>1</Multihop>
<HoldTime>180</HoldTime> <HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime> <KeepAliveTime>60</KeepAliveTime>
<VoQChassisInternal>false</VoQChassisInternal>
</BGPSession> </BGPSession>
<BGPSession> <BGPSession>
<StartRouter>switch-t0</StartRouter> <StartRouter>switch-t0</StartRouter>
@ -68,7 +67,7 @@
<Multihop>1</Multihop> <Multihop>1</Multihop>
<HoldTime>180</HoldTime> <HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime> <KeepAliveTime>60</KeepAliveTime>
<VoQChassisInternal>true</VoQChassisInternal> <ChassisInternal>voq</ChassisInternal>
</BGPSession> </BGPSession>
</PeeringSessions> </PeeringSessions>
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"> <Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">

View File

@ -20,7 +20,6 @@
<Multihop>1</Multihop> <Multihop>1</Multihop>
<HoldTime>180</HoldTime> <HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime> <KeepAliveTime>60</KeepAliveTime>
<VoQChassisInternal>false</VoQChassisInternal>
</BGPSession> </BGPSession>
<BGPSession> <BGPSession>
<StartRouter>switch-t0</StartRouter> <StartRouter>switch-t0</StartRouter>
@ -68,7 +67,7 @@
<Multihop>1</Multihop> <Multihop>1</Multihop>
<HoldTime>180</HoldTime> <HoldTime>180</HoldTime>
<KeepAliveTime>60</KeepAliveTime> <KeepAliveTime>60</KeepAliveTime>
<VoQChassisInternal>true</VoQChassisInternal> <ChassisInternal>voq</ChassisInternal>
</BGPSession> </BGPSession>
</PeeringSessions> </PeeringSessions>
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"> <Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">

View File

@ -32,6 +32,8 @@ class TestCfgGen(TestCase):
self.sample_resource_graph = os.path.join(self.test_dir, 'sample-graph-resource-type.xml') self.sample_resource_graph = os.path.join(self.test_dir, 'sample-graph-resource-type.xml')
self.sample_subintf_graph = os.path.join(self.test_dir, 'sample-graph-subintf.xml') self.sample_subintf_graph = os.path.join(self.test_dir, 'sample-graph-subintf.xml')
self.voq_port_config = os.path.join(self.test_dir, 'voq-sample-port-config.ini') self.voq_port_config = os.path.join(self.test_dir, 'voq-sample-port-config.ini')
self.packet_chassis_graph = os.path.join(self.test_dir, 'sample-chassis-packet-lc-graph.xml')
self.packet_chassis_port_ini = os.path.join(self.test_dir, 'sample-chassis-packet-lc-port-config.ini')
# To ensure that mock config_db data is used for unit-test cases # To ensure that mock config_db data is used for unit-test cases
os.environ["CFGGEN_UNIT_TESTING"] = "2" os.environ["CFGGEN_UNIT_TESTING"] = "2"
@ -832,4 +834,27 @@ class TestCfgGen(TestCase):
) )
) )
def test_minigraph_bgp_packet_chassis_peer(self):
argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "BGP_INTERNAL_NEIGHBOR[\'8.0.0.1\']"'
output = self.run_script(argument)
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict("{'rrclient': 0, 'name': 'str2-8808-lc0-ASIC1', 'local_addr': '8.0.0.3', 'nhopself': 0, 'admin_status': 'up', 'holdtime': '0', 'asn': '65100', 'keepalive': '0'}")
)
def test_minigraph_bgp_packet_chassis_static_route(self):
argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "STATIC_ROUTE"'
output = self.run_script(argument)
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2'}}")
)
def test_minigraph_bgp_packet_chassis_vlan_subintf(self):
argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "VLAN_SUB_INTERFACE"'
output = self.run_script(argument)
self.assertEqual(
utils.to_dict(output.strip()),
utils.to_dict("{('PortChannel32.2', '192.168.1.4/24'): {}, 'PortChannel32.2': {'admin_status': 'up'}, ('PortChannel33.2', '192.168.2.4/24'): {}, 'PortChannel33.2': {'admin_status': 'up'}}")
)