| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
""" |
| 8 |
The module file for sonic_ospfv2_interfaces |
| 9 |
""" |
| 10 |
|
| 11 |
from __future__ import absolute_import, division, print_function |
| 12 |
__metaclass__ = type |
| 13 |
|
| 14 |
|
| 15 |
DOCUMENTATION = """ |
| 16 |
--- |
| 17 |
module: sonic_ospfv2_interfaces |
| 18 |
version_added: '2.5.0' |
| 19 |
notes: |
| 20 |
- Supports C(check_mode). |
| 21 |
short_description: Configure OSPFv2 interface mode protocol settings on SONiC. |
| 22 |
description: |
| 23 |
- This module provides configuration management of OSPFv2 interface mode parameters on devices running SONiC. |
| 24 |
- Configure VRF instance before configuring OSPF in a VRF. |
| 25 |
- Configure OSPF instance before configuring OSPF in interfaces. |
| 26 |
author: "Santhosh kumar T (@santhosh-kt)" |
| 27 |
options: |
| 28 |
config: |
| 29 |
description: |
| 30 |
- Specifies the OSPFv2 interface configurations. |
| 31 |
type: list |
| 32 |
elements: dict |
| 33 |
suboptions: |
| 34 |
name: |
| 35 |
required: True |
| 36 |
type: str |
| 37 |
description: |
| 38 |
- Full name of the interface, i.e. Ethernet1. |
| 39 |
ospf_attributes: |
| 40 |
description: |
| 41 |
- Specifies OSPFv2 configurations for the interface. |
| 42 |
- If I(address) is not specified, the IPv4 address of the interface is considered. |
| 43 |
- I(dead_interval) and I(hello_multiplier) are mutually exclusive. |
| 44 |
type: list |
| 45 |
elements: dict |
| 46 |
suboptions: |
| 47 |
address: |
| 48 |
description: |
| 49 |
- Specifies the interface IPv4 address. |
| 50 |
type: str |
| 51 |
area_id: |
| 52 |
description: |
| 53 |
- OSPFv2 Area ID of the network (A.B.C.D or 0 to 4294967295). |
| 54 |
type: str |
| 55 |
authentication_type: |
| 56 |
description: |
| 57 |
- Enable OSPFv2 authentication and its type. |
| 58 |
- C(MD5HMAC) - Enable Message digest authentication type. |
| 59 |
- C(NONE) - Enable null authentication. |
| 60 |
- C(TEXT) - Enable plain text authentication. |
| 61 |
type: str |
| 62 |
choices: |
| 63 |
- 'MD5HMAC' |
| 64 |
- 'NONE' |
| 65 |
- 'TEXT' |
| 66 |
authentication: |
| 67 |
description: |
| 68 |
- Configure OSPFv2 plain text authentication type password. |
| 69 |
- Authentication key shall be max 8 charater long. |
| 70 |
type: dict |
| 71 |
suboptions: |
| 72 |
password: |
| 73 |
description: |
| 74 |
- Specifies the authentication password. |
| 75 |
- Plain text password i.e. password with I(encrypted=false) will be stored in encrypted format in running-config, so idempotency will |
| 76 |
not be maintained and hence the task output will always be I(changed=true). |
| 77 |
type: str |
| 78 |
required: true |
| 79 |
encrypted: |
| 80 |
description: |
| 81 |
- Indicates whether the password is in encrypted format. |
| 82 |
type: bool |
| 83 |
cost: |
| 84 |
description: |
| 85 |
- Configure OSPFv2 interface cost (1 to 65535). |
| 86 |
type: int |
| 87 |
dead_interval: |
| 88 |
description: |
| 89 |
- Configure OSPFv2 adjacency dead interval (1 to 65535). |
| 90 |
type: int |
| 91 |
hello_multiplier: |
| 92 |
description: |
| 93 |
- Minimal 1s dead-interval with fast sub-second hellos. |
| 94 |
- Number of Hellos to send each second (1 to 10). |
| 95 |
type: int |
| 96 |
hello_interval: |
| 97 |
description: |
| 98 |
- Configure OSPFv2 neighbour hello interval (1 to 65535). |
| 99 |
type: int |
| 100 |
md_authentication: |
| 101 |
description: |
| 102 |
- Configure OSPFv2 message digest keys and password. |
| 103 |
- Uses MD5 algorithm. |
| 104 |
type: list |
| 105 |
elements: dict |
| 106 |
suboptions: |
| 107 |
key_id: |
| 108 |
description: |
| 109 |
- Specifies the OSPFv2 message digest key ID (1 to 255). |
| 110 |
type: int |
| 111 |
required: True |
| 112 |
md5key: |
| 113 |
description: |
| 114 |
- Specifies the OSPFv2 message digest password. |
| 115 |
- Plain text password i.e. password with I(encrypted=false) will be stored in encrypted format in running-config, so idempotency will |
| 116 |
not be maintained and hence the task output will always be I(changed=true). |
| 117 |
type: str |
| 118 |
encrypted: |
| 119 |
description: |
| 120 |
- Indicates whether the password is in encrypted format. |
| 121 |
type: bool |
| 122 |
mtu_ignore: |
| 123 |
description: |
| 124 |
- Disable OSPFv2 MTU mismatch detection. |
| 125 |
type: bool |
| 126 |
priority: |
| 127 |
description: |
| 128 |
- Configure OSPFv2 adjacency router priority (0 to 255). |
| 129 |
type: int |
| 130 |
retransmit_interval: |
| 131 |
description: |
| 132 |
- Configure OSPFv2 retransmit interval (2 to 65535). |
| 133 |
type: int |
| 134 |
transmit_delay: |
| 135 |
description: |
| 136 |
- Configure OSPFv2 transmit delay (1 to 65535). |
| 137 |
type: int |
| 138 |
bfd: |
| 139 |
description: |
| 140 |
- Configure OSPFv2 interface BFD. |
| 141 |
type: dict |
| 142 |
suboptions: |
| 143 |
enable: |
| 144 |
description: |
| 145 |
- Enable BFD support for OSPFv2. |
| 146 |
type: bool |
| 147 |
required: true |
| 148 |
bfd_profile: |
| 149 |
description: |
| 150 |
- Configure BFD profile. |
| 151 |
type: str |
| 152 |
network: |
| 153 |
description: |
| 154 |
- Configure OSPFv2 interface network type |
| 155 |
type: str |
| 156 |
choices: |
| 157 |
- broadcast |
| 158 |
- point_to_point |
| 159 |
state: |
| 160 |
description: |
| 161 |
- Specifies the operation to be performed on the OSPFv2 interfaces configured on the device. |
| 162 |
- In case of merged, the input configuration will be merged with the existing OSPFv2 interfaces configuration on the device. |
| 163 |
- In case of deleted, the existing OSPFv2 interfaces configuration will be removed from the device. |
| 164 |
- In case of overridden, all the existing OSPFv2 interfaces configuration will be deleted and the specified input configuration will be installed. |
| 165 |
- In case of replaced, the existing OSPFv2 interface configuration on the device will be replaced by the configuration in the playbook for |
| 166 |
each interface group configured by the playbook. |
| 167 |
type: str |
| 168 |
default: merged |
| 169 |
choices: ['merged', 'deleted', 'replaced', 'overridden'] |
| 170 |
""" |
| 171 |
|
| 172 |
EXAMPLES = """ |
| 173 |
# Using "deleted" state |
| 174 |
|
| 175 |
# Before state: |
| 176 |
# ------------- |
| 177 |
# |
| 178 |
# sonic# show running-configuration interface |
| 179 |
# ! |
| 180 |
# interface Eth1/1 |
| 181 |
# ip ospf area 2.2.2.2 |
| 182 |
# ip ospf bfd |
| 183 |
# ip ospf bfd profile profile2 |
| 184 |
# ip ospf cost 30 |
| 185 |
# ip ospf dead-interval 40 |
| 186 |
# ip ospf hello-interval 10 |
| 187 |
# ip ospf mtu-ignore |
| 188 |
# ip ospf network point-to-point |
| 189 |
# ip ospf priority 20 |
| 190 |
# ip ospf authentication null 10.10.120.1 |
| 191 |
# ip ospf authentication-key U2FsdGVkX1/Ml24vwe6RSjUUqI+54BdDyDL0eKUezJw= encrypted 10.10.120.1 |
| 192 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 193 |
# ip ospf authentication null 10.19.119.1 |
| 194 |
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1 |
| 195 |
# ! |
| 196 |
# interface Eth1/2 |
| 197 |
# ip ospf bfd |
| 198 |
# ip ospf network point-to-point |
| 199 |
# ! |
| 200 |
# interface Eth1/3 |
| 201 |
# ip ospf bfd |
| 202 |
# ip ospf network point-to-point |
| 203 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 204 |
# ip ospf authentication message-digest 10.19.120.2 |
| 205 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 206 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 207 |
# ! |
| 208 |
# sonic# |
| 209 |
|
| 210 |
- name: Delete the OSPFv2_interface configurations |
| 211 |
sonic_ospfv2_interfaces: |
| 212 |
config: |
| 213 |
- name: 'Eth1/1' |
| 214 |
ospf_attributes: |
| 215 |
- area_id: '2.2.2.2' |
| 216 |
cost: 30 |
| 217 |
priority: 20 |
| 218 |
hello_interval: 10 |
| 219 |
dead_interval: 40 |
| 220 |
mtu_ignore: true |
| 221 |
- address: '10.10.120.1' |
| 222 |
authentication_type: 'NONE' |
| 223 |
authentication: |
| 224 |
password: 'pass2' |
| 225 |
- address: '10.19.119.1' |
| 226 |
bfd: |
| 227 |
enable: true |
| 228 |
bfd_profile: 'profile2' |
| 229 |
network: point_to_point |
| 230 |
- name: 'Eth1/2' |
| 231 |
bfd: |
| 232 |
enable: true |
| 233 |
- name: 'Eth1/3' |
| 234 |
state: deleted |
| 235 |
|
| 236 |
# After state: |
| 237 |
# ------------ |
| 238 |
# |
| 239 |
# sonic# show running-configuration interface |
| 240 |
# ! |
| 241 |
# interface Eth1/1 |
| 242 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 243 |
# ! |
| 244 |
# interface Eth1/2 |
| 245 |
# ip ospf network point-to-point |
| 246 |
# ! |
| 247 |
# interface Eth1/3 |
| 248 |
# ! |
| 249 |
# sonic# |
| 250 |
|
| 251 |
|
| 252 |
# Using "deleted" state |
| 253 |
|
| 254 |
# Before state: |
| 255 |
# ------------- |
| 256 |
# |
| 257 |
# sonic# show running-configuration interface |
| 258 |
# ! |
| 259 |
# interface Eth1/1 |
| 260 |
# ip ospf area 2.2.2.2 |
| 261 |
# ip ospf bfd |
| 262 |
# ip ospf bfd profile profile2 |
| 263 |
# ip ospf cost 30 |
| 264 |
# ip ospf dead-interval 40 |
| 265 |
# ip ospf hello-interval 10 |
| 266 |
# ip ospf mtu-ignore |
| 267 |
# ip ospf network point-to-point |
| 268 |
# ip ospf priority 20 |
| 269 |
# ip ospf authentication null 10.10.120.1 |
| 270 |
# ip ospf authentication-key U2FsdGVkX1/Ml24vwe6RSjUUqI+54BdDyDL0eKUezJw= encrypted 10.10.120.1 |
| 271 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 272 |
# ip ospf authentication null 10.19.119.1 |
| 273 |
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1 |
| 274 |
# ! |
| 275 |
# interface Eth1/2 |
| 276 |
# ip ospf bfd |
| 277 |
# ip ospf network point-to-point |
| 278 |
# ! |
| 279 |
# interface Eth1/3 |
| 280 |
# ip ospf bfd |
| 281 |
# ip ospf network point-to-point |
| 282 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 283 |
# ip ospf authentication message-digest 10.19.120.2 |
| 284 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 285 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 286 |
# ! |
| 287 |
# sonic# |
| 288 |
|
| 289 |
- name: Delete the OSPFv2_interface configurations |
| 290 |
sonic_ospfv2_interfaces: |
| 291 |
config: |
| 292 |
- name: 'Eth1/1' |
| 293 |
- name: 'Eth1/2' |
| 294 |
bfd: |
| 295 |
enable: true |
| 296 |
- name: 'Eth1/3' |
| 297 |
state: deleted |
| 298 |
|
| 299 |
# After state: |
| 300 |
# ------------ |
| 301 |
# |
| 302 |
# sonic# show running-configuration interface |
| 303 |
# ! |
| 304 |
# interface Eth1/1 |
| 305 |
# ! |
| 306 |
# interface Eth1/2 |
| 307 |
# ip ospf network point-to-point |
| 308 |
# ! |
| 309 |
# interface Eth1/3 |
| 310 |
# ! |
| 311 |
# sonic# |
| 312 |
|
| 313 |
|
| 314 |
# Using "merged" state |
| 315 |
|
| 316 |
# Before state: |
| 317 |
# ------------- |
| 318 |
# |
| 319 |
# sonic# show running-configuration interface |
| 320 |
# ! |
| 321 |
# interface Eth1/1 |
| 322 |
# ! |
| 323 |
# interface Eth1/2 |
| 324 |
# ! |
| 325 |
# interface Eth1/3 |
| 326 |
# ! |
| 327 |
# sonic# |
| 328 |
|
| 329 |
- name: Add the OSPFv2_interface configurations |
| 330 |
sonic_ospfv2_interfaces: |
| 331 |
config: |
| 332 |
- name: 'Eth1/1' |
| 333 |
ospf_attributes: |
| 334 |
- area_id: '2.2.2.2' |
| 335 |
cost: 20 |
| 336 |
priority: 20 |
| 337 |
hello_interval: 10 |
| 338 |
dead_interval: 40 |
| 339 |
mtu_ignore: true |
| 340 |
-address: '10.10.120.1' |
| 341 |
authentication_type: 'MD5HMAC' |
| 342 |
authentication: |
| 343 |
password: 'password' |
| 344 |
hello_multiplier: 5 |
| 345 |
bfd: |
| 346 |
enable: true |
| 347 |
bfd_profile: 'profile1' |
| 348 |
network: broadcast |
| 349 |
- name: 'Eth1/3' |
| 350 |
ospf_attributes: |
| 351 |
- area_id: '3.3.3.3' |
| 352 |
address: '10.19.120.2' |
| 353 |
authentication_type: 'MD5HMAC' |
| 354 |
authentication: |
| 355 |
password: 'password' |
| 356 |
hello_multiplier: 5 |
| 357 |
bfd: |
| 358 |
enable: true |
| 359 |
network: point_to_point |
| 360 |
state: merged |
| 361 |
|
| 362 |
# After state: |
| 363 |
# ------------ |
| 364 |
# |
| 365 |
# sonic# show running-configuration interface |
| 366 |
# ! |
| 367 |
# interface Eth1/1 |
| 368 |
# ip ospf area 2.2.2.2 |
| 369 |
# ip ospf bfd |
| 370 |
# ip ospf bfd profile profile1 |
| 371 |
# ip ospf cost 20 |
| 372 |
# ip ospf dead-interval 40 |
| 373 |
# ip ospf hello-interval 10 |
| 374 |
# ip ospf mtu-ignore |
| 375 |
# ip ospf network broadcast |
| 376 |
# ip ospf priority 20 |
| 377 |
# ip ospf authentication message-digest 10.10.120.1 |
| 378 |
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1 |
| 379 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 380 |
# ! |
| 381 |
# interface Eth1/2 |
| 382 |
# ! |
| 383 |
# interface Eth1/3 |
| 384 |
# ip ospf bfd |
| 385 |
# ip ospf network point-to-point |
| 386 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 387 |
# ip ospf authentication message-digest 10.19.120.2 |
| 388 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 389 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 390 |
# ! |
| 391 |
# sonic# |
| 392 |
|
| 393 |
|
| 394 |
# Using "merged" state |
| 395 |
|
| 396 |
# Before state: |
| 397 |
# ------------- |
| 398 |
# |
| 399 |
# sonic# show running-configuration interface |
| 400 |
# ! |
| 401 |
# interface Eth1/1 |
| 402 |
# ip ospf area 2.2.2.2 |
| 403 |
# ip ospf bfd |
| 404 |
# ip ospf bfd profile profile1 |
| 405 |
# ip ospf cost 20 |
| 406 |
# ip ospf dead-interval 40 |
| 407 |
# ip ospf hello-interval 10 |
| 408 |
# ip ospf mtu-ignore |
| 409 |
# ip ospf network broadcast |
| 410 |
# ip ospf priority 20 |
| 411 |
# ip ospf authentication message-digest 10.10.120.1 |
| 412 |
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1 |
| 413 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 414 |
# ! |
| 415 |
# interface Eth1/2 |
| 416 |
# ! |
| 417 |
# interface Eth1/3 |
| 418 |
# ip ospf bfd |
| 419 |
# ip ospf network point-to-point |
| 420 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 421 |
# ip ospf authentication message-digest 10.19.120.2 |
| 422 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 423 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 424 |
# ! |
| 425 |
# sonic# |
| 426 |
|
| 427 |
- name: Add the OSPFv2_interface configurations |
| 428 |
sonic_ospfv2_interfaces: |
| 429 |
config: |
| 430 |
- name: 'Eth1/1' |
| 431 |
ospf_attributes: |
| 432 |
- area_id: '2.2.2.2' |
| 433 |
cost: 30 |
| 434 |
priority: 20 |
| 435 |
hello_interval: 10 |
| 436 |
dead_interval: 40 |
| 437 |
mtu_ignore: true |
| 438 |
- address: '10.10.120.1' |
| 439 |
authentication_type: 'NONE' |
| 440 |
authentication: |
| 441 |
password: 'pass2' |
| 442 |
- address: '10.19.119.1' |
| 443 |
authentication_type: 'NONE' |
| 444 |
md_authentication: |
| 445 |
- key_id: 10 |
| 446 |
md5key: 'U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ=' |
| 447 |
encrypted: true |
| 448 |
bfd: |
| 449 |
enable: true |
| 450 |
bfd_profile: 'profile2' |
| 451 |
network: point_to_point |
| 452 |
- name: 'Eth1/2' |
| 453 |
bfd: |
| 454 |
enable: true |
| 455 |
network: point_to_point |
| 456 |
state: merged |
| 457 |
|
| 458 |
# After state: |
| 459 |
# ------------ |
| 460 |
# |
| 461 |
# sonic# show running-configuration interface |
| 462 |
# ! |
| 463 |
# interface Eth1/1 |
| 464 |
# ip ospf area 2.2.2.2 |
| 465 |
# ip ospf bfd |
| 466 |
# ip ospf bfd profile profile2 |
| 467 |
# ip ospf cost 30 |
| 468 |
# ip ospf dead-interval 40 |
| 469 |
# ip ospf hello-interval 10 |
| 470 |
# ip ospf mtu-ignore |
| 471 |
# ip ospf network point-to-point |
| 472 |
# ip ospf priority 20 |
| 473 |
# ip ospf authentication null 10.10.120.1 |
| 474 |
# ip ospf authentication-key U2FsdGVkX1/Ml24vwe6RSjUUqI+54BdDyDL0eKUezJw= encrypted 10.10.120.1 |
| 475 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 476 |
# ip ospf authentication null 10.19.119.1 |
| 477 |
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1 |
| 478 |
# ! |
| 479 |
# interface Eth1/2 |
| 480 |
# ip ospf bfd |
| 481 |
# ip ospf network point-to-point |
| 482 |
# ! |
| 483 |
# interface Eth1/3 |
| 484 |
# ip ospf bfd |
| 485 |
# ip ospf network point-to-point |
| 486 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 487 |
# ip ospf authentication message-digest 10.19.120.2 |
| 488 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 489 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 490 |
# ! |
| 491 |
# sonic# |
| 492 |
|
| 493 |
|
| 494 |
# Using "replaced" state |
| 495 |
|
| 496 |
# Before state: |
| 497 |
# ------------- |
| 498 |
# |
| 499 |
# sonic# show running-configuration interface |
| 500 |
# ! |
| 501 |
# interface Eth1/1 |
| 502 |
# ip ospf area 2.2.2.2 |
| 503 |
# ip ospf bfd |
| 504 |
# ip ospf bfd profile profile1 |
| 505 |
# ip ospf cost 20 |
| 506 |
# ip ospf dead-interval 40 |
| 507 |
# ip ospf hello-interval 10 |
| 508 |
# ip ospf mtu-ignore |
| 509 |
# ip ospf network broadcast |
| 510 |
# ip ospf priority 20 |
| 511 |
# ip ospf authentication message-digest 10.10.120.1 |
| 512 |
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1 |
| 513 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 514 |
# ! |
| 515 |
# interface Eth1/2 |
| 516 |
# ! |
| 517 |
# interface Eth1/3 |
| 518 |
# ip ospf bfd |
| 519 |
# ip ospf network point-to-point |
| 520 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 521 |
# ip ospf authentication message-digest 10.19.120.2 |
| 522 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 523 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 524 |
# ! |
| 525 |
# sonic# |
| 526 |
|
| 527 |
- name: Replace the OSPFv2_interface configurations |
| 528 |
sonic_ospfv2_interfaces: |
| 529 |
config: |
| 530 |
- name: 'Eth1/3' |
| 531 |
ospf_attributes: |
| 532 |
- area_id: '2.2.2.2' |
| 533 |
cost: 30 |
| 534 |
priority: 20 |
| 535 |
hello_interval: 10 |
| 536 |
dead_interval: 40 |
| 537 |
mtu_ignore: true |
| 538 |
- address: '10.10.120.1' |
| 539 |
authentication_type: 'NONE' |
| 540 |
authentication: |
| 541 |
password: 'pass2' |
| 542 |
- address: '10.19.119.1' |
| 543 |
authentication_type: 'NONE' |
| 544 |
md_authentication: |
| 545 |
- key_id: 10 |
| 546 |
md5key: 'U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ=' |
| 547 |
encrypted: true |
| 548 |
bfd: |
| 549 |
enable: true |
| 550 |
bfd_profile: 'profile2' |
| 551 |
network: broadcast |
| 552 |
state: replaced |
| 553 |
|
| 554 |
# After state: |
| 555 |
# ------------ |
| 556 |
# |
| 557 |
# sonic# show running-configuration interface |
| 558 |
# ! |
| 559 |
# interface Eth1/1 |
| 560 |
# ip ospf area 2.2.2.2 |
| 561 |
# ip ospf bfd |
| 562 |
# ip ospf bfd profile profile1 |
| 563 |
# ip ospf cost 20 |
| 564 |
# ip ospf dead-interval 40 |
| 565 |
# ip ospf hello-interval 10 |
| 566 |
# ip ospf mtu-ignore |
| 567 |
# ip ospf network broadcast |
| 568 |
# ip ospf priority 20 |
| 569 |
# ip ospf authentication message-digest 10.10.120.1 |
| 570 |
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1 |
| 571 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 572 |
# ! |
| 573 |
# interface Eth1/2 |
| 574 |
# ! |
| 575 |
# interface Eth1/3 |
| 576 |
# ip ospf area 2.2.2.2 |
| 577 |
# ip ospf bfd |
| 578 |
# ip ospf bfd profile profile2 |
| 579 |
# ip ospf cost 30 |
| 580 |
# ip ospf dead-interval 40 |
| 581 |
# ip ospf hello-interval 10 |
| 582 |
# ip ospf mtu-ignore |
| 583 |
# ip ospf network broadcast |
| 584 |
# ip ospf priority 20 |
| 585 |
# ip ospf authentication null 10.10.120.1 |
| 586 |
# ip ospf authentication-key U2FsdGVkX186k2R2hUXaDloW8hfkApn5Zx5hCQy9usc= encrypted 10.10.120.1 |
| 587 |
# ip ospf authentication null 10.19.119.1 |
| 588 |
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1 |
| 589 |
# ! |
| 590 |
# sonic# |
| 591 |
|
| 592 |
|
| 593 |
# Using "overridden" state |
| 594 |
|
| 595 |
# Before state: |
| 596 |
# ------------- |
| 597 |
# |
| 598 |
# sonic# show running-configuration interface |
| 599 |
# ! |
| 600 |
# interface Eth1/1 |
| 601 |
# ip ospf area 2.2.2.2 |
| 602 |
# ip ospf bfd |
| 603 |
# ip ospf bfd profile profile1 |
| 604 |
# ip ospf cost 20 |
| 605 |
# ip ospf dead-interval 40 |
| 606 |
# ip ospf hello-interval 10 |
| 607 |
# ip ospf mtu-ignore |
| 608 |
# ip ospf network broadcast |
| 609 |
# ip ospf priority 20 |
| 610 |
# ip ospf authentication message-digest 10.10.120.1 |
| 611 |
# ip ospf authentication-key U2FsdGVkX1+ozJSEI69XJb2KR9Pu1Sa3Ou6ujTRalbQ= encrypted 10.10.120.1 |
| 612 |
# ip ospf dead-interval minimal hello-multiplier 5 10.10.120.1 |
| 613 |
# ! |
| 614 |
# interface Eth1/2 |
| 615 |
# ! |
| 616 |
# interface Eth1/3 |
| 617 |
# ip ospf bfd |
| 618 |
# ip ospf network point-to-point |
| 619 |
# ip ospf area 3.3.3.3 10.19.120.2 |
| 620 |
# ip ospf authentication message-digest 10.19.120.2 |
| 621 |
# ip ospf authentication-key U2FsdGVkX19HqGCcf2pzGur9MDnb0VzLNRvoFij3Os0= encrypted 10.19.120.2 |
| 622 |
# ip ospf dead-interval minimal hello-multiplier 5 10.19.120.2 |
| 623 |
# ! |
| 624 |
# sonic# |
| 625 |
|
| 626 |
- name: Override the OSPFv2_interface configurations |
| 627 |
sonic_ospfv2_interfaces: |
| 628 |
config: |
| 629 |
- name: 'Eth1/3' |
| 630 |
ospf_attributes: |
| 631 |
- area_id: '2.2.2.2' |
| 632 |
cost: 30 |
| 633 |
priority: 20 |
| 634 |
hello_interval: 10 |
| 635 |
dead_interval: 40 |
| 636 |
mtu_ignore: true |
| 637 |
- address: '10.10.120.1' |
| 638 |
authentication_type: 'NONE' |
| 639 |
authentication: |
| 640 |
password: 'pass2' |
| 641 |
- address: '10.19.119.1' |
| 642 |
authentication_type: 'NONE' |
| 643 |
md_authentication: |
| 644 |
- key_id: 10 |
| 645 |
md5key: 'U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ=' |
| 646 |
encrypted: true |
| 647 |
bfd: |
| 648 |
enable: true |
| 649 |
bfd_profile: 'profile2' |
| 650 |
network: broadcast |
| 651 |
state: overridden |
| 652 |
|
| 653 |
# After state: |
| 654 |
# ------------ |
| 655 |
# |
| 656 |
# sonic# show running-configuration interface |
| 657 |
# ! |
| 658 |
# interface Eth1/1 |
| 659 |
# ! |
| 660 |
# interface Eth1/2 |
| 661 |
# ! |
| 662 |
# interface Eth1/3 |
| 663 |
# ip ospf area 2.2.2.2 |
| 664 |
# ip ospf bfd |
| 665 |
# ip ospf bfd profile profile2 |
| 666 |
# ip ospf cost 30 |
| 667 |
# ip ospf dead-interval 40 |
| 668 |
# ip ospf hello-interval 10 |
| 669 |
# ip ospf mtu-ignore |
| 670 |
# ip ospf network broadcast |
| 671 |
# ip ospf priority 20 |
| 672 |
# ip ospf authentication null 10.10.120.1 |
| 673 |
# ip ospf authentication-key U2FsdGVkX186k2R2hUXaDloW8hfkApn5Zx5hCQy9usc= encrypted 10.10.120.1 |
| 674 |
# ip ospf authentication null 10.19.119.1 |
| 675 |
# ip ospf message-digest-key 10 md5 U2FsdGVkX1/Bq/+x8a3fsBo9ZrAX56ynmPKnRM87kfQ= encrypted 10.19.119.1 |
| 676 |
# ! |
| 677 |
# sonic# |
| 678 |
""" |
| 679 |
|
| 680 |
RETURN = """ |
| 681 |
before: |
| 682 |
description: The configuration prior to the model invocation. |
| 683 |
returned: always |
| 684 |
type: list |
| 685 |
sample: > |
| 686 |
The configuration returned will always be in the same format |
| 687 |
of the parameters above. |
| 688 |
after: |
| 689 |
description: The resulting configuration model invocation. |
| 690 |
returned: when changed |
| 691 |
type: list |
| 692 |
sample: > |
| 693 |
The configuration returned will always be in the same format |
| 694 |
of the parameters above. |
| 695 |
after_generated: |
| 696 |
description: The generated configuration model invocation. |
| 697 |
returned: when C(check_mode) |
| 698 |
type: list |
| 699 |
sample: > |
| 700 |
The configuration returned will always be in the same format |
| 701 |
of the parameters above. |
| 702 |
commands: |
| 703 |
description: The set of commands pushed to the remote device. |
| 704 |
returned: always |
| 705 |
type: list |
| 706 |
sample: ['command 1', 'command 2', 'command 3'] |
| 707 |
""" |
| 708 |
|
| 709 |
|
| 710 |
from ansible.module_utils.basic import AnsibleModule |
| 711 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.ospfv2_interfaces.ospfv2_interfaces import Ospfv2_interfacesArgs |
| 712 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.config.ospfv2_interfaces.ospfv2_interfaces import Ospfv2_interfaces |
| 713 |
|
| 714 |
|
| 715 |
def main(): |
| 716 |
""" |
| 717 |
Main entry point for module execution |
| 718 |
|
| 719 |
:returns: the result form module invocation |
| 720 |
""" |
| 721 |
module = AnsibleModule(argument_spec=Ospfv2_interfacesArgs.argument_spec, |
| 722 |
supports_check_mode=True) |
| 723 |
|
| 724 |
result = Ospfv2_interfaces(module).execute_module() |
| 725 |
module.exit_json(**result) |
| 726 |
|
| 727 |
|
| 728 |
if __name__ == '__main__': |
| 729 |
main() |