diff --git a/ansible/config_sonic_basedon_testbed.yml b/ansible/config_sonic_basedon_testbed.yml index 5a899c11cc8..95cbbce0d29 100644 --- a/ansible/config_sonic_basedon_testbed.yml +++ b/ansible/config_sonic_basedon_testbed.yml @@ -92,7 +92,8 @@ num_asic: "{{ num_asics }}" card_type: "{{ card_type | default('fixed') }}" hostname: "{{ inventory_hostname | default('') }}" - switchids: "{{ switchids | default([0]) }}" + switchids: "{{ switchids | default(None) }}" + slotid: "{{ slot_num | default(None) }}" delegate_to: localhost when: deploy is not defined or deploy|bool == false @@ -101,6 +102,7 @@ num_fabric_asic: "{{ num_fabric_asics | default(0) }}" asics_host_basepfx: "{{ asics_host_ip | default(None) }}" asics_host_basepfx6: "{{ asics_host_ipv6 | default(None) }}" + delegate_to: localhost - name: set all VoQ system ports information set_fact: @@ -108,10 +110,16 @@ when: hostvars[item]['sysports'] is defined loop: "{{ ansible_play_batch }}" - - name: set all VoQ information for iBGP + - name: set all Loopback4096 information for iBGP chassis + set_fact: + all_loopback4096: "{{ all_loopback4096 | default( {} ) | combine( { item : hostvars[item]['loopback4096_ip']}) }}" + when: hostvars[item]['loopback4096_ip'] is defined + loop: "{{ ansible_play_batch }}" + + - name: set all slot information for chassis set_fact: - all_inbands: "{{ all_inbands | default( {} ) | combine( { item : hostvars[item]['voq_inband_ip']}) }}" - when: hostvars[item]['voq_inband_ip'] is defined + all_slots: "{{ all_slots | default( {} ) | combine( { item : hostvars[item]['slot_num']}) }}" + when: hostvars[item]['slot_num'] is defined loop: "{{ ansible_play_batch }}" - name: find all enabled host_interfaces diff --git a/ansible/lab b/ansible/lab index aded3d6508d..f714e064270 100644 --- a/ansible/lab +++ b/ansible/lab @@ -12,6 +12,8 @@ all: sonic_a7260: sonic_multi_asic: sonic_multi_asic_2: + sonic_sup: + sonic_lc_100G: fanout: hosts: str-7260-10: @@ -148,3 +150,54 @@ sonic_multi_asic_2: vlab-08: ansible_host: 10.250.0.112 ansible_hostv6: fec0::ffff:afa:c + +sonic_sup: + vars: + HwSku: 8800-RP-O + sonic_hwsku: 8800-RP-O + sonic_hw_platform: x86_64-8800_rp_o-r0 + slot_num: slot0 + card_type: supervisor + hosts: + lab-8800-sup-1: + ansible_host: 10.3.147.95 + hwsku: 8800-RP-O + num_asics: 2 + + +sonic_lc_100G: + vars: + switch_type: chassis-packet + num_asics: 2 + frontend_asics: [0,1] + hosts: + lab-8808-lc0-1: + hwsku: 8800-LC-48H-O + sonic_hwsku: 8800-LC-48H-O + sonic_hw_platform: x86_64-8800_lc_48h_o-r0 + slot_num: slot1 + loopback4096_ip: [3.3.3.3/32,3.3.3.4/32] + loopback4096_ipv6: [2603:10e2:400::3/128,2603:10e2:400::4/128] + serial: SSN20220006 + base_mac: fc:bd:67:67:e4:1C + ansible_host: 10.3.147.96 + lab-8808-lc1-1: + hwsku: 8800-LC-48H-O + sonic_hwsku: 8800-LC-48H-O + sonic_hw_platform: x86_64-8800_lc_48h_o-r0 + slot_num: slot2 + loopback4096_ip: [3.3.3.5/32,3.3.3.6/32] + loopback4096_ipv6: [2603:10e2:400::5/128,2603:10e2:400::6/128] + serial: SSN20220006 + base_mac: fc:bd:67:67:d9:30 + ansible_host: 10.3.147.97 + lab-8808-lc2-1: + hwsku: 8800-LC-48H-O + sonic_hwsku: 8800-LC-48H-O + sonic_hw_platform: x86_64-8800_lc_48h_o-r0 + slot_num: slot3 + loopback4096_ip: [3.3.3.7/32,3.3.3.8/32] + loopback4096_ipv6: [2603:10e2:400::7/128,2603:10e2:400::8/128] + serial: SSN20220011 + base_mac: fc:bd:67:67:de:5b + ansible_host: 10.3.147.98 diff --git a/ansible/library/port_alias.py b/ansible/library/port_alias.py index 5676d05f0a0..5c4a9000a69 100755 --- a/ansible/library/port_alias.py +++ b/ansible/library/port_alias.py @@ -78,20 +78,22 @@ def get_platform_type(self): return value return None - def get_portconfig_path(self, asic_id=None): + def get_portconfig_path(self, slotid=None, asic_id=None): platform = self.get_platform_type() if platform is None: return None if asic_id is None: portconfig = os.path.join(FILE_PATH, platform, self.hwsku, PORTMAP_FILE) - else: + elif slotid is None: portconfig = os.path.join(FILE_PATH, platform, self.hwsku, str(asic_id), PORTMAP_FILE) + else: + portconfig = os.path.join(FILE_PATH, platform, self.hwsku, str(slotid), str(asic_id), PORTMAP_FILE) if os.path.exists(portconfig): return portconfig return None def get_portmap(self, asic_id=None, include_internal=False, - hostname=None, switchid=None): + hostname=None, switchid=None, slotid=None): aliases = [] portmap = {} aliasmap = {} @@ -107,7 +109,7 @@ def get_portmap(self, asic_id=None, include_internal=False, # default to Asic0 as minigraph.py parsing code has that assumption. asic_name = "Asic0" if asic_id is None else "asic" + str(asic_id) - filename = self.get_portconfig_path(asic_id) + filename = self.get_portconfig_path(slotid, asic_id) if filename is None: raise Exception("Something wrong when trying to find the portmap file, either the hwsku is not available or file location is not correct") with open(filename) as f: @@ -209,7 +211,8 @@ def main(): include_internal=dict(required=False, type='bool', default=False), card_type=dict(type='str', required=False), hostname=dict(type='str', required=False), - switchids=dict(type='list', required=False) + switchids=dict(type='list', required=False), + slotid=dict(type='str', required=False) ), supports_check_mode=True ) @@ -236,8 +239,12 @@ def main(): return allmap = SonicPortAliasMap(m_args['hwsku']) switchids = None - if 'switchids' in m_args and m_args['switchids'] != None: + slotid = None + if 'switchids' in m_args and m_args['switchids']: switchids = m_args['switchids'] + + if 'slotid' in m_args and m_args['slotid'] != None: + slotid = m_args['slotid'] # When this script is invoked on sonic-mgmt docker, num_asic # parameter is passed. if m_args['num_asic'] is not None: @@ -264,12 +271,12 @@ def main(): if 'hostname' in m_args: hostname = m_args['hostname'] for asic_id in range(num_asic): - if switchids and asic_id is not None: + if asic_id is not None and asic_id < len(switchids) and switchids[asic_id]: switchid = switchids[asic_id] if num_asic == 1: asic_id = None (aliases_asic, portmap_asic, aliasmap_asic, portspeed_asic, front_panel_asic, asicifnames_asic, - sysport_asic) = allmap.get_portmap(asic_id, include_internal, hostname, switchid) + sysport_asic) = allmap.get_portmap(asic_id, include_internal, hostname, switchid, slotid) if aliases_asic is not None: aliases.extend(aliases_asic) if portmap_asic is not None: diff --git a/ansible/library/topo_facts.py b/ansible/library/topo_facts.py index 61e351f949c..15a95a92f46 100644 --- a/ansible/library/topo_facts.py +++ b/ansible/library/topo_facts.py @@ -83,7 +83,6 @@ def __init__(self): self.asic_topo_config = {} def parse_topo_defintion(self, topo_definition, po_map, dut_num, neigh_type='VMs'): - dut_asn = topo_definition['configuration_properties']['common']['dut_asn'] vmconfig = dict() for vm in topo_definition['topology'][neigh_type]: vmconfig[vm] = dict() @@ -106,17 +105,20 @@ def parse_topo_defintion(self, topo_definition, po_map, dut_num, neigh_type='VMs for asic_intf in topo_definition['topology'][neigh_type][vm]['asic_intfs']: vmconfig[vm]['asic_intfs'][dut_index].append(asic_intf) + # physical interface - for intf in topo_definition['configuration'][vm]['interfaces']: - if (neigh_type == 'VMs' and 'Ethernet' in intf) or \ - (neigh_type == 'NEIGH_ASIC' and re.match("Eth(\d+)-", intf)): - dut_index = 0 - if 'dut_index' in topo_definition['configuration'][vm]['interfaces'][intf]: - dut_index = topo_definition['configuration'][vm]['interfaces'][intf]['dut_index'] - if 'lacp' in topo_definition['configuration'][vm]['interfaces'][intf]: - po_map[topo_definition['configuration'][vm]['interfaces'][intf]['lacp']] = dut_index - - vmconfig[vm]['intfs'][dut_index].append(intf) + if 'configuration' in topo_definition: + if 'interfaces' in topo_definition['configuration'][vm]: + for intf in topo_definition['configuration'][vm]['interfaces']: + dut_index = 0 + if neigh_type == 'NEIGH_ASIC': + vmconfig[vm]['intfs'][dut_index].append(intf) + elif 'Ethernet' in intf: + if 'dut_index' in topo_definition['configuration'][vm]['interfaces'][intf]: + dut_index = topo_definition['configuration'][vm]['interfaces'][intf]['dut_index'] + if 'lacp' in topo_definition['configuration'][vm]['interfaces'][intf]: + po_map[topo_definition['configuration'][vm]['interfaces'][intf]['lacp']] = dut_index + vmconfig[vm]['intfs'][dut_index].append(intf) # ip interface vmconfig[vm]['ip_intf'] = [None] * dut_num @@ -124,59 +126,72 @@ def parse_topo_defintion(self, topo_definition, po_map, dut_num, neigh_type='VMs vmconfig[vm]['ipv4mask'] = [None] * dut_num vmconfig[vm]['peer_ipv6'] = [None] * dut_num vmconfig[vm]['ipv6mask'] = [None] * dut_num - - - for intf in topo_definition['configuration'][vm]['interfaces']: - dut_index = 0 - if (neigh_type == 'VMs' and 'Ethernet' in intf) or \ - (neigh_type == 'NEIGH_ASIC' and re.match("Eth(\d+)-", intf)): - if 'dut_index' in topo_definition['configuration'][vm]['interfaces'][intf]: - dut_index = topo_definition['configuration'][vm]['interfaces'][intf]['dut_index'] - elif 'Port-Channel' in intf: - m = re.search("(\d+)", intf) - dut_index = po_map[int(m.group(1))] - - if 'ipv4' in topo_definition['configuration'][vm]['interfaces'][intf] and ('loopback' not in intf.lower()): - (peer_ipv4, ipv4_mask) = topo_definition['configuration'][vm]['interfaces'][intf]['ipv4'].split('/') - vmconfig[vm]['peer_ipv4'][dut_index] = peer_ipv4 - vmconfig[vm]['ipv4mask'][dut_index] = ipv4_mask - vmconfig[vm]['ip_intf'][dut_index] = intf - if 'ipv6' in topo_definition['configuration'][vm]['interfaces'][intf] and ('loopback' not in intf.lower()): - (ipv6_addr, ipv6_mask) = topo_definition['configuration'][vm]['interfaces'][intf]['ipv6'].split('/') - vmconfig[vm]['peer_ipv6'][dut_index] = ipv6_addr.upper() - vmconfig[vm]['ipv6mask'][dut_index] = ipv6_mask - vmconfig[vm]['ip_intf'][dut_index] = intf - - # bgp vmconfig[vm]['bgp_ipv4'] = [None] * dut_num vmconfig[vm]['bgp_ipv6'] = [None] * dut_num - vmconfig[vm]['bgp_asn'] = topo_definition['configuration'][vm]['bgp']['asn'] - for ipstr in topo_definition['configuration'][vm]['bgp']['peers'][dut_asn]: - if sys.version_info < (3, 0): - ip = ipaddress.ip_address(ipstr.decode('utf8')) - else: - ip = ipaddress.ip_address(ipstr) - for dut_index in range(0, dut_num): - if ip.version == 4: - # Each VM might not be connected to all the DUT's, so check if this VM is a peer to DUT at dut_index - if vmconfig[vm]['peer_ipv4'][dut_index]: - ipsubnet_str = vmconfig[vm]['peer_ipv4'][dut_index]+'/'+vmconfig[vm]['ipv4mask'][dut_index] - if sys.version_info < (3, 0): - ipsubnet = ipaddress.ip_interface(ipsubnet_str.decode('utf8')) - else: - ipsubnet = ipaddress.ip_interface(ipsubnet_str) - if ip in ipsubnet.network: + vmconfig[vm]['bgp_asn'] = None + + + if 'configuration' in topo_definition: + if 'interfaces' in topo_definition['configuration'][vm]: + for intf in topo_definition['configuration'][vm]['interfaces']: + dut_index = 0 + if neigh_type == 'NEIGH_ASIC': + pass + elif 'Ethernet' in intf: + if 'dut_index' in topo_definition['configuration'][vm]['interfaces'][intf]: + dut_index = topo_definition['configuration'][vm]['interfaces'][intf]['dut_index'] + elif 'Port-Channel' in intf: + m = re.search("(\d+)", intf) + dut_index = po_map[int(m.group(1))] + + if isinstance(topo_definition['configuration'][vm]['interfaces'],dict) and 'ipv4' in topo_definition['configuration'][vm]['interfaces'][intf] and ('loopback' not in intf.lower()): + (peer_ipv4, ipv4_mask) = topo_definition['configuration'][vm]['interfaces'][intf]['ipv4'].split('/') + vmconfig[vm]['peer_ipv4'][dut_index] = peer_ipv4 + vmconfig[vm]['ipv4mask'][dut_index] = ipv4_mask + vmconfig[vm]['ip_intf'][dut_index] = intf + if isinstance(topo_definition['configuration'][vm]['interfaces'],dict) and 'ipv6' in topo_definition['configuration'][vm]['interfaces'][intf] and ('loopback' not in intf.lower()): + (ipv6_addr, ipv6_mask) = topo_definition['configuration'][vm]['interfaces'][intf]['ipv6'].split('/') + vmconfig[vm]['peer_ipv6'][dut_index] = ipv6_addr.upper() + vmconfig[vm]['ipv6mask'][dut_index] = ipv6_mask + vmconfig[vm]['ip_intf'][dut_index] = intf + # bgp + vmconfig[vm]['bgp_asn'] = topo_definition['configuration'][vm]['bgp']['asn'] + dut_asn = topo_definition['configuration_properties']['common']['dut_asn'] + for ipstr in topo_definition['configuration'][vm]['bgp']['peers'][dut_asn]: + ip_mask = None + if '/' in ipstr: + (ipstr, ip_mask) = ipstr.split('/') + if sys.version_info < (3, 0): + ip = ipaddress.ip_address(ipstr.decode('utf8')) + else: + ip = ipaddress.ip_address(ipstr) + for dut_index in range(0, dut_num): + if ip.version == 4: + # Each VM might not be connected to all the DUT's, so check if this VM is a peer to DUT at dut_index + if vmconfig[vm]['peer_ipv4'][dut_index]: + ipsubnet_str = vmconfig[vm]['peer_ipv4'][dut_index]+'/'+vmconfig[vm]['ipv4mask'][dut_index] + if sys.version_info < (3, 0): + ipsubnet = ipaddress.ip_interface(ipsubnet_str.decode('utf8')) + else: + ipsubnet = ipaddress.ip_interface(ipsubnet_str) + if ip in ipsubnet.network: + vmconfig[vm]['bgp_ipv4'][dut_index] = ipstr.upper() + elif neigh_type == "NEIGH_ASIC": vmconfig[vm]['bgp_ipv4'][dut_index] = ipstr.upper() - elif ip.version == 6: - # Each VM might not be connected to all the DUT's, so check if this VM is a peer to DUT at dut_index - if vmconfig[vm]['peer_ipv6'][dut_index]: - ipsubnet_str = vmconfig[vm]['peer_ipv6'][dut_index]+'/'+vmconfig[vm]['ipv6mask'][dut_index] - if sys.version_info < (3, 0): - ipsubnet = ipaddress.ip_interface(ipsubnet_str.decode('utf8')) - else: - ipsubnet = ipaddress.ip_interface(ipsubnet_str) - if ip in ipsubnet.network: + vmconfig[vm]['ipv4mask'][dut_index] = ip_mask if ip_mask else '32' + elif ip.version == 6: + # Each VM might not be connected to all the DUT's, so check if this VM is a peer to DUT at dut_index + if vmconfig[vm]['peer_ipv6'][dut_index]: + ipsubnet_str = vmconfig[vm]['peer_ipv6'][dut_index]+'/'+vmconfig[vm]['ipv6mask'][dut_index] + if sys.version_info < (3, 0): + ipsubnet = ipaddress.ip_interface(ipsubnet_str.decode('utf8')) + else: + ipsubnet = ipaddress.ip_interface(ipsubnet_str) + if ip in ipsubnet.network: + vmconfig[vm]['bgp_ipv6'][dut_index] = ipstr.upper() + elif neigh_type == "NEIGH_ASIC": vmconfig[vm]['bgp_ipv6'][dut_index] = ipstr.upper() + vmconfig[vm]['ipv6mask'][dut_index] = ip_mask if ip_mask else '128' return vmconfig def get_topo_config(self, topo_name, hwsku): @@ -201,10 +216,10 @@ def get_topo_config(self, topo_name, hwsku): topo_definition = yaml.load(f) if not os.path.isfile(asic_topo_filename): - asic_definition = {} + slot_definition = {} else: with open(asic_topo_filename) as f: - asic_definition = yaml.load(f) + slot_definition = yaml.load(f) ### parse topo file specified in vars/ to reverse as dut config dut_num = 1 @@ -225,17 +240,13 @@ def get_topo_config(self, topo_name, hwsku): vm_topo_config['dut_type'] = topo_definition['configuration_properties']['common']['dut_type'] vm_topo_config['dut_asn'] = dut_asn - - for asic in asic_definition: - po_map_asic = [None] * 16 # maximum 16 port channel interfaces - asic_topo_config[asic] = dict() - asic_topo_config[asic]['dut_asn'] = asic_definition[asic]['configuration_properties']['common']['dut_asn'] - asic_topo_config[asic]['asic_type'] = asic_definition[asic]['configuration_properties']['common']['asic_type'] - asic_topo_config[asic]['Loopback4096'] = [] - for lo4096 in asic_definition[asic]['configuration_properties']['common']['Loopback4096']: - asic_topo_config[asic]['Loopback4096'].append(lo4096) - - asic_topo_config[asic]['neigh_asic'] = self.parse_topo_defintion(asic_definition[asic], po_map_asic, 1, 'NEIGH_ASIC') + for slot,asic_definition in slot_definition.items(): + asic_topo_config[slot] = dict() + for asic in asic_definition: + po_map_asic = [None] * 16 # maximum 16 port channel interfaces + asic_topo_config[slot][asic] = dict() + asic_topo_config[slot][asic]['asic_type'] = asic_definition[asic]['configuration_properties']['common']['asic_type'] + asic_topo_config[slot][asic]['neigh_asic'] = self.parse_topo_defintion(asic_definition[asic], po_map_asic, 1, 'NEIGH_ASIC') vm_topo_config['host_interfaces_by_dut'] = [[] for i in range(dut_num)] if 'host_interfaces' in topo_definition['topology']: diff --git a/ansible/templates/minigraph_cpg.j2 b/ansible/templates/minigraph_cpg.j2 index 0ef9883216a..2afa8ca86bb 100644 --- a/ansible/templates/minigraph_cpg.j2 +++ b/ansible/templates/minigraph_cpg.j2 @@ -1,7 +1,7 @@ - + +{% if card_type is not defined or card_type != 'supervisor' %} -{% if card_type is not defined or card_type != 'supervisor' %} {% for index in range(vms_number) %} {% set vm=vms[index] %} {% if vm_topo_config['vm'][vm]['peer_ipv4'][dut_index|int] %} @@ -51,26 +51,26 @@ {% endif %} {% endif %} {% endfor %} -{% for asic in asic_topo_config %} -{% for neigh_asic in asic_topo_config[asic]['neigh_asic'] %} -{% if asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv4'][0] %} +{% for asic,asic_config in asic_topo_config[slot_num|default('slot0')].items() %} +{% for neigh_asic in asic_config['neigh_asic'] %} +{% if asic_config['neigh_asic'][neigh_asic]['peer_ipv4'][0] %} false {{ asic }} - {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['bgp_ipv4'][0] }} + {{ asic_config['neigh_asic'][neigh_asic]['bgp_ipv4'][0] }} {{ neigh_asic }} - {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv4'][0] }} + {{ asic_config['neigh_asic'][neigh_asic]['peer_ipv4'][0] }} 1 0 0 {% endif %} -{% if asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv6'][0] %} +{% if asic_config['neigh_asic'][neigh_asic]['peer_ipv6'][0] %} {{ asic }} - {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['bgp_ipv6'][0] }} + {{ asic_config['neigh_asic'][neigh_asic]['bgp_ipv6'][0] }} {{ neigh_asic }} - {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv6'][0] }} + {{ asic_config['neigh_asic'][neigh_asic]['peer_ipv6'][0] }} 1 0 0 @@ -78,22 +78,21 @@ {% endif %} {% endfor %} {% endfor %} -{% endif %} -{% if switch_type is defined and switch_type == 'voq' %} -{% set voq_peers = dict() %} +{% if switch_type is defined and (switch_type == 'voq' or switch_type == 'chassis-packet') %} +{% set chassis_ibgp_peers = dict() %} {% for asic_id in range(num_asics) %} {% if num_asics == 1 %} -{% set start_rtr = inventory_hostname %} +{% set start_rtr = inventory_hostname %} {% else %} {% set start_rtr = "ASIC" + asic_id|string %} {% endif %} -{% for a_linecard in all_inbands %} -{% for idx in range(all_inbands[a_linecard]|length) %} -{% if voq_inband_ip[asic_id] != all_inbands[a_linecard][idx] %} +{% for a_linecard in all_loopback4096 %} +{% for idx in range(all_loopback4096[a_linecard]|length) %} +{% if loopback4096_ip[asic_id] != all_loopback4096[a_linecard][idx] %} {{ start_rtr }} - {{ voq_inband_ip[asic_id].split('/')[0] }} -{% if all_inbands[a_linecard]|length == 1 %} + {{ loopback4096_ip[asic_id].split('/')[0] }} +{% if all_loopback4096[a_linecard]|length == 1 %} {% set end_rtr = a_linecard %} {% else %} {% if a_linecard == inventory_hostname %} @@ -102,13 +101,13 @@ {% set end_rtr = a_linecard + "-ASIC" + idx|string %} {% endif %} {% endif %} -{% set _ = voq_peers.update({ all_inbands[a_linecard][idx].split('/')[0] : end_rtr }) %} +{% set _ = chassis_ibgp_peers.update({ all_loopback4096[a_linecard][idx].split('/')[0] : end_rtr }) %} {{ end_rtr }} - {{ all_inbands[a_linecard][idx].split('/')[0] }} + {{ all_loopback4096[a_linecard][idx].split('/')[0] }} 1 0 0 - true + {{ switch_type }} {% endif %} {% endfor %} @@ -132,10 +131,10 @@ {% endif %} {% endfor %} -{% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} -{% for a_voq_peer in voq_peers %} +{% if num_asics == 1 and switch_type is defined and (switch_type == 'voq' or switch_type == 'chassis-packet') %} +{% for a_chassis_ibgp_peer in chassis_ibgp_peers %} -
{{ a_voq_peer }}
+
{{ a_chassis_ibgp_peer }}
@@ -175,7 +174,7 @@ {% endif %} {% endfor %} {% endif %} -{% for asic in asic_topo_config %} +{% for asic,asic_config in asic_topo_config[slot_num|default('slot0')].items() %} {{ vm_topo_config['dut_asn'] }} {{ asic }} @@ -190,10 +189,10 @@
{% endif %} {% endfor %} -{% for neigh_asic in asic_topo_config %} -{% if neigh_asic in asic_topo_config[asic]['neigh_asic'] and asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv4'][0] %} +{% for neigh_asic in asic_config['neigh_asic'] %} +{% if neigh_asic in asic_config['neigh_asic'] and asic_config['neigh_asic'][neigh_asic]['peer_ipv4'][0] %} -
{{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv4'][0] }}
+
{{ asic_config['neigh_asic'][neigh_asic]['peer_ipv4'][0] }}
@@ -204,13 +203,13 @@ {% endfor %} -{% if switch_type is defined and switch_type == 'voq' %} -{% for a_linecard in all_inbands %} +{% if switch_type is defined and (switch_type == 'voq' or switch_type == 'chassis-packet') %} +{% for a_linecard in all_loopback4096 %} {% if a_linecard != inventory_hostname %} -{% for idx in range(all_inbands[a_linecard]|length) %} +{% for idx in range(all_loopback4096[a_linecard]|length) %} {{ vm_topo_config['dut_asn'] }} - {{ voq_peers[all_inbands[a_linecard][idx].split('/')[0]] }} + {{ chassis_ibgp_peers[all_loopback4096[a_linecard][idx].split('/')[0]] }} {% endfor %} @@ -233,11 +232,11 @@
{% endif %} {% endfor %} -{% for a_linecard in all_inbands %} -{% for idx in range(all_inbands[a_linecard]|length) %} -{% if voq_inband_ip[asic_id] != all_inbands[a_linecard][idx] %} +{% for a_linecard in all_loopback4096 %} +{% for idx in range(all_loopback4096[a_linecard]|length) %} +{% if loopback4096_ip[asic_id] != all_loopback4096[a_linecard][idx] %} -
{{ all_inbands[a_linecard][idx] }}
+
{{ all_loopback4096[a_linecard][idx] }}
@@ -251,5 +250,5 @@ {% endif %} {% endif %} +{% endif %}
- diff --git a/ansible/templates/minigraph_device.j2 b/ansible/templates/minigraph_device.j2 index d4f34ab05d4..e743123bfc1 100644 --- a/ansible/templates/minigraph_device.j2 +++ b/ansible/templates/minigraph_device.j2 @@ -2,7 +2,7 @@ true -{% if card_type is not defined or card_type != 'supervisor' %} +{% if switch_type is not defined or switch_type != 'fabric' %} {% set num_of_intf = port_alias | length %} {% for index in range(num_of_intf) %} diff --git a/ansible/templates/minigraph_dpg.j2 b/ansible/templates/minigraph_dpg.j2 index 67fd871a21a..f80c78da093 100644 --- a/ansible/templates/minigraph_dpg.j2 +++ b/ansible/templates/minigraph_dpg.j2 @@ -19,7 +19,7 @@ {{ lp_ipv6 }} - {% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} + {% if num_asics == 1 and switch_type is defined and (switch_type == 'voq' or switch_type == 'chassis-packet') %} {% if loopback4096_ip is defined %} HostIP1 @@ -265,7 +265,7 @@ -{% include 'minigraph_dpg_asic.j2' %} +{# include 'minigraph_dpg_asic.j2' #} {% include 'minigraph_dpg_voq_asic.j2' %} diff --git a/ansible/templates/minigraph_dpg_voq_asic.j2 b/ansible/templates/minigraph_dpg_voq_asic.j2 index 35bd6e8e335..f4bdd6ee567 100644 --- a/ansible/templates/minigraph_dpg_voq_asic.j2 +++ b/ansible/templates/minigraph_dpg_voq_asic.j2 @@ -1,9 +1,14 @@ -{% if num_asics > 1 and switch_type is defined and switch_type == 'voq' %} -{% for asic_index in range(num_asics) %} +{% macro port_channel_id(asic_idx, neigh_asic_idx) -%} +{{ ((40 + asic_idx + (10*neigh_asic_idx))|string) }} +{%- endmacro -%} +{% if num_asics > 1 %} +{% for asic,asic_config in asic_topo_config[slot_num|default('slot0')].items() %} +{% set asic_index = asic.split('ASIC')[1]|int %} {% set asic_name = "ASIC" + asic_index|string %} +{% if card_type is not defined or card_type != 'supervisor' %} HostIP Loopback0 @@ -37,6 +42,7 @@ {{ loopback4096_ipv6[asic_index] }} +{% endif %} {% endif %} @@ -81,29 +87,60 @@ {{ asic_name }} +{% if card_type is not defined or card_type != 'supervisor' %} {% for index in range(vms_number) %} {% if vms[index] in vm_asic_ifnames and vm_asic_ifnames[vms[index]][0].split('-')[1] == asic_name %} {% if 'port-channel' in vm_topo_config['vm'][vms[index]]['ip_intf'][dut_index|int]|lower %} {% set port_channel_intf=';'.join(vm_asic_ifnames[vms[index]]) %} - PortChannel{{ ((index+1)|string).zfill(4) }} + PortChannel{{ ((index+1)|string).zfill(2) }} {{ port_channel_intf }} {% endif %} {% endif %} +{% endfor %} +{% endif %} +{%- set vlan_intfs = [] -%} +{% for neigh_asic in asic_config['neigh_asic'] %} +{%- set pc_intfs = [] -%} +{# Assumption - Backed ASIC always have port-channel connectivity #} +{%- for intf in asic_config['neigh_asic'][neigh_asic]['asic_intfs'][0] %} +{{- pc_intfs.append(intf) }} +{%- endfor -%} +{%- set port_channel_intf=pc_intfs|join(';') -%} +{% set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} + + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(2) }} + {{ port_channel_intf }} + + +{% set vlan_intf = 'PortChannel' + port_channel_id(asic_index, neigh_asic_index).zfill(2) %} +{{- vlan_intfs.append(vlan_intf) -}} {% endfor %} - +{% if card_type is defined and card_type == 'supervisor' and vlan_intfs %} + + + Vlan2 +{% set vlan_intf_str=';'.join(vlan_intfs) %} + {{ vlan_intf_str }} + Tagged + 2 + + +{% else %} +{% endif %} +{% if card_type is not defined or card_type != 'supervisor' %} {% for index in range(vms_number) %} {% if vms[index] in vm_asic_ifnames and vm_asic_ifnames[vms[index]][0].split('-')[1] == asic_name %} {% if vm_topo_config['vm'][vms[index]]['ip_intf'][dut_index|int] is not none %} {% if 'port-channel' in vm_topo_config['vm'][vms[index]]['ip_intf'][dut_index|int]|lower %} - PortChannel{{ ((index+1) |string).zfill(4) }} + PortChannel{{ ((index+1) |string).zfill(2) }} {% else %} {{ front_panel_asic_ifnames[vm_topo_config['vm'][vms[index]]['interface_indexes'][dut_index|int][0]] }} {% endif %} @@ -112,7 +149,7 @@ {% if 'port-channel' in vm_topo_config['vm'][vms[index]]['ip_intf'][dut_index|int]|lower %} - PortChannel{{ ((index+1) |string).zfill(4) }} + PortChannel{{ ((index+1) |string).zfill(2) }} {% else %} {{ front_panel_asic_ifnames[vm_topo_config['vm'][vms[index]]['interface_indexes'][dut_index|int][0]] }} {% endif %} @@ -121,7 +158,73 @@ {% endif %} {% endif %} {% endfor %} +{% if switch_type is defined and switch_type == 'chassis-packet' %} + + +{% for neigh_asic in asic_config['neigh_asic'] %} +{%- set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} + + + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(2) }} + 2 + dot1q + {{ asic_config['neigh_asic'][neigh_asic]['bgp_ipv4'][0] }}/{{ asic_config['neigh_asic'][neigh_asic]['ipv4mask'][0] }} + + + + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(2) }} + 2 + dot1q + {{ asic_config['neigh_asic'][neigh_asic]['bgp_ipv6'][0] }}/{{ asic_config['neigh_asic'][neigh_asic]['ipv6mask'][0] }} + +{% endfor %} + + +{% for a_linecard in all_loopback4096 %} +{% for idx in range(all_loopback4096[a_linecard]|length) %} +{% set remote_asic_name = "ASIC" + idx|string %} +{% if a_linecard != inventory_hostname or idx != asic_index %} + + IPNextHop + + {{ all_loopback4096[a_linecard][idx] }} + StaticRoute +
+{%- set nexthop_intfs = [] -%} +{% for asic,asic_config in asic_topo_config[all_slots[a_linecard]].items() %} +{% if (a_linecard != inventory_hostname and asic == remote_asic_name) or (a_linecard == inventory_hostname and asic != asic_name) %} +{% for neigh_asic in asic_config['neigh_asic'] %} +{% set _ = nexthop_intfs.append(asic_config['neigh_asic'][neigh_asic]['bgp_ipv4'][0]) %} +{% endfor %} +{% endif %} +{% endfor %} +{{- nexthop_intfs|join(',') -}} +
+
+{% endif %} +{% endfor %} +{% endfor %} +
+{% else %} +{% for neigh_asic in asic_config['neigh_asic'] %} +{%- set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} + + + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(2) }} + {{ asic_config['neigh_asic'][neigh_asic]['bgp_ipv4'][0] }}/{{ asic_config['neigh_asic'][neigh_asic]['ipv4mask'][0] }} + + + + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(2) }} + {{ asic_config['neigh_asic'][neigh_asic]['bgp_ipv6'][0] }}/{{ asic_config['neigh_asic'][neigh_asic]['ipv6mask'][0] }} + +{% endfor %} + +{% endif %} +{% else %} + +{% endif %} @@ -147,24 +250,35 @@ {%- set acl_intfs = [] -%} +{% if card_type is not defined or card_type != 'supervisor' %} {%- for index in range(vms_number) %} {% if vms[index] in vm_asic_ifnames and vm_asic_ifnames[vms[index]][0].split('-')[1] == asic_name %} {% if 'port-channel' in vm_topo_config['vm'][vms[index]]['ip_intf'][0]|lower %} -{% set a_intf = 'PortChannel' + ((index+1) |string).zfill(4) %} +{% set a_intf = 'PortChannel' + ((index+1) |string).zfill(2) %} {{- acl_intfs.append(a_intf) -}} {% endif %} {% endif %} {% endfor %} +{% for neigh_asic in asic_config['neigh_asic'] %} +{% set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} +{% set a_intf = 'PortChannel' + port_channel_id(asic_index, neigh_asic_index).zfill(2) %} +{{- acl_intfs.append(a_intf) -}} +{% endfor %} {%- for index in range(vms_number) -%} {% if vms[index] in vm_asic_ifnames and vm_asic_ifnames[vms[index]][0].split('-')[1] == asic_name %} -{% if 'port-channel' not in vm_topo_config['vm'][vms[index]]['ip_intf'][0]|lower %} {% if vm_topo_config['vm'][vms[index]]['intfs'][dut_index|int]|length %} {% set a_intf = front_panel_asic_ifnames[vm_topo_config['vm'][vms[index]]['interface_indexes'][dut_index|int][0]] %} {{- acl_intfs.append(a_intf) -}} {% endif %} {% endif %} -{% endif %} {% endfor -%} +{% for neigh_asic in asic_config['neigh_asic'] %} +{% if asic_config['neigh_asic'][neigh_asic]['intfs'][0]|length %} +{% set a_intf = asic_config['neigh_asic'][neigh_asic]['asic_intfs'][0][0] %} +{{- acl_intfs.append(a_intf) -}} +{% endif %} +{% endfor %} +{% endif %} {{- acl_intfs|join(';') -}} DataAcl @@ -214,5 +328,3 @@
{% endfor %} {% endif %} - - diff --git a/ansible/templates/minigraph_meta.j2 b/ansible/templates/minigraph_meta.j2 index 3fe782e7fb0..c03e9133731 100644 --- a/ansible/templates/minigraph_meta.j2 +++ b/ansible/templates/minigraph_meta.j2 @@ -91,12 +91,14 @@ {{ erspan_dest_str }} {% endif %} -{% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} +{% if switch_type is defined %} SwitchType {{ switch_type }} +{% endif %} +{% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} SwitchId @@ -144,36 +146,23 @@ {% endfor %} {% endif %} -{% for asic in asic_topo_config %} +{% for asic,asic_config in asic_topo_config[slot_num|default('slot0')].items() %} {{ asic }} SubRole - {{ asic_topo_config[asic]['asic_type'] }} + {{ asic_config['asic_type'] }} - -{% if switch_type is defined and switch_type == 'voq' %} +{% if switch_type is defined %} SwitchType {{ switch_type }} - - SwitchId - - {{ start_switchid + idx }} -{% set idx = idx + 1 %} - -{% endif %} -{% if max_cores is defined %} - - MaxCores - - {{ max_cores }} - {% endif %} + {% endfor %} {% for asic in fabric_info %} diff --git a/ansible/templates/minigraph_png.j2 b/ansible/templates/minigraph_png.j2 index 74646a22031..7a12c4c7255 100644 --- a/ansible/templates/minigraph_png.j2 +++ b/ansible/templates/minigraph_png.j2 @@ -55,18 +55,17 @@ {% endfor %} {% endif %} {% endif %} -{% for asic in asic_topo_config %} -{% for neigh_asic in asic_topo_config[asic]['neigh_asic'] %} -{% for intf in asic_topo_config[asic]['neigh_asic'][neigh_asic]['intfs'][0] | sort %} +{% for asic,asic_config in asic_topo_config[slot_num|default('slot0')].items() %} +{% for neigh_asic in asic_config['neigh_asic'] %} +{% for intf in asic_config['neigh_asic'][neigh_asic]['intfs'][0] | sort %} DeviceInterfaceLink - 40000 true {{ neigh_asic }} {{ intf }} true {{ asic }} - {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['asic_intfs'][0][loop.index-1] }} + {{ asic_config['neigh_asic'][neigh_asic]['asic_intfs'][0][loop.index-1] }} true {% endfor %} @@ -192,7 +191,9 @@ {% endif %} {% endfor %} {% endif %} -{% for asic in asic_topo_config %} +{% if num_asics > 1 %} +{% for asic_index in range(num_asics) %} +{% set asic_name = "ASIC" + asic_index|string %} Asic
@@ -215,16 +216,8 @@ ::/0 - {{ asic }} - Broadcom-Trident2 - -{% endfor %} -{% if num_asics > 1 and switch_type is defined and switch_type == 'voq' %} -{% for asic_index in range(num_asics) %} -{% set asic_name = "ASIC" + asic_index|string %} - - Asic {{ asic_name }} + Broadcom-Trident2 {% endfor %} {% endif %} diff --git a/ansible/testbed.yaml b/ansible/testbed.yaml index c6278a07ec6..692d42db1f8 100644 --- a/ansible/testbed.yaml +++ b/ansible/testbed.yaml @@ -169,3 +169,18 @@ dut: - vlab-01 comment: Test ptf ANVL SONIC VM + +- conf-name: vms26-t2-8800-1 + group-name: vms26-1 + topo: t2 + ptf_image_name: docker-ptf + ptf: vms26-1 + ptf_ip: 10.64.246.230/23 + ptf_ipv6: + server: server_26 + vm_base: VM2600 + dut: + - lab-8800-lc0-1 + - lab-8800-lc1-1 + - lab-8800-sup-1 + comment: Chasiss Testbed diff --git a/ansible/vars/topo_8800-LC-48H-O.yml b/ansible/vars/topo_8800-LC-48H-O.yml new file mode 100644 index 00000000000..e22073eb041 --- /dev/null +++ b/ansible/vars/topo_8800-LC-48H-O.yml @@ -0,0 +1,134 @@ +slot1: + ASIC0: + topology: + NEIGH_ASIC: + ASIC0: + asic_intfs: + - Eth2250-ASIC0 + - Eth2252-ASIC0 + - Eth2254-ASIC0 + ASIC1: + asic_intfs: + - Eth2064-ASIC0 + - Eth2246-ASIC0 + - Eth2248-ASIC0 + - Eth2262-ASIC0 + configuration_properties: + common: + dut_asn: 65100 + asic_type: FrontEnd + configuration: + ASIC0: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.1.1/24 + - 2603:10e2:400:1::1 + ASIC1: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.2.1/24 + - 2603:10e2:400:2::1 + ASIC1: + topology: + NEIGH_ASIC: + ASIC0: + asic_intfs: + - Eth2504-ASIC1 + - Eth2508-ASIC1 + - Eth2510-ASIC1 + ASIC1: + asic_intfs: + - Eth2320-ASIC1 + - Eth2502-ASIC1 + - Eth2506-ASIC1 + - Eth2518-ASIC1 + configuration_properties: + common: + dut_asn: 65100 + asic_type: FrontEnd + configuration: + ASIC0: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.1.2/24 + - 2603:10e2:400:1::2 + ASIC1: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.2.2/24 + - 2603:10e2:400:2::2 +slot2: + ASIC0: + topology: + NEIGH_ASIC: + ASIC0: + asic_intfs: + - Eth2250-ASIC0 + - Eth2252-ASIC0 + - Eth2254-ASIC0 + ASIC1: + asic_intfs: + - Eth2064-ASIC0 + - Eth2246-ASIC0 + - Eth2248-ASIC0 + - Eth2262-ASIC0 + configuration_properties: + common: + dut_asn: 65100 + asic_type: FrontEnd + configuration: + ASIC0: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.1.3/24 + - 2603:10e2:400:1::3 + ASIC1: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.2.3/24 + - 2603:10e2:400:2::3 + ASIC1: + topology: + NEIGH_ASIC: + ASIC0: + asic_intfs: + - Eth2504-ASIC1 + - Eth2508-ASIC1 + - Eth2510-ASIC1 + ASIC1: + asic_intfs: + - Eth2320-ASIC1 + - Eth2502-ASIC1 + - Eth2506-ASIC1 + - Eth2518-ASIC1 + configuration_properties: + common: + dut_asn: 65100 + asic_type: FrontEnd + configuration: + ASIC0: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.1.4/24 + - 2603:10e2:400:1::4 + ASIC1: + bgp: + asn: 65100 + peers: + 65100: + - 10.0.2.4/24 + - 2603:10e2:400:2::4 diff --git a/ansible/vars/topo_8800-RP-O.yml b/ansible/vars/topo_8800-RP-O.yml new file mode 100644 index 00000000000..a065e677f69 --- /dev/null +++ b/ansible/vars/topo_8800-RP-O.yml @@ -0,0 +1,57 @@ +slot0: + ASIC0: + topology: + NEIGH_ASIC: + ASIC0: + asic_intfs: + - Eth0194-ASIC0 + - Eth0170-ASIC0 + - Eth0162-ASIC0 + ASIC1: + asic_intfs: + - Eth0164-ASIC0 + - Eth0172-ASIC0 + - Eth0192-ASIC0 + ASIC2: + asic_intfs: + - Eth0126-ASIC0 + - Eth0144-ASIC0 + - Eth0152-ASIC0 + ASIC3: + asic_intfs: + - Eth0128-ASIC0 + - Eth0146-ASIC0 + - Eth0154-ASIC0 + configuration_properties: + common: + asic_type: BackEnd + ASIC1: + topology: + NEIGH_ASIC: + ASIC0: + asic_intfs: + - Eth0438-ASIC1 + - Eth0454-ASIC1 + - Eth0462-ASIC1 + - Eth0464-ASIC1 + ASIC1: + asic_intfs: + - Eth0440-ASIC1 + - Eth0456-ASIC1 + - Eth0466-ASIC1 + - Eth0468-ASIC1 + ASIC2: + asic_intfs: + - Eth0424-ASIC1 + - Eth0432-ASIC1 + - Eth0444-ASIC1 + - Eth0448-ASIC1 + ASIC3: + asic_intfs: + - Eth0422-ASIC1 + - Eth0430-ASIC1 + - Eth0446-ASIC1 + - Eth0450-ASIC1 + configuration_properties: + common: + asic_type: BackEnd diff --git a/ansible/vars/topo_t2-vs.yml b/ansible/vars/topo_t2-vs.yml index acdc630f19b..f1c458d8c22 100644 --- a/ansible/vars/topo_t2-vs.yml +++ b/ansible/vars/topo_t2-vs.yml @@ -54,7 +54,7 @@ configuration_properties: max_tor_subnet_number: 32 tor_subnet_size: 128 dut_asn: 65100 - dut_type: Spine + dut_type: SpineRouter nhipv4: 10.10.246.254 nhipv6: FC0A::FF core: