diff --git a/ansible/templates/minigraph_cpg.j2 b/ansible/templates/minigraph_cpg.j2 index 8e556071873..1f49ecb28b9 100644 --- a/ansible/templates/minigraph_cpg.j2 +++ b/ansible/templates/minigraph_cpg.j2 @@ -14,6 +14,18 @@ 10 3 +{% if vm_asic_ifnames is defined %} + + false + {{ vm_asic_ifnames[vm][0].split('-')[1] }} + {{ vm_topo_config['vm'][vm]['bgp_ipv4'][dut_index|int] }} + {{ vm }} + {{ vm_topo_config['vm'][vm]['peer_ipv4'][dut_index|int] }} + 1 + 10 + 3 + +{% endif %} {% endif %} {% if vm_topo_config['vm'][vm]['peer_ipv6'][dut_index|int] %} @@ -25,7 +37,45 @@ 10 3 +{% if vm_asic_ifnames is defined %} + + {{ vm_asic_ifnames[vm][0].split('-')[1] }} + {{ vm_topo_config['vm'][vm]['bgp_ipv6'][dut_index|int] }} + {{ vm }} + {{ vm_topo_config['vm'][vm]['peer_ipv6'][dut_index|int] }} + 1 + 10 + 3 + +{% 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] %} + + false + {{ asic }} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['bgp_ipv4'][0] }} + {{ neigh_asic }} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv4'][0] }} + 1 + 0 + 0 + +{% endif %} +{% if asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv6'][0] %} + + {{ asic }} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['bgp_ipv6'][0] }} + {{ neigh_asic }} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv6'][0] }} + 1 + 0 + 0 + {% endif %} +{% endfor %} {% endfor %} @@ -77,6 +127,35 @@ {% endif %} {% endfor %} {% endif %} +{% for asic in asic_topo_config %} + + {{ vm_topo_config['dut_asn'] }} + {{ asic }} + +{% for index in range( vms_number) %} +{% if vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %} + +
{{ vm_topo_config['vm'][vms[index]]['peer_ipv4'][dut_index|int] }}
+ + + +
+{% 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] %} + +
{{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['peer_ipv4'][0] }}
+ + + +
+{% endif %} +{% endfor %} +
+ +
+{% endfor %}
diff --git a/ansible/templates/minigraph_dpg.j2 b/ansible/templates/minigraph_dpg.j2 index cdd9074244c..68f4a204498 100644 --- a/ansible/templates/minigraph_dpg.j2 +++ b/ansible/templates/minigraph_dpg.j2 @@ -210,5 +210,6 @@ +{% include 'minigraph_dpg_asic.j2' %} diff --git a/ansible/templates/minigraph_dpg_asic.j2 b/ansible/templates/minigraph_dpg_asic.j2 new file mode 100644 index 00000000000..cef693288d2 --- /dev/null +++ b/ansible/templates/minigraph_dpg_asic.j2 @@ -0,0 +1,208 @@ +{% macro port_channel_id(asic_idx, neigh_asic_idx) -%} +{{ ((4000 + asic_idx + (10*neigh_asic_idx))|string) }} +{%- endmacro -%} +{% for asic in asic_topo_config %} +{% set asic_index = asic.split('ASIC')[1]|int %} + + + + + HostIP + Loopback0 + + {{ lp_ipv4 }} + + {{ lp_ipv4 }} + + + HostIP1 + Loopback0 + + {{ lp_ipv6 }} + + {{ lp_ipv6 }} + +{% for lo4096 in asic_topo_config[asic]['Loopback4096'] %} + + HostIP1 + Loopback4096 + + {{ lo4096 }} + + {{ lo4096 }} + +{% endfor %} + + + + 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 + + + + + + + {{ asic }} + +{% for index in range(vms_number) %} +{% if vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %} +{% 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 neigh_asic in asic_topo_config %} +{%- set pc_intfs = [] -%} +{%- if neigh_asic in asic_topo_config[asic]['neigh_asic'] and 'port-channel' in asic_topo_config[asic]['neigh_asic'][neigh_asic]['ip_intf'][0]|lower -%} +{%- for intf in asic_topo_config[asic]['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(4) }} + {{ port_channel_intf }} + + +{% endif %} +{% endfor %} + + + + +{% for index in range(vms_number) %} +{% if vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %} +{% 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 %} +{% for neigh_asic in asic_topo_config[asic]['neigh_asic'] %} + + +{%- if 'port-channel' in asic_topo_config[asic]['neigh_asic'][neigh_asic]['ip_intf'][0]|lower %} +{%- set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(4) }} +{% else %} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['asic_intfs'][0][0] }} +{% endif %} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['bgp_ipv4'][0] }}/{{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['ipv4mask'][0] }} + + + +{%- if 'port-channel' in asic_topo_config[asic]['neigh_asic'][neigh_asic]['ip_intf'][0]|lower %} +{%- set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} + PortChannel{{ port_channel_id(asic_index, neigh_asic_index).zfill(4) }} +{% else %} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['asic_intfs'][0][0] }} +{% endif %} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['bgp_ipv6'][0] }}/{{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['ipv6mask'][0] }} + +{% 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 vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %} +{% 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 neigh_asic in asic_topo_config %} +{% set neigh_asic_index = neigh_asic.split('ASIC')[1]|int %} +{%- if neigh_asic in asic_topo_config[asic]['neigh_asic'] and 'port-channel' in asic_topo_config[asic]['neigh_asic'][neigh_asic]['ip_intf'][0]|lower -%} +{% set a_intf = 'PortChannel' + port_channel_id(asic_index, neigh_asic_index).zfill(4) %} +{{- acl_intfs.append(a_intf) -}} +{% endif %} +{% endfor %} + +{%- for index in range(vms_number) -%} +{% if vm_asic_ifnames[vms[index]][0].split('-')[1] == asic %} +{% 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_topo_config -%} +{%- if neigh_asic in asic_topo_config[asic]['neigh_asic'] and 'port-channel' not in asic_topo_config[asic]['neigh_asic'][neigh_asic]['ip_intf'][0]|lower -%} +{% if asic_topo_config[asic]['neigh_asic'][neigh_asic]['intfs'][0]|length %} +{% set a_intf = asic_topo_config[asic]['neigh_asic'][neigh_asic]['asic_intfs'][0][0] %} +{{- acl_intfs.append(a_intf) -}} +{% endif %} +{% endif %} +{% endfor %} + +{{- acl_intfs|join(';') -}} + + DataAcl + DataPlane + + + + + +{% endfor %} + diff --git a/ansible/templates/minigraph_meta.j2 b/ansible/templates/minigraph_meta.j2 index 30a8c875cf6..a44ce45a16d 100644 --- a/ansible/templates/minigraph_meta.j2 +++ b/ansible/templates/minigraph_meta.j2 @@ -93,6 +93,18 @@ {% endif %} +{% for asic in asic_topo_config %} + + {{ asic }} + + + SubRole + + {{ asic_topo_config[asic]['asic_type'] }} + + + +{% endfor %} diff --git a/ansible/templates/minigraph_png.j2 b/ansible/templates/minigraph_png.j2 index 451638b50ad..128e8cae204 100644 --- a/ansible/templates/minigraph_png.j2 +++ b/ansible/templates/minigraph_png.j2 @@ -36,6 +36,36 @@ {% 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 %} + + DeviceInterfaceLink + 40000 + true + {{ neigh_asic }} + {{ intf }} + true + {{ asic }} + {{ asic_topo_config[asic]['neigh_asic'][neigh_asic]['asic_intfs'][0][loop.index-1] }} + true + +{% endfor %} +{% endfor %} +{% endfor %} +{% for asic_intf in front_panel_asic_ifnames %} + + DeviceInterfaceLink + 40000 + true + {{ asic_intf.split('-')[1] }} + {{ asic_intf }} + true + {{ inventory_hostname }} + {{ port_alias[loop.index - 1] }} + true + +{% endfor %} @@ -135,6 +165,33 @@ {% endif %} {% endfor %} {% endif %} +{% for asic in asic_topo_config %} + + Asic +
+ 0.0.0.0/0 +
+ + ::/0 + + + + + + + + + + 0.0.0.0/0 + + + ::/0 + + + {{ asic }} + Broadcom-Trident2 +
+{% endfor %}