cisco.iosxr.iosxr_lacp_interfaces 模块 – 配置 LACP 接口的资源模块。

注意

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

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

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

要在 playbook 中使用它,请指定: cisco.iosxr.iosxr_lacp_interfaces

cisco.iosxr 1.0.0 中的新增功能

概要

  • 此模块管理 IOS-XR 设备上接口的链路聚合控制协议 (LACP) 属性。

参数

参数

注释

config

列表 / 元素=字典

LACP 接口选项的字典。

churn_logging

字符串

指定 LACP 抖动事件日志记录的参数。

仅对以太网捆绑有效。

模式“actor”仅记录 actor 抖动事件。

模式“partner”仅记录 partner 抖动事件。

模式“both”仅记录 actor 和 partner 抖动事件。

选项

  • "actor"

  • "partner"

  • "both"

collector_max_delay

整数

指定要向 LACP 伙伴发信号的收集器最大延迟。

仅对以太网捆绑有效。

有关有效值,请参阅供应商文档。

name

字符串

接口或以太网捆绑的名称/标识符。

period

整数

指定发送或接收数据包的速率。

对于以太网捆绑,这指定其成员链路将使用的周期。

有关有效值,请参阅供应商文档。

switchover_suppress_flaps

整数

指定在 LACP 切换期间抑制抖动的时长。

仅对以太网捆绑有效。

有关有效值,请参阅供应商文档。

system

字典

此字典对象包含与以太网捆绑的 LACP 系统参数相关的可配置选项。

mac

字符串

指定在捆绑的 LACP 协商中使用的系统 ID,编码为 MAC 地址。

priority

整数

指定在捆绑的 LACP 协商中使用的系统优先级。

有关有效值,请参阅供应商文档。

running_config

字符串

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

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

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

state

字符串

模块完成后的配置状态。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

  • "parsed"

  • "gathered"

  • "rendered"

备注

注意

示例

# Using merged
#
#
# ------------
# Before state
# ------------
#
#
#
# RP/0/0/CPU0:an-iosxr#sh running-config interface
# Sun Jul 21 18:01:35.079 UTC
# interface Bundle-Ether10
# !
# interface Bundle-Ether11
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1'
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#
#

- name: Merge provided configuration with device configuration
  cisco.iosxr.iosxr_lacp_interfaces:
    config:
      - name: Bundle-Ether10
        churn_logging: actor
        collector_max_delay: 100
        switchover_suppress_flaps: 500
      - name: Bundle-Ether11
        system:
          mac: 00c2.4c00.bd15
      - name: GigabitEthernet0/0/0/1
        period: 200
    state: merged


#
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Jul 21 18:24:52.413 UTC
# interface Bundle-Ether10
#  lacp churn logging actor
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Bundle-Ether11
#  lacp system mac 00c2.4c00.bd15
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  lacp period 200
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#


# Using replaced
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Jul 21 18:24:52.413 UTC
# interface Bundle-Ether10
#  lacp churn logging actor
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Bundle-Ether11
#  lacp system mac 00c2.4c00.bd15
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  lacp period 200
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#

- name: Replace LACP configuration of listed interfaces with provided configuration
  cisco.iosxr.iosxr_lacp_interfaces:
    config:
      - name: Bundle-Ether10
        churn_logging: partner
      - name: GigabitEthernet0/0/0/2
        period: 300
    state: replaced


#
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Jul 21 18:50:21.929 UTC
# interface Bundle-Ether10
#  lacp churn logging partner
# !
# interface Bundle-Ether11
#  lacp system mac 00c2.4c00.bd15
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  lacp period 200
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  lacp period 300
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#
#


# Using overridden
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Jul 21 18:24:52.413 UTC
# interface Bundle-Ether10
#  lacp churn logging actor
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Bundle-Ether11
#  lacp system mac 00c2.4c00.bd15
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  lacp period 200
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  lacp period 200
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#
#

- name: Override all interface LACP configuration with provided configuration
  cisco.iosxr.iosxr_lacp_interfaces:
    config:
      - name: Bundle-Ether12
        churn_logging: both
        collector_max_delay: 100
        switchover_suppress_flaps: 500
      - name: GigabitEthernet0/0/0/1
        period: 300
    state: overridden


#
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:an-iosxr(config-if)#do sh run int
# Sun Jul 21 19:32:36.115 UTC
# interface Bundle-Ether10
# !
# interface Bundle-Ether11
# !
# interface Bundle-Ether12
#  lacp churn logging both
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  lacp period 300
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#


# Using deleted
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Jul 21 18:24:52.413 UTC
# interface Bundle-Ether10
#  lacp churn logging actor
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Bundle-Ether11
#  lacp non-revertive
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  lacp period 200
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#   lacp period 300
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#

- name: >-
    Deleted LACP configurations of provided interfaces (Note - This won't delete
    the interface itself)
  cisco.iosxr.iosxr_lacp_interfaces:
    config:
      - name: Bundle-Ether10
      - name: Bundle-Ether11
      - name: GigabitEthernet0/0/0/1
      - name: GigabitEthernet0/0/0/2
    state: deleted


#
#
# -----------
# After state
# -----------
#
#
# Using parsed:

# parsed.cfg
# interface Bundle-Ether10
#  lacp churn logging actor
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Bundle-Ether11
#  lacp system mac 00c2.4c00.bd15
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  lacp period 200
# !
#

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

# --------------
# Output:
# --------------

#    parsed:
#      - name: Bundle-Ether10
#        churn_logging: actor
#        collector_max_delay: 100
#        switchover_suppress_flaps: 500
#
#      - name: Bundle-Ether11
#        system:
#          mac: 00c2.4c00.bd15
#
#      - name: GigabitEthernet0/0/0/1
#        period: 200
#
#

# Using gathered:

# Native config:
# interface Bundle-Ether10
#  lacp churn logging actor
#  lacp switchover suppress-flaps 500
#  lacp collector-max-delay 100
# !
# interface Bundle-Ether11
#  lacp system mac 00c2.4c00.bd15
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  lacp period 200
# !
#

- name: Gather IOSXR lacp interfaces configuration
  cisco.iosxr.iosxr_lacp_interfaces:
    config:
    state: gathered

# ----------
# Output
# ---------
#    gathered:
#      - name: Bundle-Ether10
#        churn_logging: actor
#        collector_max_delay: 100
#        switchover_suppress_flaps: 500
#
#      - name: Bundle-Ether11
#        system:
#          mac: 00c2.4c00.bd15
#
#      - name: GigabitEthernet0/0/0/1
#        period: 200

# Using rendered:

- name: Render platform specific commands from task input using rendered state
  cisco.iosxr.iosxr_lacp_interfaces:
    config:
      - name: Bundle-Ether10
        churn_logging: actor
        collector_max_delay: 100
        switchover_suppress_flaps: 500
      - name: Bundle-Ether11
        system:
          mac: 00c2.4c00.bd15
      - name: GigabitEthernet0/0/0/1
        period: 200
    state: rendered


# -------------
# Output
# -------------
# rendered: [
#     - "interface Bundle-Ether10"
#     - " lacp churn logging actor"
#     - " lacp switchover suppress-flaps 500"
#     - " lacp collector-max-delay 100"
#     - "interface Bundle-Ether11"
#     - " lacp system mac 00c2.4c00.bd15"
#     - "interface MgmtEth0/0/CPU0/0"
#     - " ipv4 address 192.0.2.11 255.255.255.0"
#     - "interface GigabitEthernet0/0/0/1"
#     - " lacp period 200"
#

返回值

常用的返回值已在 此处 记录,以下是此模块特有的字段

描述

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 Bundle-Ether10", "lacp churn logging partner", "lacp period 150"]

作者

  • Nilashish Chakraborty (@nilashishc)