iosxr_lldp_interfaces – Manage Link Layer Discovery Protocol (LLDP) attributes of interfaces on IOS-XR devices — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# iosxr_lldp_interfaces – Manage Link Layer Discovery Protocol (LLDP) attributes of interfaces on IOS-XR devices

New in version 2.9.

- Synopsis

- Parameters

- Notes

- Examples

- Return Values

- Status

## Synopsis

- This module manages Link Layer Discovery Protocol (LLDP) attributes of interfaces on IOS-XR devices.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
config list / elements=dictionary |  | A dictionary of LLDP interfaces options.
| destination dictionary |  | Specifies LLDP destination configuration on the interface.
|  | mac_address string | Choices: ieee-nearest-bridge ieee-nearest-non-tmpr-bridge | Specifies the LLDP destination mac address on the interface.
| name string |  | Name/Identifier of the interface or Ether-Bundle.
| receive boolean | Choices: no yes | Enable/disable LLDP RX on an interface.
| transmit boolean | Choices: no yes | Enable/disable LLDP TX on an interface.
state string | Choices: merged ← replaced overridden deleted | The state of the configuration after module completion.

## Notes

Note

- Tested against IOS-XR 6.1.3.

- This module works with connection `network_cli`. See the IOS-XR Platform Options.

## Examples

    # Using merged
    #
    #
    # ------------
    # Before state
    # ------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 12:40:23.104 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    # !
    #
    #

    - name: Merge provided configuration with running configuration
      iosxr_lldp_interfaces:
        config:
          - name: GigabitEthernet0/0/0/1
            destination:
              mac_address: ieee-nearest-non-tmpr-bridge
            transmit: False

          - name: GigabitEthernet0/0/0/2
            destination:
              mac_address: ieee-nearest-bridge
            receive: False
        state: merged

    #
    #
    # ------------------------
    # Module Execution Result
    # ------------------------
    #
    #
    # "before": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "name": "GigabitEthernet0/0/0/1"
    #        },
    #        {
    #            "name": "GigabitEthernet0/0/0/2"
    #        }
    # ]
    #
    # "commands": [
    #        "interface GigabitEthernet0/0/0/2",
    #        "lldp destination mac-address ieee-nearest-non-tmpr-bridge",
    #        "lldp transmit disable",
    #        "interface GigabitEthernet0/0/0/1",
    #        "lldp receive disable",
    #        "lldp destination mac-address ieee-nearest-bridge"
    # ]
    #
    # "after": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/1",
    #            "receive": false
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-non-tmpr-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/2",
    #            "transmit": false
    #        }
    # ]
    #
    #
    # ------------
    # After state
    # ------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 12:49:51.517 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    #  lldp
    #   receive disable
    #   destination mac-address
    #    ieee-nearest-bridge
    #   !
    #  !
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    #  lldp
    #   transmit disable
    #   destination mac-address
    #    ieee-nearest-non-tmpr-bridge
    #   !
    #  !
    # !
    #
    #

    # Using replaced
    #
    #
    # -------------
    # Before state
    # -------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 12:49:51.517 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    #  lldp
    #   receive disable
    #   destination mac-address
    #    ieee-nearest-bridge
    #   !
    #  !
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    #  lldp
    #   transmit disable
    #   destination mac-address
    #    ieee-nearest-non-tmpr-bridge
    #   !
    #  !
    # !
    #
    #

    - name: Replace existing LLDP configurations of specified interfaces with provided configuration
      iosxr_lldp_interfaces:
        config:
          - name: GigabitEthernet0/0/0/1
            destination:
              mac_address: ieee-nearest-non-tmpr-bridge
        state: replaced

    #
    #
    # ------------------------
    # Module Execution Result
    # ------------------------
    #
    # "before": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/1",
    #            "receive": false
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-non-tmpr-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/2",
    #            "transmit": false
    #        }
    # ]
    #
    #
    # "commands": [
    #        "interface GigabitEthernet0/0/0/1",
    #        "no lldp receive disable",
    #        "lldp destination mac-address ieee-nearest-non-tmpr-bridge"
    # ]
    #
    #
    # "after": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-non-tmpr-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/1"
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-non-tmpr-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/2",
    #            "transmit": false
    #        }
    # ]
    #
    #
    # ------------
    # After state
    # ------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 13:02:57.062 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    #  lldp
    #   destination mac-address
    #    ieee-nearest-non-tmpr-bridge
    #   !
    #  !
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    #  lldp
    #   transmit disable
    #   destination mac-address
    #    ieee-nearest-non-tmpr-bridge
    #   !
    #  !
    # !
    #
    #

    # Using overridden
    #
    #
    # -------------
    # Before state
    # -------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 13:15:40.465 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    #  lldp
    #   receive disable
    #   destination mac-address
    #    ieee-nearest-bridge
    #   !
    #  !
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    #  lldp
    #   transmit disable
    #   destination mac-address
    #    ieee-nearest-non-tmpr-bridge
    #   !
    #  !
    # !
    #
    #

    - name: Override the LLDP configurations of all the interfaces with provided configurations
      iosxr_lldp_interfaces:
        config:
          - name: GigabitEthernet0/0/0/1
            transmit: False
        state: overridden

    #
    #
    # ------------------------
    # Module Execution Result
    # ------------------------
    #
    #
    # "before": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/1",
    #            "receive": false
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-non-tmpr-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/2",
    #            "transmit": false
    #        }
    # ]
    #
    # "commands": [
    #        "interface GigabitEthernet0/0/0/2",
    #        "no lldp destination mac-address ieee-nearest-non-tmpr-bridge",
    #        "no lldp transmit disable",
    #        "interface GigabitEthernet0/0/0/1",
    #        "no lldp destination mac-address ieee-nearest-bridge",
    #        "no lldp receive disable",
    #        "lldp transmit disable"
    # ]
    #
    #
    # "after": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "name": "GigabitEthernet0/0/0/1",
    #            "transmit": false
    #        },
    #        {
    #            "name": "GigabitEthernet0/0/0/2"
    #        }
    # ]
    #
    #
    # ------------
    # After state
    # ------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 13:22:25.604 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    #  lldp
    #   transmit disable
    #  !
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    # !
    #
    #

    # Using deleted
    #
    #
    # -------------
    # Before state
    # -------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 13:26:21.498 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    #  lldp
    #   receive disable
    #   destination mac-address
    #    ieee-nearest-bridge
    #   !
    #  !
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    #  lldp
    #   transmit disable
    #   destination mac-address
    #    ieee-nearest-non-tmpr-bridge
    #   !
    #  !
    # !
    #
    #

    - name: Delete LLDP configurations of all interfaces (Note - This won't delete the interfaces themselves)
      iosxr_lldp_interfaces:
        state: deleted

    #
    #
    #
    # ------------------------
    # Module Execution Result
    # ------------------------
    #
    #
    # "before": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/1",
    #            "receive": false
    #        },
    #        {
    #            "destination": {
    #                "mac_address": "ieee-nearest-non-tmpr-bridge"
    #            },
    #            "name": "GigabitEthernet0/0/0/2",
    #            "transmit": false
    #        }
    # ]
    #
    #
    # "commands": [
    #        "interface GigabitEthernet0/0/0/1",
    #        "no lldp destination mac-address ieee-nearest-bridge",
    #        "no lldp receive disable",
    #        "interface GigabitEthernet0/0/0/2",
    #        "no lldp destination mac-address ieee-nearest-non-tmpr-bridge",
    #        "no lldp transmit disable"
    # ]
    #
    #
    # "after": [
    #        {
    #            "name": "TenGigE0/0/0/0"
    #        },
    #        {
    #            "name": "GigabitEthernet0/0/0/1"
    #        },
    #        {
    #            "name": "GigabitEthernet0/0/0/2"
    #        }
    # ]
    #
    #
    # ------------
    # After state
    # ------------
    #
    #
    # RP/0/RP0/CPU0:ios#sh run int
    # Mon Aug 12 13:30:14.618 UTC
    # interface TenGigE0/0/0/0
    #  ipv4 address 192.0.2.11 255.255.255.192
    # !
    # interface preconfigure GigabitEthernet0/0/0/1
    # !
    # interface preconfigure GigabitEthernet0/0/0/2
    # !
    #
    #

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
after list | when changed | The configuration as structured data after module completion. Sample: The configuration returned will always be in the same format of the parameters above.
before list | always | The configuration as structured data prior to module invocation. Sample: The configuration returned will always be in the same format of the parameters above.
commands list | always | The set of commands pushed to the remote device. Sample: ['interface GigabitEthernet0/0/0/1', 'lldp destination mac-address ieee-nearest-non-tmpr-bridge', 'no lldp transmit disable']

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Network Team. [network]

### Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

### Authors

- Nilashish Chakraborty (@nilashishc)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.