cisco.iosxr.iosxr_lldp_global 模块 – 配置 LLDP 的资源模块。

注意

此模块是 cisco.iosxr 集合 (版本 10.2.2) 的一部分。

如果您正在使用 ansible 软件包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install cisco.iosxr

要在剧本中使用它,请指定: cisco.iosxr.iosxr_lldp_global

cisco.iosxr 1.0.0 中的新增功能

概要

  • 此模块管理 IOS-XR 设备上的全局链路层发现协议 (LLDP) 设置。

参数

参数

注释

config

字典

提供的全局 LLDP 配置。

holdtime

整数

指定要在数据包中发送的保持时间(以秒为单位)。

reinit

整数

指定在任何接口上初始化 LLDP 的延迟(以秒为单位)。

subinterfaces

布尔值

启用或禁用子接口上的 LLDP。

选项

  • false

  • true

timer

整数

指定发送 LLDP 数据包的速率(以秒为单位)。

tlv_select

字典

指定要启用或禁用的 LLDP TLV。

management_address

布尔值

启用或禁用管理地址 TLV。

选项

  • false

  • true

port_description

布尔值

启用或禁用端口描述 TLV。

选项

  • false

  • true

system_capabilities

布尔值

启用或禁用系统功能 TLV。

选项

  • false

  • true

system_description

布尔值

启用或禁用系统描述 TLV。

选项

  • false

  • true

system_name

布尔值

启用或禁用系统名称 TLV。

选项

  • false

  • true

running_config

字符串

此选项仅与状态 *parsed* 一起使用。

此选项的值应为通过执行命令 **show running-config lldp** 从 IOS-XR 设备接收到的输出。

状态 *parsed* 从 running_config 选项读取配置并将其转换为 Ansible 结构化数据,然后该值将返回到结果中的 *parsed* 密钥中。

state

字符串

模块完成后的配置状态。

选项

  • "merged" ← (默认)

  • "replaced"

  • "deleted"

  • "parsed"

  • "gathered"

  • "rendered"

  • "overridden"

注释

注意

示例

# Using merged
#
#
# -------------
# Before State
# -------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run lldp
# Tue Aug  6 19:27:54.933 UTC
# % No such configuration item(s)
#
#

- name: Merge provided LLDP configuration with the existing configuration
  cisco.iosxr.iosxr_lldp_global:
    config:
      holdtime: 100
      reinit: 2
      timer: 3000
      subinterfaces: true
      tlv_select:
        management_address: false
        system_description: false
    state: merged

#
#
# ------------------------
# Module Execution Result
# ------------------------
#
#  "before": {}
#
#  "commands": [
#        "lldp subinterfaces enable",
#        "lldp holdtime 100",
#        "lldp reinit 2",
#        "lldp tlv-select system-description disable",
#        "lldp tlv-select management-address disable",
#        "lldp timer 3000"
#  ]
#
#  "after": {
#        "holdtime": 100,
#        "reinit": 2,
#        "subinterfaces": true,
#        "timer": 3000,
#        "tlv_select": {
#            "management_address": false,
#            "system_description": false
#        }
#  }
#
#
# ------------
# After state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run lldp
# Tue Aug  6 21:31:10.587 UTC
# lldp
#  timer 3000
#  reinit 2
#  subinterfaces enable
#  holdtime 100
#  tlv-select
#   management-address disable
#   system-description disable
#  !
# !
#
#


# Using replaced
#
#
# -------------
# Before State
# -------------
#
# RP/0/0/CPU0:an-iosxr#sh run lldp
# Tue Aug  6 21:31:10.587 UTC
# lldp
#  timer 3000
#  reinit 2
#  subinterfaces enable
#  holdtime 100
#  tlv-select
#   management-address disable
#   system-description disable
#  !
# !
#
#

- name: Replace existing LLDP device configuration with provided configuration
  cisco.iosxr.iosxr_lldp_global:
    config:
      holdtime: 100
      tlv_select:
        port_description: false
        system_description: true
        management_description: true
    state: replaced

#
#
# ------------------------
# Module Execution Result
# ------------------------
#
#  "before": {
#        "holdtime": 100,
#        "reinit": 2,
#        "subinterfaces": true,
#        "timer": 3000,
#        "tlv_select": {
#            "management_address": false,
#            "system_description": false
#        }
#  }
#
#  "commands": [
#        "no lldp reinit 2",
#        "no lldp subinterfaces enable",
#        "no lldp timer 3000",
#        "no lldp tlv-select management-address disable",
#        "no lldp tlv-select system-description disable",
#        "lldp tlv-select port-description disable"
#  ]
#
#  "after": {
#        "holdtime": 100,
#        "tlv_select": {
#            "port_description": false
#        }
#  }
#
#
# ------------
# After state
# ------------
#
# RP/0/0/CPU0:an-iosxr#sh run lldp
# Tue Aug  6 21:53:08.407 UTC
# lldp
#  holdtime 100
#  tlv-select
#   port-description disable
#  !
# !
#
#


# Using deleted
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run lldp
# Tue Aug  6 21:31:10.587 UTC
# lldp
#  timer 3000
#  reinit 2
#  subinterfaces enable
#  holdtime 100
#  tlv-select
#   management-address disable
#   system-description disable
#  !
# !
#
#

- name: Deleted existing LLDP configurations from the device
  cisco.iosxr.iosxr_lldp_global:
    state: deleted

#
#
# ------------------------
# Module Execution Result
# ------------------------
#
#  "before": {
#        "holdtime": 100,
#        "reinit": 2,
#        "subinterfaces": true,
#        "timer": 3000,
#        "tlv_select": {
#            "management_address": false,
#            "system_description": false
#        }
#  },
#
#  "commands": [
#        "no lldp holdtime 100",
#        "no lldp reinit 2",
#        "no lldp subinterfaces enable",
#        "no lldp timer 3000",
#        "no lldp tlv-select management-address disable",
#        "no lldp tlv-select system-description disable"
#  ]
#
#  "after": {}
#
#
# -----------
# After state
# -----------
#
# RP/0/0/CPU0:an-iosxr#sh run lldp
# Tue Aug  6 21:38:31.187 UTC
# lldp
# !
#
# Using parsed:

# parsed.cfg
# lldp
#  timer 3000
#  reinit 2
#  subinterfaces enable
#  holdtime 100
#  tlv-select
#   management-address disable
#   system-description disable
#  !
# !

- name: Convert lldp global config to argspec without connecting to the appliance
  cisco.iosxr.iosxr_lldp_global:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed

# ------------------------
# Module Execution Result
# ------------------------
# parsed:
#     holdtime: 100
#     reinit: 2
#     timer: 3000
#     subinterfaces: True
#     tlv_select:
#       management_address: False
#       system_description: False

# using gathered:

# Device config:
# lldp
#  timer 3000
#  reinit 2
#  subinterfaces enable
#  holdtime 100
#  tlv-select
#   management-address disable
#   system-description disable
#  !
# !

- name: Gather IOSXR lldp global configuration
  cisco.iosxr.iosxr_lldp_global:
    config:
    state: gathered


# ------------------------
# Module Execution Result
# ------------------------
# gathered:
#     holdtime: 100
#     reinit: 2
#     timer: 3000
#     subinterfaces: True
#     tlv_select:
#       management_address: False
#       system_description: False

# using rendered:

- name: Render platform specific commands from task input using rendered state
  cisco.iosxr.iosxr_lldp_global:
    config:
      holdtime: 100
      reinit: 2
      timer: 3000
      subinterfaces: true
      tlv_select:
        management_address: false
        system_description: false
    state: rendered

#
#
# ------------------------
# Module Execution Result
# ------------------------
#
#  "rendered": [
#        "lldp subinterfaces enable",
#        "lldp holdtime 100",
#        "lldp reinit 2",
#        "lldp tlv-select system-description disable",
#        "lldp tlv-select management-address disable",
#        "lldp timer 3000"
#  ]

返回值

公共返回值已记录在 此处,以下是此模块独有的字段

描述

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

列表 / 元素=字符串

推送到远程设备的命令集。

返回: 始终返回

示例: ["lldp subinterfaces enable", "lldp holdtime 100", "no lldp tlv-select management-address disable"]

作者

  • Nilashish Chakraborty (@NilashishC)