| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
""" |
| 8 |
The module file for sonic_stp |
| 9 |
""" |
| 10 |
|
| 11 |
from __future__ import absolute_import, division, print_function |
| 12 |
__metaclass__ = type |
| 13 |
|
| 14 |
|
| 15 |
DOCUMENTATION = """ |
| 16 |
--- |
| 17 |
module: sonic_stp |
| 18 |
version_added: "2.3.0" |
| 19 |
notes: |
| 20 |
- Tested against Enterprise SONiC Distribution by Dell Technologies. |
| 21 |
- Supports C(check_mode). |
| 22 |
short_description: Manage STP configuration on SONiC |
| 23 |
description: |
| 24 |
- This module provides configuration management of STP for devices running SONiC |
| 25 |
author: "S. Talabi (@stalabi1)" |
| 26 |
options: |
| 27 |
config: |
| 28 |
description: |
| 29 |
- Specifies STP configurations |
| 30 |
- I(mstp), I(pvst) and I(rapid_pvst) are mutually exclusive. |
| 31 |
type: dict |
| 32 |
suboptions: |
| 33 |
global: |
| 34 |
description: |
| 35 |
- Global STP configuration |
| 36 |
type: dict |
| 37 |
suboptions: |
| 38 |
enabled_protocol: |
| 39 |
description: |
| 40 |
- Specifies the type of STP enabled on the device |
| 41 |
type: str |
| 42 |
choices: ['mst', 'pvst', 'rapid_pvst'] |
| 43 |
loop_guard: |
| 44 |
description: |
| 45 |
- The loop guard default setting for the bridge |
| 46 |
type: bool |
| 47 |
bpdu_filter: |
| 48 |
description: |
| 49 |
- Enables edge port BPDU filter |
| 50 |
type: bool |
| 51 |
disabled_vlans: |
| 52 |
description: |
| 53 |
- List of disabled STP VLANs. The value of a list item can be a single VLAN ID or a range of VLAN IDs |
| 54 |
- separated by '-' or '..'; for example 70-100 or 70..100. |
| 55 |
type: list |
| 56 |
elements: str |
| 57 |
root_guard_timeout: |
| 58 |
description: |
| 59 |
- Specifies root guard recovery timeout in seconds before the port is moved back to forwarding state |
| 60 |
- Range 5-600 |
| 61 |
type: int |
| 62 |
portfast: |
| 63 |
description: |
| 64 |
- Enables PortFast globally on all access ports |
| 65 |
- Configurable for pvst protocol |
| 66 |
type: bool |
| 67 |
hello_time: |
| 68 |
description: |
| 69 |
- Interval in seconds between periodic transmissions of configuration messages by designated ports |
| 70 |
- Range 1-10 |
| 71 |
type: int |
| 72 |
max_age: |
| 73 |
description: |
| 74 |
- Maximum age in seconds of the information transmitted by the bridge when it is the root bridge |
| 75 |
- Range 6-40 |
| 76 |
type: int |
| 77 |
fwd_delay: |
| 78 |
description: |
| 79 |
- Delay in seconds used by STP bridges to transition root and designated ports to forwarding |
| 80 |
- Range 4-30 |
| 81 |
type: int |
| 82 |
bridge_priority: |
| 83 |
description: |
| 84 |
- The manageable component of the bridge identifier |
| 85 |
- Value must be a multiple of 4096 in the range of 0-61440 |
| 86 |
type: int |
| 87 |
interfaces: |
| 88 |
description: |
| 89 |
- Interfaces STP configuration |
| 90 |
type: list |
| 91 |
elements: dict |
| 92 |
suboptions: |
| 93 |
intf_name: |
| 94 |
description: |
| 95 |
- Name of interface |
| 96 |
type: str |
| 97 |
required: True |
| 98 |
edge_port: |
| 99 |
description: |
| 100 |
- Configure interface as an STP edge port |
| 101 |
type: bool |
| 102 |
link_type: |
| 103 |
description: |
| 104 |
- Specifies the interface's link type |
| 105 |
type: str |
| 106 |
choices: ['point-to-point', 'shared'] |
| 107 |
guard: |
| 108 |
description: |
| 109 |
- Enables root guard or loop guard |
| 110 |
type: str |
| 111 |
choices: ['loop', 'root', 'none'] |
| 112 |
bpdu_guard: |
| 113 |
description: |
| 114 |
- Enable edge port BPDU guard |
| 115 |
type: bool |
| 116 |
bpdu_filter: |
| 117 |
description: |
| 118 |
- Enables edge port BPDU filter |
| 119 |
type: bool |
| 120 |
portfast: |
| 121 |
description: |
| 122 |
- Enable/Disable portfast on specified interface |
| 123 |
- Configurable for pvst protocol |
| 124 |
type: bool |
| 125 |
uplink_fast: |
| 126 |
description: |
| 127 |
- Enables uplink fast |
| 128 |
type: bool |
| 129 |
shutdown: |
| 130 |
description: |
| 131 |
- Port to be shutdown when it receives a BPDU |
| 132 |
type: bool |
| 133 |
cost: |
| 134 |
description: |
| 135 |
- The port's contribution, when it is the root port, to the root path cost for the bridge |
| 136 |
- Range 1-200000000 |
| 137 |
type: int |
| 138 |
port_priority: |
| 139 |
description: |
| 140 |
- The manageable component of the port identifier |
| 141 |
- Range 0-240 |
| 142 |
type: int |
| 143 |
stp_enable: |
| 144 |
description: |
| 145 |
- Enables STP on the interface |
| 146 |
type: bool |
| 147 |
mstp: |
| 148 |
description: |
| 149 |
- Multi STP configuration |
| 150 |
type: dict |
| 151 |
suboptions: |
| 152 |
mst_name: |
| 153 |
description: |
| 154 |
- Name of the MST configuration identifier |
| 155 |
type: str |
| 156 |
revision: |
| 157 |
description: |
| 158 |
- Revision level of the MST configuration identifier, range 0-65535 |
| 159 |
type: int |
| 160 |
max_hop: |
| 161 |
description: |
| 162 |
- Number of bridges in an MST region that a BPDU can traverse before it is discarded |
| 163 |
- Range 1-40 |
| 164 |
type: int |
| 165 |
hello_time: |
| 166 |
description: |
| 167 |
- Interval in seconds between periodic transmissions of configuration messages by designated ports |
| 168 |
- Range 1-10 |
| 169 |
type: int |
| 170 |
max_age: |
| 171 |
description: |
| 172 |
- Maximum age in seconds of the information transmitted by the bridge when it is the root bridge |
| 173 |
- Range 6-40 |
| 174 |
type: int |
| 175 |
fwd_delay: |
| 176 |
description: |
| 177 |
- Delay in seconds used by STP bridges to transition root and designated ports to forwarding |
| 178 |
- Range 4-30 |
| 179 |
type: int |
| 180 |
mst_instances: |
| 181 |
description: |
| 182 |
- Configuration for MST instances |
| 183 |
type: list |
| 184 |
elements: dict |
| 185 |
suboptions: |
| 186 |
mst_id: |
| 187 |
description: |
| 188 |
- Value used to identify MST instance, range 0-4094 |
| 189 |
type: int |
| 190 |
required: True |
| 191 |
bridge_priority: |
| 192 |
description: |
| 193 |
- The manageable component of the bridge identifier |
| 194 |
- Value must be a multiple of 4096 in the range of 0-61440 |
| 195 |
type: int |
| 196 |
vlans: |
| 197 |
description: |
| 198 |
- List of VLANs mapped to the MST instance. The value of a list item can be a single VLAN ID or a range of VLAN IDs |
| 199 |
- separated by '-' or '..'; for example 70-100 or 70..100. |
| 200 |
type: list |
| 201 |
elements: str |
| 202 |
interfaces: |
| 203 |
description: |
| 204 |
- List of STP enabled interfaces |
| 205 |
type: list |
| 206 |
elements: dict |
| 207 |
suboptions: |
| 208 |
intf_name: |
| 209 |
description: |
| 210 |
- Reference to the STP interface |
| 211 |
type: str |
| 212 |
required: True |
| 213 |
cost: |
| 214 |
description: |
| 215 |
- The port's contribution, when it is the root port, to the root path cost for the bridge |
| 216 |
- Range 1-200000000 |
| 217 |
type: int |
| 218 |
port_priority: |
| 219 |
description: |
| 220 |
- The manageable component of the port identifier, range 0-240 |
| 221 |
type: int |
| 222 |
pvst: |
| 223 |
description: |
| 224 |
- Per VLAN STP configuration |
| 225 |
type: list |
| 226 |
elements: dict |
| 227 |
suboptions: |
| 228 |
vlan_id: |
| 229 |
description: |
| 230 |
- VLAN identifier, range 1-4094 |
| 231 |
type: int |
| 232 |
required: True |
| 233 |
hello_time: |
| 234 |
description: |
| 235 |
- Interval in seconds between periodic transmissions of configuration messages by designated ports |
| 236 |
- Range 1-10 |
| 237 |
type: int |
| 238 |
max_age: |
| 239 |
description: |
| 240 |
- Maximum age in seconds of the information transmitted by the bridge when it is the root bridge |
| 241 |
- Range 6-40 |
| 242 |
type: int |
| 243 |
fwd_delay: |
| 244 |
description: |
| 245 |
- Delay in seconds used by STP bridges to transition root and designated ports to forwarding |
| 246 |
- Range 4-30 |
| 247 |
type: int |
| 248 |
bridge_priority: |
| 249 |
description: |
| 250 |
- The manageable component of the bridge identifier |
| 251 |
- Value must be a multiple of 4096 in the range of 0-61440 |
| 252 |
type: int |
| 253 |
interfaces: |
| 254 |
description: |
| 255 |
- List of STP enabled interfaces |
| 256 |
type: list |
| 257 |
elements: dict |
| 258 |
suboptions: |
| 259 |
intf_name: |
| 260 |
description: |
| 261 |
- Reference to the STP interface |
| 262 |
type: str |
| 263 |
required: True |
| 264 |
cost: |
| 265 |
description: |
| 266 |
- The port's contribution, when it is the root port, to the root path cost for the bridge |
| 267 |
- Range 1-200000000 |
| 268 |
type: int |
| 269 |
port_priority: |
| 270 |
description: |
| 271 |
- The manageable component of the port identifier, range 0-240 |
| 272 |
type: int |
| 273 |
rapid_pvst: |
| 274 |
description: |
| 275 |
- Rapid per VLAN STP configuration |
| 276 |
type: list |
| 277 |
elements: dict |
| 278 |
suboptions: |
| 279 |
vlan_id: |
| 280 |
description: |
| 281 |
- VLAN identifier, range 1-4094 |
| 282 |
type: int |
| 283 |
required: True |
| 284 |
hello_time: |
| 285 |
description: |
| 286 |
- Interval in seconds between periodic transmissions of configuration messages by designated ports |
| 287 |
- Range 1-10 |
| 288 |
type: int |
| 289 |
max_age: |
| 290 |
description: |
| 291 |
- Maximum age in seconds of the information transmitted by the bridge when it is the root bridge |
| 292 |
- Range 6-40 |
| 293 |
type: int |
| 294 |
fwd_delay: |
| 295 |
description: |
| 296 |
- Delay in seconds used by STP bridges to transition root and designated ports to forwarding |
| 297 |
- Range 4-30 |
| 298 |
type: int |
| 299 |
bridge_priority: |
| 300 |
description: |
| 301 |
- The manageable component of the bridge identifier |
| 302 |
- Value must be a multiple of 4096 in the range of 0-61440 |
| 303 |
type: int |
| 304 |
interfaces: |
| 305 |
description: |
| 306 |
- List of STP enabled interfaces |
| 307 |
type: list |
| 308 |
elements: dict |
| 309 |
suboptions: |
| 310 |
intf_name: |
| 311 |
description: |
| 312 |
- Reference to the STP interface |
| 313 |
type: str |
| 314 |
required: True |
| 315 |
cost: |
| 316 |
description: |
| 317 |
- The port's contribution, when it is the root port, to the root path cost for the bridge |
| 318 |
- Range 1-200000000 |
| 319 |
type: int |
| 320 |
port_priority: |
| 321 |
description: |
| 322 |
- The manageable component of the port identifier, range 0-240 |
| 323 |
type: int |
| 324 |
state: |
| 325 |
description: |
| 326 |
- The state of the configuration after module completion |
| 327 |
type: str |
| 328 |
choices: ['merged', 'deleted', 'replaced', 'overridden'] |
| 329 |
default: merged |
| 330 |
""" |
| 331 |
|
| 332 |
EXAMPLES = """ |
| 333 |
|
| 334 |
# Using "merged" state |
| 335 |
# |
| 336 |
# Before state: |
| 337 |
# ------------- |
| 338 |
# |
| 339 |
# sonic# show running-configuration spanning-tree |
| 340 |
# (No spanning-tree configuration present) |
| 341 |
|
| 342 |
- name: Merge STP configurations |
| 343 |
dellemc.enterprise_sonic.sonic_stp: |
| 344 |
config: |
| 345 |
global: |
| 346 |
enabled_protocol: mst |
| 347 |
loop_guard: true |
| 348 |
bpdu_filter: true |
| 349 |
disabled_vlans: |
| 350 |
- 4-6 |
| 351 |
hello_time: 5 |
| 352 |
max_age: 10 |
| 353 |
fwd_delay: 20 |
| 354 |
bridge_priority: 4096 |
| 355 |
interfaces: |
| 356 |
- intf_name: Ethernet20 |
| 357 |
edge_port: true |
| 358 |
link_type: shared |
| 359 |
guard: loop |
| 360 |
bpdu_guard: true |
| 361 |
bpdu_filter: true |
| 362 |
uplink_fast: true |
| 363 |
shutdown: true |
| 364 |
cost: 20 |
| 365 |
port_priority: 30 |
| 366 |
stp_enable: true |
| 367 |
mstp: |
| 368 |
mst_name: mst1 |
| 369 |
revision: 1 |
| 370 |
max_hop: 3 |
| 371 |
hello_time: 6 |
| 372 |
max_age: 9 |
| 373 |
fwd_delay: 12 |
| 374 |
mst_instances: |
| 375 |
- mst_id: 1 |
| 376 |
bridge_priority: 2048 |
| 377 |
vlans: |
| 378 |
- 1 |
| 379 |
interfaces: |
| 380 |
- intf_name: Ethernet20 |
| 381 |
cost: 60 |
| 382 |
port_priority: 65 |
| 383 |
state: merged |
| 384 |
|
| 385 |
# After state: |
| 386 |
# ------------ |
| 387 |
# |
| 388 |
# sonic# show running-configuration spanning-tree |
| 389 |
# no spanning-tree vlan 4-6 |
| 390 |
# spanning-tree mode mst |
| 391 |
# spanning-tree edge-port bpdufilter default |
| 392 |
# spanning-tree forward-time 20 |
| 393 |
# spanning-tree hello-time 5 |
| 394 |
# spanning-tree max-age 10 |
| 395 |
# spanning-tree loopguard default |
| 396 |
# spanning-tree mst hello-time 6 |
| 397 |
# spanning-tree mst forward-time 12 |
| 398 |
# spanning-tree mst max-age 9 |
| 399 |
# spanning-tree mst max-hops 3 |
| 400 |
# spanning-tree mst 1 priority 2048 |
| 401 |
# ! |
| 402 |
# spanning-tree mst configuration |
| 403 |
# name mst1 |
| 404 |
# revision 1 |
| 405 |
# instance 1 vlan 1 |
| 406 |
# activate |
| 407 |
# ! |
| 408 |
# interface Ethernet20 |
| 409 |
# spanning-tree bpdufilter enable |
| 410 |
# spanning-tree guard loop |
| 411 |
# spanning-tree bpduguard port-shutdown |
| 412 |
# spanning-tree cost 20 |
| 413 |
# spanning-tree link-type shared |
| 414 |
# spanning-tree port-priority 30 |
| 415 |
# spanning-tree port type edge |
| 416 |
# spanning-tree uplinkfast |
| 417 |
# spanning-tree mst 1 cost 60 |
| 418 |
# spanning-tree mst 1 port-priority 65 |
| 419 |
|
| 420 |
|
| 421 |
# Using "replaced" state |
| 422 |
# |
| 423 |
# Before state: |
| 424 |
# ------------- |
| 425 |
# |
| 426 |
# sonic# show running-configuration spanning-tree |
| 427 |
# no spanning-tree vlan 4-6 |
| 428 |
# spanning-tree mode mst |
| 429 |
# spanning-tree edge-port bpdufilter default |
| 430 |
# spanning-tree loopguard default |
| 431 |
# spanning-tree mst hello-time 6 |
| 432 |
# spanning-tree mst forward-time 12 |
| 433 |
# spanning-tree mst max-age 9 |
| 434 |
# spanning-tree mst max-hops 3 |
| 435 |
# spanning-tree mst 1 priority 2048 |
| 436 |
# ! |
| 437 |
# spanning-tree mst configuration |
| 438 |
# name mst1 |
| 439 |
# revision 1 |
| 440 |
# instance 1 vlan 1 |
| 441 |
# activate |
| 442 |
# ! |
| 443 |
# interface Ethernet20 |
| 444 |
# spanning-tree bpdufilter enable |
| 445 |
# spanning-tree guard loop |
| 446 |
# spanning-tree bpduguard port-shutdown |
| 447 |
# spanning-tree cost 20 |
| 448 |
# spanning-tree link-type shared |
| 449 |
# spanning-tree port-priority 30 |
| 450 |
# spanning-tree port type edge |
| 451 |
# spanning-tree uplinkfast |
| 452 |
# spanning-tree mst 1 cost 60 |
| 453 |
# spanning-tree mst 1 port-priority 65 |
| 454 |
|
| 455 |
- name: Replace STP configurations |
| 456 |
dellemc.enterprise_sonic.sonic_stp: |
| 457 |
config: |
| 458 |
interfaces: |
| 459 |
- intf_name: Ethernet20 |
| 460 |
cost: 25 |
| 461 |
port_priority: 35 |
| 462 |
mstp: |
| 463 |
mst_name: mst2 |
| 464 |
revision: 2 |
| 465 |
max_hop: 4 |
| 466 |
hello_time: 7 |
| 467 |
max_age: 10 |
| 468 |
fwd_delay: 13 |
| 469 |
state: replaced |
| 470 |
|
| 471 |
# After state: |
| 472 |
# ------------ |
| 473 |
# |
| 474 |
# sonic# show running-configuration spanning-tree |
| 475 |
# no spanning-tree vlan 4-6 |
| 476 |
# spanning-tree mode mst |
| 477 |
# spanning-tree edge-port bpdufilter default |
| 478 |
# spanning-tree loopguard default |
| 479 |
# spanning-tree mst hello-time 7 |
| 480 |
# spanning-tree mst forward-time 13 |
| 481 |
# spanning-tree mst max-age 10 |
| 482 |
# spanning-tree mst max-hops 4 |
| 483 |
# ! |
| 484 |
# spanning-tree mst configuration |
| 485 |
# name mst2 |
| 486 |
# revision 2 |
| 487 |
# activate |
| 488 |
# ! |
| 489 |
# interface Ethernet20 |
| 490 |
# spanning-tree cost 25 |
| 491 |
# spanning-tree port-priority 35 |
| 492 |
|
| 493 |
|
| 494 |
# Using "overridden" state |
| 495 |
# |
| 496 |
# Before state: |
| 497 |
# ------------- |
| 498 |
# |
| 499 |
# sonic# show running-configuration spanning-tree |
| 500 |
# no spanning-tree vlan 4-6 |
| 501 |
# spanning-tree mode mst |
| 502 |
# spanning-tree edge-port bpdufilter default |
| 503 |
# spanning-tree loopguard default |
| 504 |
# spanning-tree mst hello-time 7 |
| 505 |
# spanning-tree mst forward-time 13 |
| 506 |
# spanning-tree mst max-age 10 |
| 507 |
# spanning-tree mst max-hops 4 |
| 508 |
# ! |
| 509 |
# spanning-tree mst configuration |
| 510 |
# name mst2 |
| 511 |
# revision 2 |
| 512 |
# activate |
| 513 |
# ! |
| 514 |
# interface Ethernet20 |
| 515 |
# spanning-tree cost 25 |
| 516 |
# spanning-tree port-priority 35 |
| 517 |
|
| 518 |
- name: Override STP configurations |
| 519 |
dellemc.enterprise_sonic.sonic_stp: |
| 520 |
config: |
| 521 |
global: |
| 522 |
enabled_protocol: pvst |
| 523 |
bpdu_filter: true |
| 524 |
root_guard_timeout: 25 |
| 525 |
portfast: true |
| 526 |
hello_time: 5 |
| 527 |
max_age: 10 |
| 528 |
fwd_delay: 20 |
| 529 |
bridge_priority: 4096 |
| 530 |
pvst: |
| 531 |
- vlan_id: 1 |
| 532 |
hello_time: 4 |
| 533 |
max_age: 6 |
| 534 |
fwd_delay: 8 |
| 535 |
bridge_priority: 4096 |
| 536 |
interfaces: |
| 537 |
- intf_name: Ethernet20 |
| 538 |
cost: 10 |
| 539 |
port_priority: 50 |
| 540 |
state: overridden |
| 541 |
|
| 542 |
# After state: |
| 543 |
# ------------ |
| 544 |
# |
| 545 |
# sonic# show running-configuration spanning-tree |
| 546 |
# spanning-tree mode pvst |
| 547 |
# spanning-tree edge-port bpdufilter default |
| 548 |
# spanning-tree forward-time 20 |
| 549 |
# spanning-tree guard root timeout 25 |
| 550 |
# spanning-tree hello-time 5 |
| 551 |
# spanning-tree max-age 10 |
| 552 |
# spanning-tree priority 4096 |
| 553 |
# spanning-tree portfast default |
| 554 |
# spanning-tree vlan 1 hello-time 4 |
| 555 |
# spanning-tree vlan 1 forward-time 8 |
| 556 |
# spanning-tree vlan 1 max-age 6 |
| 557 |
# sonic# show running-configuration interface Ethernet 20 | grep spanning-tree |
| 558 |
# spanning-tree vlan 1 cost 10 |
| 559 |
# spanning-tree vlan 1 port-priority 50 |
| 560 |
|
| 561 |
|
| 562 |
# Using "deleted" state |
| 563 |
# |
| 564 |
# Before state: |
| 565 |
# ------------- |
| 566 |
# |
| 567 |
# sonic# show running-configuration spanning-tree |
| 568 |
# spanning-tree mode pvst |
| 569 |
# spanning-tree edge-port bpdufilter default |
| 570 |
# spanning-tree forward-time 20 |
| 571 |
# spanning-tree guard root timeout 25 |
| 572 |
# spanning-tree hello-time 5 |
| 573 |
# spanning-tree max-age 10 |
| 574 |
# spanning-tree priority 4096 |
| 575 |
# spanning-tree portfast default |
| 576 |
# spanning-tree vlan 1 hello-time 4 |
| 577 |
# spanning-tree vlan 1 forward-time 8 |
| 578 |
# spanning-tree vlan 1 max-age 6 |
| 579 |
# sonic# show running-configuration interface Ethernet 20 | grep spanning-tree |
| 580 |
# spanning-tree vlan 1 cost 10 |
| 581 |
# spanning-tree vlan 1 port-priority 50 |
| 582 |
|
| 583 |
- name: Delete STP configurations |
| 584 |
dellemc.enterprise_sonic.sonic_stp: |
| 585 |
config: |
| 586 |
global: |
| 587 |
bpdu_filter: true |
| 588 |
root_guard_timeout: 25 |
| 589 |
pvst: |
| 590 |
- vlan_id: 1 |
| 591 |
interfaces: |
| 592 |
- intf_name: Ethernet20 |
| 593 |
state: deleted |
| 594 |
|
| 595 |
# After state: |
| 596 |
# ------------ |
| 597 |
# |
| 598 |
# sonic# show running-configuration spanning-tree |
| 599 |
# spanning-tree mode pvst |
| 600 |
# spanning-tree forward-time 20 |
| 601 |
# spanning-tree hello-time 5 |
| 602 |
# spanning-tree max-age 10 |
| 603 |
# spanning-tree priority 4096 |
| 604 |
# spanning-tree portfast default |
| 605 |
# spanning-tree vlan 1 hello-time 4 |
| 606 |
# spanning-tree vlan 1 forward-time 8 |
| 607 |
# spanning-tree vlan 1 max-age 6 |
| 608 |
# sonic# show running-configuration interface Ethernet 20 | grep spanning-tree |
| 609 |
# (No spanning-tree configuration present) |
| 610 |
""" |
| 611 |
|
| 612 |
RETURN = """ |
| 613 |
before: |
| 614 |
description: The configuration prior to the module invocation. |
| 615 |
returned: always |
| 616 |
type: list |
| 617 |
sample: > |
| 618 |
The configuration returned will always be in the same format |
| 619 |
as the parameters above. |
| 620 |
after: |
| 621 |
description: The resulting configuration module invocation. |
| 622 |
returned: when changed |
| 623 |
type: list |
| 624 |
sample: > |
| 625 |
The configuration returned will always be in the same format |
| 626 |
as the parameters above. |
| 627 |
after_generated: |
| 628 |
description: The generated configuration module invocation. |
| 629 |
returned: when C(check_mode) |
| 630 |
type: list |
| 631 |
sample: > |
| 632 |
The configuration returned will always be in the same format |
| 633 |
as the parameters above. |
| 634 |
commands: |
| 635 |
description: The set of commands pushed to the remote device. |
| 636 |
returned: always |
| 637 |
type: list |
| 638 |
sample: ['command 1', 'command 2', 'command 3'] |
| 639 |
""" |
| 640 |
|
| 641 |
from ansible.module_utils.basic import AnsibleModule |
| 642 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.stp.stp import StpArgs |
| 643 |
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.config.stp.stp import Stp |
| 644 |
|
| 645 |
|
| 646 |
def main(): |
| 647 |
""" |
| 648 |
Main entry point for module execution |
| 649 |
|
| 650 |
:returns: the result form module invocation |
| 651 |
""" |
| 652 |
module = AnsibleModule(argument_spec=StpArgs.argument_spec, |
| 653 |
supports_check_mode=True) |
| 654 |
|
| 655 |
result = Stp(module).execute_module() |
| 656 |
module.exit_json(**result) |
| 657 |
|
| 658 |
|
| 659 |
if __name__ == '__main__': |
| 660 |
main() |