dellemc.enterprise_sonic.sonic_bgp_communities 模块 – 管理 BGP 社区及其参数

注意

此模块是 dellemc.enterprise_sonic 集合 (版本 2.5.1) 的一部分。

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

要安装它,请使用: ansible-galaxy collection install dellemc.enterprise_sonic

要在剧本中使用它,请指定: dellemc.enterprise_sonic.sonic_bgp_communities

dellemc.enterprise_sonic 1.0.0 中的新增功能

概要

  • 此模块提供对运行戴尔科技公司 Enterprise SONiC 发行版的设备的 BGP bgp_communities 的配置管理。

注意

此模块具有相应的 action 插件

参数

参数

注释

config

列表 / 元素=字典

‘bgp_communities’ 配置的列表。

aann

字符串

社区编号 aa:nn 格式 0..65535:0..65535;适用于标准 BGP 社区类型。

local_as

布尔值

不要发送到本地 AS 外部(众所周知的社区);适用于标准 BGP 社区类型。

选项

  • false

  • true

match

字符串

匹配任何/所有成员。

选项

  • "ALL"

  • "ANY" ← (默认)

members

字典

此 BGP 社区列表的成员。

regex

列表 / 元素=字符串

此 BGP 社区列表的成员。可以在这里给出正则表达式字符串。适用于扩展的 BGP 社区类型。

name

字符串 / 必需

BGP 社区列表的名称。

no_advertise

布尔值

不要向任何对等体广播(众所周知的社区);适用于标准 BGP 社区类型。

选项

  • false

  • true

no_export

布尔值

不要导出到下一个 AS(众所周知的社区);适用于标准 BGP 社区类型。

选项

  • false

  • true

no_peer

布尔值

不要导出到下一个 AS(众所周知的社区);适用于标准 BGP 社区类型。

选项

  • false

  • true

permit

布尔值

允许或拒绝此社区。

添加新社区列表时的默认值为 False

选项

  • false

  • true

type

字符串

它是标准社区列表条目还是扩展社区列表条目。

选项

  • "standard" ← (默认)

  • "expanded"

state

字符串

模块完成后的配置状态。

选项

  • "merged" ← (默认)

  • "deleted"

  • "replaced"

  • "overridden"

注释

注意

  • 针对戴尔科技公司的 Enterprise SONiC 发行版进行了测试。

  • 支持 check_mode

示例

# Using deleted

# Before state:
# -------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302

- name: Delete a BGP community-list member
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
      - name: test1
        type: expanded
        permit: false
        members:
          regex:
          - 302
    state: deleted

# After state:
# ------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101


# Using deleted

# Before state:
# -------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302

- name: Delete a single BGP community-list
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
      - name: test
        type: standard
    state: deleted

# After state:
# ------------
#
# show bgp community-list
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302


# Using deleted

# Before state:
# -------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302

- name: Delete All BGP community-lists
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
    state: deleted

# After state:
# ------------
#
# show bgp community-list
#


# Using deleted

# Before state:
# -------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302

- name: Delete all members in a single BGP community-list
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
      - name: test1
        type: expanded
        members:
          regex:
    state: deleted

# After state:
# ------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer


# Using merged

# Before state:
# -------------
#
# show bgp community-list
# Expanded community list test1:   match: ANY
#     permit 101
#     permit 302

- name: Add a new BGP community-list
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
      - name: test2
        type: expanded
        permit: true
        members:
          regex:
          - 909
    state: merged

# After state:
# ------------
#
# show bgp community-list
# Expanded community list test1:   match: ANY
#     permit 101
#     permit 302
# Expanded community list test2:   match: ANY
#     permit 909


# Using replaced

# Before state:
# -------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302

- name: Replacing a single BGP community-list
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
      - name: test
        type: expanded
        members:
          regex:
          - 301
      - name: test3
        type: standard
        no_advertise: true
        no_peer: true
        permit: false
        match: ALL
    state: replaced

# After state:
# ------------
#
# show bgp community-list
# Expanded community list test:   match: ANY
#     deny 301
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302
# Standard community list test3:  match: ALL
#     deny no-advertise
#     deny no-peer


# Using overridden

# Before state:
# -------------
#
# show bgp community-list
# Standard community list test:  match: ANY
#     permit local-as
#     permit no-peer
# Expanded community list test1:   match: ANY
#     deny 101
#     deny 302

- name: Override entire BGP community-lists
  dellemc.enterprise_sonic.sonic_bgp_communities:
    config:
      - name: test3
        type: expanded
        members:
          regex:
          - 301
    state: overridden

# After state:
# ------------
#
# show bgp community-list
# Expanded community list test3:   match: ANY
#     deny 301

返回值

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

描述

after

列表 / 元素=字符串

模块调用后的结果配置。

返回:已更改时

示例: ["The configuration that is returned is always in the same format as the parameters above.\n"]

before

列表 / 元素=字符串

模块调用之前的配置。

返回:始终

示例: ["The configuration that is returned is always in the same format as the parameters above.\n"]

commands

列表 / 元素=字符串

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

返回:始终

示例: ["command 1", "command 2", "command 3"]

作者

  • Kumaraguru Narayanan (@nkumaraguru)