dellemc.enterprise_sonic.sonic_route_maps 模块 – 用于 SONiC 的路由映射配置处理
注意
此模块是 dellemc.enterprise_sonic 集合(版本 2.5.1)的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install dellemc.enterprise_sonic
。
要在剧本中使用它,请指定:dellemc.enterprise_sonic.sonic_route_maps
。
dellemc.enterprise_sonic 2.1.0 中的新增功能
概要
此模块为运行 SONiC 的设备上的路由映射参数提供配置管理。
参数
参数 |
注释 |
---|---|
指定路由映射配置字典的列表 |
|
路由映射的动作类型(permit 或 deny) 此值在创建和修改路由时是必需的 映射或路由映射属性以及删除路由映射时 属性。仅当请求删除 a 时才能省略 路由映射语句或给定路由的所有路由映射语句 映射 map_name。 选项
|
|
在执行当前路由映射的“match”和“set”后跳转到的路由映射的名称。 语句。 |
|
路由映射的名称 |
|
用于将路由映射匹配到路由的标准 |
|
已配置的 BGP AS 路径列表的名称,用于检查 与目标路由匹配 |
|
已配置的 BGP “community” 的名称,用于检查 与目标路由匹配 |
|
要检查的 BGP 以太网虚拟专用网络 与目标路由匹配 |
|
默认 EVPN type-5 路由 选项
|
|
非默认路由类型:以下之一 mac-ip 路由、EVPN Type 3 Inclusive Multicast Ethernet Tag (IMET) 路由或前缀路由 选项
|
|
VNI ID,用于检查匹配;由范围内的值指定 1-16777215 |
|
已配置的 BGP “扩展社区”的名称,用于检查 与目标路由匹配 |
|
下一个跃点接口名称(类型和编号),用于检查 与目标路由匹配。接口类型可以是任何 以下类型;“Ethernet/Eth”接口或子接口, “Loopback”接口、“PortChannel”接口或 子接口、“Vlan”接口。 |
|
要检查与以下项匹配的 IP 地址或 IP 下一跃点 目标路由 |
|
包含要检查的地址前缀列表的 IPv4 前缀列表的名称 与目标路由匹配 |
|
包含下一跃点列表的前缀列表的名称 与目标路由匹配 |
|
要检查与以下项匹配的 IPv6 地址 目标路由 |
|
包含地址列表的 IPv6 前缀列表的名称 与目标路由匹配 |
|
要检查与以下项匹配的本地首选项值 目标路由。这是范围 0-4294967295 内的值。 |
|
要检查与目标路由匹配的指标值。 这是范围 0-4294967295 内的值。 |
|
要检查与目标路由匹配的 BGP 源 选项
|
|
匹配路由所需的 BGP 路由对等/邻居 ip、ipv6 和 interface 是互斥的。 |
|
BGP 对等接口的名称(类型和编号) 允许的接口类型为以太网或 Eth(取决于 配置的接口命名模式), Vlan 和 Portchannel |
|
BGP 对等方的 IPv4 地址 |
|
BGP 对等方的 IPv6 地址 |
|
匹配路由所需的源协议 选项
|
|
匹配路由所需的源 VRF 的名称 |
|
匹配路由所需的标记值 该值必须在 1-4294967295 范围内 |
|
1-66535 范围内的唯一编号,用于指定映射的优先级 此值在创建和修改路由时是必需的 映射或路由映射属性以及删除路由映射时 属性。仅当请求删除所有 给定路由映射“map_name”的路由映射“语句”时,才能省略它。 |
|
要设置到匹配路由中以进行重新分配的信息 |
|
字符串,指定要添加到匹配路由中的 BGP AS 路径属性的前缀的 AS 路径编号的逗号分隔列表。 添加到匹配路由中的 BGP AS 路径属性。 列表中的 AS 路径值必须在范围内 1-4294967295;例如,2000,3000 |
|
字符串,指定包含要从匹配路由中删除的 BGP 社区值的 BGP 社区列表的名称。 BGP 社区值。 |
|
要添加到或替换匹配路由中 BGP 的 BGP 社区属性 社区属性。仅当其中一个 指定其他属性(“none”除外)时,才允许指定“additive”属性。 指定其他属性(“none”除外)。 它会导致将指定的“set community”属性 添加到匹配路由中已存在的社区 属性中。如果未指定“additive”属性 ,则匹配路由中先前存在的社区属性 将被配置的“set community”属性替换。 指定“none”的“set community”属性 与其他社区设置互斥 属性,并导致删除匹配项中的任何社区属性 路由。 |
|
一个或多个 BGP 社区属性的列表。允许的值 为以下内容 local_as 不要在本地 AS 之外发送(众所周知的社区) no_advertise 不要向任何对等方通告(众所周知的社区) no_export 不要导出到下一个 AS(众所周知的社区) no_peer 无需将路由通告给对等方。 (可以根据其他标准抑制路由的通告。) (可以根据其他标准抑制路由的通告。) additive 将配置的“set community”属性添加到 匹配路由(如果设置为“true”);先前存在的 匹配路由中的属性会被替换, 如果此属性未指定或设置为 'false',则会被 配置的属性替换。 无 不发送任何 community 属性。此属性 与其他所有 'set community' 属性互斥。 它会导致所有属性从匹配的路由中删除。 从匹配的路由中删除。 none 与所有其他属性互斥 local_as、no_advertise、no_export、no_peer、additive 和 additive。 选项
|
|
一个或多个 BGP community 编号的列表,格式为 AA:NN,其中 AA 和 NN 是范围内的整数 0-65535. 注意:列表中的每个 community 编号必须用双引号括起来, 以避免 YAML 解析错误,因为 列表值包含嵌入的 ':' 字符。 |
|
要设置到匹配路由中的 BGP 扩展 community 属性。 |
|
格式为的路由目标 VPN 扩展 community ASN:NN 或 IP-ADDRESS:NN 注意:列表中的每个 rt 值必须用引号括起来 以避免 YAML 解析错误,因为 列表值包含嵌入的 ':' 字符。 |
|
格式为的源站点 VPN 扩展 community ASN:NN 或 IP-ADDRESS:NN 注意:列表中的每个 rt 值必须用引号括起来 以避免 YAML 解析错误,因为 列表值包含嵌入的 ':' 字符。 |
|
要设置到匹配路由中的 IPv4 下一跳地址,格式为 点分十进制格式 A.B.C.D |
|
要设置到匹配路由中的 IPv6 下一跳地址属性 |
|
要设置到匹配路由中的 IPv6 全局下一跳地址,格式为 A::B |
|
如果此 Ansible 属性的值为 'true',则将相应的属性设置到匹配的路由中。 如果此 Ansible 属性的值为 'true',则将相应的属性设置到匹配的路由中。 该属性指示路由算法必须 如果全局下一跳地址和链路本地地址都存在,则优先使用全局下一跳地址 地址。 选项
|
|
BGP 本地首选项路径属性;整数值,范围为 0-4294967295 |
|
路由度量值操作 value 和 rtt_action 互斥。 |
|
使用往返时间 (rtt) 修改匹配路由的度量的操作; 使用往返时间 (rtt) 修改匹配路由的度量的操作;
rtt 值。
路由度量。
路由度量中减去。 选项
|
|
要设置到匹配路由中的度量值; 值范围为 0-4294967295 |
|
BGP 路由源;必须选择以下选项之一。 egp (外部;远程 EGP) igp (内部;本地 IGP) incomplete (未知源) 选项
|
|
要为匹配路由设置的标签值 该值必须在 1-4294967295 范围内 |
|
要为匹配路由设置的 BGP 权重:权重必须是 范围为 0-4294967295 的整数 |
|
指定要在设备上执行的配置更新类型。 对于 对于 对于 指定的项。 对于 指定的配置。 选项
|
注释
注意
支持
check_mode
。
示例
# Using "merged" state to create initial configuration
#
# Before state:
# -------------
#
# sonic# show running-configuration route-map
# sonic#
# (No configuration present)
#
# -------------
#
- name: Merge initial route_maps configuration
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
action: permit
sequence_num: 80
match:
as_path: bgp_as1
community: bgp_comm_list1
evpn:
default_route: true
vni: 735
ext_comm: bgp_ext_comm1
interface: Ethernet4
ip:
address: ip_pfx_list1
ipv6:
address: ipv6_pfx_list1
local_preference: 8000
metric: 400
origin: egp
peer:
ip: 10.20.30.40
source_protocol: bgp
source_vrf: Vrf1
tag: 7284
set:
as_path_prepend: 200,315,7135
comm_list_delete: bgp_comm_list2
community:
community_number:
- "35:58"
- "79:150"
- "308:650"
community_attributes:
- local_as
- no_advertise
- no_export
- no_peer
- additive
extcommunity:
rt:
- "30:40"
soo:
- "10.73.14.9:78"
ip_next_hop: 10.48.16.18
ipv6_next_hop:
global_addr: 30::30
prefer_global: true
local_preference: 635
metric:
metric_value: 870
origin: egp
weight: 93471
tag: 65
- map_name: rm1
action: deny
sequence_num: 3047
match:
evpn:
route_type: multicast
origin: incomplete
peer:
interface: Ethernet6
source_protocol: ospf
set:
metric:
rtt_action: add
origin: incomplete
- map_name: rm3
action: deny
sequence_num: 285
match:
evpn:
route_type: macip
origin: igp
peer:
ipv6: 87:95:15::53
source_protocol: connected
set:
community:
community_attributes:
- none
metric:
rtt_action: set
origin: igp
call: rm1
- map_name: rm4
action: permit
sequence_num: 480
match:
evpn:
route_type: prefix
source_protocol: static
set:
metric:
rtt_action: subtract
state: merged
# After state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as1
# match evpn default-route
# match evpn vni 735
# match ip address prefix-list ip_pfx_list1
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Ethernet4
# match community bgp_comm_list1
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match peer 10.20.30.40
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 200,315,7135
# set community 35:58 79:150 308:650 local-AS no-advertise no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric 870
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set ipv6 next-hop prefer-global
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match evpn route-type multicast
# match peer Ethernet6
# match source-protocol ospf
# match origin incomplete
# set metric +rtt
# set origin incomplete
# !
# route-map rm3 deny 285
# match evpn route-type macip
# call rm1
# match peer 87:95:15::53
# match source-protocol connected
# match origin igp
# set community none
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# ------------
# Using "merged" state to update and add configuration
#
# Before state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as1
# match evpn default-route
# match evpn vni 735
# match ip address prefix-list ip_pfx_list1
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Ethernet4
# match community bgp_comm_list1
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match peer 10.20.30.40
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 200,315,7135
# set community 35:58 79:150 308:650 local-AS no-advertise no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric 870
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set ipv6 next-hop prefer-global
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match evpn route-type multicast
# match peer Ethernet6
# match source-protocol ospf
# match origin incomplete
# set metric +rtt
# set origin incomplete
# !
# route-map rm3 deny 285
# match evpn route-type macip
# call rm1
# match peer 87:95:15::53
# match source-protocol connected
# match origin igp
# set community none
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# ------------
#
- name: Merge additional and modified route map configuration
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
action: permit
sequence_num: 80
match:
as_path: bgp_as2
community: bgp_comm_list3
evpn:
route_type: prefix
vni: 850
interface: Vlan7
ip:
address: ip_pfx_list2
next_hop: ip_pfx_list3
peer:
interface: Portchannel14
set:
as_path_prepend: 188,257
community:
community_number:
- "45:736"
ipv6_next_hop:
prefer_global: false
metric:
rtt_action: add
- map_name: rm1
action: deny
sequence_num: 3047
match:
as_path: bgp_as3
ext_comm: bgp_ext_comm2
origin: igp
set:
metric:
rtt_action: subtract
- map_name: rm2
action: permit
sequence_num: 100
match:
interface: Ethernet16
set:
as_path_prepend: 200,300,400
ipv6_next_hop:
global_addr: 37::58
prefer_global: true
metric: 8000
- map_name: rm3
action: deny
sequence_num: 285
match:
local_preference: 14783
source_protocol: bgp
set:
community:
community_attributes:
- no_advertise
state: merged
# After state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn default-route
# match evpn route-type prefix
# match evpn vni 850
# match ip address prefix-list ip_pfx_list2
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community 35:58 79:150 308:650 45:736 local-AS no-advertise no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match as-path bgp_as3
# match evpn route-type multicast
# match ext-community bgp_ext_comm2
# match peer Ethernet6
# match source-protocol ospf
# match origin igp
# set metric -rtt
# set origin incomplete
# !
# route-map rm2 permit 100
# match interface Ethernet16
# set as-path prepend 200,300,400
# set ipv6 next-hop global 37::58
# set ipv6 next-hop prefer-global
# set metric 8000
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# Using "replaced" state to replace the contents of a list
#
# Before state:
# ------------
#
# sonic(config-route-map)# do show running-configuration route-map rm1 80
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn default-route
# match evpn route-type prefix
# match evpn vni 850
# match ip address prefix-list ip_pfx_list2
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community 35:58 79:150 308:650 45:736 local-AS no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# ------------
- name: Replace a list
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
action: permit
sequence_num: 80
set:
community:
community_number:
- "15:30"
- "26:54"
state: replaced
# After state:
# ------------
#
# sonic#show running-configuration route-map rm1 80
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn default-route
# match evpn route-type prefix
# match evpn vni 850
# match ip address prefix-list ip_pfx_list2
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community 15:30 26:54 local-AS no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# Using "replaced" state to replace the contents of dictionaries
#
# Before state:
# ------------
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn default-route
# match evpn route-type prefix
# match evpn vni 850
# match ip address prefix-list ip_pfx_list2
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community 15:30 26:54 local-AS no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match as-path bgp_as3
# match evpn route-type multicast
# match ext-community bgp_ext_comm2
# match peer Ethernet6
# match source-protocol ospf
# match origin igp
# set metric -rtt
# set origin incomplete
# !
# route-map rm2 permit 100
# match interface Ethernet16
# set as-path prepend 200,300,400
# set ipv6 next-hop global 37::58
# set ipv6 next-hop prefer-global
# set metric 8000
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# ------------
- name: Replace dictionaries
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
action: permit
sequence_num: 80
match:
evpn:
route_type: multicast
ip:
address: ip_pfx_list1
set:
community:
community_attributes:
- no_advertise
extcommunity:
rt:
- "20:20"
- map_name: rm2
action: permit
sequence_num: 100
set:
ipv6_next_hop:
global_addr: 45::90
state: replaced
# After state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn route-type multicast
# match ip address prefix-list ip_pfx_list1
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community no-advertise
# set extcommunity rt 20:20
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match as-path bgp_as3
# match evpn route-type multicast
# match ext-community bgp_ext_comm2
# match peer Ethernet6
# match source-protocol ospf
# match origin igp
# set metric -rtt
# set origin incomplete
# !
# route-map rm2 permit 100
# match interface Ethernet16
# set as-path prepend 200,300,400
# set metric 8000
# set ipv6 next-hop global 45::90
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# Using "overridden" state to override all existing configuration with new
# configuration
#
# Before state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn route-type multicast
# match ip address prefix-list ip_pfx_list1
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community no-advertise
# set extcommunity rt 30:40
# set extcommunity rt 20:20
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match as-path bgp_as3
# match evpn route-type multicast
# match ext-community bgp_ext_comm2
# match peer Ethernet6
# match source-protocol ospf
# match origin igp
# set metric -rtt
# set origin incomplete
# !
# route-map rm2 permit 100
# match interface Ethernet16
# set as-path prepend 200,300,400
# set metric 8000
# set ipv6 next-hop global 45::90
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# ------------
- name: Override all route map configuration with new configuration
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm5
action: permit
sequence_num: 250
match:
interface: Ethernet28
set:
as_path_prepend: 150,275
metric: 7249
state: overridden
# After state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm5 permit 250
# match interface Ethernet28
# set as-path prepend 150,275
# set metric 7249
# Using "overridden" state to override all existing configuration with new
# configuration. (Restore previous configuration.)
#
# Before state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm5 permit 250
# match interface Ethernet28
# set as-path prepend 150,275
# set metric 7249
# ------------
- name: Override (restore) all route map configuration with older configuration
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
action: permit
sequence_num: 80
match:
as_path: bgp_as2
community: bgp_comm_list3
evpn:
default_route: true
route_type: prefix
vni: 850
ext_comm: bgp_ext_comm1
interface: Vlan7
ip:
address: ip_pfx_list2
next_hop: ip_pfx_list3
ipv6:
address: ipv6_pfx_list1
local_preference: 8000
metric: 400
origin: egp
peer:
interface: Portchannel14
source_protocol: bgp
source_vrf: Vrf1
tag: 7284
set:
as_path_prepend: 188,257
comm_list_delete: bgp_comm_list2
community:
community_number:
- "35:58"
- "79:150"
- "308:650"
- "45:736"
community_attributes:
- local_as
- no_export
- no_peer
- additive
extcommunity:
rt:
- "30:40"
soo:
- "10.73.14.9:78"
ip_next_hop: 10.48.16.18
ipv6_next_hop:
global_addr: 30::30
local_preference: 635
metric:
rtt_action: add
origin: egp
weight: 93471
tag: 65
- map_name: rm1
action: deny
sequence_num: 3047
match:
as_path: bgp_as3
evpn:
route_type: multicast
ext_comm: bgp_ext_comm2
origin: igp
peer:
interface: Ethernet6
source_protocol: ospf
set:
metric:
rtt_action: subtract
origin: incomplete
- map_name: rm2
action: permit
sequence_num: 100
match:
interface: Ethernet16
set:
as_path_prepend: 200,300,400
ipv6_next_hop:
global_addr: 37::58
prefer_global: true
metric: 8000
- map_name: rm3
action: deny
sequence_num: 285
match:
evpn:
route_type: macip
origin: igp
peer:
ipv6: 87:95:15::53
local_preference: 14783
source_protocol: bgp
set:
community:
community_attributes:
- no_advertise
metric:
rtt_action: set
origin: igp
call: rm1
- map_name: rm4
action: permit
sequence_num: 480
match:
evpn:
route_type: prefix
source_protocol: static
set:
metric:
rtt_action: subtract
state: overridden
# After state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn default-route
# match evpn route-type prefix
# match evpn vni 850
# match ip address prefix-list ip_pfx_list2
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community 35:58 79:150 308:650 45:736 local-AS no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match as-path bgp_as3
# match evpn route-type multicast
# match ext-community bgp_ext_comm2
# match peer Ethernet6
# match source-protocol ospf
# match origin igp
# set metric -rtt
# set origin incomplete
# !
# route-map rm2 permit 100
# match interface Ethernet16
# set as-path prepend 200,300,400
# set ipv6 next-hop global 37::58
# set ipv6 next-hop prefer-global
# set metric 8000
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# Using "deleted" state to remove configuration
#
# Before state:
# ------------
#
# sonic# show running-configuration route-map rm1 80
# !
# route-map rm1 permit 80
# match as-path bgp_as2
# match evpn default-route
# match evpn route-type prefix
# match evpn vni 850
# match ip address prefix-list ip_pfx_list2
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match community bgp_comm_list3
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set as-path prepend 188,257
# set community 35:58 79:150 308:650 45:736 local-AS no-export no-peer additive
# set extcommunity rt 30:40
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# ------------
- name: Delete selected route map configuration
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
action: permit
sequence_num: 80
match:
as_path: bgp_as2
community: bgp_comm_list3
evpn:
vni: 850
ip:
address: ip_pfx_list2
set:
as_path_prepend: 188,257
community:
community_number:
- "35:58"
community_attributes:
- local_as
extcommunity:
rt:
- "30:40"
state: deleted
# After state:
# ------------
#
# sonic# show running-configuration route-map rm1 80
# !
# route-map rm1 permit 80
# match evpn default-route
# match evpn route-type prefix
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set community 79:150 308:650 45:736 no-export no-peer additive
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# Using "deleted" state to remove a route map or route map subset
#
# Before state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match evpn default-route
# match evpn route-type prefix
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set community 79:150 308:650 45:736 no-export no-peer additive
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm1 deny 3047
# match as-path bgp_as3
# match evpn route-type multicast
# match ext-community bgp_ext_comm2
# match peer Ethernet6
# match source-protocol ospf
# match origin igp
# set metric -rtt
# set origin incomplete
# !
# route-map rm2 permit 100
# match interface Ethernet16
# set as-path prepend 200,300,400
# set metric 8000
# set ipv6 next-hop prefer-global
# set ipv6 next-hop global 37::58
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# ------------
- name: Delete a route map subset or a route map
dellemc.enterprise_sonic.sonic_route_maps:
config:
- map_name: rm1
sequence_num: 3047
- map_name: rm2
state: deleted
# After state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match evpn default-route
# match evpn route-type prefix
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set community 79:150 308:650 45:736 no-export no-peer additive
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# Using "deleted" state to remove all route map configuration
#
# Before state:
# ------------
#
# sonic# show running-configuration route-map
# !
# route-map rm1 permit 80
# match evpn default-route
# match evpn route-type prefix
# match ipv6 address prefix-list ipv6_pfx_list1
# match interface Vlan7
# match ext-community bgp_ext_comm1
# match tag 7284
# match local-preference 8000
# match source-vrf Vrf1
# match ip next-hop prefix-list ip_pfx_list3
# match peer PortChannel 14
# match source-protocol bgp
# match metric 400
# match origin egp
# set community 79:150 308:650 45:736 no-export no-peer additive
# set extcommunity soo 10.73.14.9:78
# set comm-list bgp_comm_list2 delete
# set metric +rtt
# set ip next-hop 10.48.16.18
# set ipv6 next-hop global 30::30
# set local-preference 635
# set origin egp
# set weight 93471
# set tag 65
# !
# route-map rm3 deny 285
# match evpn route-type macip
# match local-preference 14783
# call rm1
# match peer 87:95:15::53
# match source-protocol bgp
# match origin igp
# set community no-advertise
# set metric rtt
# set origin igp
# !
# route-map rm4 permit 480
# match evpn route-type prefix
# match source-protocol static
# set metric -rtt
# ------------
- name: Delete all route map configuration
dellemc.enterprise_sonic.sonic_route_maps:
config: []
state: deleted
# After state:
# ------------
#
# sonic# show running-configuration route-map
# sonic#
# (no route map configuration present)
返回值
通用返回值记录在此处,以下是此模块特有的字段
键 |
描述 |
---|---|
生成的配置模块调用。 返回:当更改时 示例: |
|
生成的配置模块调用。 返回:当 示例: |
|
模块调用之前的配置。 返回:总是 示例: |
|
推送到远程设备的命令集。 返回:总是 示例: |