Skip to content

Commit 5848de1

Browse files
w1ndagshemesh2
authored andcommitted
[isolated-topology] Add ceos config template for PT0 in isolated topology (sonic-net#18976)
What is the motivation for this PR? In PR sonic-net#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 Signed-off-by: Guy Shemesh <[email protected]>
1 parent c834cec commit 5848de1

3 files changed

Lines changed: 142 additions & 0 deletions

File tree

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
{% set host = configuration[hostname] %}
2+
{% set mgmt_ip = ansible_host %}
3+
{% if vm_type is defined and vm_type == "ceos" %}
4+
{% set mgmt_if_index = 0 %}
5+
{% else %}
6+
{% set mgmt_if_index = 1 %}
7+
{% endif %}
8+
no schedule tech-support
9+
!
10+
{% if vm_type is defined and vm_type == "ceos" %}
11+
agent LicenseManager shutdown
12+
agent PowerFuse shutdown
13+
agent PowerManager shutdown
14+
agent Thermostat shutdown
15+
agent LedPolicy shutdown
16+
agent StandbyCpld shutdown
17+
agent Bfd shutdown
18+
{% endif %}
19+
!
20+
hostname {{ hostname }}
21+
!
22+
vrf definition MGMT
23+
rd 1:1
24+
!
25+
spanning-tree mode mstp
26+
!
27+
aaa root secret 0 123456
28+
!
29+
username admin privilege 15 role network-admin secret 0 123456
30+
!
31+
clock timezone UTC
32+
!
33+
lldp run
34+
lldp management-address Management{{ mgmt_if_index }}
35+
lldp management-address vrf MGMT
36+
!
37+
snmp-server community {{ snmp_rocommunity }} ro
38+
snmp-server vrf MGMT
39+
!
40+
ip routing
41+
ip routing vrf MGMT
42+
ipv6 unicast-routing
43+
!
44+
{% if vm_mgmt_gw is defined %}
45+
ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }}
46+
{% else %}
47+
ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }}
48+
{% endif %}
49+
!
50+
interface Management {{ mgmt_if_index }}
51+
description TO LAB MGMT SWITCH
52+
{% if vm_type is defined and vm_type == "ceos" %}
53+
vrf MGMT
54+
{% else %}
55+
vrf forwarding MGMT
56+
{% endif %}
57+
ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }}
58+
no shutdown
59+
!
60+
{% for name, iface in host['interfaces'].items() %}
61+
interface {{ name }}
62+
{% if name.startswith('Loopback') %}
63+
description LOOPBACK
64+
{% else %}
65+
mtu 9214
66+
no switchport
67+
no shutdown
68+
{% endif %}
69+
{% if iface['ipv4'] is defined %}
70+
ip address {{ iface['ipv4'] }}
71+
{% endif %}
72+
{% if iface['ipv6'] is defined %}
73+
ipv6 enable
74+
ipv6 address {{ iface['ipv6'] }}
75+
ipv6 nd ra suppress
76+
{% endif %}
77+
no shutdown
78+
!
79+
{% endfor %}
80+
!
81+
interface {{ bp_ifname }}
82+
description backplane
83+
no switchport
84+
no shutdown
85+
{% if host['bp_interface']['ipv4'] is defined %}
86+
ip address {{ host['bp_interface']['ipv4'] }}
87+
{% endif %}
88+
{% if host['bp_interface']['ipv6'] is defined %}
89+
ipv6 enable
90+
ipv6 address {{ host['bp_interface']['ipv6'] }}
91+
ipv6 nd ra suppress
92+
{% endif %}
93+
no shutdown
94+
!
95+
router bgp {{ host['bgp']['asn'] }}
96+
router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }}
97+
!
98+
graceful-restart restart-time {{ bgp_gr_timer }}
99+
graceful-restart
100+
!
101+
{% for asn, remote_ips in host['bgp']['peers'].items() %}
102+
{% for remote_ip in remote_ips %}
103+
router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }}
104+
neighbor {{ remote_ip }} remote-as {{ asn }}
105+
neighbor {{ remote_ip }} description {{ asn }}
106+
neighbor {{ remote_ip }} next-hop-self
107+
{% if remote_ip | ipv6 %}
108+
address-family ipv6
109+
neighbor {{ remote_ip }} activate
110+
exit
111+
{% endif %}
112+
{% endfor %}
113+
{% endfor %}
114+
{% if props.enable_ipv4_routes_generation is not defined or props.enable_ipv4_routes_generation %}
115+
neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }}
116+
neighbor {{ props.nhipv4 }} description exabgp_v4
117+
{% endif %}
118+
{% if props.enable_ipv6_routes_generation is not defined or props.enable_ipv6_routes_generation %}
119+
neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }}
120+
neighbor {{ props.nhipv6 }} description exabgp_v6
121+
address-family ipv6
122+
neighbor {{ props.nhipv6 }} activate
123+
exit
124+
{% endif %}
125+
!
126+
{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %}
127+
{% if iface['ipv4'] is defined %}
128+
network {{ iface['ipv4'] }}
129+
{% endif %}
130+
{% if iface['ipv6'] is defined %}
131+
network {{ iface['ipv6'] }}
132+
{% endif %}
133+
{% endfor %}
134+
!
135+
management api http-commands
136+
no protocol https
137+
protocol http
138+
no shutdown
139+
!
140+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t0-isolated-d2u254s1-tor.j2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t0-isolated-d2u254s1-tor.j2

0 commit comments

Comments
 (0)