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 Distribution 的设备提供 BGP bgp_communities 的配置管理。

注意

此模块具有相应的 操作插件

参数

参数

注释

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 Distribution 进行测试。

  • 支持 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

列表 / 元素=字符串

模块调用后的结果配置。

返回: 当更改时

示例: ["返回的配置始终与上面的参数格式相同。\n"]

before

列表 / 元素=字符串

模块调用前的配置。

返回: 始终

示例: ["返回的配置始终与上面的参数格式相同。\n"]

commands

列表 / 元素=字符串

推送到远程设备的一组命令。

返回: 始终

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

作者

  • Kumaraguru Narayanan (@nkumaraguru)