Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_static_routes_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_static_routes_module:
2
3
4 ********************************************
5 dellemc.enterprise_sonic.sonic_static_routes
6 ********************************************
7
8 **Manage static routes configuration on SONiC**
9
10
11 Version added: 2.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management of static routes for devices running SONiC
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="5">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="5">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>config</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">list</span>
43 / <span style="color: purple">elements=dictionary</span>
44 </div>
45 </td>
46 <td>
47 </td>
48 <td>
49 <div>Manages &#x27;static_routes&#x27; configurations</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="4">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>static_list</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">list</span>
60 / <span style="color: purple">elements=dictionary</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>A list of &#x27;static_routes&#x27; configurations.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td class="elbow-placeholder"></td>
72 <td colspan="3">
73 <div class="ansibleOptionAnchor" id="parameter-"></div>
74 <b>next_hops</b>
75 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
76 <div style="font-size: small">
77 <span style="color: purple">list</span>
78 / <span style="color: purple">elements=dictionary</span>
79 </div>
80 </td>
81 <td>
82 </td>
83 <td>
84 <div>A list of next-hops to be utilised for the static route being specified.</div>
85 </td>
86 </tr>
87 <tr>
88 <td class="elbow-placeholder"></td>
89 <td class="elbow-placeholder"></td>
90 <td class="elbow-placeholder"></td>
91 <td colspan="2">
92 <div class="ansibleOptionAnchor" id="parameter-"></div>
93 <b>index</b>
94 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
95 <div style="font-size: small">
96 <span style="color: purple">dictionary</span>
97 / <span style="color: red">required</span>
98 </div>
99 </td>
100 <td>
101 </td>
102 <td>
103 <div>An identifier utilised to uniquely reference the next-hop.</div>
104 </td>
105 </tr>
106 <tr>
107 <td class="elbow-placeholder"></td>
108 <td class="elbow-placeholder"></td>
109 <td class="elbow-placeholder"></td>
110 <td class="elbow-placeholder"></td>
111 <td colspan="1">
112 <div class="ansibleOptionAnchor" id="parameter-"></div>
113 <b>blackhole</b>
114 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
115 <div style="font-size: small">
116 <span style="color: purple">boolean</span>
117 </div>
118 </td>
119 <td>
120 <ul style="margin: 0; padding: 0"><b>Choices:</b>
121 <li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
122 <li>yes</li>
123 </ul>
124 </td>
125 <td>
126 <div>Indicates that packets matching this route should be discarded.</div>
127 </td>
128 </tr>
129 <tr>
130 <td class="elbow-placeholder"></td>
131 <td class="elbow-placeholder"></td>
132 <td class="elbow-placeholder"></td>
133 <td class="elbow-placeholder"></td>
134 <td colspan="1">
135 <div class="ansibleOptionAnchor" id="parameter-"></div>
136 <b>interface</b>
137 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
138 <div style="font-size: small">
139 <span style="color: purple">string</span>
140 </div>
141 </td>
142 <td>
143 </td>
144 <td>
145 <div>The reference to a base interface.</div>
146 </td>
147 </tr>
148 <tr>
149 <td class="elbow-placeholder"></td>
150 <td class="elbow-placeholder"></td>
151 <td class="elbow-placeholder"></td>
152 <td class="elbow-placeholder"></td>
153 <td colspan="1">
154 <div class="ansibleOptionAnchor" id="parameter-"></div>
155 <b>next_hop</b>
156 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
157 <div style="font-size: small">
158 <span style="color: purple">string</span>
159 </div>
160 </td>
161 <td>
162 </td>
163 <td>
164 <div>The next-hop that is to be used for the static route.</div>
165 </td>
166 </tr>
167 <tr>
168 <td class="elbow-placeholder"></td>
169 <td class="elbow-placeholder"></td>
170 <td class="elbow-placeholder"></td>
171 <td class="elbow-placeholder"></td>
172 <td colspan="1">
173 <div class="ansibleOptionAnchor" id="parameter-"></div>
174 <b>nexthop_vrf</b>
175 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
176 <div style="font-size: small">
177 <span style="color: purple">string</span>
178 </div>
179 </td>
180 <td>
181 </td>
182 <td>
183 <div>Name of the next-hop network instance for leaked routes.</div>
184 </td>
185 </tr>
186
187 <tr>
188 <td class="elbow-placeholder"></td>
189 <td class="elbow-placeholder"></td>
190 <td class="elbow-placeholder"></td>
191 <td colspan="2">
192 <div class="ansibleOptionAnchor" id="parameter-"></div>
193 <b>metric</b>
194 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
195 <div style="font-size: small">
196 <span style="color: purple">integer</span>
197 </div>
198 </td>
199 <td>
200 </td>
201 <td>
202 <div>Specifies the preference of the next-hop entry when it is injected into the RIB.</div>
203 </td>
204 </tr>
205 <tr>
206 <td class="elbow-placeholder"></td>
207 <td class="elbow-placeholder"></td>
208 <td class="elbow-placeholder"></td>
209 <td colspan="2">
210 <div class="ansibleOptionAnchor" id="parameter-"></div>
211 <b>tag</b>
212 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
213 <div style="font-size: small">
214 <span style="color: purple">integer</span>
215 </div>
216 </td>
217 <td>
218 </td>
219 <td>
220 <div>The tag value for the static route.</div>
221 </td>
222 </tr>
223 <tr>
224 <td class="elbow-placeholder"></td>
225 <td class="elbow-placeholder"></td>
226 <td class="elbow-placeholder"></td>
227 <td colspan="2">
228 <div class="ansibleOptionAnchor" id="parameter-"></div>
229 <b>track</b>
230 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
231 <div style="font-size: small">
232 <span style="color: purple">integer</span>
233 </div>
234 </td>
235 <td>
236 </td>
237 <td>
238 <div>The IP SLA track ID for static route.</div>
239 </td>
240 </tr>
241
242 <tr>
243 <td class="elbow-placeholder"></td>
244 <td class="elbow-placeholder"></td>
245 <td colspan="3">
246 <div class="ansibleOptionAnchor" id="parameter-"></div>
247 <b>prefix</b>
248 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
249 <div style="font-size: small">
250 <span style="color: purple">string</span>
251 / <span style="color: red">required</span>
252 </div>
253 </td>
254 <td>
255 </td>
256 <td>
257 <div>Destination prefix for the static route, either IPv4 or IPv6.</div>
258 </td>
259 </tr>
260
261 <tr>
262 <td class="elbow-placeholder"></td>
263 <td colspan="4">
264 <div class="ansibleOptionAnchor" id="parameter-"></div>
265 <b>vrf_name</b>
266 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
267 <div style="font-size: small">
268 <span style="color: purple">string</span>
269 / <span style="color: red">required</span>
270 </div>
271 </td>
272 <td>
273 </td>
274 <td>
275 <div>Name of the configured VRF on the device.</div>
276 </td>
277 </tr>
278
279 <tr>
280 <td colspan="5">
281 <div class="ansibleOptionAnchor" id="parameter-"></div>
282 <b>state</b>
283 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
284 <div style="font-size: small">
285 <span style="color: purple">string</span>
286 </div>
287 </td>
288 <td>
289 <ul style="margin: 0; padding: 0"><b>Choices:</b>
290 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
291 <li>deleted</li>
292 <li>overridden</li>
293 <li>replaced</li>
294 </ul>
295 </td>
296 <td>
297 <div>The state of the configuration after module completion.</div>
298 </td>
299 </tr>
300 </table>
301 <br/>
302
303
304 Notes
305 -----
306
307 .. note::
308 - Supports ``check_mode``.
309
310
311
312 Examples
313 --------
314
315 .. code-block:: yaml
316
317 # Using "merged" state
318 #
319 # Before state:
320 # -------------
321 #
322 # sonic# show running-configuration | grep "ip route"
323 # (No "ip route" configuration present)
324
325 - name: Merge static routes configurations
326 dellemc.enterprise_sonic.sonic_static_routes:
327 config:
328 - vrf_name: 'default'
329 static_list:
330 - prefix: '2.0.0.0/8'
331 next_hops:
332 - index:
333 interface: 'Ethernet4'
334 metric: 1
335 tag: 2
336 track: 3
337 - index:
338 next_hop: '3.0.0.0'
339 metric: 2
340 tag: 4
341 track: 8
342 - vrf_name: 'VrfReg1'
343 static_list:
344 - prefix: '3.0.0.0/8'
345 next_hops:
346 - index:
347 interface: 'eth0'
348 nexthop_vrf: 'VrfReg2'
349 next_hop: '4.0.0.0'
350 metric: 4
351 tag: 5
352 track: 6
353 - index:
354 blackhole: true
355 metric: 10
356 tag: 20
357 track: 30
358 state: merged
359
360 # After state:
361 # ------------
362 #
363 # sonic# show running-configuration | grep "ip route"
364 # ip route 2.0.0.0/8 3.0.0.0 tag 4 track 8 2
365 # ip route 2.0.0.0/8 interface Ethernet4 tag 2 track 3 1
366 # ip route vrf VrfReg1 3.0.0.0/8 4.0.0.0 interface Management 0 nexthop-vrf VrfReg2 tag 5 track 6 4
367 # ip route vrf VrfReg1 3.0.0.0/8 blackhole tag 20 track 30 10
368 #
369 #
370 # Modifying previous merge
371
372 - name: Modify static routes configurations
373 dellemc.enterprise_sonic.sonic_static_routes:
374 config:
375 - vrf_name: 'VrfReg1'
376 static_list:
377 - prefix: '3.0.0.0/8'
378 next_hops:
379 - index:
380 blackhole: true
381 metric: 11
382 tag: 22
383 track: 33
384 state: merged
385
386 # After state:
387 # ------------
388 #
389 # sonic# show running-configuration | grep "ip route"
390 # ip route 2.0.0.0/8 3.0.0.0 tag 4 track 8 2
391 # ip route 2.0.0.0/8 interface Ethernet4 tag 2 track 3 1
392 # ip route vrf VrfReg1 3.0.0.0/8 4.0.0.0 interface Management 0 nexthop-vrf VrfReg2 tag 5 track 6 4
393 # ip route vrf VrfReg1 3.0.0.0/8 blackhole tag 22 track 33 11
394
395
396 # Using "overridden" state
397 #
398 # Before state:
399 # -------------
400 #
401 # sonic# show running-configuration | grep "ip route"
402 # ip route 4.0.0.0/8 2.0.0.0 tag 4 track 8 2
403
404 - name: Override static routes configurations
405 dellemc.enterprise_sonic.sonic_static_routes:
406 config:
407 - vrf_name: 'VrfReg2'
408 static_list:
409 - prefix: '3.0.0.0/8'
410 next_hops:
411 - index:
412 blackhole: true
413 metric: 10
414 tag: 20
415 track: 30
416 state: overridden
417
418 # After state:
419 # ------------
420 #
421 # sonic# show running-configuration | grep "ip route"
422 # ip route vrf VrfReg2 3.0.0.0/8 blackhole tag 20 track 30 10
423
424
425 # Using "replaced" state
426 #
427 # Before state:
428 # -------------
429 #
430 # sonic# show running-configuration | grep "ip route"
431 # ip route 4.0.0.0/8 2.0.0.0 tag 4 track 8 2
432
433 - name: Replace static routes configurations
434 dellemc.enterprise_sonic.sonic_static_routes:
435 config:
436 - vrf_name: 'default'
437 static_list:
438 - prefix: '4.0.0.0/8'
439 next_hops:
440 - index:
441 blackhole: true
442 metric: 5
443 tag: 10
444 track: 15
445 state: replaced
446
447 # After state:
448 # ------------
449 #
450 # sonic# show running-configuration | grep "ip route"
451 # ip route 4.0.0.0/8 blackhole tag 10 track 15 5
452
453
454 # Using "deleted" state
455 #
456 # Before state:
457 # -------------
458 #
459 # sonic# show running-configuration | grep "ip route"
460 # ip route 2.0.0.0/8 3.0.0.0 tag 4 track 8 2
461 # ip route 2.0.0.0/8 interface Ethernet4 tag 2 track 3 1
462 # ip route vrf VrfReg1 3.0.0.0/8 4.0.0.0 interface Management 0 nexthop-vrf VrfReg2 tag 5 track 6 4
463 # ip route vrf VrfReg1 3.0.0.0/8 blackhole tag 22 track 33 11
464
465 - name: Delete static routes configurations
466 dellemc.enterprise_sonic.sonic_static_routes:
467 config:
468 - vrf_name: 'default'
469 static_list:
470 - prefix: '2.0.0.0/8'
471 next_hops:
472 - index:
473 interface: 'Ethernet4'
474 - vrf_name: 'VrfReg1'
475 state: deleted
476
477 # After state:
478 # ------------
479 #
480 # sonic# show running-configuration | grep "ip route"
481 # ip route 2.0.0.0/8 3.0.0.0 tag 4 track 8 2
482
483
484
485 Return Values
486 -------------
487 Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
488
489 .. raw:: html
490
491 <table border=0 cellpadding=0 class="documentation-table">
492 <tr>
493 <th colspan="1">Key</th>
494 <th>Returned</th>
495 <th width="100%">Description</th>
496 </tr>
497 <tr>
498 <td colspan="1">
499 <div class="ansibleOptionAnchor" id="return-"></div>
500 <b>after</b>
501 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
502 <div style="font-size: small">
503 <span style="color: purple">list</span>
504 </div>
505 </td>
506 <td>when changed</td>
507 <td>
508 <div>The resulting configuration module invocation.</div>
509 <br/>
510 <div style="font-size: smaller"><b>Sample:</b></div>
511 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
512 </td>
513 </tr>
514 <tr>
515 <td colspan="1">
516 <div class="ansibleOptionAnchor" id="return-"></div>
517 <b>after_generated</b>
518 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
519 <div style="font-size: small">
520 <span style="color: purple">list</span>
521 </div>
522 </td>
523 <td>when <code>check_mode</code></td>
524 <td>
525 <div>The generated configuration module invocation.</div>
526 <br/>
527 <div style="font-size: smaller"><b>Sample:</b></div>
528 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
529 </td>
530 </tr>
531 <tr>
532 <td colspan="1">
533 <div class="ansibleOptionAnchor" id="return-"></div>
534 <b>before</b>
535 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
536 <div style="font-size: small">
537 <span style="color: purple">list</span>
538 </div>
539 </td>
540 <td>always</td>
541 <td>
542 <div>The configuration prior to the module invocation.</div>
543 <br/>
544 <div style="font-size: smaller"><b>Sample:</b></div>
545 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
546 </td>
547 </tr>
548 <tr>
549 <td colspan="1">
550 <div class="ansibleOptionAnchor" id="return-"></div>
551 <b>commands</b>
552 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
553 <div style="font-size: small">
554 <span style="color: purple">list</span>
555 </div>
556 </td>
557 <td>always</td>
558 <td>
559 <div>The set of commands pushed to the remote device.</div>
560 <br/>
561 <div style="font-size: smaller"><b>Sample:</b></div>
562 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;command 1&#x27;, &#x27;command 2&#x27;, &#x27;command 3&#x27;]</div>
563 </td>
564 </tr>
565 </table>
566 <br/><br/>
567
568
569 Status
570 ------
571
572
573 Authors
574 ~~~~~~~
575
576 - S\. Talabi (@stalabi1)