dellemc.enterprise_sonic.sonic_ospf_area 模块 – 在 SONiC 上配置 OSPF 区域设置

注意

此模块是 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_ospf_area

dellemc.enterprise_sonic 2.5.0 中的新增功能

概要

  • 此模块提供在 SONiC 交换机上运行的 OSPF 的区域设置的配置。

参数

参数

注释

config

列表 / 元素=字典

指定 OSPFv2 区域的配置

area_id

字符串 / 必填

网络的区域 ID (A.B.C.D 或 0 到 4294967295)。

authentication_type

字符串

区域的身份验证类型

选项

  • "message_digest"

  • "text"

default_cost

整数

配置 NSSA 或 stub 区域摘要的默认成本

范围是 0 到 16777215(含)。

filter_list_in

字符串

区域间前缀过滤器列表。

过滤传入区域的前缀。

需要前缀列表的名称。

filter_list_out

字符串

区域间前缀过滤器列表。

过滤从区域传出的前缀。

需要前缀列表的名称。

networks

列表 / 元素=字符串

配置区域中的网络

是一个掩码 IP 地址

ranges

列表 / 元素=字典

在边界路由器上配置地址范围汇总

advertise

布尔值

启用地址范围广告

选项

  • false

  • true

cost

整数

配置地址范围的成本

范围是 0 到 16777215(含)。

prefix

字符串 / 必填

地址范围前缀

是一个掩码 IP 地址

substitute

字符串

为地址范围配置替代前缀

是一个掩码 IP 地址

shortcut

字符串

配置区域的快捷方式模式

选项

  • "default"

  • "disable"

  • "enable"

stub

字典

stub 类型区域的配置

enabled

布尔值

将区域配置为 stub 类型区域

选项

  • false

  • true

no_summary

布尔值

禁用将区域间路由注入 stub

选项

  • false

  • true

列表 / 元素=字典

虚拟链路的配置

字典

配置虚拟链路的身份验证设置

字符串

虚拟链路的身份验证类型

选项

  • "message_digest"

  • "text"

  • "none"

字符串

虚拟链路的文本身份验证密码

布尔值

密码已加密

选项

  • false

  • true

整数

配置邻接失效间隔

值为秒

范围是 1 到 65535(含)。

布尔值

启用虚拟链路

选项

  • false

  • true

整数

配置邻居 hello 间隔

值为秒

范围是 1 到 65535(含)。

列表 / 元素=字典

配置消息摘要身份验证密钥

对于删除,仅使用 key_id。

字符串

身份验证密码(删除时忽略)

布尔值

密码已加密(删除时忽略)

选项

  • false

  • true

整数 / 必填

消息摘要身份验证密钥 ID

范围是 1 到 255(含)。

整数

配置 LSA 重传间隔

值为秒

范围是 1 到 65535(含)。

字符串 / 必填

远程 ABR 的路由器 ID

IP 地址格式

整数

配置 LSA 传输延迟

值为秒

范围是 1 到 65535(含)。

vrf_name

字符串

此区域所属的 VRF 的名称

默认值: "default"

state

字符串

指定要在设备上执行的配置更新类型。

选项

  • "merged" ← (默认)

  • "replaced"

  • "overridden"

  • "deleted"

示例

# NOTE: Configuration of an OSPF network instance (VRF) is required before an OSPF "area" can
# be configured in association with that network instance (VRF).

# using merged to add or change ospf_area settings
    # merging all settings for an area
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: merge examples of all settings
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 2
            vrf_name: Vrf1
            authentication_type: message_digest
            default_cost: 3
            stub:
              enabled: True
              no_summary: True
            shortcut: default
          - area_id: 3
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            ranges:
            - prefix: 1.1.1.1/24
            - prefix: 1.1.1.2/24
              advertise: True
              cost: 4
            - prefix: 1.1.1.3/24
              advertise: False
              substitute: 2.2.2.2/24
            - prefix: 1.1.1.4/24
              advertise: True
              cost: 10
              substitute: 3.3.3.3/24
          - area_id: 4
            vrf_name: Vrf1
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
          - area_id: 5
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
            - router_id: 34.7.35.2
              enabled: True
              dead_interval: 10
              hello_interval: 30
              retransmit_interval: 40
              transmit_delay: 50
              authentication:
                auth_type: text
                key: "U2FsdGVkX197YJtZ/3Ac6n5kRIG/ZqeU1/wC0cVFyfU="
                key_encrypted: True
              message_digest_list:
              - key_id: 1
                key: "U2FsdGVkX1/wbqjMB7Lr+Mm3wY8+lCdaqUmG2rr9Adw="
                key_encrypted: True
              - key_id: 2
                key: "U2FsdGVkX18Czj9r8skDrg/wtpwTKKCQ8FXUehpCmHc="
                key_encrypted: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 default-cost 3
    #  area 0.0.0.2 shortcut default
    #  area 0.0.0.3 filter-list prefix pf1 in
    #  area 0.0.0.3 filter-list prefix pf2 out
    #  area 0.0.0.4
    #  area 0.0.0.5
    #  area 0.0.0.5 virtual-link 34.7.35.1
    #  area 0.0.0.5 virtual-link 34.7.35.2
    #  area 0.0.0.5 virtual-link 34.7.35.2 authentication
    #  area 0.0.0.5 virtual-link 34.7.35.2 authentication-key U2FsdGVkX197YJtZ/3Ac6n5kRIG/ZqeU1/wC0cVFyfU= encrypted
    #  area 0.0.0.5 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.5 virtual-link 34.7.35.2 hello-interval 30
    #  area 0.0.0.5 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.5 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.5 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX1/wbqjMB7Lr+Mm3wY8+lCdaqUmG2rr9Adw= encrypted
    #  area 0.0.0.5 virtual-link 34.7.35.2 message-digest-key 2 md5 U2FsdGVkX18Czj9r8skDrg/wtpwTKKCQ8FXUehpCmHc= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24
    #  area 0.0.0.3 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.3 range 1.1.1.3/24 not-advertise
    #  area 0.0.0.3 range 1.1.1.4/24 advertise cost 10
    #  area 0.0.0.3 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.4
    #  network 23.235.75.1/23 area 0.0.0.4
    #  network 3.5.1.5/23 area 0.0.0.4
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # minimum data for config subsections
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: merge smallest group of settings
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            networks:
            - 1.1.1.1/24
          - area_id: 0.0.0.3
            vrf_name: Vrf1
            ranges:
            - prefix: 1.1.1.1/24
          - area_id: 0.0.0.4
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
          - area_id: 0.0.0.5
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              message_digest_list:
              - key_id: 1
                key: grighr
  # NOTE: The existence of an 'area' is only displayed by this Ansible module if configuration options are
  # currently configured for that area. (An "area" that currently has no configured sub-options is not displayed.)

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.2
    #  area 0.0.0.3
    #  area 0.0.0.4
    #  area 0.0.0.5
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.5 virtual-link 34.7.35.1
    #  area 0.0.0.5 virtual-link 34.7.35.1 message-digest-key 1 md5 U2FsdGVkX19oCaX2HsxLR2nWtyK15AfE7ajHVjzgoaY= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24
    #  network 1.1.1.1/24 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # merging and making changes to attributes
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub no-summary
    #  area 0.0.0.1 default-cost 6
    #  area 0.0.0.1 filter-list prefix pf1 in
    #  area 0.0.0.1 filter-list prefix pf2 out
    #  area 0.0.0.1 shortcut disable
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 10
    #  area 0.0.0.1 virtual-link 1.1.1.2
    #  area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 34
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX1//fyBCsQYQI4q743L8Rf1Q1qUOEc75lNM= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 not-advertise
    #  area 0.0.0.1 range 1.1.1.2/24 advertise
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 1.1.1.2/24 area 0.0.0.1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test merge all settings"
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            authentication_type: text
            default_cost: 5
            filter_list_in: pf2
            filter_list_out: pf1
            networks:
            - 1.1.1.5/24
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
              cost: 12
              substitute: 11.11.1.1/24
            - prefix: 1.1.1.2/24
              advertise: False
            shortcut: enable
            stub:
              enabled: True
              no_summary: False
            virtual_links:
            - router_id: 1.1.1.1
              enabled: True
              dead_interval: 45
              hello_interval: 21
              retransmit_interval: 15
              transmit_delay: 23
              authentication:
                auth_type: text
                key: "U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ="
                key_encrypted: True
              message_digest_list:
              - key_id: 1
                key: "somepass"
            - router_id: 1.1.1.2
              dead_interval: 16

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication
    #  area 0.0.0.1 stub
    #  area 0.0.0.1 default-cost 5
    #  area 0.0.0.1 filter-list prefix pf2 in
    #  area 0.0.0.1 filter-list prefix pf1 out
    #  area 0.0.0.1 shortcut enable
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 45
    #  area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 21
    #  area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 15
    #  area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 23
    #  area 0.0.0.1 virtual-link 1.1.1.2
    #  area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 16
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX18D0swlrl3pVzMGxRZYzY58X06jPq2CrNU= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 12
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.11.1.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 not-advertise
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 1.1.1.2/24 area 0.0.0.1
    #  network 1.1.1.5/24 area 0.0.0.1
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # merging different keys
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test merge different keys"
        sonic_ospf_area:
          state: merged
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            virtual_links:
            - router_id: 1.1.1.1
              authentication:
                key: qwerty
                key_encrypted: False
            - router_id: 1.1.1.3
              authentication:
                key: "U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ="
                key_encrypted: True
            - router_id: 1.1.1.4
              authentication:
                key: somepass

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX180JKbs3Rf5IyLot8UW0/srcXdGaQXEHiw= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.3
    #  area 0.0.0.1 virtual-link 1.1.1.3 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.4
    #  area 0.0.0.1 virtual-link 1.1.1.4 authentication-key U2FsdGVkX1+2i/anKXKpEfwZIAkb1Hzkx1nH2IBnlMA= encrypted
    # !
    # router ospf vrf Vrf2
    # !
    # Note: the device automatically converts keys to encrypted format
# ----------


# using deleted to remove ospf settings
    # deleting all settings for areas
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub no-summary
    #  area 0.0.0.1 default-cost 6
    #  area 0.0.0.1 filter-list prefix pf1 in
    #  area 0.0.0.1 filter-list prefix pf2 out
    #  area 0.0.0.1 shortcut disable
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 shortcut disable
    #  area 0.0.0.3 shortcut default
    #  area 0.0.0.1 virtual-link 1.1.1.1
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication
    #  area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 10
    #  area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 10
    #  area 0.0.0.1 virtual-link 1.1.1.2
    #  area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 34
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX1//fyBCsQYQI4q743L8Rf1Q1qUOEc75lNM= encrypted
    #  area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 not-advertise
    #  area 0.0.0.1 range 1.1.1.2/24 advertise
    #  area 0.0.0.2 range 1.1.1.1/24 advertise
    #  area 0.0.0.3 range 1.1.4.6/24 cost 14
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 1.1.1.2/24 area 0.0.0.1
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test delete all settings for areas"
        sonic_ospf_area:
          state: deleted
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
            shortcut: disable
            stub:
              enabled: True
              no_summary: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.3 shortcut default
    #  area 0.0.0.3 range 1.1.4.6/24 cost 14
    # !
    # router ospf vrf Vrf2
    # !
    # -----


    # clearing subsections of config
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 shortcut default
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3 filter-list prefix pf1 in
    #  area 0.0.0.4
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.1 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 not-advertise
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test clear subsections"
        sonic_ospf_area:
          state: deleted
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            ranges: []
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            networks: []
          - area_id: 0.0.0.3
            vrf_name: Vrf1
            virtual_links: []
          - area_id: 4
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              authentication: {}
            - router_id: 34.7.35.2
              message_digest_list: []

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 shortcut default
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3 filter-list prefix pf1 in
    #  area 0.0.0.4
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    # !
    # router ospf vrf Vrf2
    # !
    # -----

    # deleting individual attributes
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 filter-list prefix pf1 in
    #  area 0.0.0.1 filter-list prefix pf2 out
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3
    #  area 0.0.0.4 stub no-summary
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 13
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24
    #  area 0.0.0.1 range 1.1.1.4/24 advertise cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "test clear subsections"
        sonic_ospf_area:
          state: deleted
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            ranges:
            - prefix: 1.1.1.1/24
            - prefix: 1.1.1.2/24
              cost: 4
            - prefix: 1.1.1.3/24
              substitute: 2.2.2.2/24
            - prefix: 1.1.1.4/24
              advertise: True
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
          - area_id: 3
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
            - router_id: 34.7.35.2
              enabled: True
              dead_interval: 10
              retransmit_interval: 40
              message_digest_list:
              - key_id: 1
              authentication:
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
          - area_id: 4
            vrf_name: Vrf1
            shortcut: default
            stub:
              enabled: True
              no_summary: True
          - area_id: 5
            vrf_name: Vrf1
            default_cost: 5
            stub:
              enabled: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1
    #  area 0.0.0.2
    #  area 0.0.0.3
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.2/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.4/24 cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 23.235.75.1/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
    # -----
# ----------


# using replaced
    # replace listed areas
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 filter-list prefix pf1 in
    #  area 0.0.0.1 filter-list prefix pf2 out
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3
    #  area 0.0.0.4 stub no-summary
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 13
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24
    #  area 0.0.0.1 range 1.1.1.4/24 advertise cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "replace areas"
        sonic_ospf_area:
          state: replaced
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
            default_cost: 5
            stub:
              enabled: True
              no_summary: False
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            shortcut: default
            default_cost: 3
            stub:
              enabled: True
              no_summary: True
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
          - area_id: 3
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
              substitute: 11.2.5.1/24
            - prefix: 1.1.1.2/24
              advertise: True
              cost: 4
            - prefix: 1.1.1.3/24
              advertise: True
              substitute: 2.5.3.78/24
          - area_id: 4
            vrf_name: Vrf1
            shortcut: default
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            - router_id: 34.7.35.2
              transmit_delay: 50
              enabled: True
              dead_interval: 10
              retransmit_interval: 40
              message_digest_list:
              - key_id: 1
                key: "U2FsdGVkX18mUZjlJL/Q/7vYtx2AUyDc+NcLKc/BOJUA="
                key_encrypted: True
              - key_id: 3
                key: "U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo="
                key_encrypted: True
              authentication:
                auth_type: message_digest
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub
    #  area 0.0.0.1 default-cost 5
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 default-cost 3
    #  area 0.0.0.2 filter-list prefix pf1 in
    #  area 0.0.0.2 filter-list prefix pf2 out
    #  area 0.0.0.2 shortcut default
    #  area 0.0.0.3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.4 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.4 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24 advertise
    #  area 0.0.0.3 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.3 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.3 range 1.1.1.3/24 advertise
    #  area 0.0.0.3 range 1.1.1.3/24 substitute 2.5.3.78/24
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 23.235.75.1/23 area 0.0.0.1
    #  network 3.5.1.5/23 area 0.0.0.1
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
# ----------


# using overridden
    # override listed areas
    # Before state:
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 filter-list prefix pf1 in
    #  area 0.0.0.1 filter-list prefix pf2 out
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.3
    #  area 0.0.0.4 stub no-summary
    #  area 0.0.0.4 default-cost 3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.5 stub
    #  area 0.0.0.5 default-cost 5
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.1 range 1.1.1.1/24 advertise cost 13
    #  area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.1 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.1 range 1.1.1.3/24 advertise
    #  area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24
    #  area 0.0.0.1 range 1.1.1.4/24 advertise cost 34
    #  area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !

    # example:
      - name: "override areas"
        sonic_ospf_area:
          state: overridden
          config:
          - area_id: 0.0.0.1
            vrf_name: Vrf1
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
            default_cost: 5
            stub:
              enabled: True
              no_summary: False
          - area_id: 0.0.0.2
            vrf_name: Vrf1
            filter_list_in: pf1
            filter_list_out: pf2
            shortcut: default
            default_cost: 3
            stub:
              enabled: True
              no_summary: True
            authentication_type: message_digest
            networks:
            - 1.1.1.1/24
            - 3.5.1.5/23
            - 23.235.75.1/23
          - area_id: 3
            vrf_name: Vrf1
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            ranges:
            - prefix: 1.1.1.1/24
              advertise: True
              substitute: 11.2.5.1/24
            - prefix: 1.1.1.2/24
              advertise: True
              cost: 4
            - prefix: 1.1.1.3/24
              advertise: True
              substitute: 2.5.3.78/24
          - area_id: 4
            vrf_name: Vrf1
            shortcut: default
            virtual_links:
            - router_id: 34.7.35.1
              enabled: True
              transmit_delay: 50
              hello_interval: 30
              authentication:
                auth_type: text
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True
            - router_id: 34.7.35.2
              transmit_delay: 50
              enabled: True
              dead_interval: 10
              retransmit_interval: 40
              message_digest_list:
              - key_id: 1
                key: "U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA="
                key_encrypted: True
              - key_id: 3
                key: "U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo="
                key_encrypted: True
              authentication:
                auth_type: message_digest
                key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ="
                key_encrypted: True

    # After state
    # sonic# show running-configuration ospf
    # router ospf vrf Vrf1
    #  area 0.0.0.1 authentication message-digest
    #  area 0.0.0.1 stub
    #  area 0.0.0.1 default-cost 5
    #  area 0.0.0.2 authentication message-digest
    #  area 0.0.0.2 stub no-summary
    #  area 0.0.0.2 default-cost 3
    #  area 0.0.0.2 filter-list prefix pf1 in
    #  area 0.0.0.2 filter-list prefix pf2 out
    #  area 0.0.0.2 shortcut default
    #  area 0.0.0.3
    #  area 0.0.0.4 shortcut default
    #  area 0.0.0.3 virtual-link 34.7.35.1
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.1
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication
    #  area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.1 hello-interval 30
    #  area 0.0.0.4 virtual-link 34.7.35.1 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication message-digest
    #  area 0.0.0.4 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10
    #  area 0.0.0.4 virtual-link 34.7.35.2 retransmit-interval 40
    #  area 0.0.0.4 virtual-link 34.7.35.2 transmit-delay 50
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted
    #  area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted
    #  area 0.0.0.3 range 1.1.1.1/24 advertise
    #  area 0.0.0.3 range 1.1.1.1/24 substitute 11.2.5.1/24
    #  area 0.0.0.3 range 1.1.1.2/24 advertise cost 4
    #  area 0.0.0.3 range 1.1.1.3/24 advertise
    #  area 0.0.0.3 range 1.1.1.3/24 substitute 2.5.3.78/24
    #  network 1.1.1.1/24 area 0.0.0.1
    #  network 23.235.75.1/23 area 0.0.0.1
    #  network 3.5.1.5/23 area 0.0.0.1
    #  network 1.1.1.1/24 area 0.0.0.2
    #  network 23.235.75.1/23 area 0.0.0.2
    #  network 3.5.1.5/23 area 0.0.0.2
    # !
    # router ospf vrf Vrf2
    # !
# ----------

返回值

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

描述

after

列表 / 元素=字符串

生成的配置模型调用。

返回:已更改时

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

before

列表 / 元素=字符串

模型调用之前的配置。

返回:始终返回

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

commands

列表 / 元素=字符串

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

返回:始终返回

示例: [{"config": "...", "state": "..."}, {"config": "...", "state": "..."}]

作者

  • 韩晓 (@Xiao_Han2)