diff --git a/ansible/TestbedProcessing.py b/ansible/TestbedProcessing.py index 6e0075407d7..f4dbf6658c8 100644 --- a/ansible/TestbedProcessing.py +++ b/ansible/TestbedProcessing.py @@ -492,63 +492,48 @@ def makeLab(data, devices, testbed, outfile): except AttributeError: print("\t\t" + host + " asics_host_ipv6 not found") + try: #get voq_inband_ip + voq_inband_ip = dev.get("voq_inband_ip") + if voq_inband_ip is not None: + entry += "\tvoq_inband_ip=" + str( voq_inband_ip ) + except AttributeError: + print("\t\t" + host + " voq_inband_ip not found") + + try: #get voq_inband_ipv6 + voq_inband_ipv6 = dev.get("voq_inband_ipv6") + if voq_inband_ipv6 is not None: + entry += "\tvoq_inband_ipv6=" + str( voq_inband_ipv6 ) + except AttributeError: + print("\t\t" + host + " voq_inband_ipv6 not found") + + try: #get voq_inband_intf + voq_inband_intf = dev.get("voq_inband_intf") + if voq_inband_intf is not None: + entry += "\tvoq_inband_intf=" + str( voq_inband_intf ) + except AttributeError: + print("\t\t" + host + " voq_inband_intf not found") + + try: #get voq_inband_type + voq_inband_type = dev.get("voq_inband_type") + if voq_inband_type is not None: + entry += "\tvoq_inband_type=" + str( voq_inband_type ) + except AttributeError: + print("\t\t" + host + " voq_inband_type not found") + try: #get switch_type switch_type = dev.get("switch_type") if switch_type is not None: - entry += "\tswitch_type=" + str( switch_type ) - if switch_type == 'voq' and card_type != 'supervisor': - if num_asics is None: - num_asics = 1 - - # All fields are a list. For single asic the list is of size 1. - switchids = dev.get("switchids") # switchids, single asic example "[4]", 3 asic example "[4,6,8]" - voq_inband_ip = dev.get("voq_inband_ip") # voq_inband_ip - voq_inband_ipv6 = dev.get("voq_inband_ipv6") # voq_inband_ipv6 - voq_inband_intf = dev.get("voq_inband_intf") # voq_inband_intf - voq_inband_type = dev.get("voq_inband_type") # voq_inband_type - max_cores = dev.get("max_cores") # max cores - lo4096_ip = dev.get("loopback4096_ip") # loopback4096_ip - lo4096_ipv6 = dev.get("loopback4096_ipv6") # loopback4096_ipv6 - num_cores_per_asic = dev.get("num_cores_per_asic", 1) # number of cores per asic - to be used in calculating the switchids, assuming to be the same for all linecards - - # Add fields - if switchids is None: - switchids = [start_switchid + (asic_id * num_cores_per_asic) for asic_id in range(num_asics)] - entry += "\tswitchids=" + str(switchids) - - if voq_inband_ip is None: - voq_inband_ip = ["1.1.1.{}/32".format(start_switchid + asic_id) for asic_id in range(num_asics)] - entry += "\tvoq_inband_ip=" + str(voq_inband_ip) - - if voq_inband_ipv6 is None: - voq_inband_ip = ["1111::1:{}/128".format(start_switchid + asic_id) for asic_id in range(num_asics)] - entry += "\tvoq_inband_ipv6=" + str(voq_inband_ip) - - if voq_inband_intf is None: - voq_inband_intf = ["Ethernet-IB{}".format(asic_id) for asic_id in range(num_asics)] - entry += "\tvoq_inband_intf=" + str(voq_inband_intf) - - if voq_inband_type is None: - voq_inband_type = "port" - entry += "\tvoq_inband_type=" + voq_inband_type - - if max_cores is None: - max_cores = 48 - entry += "\tmax_cores=" + str(max_cores) - - if lo4096_ip is None: - lo4096_ip = ["8.0.0.{}/32".format(start_switchid + asic_id) for asic_id in range(num_asics)] - entry += "\tloopback4096_ip=" + lo4096_ip - - if lo4096_ipv6 is None: - lo4096_ipv6 = ["2603:10e2:400::{}/128".format(start_switchid + asic_id) for asic_id in range(num_asics)] - entry += "\tloopback4096_ipv6=" + lo4096_ipv6 - - start_switchid += (num_asics * num_cores_per_asic) - + entry += "\tswitch_type=" + str( switch_type ) except AttributeError: print("\t\t" + host + " switch_type not found") + try: #get max_cores + max_cores = dev.get("max_cores") + if max_cores is not None: + entry += "\tmax_cores=" + str( max_cores ) + except AttributeError: + print("\t\t" + host + " max_cores not found") + try: #get os os = dev.get("os") if os is not None: diff --git a/ansible/config_sonic_basedon_testbed.yml b/ansible/config_sonic_basedon_testbed.yml index b01a3484036..72646b8f350 100644 --- a/ansible/config_sonic_basedon_testbed.yml +++ b/ansible/config_sonic_basedon_testbed.yml @@ -84,7 +84,7 @@ hwsku: "{{ hwsku }}" card_type: "{{ card_type | default('fixed') }}" hostname: "{{ inventory_hostname | default('') }}" - switchids: "{{ switchids | default([0]) }}" + start_switchid: "{{ start_switchid | default(0) }}" when: deploy is defined and deploy|bool == true - name: find interface name mapping and individual interface speed if defined with local data @@ -93,7 +93,7 @@ num_asic: "{{ num_asics }}" card_type: "{{ card_type | default('fixed') }}" hostname: "{{ inventory_hostname | default('') }}" - switchids: "{{ switchids | default([0]) }}" + start_switchid: "{{ start_switchid | default(0) }}" delegate_to: localhost when: deploy is not defined or deploy|bool == false @@ -111,7 +111,8 @@ - name: set all VoQ information for iBGP set_fact: - all_inbands: "{{ all_inbands | default( {} ) | combine( { item : hostvars[item]['voq_inband_ip']}) }}" + all_inbands: "{{ all_inbands | default( [] ) + [ hostvars[item]['voq_inband_ip'] ] }}" + all_hostnames: "{{ all_hostnames | default( [] ) + [ item ] }}" when: hostvars[item]['voq_inband_ip'] is defined loop: "{{ ansible_play_batch }}" diff --git a/ansible/library/fabric_info.py b/ansible/library/fabric_info.py index 9385231c1e7..7b7442c203c 100644 --- a/ansible/library/fabric_info.py +++ b/ansible/library/fabric_info.py @@ -23,8 +23,8 @@ RETURN = ''' ansible_facts{ - fabric_info: [{'asicname': 'ASIC0', 'asic_id': 0, 'ip_prefix': '10.1.0.1/32', 'ip6_prefix': 'FC00:1::1/128'}, - {'asicname': 'ASIC1', 'asic_id': 1, 'ip_prefix': '10.1.0.2/32', 'ip6_prefix': 'FC00:1::2/128'}] + fabric_info: [{'asicname': 'ASIC0', 'ip_prefix': '10.1.0.1/32', 'ip6_prefix': 'FC00:1::1/128'}, + {'asicname': 'ASIC1', 'ip_prefix': '10.1.0.2/32', 'ip6_prefix': 'FC00:1::2/128'}] } ''' @@ -55,7 +55,6 @@ def main(): next_v4addr = str( ipaddress.IPv4Address(v4base + asic_id) ) next_v6addr = str( ipaddress.IPv6Address(v6base + asic_id) ) data = { 'asicname': key, - 'asic_id' : asic_id, 'ip_prefix': next_v4addr + "/" + v4pfx[-1], 'ip6_prefix': next_v6addr + "/" + v6pfx[-1] } fabric_info.append( data ) diff --git a/ansible/library/port_alias.py b/ansible/library/port_alias.py index 5676d05f0a0..13fd30d610c 100755 --- a/ansible/library/port_alias.py +++ b/ansible/library/port_alias.py @@ -104,8 +104,8 @@ def get_portmap(self, asic_id=None, include_internal=False, port_coreid_index = -1 port_core_portid_index = -1 num_voq_index = -1 - # default to Asic0 as minigraph.py parsing code has that assumption. - asic_name = "Asic0" if asic_id is None else "asic" + str(asic_id) + # 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) if filename is None: @@ -209,7 +209,7 @@ 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) + start_switchid=dict(type='int', required=False) ), supports_check_mode=True ) @@ -235,10 +235,10 @@ def main(): 'sysports': sysports}) return allmap = SonicPortAliasMap(m_args['hwsku']) - switchids = None - if 'switchids' in m_args and m_args['switchids'] != None: - switchids = m_args['switchids'] - # When this script is invoked on sonic-mgmt docker, num_asic + start_switchid = 0 + if 'start_switchid' in m_args and m_args['start_switchid'] != None: + start_switchid = int(m_args['start_switchid']) + # When this script is invoked on sonic-mgmt docker, num_asic # parameter is passed. if m_args['num_asic'] is not None: num_asic = m_args['num_asic'] @@ -264,8 +264,8 @@ 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: - switchid = switchids[asic_id] + if asic_id is not None: + switchid = start_switchid + asic_id if num_asic == 1: asic_id = None (aliases_asic, portmap_asic, aliasmap_asic, portspeed_asic, front_panel_asic, asicifnames_asic, diff --git a/ansible/templates/minigraph_cpg.j2 b/ansible/templates/minigraph_cpg.j2 index 0ef9883216a..3b92d7cbf7c 100644 --- a/ansible/templates/minigraph_cpg.j2 +++ b/ansible/templates/minigraph_cpg.j2 @@ -80,31 +80,13 @@ {% endfor %} {% endif %} {% if switch_type is defined and switch_type == 'voq' %} -{% set voq_peers = dict() %} -{% for asic_id in range(num_asics) %} -{% if num_asics == 1 %} -{% 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 all_idx in range(all_inbands|length) %} +{% if voq_inband_ip != all_inbands[all_idx] %} - {{ start_rtr }} - {{ voq_inband_ip[asic_id].split('/')[0] }} -{% if all_inbands[a_linecard]|length == 1 %} -{% set end_rtr = a_linecard %} -{% else %} -{% if a_linecard == inventory_hostname %} -{% set end_rtr = "ASIC" + idx|string %} -{% else %} -{% set end_rtr = a_linecard + "-ASIC" + idx|string %} -{% endif %} -{% endif %} -{% set _ = voq_peers.update({ all_inbands[a_linecard][idx].split('/')[0] : end_rtr }) %} - {{ end_rtr }} - {{ all_inbands[a_linecard][idx].split('/')[0] }} + {{ inventory_hostname }} + {{ voq_inband_ip.split('/')[0] }} + {{ all_hostnames[all_idx] }} + {{ all_inbands[all_idx].split('/')[0] }} 1 0 0 @@ -112,8 +94,6 @@ {% endif %} {% endfor %} -{% endfor %} -{% endfor %} {% endif %} @@ -132,14 +112,16 @@ {% endif %} {% endfor %} -{% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} -{% for a_voq_peer in voq_peers %} +{% if switch_type is defined and switch_type == 'voq' %} +{% for all_idx in range(all_inbands|length) %} +{% if voq_inband_ip != all_inbands[all_idx] %} -
{{ a_voq_peer }}
+
{{ all_inbands[all_idx].split('/')[0] }}
+{% endif %} {% endfor %} {% endif %} {% if 'tor' in vm_topo_config['dut_type'] | lower %} @@ -165,6 +147,17 @@ +{% if switch_type is defined and switch_type == 'voq' %} +{% for all_idx in range(all_inbands|length) %} +{% if voq_inband_ip != all_inbands[all_idx] %} + + {{ vm_topo_config['dut_asn'] }} + {{ all_hostnames[all_idx] }} + + +{% endif %} +{% endfor %} +{% endif %} {% for index in range( vms_number) %} {% if vm_topo_config['vm'][vms[index]]['intfs'][dut_index|int]|length > 0 %} @@ -181,7 +174,7 @@ {{ asic }} {% for index in range( vms_number) %} -{% if vms[index] in vm_asic_ifnames and vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %} +{% if vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %}
{{ vm_topo_config['vm'][vms[index]]['peer_ipv4'][dut_index|int] }}
@@ -204,52 +197,6 @@
{% endfor %} -{% if switch_type is defined and switch_type == 'voq' %} -{% for a_linecard in all_inbands %} -{% if a_linecard != inventory_hostname %} -{% for idx in range(all_inbands[a_linecard]|length) %} - - {{ vm_topo_config['dut_asn'] }} - {{ voq_peers[all_inbands[a_linecard][idx].split('/')[0]] }} - - -{% endfor %} -{% endif %} -{% endfor %} -{% if num_asics > 1 %} -{% for asic_id in range(num_asics) %} -{% set asic_name = "ASIC" + asic_id|string %} - - {{ vm_topo_config['dut_asn'] }} - {{ asic_name }} - -{% for index in range( vms_number) %} -{% if vms[index] in vm_asic_ifnames and vm_asic_ifnames[vms[index]][0].split('-')[1] == asic_name %} - -
{{ vm_topo_config['vm'][vms[index]]['peer_ipv4'][dut_index|int] }}
- - - -
-{% 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] %} - -
{{ all_inbands[a_linecard][idx] }}
- - - -
-{% endif %} -{% endfor %} -{% endfor %} -
-
-{% endfor %} -{% endif %} -{% endif %}
diff --git a/ansible/templates/minigraph_dpg.j2 b/ansible/templates/minigraph_dpg.j2 index 67fd871a21a..821bec08dc0 100644 --- a/ansible/templates/minigraph_dpg.j2 +++ b/ansible/templates/minigraph_dpg.j2 @@ -19,26 +19,6 @@ {{ lp_ipv6 }} - {% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} - {% if loopback4096_ip is defined %} - - HostIP1 - Loopback4096 - - {{ loopback4096_ip[0] }} - - {{ loopback4096_ip[0] }} - - - HostIP1 - Loopback4096 - - {{ loopback4096_ipv6[0] }} - - {{ loopback4096_ipv6[0] }} - - {% endif %} - {% endif %} {%- if 'addl_loopbacks' in dual_tor_facts -%} {%- for loopback_num in dual_tor_facts['addl_loopbacks'][inventory_hostname] -%} {%- set loopback_facts = dual_tor_facts['addl_loopbacks'][inventory_hostname][loopback_num] -%} @@ -81,24 +61,24 @@ -{% if num_asics == 1 and (voq_inband_ip is defined or voq_inband_ipv6 is defined) %} +{% if voq_inband_ip is defined or voq_inband_ipv6 is defined %} {% if voq_inband_ip is defined %} - {{ voq_inband_intf[0] }} + {{ voq_inband_intf }} {{ voq_inband_type }} - {{ voq_inband_ip[0] }} + {{ voq_inband_ip }} {% endif %} {% if voq_inband_ipv6 is defined %} - {{ voq_inband_intf[0] }} + {{ voq_inband_intf }} {{ voq_inband_type }} - {{ voq_inband_ipv6[0] }} + {{ voq_inband_ipv6 }} {% endif %} -{% endif %} +{% endif %} @@ -266,6 +246,5 @@ {% 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 deleted file mode 100644 index 35bd6e8e335..00000000000 --- a/ansible/templates/minigraph_dpg_voq_asic.j2 +++ /dev/null @@ -1,218 +0,0 @@ -{% 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 %} - - - - - HostIP - Loopback0 - - {{ lp_ipv4 }} - - {{ lp_ipv4 }} - - - HostIP1 - Loopback0 - - {{ lp_ipv6 }} - - {{ lp_ipv6 }} - -{% if loopback4096_ip is defined %} - - HostIP1 - Loopback4096 - - {{ loopback4096_ip[asic_index] }} - - {{ loopback4096_ip[asic_index] }} - - - HostIP1 - Loopback4096 - - {{ loopback4096_ipv6[asic_index] }} - - {{ loopback4096_ipv6[asic_index] }} - -{% endif %} - - - - HostIP - eth0 - - {{ ansible_host }}/{{ mgmt_subnet_mask_length }} - - {{ ansible_host }}/{{ mgmt_subnet_mask_length }} - - - V6HostIP - eth0 - - {{ ansible_hostv6 if ansible_hostv6 is defined else 'FC00:2::32' }}/64 - - {{ ansible_hostv6 if ansible_hostv6 is defined else 'FC00:2::32' }}/64 - - - -{% if voq_inband_ip is defined or voq_inband_ipv6 is defined %} - -{% if voq_inband_ip is defined %} - - {{ voq_inband_intf[asic_index] }} - {{ voq_inband_type }} - {{ voq_inband_ip[asic_index] }} - -{% endif %} -{% if voq_inband_ipv6 is defined %} - - {{ voq_inband_intf[asic_index] }} - {{ voq_inband_type }} - {{ voq_inband_ipv6[asic_index] }} - -{% endif %} - -{% endif %} - - - - {{ asic_name }} - -{% 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) }} - {{ port_channel_intf }} - - -{% endif %} -{% endif %} -{% 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 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) }} -{% else %} - {{ front_panel_asic_ifnames[vm_topo_config['vm'][vms[index]]['interface_indexes'][dut_index|int][0]] }} -{% endif %} - {{ vm_topo_config['vm'][vms[index]]['bgp_ipv4'][dut_index|int] }}/{{ vm_topo_config['vm'][vms[index]]['ipv4mask'][dut_index|int] }} - - - -{% if 'port-channel' in vm_topo_config['vm'][vms[index]]['ip_intf'][dut_index|int]|lower %} - PortChannel{{ ((index+1) |string).zfill(4) }} -{% else %} - {{ front_panel_asic_ifnames[vm_topo_config['vm'][vms[index]]['interface_indexes'][dut_index|int][0]] }} -{% endif %} - {{ vm_topo_config['vm'][vms[index]]['bgp_ipv6'][dut_index|int] }}/{{ vm_topo_config['vm'][vms[index]]['ipv6mask'][dut_index|int] }} - -{% endif %} -{% endif %} -{% endfor %} - - - - - SNMP_ACL - SNMP - SNMP - - - ERSPAN - Everflow - Everflow - - - ERSPANV6 - EverflowV6 - EverflowV6 - - - VTY_LINE - ssh-only - SSH - - - -{%- set acl_intfs = [] -%} -{%- 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) %} -{{- acl_intfs.append(a_intf) -}} -{% endif %} -{% endif %} -{% 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 -%} -{{- acl_intfs|join(';') -}} - - DataAcl - DataPlane - - - - - -{% endfor %} -{% endif %} -{% if switch_type is defined and switch_type == 'fabric' %} -{% for asic in fabric_info %} - - - - - HostIP - Loopback0 - - {{ asic['ip_prefix'] }} - - {{ asic['ip_prefix'] }} - - - HostIP - Loopback0 - - {{ asic['ip6_prefix'] }} - - {{ asic['ip6_prefix'] }} - - - - - - - - {{ asic['asicname'] }} - - - - - - - - -{% endfor %} -{% endif %} - - diff --git a/ansible/templates/minigraph_meta.j2 b/ansible/templates/minigraph_meta.j2 index 3fe782e7fb0..af7a916fee7 100644 --- a/ansible/templates/minigraph_meta.j2 +++ b/ansible/templates/minigraph_meta.j2 @@ -91,7 +91,7 @@ {{ erspan_dest_str }} {% endif %} -{% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} +{% if switch_type is defined and switch_type == 'voq' %} SwitchType @@ -100,8 +100,8 @@ SwitchId - {{ switchids[0] }} - + {{ start_switchid }} + {% endif %} {% if max_cores is defined %} @@ -112,38 +112,7 @@ {% endif %} -{% 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_name }} - - - SubRole - - FrontEnd - - - SwitchType - - {{ switch_type }} - - - SwitchId - - {{ switchids[asic_index] }} - -{% if max_cores is defined %} - - MaxCores - - {{ max_cores }} - - -{% endif %} - -{% endfor %} -{% endif %} +{% set idx = 0 %} {% for asic in asic_topo_config %} {{ asic }} @@ -176,6 +145,7 @@ {% endif %} {% endfor %} + {% for asic in fabric_info %} {{ asic['asicname'] }} @@ -190,14 +160,10 @@ Fabric - - SwitchId - - {{ switchids[asic['asic_id']] }} - {% endfor %} + diff --git a/ansible/templates/minigraph_png.j2 b/ansible/templates/minigraph_png.j2 index 74646a22031..732c3549755 100644 --- a/ansible/templates/minigraph_png.j2 +++ b/ansible/templates/minigraph_png.j2 @@ -73,10 +73,9 @@ {% endfor %} {% endfor %} {% for asic_intf in front_panel_asic_ifnames %} -{% if port_alias[loop.index - 1] in device_conn[inventory_hostname] %} DeviceInterfaceLink - {{ port_speed[port_alias[loop.index - 1]] }} + 40000 true {{ asic_intf.split('-')[1] }} {{ asic_intf }} @@ -85,7 +84,6 @@ {{ port_alias[loop.index - 1] }} true -{% endif %} {% endfor %} {% endif %} @@ -219,15 +217,6 @@ 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 }} - -{% endfor %} -{% endif %} {% for asic in fabric_info %} {{ asic['asicname'] }} diff --git a/tests/bgp/test_bgp_fact.py b/tests/bgp/test_bgp_fact.py index 4b5a356174f..e477ed0197c 100644 --- a/tests/bgp/test_bgp_fact.py +++ b/tests/bgp/test_bgp_fact.py @@ -5,11 +5,14 @@ pytest.mark.device_type('vs') ] - -def test_bgp_facts(duthosts, enum_frontend_dut_hostname, enum_asic_index): +def test_bgp_facts(duthosts, enum_dut_hostname, enum_asic_index): """compare the bgp facts between observed states and target state""" - duthost = duthosts[enum_frontend_dut_hostname] + duthost = duthosts[enum_dut_hostname] + + # Check if duthost is 'supervisor' card, and skip the test if dealing with supervisor card. + if duthost.is_supervisor_node(): + pytest.skip("bgp_facts not valid on supervisor card '%s'" % enum_dut_hostname) bgp_facts = duthost.bgp_facts(instance_id=enum_asic_index)['ansible_facts'] namespace = duthost.get_namespace_from_asic_id(enum_asic_index) @@ -29,8 +32,6 @@ def test_bgp_facts(duthosts, enum_frontend_dut_hostname, enum_asic_index): nbrs_in_cfg_facts = {} nbrs_in_cfg_facts.update(config_facts.get('BGP_NEIGHBOR', {})) nbrs_in_cfg_facts.update(config_facts.get('BGP_INTERNAL_NEIGHBOR', {})) - # In VoQ Chassis, we would have BGP_VOQ_CHASSIS_NEIGHBOR as well. - nbrs_in_cfg_facts.update(config_facts.get('BGP_VOQ_CHASSIS_NEIGHBOR', {})) for k, v in nbrs_in_cfg_facts.items(): # Compare the bgp neighbors name with config db bgp neighbors name assert v['name'] == bgp_facts['bgp_neighbors'][k]['description']