| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
""" |
| 8 |
The module file for sonic_ospf_area |
| 9 |
""" |
| 10 |
|
| 11 |
from __future__ import absolute_import, division, print_function |
| 12 |
__metaclass__ = type |
| 13 |
|
| 14 |
DOCUMENTATION = """ |
| 15 |
--- |
| 16 |
module: sonic_ospf_area |
| 17 |
description: This module provides configuration for the area settings of OSPF running on SONiC switches |
| 18 |
version_added: "2.5.0" |
| 19 |
short_description: configure OSPF area settings on SONiC |
| 20 |
author: "Xiao Han (@Xiao_Han2)" |
| 21 |
options: |
| 22 |
config: |
| 23 |
description: |
| 24 |
- Specifies configuration for OSPFv2 areas |
| 25 |
type: list |
| 26 |
elements: dict |
| 27 |
suboptions: |
| 28 |
area_id: |
| 29 |
type: str |
| 30 |
required: true |
| 31 |
description: |
| 32 |
- Area ID of the network (A.B.C.D or 0 to 4294967295). |
| 33 |
vrf_name: |
| 34 |
type: str |
| 35 |
default: 'default' |
| 36 |
description: name of the vrf this area belongs to |
| 37 |
authentication_type: |
| 38 |
type: str |
| 39 |
choices: |
| 40 |
- message_digest |
| 41 |
- text |
| 42 |
description: authentication type for area |
| 43 |
default_cost: |
| 44 |
description: |
| 45 |
- Configure NSSA or stub area summary default cost |
| 46 |
- range is 0 to 16777215 inclusive |
| 47 |
type: int |
| 48 |
filter_list_in: |
| 49 |
type: str |
| 50 |
description: |
| 51 |
- inter area prefix filter list. |
| 52 |
- Filter incoming prefixes into the area. |
| 53 |
- expects name of a prefix list. |
| 54 |
filter_list_out: |
| 55 |
type: str |
| 56 |
description: |
| 57 |
- inter area prefix filter list. |
| 58 |
- Filter outgoing prefixes from the area. |
| 59 |
- expects name of a prefix list. |
| 60 |
networks: |
| 61 |
type: list |
| 62 |
elements: str |
| 63 |
description: |
| 64 |
- Configure networks in an area |
| 65 |
- is a masked ip address |
| 66 |
ranges: |
| 67 |
type: list |
| 68 |
elements: dict |
| 69 |
description: Configure address range summarization on border routers |
| 70 |
suboptions: |
| 71 |
prefix: |
| 72 |
type: str |
| 73 |
required: true |
| 74 |
description: |
| 75 |
- address range prefix |
| 76 |
- is a masked ip address |
| 77 |
advertise: |
| 78 |
type: bool |
| 79 |
description: |
| 80 |
- enable address range advertising |
| 81 |
- default of true |
| 82 |
cost: |
| 83 |
type: int |
| 84 |
description: |
| 85 |
- configure cost of address range |
| 86 |
- range is 0 to 16777215 inclusive |
| 87 |
substitute: |
| 88 |
type: str |
| 89 |
description: |
| 90 |
- Configure substitute prefix for the address range |
| 91 |
- is a masked ip address |
| 92 |
shortcut: |
| 93 |
type: str |
| 94 |
choices: |
| 95 |
- default |
| 96 |
- disable |
| 97 |
- enable |
| 98 |
description: Configure area's shortcut mode |
| 99 |
stub: |
| 100 |
type: dict |
| 101 |
description: configuration for stub type area |
| 102 |
suboptions: |
| 103 |
enabled: |
| 104 |
type: bool |
| 105 |
description: configure area as stub type area |
| 106 |
no_summary: |
| 107 |
type: bool |
| 108 |
description: disable inter-area route injection into the stub |
| 109 |
virtual_links: |
| 110 |
type: list |
| 111 |
elements: dict |
| 112 |
description: configuration for virtual links |
| 113 |
suboptions: |
| 114 |
enabled: |
| 115 |
type: bool |
| 116 |
description: |
| 117 |
- enable virtual link |
| 118 |
- virtual link must be enabled for creation |
| 119 |
router_id: |
| 120 |
type: str |
| 121 |
required: true |
| 122 |
description: |
| 123 |
- router id of the remote ABR |
| 124 |
- ip address format |
| 125 |
dead_interval: |
| 126 |
type: int |
| 127 |
description: |
| 128 |
- configure adjacency dead interval |
| 129 |
- value is in seconds |
| 130 |
- range is 1 to 65535 inclusive |
| 131 |
hello_interval: |
| 132 |
type: int |
| 133 |
description: |
| 134 |
- configure neighbor hello interval |
| 135 |
- value is in seconds |
| 136 |
- range is 1 to 65535 inclusive |
| 137 |
retransmit_interval: |
| 138 |
type: int |
| 139 |
description: |
| 140 |
- configure LSA retransmit interval |
| 141 |
- value is in seconds |
| 142 |
- range is 1 to 65535 inclusive |
| 143 |
transmit_delay: |
| 144 |
type: int |
| 145 |
description: |
| 146 |
- configure LSA transmit delay |
| 147 |
- value is in seconds |
| 148 |
- range is 1 to 65535 inclusive |
| 149 |
authentication: |
| 150 |
type: dict |
| 151 |
description: configure authentication settings for virtual link |
| 152 |
suboptions: |
| 153 |
auth_type: |
| 154 |
type: str |
| 155 |
choices: |
| 156 |
- message_digest |
| 157 |
- text |
| 158 |
- none |
| 159 |
description: authentication type for virtual link |
| 160 |
key: |
| 161 |
type: str |
| 162 |
description: text authentication password for virtual link |
| 163 |
key_encrypted: |
| 164 |
type: bool |
| 165 |
description: password is in encrypted format |
| 166 |
message_digest_list: |
| 167 |
type: list |
| 168 |
elements: dict |
| 169 |
description: |
| 170 |
- configure message-digest authentication keys |
| 171 |
- For deletion, only the key_id is used. |
| 172 |
suboptions: |
| 173 |
key_id: |
| 174 |
type: int |
| 175 |
required: true |
| 176 |
description: |
| 177 |
- message-digest authentication key id |
| 178 |
- range is 1 to 255 inclusive |
| 179 |
key: |
| 180 |
type: str |
| 181 |
description: authentication password (ignored for deletion) |
| 182 |
key_encrypted: |
| 183 |
type: bool |
| 184 |
description: password is in encrypted format (ignored for deletion) |
| 185 |
state: |
| 186 |
description: |
| 187 |
- Specifies the type of configuration update to be performed on the device. |
| 188 |
type: str |
| 189 |
choices: |
| 190 |
- merged |
| 191 |
- replaced |
| 192 |
- overridden |
| 193 |
- deleted |
| 194 |
default: merged |
| 195 |
""" |
| 196 |
|
| 197 |
EXAMPLES = """ |
| 198 |
# NOTE: Configuration of an OSPF network instance (VRF) is required before an OSPF "area" can |
| 199 |
# be configured in association with that network instance (VRF). |
| 200 |
|
| 201 |
# ============ MERGED ================== |
| 202 |
|
| 203 |
# Scenario: Using "merged" state to add or change ospf_area settings |
| 204 |
# merging all settings for an area |
| 205 |
|
| 206 |
# Before state: |
| 207 |
|
| 208 |
# sonic# show running-configuration ospf |
| 209 |
# router ospf vrf Vrf1 |
| 210 |
# ! |
| 211 |
# router ospf vrf Vrf2 |
| 212 |
# ! |
| 213 |
|
| 214 |
# example: |
| 215 |
- name: merge examples of all settings |
| 216 |
sonic_ospf_area: |
| 217 |
state: merged |
| 218 |
config: |
| 219 |
- area_id: 2 |
| 220 |
vrf_name: Vrf1 |
| 221 |
authentication_type: message_digest |
| 222 |
default_cost: 3 |
| 223 |
stub: |
| 224 |
enabled: true |
| 225 |
no_summary: true |
| 226 |
shortcut: default |
| 227 |
- area_id: 3 |
| 228 |
vrf_name: Vrf1 |
| 229 |
filter_list_in: pf1 |
| 230 |
filter_list_out: pf2 |
| 231 |
ranges: |
| 232 |
- prefix: 1.1.1.1/24 |
| 233 |
- prefix: 1.1.1.2/24 |
| 234 |
advertise: true |
| 235 |
cost: 4 |
| 236 |
- prefix: 1.1.1.3/24 |
| 237 |
advertise: false |
| 238 |
- prefix: 1.1.1.4/24 |
| 239 |
advertise: true |
| 240 |
cost: 10 |
| 241 |
substitute: 3.3.3.3/24 |
| 242 |
- area_id: 4 |
| 243 |
vrf_name: Vrf1 |
| 244 |
networks: |
| 245 |
- 1.1.1.1/24 |
| 246 |
- 3.5.1.5/23 |
| 247 |
- 23.235.75.1/23 |
| 248 |
- area_id: 5 |
| 249 |
vrf_name: Vrf1 |
| 250 |
virtual_links: |
| 251 |
- router_id: 34.7.35.1 |
| 252 |
enabled: true |
| 253 |
- router_id: 34.7.35.2 |
| 254 |
enabled: true |
| 255 |
dead_interval: 30 |
| 256 |
hello_interval: 10 |
| 257 |
retransmit_interval: 40 |
| 258 |
transmit_delay: 50 |
| 259 |
authentication: |
| 260 |
auth_type: text |
| 261 |
key: "U2FsdGVkX197YJtZ/3Ac6n5kRIG/ZqeU1/wC0cVFyfU=" |
| 262 |
key_encrypted: true |
| 263 |
message_digest_list: |
| 264 |
- key_id: 1 |
| 265 |
key: "U2FsdGVkX1/wbqjMB7Lr+Mm3wY8+lCdaqUmG2rr9Adw=" |
| 266 |
key_encrypted: true |
| 267 |
- key_id: 2 |
| 268 |
key: "U2FsdGVkX18Czj9r8skDrg/wtpwTKKCQ8FXUehpCmHc=" |
| 269 |
key_encrypted: true |
| 270 |
|
| 271 |
# After state |
| 272 |
|
| 273 |
# sonic# show running-configuration ospf |
| 274 |
# router ospf vrf Vrf1 |
| 275 |
# area 0.0.0.2 authentication message-digest |
| 276 |
# area 0.0.0.2 stub no-summary |
| 277 |
# area 0.0.0.2 default-cost 3 |
| 278 |
# area 0.0.0.2 shortcut default |
| 279 |
# area 0.0.0.3 filter-list prefix pf1 in |
| 280 |
# area 0.0.0.3 filter-list prefix pf2 out |
| 281 |
# area 0.0.0.4 |
| 282 |
# area 0.0.0.5 |
| 283 |
# area 0.0.0.5 virtual-link 34.7.35.1 |
| 284 |
# area 0.0.0.5 virtual-link 34.7.35.2 |
| 285 |
# area 0.0.0.5 virtual-link 34.7.35.2 authentication |
| 286 |
# area 0.0.0.5 virtual-link 34.7.35.2 authentication-key U2FsdGVkX197YJtZ/3Ac6n5kRIG/ZqeU1/wC0cVFyfU= encrypted |
| 287 |
# area 0.0.0.5 virtual-link 34.7.35.2 dead-interval 30 |
| 288 |
# area 0.0.0.5 virtual-link 34.7.35.2 hello-interval 10 |
| 289 |
# area 0.0.0.5 virtual-link 34.7.35.2 retransmit-interval 40 |
| 290 |
# area 0.0.0.5 virtual-link 34.7.35.2 transmit-delay 50 |
| 291 |
# area 0.0.0.5 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX1/wbqjMB7Lr+Mm3wY8+lCdaqUmG2rr9Adw= encrypted |
| 292 |
# area 0.0.0.5 virtual-link 34.7.35.2 message-digest-key 2 md5 U2FsdGVkX18Czj9r8skDrg/wtpwTKKCQ8FXUehpCmHc= encrypted |
| 293 |
# area 0.0.0.3 range 1.1.1.1/24 |
| 294 |
# area 0.0.0.3 range 1.1.1.2/24 advertise cost 4 |
| 295 |
# area 0.0.0.3 range 1.1.1.3/24 not-advertise |
| 296 |
# area 0.0.0.3 range 1.1.1.4/24 advertise cost 10 |
| 297 |
# area 0.0.0.3 range 1.1.1.4/24 substitute 3.3.3.3/24 |
| 298 |
# network 1.1.1.1/24 area 0.0.0.4 |
| 299 |
# network 23.235.75.1/23 area 0.0.0.4 |
| 300 |
# network 3.5.1.5/23 area 0.0.0.4 |
| 301 |
# ! |
| 302 |
# router ospf vrf Vrf2 |
| 303 |
# ! |
| 304 |
# ----- |
| 305 |
|
| 306 |
# Scenario: minimum data for config subsections |
| 307 |
|
| 308 |
# Before state: |
| 309 |
|
| 310 |
# sonic# show running-configuration ospf |
| 311 |
# router ospf vrf Vrf1 |
| 312 |
# ! |
| 313 |
# router ospf vrf Vrf2 |
| 314 |
# ! |
| 315 |
|
| 316 |
# example: |
| 317 |
- name: merge smallest group of settings |
| 318 |
sonic_ospf_area: |
| 319 |
state: merged |
| 320 |
config: |
| 321 |
- area_id: 0.0.0.2 |
| 322 |
vrf_name: Vrf1 |
| 323 |
networks: |
| 324 |
- 1.1.1.1/24 |
| 325 |
- area_id: 0.0.0.3 |
| 326 |
vrf_name: Vrf1 |
| 327 |
ranges: |
| 328 |
- prefix: 1.1.1.1/24 |
| 329 |
- area_id: 0.0.0.4 |
| 330 |
vrf_name: Vrf1 |
| 331 |
virtual_links: |
| 332 |
- router_id: 34.7.35.1 |
| 333 |
enabled: true |
| 334 |
- area_id: 0.0.0.5 |
| 335 |
vrf_name: Vrf1 |
| 336 |
virtual_links: |
| 337 |
- router_id: 34.7.35.1 |
| 338 |
enabled: true |
| 339 |
message_digest_list: |
| 340 |
- key_id: 1 |
| 341 |
key: grighr |
| 342 |
# NOTE: The existence of an 'area' is only displayed by this Ansible module if configuration options are |
| 343 |
# currently configured for that area. (An "area" that currently has no configured sub-options is not displayed.) |
| 344 |
|
| 345 |
# After state |
| 346 |
|
| 347 |
# sonic# show running-configuration ospf |
| 348 |
# router ospf vrf Vrf1 |
| 349 |
# area 0.0.0.2 |
| 350 |
# area 0.0.0.3 |
| 351 |
# area 0.0.0.4 |
| 352 |
# area 0.0.0.5 |
| 353 |
# area 0.0.0.4 virtual-link 34.7.35.1 |
| 354 |
# area 0.0.0.5 virtual-link 34.7.35.1 |
| 355 |
# area 0.0.0.5 virtual-link 34.7.35.1 message-digest-key 1 md5 U2FsdGVkX19oCaX2HsxLR2nWtyK15AfE7ajHVjzgoaY= encrypted |
| 356 |
# area 0.0.0.3 range 1.1.1.1/24 |
| 357 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 358 |
# ! |
| 359 |
# router ospf vrf Vrf2 |
| 360 |
# ! |
| 361 |
# ----- |
| 362 |
|
| 363 |
# Scenario: merging and making changes to attributes |
| 364 |
|
| 365 |
# Before state: |
| 366 |
|
| 367 |
# sonic# show running-configuration ospf |
| 368 |
# router ospf vrf Vrf1 |
| 369 |
# area 0.0.0.1 authentication message-digest |
| 370 |
# area 0.0.0.1 stub no-summary |
| 371 |
# area 0.0.0.1 default-cost 6 |
| 372 |
# area 0.0.0.1 filter-list prefix pf1 in |
| 373 |
# area 0.0.0.1 filter-list prefix pf2 out |
| 374 |
# area 0.0.0.1 shortcut disable |
| 375 |
# area 0.0.0.1 virtual-link 1.1.1.1 |
| 376 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication |
| 377 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 378 |
# area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 20 |
| 379 |
# area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 10 |
| 380 |
# area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 10 |
| 381 |
# area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 10 |
| 382 |
# area 0.0.0.1 virtual-link 1.1.1.2 |
| 383 |
# area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 34 |
| 384 |
# area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX1//fyBCsQYQI4q743L8Rf1Q1qUOEc75lNM= encrypted |
| 385 |
# area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted |
| 386 |
# area 0.0.0.1 range 1.1.1.1/24 not-advertise |
| 387 |
# area 0.0.0.1 range 1.1.1.2/24 advertise |
| 388 |
# network 1.1.1.1/24 area 0.0.0.1 |
| 389 |
# network 1.1.1.2/24 area 0.0.0.1 |
| 390 |
# ! |
| 391 |
# router ospf vrf Vrf2 |
| 392 |
# ! |
| 393 |
|
| 394 |
# example: |
| 395 |
- name: "test merge all settings" |
| 396 |
sonic_ospf_area: |
| 397 |
state: merged |
| 398 |
config: |
| 399 |
- area_id: 0.0.0.1 |
| 400 |
vrf_name: Vrf1 |
| 401 |
authentication_type: text |
| 402 |
default_cost: 5 |
| 403 |
filter_list_in: pf2 |
| 404 |
filter_list_out: pf1 |
| 405 |
networks: |
| 406 |
- 1.1.1.5/24 |
| 407 |
ranges: |
| 408 |
- prefix: 1.1.1.1/24 |
| 409 |
advertise: true |
| 410 |
cost: 12 |
| 411 |
substitute: 11.11.1.1/24 |
| 412 |
- prefix: 1.1.1.2/24 |
| 413 |
advertise: false |
| 414 |
shortcut: enable |
| 415 |
stub: |
| 416 |
enabled: true |
| 417 |
no_summary: false |
| 418 |
virtual_links: |
| 419 |
- router_id: 1.1.1.1 |
| 420 |
enabled: true |
| 421 |
dead_interval: 45 |
| 422 |
hello_interval: 21 |
| 423 |
retransmit_interval: 15 |
| 424 |
transmit_delay: 23 |
| 425 |
authentication: |
| 426 |
auth_type: text |
| 427 |
key: "U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ=" |
| 428 |
key_encrypted: true |
| 429 |
message_digest_list: |
| 430 |
- key_id: 1 |
| 431 |
key: "somepass" |
| 432 |
- router_id: 1.1.1.2 |
| 433 |
enabled: true |
| 434 |
dead_interval: 16 |
| 435 |
|
| 436 |
# After state |
| 437 |
|
| 438 |
# sonic# show running-configuration ospf |
| 439 |
# router ospf vrf Vrf1 |
| 440 |
# area 0.0.0.1 authentication |
| 441 |
# area 0.0.0.1 stub |
| 442 |
# area 0.0.0.1 default-cost 5 |
| 443 |
# area 0.0.0.1 filter-list prefix pf2 in |
| 444 |
# area 0.0.0.1 filter-list prefix pf1 out |
| 445 |
# area 0.0.0.1 shortcut enable |
| 446 |
# area 0.0.0.1 virtual-link 1.1.1.1 |
| 447 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication |
| 448 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted |
| 449 |
# area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 45 |
| 450 |
# area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 21 |
| 451 |
# area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 15 |
| 452 |
# area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 23 |
| 453 |
# area 0.0.0.1 virtual-link 1.1.1.2 |
| 454 |
# area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 16 |
| 455 |
# area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX18D0swlrl3pVzMGxRZYzY58X06jPq2CrNU= encrypted |
| 456 |
# area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted |
| 457 |
# area 0.0.0.1 range 1.1.1.1/24 advertise cost 12 |
| 458 |
# area 0.0.0.1 range 1.1.1.1/24 substitute 11.11.1.1/24 |
| 459 |
# area 0.0.0.1 range 1.1.1.2/24 not-advertise |
| 460 |
# network 1.1.1.1/24 area 0.0.0.1 |
| 461 |
# network 1.1.1.2/24 area 0.0.0.1 |
| 462 |
# network 1.1.1.5/24 area 0.0.0.1 |
| 463 |
# ! |
| 464 |
# router ospf vrf Vrf2 |
| 465 |
# ! |
| 466 |
# ----- |
| 467 |
|
| 468 |
# Scenario: merging different keys |
| 469 |
|
| 470 |
# Before state: |
| 471 |
|
| 472 |
# sonic# show running-configuration ospf |
| 473 |
# router ospf vrf Vrf1 |
| 474 |
# ! |
| 475 |
# router ospf vrf Vrf2 |
| 476 |
# ! |
| 477 |
|
| 478 |
# example: |
| 479 |
- name: "test merge different keys" |
| 480 |
sonic_ospf_area: |
| 481 |
state: merged |
| 482 |
config: |
| 483 |
- area_id: 0.0.0.1 |
| 484 |
vrf_name: Vrf1 |
| 485 |
virtual_links: |
| 486 |
- router_id: 1.1.1.1 |
| 487 |
enabled: true |
| 488 |
authentication: |
| 489 |
key: qwerty |
| 490 |
key_encrypted: false |
| 491 |
- router_id: 1.1.1.3 |
| 492 |
enabled: true |
| 493 |
authentication: |
| 494 |
key: "U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ=" |
| 495 |
key_encrypted: true |
| 496 |
- router_id: 1.1.1.4 |
| 497 |
enabled: true |
| 498 |
authentication: |
| 499 |
key: somepass |
| 500 |
|
| 501 |
# After state |
| 502 |
|
| 503 |
# sonic# show running-configuration ospf |
| 504 |
# router ospf vrf Vrf1 |
| 505 |
# area 0.0.0.1 |
| 506 |
# area 0.0.0.1 virtual-link 1.1.1.1 |
| 507 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX180JKbs3Rf5IyLot8UW0/srcXdGaQXEHiw= encrypted |
| 508 |
# area 0.0.0.1 virtual-link 1.1.1.3 |
| 509 |
# area 0.0.0.1 virtual-link 1.1.1.3 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted |
| 510 |
# area 0.0.0.1 virtual-link 1.1.1.4 |
| 511 |
# area 0.0.0.1 virtual-link 1.1.1.4 authentication-key U2FsdGVkX1+2i/anKXKpEfwZIAkb1Hzkx1nH2IBnlMA= encrypted |
| 512 |
# ! |
| 513 |
# router ospf vrf Vrf2 |
| 514 |
# ! |
| 515 |
# Note: the device automatically converts keys to encrypted format |
| 516 |
# ---------- |
| 517 |
|
| 518 |
# ============ DELETED ================== |
| 519 |
|
| 520 |
# using deleted to remove ospf settings |
| 521 |
# Scenario: deleting all settings for areas |
| 522 |
|
| 523 |
# Before state: |
| 524 |
|
| 525 |
# sonic# show running-configuration ospf |
| 526 |
# router ospf vrf Vrf1 |
| 527 |
# area 0.0.0.1 authentication message-digest |
| 528 |
# area 0.0.0.1 stub no-summary |
| 529 |
# area 0.0.0.1 default-cost 6 |
| 530 |
# area 0.0.0.1 filter-list prefix pf1 in |
| 531 |
# area 0.0.0.1 filter-list prefix pf2 out |
| 532 |
# area 0.0.0.1 shortcut disable |
| 533 |
# area 0.0.0.2 stub no-summary |
| 534 |
# area 0.0.0.2 shortcut disable |
| 535 |
# area 0.0.0.3 shortcut default |
| 536 |
# area 0.0.0.1 virtual-link 1.1.1.1 |
| 537 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication |
| 538 |
# area 0.0.0.1 virtual-link 1.1.1.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 539 |
# area 0.0.0.1 virtual-link 1.1.1.1 dead-interval 20 |
| 540 |
# area 0.0.0.1 virtual-link 1.1.1.1 hello-interval 10 |
| 541 |
# area 0.0.0.1 virtual-link 1.1.1.1 retransmit-interval 10 |
| 542 |
# area 0.0.0.1 virtual-link 1.1.1.1 transmit-delay 10 |
| 543 |
# area 0.0.0.1 virtual-link 1.1.1.2 |
| 544 |
# area 0.0.0.1 virtual-link 1.1.1.2 dead-interval 34 |
| 545 |
# area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 1 md5 U2FsdGVkX1//fyBCsQYQI4q743L8Rf1Q1qUOEc75lNM= encrypted |
| 546 |
# area 0.0.0.1 virtual-link 1.1.1.1 message-digest-key 2 md5 U2FsdGVkX18tvS+HyOt1zIbx9P8I9NMguQ17NZGd9ZY= encrypted |
| 547 |
# area 0.0.0.1 range 1.1.1.1/24 not-advertise |
| 548 |
# area 0.0.0.1 range 1.1.1.2/24 advertise |
| 549 |
# area 0.0.0.2 range 1.1.1.1/24 advertise |
| 550 |
# area 0.0.0.3 range 1.1.4.6/24 cost 14 |
| 551 |
# network 1.1.1.1/24 area 0.0.0.1 |
| 552 |
# network 1.1.1.2/24 area 0.0.0.1 |
| 553 |
# ! |
| 554 |
# router ospf vrf Vrf2 |
| 555 |
# ! |
| 556 |
|
| 557 |
# example: |
| 558 |
- name: "test delete all settings for areas" |
| 559 |
sonic_ospf_area: |
| 560 |
state: deleted |
| 561 |
config: |
| 562 |
- area_id: 0.0.0.1 |
| 563 |
vrf_name: Vrf1 |
| 564 |
- area_id: 0.0.0.2 |
| 565 |
vrf_name: Vrf1 |
| 566 |
ranges: |
| 567 |
- prefix: 1.1.1.1/24 |
| 568 |
shortcut: disable |
| 569 |
stub: |
| 570 |
enabled: true |
| 571 |
no_summary: true |
| 572 |
|
| 573 |
# After state |
| 574 |
|
| 575 |
# sonic# show running-configuration ospf |
| 576 |
# router ospf vrf Vrf1 |
| 577 |
# area 0.0.0.3 shortcut default |
| 578 |
# area 0.0.0.3 range 1.1.4.6/24 cost 14 |
| 579 |
# ! |
| 580 |
# router ospf vrf Vrf2 |
| 581 |
# ! |
| 582 |
# ----- |
| 583 |
|
| 584 |
|
| 585 |
# Scenario: clearing subsections of config |
| 586 |
|
| 587 |
# Before state: |
| 588 |
|
| 589 |
# sonic# show running-configuration ospf |
| 590 |
# router ospf vrf Vrf1 |
| 591 |
# area 0.0.0.1 shortcut default |
| 592 |
# area 0.0.0.2 authentication message-digest |
| 593 |
# area 0.0.0.3 filter-list prefix pf1 in |
| 594 |
# area 0.0.0.4 |
| 595 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 596 |
# area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30 |
| 597 |
# area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50 |
| 598 |
# area 0.0.0.3 virtual-link 34.7.35.2 |
| 599 |
# area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10 |
| 600 |
# area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40 |
| 601 |
# area 0.0.0.4 virtual-link 34.7.35.1 |
| 602 |
# area 0.0.0.4 virtual-link 34.7.35.1 authentication |
| 603 |
# area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX1/lz7KE/onDUAhQU2nftsm/nddLb2ZvYSQ= encrypted |
| 604 |
# area 0.0.0.4 virtual-link 34.7.35.1 dead-interval 10 |
| 605 |
# area 0.0.0.4 virtual-link 34.7.35.2 |
| 606 |
# area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10 |
| 607 |
# area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted |
| 608 |
# area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 609 |
# area 0.0.0.1 range 1.1.1.2/24 advertise cost 4 |
| 610 |
# area 0.0.0.1 range 1.1.1.3/24 not-advertise |
| 611 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 612 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 613 |
# network 3.5.1.5/23 area 0.0.0.2 |
| 614 |
# ! |
| 615 |
# router ospf vrf Vrf2 |
| 616 |
# ! |
| 617 |
|
| 618 |
# example: |
| 619 |
- name: "test clear subsections" |
| 620 |
sonic_ospf_area: |
| 621 |
state: deleted |
| 622 |
config: |
| 623 |
- area_id: 0.0.0.1 |
| 624 |
vrf_name: Vrf1 |
| 625 |
ranges: [] |
| 626 |
- area_id: 0.0.0.2 |
| 627 |
vrf_name: Vrf1 |
| 628 |
networks: [] |
| 629 |
- area_id: 0.0.0.3 |
| 630 |
vrf_name: Vrf1 |
| 631 |
virtual_links: [] |
| 632 |
- area_id: 4 |
| 633 |
vrf_name: Vrf1 |
| 634 |
virtual_links: |
| 635 |
- router_id: 34.7.35.1 |
| 636 |
authentication: {} |
| 637 |
- router_id: 34.7.35.2 |
| 638 |
message_digest_list: [] |
| 639 |
|
| 640 |
# After state |
| 641 |
|
| 642 |
# sonic# show running-configuration ospf |
| 643 |
# router ospf vrf Vrf1 |
| 644 |
# area 0.0.0.1 shortcut default |
| 645 |
# area 0.0.0.2 authentication message-digest |
| 646 |
# area 0.0.0.3 filter-list prefix pf1 in |
| 647 |
# area 0.0.0.4 |
| 648 |
# area 0.0.0.4 virtual-link 34.7.35.1 |
| 649 |
# area 0.0.0.4 virtual-link 34.7.35.1 dead-interval 10 |
| 650 |
# area 0.0.0.4 virtual-link 34.7.35.2 |
| 651 |
# area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10 |
| 652 |
# ! |
| 653 |
# router ospf vrf Vrf2 |
| 654 |
# ! |
| 655 |
# ----- |
| 656 |
|
| 657 |
# Scenario: deleting individual attributes |
| 658 |
|
| 659 |
# Before state: |
| 660 |
|
| 661 |
# sonic# show running-configuration ospf |
| 662 |
# router ospf vrf Vrf1 |
| 663 |
# area 0.0.0.1 filter-list prefix pf1 in |
| 664 |
# area 0.0.0.1 filter-list prefix pf2 out |
| 665 |
# area 0.0.0.2 authentication message-digest |
| 666 |
# area 0.0.0.3 |
| 667 |
# area 0.0.0.4 stub no-summary |
| 668 |
# area 0.0.0.4 default-cost 3 |
| 669 |
# area 0.0.0.4 shortcut default |
| 670 |
# area 0.0.0.5 stub |
| 671 |
# area 0.0.0.5 default-cost 5 |
| 672 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 673 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication |
| 674 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 675 |
# area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30 |
| 676 |
# area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50 |
| 677 |
# area 0.0.0.3 virtual-link 34.7.35.2 |
| 678 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest |
| 679 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 680 |
# area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10 |
| 681 |
# area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40 |
| 682 |
# area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50 |
| 683 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted |
| 684 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 685 |
# area 0.0.0.1 range 1.1.1.1/24 advertise cost 13 |
| 686 |
# area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24 |
| 687 |
# area 0.0.0.1 range 1.1.1.2/24 advertise cost 4 |
| 688 |
# area 0.0.0.1 range 1.1.1.3/24 advertise |
| 689 |
# area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24 |
| 690 |
# area 0.0.0.1 range 1.1.1.4/24 advertise cost 34 |
| 691 |
# area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24 |
| 692 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 693 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 694 |
# network 3.5.1.5/23 area 0.0.0.2 |
| 695 |
# ! |
| 696 |
# router ospf vrf Vrf2 |
| 697 |
# ! |
| 698 |
|
| 699 |
# example: |
| 700 |
- name: "delete individual attributes" |
| 701 |
sonic_ospf_area: |
| 702 |
state: deleted |
| 703 |
config: |
| 704 |
- area_id: 0.0.0.1 |
| 705 |
vrf_name: Vrf1 |
| 706 |
filter_list_in: pf1 |
| 707 |
filter_list_out: pf2 |
| 708 |
ranges: |
| 709 |
- prefix: 1.1.1.1/24 |
| 710 |
- prefix: 1.1.1.2/24 |
| 711 |
cost: 4 |
| 712 |
- prefix: 1.1.1.3/24 |
| 713 |
substitute: 2.2.2.2/24 |
| 714 |
- area_id: 0.0.0.2 |
| 715 |
vrf_name: Vrf1 |
| 716 |
authentication_type: message_digest |
| 717 |
networks: |
| 718 |
- 1.1.1.1/24 |
| 719 |
- 3.5.1.5/23 |
| 720 |
- area_id: 3 |
| 721 |
vrf_name: Vrf1 |
| 722 |
virtual_links: |
| 723 |
- router_id: 34.7.35.1 |
| 724 |
transmit_delay: 50 |
| 725 |
hello_interval: 30 |
| 726 |
authentication: |
| 727 |
auth_type: text |
| 728 |
- router_id: 34.7.35.2 |
| 729 |
enabled: true |
| 730 |
dead_interval: 10 |
| 731 |
retransmit_interval: 40 |
| 732 |
message_digest_list: |
| 733 |
- key_id: 1 |
| 734 |
authentication: |
| 735 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 736 |
key_encrypted: true |
| 737 |
- area_id: 4 |
| 738 |
vrf_name: Vrf1 |
| 739 |
shortcut: default |
| 740 |
stub: |
| 741 |
enabled: true |
| 742 |
no_summary: true |
| 743 |
- area_id: 5 |
| 744 |
vrf_name: Vrf1 |
| 745 |
default_cost: 5 |
| 746 |
stub: |
| 747 |
enabled: true |
| 748 |
|
| 749 |
# After state |
| 750 |
|
| 751 |
# sonic# show running-configuration ospf |
| 752 |
# router ospf vrf Vrf1 |
| 753 |
# area 0.0.0.1 |
| 754 |
# area 0.0.0.2 |
| 755 |
# area 0.0.0.3 |
| 756 |
# area 0.0.0.4 default-cost 3 |
| 757 |
# area 0.0.0.5 |
| 758 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 759 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 760 |
# area 0.0.0.3 virtual-link 34.7.35.2 |
| 761 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest |
| 762 |
# area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50 |
| 763 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 764 |
# area 0.0.0.1 range 1.1.1.2/24 advertise |
| 765 |
# area 0.0.0.1 range 1.1.1.3/24 advertise |
| 766 |
# area 0.0.0.1 range 1.1.1.4/24 advertise cost 34 |
| 767 |
# area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24 |
| 768 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 769 |
# ! |
| 770 |
# router ospf vrf Vrf2 |
| 771 |
# ! |
| 772 |
# ----- |
| 773 |
# ---------- |
| 774 |
|
| 775 |
|
| 776 |
# ============ REPLACED ================== |
| 777 |
|
| 778 |
# Scenario: Replace listed areas |
| 779 |
|
| 780 |
# Before state: |
| 781 |
|
| 782 |
# sonic# show running-configuration ospf |
| 783 |
# router ospf vrf Vrf1 |
| 784 |
# area 0.0.0.1 filter-list prefix pf1 in |
| 785 |
# area 0.0.0.1 filter-list prefix pf2 out |
| 786 |
# area 0.0.0.2 authentication message-digest |
| 787 |
# area 0.0.0.3 |
| 788 |
# area 0.0.0.4 stub no-summary |
| 789 |
# area 0.0.0.4 default-cost 3 |
| 790 |
# area 0.0.0.4 shortcut default |
| 791 |
# area 0.0.0.5 stub |
| 792 |
# area 0.0.0.5 default-cost 5 |
| 793 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 794 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication |
| 795 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 796 |
# area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30 |
| 797 |
# area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50 |
| 798 |
# area 0.0.0.3 virtual-link 34.7.35.2 |
| 799 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest |
| 800 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 801 |
# area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10 |
| 802 |
# area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40 |
| 803 |
# area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50 |
| 804 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted |
| 805 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 806 |
# area 0.0.0.1 range 1.1.1.1/24 advertise cost 13 |
| 807 |
# area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24 |
| 808 |
# area 0.0.0.1 range 1.1.1.2/24 advertise cost 4 |
| 809 |
# area 0.0.0.1 range 1.1.1.3/24 advertise |
| 810 |
# area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24 |
| 811 |
# area 0.0.0.1 range 1.1.1.4/24 advertise cost 34 |
| 812 |
# area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24 |
| 813 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 814 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 815 |
# network 3.5.1.5/23 area 0.0.0.2 |
| 816 |
# ! |
| 817 |
# router ospf vrf Vrf2 |
| 818 |
# ! |
| 819 |
|
| 820 |
# example: |
| 821 |
- name: "replace areas" |
| 822 |
sonic_ospf_area: |
| 823 |
state: replaced |
| 824 |
config: |
| 825 |
- area_id: 0.0.0.1 |
| 826 |
vrf_name: Vrf1 |
| 827 |
authentication_type: message_digest |
| 828 |
networks: |
| 829 |
- 1.1.1.1/24 |
| 830 |
- 3.5.1.5/23 |
| 831 |
- 23.235.75.1/23 |
| 832 |
default_cost: 5 |
| 833 |
stub: |
| 834 |
enabled: true |
| 835 |
no_summary: false |
| 836 |
- area_id: 0.0.0.2 |
| 837 |
vrf_name: Vrf1 |
| 838 |
filter_list_in: pf1 |
| 839 |
filter_list_out: pf2 |
| 840 |
shortcut: default |
| 841 |
default_cost: 3 |
| 842 |
stub: |
| 843 |
enabled: true |
| 844 |
no_summary: true |
| 845 |
authentication_type: message_digest |
| 846 |
networks: |
| 847 |
- 1.1.1.1/24 |
| 848 |
- 3.5.1.5/23 |
| 849 |
- 23.235.75.1/23 |
| 850 |
- area_id: 3 |
| 851 |
vrf_name: Vrf1 |
| 852 |
virtual_links: |
| 853 |
- router_id: 34.7.35.1 |
| 854 |
enabled: true |
| 855 |
transmit_delay: 50 |
| 856 |
hello_interval: 30 |
| 857 |
authentication: |
| 858 |
auth_type: text |
| 859 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 860 |
key_encrypted: true |
| 861 |
ranges: |
| 862 |
- prefix: 1.1.1.1/24 |
| 863 |
advertise: true |
| 864 |
substitute: 11.2.5.1/24 |
| 865 |
- prefix: 1.1.1.2/24 |
| 866 |
advertise: true |
| 867 |
cost: 4 |
| 868 |
- prefix: 1.1.1.3/24 |
| 869 |
advertise: true |
| 870 |
substitute: 2.5.3.78/24 |
| 871 |
- area_id: 4 |
| 872 |
vrf_name: Vrf1 |
| 873 |
shortcut: default |
| 874 |
virtual_links: |
| 875 |
- router_id: 34.7.35.1 |
| 876 |
enabled: true |
| 877 |
transmit_delay: 50 |
| 878 |
hello_interval: 30 |
| 879 |
authentication: |
| 880 |
auth_type: text |
| 881 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 882 |
key_encrypted: true |
| 883 |
- router_id: 34.7.35.2 |
| 884 |
transmit_delay: 50 |
| 885 |
enabled: true |
| 886 |
dead_interval: 10 |
| 887 |
retransmit_interval: 40 |
| 888 |
message_digest_list: |
| 889 |
- key_id: 1 |
| 890 |
key: "U2FsdGVkX18mUZjlJL/Q/7vYtx2AUyDc+NcLKc/BOJUA=" |
| 891 |
key_encrypted: true |
| 892 |
- key_id: 3 |
| 893 |
key: "U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo=" |
| 894 |
key_encrypted: true |
| 895 |
authentication: |
| 896 |
auth_type: message_digest |
| 897 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 898 |
key_encrypted: true |
| 899 |
|
| 900 |
# After state |
| 901 |
|
| 902 |
# sonic# show running-configuration ospf |
| 903 |
# router ospf vrf Vrf1 |
| 904 |
# area 0.0.0.1 authentication message-digest |
| 905 |
# area 0.0.0.1 stub |
| 906 |
# area 0.0.0.1 default-cost 5 |
| 907 |
# area 0.0.0.2 authentication message-digest |
| 908 |
# area 0.0.0.2 stub no-summary |
| 909 |
# area 0.0.0.2 default-cost 3 |
| 910 |
# area 0.0.0.2 filter-list prefix pf1 in |
| 911 |
# area 0.0.0.2 filter-list prefix pf2 out |
| 912 |
# area 0.0.0.2 shortcut default |
| 913 |
# area 0.0.0.3 |
| 914 |
# area 0.0.0.4 shortcut default |
| 915 |
# area 0.0.0.5 stub |
| 916 |
# area 0.0.0.5 default-cost 5 |
| 917 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 918 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication |
| 919 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 920 |
# area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30 |
| 921 |
# area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50 |
| 922 |
# area 0.0.0.4 virtual-link 34.7.35.1 |
| 923 |
# area 0.0.0.4 virtual-link 34.7.35.1 authentication |
| 924 |
# area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 925 |
# area 0.0.0.4 virtual-link 34.7.35.1 hello-interval 30 |
| 926 |
# area 0.0.0.4 virtual-link 34.7.35.1 transmit-delay 50 |
| 927 |
# area 0.0.0.4 virtual-link 34.7.35.2 |
| 928 |
# area 0.0.0.4 virtual-link 34.7.35.2 authentication message-digest |
| 929 |
# area 0.0.0.4 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 930 |
# area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10 |
| 931 |
# area 0.0.0.4 virtual-link 34.7.35.2 retransmit-interval 40 |
| 932 |
# area 0.0.0.4 virtual-link 34.7.35.2 transmit-delay 50 |
| 933 |
# area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted |
| 934 |
# area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 935 |
# area 0.0.0.3 range 1.1.1.1/24 advertise |
| 936 |
# area 0.0.0.3 range 1.1.1.1/24 substitute 11.2.5.1/24 |
| 937 |
# area 0.0.0.3 range 1.1.1.2/24 advertise cost 4 |
| 938 |
# area 0.0.0.3 range 1.1.1.3/24 advertise |
| 939 |
# area 0.0.0.3 range 1.1.1.3/24 substitute 2.5.3.78/24 |
| 940 |
# network 1.1.1.1/24 area 0.0.0.1 |
| 941 |
# network 23.235.75.1/23 area 0.0.0.1 |
| 942 |
# network 3.5.1.5/23 area 0.0.0.1 |
| 943 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 944 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 945 |
# network 3.5.1.5/23 area 0.0.0.2 |
| 946 |
# ! |
| 947 |
# router ospf vrf Vrf2 |
| 948 |
# ! |
| 949 |
# ---------- |
| 950 |
|
| 951 |
# ============ OVERRIDDEN ================== |
| 952 |
|
| 953 |
# Scenario: override listed areas |
| 954 |
|
| 955 |
# Before state: |
| 956 |
|
| 957 |
# sonic# show running-configuration ospf |
| 958 |
# router ospf vrf Vrf1 |
| 959 |
# area 0.0.0.1 filter-list prefix pf1 in |
| 960 |
# area 0.0.0.1 filter-list prefix pf2 out |
| 961 |
# area 0.0.0.2 authentication message-digest |
| 962 |
# area 0.0.0.3 |
| 963 |
# area 0.0.0.4 stub no-summary |
| 964 |
# area 0.0.0.4 default-cost 3 |
| 965 |
# area 0.0.0.4 shortcut default |
| 966 |
# area 0.0.0.5 stub |
| 967 |
# area 0.0.0.5 default-cost 5 |
| 968 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 969 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication |
| 970 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 971 |
# area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30 |
| 972 |
# area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50 |
| 973 |
# area 0.0.0.3 virtual-link 34.7.35.2 |
| 974 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication message-digest |
| 975 |
# area 0.0.0.3 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 976 |
# area 0.0.0.3 virtual-link 34.7.35.2 dead-interval 10 |
| 977 |
# area 0.0.0.3 virtual-link 34.7.35.2 retransmit-interval 40 |
| 978 |
# area 0.0.0.3 virtual-link 34.7.35.2 transmit-delay 50 |
| 979 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted |
| 980 |
# area 0.0.0.3 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 981 |
# area 0.0.0.1 range 1.1.1.1/24 advertise cost 13 |
| 982 |
# area 0.0.0.1 range 1.1.1.1/24 substitute 11.2.5.1/24 |
| 983 |
# area 0.0.0.1 range 1.1.1.2/24 advertise cost 4 |
| 984 |
# area 0.0.0.1 range 1.1.1.3/24 advertise |
| 985 |
# area 0.0.0.1 range 1.1.1.3/24 substitute 2.2.2.2/24 |
| 986 |
# area 0.0.0.1 range 1.1.1.4/24 advertise cost 34 |
| 987 |
# area 0.0.0.1 range 1.1.1.4/24 substitute 3.3.3.3/24 |
| 988 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 989 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 990 |
# network 3.5.1.5/23 area 0.0.0.2 |
| 991 |
# ! |
| 992 |
# router ospf vrf Vrf2 |
| 993 |
# ! |
| 994 |
|
| 995 |
# example: |
| 996 |
- name: "override areas" |
| 997 |
sonic_ospf_area: |
| 998 |
state: overridden |
| 999 |
config: |
| 1000 |
- area_id: 0.0.0.1 |
| 1001 |
vrf_name: Vrf1 |
| 1002 |
authentication_type: message_digest |
| 1003 |
networks: |
| 1004 |
- 1.1.1.1/24 |
| 1005 |
- 3.5.1.5/23 |
| 1006 |
- 23.235.75.1/23 |
| 1007 |
default_cost: 5 |
| 1008 |
stub: |
| 1009 |
enabled: true |
| 1010 |
no_summary: false |
| 1011 |
- area_id: 0.0.0.2 |
| 1012 |
vrf_name: Vrf1 |
| 1013 |
filter_list_in: pf1 |
| 1014 |
filter_list_out: pf2 |
| 1015 |
shortcut: default |
| 1016 |
default_cost: 3 |
| 1017 |
stub: |
| 1018 |
enabled: true |
| 1019 |
no_summary: true |
| 1020 |
authentication_type: message_digest |
| 1021 |
networks: |
| 1022 |
- 1.1.1.1/24 |
| 1023 |
- 3.5.1.5/23 |
| 1024 |
- 23.235.75.1/23 |
| 1025 |
- area_id: 3 |
| 1026 |
vrf_name: Vrf1 |
| 1027 |
virtual_links: |
| 1028 |
- router_id: 34.7.35.1 |
| 1029 |
enabled: true |
| 1030 |
transmit_delay: 50 |
| 1031 |
hello_interval: 30 |
| 1032 |
authentication: |
| 1033 |
auth_type: text |
| 1034 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 1035 |
key_encrypted: true |
| 1036 |
ranges: |
| 1037 |
- prefix: 1.1.1.1/24 |
| 1038 |
advertise: true |
| 1039 |
substitute: 11.2.5.1/24 |
| 1040 |
- prefix: 1.1.1.2/24 |
| 1041 |
advertise: true |
| 1042 |
cost: 4 |
| 1043 |
- prefix: 1.1.1.3/24 |
| 1044 |
advertise: true |
| 1045 |
substitute: 2.5.3.78/24 |
| 1046 |
- area_id: 4 |
| 1047 |
vrf_name: Vrf1 |
| 1048 |
shortcut: default |
| 1049 |
virtual_links: |
| 1050 |
- router_id: 34.7.35.1 |
| 1051 |
enabled: true |
| 1052 |
transmit_delay: 50 |
| 1053 |
hello_interval: 30 |
| 1054 |
authentication: |
| 1055 |
auth_type: text |
| 1056 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 1057 |
key_encrypted: true |
| 1058 |
- router_id: 34.7.35.2 |
| 1059 |
transmit_delay: 50 |
| 1060 |
enabled: true |
| 1061 |
dead_interval: 10 |
| 1062 |
retransmit_interval: 40 |
| 1063 |
message_digest_list: |
| 1064 |
- key_id: 1 |
| 1065 |
key: "U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA=" |
| 1066 |
key_encrypted: true |
| 1067 |
- key_id: 3 |
| 1068 |
key: "U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo=" |
| 1069 |
key_encrypted: true |
| 1070 |
authentication: |
| 1071 |
auth_type: message_digest |
| 1072 |
key: "U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ=" |
| 1073 |
key_encrypted: true |
| 1074 |
|
| 1075 |
# After state |
| 1076 |
|
| 1077 |
# sonic# show running-configuration ospf |
| 1078 |
# router ospf vrf Vrf1 |
| 1079 |
# area 0.0.0.1 authentication message-digest |
| 1080 |
# area 0.0.0.1 stub |
| 1081 |
# area 0.0.0.1 default-cost 5 |
| 1082 |
# area 0.0.0.2 authentication message-digest |
| 1083 |
# area 0.0.0.2 stub no-summary |
| 1084 |
# area 0.0.0.2 default-cost 3 |
| 1085 |
# area 0.0.0.2 filter-list prefix pf1 in |
| 1086 |
# area 0.0.0.2 filter-list prefix pf2 out |
| 1087 |
# area 0.0.0.2 shortcut default |
| 1088 |
# area 0.0.0.3 |
| 1089 |
# area 0.0.0.4 shortcut default |
| 1090 |
# area 0.0.0.3 virtual-link 34.7.35.1 |
| 1091 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication |
| 1092 |
# area 0.0.0.3 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 1093 |
# area 0.0.0.3 virtual-link 34.7.35.1 hello-interval 30 |
| 1094 |
# area 0.0.0.3 virtual-link 34.7.35.1 transmit-delay 50 |
| 1095 |
# area 0.0.0.4 virtual-link 34.7.35.1 |
| 1096 |
# area 0.0.0.4 virtual-link 34.7.35.1 authentication |
| 1097 |
# area 0.0.0.4 virtual-link 34.7.35.1 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 1098 |
# area 0.0.0.4 virtual-link 34.7.35.1 hello-interval 30 |
| 1099 |
# area 0.0.0.4 virtual-link 34.7.35.1 transmit-delay 50 |
| 1100 |
# area 0.0.0.4 virtual-link 34.7.35.2 |
| 1101 |
# area 0.0.0.4 virtual-link 34.7.35.2 authentication message-digest |
| 1102 |
# area 0.0.0.4 virtual-link 34.7.35.2 authentication-key U2FsdGVkX18zN46d3pzk+t7TofEHAZGY+5RvgXMwDiQ= encrypted |
| 1103 |
# area 0.0.0.4 virtual-link 34.7.35.2 dead-interval 10 |
| 1104 |
# area 0.0.0.4 virtual-link 34.7.35.2 retransmit-interval 40 |
| 1105 |
# area 0.0.0.4 virtual-link 34.7.35.2 transmit-delay 50 |
| 1106 |
# area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 1 md5 U2FsdGVkX18mUZjlJL/Q/7vYtx2UyDc+NcLKc/BOJUA= encrypted |
| 1107 |
# area 0.0.0.4 virtual-link 34.7.35.2 message-digest-key 3 md5 U2FsdGVkX19SlRpqsnpeRmjq7WmtctYtveHlYF0Faqo= encrypted |
| 1108 |
# area 0.0.0.3 range 1.1.1.1/24 advertise |
| 1109 |
# area 0.0.0.3 range 1.1.1.1/24 substitute 11.2.5.1/24 |
| 1110 |
# area 0.0.0.3 range 1.1.1.2/24 advertise cost 4 |
| 1111 |
# area 0.0.0.3 range 1.1.1.3/24 advertise |
| 1112 |
# area 0.0.0.3 range 1.1.1.3/24 substitute 2.5.3.78/24 |
| 1113 |
# network 1.1.1.1/24 area 0.0.0.1 |
| 1114 |
# network 23.235.75.1/23 area 0.0.0.1 |
| 1115 |
# network 3.5.1.5/23 area 0.0.0.1 |
| 1116 |
# network 1.1.1.1/24 area 0.0.0.2 |
| 1117 |
# network 23.235.75.1/23 area 0.0.0.2 |
| 1118 |
# network 3.5.1.5/23 area 0.0.0.2 |
| 1119 |
# ! |
| 1120 |
# router ospf vrf Vrf2 |
| 1121 |
# ! |
| 1122 |
# ---------- |
| 1123 |
""" |
| 1124 |
|
| 1125 |
RETURN = """ |
| 1126 |
before: |
| 1127 |
description: The configuration prior to the model invocation. |
| 1128 |
returned: always |
| 1129 |
type: list |
| 1130 |
sample: > |
| 1131 |
The configuration returned will always be in the same format |
| 1132 |
as the parameters above. |
| 1133 |
after: |
| 1134 |
description: The resulting configuration model invocation. |
| 1135 |
returned: when changed |
| 1136 |
type: list |
| 1137 |
sample: > |
| 1138 |
The configuration returned will always be in the same format |
| 1139 |
as the parameters above. |
| 1140 |
commands: |
| 1141 |
description: The set of commands pushed to the remote device. |
| 1142 |
returned: always |
| 1143 |
type: list |
| 1144 |
sample: [{"config": ..., "state": ...}, {"config": ..., "state": ...}] |
| 1145 |
""" |
| 1146 |
|
| 1147 |
|
| 1148 |
from ansible.module_utils.basic import AnsibleModule |
| 1149 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.ospf_area.ospf_area import Ospf_areaArgs |
| 1150 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.config.ospf_area.ospf_area import Ospf_area |
| 1151 |
|
| 1152 |
|
| 1153 |
def main(): |
| 1154 |
""" |
| 1155 |
Main entry point for module execution |
| 1156 |
|
| 1157 |
:returns: the result form module invocation |
| 1158 |
""" |
| 1159 |
module = AnsibleModule(argument_spec=Ospf_areaArgs.argument_spec, |
| 1160 |
supports_check_mode=True) |
| 1161 |
|
| 1162 |
result = Ospf_area(module).execute_module() |
| 1163 |
module.exit_json(**result) |
| 1164 |
|
| 1165 |
|
| 1166 |
if __name__ == '__main__': |
| 1167 |
main() |