-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathspec.yaml
304 lines (298 loc) · 10.4 KB
/
spec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
preinit:
- cmds:
- cmd: modprobe mpls_router
- cmd: modprobe mpls_gso
- cmd: modprobe mpls_iptunnel
# Install Pola Docker Images
- cmd: NAME_IMAGE=pola:latest
- cmd: if [ "$(docker image ls -q $NAME_IMAGE)" = "" ]; then docker build -t $NAME_IMAGE -f ../package/pola.Dockerfile ../package;fi
# Install FRR Docker Images
- cmd: NAME_IMAGE=frr:latest
- cmd: if [ "$(docker image ls -q $NAME_IMAGE)" = "" ]; then docker build -t $NAME_IMAGE -f ../package/frr.Dockerfile ../package;fi
# Install host_ubuntu Docker Images
- cmd: NAME_IMAGE=host_ubuntu:latest
- cmd: if [ "$(docker image ls -q $NAME_IMAGE)" = "" ]; then docker build -t $NAME_IMAGE -f ../package/host_ubuntu.Dockerfile ../package;fi
postinit:
- cmds:
- cmd: docker cp polad/polad.yaml pola:/config.yaml
nodes:
- name: pola
image: pola:latest
interfaces:
- { name: net0, type: bridge, args: Switch }
- name: pe01
image: frr:latest
interfaces:
- { name: net0, type: direct, args: p01#net0 }
- { name: net1, type: direct, args: p02#net0 }
- { name: net2, type: direct, args: host01#net0 }
- { name: net3, type: bridge, args: Switch }
- name: pe02
image: frr:latest
interfaces:
- { name: net0, type: direct, args: p01#net1 }
- { name: net1, type: direct, args: p02#net1 }
- { name: net2, type: direct, args: host02#net0 }
- { name: net3, type: bridge, args: Switch }
- name: p01
image: frr:latest
interfaces:
- { name: net0, type: direct, args: pe01#net0 }
- { name: net1, type: direct, args: pe02#net0 }
- { name: net2, type: direct, args: p02#net2 }
- name: p02
image: frr:latest
interfaces:
- { name: net0, type: direct, args: pe01#net1 }
- { name: net1, type: direct, args: pe02#net1 }
- { name: net2, type: direct, args: p01#net2 }
- name: host01
image: host_ubuntu:latest
interfaces:
- { name: net0, type: direct, args: pe01#net2 }
- name: host02
image: host_ubuntu:latest
interfaces:
- { name: net0, type: direct, args: pe02#net2 }
switches:
- name: Switch
interfaces:
- { name: net0, type: container, args: pola }
- { name: net3, type: container, args: pe01 }
- { name: net3, type: container, args: pe02 }
node_configs:
- name: pola
cmds:
- cmd: 'ip a add 10.0.255.254/24 dev net0'
- cmd: '/usr/local/go/bin/polad -f config.yaml > /dev/null 2>&1 &'
- name: pe01
cmds:
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
- cmd: sysctl -w net.mpls.conf.net1.input=1
- cmd: sysctl -w net.mpls.platform_labels=1048575
- cmd: ip link add cust-a type vrf table 10
- cmd: ip link set cust-a up
- cmd: ip link set net2 master cust-a
- cmd: >-
vtysh -c 'conf t'
-c 'log file /var/log/frr/frr.log'
-c 'debug pathd pcep basic path message pceplib'
-c 'debug pathd mpls-te'
-c 'interface lo'
-c ' ip address 10.255.0.1/32'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.1/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.9/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net2'
-c ' ip address 192.168.0.1/24'
-c 'exit'
-c 'interface net3'
-c ' ip address 10.0.255.1/24'
-c 'exit'
-c 'router ospf'
-c ' ospf router-id 10.255.0.1'
-c ' router-info area 0.0.0.0'
-c ' passive-interface lo'
-c ' capability opaque'
-c ' mpls-te on'
-c ' mpls-te router-address 10.255.0.1'
-c ' segment-routing on'
-c ' segment-routing global-block 16000 19999'
-c ' segment-routing node-msd 8'
-c ' segment-routing prefix 10.255.0.1/32 index 1'
-c 'exit'
-c 'router bgp 65000'
-c ' neighbor 10.255.0.3 remote-as 65000'
-c ' neighbor 10.255.0.3 update-source 10.255.0.1'
-c ' address-family ipv4 vpn'
-c ' neighbor 10.255.0.3 activate'
-c ' exit-address-family'
-c 'exit'
-c 'router bgp 65000 vrf cust-a'
-c ' address-family ipv4 unicast'
-c ' redistribute connected'
-c ' label vpn export auto'
-c ' rd vpn export 65000:10'
-c ' rt vpn both 65000:10'
-c ' export vpn'
-c ' import vpn'
-c ' exit-address-family'
-c 'exit'
-c 'route-map color1 permit 1'
-c ' set sr-te color 1'
-c 'exit'
-c 'segment-routing'
-c ' traffic-eng'
-c ' pcep'
-c ' pce POLA'
-c ' address ip 10.0.255.254'
-c ' source-address ip 10.0.255.1'
-c ' pce-initiated'
-c ' exit'
-c ' pcc'
-c ' peer POLA'
-c ' exit'
-c ' exit'
-c ' exit'
-c 'exit'
- name: pe02
cmds:
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
- cmd: sysctl -w net.mpls.conf.net1.input=1
- cmd: sysctl -w net.mpls.platform_labels=1048575
- cmd: ip link add cust-a type vrf table 10
- cmd: ip link set cust-a up
- cmd: ip link set net2 master cust-a
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.3/32'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.6/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.17/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net2'
-c ' ip address 192.168.1.1/24'
-c 'exit'
-c 'interface net3'
-c ' ip address 10.0.255.2/24'
-c 'exit'
-c 'router ospf'
-c ' ospf router-id 10.255.0.3'
-c ' router-info area 0.0.0.0'
-c ' passive-interface lo'
-c ' capability opaque'
-c ' mpls-te on'
-c ' mpls-te router-address 10.255.0.3'
-c ' segment-routing on'
-c ' segment-routing global-block 16000 19999'
-c ' segment-routing node-msd 8'
-c ' segment-routing prefix 10.255.0.3/32 index 3'
-c 'exit'
-c 'router bgp 65000'
-c ' neighbor 10.255.0.1 remote-as 65000'
-c ' neighbor 10.255.0.1 update-source 10.255.0.3'
-c ' address-family ipv4 vpn'
-c ' neighbor 10.255.0.1 activate'
-c ' exit-address-family'
-c 'exit'
-c 'router bgp 65000 vrf cust-a'
-c ' address-family ipv4 unicast'
-c ' redistribute connected'
-c ' label vpn export auto'
-c ' rd vpn export 65000:10'
-c ' rt vpn both 65000:10'
-c ' export vpn'
-c ' import vpn'
-c ' exit-address-family'
-c 'exit'
- name: p01
cmds:
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
- cmd: sysctl -w net.mpls.conf.net1.input=1
- cmd: sysctl -w net.mpls.conf.net2.input=1
- cmd: sysctl -w net.mpls.platform_labels=1048575
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.2/32'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.2/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.5/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net2'
-c ' ip address 10.0.0.13/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'router ospf'
-c ' ospf router-id 10.255.0.2'
-c ' router-info area 0.0.0.0'
-c ' passive-interface lo'
-c ' capability opaque'
-c ' mpls-te on'
-c ' mpls-te router-address 10.255.0.2'
-c ' segment-routing on'
-c ' segment-routing global-block 16000 19999'
-c ' segment-routing node-msd 8'
-c ' segment-routing prefix 10.255.0.2/32 index 2'
-c 'exit'
- name: p02
cmds:
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
- cmd: sysctl -w net.mpls.conf.net1.input=1
- cmd: sysctl -w net.mpls.conf.net2.input=1
- cmd: sysctl -w net.mpls.platform_labels=1048575
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.4/32'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.10/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.18/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'interface net2'
-c ' ip address 10.0.0.14/30'
-c ' ip ospf area 0.0.0.0'
-c 'exit'
-c 'router ospf'
-c ' ospf router-id 10.255.0.4'
-c ' router-info area 0.0.0.0'
-c ' passive-interface lo'
-c ' capability opaque'
-c ' mpls-te on'
-c ' mpls-te router-address 10.255.0.4'
-c ' segment-routing on'
-c ' segment-routing global-block 16000 19999'
-c ' segment-routing node-msd 8'
-c ' segment-routing prefix 10.255.0.4/32 index 4'
-c 'exit'
- name: host01
cmds:
- cmd: ip addr add 192.168.0.2/24 dev net0
- cmd: ip route add default via 192.168.0.1
- name: host02
cmds:
- cmd: ip addr add 192.168.1.2/24 dev net0
- cmd: ip route add default via 192.168.1.1
test:
- cmds:
## Add SR-TE Color
- cmd: docker exec pe01 vtysh -c 'conf t' -c 'router bgp 65000' -c 'address-family ipv4 vpn' -c 'neighbor 10.255.0.3 route-map color1 in'
## Show Status
- cmd: docker exec pe01 vtysh -c 'show sr-te policy'
- cmd: docker exec pe01 vtysh -c 'show ip route vrf cust-a 192.168.1.0/24'
## L3VPN Test
- cmd: docker exec host01 ping -c3 192.168.1.2