Debian Codegraph @

ansible_collections/cisco/iosxr/docs/cisco.iosxr.iosxr_lldp_interfaces_module.rst

raw
1 .. _cisco.iosxr.iosxr_lldp_interfaces_module:
2
3
4 *********************************
5 cisco.iosxr.iosxr_lldp_interfaces
6 *********************************
7
8 **Resource module to configure LLDP interfaces.**
9
10
11 Version added: 1.0.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module manages Link Layer Discovery Protocol (LLDP) attributes of interfaces on IOS-XR devices.
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="3">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="3">
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 dictionary of LLDP interfaces options.</div>
50 </td>
51 </tr>
52 <tr>
53 <td class="elbow-placeholder"></td>
54 <td colspan="2">
55 <div class="ansibleOptionAnchor" id="parameter-"></div>
56 <b>destination</b>
57 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
58 <div style="font-size: small">
59 <span style="color: purple">dictionary</span>
60 </div>
61 </td>
62 <td>
63 </td>
64 <td>
65 <div>Specifies LLDP destination configuration on the interface.</div>
66 </td>
67 </tr>
68 <tr>
69 <td class="elbow-placeholder"></td>
70 <td class="elbow-placeholder"></td>
71 <td colspan="1">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>mac_address</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 <ul style="margin: 0; padding: 0"><b>Choices:</b>
81 <li>ieee-nearest-bridge</li>
82 <li>ieee-nearest-non-tmpr-bridge</li>
83 </ul>
84 </td>
85 <td>
86 <div>Specifies the LLDP destination mac address on the interface.</div>
87 </td>
88 </tr>
89
90 <tr>
91 <td class="elbow-placeholder"></td>
92 <td colspan="2">
93 <div class="ansibleOptionAnchor" id="parameter-"></div>
94 <b>name</b>
95 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
96 <div style="font-size: small">
97 <span style="color: purple">string</span>
98 </div>
99 </td>
100 <td>
101 </td>
102 <td>
103 <div>Name/Identifier of the interface or Ether-Bundle.</div>
104 </td>
105 </tr>
106 <tr>
107 <td class="elbow-placeholder"></td>
108 <td colspan="2">
109 <div class="ansibleOptionAnchor" id="parameter-"></div>
110 <b>receive</b>
111 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
112 <div style="font-size: small">
113 <span style="color: purple">boolean</span>
114 </div>
115 </td>
116 <td>
117 <ul style="margin: 0; padding: 0"><b>Choices:</b>
118 <li>no</li>
119 <li>yes</li>
120 </ul>
121 </td>
122 <td>
123 <div>Enable/disable LLDP RX on an interface.</div>
124 </td>
125 </tr>
126 <tr>
127 <td class="elbow-placeholder"></td>
128 <td colspan="2">
129 <div class="ansibleOptionAnchor" id="parameter-"></div>
130 <b>transmit</b>
131 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
132 <div style="font-size: small">
133 <span style="color: purple">boolean</span>
134 </div>
135 </td>
136 <td>
137 <ul style="margin: 0; padding: 0"><b>Choices:</b>
138 <li>no</li>
139 <li>yes</li>
140 </ul>
141 </td>
142 <td>
143 <div>Enable/disable LLDP TX on an interface.</div>
144 </td>
145 </tr>
146
147 <tr>
148 <td colspan="3">
149 <div class="ansibleOptionAnchor" id="parameter-"></div>
150 <b>running_config</b>
151 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
152 <div style="font-size: small">
153 <span style="color: purple">string</span>
154 </div>
155 </td>
156 <td>
157 </td>
158 <td>
159 <div>This option is used only with state <em>parsed</em>.</div>
160 <div>The value of this option should be the output received from the IOS-XR device by executing the command <b>show running-config int</b>.</div>
161 <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>
162 </td>
163 </tr>
164 <tr>
165 <td colspan="3">
166 <div class="ansibleOptionAnchor" id="parameter-"></div>
167 <b>state</b>
168 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
169 <div style="font-size: small">
170 <span style="color: purple">string</span>
171 </div>
172 </td>
173 <td>
174 <ul style="margin: 0; padding: 0"><b>Choices:</b>
175 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
176 <li>replaced</li>
177 <li>overridden</li>
178 <li>deleted</li>
179 <li>parsed</li>
180 <li>rendered</li>
181 <li>gathered</li>
182 </ul>
183 </td>
184 <td>
185 <div>The state of the configuration after module completion.</div>
186 </td>
187 </tr>
188 </table>
189 <br/>
190
191
192 Notes
193 -----
194
195 .. note::
196 - This module works with connection ``network_cli``. See `the IOS-XR Platform Options <../network/user_guide/platform_iosxr.html>`_.
197
198
199
200 Examples
201 --------
202
203 .. code-block:: yaml
204
205 # Using merged
206 #
207 #
208 # ------------
209 # Before state
210 # ------------
211 #
212 #
213 # RP/0/RP0/CPU0:ios#sh run int
214 # Mon Aug 12 12:40:23.104 UTC
215 # interface TenGigE0/0/0/0
216 # ipv4 address 192.0.2.11 255.255.255.192
217 # !
218 # interface preconfigure GigabitEthernet0/0/0/1
219 # !
220 # interface preconfigure GigabitEthernet0/0/0/2
221 # !
222 #
223 #
224
225 - name: Merge provided configuration with running configuration
226 cisco.iosxr.iosxr_lldp_interfaces:
227 config:
228 - name: GigabitEthernet0/0/0/1
229 destination:
230 mac_address: ieee-nearest-non-tmpr-bridge
231 transmit: false
232 - name: GigabitEthernet0/0/0/2
233 destination:
234 mac_address: ieee-nearest-bridge
235 receive: false
236 state: merged
237
238
239 #
240 #
241 # ------------------------
242 # Module Execution Result
243 # ------------------------
244 #
245 #
246 # "before": [
247 # {
248 # "name": "TenGigE0/0/0/0"
249 # },
250 # {
251 # "name": "GigabitEthernet0/0/0/1"
252 # },
253 # {
254 # "name": "GigabitEthernet0/0/0/2"
255 # }
256 # ]
257 #
258 # "commands": [
259 # "interface GigabitEthernet0/0/0/2",
260 # "lldp destination mac-address ieee-nearest-non-tmpr-bridge",
261 # "lldp transmit disable",
262 # "interface GigabitEthernet0/0/0/1",
263 # "lldp receive disable",
264 # "lldp destination mac-address ieee-nearest-bridge"
265 # ]
266 #
267 # "after": [
268 # {
269 # "name": "TenGigE0/0/0/0"
270 # },
271 # {
272 # "destination": {
273 # "mac_address": "ieee-nearest-bridge"
274 # },
275 # "name": "GigabitEthernet0/0/0/1",
276 # "receive": false
277 # },
278 # {
279 # "destination": {
280 # "mac_address": "ieee-nearest-non-tmpr-bridge"
281 # },
282 # "name": "GigabitEthernet0/0/0/2",
283 # "transmit": false
284 # }
285 # ]
286 #
287 #
288 # ------------
289 # After state
290 # ------------
291 #
292 #
293 # RP/0/RP0/CPU0:ios#sh run int
294 # Mon Aug 12 12:49:51.517 UTC
295 # interface TenGigE0/0/0/0
296 # ipv4 address 192.0.2.11 255.255.255.192
297 # !
298 # interface preconfigure GigabitEthernet0/0/0/1
299 # lldp
300 # receive disable
301 # destination mac-address
302 # ieee-nearest-bridge
303 # !
304 # !
305 # !
306 # interface preconfigure GigabitEthernet0/0/0/2
307 # lldp
308 # transmit disable
309 # destination mac-address
310 # ieee-nearest-non-tmpr-bridge
311 # !
312 # !
313 # !
314 #
315 #
316
317
318 # Using replaced
319 #
320 #
321 # -------------
322 # Before state
323 # -------------
324 #
325 #
326 # RP/0/RP0/CPU0:ios#sh run int
327 # Mon Aug 12 12:49:51.517 UTC
328 # interface TenGigE0/0/0/0
329 # ipv4 address 192.0.2.11 255.255.255.192
330 # !
331 # interface preconfigure GigabitEthernet0/0/0/1
332 # lldp
333 # receive disable
334 # destination mac-address
335 # ieee-nearest-bridge
336 # !
337 # !
338 # !
339 # interface preconfigure GigabitEthernet0/0/0/2
340 # lldp
341 # transmit disable
342 # destination mac-address
343 # ieee-nearest-non-tmpr-bridge
344 # !
345 # !
346 # !
347 #
348 #
349
350 - name: >-
351 Replace existing LLDP configurations of specified interfaces with provided
352 configuration
353 cisco.iosxr.iosxr_lldp_interfaces:
354 config:
355 - name: GigabitEthernet0/0/0/1
356 destination:
357 mac_address: ieee-nearest-non-tmpr-bridge
358 state: replaced
359
360
361 #
362 #
363 # ------------------------
364 # Module Execution Result
365 # ------------------------
366 #
367 # "before": [
368 # {
369 # "name": "TenGigE0/0/0/0"
370 # },
371 # {
372 # "destination": {
373 # "mac_address": "ieee-nearest-bridge"
374 # },
375 # "name": "GigabitEthernet0/0/0/1",
376 # "receive": false
377 # },
378 # {
379 # "destination": {
380 # "mac_address": "ieee-nearest-non-tmpr-bridge"
381 # },
382 # "name": "GigabitEthernet0/0/0/2",
383 # "transmit": false
384 # }
385 # ]
386 #
387 #
388 # "commands": [
389 # "interface GigabitEthernet0/0/0/1",
390 # "no lldp receive disable",
391 # "lldp destination mac-address ieee-nearest-non-tmpr-bridge"
392 # ]
393 #
394 #
395 # "after": [
396 # {
397 # "name": "TenGigE0/0/0/0"
398 # },
399 # {
400 # "destination": {
401 # "mac_address": "ieee-nearest-non-tmpr-bridge"
402 # },
403 # "name": "GigabitEthernet0/0/0/1"
404 # },
405 # {
406 # "destination": {
407 # "mac_address": "ieee-nearest-non-tmpr-bridge"
408 # },
409 # "name": "GigabitEthernet0/0/0/2",
410 # "transmit": false
411 # }
412 # ]
413 #
414 #
415 # ------------
416 # After state
417 # ------------
418 #
419 #
420 # RP/0/RP0/CPU0:ios#sh run int
421 # Mon Aug 12 13:02:57.062 UTC
422 # interface TenGigE0/0/0/0
423 # ipv4 address 192.0.2.11 255.255.255.192
424 # !
425 # interface preconfigure GigabitEthernet0/0/0/1
426 # lldp
427 # destination mac-address
428 # ieee-nearest-non-tmpr-bridge
429 # !
430 # !
431 # !
432 # interface preconfigure GigabitEthernet0/0/0/2
433 # lldp
434 # transmit disable
435 # destination mac-address
436 # ieee-nearest-non-tmpr-bridge
437 # !
438 # !
439 # !
440 #
441 #
442
443
444 # Using overridden
445 #
446 #
447 # -------------
448 # Before state
449 # -------------
450 #
451 #
452 # RP/0/RP0/CPU0:ios#sh run int
453 # Mon Aug 12 13:15:40.465 UTC
454 # interface TenGigE0/0/0/0
455 # ipv4 address 192.0.2.11 255.255.255.192
456 # !
457 # interface preconfigure GigabitEthernet0/0/0/1
458 # lldp
459 # receive disable
460 # destination mac-address
461 # ieee-nearest-bridge
462 # !
463 # !
464 # !
465 # interface preconfigure GigabitEthernet0/0/0/2
466 # lldp
467 # transmit disable
468 # destination mac-address
469 # ieee-nearest-non-tmpr-bridge
470 # !
471 # !
472 # !
473 #
474 #
475
476 - name: >-
477 Override the LLDP configurations of all the interfaces with provided
478 configurations
479 cisco.iosxr.iosxr_lldp_interfaces:
480 config:
481 - name: GigabitEthernet0/0/0/1
482 transmit: false
483 state: overridden
484
485
486 #
487 #
488 # ------------------------
489 # Module Execution Result
490 # ------------------------
491 #
492 #
493 # "before": [
494 # {
495 # "name": "TenGigE0/0/0/0"
496 # },
497 # {
498 # "destination": {
499 # "mac_address": "ieee-nearest-bridge"
500 # },
501 # "name": "GigabitEthernet0/0/0/1",
502 # "receive": false
503 # },
504 # {
505 # "destination": {
506 # "mac_address": "ieee-nearest-non-tmpr-bridge"
507 # },
508 # "name": "GigabitEthernet0/0/0/2",
509 # "transmit": false
510 # }
511 # ]
512 #
513 # "commands": [
514 # "interface GigabitEthernet0/0/0/2",
515 # "no lldp destination mac-address ieee-nearest-non-tmpr-bridge",
516 # "no lldp transmit disable",
517 # "interface GigabitEthernet0/0/0/1",
518 # "no lldp destination mac-address ieee-nearest-bridge",
519 # "no lldp receive disable",
520 # "lldp transmit disable"
521 # ]
522 #
523 #
524 # "after": [
525 # {
526 # "name": "TenGigE0/0/0/0"
527 # },
528 # {
529 # "name": "GigabitEthernet0/0/0/1",
530 # "transmit": false
531 # },
532 # {
533 # "name": "GigabitEthernet0/0/0/2"
534 # }
535 # ]
536 #
537 #
538 # ------------
539 # After state
540 # ------------
541 #
542 #
543 # RP/0/RP0/CPU0:ios#sh run int
544 # Mon Aug 12 13:22:25.604 UTC
545 # interface TenGigE0/0/0/0
546 # ipv4 address 192.0.2.11 255.255.255.192
547 # !
548 # interface preconfigure GigabitEthernet0/0/0/1
549 # lldp
550 # transmit disable
551 # !
552 # !
553 # interface preconfigure GigabitEthernet0/0/0/2
554 # !
555 #
556 #
557
558
559 # Using deleted
560 #
561 #
562 # -------------
563 # Before state
564 # -------------
565 #
566 #
567 # RP/0/RP0/CPU0:ios#sh run int
568 # Mon Aug 12 13:26:21.498 UTC
569 # interface TenGigE0/0/0/0
570 # ipv4 address 192.0.2.11 255.255.255.192
571 # !
572 # interface preconfigure GigabitEthernet0/0/0/1
573 # lldp
574 # receive disable
575 # destination mac-address
576 # ieee-nearest-bridge
577 # !
578 # !
579 # !
580 # interface preconfigure GigabitEthernet0/0/0/2
581 # lldp
582 # transmit disable
583 # destination mac-address
584 # ieee-nearest-non-tmpr-bridge
585 # !
586 # !
587 # !
588 #
589 #
590
591 - name: Delete LLDP configurations of all interfaces (Note - This won't delete the
592 interfaces themselves)
593 cisco.iosxr.iosxr_lldp_interfaces:
594 state: deleted
595
596 #
597 #
598 #
599 # ------------------------
600 # Module Execution Result
601 # ------------------------
602 #
603 #
604 # "before": [
605 # {
606 # "name": "TenGigE0/0/0/0"
607 # },
608 # {
609 # "destination": {
610 # "mac_address": "ieee-nearest-bridge"
611 # },
612 # "name": "GigabitEthernet0/0/0/1",
613 # "receive": false
614 # },
615 # {
616 # "destination": {
617 # "mac_address": "ieee-nearest-non-tmpr-bridge"
618 # },
619 # "name": "GigabitEthernet0/0/0/2",
620 # "transmit": false
621 # }
622 # ]
623 #
624 #
625 # "commands": [
626 # "interface GigabitEthernet0/0/0/1",
627 # "no lldp destination mac-address ieee-nearest-bridge",
628 # "no lldp receive disable",
629 # "interface GigabitEthernet0/0/0/2",
630 # "no lldp destination mac-address ieee-nearest-non-tmpr-bridge",
631 # "no lldp transmit disable"
632 # ]
633 #
634 #
635 # "after": [
636 # {
637 # "name": "TenGigE0/0/0/0"
638 # },
639 # {
640 # "name": "GigabitEthernet0/0/0/1"
641 # },
642 # {
643 # "name": "GigabitEthernet0/0/0/2"
644 # }
645 # ]
646 #
647 #
648 # ------------
649 # After state
650 # ------------
651 #
652 #
653 # RP/0/RP0/CPU0:ios#sh run int
654 # Mon Aug 12 13:30:14.618 UTC
655 # interface TenGigE0/0/0/0
656 # ipv4 address 192.0.2.11 255.255.255.192
657 # !
658 # interface preconfigure GigabitEthernet0/0/0/1
659 # !
660 # interface preconfigure GigabitEthernet0/0/0/2
661 # !
662 #
663 #
664 # Using parsed:
665 # parsed.cfg
666
667 # interface TenGigE0/0/0/0
668 # ipv4 address 192.0.2.11 255.255.255.192
669 # !
670 # interface preconfigure GigabitEthernet0/0/0/1
671 # lldp
672 # receive disable
673 # destination mac-address
674 # ieee-nearest-bridge
675 # !
676 # !
677 # !
678 # interface preconfigure GigabitEthernet0/0/0/2
679 # lldp
680 # transmit disable
681 # destination mac-address
682 # ieee-nearest-non-tmpr-bridge
683
684 - name: Convert lacp interfaces config to argspec without connecting to the appliance
685 cisco.iosxr.iosxr_lldp_interfaces:
686 running_config: "{{ lookup('file', './parsed.cfg') }}"
687 state: parsed
688
689 # ------------------------
690 # Module Execution Result
691 # ------------------------
692
693 # parsed: [
694 # - name: GigabitEthernet0/0/0/1
695 # destination:
696 # mac_address: ieee-nearest-non-tmpr-bridge
697 # transmit: False
698
699 # - name: GigabitEthernet0/0/0/2
700 # destination:
701 # mac_address: ieee-nearest-bridge
702 # receive: False
703 # ]
704
705 # Using gathered:
706 # Device config:
707
708 # RP/0/RP0/CPU0:ios#sh run int
709 # Mon Aug 12 12:49:51.517 UTC
710 # interface TenGigE0/0/0/0
711 # ipv4 address 192.0.2.11 255.255.255.192
712 # !
713 # interface preconfigure GigabitEthernet0/0/0/1
714 # lldp
715 # receive disable
716 # destination mac-address
717 # ieee-nearest-bridge
718 # !
719 # !
720 # !
721 # interface preconfigure GigabitEthernet0/0/0/2
722 # lldp
723 # transmit disable
724 # destination mac-address
725 # ieee-nearest-non-tmpr-bridge
726
727 - name: Gather IOSXR lldp interfaces configuration
728 cisco.iosxr.iosxr_lldp_interfaces:
729 config:
730 state: gathered
731
732 # ------------------------
733 # Module Execution Result
734 # ------------------------
735
736 # gathered:
737 # - name: GigabitEthernet0/0/0/1
738 # destination:
739 # mac_address: ieee-nearest-non-tmpr-bridge
740 # transmit: False
741
742 # - name: GigabitEthernet0/0/0/2
743 # destination:
744 # mac_address: ieee-nearest-bridge
745 # receive: False
746
747 # Using rendred:
748 - name: Render platform specific commands from task input using rendered state
749 cisco.iosxr.iosxr_lldp_interfaces:
750 config:
751 - name: GigabitEthernet0/0/0/1
752 destination:
753 mac_address: ieee-nearest-non-tmpr-bridge
754 transmit: false
755 - name: GigabitEthernet0/0/0/2
756 destination:
757 mac_address: ieee-nearest-bridge
758 receive: false
759 state: rendered
760 # ------------------------
761 # Module Execution Result
762 # ------------------------
763
764 # "rendered": [
765 # "interface GigabitEthernet0/0/0/2",
766 # "lldp destination mac-address ieee-nearest-non-tmpr-bridge",
767 # "lldp transmit disable",
768 # "interface GigabitEthernet0/0/0/1",
769 # "lldp receive disable",
770 # "lldp destination mac-address ieee-nearest-bridge"
771 # ]
772
773
774
775 Return Values
776 -------------
777 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:
778
779 .. raw:: html
780
781 <table border=0 cellpadding=0 class="documentation-table">
782 <tr>
783 <th colspan="1">Key</th>
784 <th>Returned</th>
785 <th width="100%">Description</th>
786 </tr>
787 <tr>
788 <td colspan="1">
789 <div class="ansibleOptionAnchor" id="return-"></div>
790 <b>after</b>
791 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
792 <div style="font-size: small">
793 <span style="color: purple">list</span>
794 </div>
795 </td>
796 <td>when changed</td>
797 <td>
798 <div>The configuration as structured data after module completion.</div>
799 <br/>
800 <div style="font-size: smaller"><b>Sample:</b></div>
801 <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
802 of the parameters above.</div>
803 </td>
804 </tr>
805 <tr>
806 <td colspan="1">
807 <div class="ansibleOptionAnchor" id="return-"></div>
808 <b>before</b>
809 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
810 <div style="font-size: small">
811 <span style="color: purple">list</span>
812 </div>
813 </td>
814 <td>always</td>
815 <td>
816 <div>The configuration as structured data prior to module invocation.</div>
817 <br/>
818 <div style="font-size: smaller"><b>Sample:</b></div>
819 <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
820 of the parameters above.</div>
821 </td>
822 </tr>
823 <tr>
824 <td colspan="1">
825 <div class="ansibleOptionAnchor" id="return-"></div>
826 <b>commands</b>
827 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
828 <div style="font-size: small">
829 <span style="color: purple">list</span>
830 </div>
831 </td>
832 <td>always</td>
833 <td>
834 <div>The set of commands pushed to the remote device.</div>
835 <br/>
836 <div style="font-size: smaller"><b>Sample:</b></div>
837 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;interface GigabitEthernet0/0/0/1&#x27;, &#x27;lldp destination mac-address ieee-nearest-non-tmpr-bridge&#x27;, &#x27;no lldp transmit disable&#x27;]</div>
838 </td>
839 </tr>
840 </table>
841 <br/><br/>
842
843
844 Status
845 ------
846
847
848 Authors
849 ~~~~~~~
850
851 - Nilashish Chakraborty (@nilashishc)