From b73e53c8b5066ffc3590e4cc1e20bc62848a3c8b Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Wed, 5 Aug 2026 23:49:12 +0000 Subject: [PATCH] [DMA] add UMA and LMA min topo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pull request introduces two new management network topologies—UMA and LMA—by adding their variable files and corresponding Jinja2 templates for both core and leaf devices. The templates support both converged (multi-VRF) and non-converged topologies, and implement detailed device and interface configuration logic, including BGP, interface, and management settings. The most important changes are: **New Topology Variable Files:** * Added `topo_uma.yml` and `topo_lma.yml` with detailed definitions for VMs, DUT loopbacks, configuration properties, and per-device interface and BGP settings. These files describe the network layout and parameters for the UMA and LMA topologies. [[1]](diffhunk://#diff-6c62217aa4f542511305184bcb15edff194ad36c6ca10004dd26499681086d94R1-R188) [[2]](diffhunk://#diff-59d77ba3a090eac1424251402f846ff5a9613353f913e5dc6cc00020776663b3R1-R193) **Jinja2 Templates for Device Configuration:** * Added `lma-core.j2`, `lma-leaf.j2`, `uma-core.j2`, and `uma-leaf.j2` templates. These templates generate EOS device configurations for core and leaf roles, handling both standard and converged (multi-VRF) topologies. [[1]](diffhunk://#diff-c56d28e02d004dab9f9b9143c107d620df6dc9f23ff6a3da911320cd182e7f54R1-R173) [[2]](diffhunk://#diff-f344f679ecf3f9b89bdb19fe180c632905765b1224f0ce5f370d5c9fb2251500R1-R160) **Support for Converged Topologies:** * All templates check for multi-VRF (converged) topologies and include a shared converged configuration (`ceos_converged.j2`) when appropriate, ensuring flexibility and reusability. [[1]](diffhunk://#diff-c56d28e02d004dab9f9b9143c107d620df6dc9f23ff6a3da911320cd182e7f54R1-R173) [[2]](diffhunk://#diff-f344f679ecf3f9b89bdb19fe180c632905765b1224f0ce5f370d5c9fb2251500R1-R160) **Device and Interface Configuration Logic:** * The templates implement logic for management VRF, interface addressing, BGP configuration (including confederations and peerings), MACsec support, and interface attributes such as MTU and LACP. [[1]](diffhunk://#diff-c56d28e02d004dab9f9b9143c107d620df6dc9f23ff6a3da911320cd182e7f54R1-R173) [[2]](diffhunk://#diff-f344f679ecf3f9b89bdb19fe180c632905765b1224f0ce5f370d5c9fb2251500R1-R160) **BGP Neighbor Handling Enhancements:** * In leaf templates, BGP neighbors are configured with `allowas-in` and other peer-specific settings to support advanced routing scenarios. These changes collectively enable automated, flexible generation of EOS configurations for new UMA and LMA management network topologies. Please provide following information to help code review process a bit easier: --> ### Description of PR Summary: Fixes # (issue) ### Type of change - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [ ] 202512 - [ ] 202605 Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): Failure type: ### Tested branch - [ ] master - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [ ] 202512 - [ ] 202605 - [ ] N/A ### Test result ### Approach #### What is the motivation for this PR? #### How did you do it? #### How did you verify/test it? #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation Signed-off-by: Sonic Build Admin --- ansible/roles/eos/templates/lma-core.j2 | 173 +++++++++++++++++++++ ansible/roles/eos/templates/lma-leaf.j2 | 160 ++++++++++++++++++++ ansible/roles/eos/templates/uma-core.j2 | 173 +++++++++++++++++++++ ansible/roles/eos/templates/uma-leaf.j2 | 160 ++++++++++++++++++++ ansible/vars/topo_lma.yml | 193 ++++++++++++++++++++++++ ansible/vars/topo_uma.yml | 193 ++++++++++++++++++++++++ 6 files changed, 1052 insertions(+) create mode 100644 ansible/roles/eos/templates/lma-core.j2 create mode 100644 ansible/roles/eos/templates/lma-leaf.j2 create mode 100644 ansible/roles/eos/templates/uma-core.j2 create mode 100644 ansible/roles/eos/templates/uma-leaf.j2 create mode 100644 ansible/vars/topo_lma.yml create mode 100644 ansible/vars/topo_uma.yml diff --git a/ansible/roles/eos/templates/lma-core.j2 b/ansible/roles/eos/templates/lma-core.j2 new file mode 100644 index 0000000000..67cb923fb6 --- /dev/null +++ b/ansible/roles/eos/templates/lma-core.j2 @@ -0,0 +1,173 @@ +{# Converged (multi-VRF) topologies render the shared converged config; the + stock body below is used unchanged on non-converged topologies. #} +{% if topo_is_multi_vrf | default(false) | bool %} +{% include 'ceos_converged.j2' %} +{% else %} +{% set host = configuration[hostname] %} +{% set mgmt_ip = ansible_host %} +{% if vm_type is defined and vm_type == "ceos" %} +{% set mgmt_if_index = 0 %} +{% else %} +{% set mgmt_if_index = 1 %} +{% endif %} +no schedule tech-support +! +{% if vm_type is defined and vm_type == "ceos" %} +agent LicenseManager shutdown +agent PowerFuse shutdown +agent PowerManager shutdown +agent Thermostat shutdown +agent LedPolicy shutdown +agent StandbyCpld shutdown +agent Bfd shutdown +{% endif %} +! +hostname {{ hostname }} +! +vrf definition MGMT + rd 1:1 +! +spanning-tree mode mstp +! +aaa root secret 0 123456 +! +username admin privilege 15 role network-admin secret 0 123456 +! +clock timezone UTC +! +lldp run +lldp management-address Management{{ mgmt_if_index }} +lldp management-address vrf MGMT +! +snmp-server community {{ snmp_rocommunity }} ro +snmp-server vrf MGMT +! +ip routing +ip routing vrf MGMT +ipv6 unicast-routing +! +{% if disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%} +{% elif vm_mgmt_gw is defined %} +ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }} +{% else %} +ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }} +{% endif %} +! +interface Management {{ mgmt_if_index }} + description TO LAB MGMT SWITCH +{% if vm_type is defined and vm_type == "ceos" %} + vrf MGMT +{% else %} + vrf forwarding MGMT +{% endif %} + ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }} + no shutdown +! +{% if enable_macsec is defined %} +mac security + profile {{ profile.macsec_profile }} + cipher {{ profile.cipher_suite }} + key {{ profile.primary_ckn }} 7 {{ profile.primary_cak }} + traffic unprotected drop + sci +{% endif %} +! +{% set ns = namespace(po_mbr_cnt=0) %} +{% for name, iface in host['interfaces'].items() %} +{% if name.startswith('Ethernet') %} +{% set ns.po_mbr_cnt = ns.po_mbr_cnt + 1 %} +{% endif %} +{% endfor %} + +{% for name, iface in host['interfaces'].items() %} +interface {{ name }} +{% if name.startswith('Loopback') %} + description LOOPBACK +{% else %} + mtu 9214 + no switchport +{% endif %} +{% if name.startswith('Port-Channel') %} +{% set min_links = (ns.po_mbr_cnt * 0.75) | round(0, 'ceil') | int %} + port-channel min-links {{ min_links }} +{% else %} +{% if enable_macsec is defined %} + mac security profile {{ profile.macsec_profile }} +{% endif %} +{% endif %} +{% if iface['lacp'] is defined %} + channel-group {{ iface['lacp'] }} mode active + lacp rate normal +{% endif %} +{% if iface['ipv4'] is defined %} + ip address {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ iface['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +{% endfor %} +! +interface {{ bp_ifname }} + description backplane + no switchport +{% if host['bp_interface']['ipv4'] is defined %} + ip address {{ host['bp_interface']['ipv4'] }} +{% endif %} +{% if host['bp_interface']['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ host['bp_interface']['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +router bgp {{ host['bgp']['asn'] }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} + ! +{% if host['bgp']['confed_asn'] is defined and host['bgp']['confed_peers'] is defined %} + bgp confederation identifier {{ host['bgp']['confed_asn'] }} + bgp confederation peers {{ host['bgp']['confed_peers'] }} + ! +{% endif %} +{% for asn, remote_ips in host['bgp']['peers'].items() %} +{% for remote_ip in remote_ips %} + neighbor {{ remote_ip }} remote-as {{ asn }} + neighbor {{ remote_ip }} maximum-routes 0 + neighbor {{ remote_ip }} description {{ asn }} + neighbor {{ remote_ip }} next-hop-self +{% if remote_ip | ansible.utils.ipv6 %} + address-family ipv6 + neighbor {{ remote_ip }} activate + exit +{% endif %} +{% endfor %} +{% endfor %} + neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv4 }} maximum-routes 0 + neighbor {{ props.nhipv4 }} description exabgp_v4 + neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv6 }} maximum-routes 0 + neighbor {{ props.nhipv6 }} description exabgp_v6 + address-family ipv6 + neighbor {{ props.nhipv6 }} activate + exit + ! +{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %} +{% if iface['ipv4'] is defined %} + network {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + network {{ iface['ipv6'] }} +{% endif %} +{% endfor %} +! +management api http-commands + no protocol https + protocol http + no shutdown +! +end +{% endif %} diff --git a/ansible/roles/eos/templates/lma-leaf.j2 b/ansible/roles/eos/templates/lma-leaf.j2 new file mode 100644 index 0000000000..8152a70a09 --- /dev/null +++ b/ansible/roles/eos/templates/lma-leaf.j2 @@ -0,0 +1,160 @@ +{# Converged (multi-VRF) topologies render the shared converged config; the + stock body below is used unchanged on non-converged topologies. #} +{% if topo_is_multi_vrf | default(false) | bool %} +{% include 'ceos_converged.j2' %} +{% else %} +{% set host = configuration[hostname] %} +{% set mgmt_ip = ansible_host %} +{% if vm_type is defined and vm_type == "ceos" %} +{% set mgmt_if_index = 0 %} +{% else %} +{% set mgmt_if_index = 1 %} +{% endif %} +no schedule tech-support +! +{% if vm_type is defined and vm_type == "ceos" %} +agent LicenseManager shutdown +agent PowerFuse shutdown +agent PowerManager shutdown +agent Thermostat shutdown +agent LedPolicy shutdown +agent StandbyCpld shutdown +agent Bfd shutdown +{% endif %} +! +hostname {{ hostname }} +! +vrf definition MGMT + rd 1:1 +! +spanning-tree mode mstp +! +aaa root secret 0 123456 +! +username admin privilege 15 role network-admin secret 0 123456 +! +clock timezone UTC +! +lldp run +lldp management-address Management{{ mgmt_if_index }} +lldp management-address vrf MGMT +! +snmp-server community {{ snmp_rocommunity }} ro +snmp-server vrf MGMT +! +ip routing +ip routing vrf MGMT +ipv6 unicast-routing +! +{% if disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%} +{% elif vm_mgmt_gw is defined %} +ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }} +{% else %} +ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }} +{% endif %} +! +interface Management {{ mgmt_if_index }} + description TO LAB MGMT SWITCH +{% if vm_type is defined and vm_type == "ceos" %} + vrf MGMT +{% else %} + vrf forwarding MGMT +{% endif %} + ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }} + no shutdown +! +{% set ns = namespace(po_mbr_cnt=0) %} +{% for name, iface in host['interfaces'].items() %} +{% if name.startswith('Ethernet') %} +{% set ns.po_mbr_cnt = ns.po_mbr_cnt + 1 %} +{% endif %} +{% endfor %} + +{% for name, iface in host['interfaces'].items() %} +interface {{ name }} +{% if name.startswith('Loopback') %} + description LOOPBACK +{% else %} + mtu 9214 + no switchport +{% endif %} +{% if name.startswith('Port-Channel') %} +{% set min_links = (ns.po_mbr_cnt * 0.75) | round(0, 'ceil') | int %} + port-channel min-links {{ min_links }} +{% endif %} +{% if iface['lacp'] is defined %} + channel-group {{ iface['lacp'] }} mode active + lacp rate normal +{% endif %} +{% if iface['ipv4'] is defined %} + ip address {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ iface['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +{% endfor %} +! +interface {{ bp_ifname }} + description backplane + no switchport +{% if host['bp_interface']['ipv4'] is defined %} + ip address {{ host['bp_interface']['ipv4'] }} +{% endif %} +{% if host['bp_interface']['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ host['bp_interface']['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +router bgp {{ host['bgp']['asn'] }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} + ! +{% if host['bgp']['confed_asn'] is defined and host['bgp']['confed_peers'] is defined %} + bgp confederation identifier {{ host['bgp']['confed_asn'] }} + bgp confederation peers {{ host['bgp']['confed_peers'] }} + ! + {% endif %} + +{% for asn, remote_ips in host['bgp']['peers'].items() %} +{% for remote_ip in remote_ips %} + neighbor {{ remote_ip }} remote-as {{ asn }} + neighbor {{ remote_ip }} maximum-routes 0 + neighbor {{ remote_ip }} description {{ asn }} + neighbor {{ remote_ip }} allowas-in + neighbor {{ remote_ip }} next-hop-self +{% if remote_ip | ansible.utils.ipv6 %} + address-family ipv6 + neighbor {{ remote_ip }} activate + exit +{% endif %} +{% endfor %} +{% endfor %} + neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv4 }} description exabgp_v4 + neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv6 }} description exabgp_v6 + address-family ipv6 + neighbor {{ props.nhipv6 }} activate + exit + ! +{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %} +{% if iface['ipv4'] is defined %} + network {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + network {{ iface['ipv6'] }} +{% endif %} +{% endfor %} +! +management api http-commands + no protocol https + protocol http + no shutdown +! +end +{% endif %} diff --git a/ansible/roles/eos/templates/uma-core.j2 b/ansible/roles/eos/templates/uma-core.j2 new file mode 100644 index 0000000000..67cb923fb6 --- /dev/null +++ b/ansible/roles/eos/templates/uma-core.j2 @@ -0,0 +1,173 @@ +{# Converged (multi-VRF) topologies render the shared converged config; the + stock body below is used unchanged on non-converged topologies. #} +{% if topo_is_multi_vrf | default(false) | bool %} +{% include 'ceos_converged.j2' %} +{% else %} +{% set host = configuration[hostname] %} +{% set mgmt_ip = ansible_host %} +{% if vm_type is defined and vm_type == "ceos" %} +{% set mgmt_if_index = 0 %} +{% else %} +{% set mgmt_if_index = 1 %} +{% endif %} +no schedule tech-support +! +{% if vm_type is defined and vm_type == "ceos" %} +agent LicenseManager shutdown +agent PowerFuse shutdown +agent PowerManager shutdown +agent Thermostat shutdown +agent LedPolicy shutdown +agent StandbyCpld shutdown +agent Bfd shutdown +{% endif %} +! +hostname {{ hostname }} +! +vrf definition MGMT + rd 1:1 +! +spanning-tree mode mstp +! +aaa root secret 0 123456 +! +username admin privilege 15 role network-admin secret 0 123456 +! +clock timezone UTC +! +lldp run +lldp management-address Management{{ mgmt_if_index }} +lldp management-address vrf MGMT +! +snmp-server community {{ snmp_rocommunity }} ro +snmp-server vrf MGMT +! +ip routing +ip routing vrf MGMT +ipv6 unicast-routing +! +{% if disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%} +{% elif vm_mgmt_gw is defined %} +ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }} +{% else %} +ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }} +{% endif %} +! +interface Management {{ mgmt_if_index }} + description TO LAB MGMT SWITCH +{% if vm_type is defined and vm_type == "ceos" %} + vrf MGMT +{% else %} + vrf forwarding MGMT +{% endif %} + ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }} + no shutdown +! +{% if enable_macsec is defined %} +mac security + profile {{ profile.macsec_profile }} + cipher {{ profile.cipher_suite }} + key {{ profile.primary_ckn }} 7 {{ profile.primary_cak }} + traffic unprotected drop + sci +{% endif %} +! +{% set ns = namespace(po_mbr_cnt=0) %} +{% for name, iface in host['interfaces'].items() %} +{% if name.startswith('Ethernet') %} +{% set ns.po_mbr_cnt = ns.po_mbr_cnt + 1 %} +{% endif %} +{% endfor %} + +{% for name, iface in host['interfaces'].items() %} +interface {{ name }} +{% if name.startswith('Loopback') %} + description LOOPBACK +{% else %} + mtu 9214 + no switchport +{% endif %} +{% if name.startswith('Port-Channel') %} +{% set min_links = (ns.po_mbr_cnt * 0.75) | round(0, 'ceil') | int %} + port-channel min-links {{ min_links }} +{% else %} +{% if enable_macsec is defined %} + mac security profile {{ profile.macsec_profile }} +{% endif %} +{% endif %} +{% if iface['lacp'] is defined %} + channel-group {{ iface['lacp'] }} mode active + lacp rate normal +{% endif %} +{% if iface['ipv4'] is defined %} + ip address {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ iface['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +{% endfor %} +! +interface {{ bp_ifname }} + description backplane + no switchport +{% if host['bp_interface']['ipv4'] is defined %} + ip address {{ host['bp_interface']['ipv4'] }} +{% endif %} +{% if host['bp_interface']['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ host['bp_interface']['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +router bgp {{ host['bgp']['asn'] }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} + ! +{% if host['bgp']['confed_asn'] is defined and host['bgp']['confed_peers'] is defined %} + bgp confederation identifier {{ host['bgp']['confed_asn'] }} + bgp confederation peers {{ host['bgp']['confed_peers'] }} + ! +{% endif %} +{% for asn, remote_ips in host['bgp']['peers'].items() %} +{% for remote_ip in remote_ips %} + neighbor {{ remote_ip }} remote-as {{ asn }} + neighbor {{ remote_ip }} maximum-routes 0 + neighbor {{ remote_ip }} description {{ asn }} + neighbor {{ remote_ip }} next-hop-self +{% if remote_ip | ansible.utils.ipv6 %} + address-family ipv6 + neighbor {{ remote_ip }} activate + exit +{% endif %} +{% endfor %} +{% endfor %} + neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv4 }} maximum-routes 0 + neighbor {{ props.nhipv4 }} description exabgp_v4 + neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv6 }} maximum-routes 0 + neighbor {{ props.nhipv6 }} description exabgp_v6 + address-family ipv6 + neighbor {{ props.nhipv6 }} activate + exit + ! +{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %} +{% if iface['ipv4'] is defined %} + network {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + network {{ iface['ipv6'] }} +{% endif %} +{% endfor %} +! +management api http-commands + no protocol https + protocol http + no shutdown +! +end +{% endif %} diff --git a/ansible/roles/eos/templates/uma-leaf.j2 b/ansible/roles/eos/templates/uma-leaf.j2 new file mode 100644 index 0000000000..8152a70a09 --- /dev/null +++ b/ansible/roles/eos/templates/uma-leaf.j2 @@ -0,0 +1,160 @@ +{# Converged (multi-VRF) topologies render the shared converged config; the + stock body below is used unchanged on non-converged topologies. #} +{% if topo_is_multi_vrf | default(false) | bool %} +{% include 'ceos_converged.j2' %} +{% else %} +{% set host = configuration[hostname] %} +{% set mgmt_ip = ansible_host %} +{% if vm_type is defined and vm_type == "ceos" %} +{% set mgmt_if_index = 0 %} +{% else %} +{% set mgmt_if_index = 1 %} +{% endif %} +no schedule tech-support +! +{% if vm_type is defined and vm_type == "ceos" %} +agent LicenseManager shutdown +agent PowerFuse shutdown +agent PowerManager shutdown +agent Thermostat shutdown +agent LedPolicy shutdown +agent StandbyCpld shutdown +agent Bfd shutdown +{% endif %} +! +hostname {{ hostname }} +! +vrf definition MGMT + rd 1:1 +! +spanning-tree mode mstp +! +aaa root secret 0 123456 +! +username admin privilege 15 role network-admin secret 0 123456 +! +clock timezone UTC +! +lldp run +lldp management-address Management{{ mgmt_if_index }} +lldp management-address vrf MGMT +! +snmp-server community {{ snmp_rocommunity }} ro +snmp-server vrf MGMT +! +ip routing +ip routing vrf MGMT +ipv6 unicast-routing +! +{% if disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%} +{% elif vm_mgmt_gw is defined %} +ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }} +{% else %} +ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }} +{% endif %} +! +interface Management {{ mgmt_if_index }} + description TO LAB MGMT SWITCH +{% if vm_type is defined and vm_type == "ceos" %} + vrf MGMT +{% else %} + vrf forwarding MGMT +{% endif %} + ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }} + no shutdown +! +{% set ns = namespace(po_mbr_cnt=0) %} +{% for name, iface in host['interfaces'].items() %} +{% if name.startswith('Ethernet') %} +{% set ns.po_mbr_cnt = ns.po_mbr_cnt + 1 %} +{% endif %} +{% endfor %} + +{% for name, iface in host['interfaces'].items() %} +interface {{ name }} +{% if name.startswith('Loopback') %} + description LOOPBACK +{% else %} + mtu 9214 + no switchport +{% endif %} +{% if name.startswith('Port-Channel') %} +{% set min_links = (ns.po_mbr_cnt * 0.75) | round(0, 'ceil') | int %} + port-channel min-links {{ min_links }} +{% endif %} +{% if iface['lacp'] is defined %} + channel-group {{ iface['lacp'] }} mode active + lacp rate normal +{% endif %} +{% if iface['ipv4'] is defined %} + ip address {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ iface['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +{% endfor %} +! +interface {{ bp_ifname }} + description backplane + no switchport +{% if host['bp_interface']['ipv4'] is defined %} + ip address {{ host['bp_interface']['ipv4'] }} +{% endif %} +{% if host['bp_interface']['ipv6'] is defined %} + ipv6 enable + ipv6 address {{ host['bp_interface']['ipv6'] }} + ipv6 nd ra suppress +{% endif %} + no shutdown +! +router bgp {{ host['bgp']['asn'] }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} + ! +{% if host['bgp']['confed_asn'] is defined and host['bgp']['confed_peers'] is defined %} + bgp confederation identifier {{ host['bgp']['confed_asn'] }} + bgp confederation peers {{ host['bgp']['confed_peers'] }} + ! + {% endif %} + +{% for asn, remote_ips in host['bgp']['peers'].items() %} +{% for remote_ip in remote_ips %} + neighbor {{ remote_ip }} remote-as {{ asn }} + neighbor {{ remote_ip }} maximum-routes 0 + neighbor {{ remote_ip }} description {{ asn }} + neighbor {{ remote_ip }} allowas-in + neighbor {{ remote_ip }} next-hop-self +{% if remote_ip | ansible.utils.ipv6 %} + address-family ipv6 + neighbor {{ remote_ip }} activate + exit +{% endif %} +{% endfor %} +{% endfor %} + neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv4 }} description exabgp_v4 + neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv6 }} description exabgp_v6 + address-family ipv6 + neighbor {{ props.nhipv6 }} activate + exit + ! +{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %} +{% if iface['ipv4'] is defined %} + network {{ iface['ipv4'] }} +{% endif %} +{% if iface['ipv6'] is defined %} + network {{ iface['ipv6'] }} +{% endif %} +{% endfor %} +! +management api http-commands + no protocol https + protocol http + no shutdown +! +end +{% endif %} diff --git a/ansible/vars/topo_lma.yml b/ansible/vars/topo_lma.yml new file mode 100644 index 0000000000..44ed0bfc67 --- /dev/null +++ b/ansible/vars/topo_lma.yml @@ -0,0 +1,193 @@ +topology: + VMs: + VM01UMA: + vlans: + - 0 + vm_offset: 0 + VM02UMA: + vlans: + - 1 + vm_offset: 1 + VM03M2: + vlans: + - 2 + vm_offset: 2 + VM04M2: + vlans: + - 3 + vm_offset: 3 + VM05M3: + vlans: + - 4 + vm_offset: 4 + VM06M3: + vlans: + - 5 + vm_offset: 5 + + DUT: + loopback: + ipv4: + - 10.1.0.1/32 + ipv6: + - fc00:10::1/128 + +configuration_properties: + common: + podset_number: 400 + tor_number: 16 + tor_subnet_number: 8 + max_tor_subnet_number: 32 + tor_subnet_size: 128 + dut_asn: 64589 + dut_confed_asn: 64582 + dut_confed_peers: 64588 + dut_type: LowerMgmtAggregator + nhipv4: 10.10.246.254 + nhipv6: fc0a::ff + core: + swrole: core + device_type: UpperMgmtAggregator + leaf: + swrole: leaf + m2: + swrole: leaf + device_type: MgmtSpineRouter + m3: + swrole: leaf + device_type: MgmtAccessRouter + +configuration: + VM01UMA: + properties: + - common + - core + bgp: + asn: 64588 + confed_asn: 64582 + confed_peers: 64589 + peers: + 64589: + - 10.0.0.0 + - fc00::1 + interfaces: + Loopback0: + ipv4: 100.1.0.1/32 + ipv6: 2064:100::1/128 + Ethernet1: + ipv4: 10.0.0.1/31 + ipv6: fc00::2/126 + bp_interface: + ipv4: 10.10.246.1/24 + ipv6: fc0a::2/64 + + VM02UMA: + properties: + - common + - core + bgp: + asn: 64588 + confed_asn: 64582 + confed_peers: 64589 + peers: + 64589: + - 10.0.0.2 + - fc00::5 + interfaces: + Loopback0: + ipv4: 100.1.0.2/32 + ipv6: 2064:100::2/128 + Ethernet1: + ipv4: 10.0.0.3/31 + ipv6: fc00::6/126 + bp_interface: + ipv4: 10.10.246.2/24 + ipv6: fc0a::3/64 + + VM03M2: + properties: + - common + - m2 + bgp: + peer_in_bgp_confed: true + asn: 65300 + peers: + 64582: + - 10.0.0.136 + - fc00::111 + interfaces: + Loopback0: + ipv4: 100.1.0.69/32 + ipv6: 2064:100::45/128 + Ethernet1: + ipv4: 10.0.0.137/31 + ipv6: fc00::112/126 + bp_interface: + ipv4: 10.10.246.69/24 + ipv6: fc0a::46/64 + + VM04M2: + properties: + - common + - m2 + bgp: + peer_in_bgp_confed: true + asn: 65300 + peers: + 64582: + - 10.0.0.138 + - fc00::115 + interfaces: + Loopback0: + ipv4: 100.1.0.70/32 + ipv6: 2064:100::46/128 + Ethernet1: + ipv4: 10.0.0.139/31 + ipv6: fc00::116/126 + bp_interface: + ipv4: 10.10.246.70/24 + ipv6: fc0a::47/64 + + VM05M3: + properties: + - common + - m3 + bgp: + peer_in_bgp_confed: true + asn: 65300 + peers: + 64582: + - 10.0.0.140 + - fc00::119 + interfaces: + Loopback0: + ipv4: 100.1.0.71/32 + ipv6: 2064:100::47/128 + Ethernet1: + ipv4: 10.0.0.141/31 + ipv6: fc00::11a/126 + bp_interface: + ipv4: 10.10.246.71/24 + ipv6: fc0a::48/64 + + VM06M3: + properties: + - common + - m3 + bgp: + peer_in_bgp_confed: true + asn: 65300 + peers: + 64582: + - 10.0.0.142 + - fc00::11d + interfaces: + Loopback0: + ipv4: 100.1.0.72/32 + ipv6: 2064:100::48/128 + Ethernet1: + ipv4: 10.0.0.143/31 + ipv6: fc00::11e/126 + bp_interface: + ipv4: 10.10.246.72/24 + ipv6: fc0a::49/64 diff --git a/ansible/vars/topo_uma.yml b/ansible/vars/topo_uma.yml new file mode 100644 index 0000000000..6404622bdc --- /dev/null +++ b/ansible/vars/topo_uma.yml @@ -0,0 +1,193 @@ +topology: + VMs: + VM01RWA: + vlans: + - 0 + vm_offset: 0 + VM02LMA: + vlans: + - 1 + vm_offset: 1 + VM03LMA: + vlans: + - 2 + vm_offset: 2 + VM04LMA: + vlans: + - 3 + vm_offset: 3 + VM05LMA: + vlans: + - 4 + vm_offset: 4 + VM06M1: + vlans: + - 5 + vm_offset: 5 + + DUT: + loopback: + ipv4: + - 10.1.0.1/32 + ipv6: + - fc00:10::1/128 + +configuration_properties: + common: + podset_number: 400 + tor_number: 16 + tor_subnet_number: 8 + max_tor_subnet_number: 32 + tor_subnet_size: 128 + dut_asn: 64588 + dut_confed_asn: 64582 + dut_confed_peers: 64589 + dut_type: UpperMgmtAggregator + nhipv4: 10.10.246.254 + nhipv6: fc0a::ff + core: + swrole: core + device_type: RegionalWANAggregator + lma: + swrole: leaf + device_type: LowerMgmtAggregator # VM02-05LMA (confed peers) + m1: + swrole: leaf + device_type: MgmtLeafRouter # VM06M1 (external downstream) + +configuration: + VM01RWA: + properties: + - common + - core + bgp: + peer_in_bgp_confed: true + asn: 65200 + peers: + 64582: + - 10.0.0.0 + - fc00::1 + interfaces: + Loopback0: + ipv4: 100.1.0.1/32 + ipv6: 2064:100::1/128 + Ethernet1: + ipv4: 10.0.0.1/31 + ipv6: fc00::2/126 + bp_interface: + ipv4: 10.10.246.1/24 + ipv6: fc0a::2/64 + + VM02LMA: + properties: + - common + - lma + bgp: + asn: 64589 + confed_asn: 64582 + confed_peers: 64588 + peers: + 64588: + - 10.0.0.136 + - fc00::111 + interfaces: + Loopback0: + ipv4: 100.1.0.69/32 + ipv6: 2064:100::45/128 + Ethernet1: + ipv4: 10.0.0.137/31 + ipv6: fc00::112/126 + bp_interface: + ipv4: 10.10.246.69/24 + ipv6: fc0a::46/64 + + VM03LMA: + properties: + - common + - lma + bgp: + asn: 64589 + confed_asn: 64582 + confed_peers: 64588 + peers: + 64588: + - 10.0.0.138 + - fc00::115 + interfaces: + Loopback0: + ipv4: 100.1.0.70/32 + ipv6: 2064:100::46/128 + Ethernet1: + ipv4: 10.0.0.139/31 + ipv6: fc00::116/126 + bp_interface: + ipv4: 10.10.246.70/24 + ipv6: fc0a::47/64 + + VM04LMA: + properties: + - common + - lma + bgp: + asn: 64589 + confed_asn: 64582 + confed_peers: 64588 + peers: + 64588: + - 10.0.0.140 + - fc00::119 + interfaces: + Loopback0: + ipv4: 100.1.0.71/32 + ipv6: 2064:100::47/128 + Ethernet1: + ipv4: 10.0.0.141/31 + ipv6: fc00::11a/126 + bp_interface: + ipv4: 10.10.246.71/24 + ipv6: fc0a::48/64 + + VM05LMA: + properties: + - common + - lma + bgp: + asn: 64589 + confed_asn: 64582 + confed_peers: 64588 + peers: + 64588: + - 10.0.0.142 + - fc00::11d + interfaces: + Loopback0: + ipv4: 100.1.0.72/32 + ipv6: 2064:100::48/128 + Ethernet1: + ipv4: 10.0.0.143/31 + ipv6: fc00::11e/126 + bp_interface: + ipv4: 10.10.246.72/24 + ipv6: fc0a::49/64 + + VM06M1: + properties: + - common + - m1 + bgp: + peer_in_bgp_confed: true + asn: 65300 + peers: + 64582: + - 10.0.0.144 + - fc00::121 + interfaces: + Loopback0: + ipv4: 100.1.0.73/32 + ipv6: 2064:100::49/128 + Ethernet1: + ipv4: 10.0.0.145/31 + ipv6: fc00::122/126 + bp_interface: + ipv4: 10.10.246.73/24 + ipv6: fc0a::4a/64