dellemc.enterprise_sonic.sonic_bgp_ext_communities 模块 – 管理 BGP 扩展 community-list 及其参数

注意

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

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

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

要在 playbook 中使用它,请指定:dellemc.enterprise_sonic.sonic_bgp_ext_communities

dellemc.enterprise_sonic 1.0.0 中的新增功能

概要

  • 此模块为运行 Dell Technologies Enterprise SONiC Distribution 的设备提供 BGP extcommunity-list 的配置管理。

注意

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

参数

参数

注释

config

列表 / 元素=字典

“bgp_extcommunity_list”配置的列表。

match

字符串

匹配任何/所有成员。

选择

  • "all"

  • "any" ← (默认)

members

字典

此 BGP 扩展 community 列表的成员。

regex

列表 / 元素=字符串

此 BGP 扩展 community 列表的成员。可以在此处提供正则表达式字符串。适用于扩展的 ext BGP community 类型。

route_origin

列表 / 元素=字符串

此 BGP 扩展 community 列表的成员。route_origin 的格式为 0..65535:0..65535 或 A.B.C.D:[1..65535] 格式。

route_target

列表 / 元素=字符串

此 BGP 扩展 community 列表的成员。route_target 的格式为 0..65535:0..65535 或 A.B.C.D:[1..65535] 格式。

name

字符串 / 必需

BGP 扩展 communitylist 的名称。

permit

布尔值

允许或拒绝此 community。

添加新的 ext-community-list 时的默认值为 False。

选择

  • false

  • true

type

字符串

它是标准还是扩展的 ext community_list 条目。

选择

  • "standard" ← (默认)

  • "expanded"

state

字符串

模块完成后的配置状态。

选择

  • "merged" ← (默认)

  • "deleted"

  • "replaced"

  • "overridden"

注释

注意

  • 已针对 Dell Technologies 的 Enterprise SONiC Distribution 进行测试。

  • 支持 check_mode

示例

# Using deleted

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201

- name: Deletes a BGP ext community member
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
      - name: test
        type: standard
        members:
          route_target:
          - 201:201
    state: deleted

# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#


# Using deleted

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102

- name: Deletes a single BGP extended community
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
      - name: test1
        members:
    state: deleted

# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
#


# Using deleted

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102

- name: Deletes all BGP extended communities
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
    state: deleted

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


# Using deleted

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102

- name: Deletes all members in a single BGP extended community
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
      - name: test1
        members:
          regex:
    state: deleted

# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
#


# Using merged

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102

- name: Adds new community list
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
      - name: test3
        type: standard
        match: any
        permit: true
        members:
          route_origin:
            - "301:301"
            - "401:401"
    state: merged

# After state:
# ------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102
# Standard extended community list test3:  match: ANY
#     permit soo:301:301
#     permit soo:401:401



# Using replaced

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102

- name: Replacing a single BGP extended community
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
      - name: test
        type: expanded
        permit: true
        match: all
        members:
          regex:
          - 301:302
    state: replaced

# After state:
# ------------
#
# show bgp ext-community-list
# Expanded extended community list test:  match: ALL
#     permit 301:302
# Expanded extended community list test1:   match: ALL
#     deny 101:102
#


# Using overridden

# Before state:
# -------------
#
# show bgp ext-community-list
# Standard extended community list test:  match: ANY
#     permit rt:101:101
#     permit rt:201:201
# Expanded extended community list test1:   match: ALL
#     deny 101:102


- name: Override the entire list of BGP extended community
  dellemc.enterprise_sonic.sonic_bgp_ext_communities:
    config:
      - name: test3
        type: expanded
        permit: true
        match: all
        members:
          regex:
          - 301:302
    state: overridden

# After state:
# ------------
#
# show bgp ext-community-list
# Expanded extended community list test3:  match: ALL
#     permit 301:302
#

返回值

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

描述

after

列表 / 元素=字符串

模块调用后的结果配置。

返回:当发生更改时

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

before

列表 / 元素=字符串

模块调用之前的配置。

返回:始终

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

commands

列表 / 元素=字符串

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

返回:始终

示例: ["命令 1", "命令 2", "命令 3"]

作者

  • Kumaraguru Narayanan (@nkumaraguru)