| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
""" |
| 8 |
The module file for sonic_route_maps |
| 9 |
""" |
| 10 |
|
| 11 |
from __future__ import absolute_import, division, print_function |
| 12 |
__metaclass__ = type |
| 13 |
|
| 14 |
|
| 15 |
DOCUMENTATION = """ |
| 16 |
--- |
| 17 |
module: sonic_route_maps |
| 18 |
version_added: "2.1.0" |
| 19 |
author: "Kerry Meyer (@kerry-meyer)" |
| 20 |
notes: |
| 21 |
- Supports C(check_mode). |
| 22 |
short_description: route map configuration handling for SONiC |
| 23 |
description: |
| 24 |
- This module provides configuration management for route map parameters on devices running SONiC. |
| 25 |
options: |
| 26 |
config: |
| 27 |
description: |
| 28 |
- Specifies a list of route map configuration dictionaries |
| 29 |
type: list |
| 30 |
elements: dict |
| 31 |
suboptions: |
| 32 |
map_name: |
| 33 |
description: |
| 34 |
- Name of a route map |
| 35 |
type: str |
| 36 |
required: true |
| 37 |
action: |
| 38 |
description: |
| 39 |
- action type for the route map (permit or deny) |
| 40 |
- This value is required for creation and modification of a route |
| 41 |
- map or route map attributes as well as for deletion of route map |
| 42 |
- attributes. It can be omitted only when requesting deletion of a |
| 43 |
- route map statement or all route map statements for a given route |
| 44 |
- map map_name. |
| 45 |
type: str |
| 46 |
choices: |
| 47 |
- permit |
| 48 |
- deny |
| 49 |
sequence_num: |
| 50 |
description: |
| 51 |
- "unique number in the range 1-66535 to specify priority of the map" |
| 52 |
- This value is required for creation and modification of a route |
| 53 |
- map or route map attributes as well as for deletion of route map |
| 54 |
- attributes. It can be omitted only when requesting deletion of all |
| 55 |
- route map "statements" for a given route map "map_name". |
| 56 |
type: int |
| 57 |
match: |
| 58 |
description: Criteria for matching the route map to a route |
| 59 |
type: dict |
| 60 |
suboptions: |
| 61 |
as_path: |
| 62 |
description: |
| 63 |
- Name of a configured BGP AS path list to be checked for |
| 64 |
- a match with the target route |
| 65 |
type: str |
| 66 |
community: |
| 67 |
description: |
| 68 |
- Name of a configured BGP "community" to be checked for |
| 69 |
- a match with the target route |
| 70 |
type: str |
| 71 |
evpn: |
| 72 |
description: |
| 73 |
- BGP Ethernet Virtual Private Network to be checked for |
| 74 |
- a match with the target route |
| 75 |
type: dict |
| 76 |
suboptions: |
| 77 |
default_route: |
| 78 |
description: |
| 79 |
- "Default EVPN type-5 route" |
| 80 |
type: bool |
| 81 |
route_type: |
| 82 |
description: |
| 83 |
- "Non-default route type: One of the following:" |
| 84 |
- "mac-ip route, EVPN Type 3 Inclusive Multicast Ethernet" |
| 85 |
- Tag (IMET) route, or prefix route |
| 86 |
type: str |
| 87 |
choices: |
| 88 |
- macip |
| 89 |
- multicast |
| 90 |
- prefix |
| 91 |
vni: |
| 92 |
description: |
| 93 |
- VNI ID to be checked for a match; specified by a value in the |
| 94 |
- "range 1-16777215" |
| 95 |
type: int |
| 96 |
ext_comm: |
| 97 |
description: |
| 98 |
- Name of a configured BGP 'extended community' to be checked for |
| 99 |
- a match with the target route |
| 100 |
type: str |
| 101 |
interface: |
| 102 |
description: |
| 103 |
- Next hop interface name (type and number) to be checked for a |
| 104 |
- match with the target route. The interface type can be any |
| 105 |
- "of the following; 'Ethernet/Eth' interface or sub-interface," |
| 106 |
- "'Loopback' interface, 'PortChannel' interface or" |
| 107 |
- "sub-interface, 'Vlan' interface." |
| 108 |
type: str |
| 109 |
ip: |
| 110 |
description: |
| 111 |
- IP addresses or IP next hops to be checked for a match with the |
| 112 |
- target route |
| 113 |
type: dict |
| 114 |
suboptions: |
| 115 |
address: |
| 116 |
description: |
| 117 |
- name of an IPv4 prefix list containing a list of address |
| 118 |
- prefixes to be checked for a match with the target route |
| 119 |
type: str |
| 120 |
next_hop: |
| 121 |
description: |
| 122 |
- "name of a prefix list containing a list of next-hop" |
| 123 |
- prefixes to be checked for a match with the target route |
| 124 |
type: str |
| 125 |
ipv6: |
| 126 |
description: |
| 127 |
- IPv6 addresses to be checked for a match with the |
| 128 |
- target route |
| 129 |
type: dict |
| 130 |
suboptions: |
| 131 |
address: |
| 132 |
description: |
| 133 |
- name of an IPv6 prefix list containing a list of address |
| 134 |
- prefixes to be checked for a match with the target route |
| 135 |
type: str |
| 136 |
required: true |
| 137 |
local_preference: |
| 138 |
description: |
| 139 |
- "local-preference value to be checked for a match with the" |
| 140 |
- "target route. This is a value in the range 0-4294967295." |
| 141 |
type: int |
| 142 |
metric: |
| 143 |
description: |
| 144 |
- metric value to be checked for a match with the target route. |
| 145 |
- "This is a value in the range 0-4294967295." |
| 146 |
type: int |
| 147 |
origin: |
| 148 |
description: |
| 149 |
- BGP origin to be checked for a match with the target route |
| 150 |
type: str |
| 151 |
choices: |
| 152 |
- egp |
| 153 |
- igp |
| 154 |
- incomplete |
| 155 |
peer: |
| 156 |
description: |
| 157 |
- BGP routing peer/neighbor required for a matching route |
| 158 |
- I(ip), I(ipv6), and I(interface) are mutually exclusive. |
| 159 |
type: dict |
| 160 |
suboptions: |
| 161 |
ip: |
| 162 |
description: IPv4 address of a BGP peer |
| 163 |
type: str |
| 164 |
ipv6: |
| 165 |
description: IPv6 address of a BGP peer |
| 166 |
type: str |
| 167 |
interface: |
| 168 |
description: |
| 169 |
- Name (type and number) of a BGP peer interface |
| 170 |
- Allowed interface types are Ethernet or Eth (depending |
| 171 |
- "on the configured interface-naming mode)," |
| 172 |
- Vlan, and Portchannel |
| 173 |
type: str |
| 174 |
source_protocol: |
| 175 |
description: Source protocol required for a matching route |
| 176 |
type: str |
| 177 |
choices: |
| 178 |
- bgp |
| 179 |
- connected |
| 180 |
- ospf |
| 181 |
- static |
| 182 |
source_vrf: |
| 183 |
description: Name of the source VRF required for a matching route |
| 184 |
type: str |
| 185 |
tag: |
| 186 |
description: |
| 187 |
- Tag value required for a matching route |
| 188 |
- "The value must be in the range 1-4294967295" |
| 189 |
type: int |
| 190 |
set: |
| 191 |
description: "Information to set into a matching route for re-distribution" |
| 192 |
type: dict |
| 193 |
suboptions: |
| 194 |
ars_object: |
| 195 |
description: |
| 196 |
- Adaptive Routing and Switching object |
| 197 |
type: str |
| 198 |
version_added: 3.1.0 |
| 199 |
as_path_prepend: |
| 200 |
description: |
| 201 |
- "String specifying a comma-separated list of AS-path numbers" |
| 202 |
- "to prepend to the BGP AS-path attribute in a matched route." |
| 203 |
- "AS-path values in the list must be in the range" |
| 204 |
- "1-4294967295; for example, 2000,3000" |
| 205 |
type: str |
| 206 |
comm_list_delete: |
| 207 |
description: |
| 208 |
- String specifying the name of a BGP community list containing |
| 209 |
- BGP Community values to be deleted from matching routes. |
| 210 |
type: str |
| 211 |
community: |
| 212 |
description: |
| 213 |
- BGP community attributes to add to or replace the BGP |
| 214 |
- community attributes in a matching route. Specifying the |
| 215 |
- "'additive' attribute is allowed only if one of" |
| 216 |
- the other attributes (other than 'none') is specified. |
| 217 |
- It causes the specified 'set community' attributes |
| 218 |
- to be added to the already existing community |
| 219 |
- "attributes in the matching route. If the 'additive' attribute" |
| 220 |
- is not specified, the previously existing community attributes |
| 221 |
- in the matching route are replaced by the configured |
| 222 |
- "'set community' attributes. Specifying a 'set community' attribute" |
| 223 |
- of 'none' is mutually exclusive with setting of other community |
| 224 |
- attributes and causes any community attributes in the matching |
| 225 |
- route to be removed. |
| 226 |
type: dict |
| 227 |
suboptions: |
| 228 |
community_number: |
| 229 |
description: |
| 230 |
- A list of one or more BGP community numbers in the |
| 231 |
- "form AA:NN where AA and NN are integers in the range" |
| 232 |
- "0-65535." |
| 233 |
- "Note: Each community number in the list must be enclosed" |
| 234 |
- in double quotes to avoid YAML parsing errors due to the |
| 235 |
- "list values containing an embedded ':' character." |
| 236 |
type: list |
| 237 |
elements: str |
| 238 |
community_attributes: |
| 239 |
description: |
| 240 |
- A list of one or more BGP community attributes. The allowed |
| 241 |
- "values are the following:" |
| 242 |
- local_as |
| 243 |
- Do not send outside local AS (well-known community) |
| 244 |
- no_advertise |
| 245 |
- Do not advertise to any peer (well-known community) |
| 246 |
- no_export |
| 247 |
- Do not export to next AS (well-known community) |
| 248 |
- no_peer |
| 249 |
- "The route does not need to be advertised to peers." |
| 250 |
- (Advertisement of the route can be suppressed based |
| 251 |
- on other criteria.) |
| 252 |
- additive |
| 253 |
- Add the configured 'set community' attributes to |
| 254 |
- "the matching route (if set to 'true'); Previously existing" |
| 255 |
- attributes in the matching route are, instead, replaced |
| 256 |
- by the configured attributes if this attribute is |
| 257 |
- not specified or if it is set to 'false'. |
| 258 |
- none |
| 259 |
- Do not send any community attribute. This attribute |
| 260 |
- is mutually exclusive with all other 'set community' |
| 261 |
- attributes. It causes all attributes to be removed |
| 262 |
- from the matching route. |
| 263 |
- "I(none) is mutually exclusive with all of the other attributes:" |
| 264 |
- I(local_as), I(no_advertise), I(no_export), I(no_peer), I(additive), |
| 265 |
- and I(additive). |
| 266 |
type: list |
| 267 |
elements: str |
| 268 |
choices: |
| 269 |
- local_as |
| 270 |
- no_advertise |
| 271 |
- no_export |
| 272 |
- no_peer |
| 273 |
- additive |
| 274 |
- none |
| 275 |
extcommunity: |
| 276 |
description: |
| 277 |
- BGP extended community attributes to set into a matching route. |
| 278 |
type: dict |
| 279 |
suboptions: |
| 280 |
rt: |
| 281 |
description: |
| 282 |
- Route Target VPN extended communities in the format |
| 283 |
- "ASN:NN or IP-ADDRESS:NN" |
| 284 |
- "Note: Each rt value in the list must be enclosed" |
| 285 |
- in double quotes to avoid YAML parsing errors due to the |
| 286 |
- "list values containing an embedded ':' character." |
| 287 |
type: list |
| 288 |
elements: str |
| 289 |
soo: |
| 290 |
description: |
| 291 |
- "Site-of-Origin VPN extended communities in the format" |
| 292 |
- "ASN:NN or IP-ADDRESS:NN" |
| 293 |
- "Note: Each rt value in the list must be enclosed" |
| 294 |
- in double quotes to avoid YAML parsing errors due to the |
| 295 |
- "list values containing an embedded ':' character." |
| 296 |
type: list |
| 297 |
elements: str |
| 298 |
bandwidth: |
| 299 |
version_added: "3.1.0" |
| 300 |
description: |
| 301 |
- Link bandwidth extended community |
| 302 |
type: dict |
| 303 |
suboptions: |
| 304 |
bandwidth_value: |
| 305 |
description: |
| 306 |
- "Options are one of the following values" |
| 307 |
- "<1..4294967295> Cumulative bandwidth of all multipaths (outbound-only)" |
| 308 |
- "num-multipaths Internally computed bandwidth based on number of multipaths (outbound-only)" |
| 309 |
type: str |
| 310 |
required: true |
| 311 |
transitive_value: |
| 312 |
description: |
| 313 |
- The operational default is false if this option is not specified. |
| 314 |
- True for transitive, false for non-transitive. If true, include the |
| 315 |
- link bandwidth extcommunity in route advertisements sent to |
| 316 |
- neighbors across AS boundaries (eBGP neighbors). If false, |
| 317 |
- drop the link bandwidth extcommunity from route advertisements |
| 318 |
- sent across AS boundaries. |
| 319 |
type: bool |
| 320 |
ip_next_hop: |
| 321 |
description: |
| 322 |
- IPv4 next hop address attributes to set into a matching route |
| 323 |
type: dict |
| 324 |
suboptions: |
| 325 |
address: |
| 326 |
description: |
| 327 |
- IPv4 next hop address to set into a matching route in the |
| 328 |
- dotted decimal format A.B.C.D |
| 329 |
type: str |
| 330 |
native: |
| 331 |
description: Set native or underlay nexthop |
| 332 |
type: bool |
| 333 |
ipv6_next_hop: |
| 334 |
description: |
| 335 |
- IPv6 next hop address attributes to set into a matching route |
| 336 |
type: dict |
| 337 |
suboptions: |
| 338 |
global_addr: |
| 339 |
description: |
| 340 |
- IPv6 global next hop address to set into a matching |
| 341 |
- "route in the format A::B" |
| 342 |
type: str |
| 343 |
prefer_global: |
| 344 |
description: |
| 345 |
- Set the corresponding attribute into a matching route |
| 346 |
- if the value of this Ansible attribute is 'true'. |
| 347 |
- The attribute indicates that the routing algorithm must |
| 348 |
- "prefer the global next-hop address over the link-local" |
| 349 |
- address if both exist. |
| 350 |
type: bool |
| 351 |
native: |
| 352 |
description: Set native or underlay nexthop |
| 353 |
type: bool |
| 354 |
local_preference: |
| 355 |
description: |
| 356 |
- "BGP local preference path attribute; integer value in" |
| 357 |
- "the range 0-4294967295" |
| 358 |
type: int |
| 359 |
metric: |
| 360 |
description: |
| 361 |
- route metric value actions |
| 362 |
- I(value) and I(rtt_action) are mutually exclusive. |
| 363 |
type: dict |
| 364 |
suboptions: |
| 365 |
value: |
| 366 |
description: |
| 367 |
- "metric value to be set into a matching route;" |
| 368 |
- "value in the range 0-4294967295" |
| 369 |
type: int |
| 370 |
rtt_action: |
| 371 |
description: |
| 372 |
- Action to take for modifying the metric for a matched |
| 373 |
- "route using the Round Trip Time (rtt);" |
| 374 |
- C(set) causes the route metric to be set to the |
| 375 |
- rtt value. |
| 376 |
- C(add) causes the rtt value to be added |
| 377 |
- to the route metric. |
| 378 |
- C(subtract) causes the rtt value to be |
| 379 |
- subtracted from route metric. |
| 380 |
type: str |
| 381 |
choices: |
| 382 |
- set |
| 383 |
- add |
| 384 |
- subtract |
| 385 |
origin: |
| 386 |
description: |
| 387 |
- "BGP route origin; One of the following must be selected." |
| 388 |
- "egp (External; remote EGP)" |
| 389 |
- "igp (Internal; local IGP)" |
| 390 |
- incomplete (Unknown origin) |
| 391 |
type: str |
| 392 |
choices: |
| 393 |
- egp |
| 394 |
- igp |
| 395 |
- incomplete |
| 396 |
weight: |
| 397 |
description: |
| 398 |
- "BGP weight to be set for a matching route: The weight must be" |
| 399 |
- "an integer in the range 0-4294967295" |
| 400 |
type: int |
| 401 |
tag: |
| 402 |
description: |
| 403 |
- Tag value to be set for a matching route |
| 404 |
- "The value must be in the range 1-4294967295" |
| 405 |
type: int |
| 406 |
call: |
| 407 |
description: |
| 408 |
- Name of a route map to jump to after executing 'match' and 'set' |
| 409 |
- statements for the current route map. |
| 410 |
type: str |
| 411 |
|
| 412 |
state: |
| 413 |
description: |
| 414 |
- Specifies the type of configuration update to be performed on the device. |
| 415 |
- For C(merged), merge specified attributes with existing configured attributes. |
| 416 |
- For C(deleted), delete the specified attributes from existing configuration. |
| 417 |
- For C(replaced), replace each modified list or dictionary with the |
| 418 |
- specified items. |
| 419 |
- For C(overridden), replace all current configuration for this resource |
| 420 |
- module with the specified configuration. |
| 421 |
type: str |
| 422 |
choices: |
| 423 |
- merged |
| 424 |
- deleted |
| 425 |
- replaced |
| 426 |
- overridden |
| 427 |
default: merged |
| 428 |
""" |
| 429 |
|
| 430 |
EXAMPLES = """ |
| 431 |
# Using "merged" state to create initial configuration |
| 432 |
# |
| 433 |
# Before state: |
| 434 |
# ------------- |
| 435 |
# |
| 436 |
# sonic# show running-configuration route-map |
| 437 |
# sonic# |
| 438 |
# (No configuration present) |
| 439 |
# |
| 440 |
# ------------- |
| 441 |
# |
| 442 |
- name: Merge initial route_maps configuration |
| 443 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 444 |
config: |
| 445 |
- map_name: rm1 |
| 446 |
action: permit |
| 447 |
sequence_num: 80 |
| 448 |
match: |
| 449 |
as_path: bgp_as1 |
| 450 |
community: bgp_comm_list1 |
| 451 |
evpn: |
| 452 |
default_route: true |
| 453 |
vni: 735 |
| 454 |
ext_comm: bgp_ext_comm1 |
| 455 |
interface: Ethernet4 |
| 456 |
ip: |
| 457 |
address: ip_pfx_list1 |
| 458 |
ipv6: |
| 459 |
address: ipv6_pfx_list1 |
| 460 |
local_preference: 8000 |
| 461 |
metric: 400 |
| 462 |
origin: egp |
| 463 |
peer: |
| 464 |
ip: 10.20.30.40 |
| 465 |
source_protocol: bgp |
| 466 |
source_vrf: Vrf1 |
| 467 |
tag: 7284 |
| 468 |
set: |
| 469 |
as_path_prepend: 200,315,7135 |
| 470 |
comm_list_delete: bgp_comm_list2 |
| 471 |
community: |
| 472 |
community_number: |
| 473 |
- "35:58" |
| 474 |
- "79:150" |
| 475 |
- "308:650" |
| 476 |
community_attributes: |
| 477 |
- local_as |
| 478 |
- no_advertise |
| 479 |
- no_export |
| 480 |
- no_peer |
| 481 |
- additive |
| 482 |
extcommunity: |
| 483 |
rt: |
| 484 |
- "30:40" |
| 485 |
soo: |
| 486 |
- "10.73.14.9:78" |
| 487 |
ip_next_hop: |
| 488 |
address: 10.48.16.18 |
| 489 |
native: true |
| 490 |
ipv6_next_hop: |
| 491 |
global_addr: 30::30 |
| 492 |
prefer_global: true |
| 493 |
native: true |
| 494 |
local_preference: 635 |
| 495 |
metric: |
| 496 |
metric_value: 870 |
| 497 |
origin: egp |
| 498 |
weight: 93471 |
| 499 |
tag: 65 |
| 500 |
- map_name: rm1 |
| 501 |
action: deny |
| 502 |
sequence_num: 3047 |
| 503 |
match: |
| 504 |
evpn: |
| 505 |
route_type: multicast |
| 506 |
origin: incomplete |
| 507 |
peer: |
| 508 |
interface: Ethernet6 |
| 509 |
source_protocol: ospf |
| 510 |
set: |
| 511 |
metric: |
| 512 |
rtt_action: add |
| 513 |
origin: incomplete |
| 514 |
- map_name: rm3 |
| 515 |
action: deny |
| 516 |
sequence_num: 285 |
| 517 |
match: |
| 518 |
evpn: |
| 519 |
route_type: macip |
| 520 |
origin: igp |
| 521 |
peer: |
| 522 |
ipv6: 87:95:15::53 |
| 523 |
source_protocol: connected |
| 524 |
set: |
| 525 |
community: |
| 526 |
community_attributes: |
| 527 |
- none |
| 528 |
metric: |
| 529 |
rtt_action: set |
| 530 |
origin: igp |
| 531 |
call: rm1 |
| 532 |
- map_name: rm4 |
| 533 |
action: permit |
| 534 |
sequence_num: 480 |
| 535 |
match: |
| 536 |
evpn: |
| 537 |
route_type: prefix |
| 538 |
source_protocol: static |
| 539 |
set: |
| 540 |
metric: |
| 541 |
rtt_action: subtract |
| 542 |
state: merged |
| 543 |
|
| 544 |
# After state: |
| 545 |
# ------------ |
| 546 |
# |
| 547 |
# sonic# show running-configuration route-map |
| 548 |
# ! |
| 549 |
# route-map rm1 permit 80 |
| 550 |
# match as-path bgp_as1 |
| 551 |
# match evpn default-route |
| 552 |
# match evpn vni 735 |
| 553 |
# match ip address prefix-list ip_pfx_list1 |
| 554 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 555 |
# match interface Ethernet4 |
| 556 |
# match community bgp_comm_list1 |
| 557 |
# match ext-community bgp_ext_comm1 |
| 558 |
# match tag 7284 |
| 559 |
# match local-preference 8000 |
| 560 |
# match source-vrf Vrf1 |
| 561 |
# match peer 10.20.30.40 |
| 562 |
# match source-protocol bgp |
| 563 |
# match metric 400 |
| 564 |
# match origin egp |
| 565 |
# set as-path prepend 200,315,7135 |
| 566 |
# set community 35:58 79:150 308:650 local-AS no-advertise no-export no-peer additive |
| 567 |
# set extcommunity rt 30:40 |
| 568 |
# set extcommunity soo 10.73.14.9:78 |
| 569 |
# set comm-list bgp_comm_list2 delete |
| 570 |
# set metric 870 |
| 571 |
# set ip next-hop 10.48.16.18 |
| 572 |
# set ip next-hop native true |
| 573 |
# set ipv6 next-hop global 30::30 |
| 574 |
# set ipv6 next-hop prefer-global |
| 575 |
# set ipv6 next-hop native true |
| 576 |
# set local-preference 635 |
| 577 |
# set origin egp |
| 578 |
# set weight 93471 |
| 579 |
# set tag 65 |
| 580 |
# ! |
| 581 |
# route-map rm1 deny 3047 |
| 582 |
# match evpn route-type multicast |
| 583 |
# match peer Ethernet6 |
| 584 |
# match source-protocol ospf |
| 585 |
# match origin incomplete |
| 586 |
# set metric +rtt |
| 587 |
# set origin incomplete |
| 588 |
# ! |
| 589 |
# route-map rm3 deny 285 |
| 590 |
# match evpn route-type macip |
| 591 |
# call rm1 |
| 592 |
# match peer 87:95:15::53 |
| 593 |
# match source-protocol connected |
| 594 |
# match origin igp |
| 595 |
# set community none |
| 596 |
# set metric rtt |
| 597 |
# set origin igp |
| 598 |
# ! |
| 599 |
# route-map rm4 permit 480 |
| 600 |
# match evpn route-type prefix |
| 601 |
# match source-protocol static |
| 602 |
# set metric -rtt |
| 603 |
# ------------ |
| 604 |
|
| 605 |
|
| 606 |
# Using "merged" state to update and add configuration |
| 607 |
# |
| 608 |
# Before state: |
| 609 |
# ------------ |
| 610 |
# |
| 611 |
# sonic# show running-configuration route-map |
| 612 |
# ! |
| 613 |
# route-map rm1 permit 80 |
| 614 |
# match as-path bgp_as1 |
| 615 |
# match evpn default-route |
| 616 |
# match evpn vni 735 |
| 617 |
# match ip address prefix-list ip_pfx_list1 |
| 618 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 619 |
# match interface Ethernet4 |
| 620 |
# match community bgp_comm_list1 |
| 621 |
# match ext-community bgp_ext_comm1 |
| 622 |
# match tag 7284 |
| 623 |
# match local-preference 8000 |
| 624 |
# match source-vrf Vrf1 |
| 625 |
# match peer 10.20.30.40 |
| 626 |
# match source-protocol bgp |
| 627 |
# match metric 400 |
| 628 |
# match origin egp |
| 629 |
# set as-path prepend 200,315,7135 |
| 630 |
# set community 35:58 79:150 308:650 local-AS no-advertise no-export no-peer additive |
| 631 |
# set extcommunity rt 30:40 |
| 632 |
# set extcommunity soo 10.73.14.9:78 |
| 633 |
# set comm-list bgp_comm_list2 delete |
| 634 |
# set metric 870 |
| 635 |
# set ip next-hop 10.48.16.18 |
| 636 |
# set ipv6 next-hop global 30::30 |
| 637 |
# set ipv6 next-hop prefer-global |
| 638 |
# set local-preference 635 |
| 639 |
# set origin egp |
| 640 |
# set weight 93471 |
| 641 |
# set tag 65 |
| 642 |
# ! |
| 643 |
# route-map rm1 deny 3047 |
| 644 |
# match evpn route-type multicast |
| 645 |
# match peer Ethernet6 |
| 646 |
# match source-protocol ospf |
| 647 |
# match origin incomplete |
| 648 |
# set metric +rtt |
| 649 |
# set origin incomplete |
| 650 |
# ! |
| 651 |
# route-map rm3 deny 285 |
| 652 |
# match evpn route-type macip |
| 653 |
# call rm1 |
| 654 |
# match peer 87:95:15::53 |
| 655 |
# match source-protocol connected |
| 656 |
# match origin igp |
| 657 |
# set community none |
| 658 |
# set metric rtt |
| 659 |
# set origin igp |
| 660 |
# ! |
| 661 |
# route-map rm4 permit 480 |
| 662 |
# match evpn route-type prefix |
| 663 |
# match source-protocol static |
| 664 |
# set metric -rtt |
| 665 |
# ------------ |
| 666 |
# |
| 667 |
- name: Merge additional and modified route map configuration |
| 668 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 669 |
config: |
| 670 |
- map_name: rm1 |
| 671 |
action: permit |
| 672 |
sequence_num: 80 |
| 673 |
match: |
| 674 |
as_path: bgp_as2 |
| 675 |
community: bgp_comm_list3 |
| 676 |
evpn: |
| 677 |
route_type: prefix |
| 678 |
vni: 850 |
| 679 |
interface: Vlan7 |
| 680 |
ip: |
| 681 |
address: ip_pfx_list2 |
| 682 |
next_hop: ip_pfx_list3 |
| 683 |
peer: |
| 684 |
interface: Portchannel14 |
| 685 |
set: |
| 686 |
as_path_prepend: 188,257 |
| 687 |
community: |
| 688 |
community_number: |
| 689 |
- "45:736" |
| 690 |
ipv6_next_hop: |
| 691 |
prefer_global: false |
| 692 |
metric: |
| 693 |
rtt_action: add |
| 694 |
- map_name: rm1 |
| 695 |
action: deny |
| 696 |
sequence_num: 3047 |
| 697 |
match: |
| 698 |
as_path: bgp_as3 |
| 699 |
ext_comm: bgp_ext_comm2 |
| 700 |
origin: igp |
| 701 |
set: |
| 702 |
metric: |
| 703 |
rtt_action: subtract |
| 704 |
- map_name: rm2 |
| 705 |
action: permit |
| 706 |
sequence_num: 100 |
| 707 |
match: |
| 708 |
interface: Ethernet16 |
| 709 |
set: |
| 710 |
as_path_prepend: 200,300,400 |
| 711 |
ipv6_next_hop: |
| 712 |
global_addr: 37::58 |
| 713 |
prefer_global: true |
| 714 |
metric: 8000 |
| 715 |
- map_name: rm3 |
| 716 |
action: deny |
| 717 |
sequence_num: 285 |
| 718 |
match: |
| 719 |
local_preference: 14783 |
| 720 |
source_protocol: bgp |
| 721 |
set: |
| 722 |
community: |
| 723 |
community_attributes: |
| 724 |
- no_advertise |
| 725 |
state: merged |
| 726 |
|
| 727 |
# After state: |
| 728 |
# ------------ |
| 729 |
# |
| 730 |
# sonic# show running-configuration route-map |
| 731 |
# ! |
| 732 |
# route-map rm1 permit 80 |
| 733 |
# match as-path bgp_as2 |
| 734 |
# match evpn default-route |
| 735 |
# match evpn route-type prefix |
| 736 |
# match evpn vni 850 |
| 737 |
# match ip address prefix-list ip_pfx_list2 |
| 738 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 739 |
# match interface Vlan7 |
| 740 |
# match community bgp_comm_list3 |
| 741 |
# match ext-community bgp_ext_comm1 |
| 742 |
# match tag 7284 |
| 743 |
# match local-preference 8000 |
| 744 |
# match source-vrf Vrf1 |
| 745 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 746 |
# match peer PortChannel 14 |
| 747 |
# match source-protocol bgp |
| 748 |
# match metric 400 |
| 749 |
# match origin egp |
| 750 |
# set as-path prepend 188,257 |
| 751 |
# set community 35:58 79:150 308:650 45:736 local-AS no-advertise no-export no-peer additive |
| 752 |
# set extcommunity rt 30:40 |
| 753 |
# set extcommunity soo 10.73.14.9:78 |
| 754 |
# set comm-list bgp_comm_list2 delete |
| 755 |
# set metric +rtt |
| 756 |
# set ip next-hop 10.48.16.18 |
| 757 |
# set ipv6 next-hop global 30::30 |
| 758 |
# set local-preference 635 |
| 759 |
# set origin egp |
| 760 |
# set weight 93471 |
| 761 |
# set tag 65 |
| 762 |
# ! |
| 763 |
# route-map rm1 deny 3047 |
| 764 |
# match as-path bgp_as3 |
| 765 |
# match evpn route-type multicast |
| 766 |
# match ext-community bgp_ext_comm2 |
| 767 |
# match peer Ethernet6 |
| 768 |
# match source-protocol ospf |
| 769 |
# match origin igp |
| 770 |
# set metric -rtt |
| 771 |
# set origin incomplete |
| 772 |
# ! |
| 773 |
# route-map rm2 permit 100 |
| 774 |
# match interface Ethernet16 |
| 775 |
# set as-path prepend 200,300,400 |
| 776 |
# set ipv6 next-hop global 37::58 |
| 777 |
# set ipv6 next-hop prefer-global |
| 778 |
# set metric 8000 |
| 779 |
# ! |
| 780 |
# route-map rm3 deny 285 |
| 781 |
# match evpn route-type macip |
| 782 |
# match local-preference 14783 |
| 783 |
# call rm1 |
| 784 |
# match peer 87:95:15::53 |
| 785 |
# match source-protocol bgp |
| 786 |
# match origin igp |
| 787 |
# set community no-advertise |
| 788 |
# set metric rtt |
| 789 |
# set origin igp |
| 790 |
# ! |
| 791 |
# route-map rm4 permit 480 |
| 792 |
# match evpn route-type prefix |
| 793 |
# match source-protocol static |
| 794 |
# set metric -rtt |
| 795 |
|
| 796 |
|
| 797 |
# Using "replaced" state to replace the contents of a list |
| 798 |
# |
| 799 |
# Before state: |
| 800 |
# ------------ |
| 801 |
# |
| 802 |
# sonic(config-route-map)# do show running-configuration route-map rm1 80 |
| 803 |
# ! |
| 804 |
# route-map rm1 permit 80 |
| 805 |
# match as-path bgp_as2 |
| 806 |
# match evpn default-route |
| 807 |
# match evpn route-type prefix |
| 808 |
# match evpn vni 850 |
| 809 |
# match ip address prefix-list ip_pfx_list2 |
| 810 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 811 |
# match interface Vlan7 |
| 812 |
# match community bgp_comm_list3 |
| 813 |
# match ext-community bgp_ext_comm1 |
| 814 |
# match tag 7284 |
| 815 |
# match local-preference 8000 |
| 816 |
# match source-vrf Vrf1 |
| 817 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 818 |
# match peer PortChannel 14 |
| 819 |
# match source-protocol bgp |
| 820 |
# match metric 400 |
| 821 |
# match origin egp |
| 822 |
# set as-path prepend 188,257 |
| 823 |
# set community 35:58 79:150 308:650 45:736 local-AS no-export no-peer additive |
| 824 |
# set extcommunity rt 30:40 |
| 825 |
# set extcommunity soo 10.73.14.9:78 |
| 826 |
# set comm-list bgp_comm_list2 delete |
| 827 |
# set metric +rtt |
| 828 |
# set ip next-hop 10.48.16.18 |
| 829 |
# set ipv6 next-hop global 30::30 |
| 830 |
# set local-preference 635 |
| 831 |
# set origin egp |
| 832 |
# set weight 93471 |
| 833 |
# set tag 65 |
| 834 |
# ------------ |
| 835 |
- name: Replace a list |
| 836 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 837 |
config: |
| 838 |
- map_name: rm1 |
| 839 |
action: permit |
| 840 |
sequence_num: 80 |
| 841 |
set: |
| 842 |
community: |
| 843 |
community_number: |
| 844 |
- "15:30" |
| 845 |
- "26:54" |
| 846 |
state: replaced |
| 847 |
|
| 848 |
# After state: |
| 849 |
# ------------ |
| 850 |
# |
| 851 |
# sonic#show running-configuration route-map rm1 80 |
| 852 |
# ! |
| 853 |
# route-map rm1 permit 80 |
| 854 |
# match as-path bgp_as2 |
| 855 |
# match evpn default-route |
| 856 |
# match evpn route-type prefix |
| 857 |
# match evpn vni 850 |
| 858 |
# match ip address prefix-list ip_pfx_list2 |
| 859 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 860 |
# match interface Vlan7 |
| 861 |
# match community bgp_comm_list3 |
| 862 |
# match ext-community bgp_ext_comm1 |
| 863 |
# match tag 7284 |
| 864 |
# match local-preference 8000 |
| 865 |
# match source-vrf Vrf1 |
| 866 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 867 |
# match peer PortChannel 14 |
| 868 |
# match source-protocol bgp |
| 869 |
# match metric 400 |
| 870 |
# match origin egp |
| 871 |
# set as-path prepend 188,257 |
| 872 |
# set community 15:30 26:54 local-AS no-export no-peer additive |
| 873 |
# set extcommunity rt 30:40 |
| 874 |
# set extcommunity soo 10.73.14.9:78 |
| 875 |
# set comm-list bgp_comm_list2 delete |
| 876 |
# set metric +rtt |
| 877 |
# set ip next-hop 10.48.16.18 |
| 878 |
# set ipv6 next-hop global 30::30 |
| 879 |
# set local-preference 635 |
| 880 |
# set origin egp |
| 881 |
# set weight 93471 |
| 882 |
# set tag 65 |
| 883 |
|
| 884 |
|
| 885 |
# Using "replaced" state to replace the contents of dictionaries |
| 886 |
# |
| 887 |
# Before state: |
| 888 |
# ------------ |
| 889 |
# sonic# show running-configuration route-map |
| 890 |
# ! |
| 891 |
# route-map rm1 permit 80 |
| 892 |
# match as-path bgp_as2 |
| 893 |
# match evpn default-route |
| 894 |
# match evpn route-type prefix |
| 895 |
# match evpn vni 850 |
| 896 |
# match ip address prefix-list ip_pfx_list2 |
| 897 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 898 |
# match interface Vlan7 |
| 899 |
# match community bgp_comm_list3 |
| 900 |
# match ext-community bgp_ext_comm1 |
| 901 |
# match tag 7284 |
| 902 |
# match local-preference 8000 |
| 903 |
# match source-vrf Vrf1 |
| 904 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 905 |
# match peer PortChannel 14 |
| 906 |
# match source-protocol bgp |
| 907 |
# match metric 400 |
| 908 |
# match origin egp |
| 909 |
# set as-path prepend 188,257 |
| 910 |
# set community 15:30 26:54 local-AS no-export no-peer additive |
| 911 |
# set extcommunity rt 30:40 |
| 912 |
# set extcommunity soo 10.73.14.9:78 |
| 913 |
# set comm-list bgp_comm_list2 delete |
| 914 |
# set metric +rtt |
| 915 |
# set ip next-hop 10.48.16.18 |
| 916 |
# set ipv6 next-hop global 30::30 |
| 917 |
# set local-preference 635 |
| 918 |
# set origin egp |
| 919 |
# set weight 93471 |
| 920 |
# set tag 65 |
| 921 |
# ! |
| 922 |
# route-map rm1 deny 3047 |
| 923 |
# match as-path bgp_as3 |
| 924 |
# match evpn route-type multicast |
| 925 |
# match ext-community bgp_ext_comm2 |
| 926 |
# match peer Ethernet6 |
| 927 |
# match source-protocol ospf |
| 928 |
# match origin igp |
| 929 |
# set metric -rtt |
| 930 |
# set origin incomplete |
| 931 |
# ! |
| 932 |
# route-map rm2 permit 100 |
| 933 |
# match interface Ethernet16 |
| 934 |
# set as-path prepend 200,300,400 |
| 935 |
# set ipv6 next-hop global 37::58 |
| 936 |
# set ipv6 next-hop prefer-global |
| 937 |
# set metric 8000 |
| 938 |
# ! |
| 939 |
# route-map rm3 deny 285 |
| 940 |
# match evpn route-type macip |
| 941 |
# match local-preference 14783 |
| 942 |
# call rm1 |
| 943 |
# match peer 87:95:15::53 |
| 944 |
# match source-protocol bgp |
| 945 |
# match origin igp |
| 946 |
# set community no-advertise |
| 947 |
# set metric rtt |
| 948 |
# set origin igp |
| 949 |
# ! |
| 950 |
# route-map rm4 permit 480 |
| 951 |
# match evpn route-type prefix |
| 952 |
# match source-protocol static |
| 953 |
# set metric -rtt |
| 954 |
# ------------ |
| 955 |
- name: Replace dictionaries |
| 956 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 957 |
config: |
| 958 |
- map_name: rm1 |
| 959 |
action: permit |
| 960 |
sequence_num: 80 |
| 961 |
match: |
| 962 |
evpn: |
| 963 |
route_type: multicast |
| 964 |
ip: |
| 965 |
address: ip_pfx_list1 |
| 966 |
set: |
| 967 |
community: |
| 968 |
community_attributes: |
| 969 |
- no_advertise |
| 970 |
extcommunity: |
| 971 |
rt: |
| 972 |
- "20:20" |
| 973 |
- map_name: rm2 |
| 974 |
action: permit |
| 975 |
sequence_num: 100 |
| 976 |
set: |
| 977 |
ipv6_next_hop: |
| 978 |
global_addr: 45::90 |
| 979 |
native: true |
| 980 |
state: replaced |
| 981 |
|
| 982 |
# After state: |
| 983 |
# ------------ |
| 984 |
# |
| 985 |
# sonic# show running-configuration route-map |
| 986 |
# ! |
| 987 |
# route-map rm1 permit 80 |
| 988 |
# match as-path bgp_as2 |
| 989 |
# match evpn route-type multicast |
| 990 |
# match ip address prefix-list ip_pfx_list1 |
| 991 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 992 |
# match interface Vlan7 |
| 993 |
# match community bgp_comm_list3 |
| 994 |
# match ext-community bgp_ext_comm1 |
| 995 |
# match tag 7284 |
| 996 |
# match local-preference 8000 |
| 997 |
# match source-vrf Vrf1 |
| 998 |
# match peer PortChannel 14 |
| 999 |
# match source-protocol bgp |
| 1000 |
# match metric 400 |
| 1001 |
# match origin egp |
| 1002 |
# set as-path prepend 188,257 |
| 1003 |
# set community no-advertise |
| 1004 |
# set extcommunity rt 20:20 |
| 1005 |
# set comm-list bgp_comm_list2 delete |
| 1006 |
# set metric +rtt |
| 1007 |
# set ip next-hop 10.48.16.18 |
| 1008 |
# set ipv6 next-hop global 30::30 |
| 1009 |
# set local-preference 635 |
| 1010 |
# set origin egp |
| 1011 |
# set weight 93471 |
| 1012 |
# set tag 65 |
| 1013 |
# ! |
| 1014 |
# route-map rm1 deny 3047 |
| 1015 |
# match as-path bgp_as3 |
| 1016 |
# match evpn route-type multicast |
| 1017 |
# match ext-community bgp_ext_comm2 |
| 1018 |
# match peer Ethernet6 |
| 1019 |
# match source-protocol ospf |
| 1020 |
# match origin igp |
| 1021 |
# set metric -rtt |
| 1022 |
# set origin incomplete |
| 1023 |
# ! |
| 1024 |
# route-map rm2 permit 100 |
| 1025 |
# match interface Ethernet16 |
| 1026 |
# set as-path prepend 200,300,400 |
| 1027 |
# set metric 8000 |
| 1028 |
# set ipv6 next-hop global 45::90 |
| 1029 |
# set ipv6 next-hop native true |
| 1030 |
# ! |
| 1031 |
# route-map rm3 deny 285 |
| 1032 |
# match evpn route-type macip |
| 1033 |
# match local-preference 14783 |
| 1034 |
# call rm1 |
| 1035 |
# match peer 87:95:15::53 |
| 1036 |
# match source-protocol bgp |
| 1037 |
# match origin igp |
| 1038 |
# set community no-advertise |
| 1039 |
# set metric rtt |
| 1040 |
# set origin igp |
| 1041 |
# ! |
| 1042 |
# route-map rm4 permit 480 |
| 1043 |
# match evpn route-type prefix |
| 1044 |
# match source-protocol static |
| 1045 |
# set metric -rtt |
| 1046 |
|
| 1047 |
|
| 1048 |
# Using "overridden" state to override all existing configuration with new |
| 1049 |
# configuration |
| 1050 |
# |
| 1051 |
# Before state: |
| 1052 |
# ------------ |
| 1053 |
# |
| 1054 |
# sonic# show running-configuration route-map |
| 1055 |
# ! |
| 1056 |
# route-map rm1 permit 80 |
| 1057 |
# match as-path bgp_as2 |
| 1058 |
# match evpn route-type multicast |
| 1059 |
# match ip address prefix-list ip_pfx_list1 |
| 1060 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1061 |
# match interface Vlan7 |
| 1062 |
# match community bgp_comm_list3 |
| 1063 |
# match ext-community bgp_ext_comm1 |
| 1064 |
# match tag 7284 |
| 1065 |
# match local-preference 8000 |
| 1066 |
# match source-vrf Vrf1 |
| 1067 |
# match peer PortChannel 14 |
| 1068 |
# match source-protocol bgp |
| 1069 |
# match metric 400 |
| 1070 |
# match origin egp |
| 1071 |
# set as-path prepend 188,257 |
| 1072 |
# set community no-advertise |
| 1073 |
# set extcommunity rt 30:40 |
| 1074 |
# set extcommunity rt 20:20 |
| 1075 |
# set comm-list bgp_comm_list2 delete |
| 1076 |
# set metric +rtt |
| 1077 |
# set ip next-hop 10.48.16.18 |
| 1078 |
# set ipv6 next-hop global 30::30 |
| 1079 |
# set local-preference 635 |
| 1080 |
# set origin egp |
| 1081 |
# set weight 93471 |
| 1082 |
# set tag 65 |
| 1083 |
# ! |
| 1084 |
# route-map rm1 deny 3047 |
| 1085 |
# match as-path bgp_as3 |
| 1086 |
# match evpn route-type multicast |
| 1087 |
# match ext-community bgp_ext_comm2 |
| 1088 |
# match peer Ethernet6 |
| 1089 |
# match source-protocol ospf |
| 1090 |
# match origin igp |
| 1091 |
# set metric -rtt |
| 1092 |
# set origin incomplete |
| 1093 |
# ! |
| 1094 |
# route-map rm2 permit 100 |
| 1095 |
# match interface Ethernet16 |
| 1096 |
# set as-path prepend 200,300,400 |
| 1097 |
# set metric 8000 |
| 1098 |
# set ipv6 next-hop global 45::90 |
| 1099 |
# ! |
| 1100 |
# route-map rm3 deny 285 |
| 1101 |
# match evpn route-type macip |
| 1102 |
# match local-preference 14783 |
| 1103 |
# call rm1 |
| 1104 |
# match peer 87:95:15::53 |
| 1105 |
# match source-protocol bgp |
| 1106 |
# match origin igp |
| 1107 |
# set community no-advertise |
| 1108 |
# set metric rtt |
| 1109 |
# set origin igp |
| 1110 |
# ! |
| 1111 |
# route-map rm4 permit 480 |
| 1112 |
# match evpn route-type prefix |
| 1113 |
# match source-protocol static |
| 1114 |
# set metric -rtt |
| 1115 |
# ------------ |
| 1116 |
- name: Override all route map configuration with new configuration |
| 1117 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 1118 |
config: |
| 1119 |
- map_name: rm5 |
| 1120 |
action: permit |
| 1121 |
sequence_num: 250 |
| 1122 |
match: |
| 1123 |
interface: Ethernet28 |
| 1124 |
set: |
| 1125 |
as_path_prepend: 150,275 |
| 1126 |
metric: 7249 |
| 1127 |
state: overridden |
| 1128 |
|
| 1129 |
# After state: |
| 1130 |
# ------------ |
| 1131 |
# |
| 1132 |
# sonic# show running-configuration route-map |
| 1133 |
# ! |
| 1134 |
# route-map rm5 permit 250 |
| 1135 |
# match interface Ethernet28 |
| 1136 |
# set as-path prepend 150,275 |
| 1137 |
# set metric 7249 |
| 1138 |
|
| 1139 |
|
| 1140 |
# Using "overridden" state to override all existing configuration with new |
| 1141 |
# configuration. (Restore previous configuration.) |
| 1142 |
# |
| 1143 |
# Before state: |
| 1144 |
# ------------ |
| 1145 |
# |
| 1146 |
# sonic# show running-configuration route-map |
| 1147 |
# ! |
| 1148 |
# route-map rm5 permit 250 |
| 1149 |
# match interface Ethernet28 |
| 1150 |
# set as-path prepend 150,275 |
| 1151 |
# set metric 7249 |
| 1152 |
# ------------ |
| 1153 |
- name: Override (restore) all route map configuration with older configuration |
| 1154 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 1155 |
config: |
| 1156 |
- map_name: rm1 |
| 1157 |
action: permit |
| 1158 |
sequence_num: 80 |
| 1159 |
match: |
| 1160 |
as_path: bgp_as2 |
| 1161 |
community: bgp_comm_list3 |
| 1162 |
evpn: |
| 1163 |
default_route: true |
| 1164 |
route_type: prefix |
| 1165 |
vni: 850 |
| 1166 |
ext_comm: bgp_ext_comm1 |
| 1167 |
interface: Vlan7 |
| 1168 |
ip: |
| 1169 |
address: ip_pfx_list2 |
| 1170 |
next_hop: ip_pfx_list3 |
| 1171 |
ipv6: |
| 1172 |
address: ipv6_pfx_list1 |
| 1173 |
local_preference: 8000 |
| 1174 |
metric: 400 |
| 1175 |
origin: egp |
| 1176 |
peer: |
| 1177 |
interface: Portchannel14 |
| 1178 |
source_protocol: bgp |
| 1179 |
source_vrf: Vrf1 |
| 1180 |
tag: 7284 |
| 1181 |
set: |
| 1182 |
as_path_prepend: 188,257 |
| 1183 |
comm_list_delete: bgp_comm_list2 |
| 1184 |
community: |
| 1185 |
community_number: |
| 1186 |
- "35:58" |
| 1187 |
- "79:150" |
| 1188 |
- "308:650" |
| 1189 |
- "45:736" |
| 1190 |
community_attributes: |
| 1191 |
- local_as |
| 1192 |
- no_export |
| 1193 |
- no_peer |
| 1194 |
- additive |
| 1195 |
extcommunity: |
| 1196 |
rt: |
| 1197 |
- "30:40" |
| 1198 |
soo: |
| 1199 |
- "10.73.14.9:78" |
| 1200 |
ip_next_hop: |
| 1201 |
address: 10.48.16.18 |
| 1202 |
native: false |
| 1203 |
ipv6_next_hop: |
| 1204 |
global_addr: 30::30 |
| 1205 |
native: false |
| 1206 |
local_preference: 635 |
| 1207 |
metric: |
| 1208 |
rtt_action: add |
| 1209 |
origin: egp |
| 1210 |
weight: 93471 |
| 1211 |
tag: 65 |
| 1212 |
- map_name: rm1 |
| 1213 |
action: deny |
| 1214 |
sequence_num: 3047 |
| 1215 |
match: |
| 1216 |
as_path: bgp_as3 |
| 1217 |
evpn: |
| 1218 |
route_type: multicast |
| 1219 |
ext_comm: bgp_ext_comm2 |
| 1220 |
origin: igp |
| 1221 |
peer: |
| 1222 |
interface: Ethernet6 |
| 1223 |
source_protocol: ospf |
| 1224 |
set: |
| 1225 |
metric: |
| 1226 |
rtt_action: subtract |
| 1227 |
origin: incomplete |
| 1228 |
- map_name: rm2 |
| 1229 |
action: permit |
| 1230 |
sequence_num: 100 |
| 1231 |
match: |
| 1232 |
interface: Ethernet16 |
| 1233 |
set: |
| 1234 |
as_path_prepend: 200,300,400 |
| 1235 |
ipv6_next_hop: |
| 1236 |
global_addr: 37::58 |
| 1237 |
prefer_global: true |
| 1238 |
metric: 8000 |
| 1239 |
- map_name: rm3 |
| 1240 |
action: deny |
| 1241 |
sequence_num: 285 |
| 1242 |
match: |
| 1243 |
evpn: |
| 1244 |
route_type: macip |
| 1245 |
origin: igp |
| 1246 |
peer: |
| 1247 |
ipv6: 87:95:15::53 |
| 1248 |
local_preference: 14783 |
| 1249 |
source_protocol: bgp |
| 1250 |
set: |
| 1251 |
community: |
| 1252 |
community_attributes: |
| 1253 |
- no_advertise |
| 1254 |
metric: |
| 1255 |
rtt_action: set |
| 1256 |
origin: igp |
| 1257 |
call: rm1 |
| 1258 |
- map_name: rm4 |
| 1259 |
action: permit |
| 1260 |
sequence_num: 480 |
| 1261 |
match: |
| 1262 |
evpn: |
| 1263 |
route_type: prefix |
| 1264 |
source_protocol: static |
| 1265 |
set: |
| 1266 |
metric: |
| 1267 |
rtt_action: subtract |
| 1268 |
state: overridden |
| 1269 |
|
| 1270 |
# After state: |
| 1271 |
# ------------ |
| 1272 |
# |
| 1273 |
# sonic# show running-configuration route-map |
| 1274 |
# ! |
| 1275 |
# route-map rm1 permit 80 |
| 1276 |
# match as-path bgp_as2 |
| 1277 |
# match evpn default-route |
| 1278 |
# match evpn route-type prefix |
| 1279 |
# match evpn vni 850 |
| 1280 |
# match ip address prefix-list ip_pfx_list2 |
| 1281 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1282 |
# match interface Vlan7 |
| 1283 |
# match community bgp_comm_list3 |
| 1284 |
# match ext-community bgp_ext_comm1 |
| 1285 |
# match tag 7284 |
| 1286 |
# match local-preference 8000 |
| 1287 |
# match source-vrf Vrf1 |
| 1288 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 1289 |
# match peer PortChannel 14 |
| 1290 |
# match source-protocol bgp |
| 1291 |
# match metric 400 |
| 1292 |
# match origin egp |
| 1293 |
# set as-path prepend 188,257 |
| 1294 |
# set community 35:58 79:150 308:650 45:736 local-AS no-export no-peer additive |
| 1295 |
# set extcommunity rt 30:40 |
| 1296 |
# set extcommunity soo 10.73.14.9:78 |
| 1297 |
# set comm-list bgp_comm_list2 delete |
| 1298 |
# set metric +rtt |
| 1299 |
# set ip next-hop 10.48.16.18 |
| 1300 |
# set ip next-hop native false |
| 1301 |
# set ipv6 next-hop global 30::30 |
| 1302 |
# set ipv6 next-hop native false |
| 1303 |
# set local-preference 635 |
| 1304 |
# set origin egp |
| 1305 |
# set weight 93471 |
| 1306 |
# set tag 65 |
| 1307 |
# ! |
| 1308 |
# route-map rm1 deny 3047 |
| 1309 |
# match as-path bgp_as3 |
| 1310 |
# match evpn route-type multicast |
| 1311 |
# match ext-community bgp_ext_comm2 |
| 1312 |
# match peer Ethernet6 |
| 1313 |
# match source-protocol ospf |
| 1314 |
# match origin igp |
| 1315 |
# set metric -rtt |
| 1316 |
# set origin incomplete |
| 1317 |
# ! |
| 1318 |
# route-map rm2 permit 100 |
| 1319 |
# match interface Ethernet16 |
| 1320 |
# set as-path prepend 200,300,400 |
| 1321 |
# set ipv6 next-hop global 37::58 |
| 1322 |
# set ipv6 next-hop prefer-global |
| 1323 |
# set metric 8000 |
| 1324 |
# ! |
| 1325 |
# route-map rm3 deny 285 |
| 1326 |
# match evpn route-type macip |
| 1327 |
# match local-preference 14783 |
| 1328 |
# call rm1 |
| 1329 |
# match peer 87:95:15::53 |
| 1330 |
# match source-protocol bgp |
| 1331 |
# match origin igp |
| 1332 |
# set community no-advertise |
| 1333 |
# set metric rtt |
| 1334 |
# set origin igp |
| 1335 |
# ! |
| 1336 |
# route-map rm4 permit 480 |
| 1337 |
# match evpn route-type prefix |
| 1338 |
# match source-protocol static |
| 1339 |
# set metric -rtt |
| 1340 |
|
| 1341 |
|
| 1342 |
# Using "deleted" state to remove configuration |
| 1343 |
# |
| 1344 |
# Before state: |
| 1345 |
# ------------ |
| 1346 |
# |
| 1347 |
# sonic# show running-configuration route-map rm1 80 |
| 1348 |
# ! |
| 1349 |
# route-map rm1 permit 80 |
| 1350 |
# match as-path bgp_as2 |
| 1351 |
# match evpn default-route |
| 1352 |
# match evpn route-type prefix |
| 1353 |
# match evpn vni 850 |
| 1354 |
# match ip address prefix-list ip_pfx_list2 |
| 1355 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1356 |
# match interface Vlan7 |
| 1357 |
# match community bgp_comm_list3 |
| 1358 |
# match ext-community bgp_ext_comm1 |
| 1359 |
# match tag 7284 |
| 1360 |
# match local-preference 8000 |
| 1361 |
# match source-vrf Vrf1 |
| 1362 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 1363 |
# match peer PortChannel 14 |
| 1364 |
# match source-protocol bgp |
| 1365 |
# match metric 400 |
| 1366 |
# match origin egp |
| 1367 |
# set as-path prepend 188,257 |
| 1368 |
# set community 35:58 79:150 308:650 45:736 local-AS no-export no-peer additive |
| 1369 |
# set extcommunity rt 30:40 |
| 1370 |
# set extcommunity soo 10.73.14.9:78 |
| 1371 |
# set comm-list bgp_comm_list2 delete |
| 1372 |
# set metric +rtt |
| 1373 |
# set ip next-hop 10.48.16.18 |
| 1374 |
# set ip next-hop native true |
| 1375 |
# set ipv6 next-hop global 30::30 |
| 1376 |
# set local-preference 635 |
| 1377 |
# set origin egp |
| 1378 |
# set weight 93471 |
| 1379 |
# set tag 65 |
| 1380 |
# ------------ |
| 1381 |
- name: Delete selected route map configuration |
| 1382 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 1383 |
config: |
| 1384 |
- map_name: rm1 |
| 1385 |
action: permit |
| 1386 |
sequence_num: 80 |
| 1387 |
match: |
| 1388 |
as_path: bgp_as2 |
| 1389 |
community: bgp_comm_list3 |
| 1390 |
evpn: |
| 1391 |
vni: 850 |
| 1392 |
ip: |
| 1393 |
address: ip_pfx_list2 |
| 1394 |
set: |
| 1395 |
as_path_prepend: 188,257 |
| 1396 |
ip_next_hop: |
| 1397 |
address: 10.48.16.18 |
| 1398 |
native: true |
| 1399 |
ipv6_next_hop: |
| 1400 |
native: true |
| 1401 |
community: |
| 1402 |
community_number: |
| 1403 |
- "35:58" |
| 1404 |
community_attributes: |
| 1405 |
- local_as |
| 1406 |
extcommunity: |
| 1407 |
rt: |
| 1408 |
- "30:40" |
| 1409 |
state: deleted |
| 1410 |
|
| 1411 |
# After state: |
| 1412 |
# ------------ |
| 1413 |
# |
| 1414 |
# sonic# show running-configuration route-map rm1 80 |
| 1415 |
# ! |
| 1416 |
# route-map rm1 permit 80 |
| 1417 |
# match evpn default-route |
| 1418 |
# match evpn route-type prefix |
| 1419 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1420 |
# match interface Vlan7 |
| 1421 |
# match ext-community bgp_ext_comm1 |
| 1422 |
# match tag 7284 |
| 1423 |
# match local-preference 8000 |
| 1424 |
# match source-vrf Vrf1 |
| 1425 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 1426 |
# match peer PortChannel 14 |
| 1427 |
# match source-protocol bgp |
| 1428 |
# match metric 400 |
| 1429 |
# match origin egp |
| 1430 |
# set community 79:150 308:650 45:736 no-export no-peer additive |
| 1431 |
# set extcommunity soo 10.73.14.9:78 |
| 1432 |
# set comm-list bgp_comm_list2 delete |
| 1433 |
# set metric +rtt |
| 1434 |
# set ipv6 next-hop global 30::30 |
| 1435 |
# set local-preference 635 |
| 1436 |
# set origin egp |
| 1437 |
# set weight 93471 |
| 1438 |
# set tag 65 |
| 1439 |
|
| 1440 |
|
| 1441 |
# Using "deleted" state to remove a route map or route map subset |
| 1442 |
# |
| 1443 |
# Before state: |
| 1444 |
# ------------ |
| 1445 |
# |
| 1446 |
# sonic# show running-configuration route-map |
| 1447 |
# ! |
| 1448 |
# route-map rm1 permit 80 |
| 1449 |
# match evpn default-route |
| 1450 |
# match evpn route-type prefix |
| 1451 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1452 |
# match interface Vlan7 |
| 1453 |
# match ext-community bgp_ext_comm1 |
| 1454 |
# match tag 7284 |
| 1455 |
# match local-preference 8000 |
| 1456 |
# match source-vrf Vrf1 |
| 1457 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 1458 |
# match peer PortChannel 14 |
| 1459 |
# match source-protocol bgp |
| 1460 |
# match metric 400 |
| 1461 |
# match origin egp |
| 1462 |
# set community 79:150 308:650 45:736 no-export no-peer additive |
| 1463 |
# set extcommunity soo 10.73.14.9:78 |
| 1464 |
# set comm-list bgp_comm_list2 delete |
| 1465 |
# set metric +rtt |
| 1466 |
# set ip next-hop 10.48.16.18 |
| 1467 |
# set ipv6 next-hop global 30::30 |
| 1468 |
# set local-preference 635 |
| 1469 |
# set origin egp |
| 1470 |
# set weight 93471 |
| 1471 |
# set tag 65 |
| 1472 |
# ! |
| 1473 |
# route-map rm1 deny 3047 |
| 1474 |
# match as-path bgp_as3 |
| 1475 |
# match evpn route-type multicast |
| 1476 |
# match ext-community bgp_ext_comm2 |
| 1477 |
# match peer Ethernet6 |
| 1478 |
# match source-protocol ospf |
| 1479 |
# match origin igp |
| 1480 |
# set metric -rtt |
| 1481 |
# set origin incomplete |
| 1482 |
# ! |
| 1483 |
# route-map rm2 permit 100 |
| 1484 |
# match interface Ethernet16 |
| 1485 |
# set as-path prepend 200,300,400 |
| 1486 |
# set metric 8000 |
| 1487 |
# set ipv6 next-hop prefer-global |
| 1488 |
# set ipv6 next-hop global 37::58 |
| 1489 |
# ! |
| 1490 |
# route-map rm3 deny 285 |
| 1491 |
# match evpn route-type macip |
| 1492 |
# match local-preference 14783 |
| 1493 |
# call rm1 |
| 1494 |
# match peer 87:95:15::53 |
| 1495 |
# match source-protocol bgp |
| 1496 |
# match origin igp |
| 1497 |
# set community no-advertise |
| 1498 |
# set metric rtt |
| 1499 |
# set origin igp |
| 1500 |
# ! |
| 1501 |
# route-map rm4 permit 480 |
| 1502 |
# match evpn route-type prefix |
| 1503 |
# match source-protocol static |
| 1504 |
# set metric -rtt |
| 1505 |
# ------------ |
| 1506 |
- name: Delete a route map subset or a route map |
| 1507 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 1508 |
config: |
| 1509 |
- map_name: rm1 |
| 1510 |
sequence_num: 3047 |
| 1511 |
- map_name: rm2 |
| 1512 |
state: deleted |
| 1513 |
|
| 1514 |
# After state: |
| 1515 |
# ------------ |
| 1516 |
# |
| 1517 |
# sonic# show running-configuration route-map |
| 1518 |
# ! |
| 1519 |
# route-map rm1 permit 80 |
| 1520 |
# match evpn default-route |
| 1521 |
# match evpn route-type prefix |
| 1522 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1523 |
# match interface Vlan7 |
| 1524 |
# match ext-community bgp_ext_comm1 |
| 1525 |
# match tag 7284 |
| 1526 |
# match local-preference 8000 |
| 1527 |
# match source-vrf Vrf1 |
| 1528 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 1529 |
# match peer PortChannel 14 |
| 1530 |
# match source-protocol bgp |
| 1531 |
# match metric 400 |
| 1532 |
# match origin egp |
| 1533 |
# set community 79:150 308:650 45:736 no-export no-peer additive |
| 1534 |
# set extcommunity soo 10.73.14.9:78 |
| 1535 |
# set comm-list bgp_comm_list2 delete |
| 1536 |
# set metric +rtt |
| 1537 |
# set ip next-hop 10.48.16.18 |
| 1538 |
# set ipv6 next-hop global 30::30 |
| 1539 |
# set local-preference 635 |
| 1540 |
# set origin egp |
| 1541 |
# set weight 93471 |
| 1542 |
# set tag 65 |
| 1543 |
# ! |
| 1544 |
# route-map rm3 deny 285 |
| 1545 |
# match evpn route-type macip |
| 1546 |
# match local-preference 14783 |
| 1547 |
# call rm1 |
| 1548 |
# match peer 87:95:15::53 |
| 1549 |
# match source-protocol bgp |
| 1550 |
# match origin igp |
| 1551 |
# set community no-advertise |
| 1552 |
# set metric rtt |
| 1553 |
# set origin igp |
| 1554 |
# ! |
| 1555 |
# route-map rm4 permit 480 |
| 1556 |
# match evpn route-type prefix |
| 1557 |
# match source-protocol static |
| 1558 |
# set metric -rtt |
| 1559 |
|
| 1560 |
|
| 1561 |
# Using "deleted" state to remove all route map configuration |
| 1562 |
# |
| 1563 |
# Before state: |
| 1564 |
# ------------ |
| 1565 |
# |
| 1566 |
# sonic# show running-configuration route-map |
| 1567 |
# ! |
| 1568 |
# route-map rm1 permit 80 |
| 1569 |
# match evpn default-route |
| 1570 |
# match evpn route-type prefix |
| 1571 |
# match ipv6 address prefix-list ipv6_pfx_list1 |
| 1572 |
# match interface Vlan7 |
| 1573 |
# match ext-community bgp_ext_comm1 |
| 1574 |
# match tag 7284 |
| 1575 |
# match local-preference 8000 |
| 1576 |
# match source-vrf Vrf1 |
| 1577 |
# match ip next-hop prefix-list ip_pfx_list3 |
| 1578 |
# match peer PortChannel 14 |
| 1579 |
# match source-protocol bgp |
| 1580 |
# match metric 400 |
| 1581 |
# match origin egp |
| 1582 |
# set community 79:150 308:650 45:736 no-export no-peer additive |
| 1583 |
# set extcommunity soo 10.73.14.9:78 |
| 1584 |
# set comm-list bgp_comm_list2 delete |
| 1585 |
# set metric +rtt |
| 1586 |
# set ip next-hop 10.48.16.18 |
| 1587 |
# set ipv6 next-hop global 30::30 |
| 1588 |
# set local-preference 635 |
| 1589 |
# set origin egp |
| 1590 |
# set weight 93471 |
| 1591 |
# set tag 65 |
| 1592 |
# ! |
| 1593 |
# route-map rm3 deny 285 |
| 1594 |
# match evpn route-type macip |
| 1595 |
# match local-preference 14783 |
| 1596 |
# call rm1 |
| 1597 |
# match peer 87:95:15::53 |
| 1598 |
# match source-protocol bgp |
| 1599 |
# match origin igp |
| 1600 |
# set community no-advertise |
| 1601 |
# set metric rtt |
| 1602 |
# set origin igp |
| 1603 |
# ! |
| 1604 |
# route-map rm4 permit 480 |
| 1605 |
# match evpn route-type prefix |
| 1606 |
# match source-protocol static |
| 1607 |
# set metric -rtt |
| 1608 |
# ------------ |
| 1609 |
- name: Delete all route map configuration |
| 1610 |
dellemc.enterprise_sonic.sonic_route_maps: |
| 1611 |
config: [] |
| 1612 |
state: deleted |
| 1613 |
|
| 1614 |
# After state: |
| 1615 |
# ------------ |
| 1616 |
# |
| 1617 |
# sonic# show running-configuration route-map |
| 1618 |
# sonic# |
| 1619 |
# (no route map configuration present) |
| 1620 |
""" |
| 1621 |
|
| 1622 |
RETURN = """ |
| 1623 |
before: |
| 1624 |
description: The configuration prior to the module invocation. |
| 1625 |
returned: always |
| 1626 |
type: list |
| 1627 |
sample: > |
| 1628 |
The configuration returned will always be in the same format |
| 1629 |
as the parameters above. |
| 1630 |
after: |
| 1631 |
description: The resulting configuration module invocation. |
| 1632 |
returned: when changed |
| 1633 |
type: list |
| 1634 |
sample: > |
| 1635 |
The configuration returned will always be in the same format |
| 1636 |
as the parameters above. |
| 1637 |
after_generated: |
| 1638 |
description: The generated configuration module invocation. |
| 1639 |
returned: when C(check_mode) |
| 1640 |
type: list |
| 1641 |
sample: > |
| 1642 |
The configuration returned will always be in the same format |
| 1643 |
as the parameters above. |
| 1644 |
commands: |
| 1645 |
description: The set of commands pushed to the remote device. |
| 1646 |
returned: always |
| 1647 |
type: list |
| 1648 |
sample: ['command 1', 'command 2', 'command 3'] |
| 1649 |
""" |
| 1650 |
|
| 1651 |
|
| 1652 |
from ansible.module_utils.basic import AnsibleModule |
| 1653 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.route_maps.route_maps import Route_mapsArgs |
| 1654 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.config.route_maps.route_maps import Route_maps |
| 1655 |
|
| 1656 |
|
| 1657 |
def main(): |
| 1658 |
""" |
| 1659 |
Main entry point for module execution |
| 1660 |
|
| 1661 |
:returns: the result form module invocation |
| 1662 |
""" |
| 1663 |
module = AnsibleModule(argument_spec=Route_mapsArgs.argument_spec, |
| 1664 |
supports_check_mode=True) |
| 1665 |
|
| 1666 |
result = Route_maps(module).execute_module() |
| 1667 |
module.exit_json(**result) |
| 1668 |
|
| 1669 |
|
| 1670 |
if __name__ == '__main__': |
| 1671 |
main() |