Debian Codegraph @

ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_vrf_interfaces_module.rst

raw
1 .. _cisco.iosxr.iosxr_vrf_interfaces_module:
2
3
4 ********************************
5 cisco.iosxr.iosxr_vrf_interfaces
6 ********************************
7
8 **Resource module to configure VRF interfaces.**
9
10
11 Version added: 10.3.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module configures and manages the VRF configuration in interface on IOS XR platforms.
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="2">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="2">
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>A list of VRF interfaces options.</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="1">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>name</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">string</span>
60 / <span style="color: red">required</span>
61 </div>
62 </td>
63 <td>
64 </td>
65 <td>
66 <div>Full name of the interface excluding any logical unit number, i.e. GigabitEthernet0/0/0/1.</div>
67 </td>
68 </tr>
69 <tr>
70 <td class="elbow-placeholder"></td>
71 <td colspan="1">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>vrf_name</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">string</span>
77 </div>
78 </td>
79 <td>
80 </td>
81 <td>
82 <div>Vrf that is to be added to the interface.</div>
83 </td>
84 </tr>
85
86 <tr>
87 <td colspan="2">
88 <div class="ansibleOptionAnchor" id="parameter-"></div>
89 <b>running_config</b>
90 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
91 <div style="font-size: small">
92 <span style="color: purple">string</span>
93 </div>
94 </td>
95 <td>
96 </td>
97 <td>
98 <div>This option is used only with state <em>parsed</em>.</div>
99 <div>The value of this option should be the output received from the IOS device by executing the command <b>sh running-config interface</b>.</div>
100 <div>The state <em>parsed</em> reads the configuration from <code>running_config</code> option and transforms it into Ansible structured data as per the resource module&#x27;s argspec and the value is then returned in the <em>parsed</em> key within the result.</div>
101 </td>
102 </tr>
103 <tr>
104 <td colspan="2">
105 <div class="ansibleOptionAnchor" id="parameter-"></div>
106 <b>state</b>
107 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
108 <div style="font-size: small">
109 <span style="color: purple">string</span>
110 </div>
111 </td>
112 <td>
113 <ul style="margin: 0; padding: 0"><b>Choices:</b>
114 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
115 <li>replaced</li>
116 <li>overridden</li>
117 <li>deleted</li>
118 <li>gathered</li>
119 <li>rendered</li>
120 <li>parsed</li>
121 </ul>
122 </td>
123 <td>
124 <div>The state the configuration should be left in</div>
125 <div>The states <em>rendered</em>, <em>gathered</em> and <em>parsed</em> does not perform any change on the device.</div>
126 <div>The state <em>rendered</em> will transform the configuration in <code>config</code> option to platform specific CLI commands which will be returned in the <em>rendered</em> key within the result. For state <em>rendered</em> active connection to remote host is not required.</div>
127 <div>The state <em>gathered</em> will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the <em>gathered</em> key within the result.</div>
128 <div>The state <em>parsed</em> reads the configuration from <code>running_config</code> option and transforms it into JSON format as per the resource module parameters and the value is returned in the <em>parsed</em> key within the result. The value of <code>running_config</code> option should be the same format as the output of command <em>show running-config | include ip route|ipv6 route</em> executed on device. For state <em>parsed</em> active connection to remote host is not required.</div>
129 </td>
130 </tr>
131 </table>
132 <br/>
133
134
135 Notes
136 -----
137
138 .. note::
139 - Tested against Cisco IOS-XR 7.2.2.
140 - This module works with connection ``network_cli``.
141
142
143
144 Examples
145 --------
146
147 .. code-block:: yaml
148
149 # Using merged
150
151 # Before state:
152 # -------------
153 #
154 # viosxr#show running-config interfaces
155 # interface MgmtEth0/RP0/CPU0/0
156 # ipv4 address dhcp
157 # !
158 # interface GigabitEthernet0/0/0/0
159 # description this is interface0
160 # cdp
161 # !
162 # interface GigabitEthernet0/0/0/1
163 # shutdown
164 # !
165 # interface GigabitEthernet0/0/0/2
166 # shutdown
167 # !
168
169 - name: Simple merge selective
170 cisco.iosxr.iosxr_vrf_interfaces:
171 state: merged
172 config:
173 - name: MgmtEth0/RP0/CPU0/0
174 - name: GigabitEthernet0/0/0/0
175 - name: GigabitEthernet0/0/0/1
176 vrf_name: vrf_C
177 - name: GigabitEthernet0/0/0/2
178 vrf_name: vrf_D
179
180 # Task Output
181 # -----------
182 #
183 # before:
184 # - name: MgmtEth0/RP0/CPU0/0
185 # - name: GigabitEthernet0/0/0/0
186 # - name: GigabitEthernet0/0/0/1
187 # - name: GigabitEthernet0/0/0/2
188 # commands:
189 # - interface GigabitEthernet0/0/0/1
190 # - vrf vrf_C
191 # - interface GigabitEthernet0/0/0/2
192 # - vrf vrf_D
193 # after:
194 # - name: MgmtEth0/RP0/CPU0/0
195 # - name: GigabitEthernet0/0/0/0
196 # - name: GigabitEthernet0/0/0/1
197 # vrf_name: vrf_C
198 # - name: GigabitEthernet0/0/0/2
199 # vrf_name: vrf_D
200
201 # After state:
202 # -------------
203 #
204 # viosxr#show running-config interfaces
205 # interface MgmtEth0/RP0/CPU0/0
206 # ipv4 address dhcp
207 # !
208 # interface GigabitEthernet0/0/0/0
209 # description this is interface0
210 # cdp
211 # !
212 # interface GigabitEthernet0/0/0/1
213 # vrf vrf_C
214 # shutdown
215 # !
216 # interface GigabitEthernet0/0/0/2
217 # vrf vrf_D
218 # shutdown
219 # !
220
221 # Using replaced
222
223 # Before state:
224 # -------------
225 #
226 # viosxr#show running-config interfaces
227 # interface MgmtEth0/RP0/CPU0/0
228 # ipv4 address dhcp
229 # !
230 # interface GigabitEthernet0/0/0/0
231 # description this is interface0
232 # cdp
233 # !
234 # interface GigabitEthernet0/0/0/1
235 # vrf vrf_C
236 # shutdown
237 # !
238 # interface GigabitEthernet0/0/0/2
239 # vrf vrf_D
240 # shutdown
241 # !
242
243 - name: Simple replaced selective
244 cisco.iosxr.iosxr_vrf_interfaces:
245 state: replaced
246 config:
247 - name: MgmtEth0/RP0/CPU0/0
248 - name: GigabitEthernet0/0/0/0
249 - name: GigabitEthernet0/0/0/1
250 vrf_name: vrf_E
251 - name: GigabitEthernet0/0/0/2
252 vrf_name: vrf_D
253
254 # Task Output
255 # -----------
256 #
257 # before:
258 # - name: MgmtEth0/RP0/CPU0/0
259 # - name: GigabitEthernet0/0/0/0
260 # - name: GigabitEthernet0/0/0/1
261 # vrf_name: vrf_C
262 # - name: GigabitEthernet0/0/0/2
263 # vrf_name: vrf_D
264 # commands:
265 # - interface GigabitEthernet0/0/0/1
266 # - vrf vrf_E
267 # after:
268 # - name: MgmtEth0/RP0/CPU0/0
269 # - name: GigabitEthernet0/0/0/0
270 # - name: GigabitEthernet0/0/0/1
271 # vrf_name: vrf_E
272 # - name: GigabitEthernet0/0/0/2
273 # vrf_name: vrf_D
274
275 # After state:
276 # -------------
277 #
278 # viosxr#show running-config interfaces
279 # interface MgmtEth0/RP0/CPU0/0
280 # ipv4 address dhcp
281 # !
282 # interface GigabitEthernet0/0/0/0
283 # description this is interface0
284 # cdp
285 # !
286 # interface GigabitEthernet0/0/0/1
287 # vrf vrf_E
288 # shutdown
289 # !
290 # interface GigabitEthernet0/0/0/2
291 # vrf vrf_D
292 # shutdown
293 # !
294
295 # Using overridden
296
297 # Before state:
298 # -------------
299 #
300 # viosxr#show running-config interfaces
301 # interface MgmtEth0/RP0/CPU0/0
302 # ipv4 address dhcp
303 # !
304 # interface GigabitEthernet0/0/0/0
305 # description this is interface0
306 # cdp
307 # !
308 # interface GigabitEthernet0/0/0/1
309 # vrf vrf_C
310 # shutdown
311 # !
312 # interface GigabitEthernet0/0/0/2
313 # vrf vrf_D
314 # shutdown
315 # !
316
317 - name: Simple overridden selective
318 cisco.iosxr.iosxr_vrf_interfaces:
319 state: overridden
320 config:
321 - name: MgmtEth0/RP0/CPU0/0
322 - name: GigabitEthernet0/0/0/0
323 - name: GigabitEthernet0/0/0/1
324 vrf_name: vrf_E
325
326 # Task Output
327 # -----------
328 #
329 # before:
330 # - name: MgmtEth0/RP0/CPU0/0
331 # - name: GigabitEthernet0/0/0/0
332 # - name: GigabitEthernet0/0/0/1
333 # vrf_name: vrf_C
334 # - name: GigabitEthernet0/0/0/2
335 # vrf_name: vrf_D
336 # commands:
337 # - interface GigabitEthernet0/0/0/1
338 # - vrf vrf_E
339 # - interface GigabitEthernet0/0/0/2
340 # - no vrf vrf_E
341 # after:
342 # - name: MgmtEth0/RP0/CPU0/0
343 # - name: GigabitEthernet0/0/0/0
344 # - name: GigabitEthernet0/0/0/1
345 # vrf_name: vrf_E
346 # - name: GigabitEthernet0/0/0/2
347
348 # After state:
349 # -------------
350 #
351 # viosxr#show running-config interfaces
352 # interface MgmtEth0/RP0/CPU0/0
353 # ipv4 address dhcp
354 # !
355 # interface GigabitEthernet0/0/0/0
356 # description this is interface0
357 # cdp
358 # !
359 # interface GigabitEthernet0/0/0/1
360 # vrf vrf_E
361 # shutdown
362 # !
363 # interface GigabitEthernet0/0/0/2
364 # shutdown
365 # !
366
367 # Using deleted
368
369 # Before state:
370 # -------------
371 #
372 # viosxr#show running-config interfaces
373 # interface MgmtEth0/RP0/CPU0/0
374 # ipv4 address dhcp
375 # !
376 # interface GigabitEthernet0/0/0/0
377 # description this is interface0
378 # cdp
379 # !
380 # interface GigabitEthernet0/0/0/1
381 # vrf vrf_E
382 # shutdown
383 # !
384 # interface GigabitEthernet0/0/0/2
385 # vrf vrf_D
386 # shutdown
387 # !
388
389 - name: Simple deleted selective
390 cisco.iosxr.iosxr_vrf_interfaces:
391 state: deleted
392 config:
393 - name: GigabitEthernet0/0/0/1
394 vrf_name: vrf_E
395
396 # Task Output
397 # -----------
398 #
399 # before:
400 # - name: MgmtEth0/RP0/CPU0/0
401 # - name: GigabitEthernet0/0/0/0
402 # - name: GigabitEthernet0/0/0/1
403 # vrf_name: vrf_E
404 # - name: GigabitEthernet0/0/0/2
405 # vrf_name: vrf_D
406 # commands:
407 # - interface GigabitEthernet0/0/0/1
408 # - no vrf vrf_E
409 # after:
410 # - name: MgmtEth0/RP0/CPU0/0
411 # - name: GigabitEthernet0/0/0/0
412 # - name: GigabitEthernet0/0/0/1
413 # - name: GigabitEthernet0/0/0/2
414 # vrf_name: vrf_D
415
416 # After state:
417 # -------------
418 #
419 # viosxr#show running-config interfaces
420 # interface MgmtEth0/RP0/CPU0/0
421 # ipv4 address dhcp
422 # !
423 # interface GigabitEthernet0/0/0/0
424 # description this is interface0
425 # cdp
426 # !
427 # interface GigabitEthernet0/0/0/1
428 # shutdown
429 # !
430 # interface GigabitEthernet0/0/0/2
431 # vrf vrf_D
432 # shutdown
433 # !
434
435 # Using gathered
436
437 # Before state:
438 # -------------
439 #
440 # viosxr#show running-config interfaces
441 # interface MgmtEth0/RP0/CPU0/0
442 # ipv4 address dhcp
443 # !
444 # interface GigabitEthernet0/0/0/0
445 # description this is interface0
446 # cdp
447 # !
448 # interface GigabitEthernet0/0/0/1
449 # vrf vrf_C
450 # shutdown
451 # !
452 # interface GigabitEthernet0/0/0/2
453 # vrf vrf_D
454 # shutdown
455 # !
456
457 - name: Simple gathered selective
458 cisco.iosxr.iosxr_vrf_interfaces:
459 state: gathered
460
461 # Task Output
462 # -----------
463 #
464 # gathered:
465 # - name: MgmtEth0/RP0/CPU0/0
466 # - name: GigabitEthernet0/0/0/0
467 # - name: GigabitEthernet0/0/0/1
468 # vrf_name: vrf_C
469 # - name: GigabitEthernet0/0/0/2
470 # vrf_name: vrf_D
471
472 # Using rendered
473
474 # Before state:
475 # -------------
476 #
477 # viosxr#show running-config interfaces
478 # interface MgmtEth0/RP0/CPU0/0
479 # ipv4 address dhcp
480 # !
481 # interface GigabitEthernet0/0/0/0
482 # description this is interface0
483 # cdp
484 # !
485 # interface GigabitEthernet0/0/0/1
486 # vrf vrf_C
487 # shutdown
488 # !
489 # interface GigabitEthernet0/0/0/2
490 # vrf vrf_D
491 # shutdown
492 # !
493
494 - name: Simple rendered selective
495 cisco.iosxr.iosxr_vrf_interfaces:
496 state: rendered
497
498 # Task Output
499 # -----------
500 #
501 # commands:
502 # - interface GigabitEthernet0/0/0/1
503 # - vrf vrf_C
504 # - interface GigabitEthernet0/0/0/2
505 # - vrf vrf_D
506
507
508
509 Return Values
510 -------------
511 Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
512
513 .. raw:: html
514
515 <table border=0 cellpadding=0 class="documentation-table">
516 <tr>
517 <th colspan="1">Key</th>
518 <th>Returned</th>
519 <th width="100%">Description</th>
520 </tr>
521 <tr>
522 <td colspan="1">
523 <div class="ansibleOptionAnchor" id="return-"></div>
524 <b>after</b>
525 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
526 <div style="font-size: small">
527 <span style="color: purple">dictionary</span>
528 </div>
529 </td>
530 <td>when changed</td>
531 <td>
532 <div>The resulting configuration after module execution.</div>
533 <br/>
534 <div style="font-size: smaller"><b>Sample:</b></div>
535 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div>
536 </td>
537 </tr>
538 <tr>
539 <td colspan="1">
540 <div class="ansibleOptionAnchor" id="return-"></div>
541 <b>before</b>
542 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
543 <div style="font-size: small">
544 <span style="color: purple">dictionary</span>
545 </div>
546 </td>
547 <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td>
548 <td>
549 <div>The configuration prior to the module execution.</div>
550 <br/>
551 <div style="font-size: smaller"><b>Sample:</b></div>
552 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div>
553 </td>
554 </tr>
555 <tr>
556 <td colspan="1">
557 <div class="ansibleOptionAnchor" id="return-"></div>
558 <b>commands</b>
559 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
560 <div style="font-size: small">
561 <span style="color: purple">list</span>
562 </div>
563 </td>
564 <td>when <em>state</em> is <code>merged</code>, <code>replaced</code>, <code>overridden</code>, <code>deleted</code> or <code>purged</code></td>
565 <td>
566 <div>The set of commands pushed to the remote device.</div>
567 <br/>
568 <div style="font-size: smaller"><b>Sample:</b></div>
569 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface GigabitEthernet0/0/0/1&#x27;, &#x27;no vrf test_vrf1&#x27;, &#x27;vrf test_vrf2&#x27;]</div>
570 </td>
571 </tr>
572 <tr>
573 <td colspan="1">
574 <div class="ansibleOptionAnchor" id="return-"></div>
575 <b>gathered</b>
576 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
577 <div style="font-size: small">
578 <span style="color: purple">list</span>
579 </div>
580 </td>
581 <td>when <em>state</em> is <code>gathered</code></td>
582 <td>
583 <div>Facts about the network resource gathered from the remote device as structured data.</div>
584 <br/>
585 <div style="font-size: smaller"><b>Sample:</b></div>
586 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div>
587 </td>
588 </tr>
589 <tr>
590 <td colspan="1">
591 <div class="ansibleOptionAnchor" id="return-"></div>
592 <b>parsed</b>
593 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
594 <div style="font-size: small">
595 <span style="color: purple">list</span>
596 </div>
597 </td>
598 <td>when <em>state</em> is <code>parsed</code></td>
599 <td>
600 <div>The device native config provided in <em>running_config</em> option parsed into structured data as per module argspec.</div>
601 <br/>
602 <div style="font-size: smaller"><b>Sample:</b></div>
603 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">This output will always be in the same format as the module argspec.</div>
604 </td>
605 </tr>
606 <tr>
607 <td colspan="1">
608 <div class="ansibleOptionAnchor" id="return-"></div>
609 <b>rendered</b>
610 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
611 <div style="font-size: small">
612 <span style="color: purple">list</span>
613 </div>
614 </td>
615 <td>when <em>state</em> is <code>rendered</code></td>
616 <td>
617 <div>The provided configuration in the task rendered in device-native format (offline).</div>
618 <br/>
619 <div style="font-size: smaller"><b>Sample:</b></div>
620 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface GigabitEthernet0/0/0/1&#x27;, &#x27;no vrf test_vrf1&#x27;, &#x27;vrf test_vrf2&#x27;]</div>
621 </td>
622 </tr>
623 </table>
624 <br/><br/>
625
626
627 Status
628 ------
629
630
631 Authors
632 ~~~~~~~
633
634 - Sagar Paul (@KB-perByte)