Spec-Zone.ru › Ansible

Модуль cisco.iosxr.iosxr_lldp_interfaces — Модуль ресурсов для настройки интерфейсов LLDP.

Примечание

Этот модуль является частью коллекции cisco.iosxr (версия 9.0.0).

Возможно, эта коллекция уже установлена, если вы используете пакет ansible. Она не включена в ansible-core. Чтобы проверить, установлена ли она, выполните ansible-galaxy collection list.

Для установки используйте: ansible-galaxy collection install cisco.iosxr.

Чтобы использовать её в playbook, укажите: cisco.iosxr.iosxr_lldp_interfaces.

Новая функция в cisco.iosxr 1.0.0

  • Описание
  • Параметры
  • Примечания
  • Примеры
  • Возвращаемые значения

Описание

  • Этот модуль управляет атрибутами протокола Link Layer Discovery Protocol (LLDP) интерфейсов на устройствах IOS-XR.

Псевдонимы: lldp_interfaces

Параметры

Параметр

Комментарии

config

список / элементы=словарь

Словарь параметров интерфейсов LLDP.

destination

словарь

Указывает конфигурацию назначения LLDP на интерфейсе.

mac_address

строка

Указывает MAC-адрес назначения LLDP на интерфейсе.

Варианты:

  • "ieee-nearest-bridge"
  • "ieee-nearest-non-tmpr-bridge"

name

строка

Имя/идентификатор интерфейса или Ether-Bundle.

receive

логическое

Включить/отключить прием LLDP на интерфейсе.

Варианты:

  • false
  • true

transmit

логическое

Включить/отключить передачу LLDP на интерфейсе.

Варианты:

  • false
  • true

running_config

строка

Этот параметр используется только со значением parsed.

Значение этого параметра должно соответствовать выводу устройства IOS-XR, полученному с помощью команды show running-config int.

Состояние parsed считывает конфигурацию из параметра running_config и преобразует ее в структурированные данные Ansible в соответствии с argspec модуля ресурса, а затем возвращает значение в ключе parsed в результате.

state

строка

Состояние конфигурации после завершения модуля.

Варианты:

  • "merged" ← (по умолчанию)
  • "replaced"
  • "overridden"
  • "deleted"
  • "parsed"
  • "rendered"
  • "gathered"

Примечания

Примечание

  • Этот модуль работает с соединением network_cli. См. параметры платформы IOS-XR.

Примеры

# 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
  cisco.iosxr.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
  cisco.iosxr.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
  cisco.iosxr.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)
  cisco.iosxr.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
# !
#
#
# Using parsed:
# parsed.cfg

# 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: Convert lacp interfaces config to argspec without connecting to the appliance
  cisco.iosxr.iosxr_lldp_interfaces:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed

# ------------------------
# Module Execution Result
# ------------------------

# parsed: [
#   - 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
#   ]

# Using gathered:
# Device config:

# 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: Gather IOSXR lldp interfaces configuration
  cisco.iosxr.iosxr_lldp_interfaces:
    config:
    state: gathered

# ------------------------
# Module Execution Result
# ------------------------

#   gathered:
#     - 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

# Using rendred:
- name: Render platform specific commands from task input using rendered state
  cisco.iosxr.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: rendered
# ------------------------
# Module Execution Result
# ------------------------

# "rendered": [
#        "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

список / элементы=строка

Конфигурация в виде структурированных данных после завершения модуля.

Возвращается: при изменении

Пример: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

before

список / элементы=строка

Конфигурация в виде структурированных данных до вызова модуля.

Возвращается: всегда

Пример: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

commands

список / элементы=строка

Набор команд, отправленных на удалённое устройство.

Возвращается: всегда

Пример: ["interface GigabitEthernet0/0/0/1", "lldp destination mac-address ieee-nearest-non-tmpr-bridge", "no lldp transmit disable"]

Авторы

  • Nilashish Chakraborty (@nilashishc)

Ссылки на коллекцию

  • Система отслеживания ошибок
  • Репозиторий (исходный код)

© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/cisco/iosxr/iosxr_lldp_interfaces_module.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API