diff --git a/ansible/config_sonic_basedon_testbed.yml b/ansible/config_sonic_basedon_testbed.yml index c035c6f7aea..3acb0fc6b19 100644 --- a/ansible/config_sonic_basedon_testbed.yml +++ b/ansible/config_sonic_basedon_testbed.yml @@ -235,6 +235,17 @@ - "ports" when: front_panel_asic_ifnames != [] + - block: + - name: Create new dictionary for my slot + set_fact: + new_asic_topo_config : "{{ new_asic_topo_config | default( { slot_num : asic_topo_config.slot0 }) }}" + + - name: set asic_topo_config to new dictionary + set_fact: + asic_topo_config: "{{ new_asic_topo_config }}" + + when: switch_type is defined and switch_type == 'voq' and slot_num is defined and asic_topo_config|length > 0 + - name: create minigraph file in ansible minigraph folder template: src=templates/minigraph_template.j2 dest=minigraph/{{ inventory_hostname}}.{{ topo }}.xml diff --git a/ansible/library/topo_facts.py b/ansible/library/topo_facts.py index 00462542b65..f0f055a8fb1 100644 --- a/ansible/library/topo_facts.py +++ b/ansible/library/topo_facts.py @@ -84,6 +84,8 @@ def __init__(self): def parse_topo_defintion(self, topo_definition, po_map, dut_num, neigh_type='VMs'): vmconfig = dict() + if topo_definition['topology'][neigh_type] is None: + return vmconfig for vm in topo_definition['topology'][neigh_type]: vmconfig[vm] = dict() vmconfig[vm]['intfs'] = [[] for i in range(dut_num)] @@ -105,7 +107,6 @@ 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 if 'configuration' in topo_definition: if 'interfaces' in topo_definition['configuration'][vm]: diff --git a/ansible/templates/minigraph_cpg.j2 b/ansible/templates/minigraph_cpg.j2 index ac5857e74f1..c26735d4437 100644 --- a/ansible/templates/minigraph_cpg.j2 +++ b/ansible/templates/minigraph_cpg.j2 @@ -1,4 +1,4 @@ - + {% if card_type is not defined or card_type != 'supervisor' %} @@ -216,6 +216,21 @@ {% endif %} {% endfor %} +{% if switch_type is defined and switch_type == 'voq' %} +{% set asic_id = asic.split('ASIC')[1]|int %} +{% 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] }}
+ + + +
+{% endif %} +{% endfor %} +{% endfor %} +{% else %} {% 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] %} @@ -226,56 +241,28 @@ {% endif %} {% endfor %} +{% endif %} {% endfor %} +{% endif %} {% 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_loopback4096[a_linecard]|length) %} {{ vm_topo_config['dut_asn'] }} +{% if switch_type == 'voq' %} + {{ chassis_ibgp_peers[all_inbands[a_linecard][idx].split('/')[0]] }} +{% else %} {{ chassis_ibgp_peers[all_loopback4096[a_linecard][idx].split('/')[0]] }} +{% endif %} {% 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_loopback4096 %} -{% for idx in range(all_loopback4096[a_linecard]|length) %} -{% if loopback4096_ip[asic_id] != all_loopback4096[a_linecard][idx] %} - -
{{ all_loopback4096[a_linecard][idx] }}
- - - -
-{% endif %} -{% endfor %} -{% endfor %} -
-
-{% endfor %} -{% endif %} -{% endif %} {% endif %} {% endif %} diff --git a/ansible/vars/topo_Nokia-IXR7250E-36x400G.yml b/ansible/vars/topo_Nokia-IXR7250E-36x400G.yml new file mode 100644 index 00000000000..a3a459c097c --- /dev/null +++ b/ansible/vars/topo_Nokia-IXR7250E-36x400G.yml @@ -0,0 +1,16 @@ +slot0: + ASIC0: + topology: + NEIGH_ASIC: + configuration_properties: + common: + asic_type: FrontEnd + configuration: + + ASIC1: + topology: + NEIGH_ASIC: + configuration_properties: + common: + asic_type: FrontEnd + configuration: