-
Notifications
You must be signed in to change notification settings - Fork 0
/
full-rip-user-conf.yaml
476 lines (455 loc) · 12.2 KB
/
full-rip-user-conf.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
---
globals:
asn: 25253
default_router_classes: [ ]
default_interface_classes: [ ]
classes:
# classes abstraites
- name: backbone #routeur OSPF de cœur
type: router
classes: [ loopback, ospf4-router, mpls-router ]
values:
ospf4_process: 1
ospf4_area: 0
- name: backbone-interface
type: interface
classes: [ ospf4-interface, mpls-interface ]
- name: provider-edge
type: router
classes: [ bgp-router,vrf-router, backbone ]
- name: provider
type: router
classes: [backbone]
interface_classes: [backbone-interface] # toutes ses interfaces sont des interfaces OSPF
- name: customer-edge
type: router
classes: [ rip-router ]
- name: edge-interface # interface PE côté CE
type: interface
classes: [rip-vrf-int, vrf-interface]
- name: routing-interface # interface CE côté PE
type: interface
classes: [rip-int]
- name: ce-ext # interface CE côté client
type: interface
classes: [ dhcp-server ]
values:
ipv4_netmask: 255.255.255.0
# classes concrètes
- name: dhcp-server
type: interface
template: |-
ip dhcp pool {{interface.name}}
network {{interface.ipv4_network}} {{interface.ipv4_netmask}}
default-router {{construct_ipv4(interface.ipv4_network,interface.ip_end)}}
exit
int {{interface.name}}
- name: rip-router
type: router
interface_classes: [ ]
template: |-
router rip
version 2
no auto-summary
redistribute connected
exit
- name: rip-int
type: interface
template: |-
!
router rip
network {{interface.ipv4_network}}
interface {{interface.name}}
- name: rip-vrf-int
type: interface
template: |-
!
router rip
version 2
address-family ipv4 vrf {{interface.vrf}}
network {{interface.ipv4_network}}
redistribute bgp 25253 metric transparent
exit-address-family
interface {{interface.name}}
- name: vrf-router
type: router
template: ''
values:
vrfs:
- name: TC
rd: 100
imports: [ 100, 300 ]
exports: [ 100, 301 ]
- name: IT
rd: 200
imports: [ 200,300 ]
exports: [ 200,301 ]
- name: SHR
rd: 300
imports: [ 300,301 ]
exports: [ 300 ]
- name: vrf-interface
type: interface
template: |-
ip vrf forwarding {{interface.vrf}}
- name: loopback
template: |-
int Loopback0
ip address 192.168.10.{{router.loopback_end}} 255.255.255.255
ip ospf {{router.ospf4_process}} area {{router.ospf4_area}}
exit
type: router
- name: ospf4-interface
type: interface
template: |-
ip ospf {{router.ospf4_process}} area {{router.ospf4_area}}
- name: ospf4-router
type: router
template: |-
router ospf {{router.ospf4_process}}
exit
- name: mpls-interface
type: interface
template: |-
mpls ip
mpls mtu override 1560
- name: mpls-router
type: router
template: |-
mpls ldp router-id Loopback0
mpls ldp discovery targeted-hello accept
mpls label range 300 399
ip cef
- name: bgp-router
type: router
template: |-
router bgp {{globals.asn}}
bgp router-id 192.168.10.{{router.loopback_end}}
{% for peer in router.peers_end %}{% if peer != router.loopback_end %}
neighbor 192.168.10.{{peer}} remote-as {{globals.asn}}
neighbor 192.168.10.{{peer}} update-source Loopback0
neighbor 192.168.10.{{peer}} activate
{% endif %}{% endfor %}
!
address-family ipv4 unicast
{% for peer in router.peers_end %}{% if peer != router.loopback_end %}
neighbor 192.168.10.{{peer}} remote-as {{globals.asn}}
neighbor 192.168.10.{{peer}} activate
{% endif %}{% endfor %}
exit-address-family
!
address-family vpnv4
{% for peer in router.peers_end %}{% if peer != router.loopback_end %}
neighbor 192.168.10.{{peer}} remote-as 25253
neighbor 192.168.10.{{peer}} send-community extended
neighbor 192.168.10.{{peer}} next-hop-self
neighbor 192.168.10.{{peer}} activate
{% endif %}{% endfor %}
exit-address-family
!
{% for vrf in router.vrfs %}
address-family ipv4 vrf {{vrf.name}}
{% for peer in router.peers_end %}{% if peer != router.loopback_end %}
neighbor 192.168.10.{{peer}} remote-as 25253
neighbor 192.168.10.{{peer}} activate
{% endif %}{% endfor %}
redistribute rip
no synchronization
exit-address-family
!
{% endfor %}
exit
#--
values:
peers_end: [ 21,22,23 ] # le nombre à la fin de l'adresse de loopback
templates:
router: |-
#### configuration de {{router.name}}
hostname {{router.name}}
no ip domain lookup
ip arp proxy disable
{% for vrf in router.vrfs %}
ip vrf {{vrf.name}}
rd {{globals.asn}}:{{vrf.rd}}
{% for rt in vrf.imports %}
route-target import {{globals.asn}}:{{rt}}
{% endfor %}
{% for rt in vrf.exports %}
route-target export {{globals.asn}}:{{rt}}
{% endfor %}
{% endfor %}
{% for classe in router.resolved_classes %}
# classe {{classe.name}}
{{Template(classe.template).render(Template=Template,classe=classe,router=router,construct_ipv4=construct_ipv4,globals=globals)}}
# fin classe {{classe.name}}
#--
{% endfor %}
{% for interface in router.interfaces %}
{{Template(interface.template).render(Template=Template,interface=interface,router=router,construct_ipv4=construct_ipv4,globals=globals)}}
#--
{% endfor %}
{% if router.disable %}# ce routeur ne doit pas etre configure{% endif %}
# template specifique
{{Template(router.router_template).render(Template=Template,router=router,construct_ipv4=construct_ipv4,globals=globals)}}
#fin de la configuration de {{router.name}}
#--
menu tp command 1 show ip cef
menu tp command 2 show mpls ldp neighbor
menu tp command 3 show mpls forwarding-table
menu tp command 4 show mpls ip binding
menu tp command e menu-exit
menu tp command q menu-exit
#--
menu tp prompt $ ====menu TP=====
1. voir la FIB show ip cef
2. voisins LDP show mpls ldp neighbor
3. voir la LFIB show mpls forwarding-table
4. voir la LIB show mpls ip binding
(q|e). quitter
choix : $
interface: |-
interface {{interface.name}}
{% if interface.disable %}
# cette interface ne doit pas etre configuree
{% endif %}
{% if interface.peer %}
description connectee a {{interface.peer.interface}} de {{interface.peer.name}}
{% endif %}
no shutdown
{% for classe in interface.resolved_classes %}# classe {{classe.name}}
{{Template(classe.template).render(interface=interface,router=router,construct_ipv4=construct_ipv4,globals=globals)}}
# fin classe {{classe.name}}
{% endfor %}
ip address {{construct_ipv4(interface.ipv4_network,interface.ip_end)}} {{interface.ipv4_netmask}}
#template specifique a cette interface
{{ interface.interface_template }}
exit
# fin interface {{interface.name}}
links:
- name: P2<-->PE2-1
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 172.26.21.0
- name: PE2-1<-->TC_CE21
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 194.10.21.0
vrf: TC
- name: PE2-1<-->IT_CE21
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 194.20.21.0
vrf: IT
- name: P2<-->PE2-2
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 172.26.22.0
- name: PE2-2<-->TC_CE22
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 194.10.22.0
vrf: TC
- name: PE2-2<-->IT_CE22
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 194.20.22.0
vrf: IT
- name: P2<-->PE2-3
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 172.26.23.0
- name: PE2-3<-->TC_CE23
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 194.10.23.0
vrf: TC
- name: SHR_CE23<-->PE2-3
interface_classes: [ ]
router_classes: [ ]
template: ''
interface_values:
ipv4_network: 194.30.10.0
vrf: SHR
routers:
- name: P2
disable: false
classes: [ provider ]
template: ''
interfaces:
- name: f1/0
template: ''
classes: [ ]
values: { }
- name: f2/0
template: ''
classes: [ ]
values: { }
- name: f3/0
template: ''
classes: []
values: { }
values:
loopback_end: 20
- name: PE2-1
disable: false
classes: [ provider-edge ]
template: ''
interfaces:
- name: f1/0
template: ''
classes: [ backbone-interface ]
values: { }
- name: f2/0
template: ''
classes: [ edge-interface ]
values: {}
- name: f3/0
template: ''
classes: [ edge-interface ]
values: {}
values:
loopback_end: 21
- name: PE2-2
disable: false
classes: [ provider-edge ]
template: ''
interfaces:
- name: f2/0
template: ''
classes: [ backbone-interface ]
values: { }
- name: f3/0
template: ''
classes: [ edge-interface ]
values: { }
- name: f4/0
template: ''
classes: [ edge-interface ]
values: { }
values:
loopback_end: 22
- name: PE2-3
disable: false
classes: [ provider-edge ]
template: ''
interfaces:
- name: f3/0
template: ''
classes: [ backbone-interface ]
values: { }
- name: f2/0
template: ''
classes: [ edge-interface ]
values: { }
- name: f4/0
template: ''
classes: [ edge-interface ]
values: { }
values:
loopback_end: 23
- name: TC_CE23
disable: false
classes: [ customer-edge ]
template: ''
interfaces:
- name: f2/0
template: ''
classes: [ routing-interface ]
values: { }
- name: f0/0
template: ''
classes: [ ce-ext ]
values:
ipv4_network: 10.23.0.0
values: { }
- name: TC_CE21
disable: false
classes: [ customer-edge ]
template: ''
interfaces:
- name: f2/0
template: ''
classes: [ routing-interface ]
values: { }
- name: f0/0
template: ''
classes: [ ce-ext ]
values:
ipv4_network: 10.21.0.0
values: { }
- name: IT_CE21
disable: false
classes: [ customer-edge ]
template: ''
interfaces:
- name: f3/0
template: ''
classes: [ routing-interface ]
values: { }
- name: f0/0
template: ''
classes: [ ce-ext ]
values:
ipv4_network: 20.21.0.0
values: { }
- name: TC_CE22
disable: false
classes: [ customer-edge ]
template: ''
interfaces:
- name: f3/0
template: ''
classes: [ routing-interface ]
values: { }
- name: f0/0
template: ''
classes: [ ce-ext ]
values:
ipv4_network: 10.22.0.0
values: { }
- name: IT_CE22
disable: false
classes: [ customer-edge ]
template: ''
interfaces:
- name: f4/0
template: ''
classes: [routing-interface ]
values: { }
- name: f0/0
template: ''
classes: [ ce-ext ]
values:
ipv4_network: 20.22.0.0
values: { }
- name: SHR_CE23
disable: false
classes: [ customer-edge ]
template: ''
interfaces:
- name: f4/0
template: ''
classes: [ routing-interface ]
values: {}
- name: f0/0
template: ''
classes: [ ce-ext ]
values:
ipv4_network: 30.10.0.0
values: { }