From cddc29e32e1d201de70608bdeac3aab820599746 Mon Sep 17 00:00:00 2001 From: Wenda Chu <32250288+w1nda@users.noreply.github.com> Date: Sun, 15 Jun 2025 00:58:37 +0800 Subject: [PATCH] [isolated-topology] Add ceos config template for PT0 in isolated topology (#18976) What is the motivation for this PR? In PR #18686, we set pt0 as role tor, however, there is no ceos template for it How did you do it? create the ceos templates for PT0 --- .../eos/templates/t0-isolated-d2u254s1-tor.j2 | 140 ++++++++++++++++++ .../eos/templates/t0-isolated-d2u254s2-tor.j2 | 1 + .../eos/templates/t0-isolated-d2u510s2-tor.j2 | 1 + 3 files changed, 142 insertions(+) create mode 100644 ansible/roles/eos/templates/t0-isolated-d2u254s1-tor.j2 create mode 120000 ansible/roles/eos/templates/t0-isolated-d2u254s2-tor.j2 create mode 120000 ansible/roles/eos/templates/t0-isolated-d2u510s2-tor.j2 diff --git a/ansible/roles/eos/templates/t0-isolated-d2u254s1-tor.j2 b/ansible/roles/eos/templates/t0-isolated-d2u254s1-tor.j2 new file mode 100644 index 00000000000..48793369bcc --- /dev/null +++ b/ansible/roles/eos/templates/t0-isolated-d2u254s1-tor.j2 @@ -0,0 +1,140 @@ +{% 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 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 +! +{% for name, iface in host['interfaces'].items() %} +interface {{ name }} +{% if name.startswith('Loopback') %} + description LOOPBACK +{% else %} + mtu 9214 + no switchport + no shutdown +{% 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 + no shutdown +{% 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['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + ! + graceful-restart restart-time {{ bgp_gr_timer }} + graceful-restart + ! +{% for asn, remote_ips in host['bgp']['peers'].items() %} +{% for remote_ip in remote_ips %} + router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + neighbor {{ remote_ip }} remote-as {{ asn }} + neighbor {{ remote_ip }} description {{ asn }} + neighbor {{ remote_ip }} next-hop-self +{% if remote_ip | ipv6 %} + address-family ipv6 + neighbor {{ remote_ip }} activate + exit +{% endif %} +{% endfor %} +{% endfor %} +{% if props.enable_ipv4_routes_generation is not defined or props.enable_ipv4_routes_generation %} + neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv4 }} description exabgp_v4 +{% endif %} +{% if props.enable_ipv6_routes_generation is not defined or props.enable_ipv6_routes_generation %} + neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }} + neighbor {{ props.nhipv6 }} description exabgp_v6 + address-family ipv6 + neighbor {{ props.nhipv6 }} activate + exit +{% endif %} + ! +{% 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 diff --git a/ansible/roles/eos/templates/t0-isolated-d2u254s2-tor.j2 b/ansible/roles/eos/templates/t0-isolated-d2u254s2-tor.j2 new file mode 120000 index 00000000000..7c2b08881bf --- /dev/null +++ b/ansible/roles/eos/templates/t0-isolated-d2u254s2-tor.j2 @@ -0,0 +1 @@ +t0-isolated-d2u254s1-tor.j2 \ No newline at end of file diff --git a/ansible/roles/eos/templates/t0-isolated-d2u510s2-tor.j2 b/ansible/roles/eos/templates/t0-isolated-d2u510s2-tor.j2 new file mode 120000 index 00000000000..7c2b08881bf --- /dev/null +++ b/ansible/roles/eos/templates/t0-isolated-d2u510s2-tor.j2 @@ -0,0 +1 @@ +t0-isolated-d2u254s1-tor.j2 \ No newline at end of file