1# xSTP role
2
3This role facilitates the configuration of xSTP attributes. It supports multiple version of spanning-tree protocol (STP), rapid spanning-tree (RSTP), rapid per-VLAN spanning-tree (Rapid PVST+), multiple spanning-tree (MST), and per-VLAN spanning-tree (PVST). It supports the configuration of bridge priority, enabling and disabling spanning-tree, creating and deleting instances, and mapping virtual LAN (VLAN) to instances. This role is abstracted for Dell EMC PowerSwitch platforms running Dell EMC SmartFabric OS10.
4
5The xSTP role requires an SSH connection for connectivity to a Dell EMC SmartFabric OS10 device. You can use any of the built-in OS connection variables.
6
7Role variables
8--------------
9
10- Role is abstracted using the `ansible_network_os` variable that can take `dellemc.os10.os10` as the value
11- If `os10_cfg_generate` is set to true, the variable generates the role configuration commands in a file
12- `os10_xstp` (dictionary) contains the hostname (dictionary)
13- Hostname is the value of the *hostname* variable that corresponds to the name of the device
14- Any role variable with a corresponding state variable set to absent negates the configuration of that variable
15- Setting an empty value to any variable negates the corresponding configuration
16- Variables and values are case-sensitive
17
18**hostname keys**
19
20| Key        | Type                      | Description                                             | Support              |
21|------------|---------------------------|---------------------------------------------------------|----------------------|
22| ``type``       | string (required) | Configures the type of spanning-tree mode specified that can vary according to the device including RSTP, rapid-PVST, and MST | os10 |
23| ``enable``  | boolean: true,false             | Enables/disables the spanning-tree protocol specified in the type variable | os10 |
24| ``mac_flush_timer`` | integer | Configures the mac_flush_timer value (0 to 500) | os10 |
25| ``rstp``  | dictionary             | Configures rapid spanning-tree (see ``rstp.*``)  | os10 |
26| ``rstp.bridge_priority`` | integer | Configures bridge-priority for the spanning-tree (0 to 61440 in multiples of 4096) | os10 |
27| ``rstp.max_age`` | integer  | Configures the max_age timer for RSTP (6 to 40) | os10 |
28| ``rstp.hello_time`` | integer | Configures the hello-time for RSTP (1 to 10) | os10 |
29| ``rstp.forward_time`` | integer | Configures the forward-time for RSTP (4 to 30) | os10 |
30| ``rstp.force_version`` | string: stp | Configures the force version for the BPDUs transmitted by RSTP | os10 |
31| ``rstp.mac_flush_threshold`` | integer | Configures the MAC flush threshold for RSTP (1 to 65535) | os10 |
32| ``pvst``  | dictionary     | Configures per-VLAN spanning-tree protocol (see ``pvst.*``) | os10 |
33| ``pvst.vlan`` | list | Configures the VLAN for PVST (see ``vlan.*``)  | os10 |
34| ``vlan.range_or_id``  | string             | Configures a VLAN/range of VLANs for the per-VLAN spanning-tree protocol | os10 |
35| ``vlan.max_age`` | integer  | Configures the max_age timer for a VLAN (6 to 40) | os10 |
36| ``vlan.hello_time`` | integer | Configures the hello-time for a VLAN (1 to 10) | os10 |
37| ``vlan.forward_time`` | integer | Configures the forward-time for a VLAN (4 to 30) | os10 |
38| ``vlan.enable`` | boolean: true,false | Enables/disables spanning-tree for the associated VLAN range_or_id | os10 |
39| ``vlan.mac_flush_threshold`` | integer | Configures the MAC flush threshold for a VLAN (1 to 65535) | os10 |
40| ``vlan.root`` | string: primary,secondary | Designates the primary or secondary root for the associated VLAN range_or_id; mutually exclusive with *vlan.bridge_priority* | os10 |
41| ``vlan.bridge_priority`` | integer | Configures bridge-priority for the per-VLAN spanning-tree (0 to 61440 in multiples of 4096); mutually exclusive with *vlan.root* | os10 |
42| ``mstp``  | dictionary     | Configures multiple spanning-tree protocol (see ``mstp.*``)  | os10 |
43| ``mstp.max_age`` | integer  | Configures the max_age timer for MSTP (6 to 40) | os10 |
44| ``mstp.max_hops`` | integer | Configures the max-hops for MSTP (6 to 40) | os10 |
45| ``mstp.hello_time`` | integer | Configures the hello-time for MSTP (1 to 10) | os10 |
46| ``mstp.forward_time`` | integer | Configures the forward-time for MSTP (4 to 30) | os10 |
47| ``mstp.force_version`` | string: stp,rstp | Configures the force-version for the BPDUs transmitted by MSTP | os10 |
48| ``mstp.mstp_instances`` | list | Configures a MSTP instance (see ``mstp_instances.*``)  | os10 |
49| ``mstp_instances.number_or_range``     | integer                   | Configures the multiple spanning-tree instance number| os10 |
50| ``mstp_instances.bridge_priority`` | integer | Configures the bridge-priority for the spanning-tree (0 to 61440 in multiples of 4096); mutually exclusive with *mstp_instances.root* | os10 |
51| ``mstp_instances.enable`` | boolean: true,false | Enables/disables spanning-tree for the associated MSTP instance | os10 |
52| ``mstp_instances.mac_flush_threshold`` | integer | Configures the MAC flush-threshold for an MSTP instance (1 to 65535) | os10 |
53| ``mstp_instances.root`` | string: primary,secondary | Designates the primary or secondary root for the associated MSTP instance; mutually exclusive with *mstp_instances.bridge_priority* | os10 |
54| ``mstp.mst_config`` | dictionary | Configures multiple spanning-tree (see ``mstp.mst_config.*``); supported | os10 |
55| ``mst_config.name`` | string | Configures the name which is specified for the MSTP | os10 |
56| ``mst_config.revision`` | integer | Configures the revision number for MSTP | os10 |
57| ``mst_config.cfg_list`` | list | Configures the multiple spanning-tree list (see ``mst_config.cfg_list.*``) | os10 |
58| ``cfg_list.number`` | integer | Specifies the MSTP instance number | os10 |
59| ``cfg_list.vlans``      | string     | Configures a VLAN/range of VLANs by mapping it to an instance number | os10 |
60| ``cfg_list.vlans_state`` | string: absent,present\* | Deletes a set of VLANs mapped to the spanning-tree instance if set to absent | os10 |
61| ``intf`` | list | Configures multiple spanning-tree in an interface (see ``intf.*``)  | os10 |
62| ``intf <interface name>``| dictionary | Configures the interface name (see ``intf.<interface name>.*``) | os10 |
63| ``intf.<interface name>.edge_port`` | boolean: true,false | Configures the EdgePort as dynamic if set to true | os10 |
64| ``intf.<interface name>.bpdu_filter``| boolean: true,false | Enables/disables bpdufilter at the interface | os10 |
65| ``intf.<interface name>.bpdu_guard``| boolean: true,false | Enables/disables bpduguard at the interface | os10 |
66| ``intf.<interface name>.guard``| string: loop,root,none | Configures guard on the interface | os10 |
67| ``intf.<interface name>.enable`` | boolean: true,false | Enables/disables spanning-tree at the interface level  | os10 |
68| ``intf.<interface name>.link_type``| string: auto,point-to-point,shared | Configures the link type at the interface | os10 |
69| ``intf.<interface name>.rstp`` | dictionary | Configures the RSTP interface name (see ``intf.<interface name>.rstp.*``) | os10 |
70| ``rstp.priority``| integer | Configures the RSTP priority value at the interface | os10 |
71| ``rstp.cost`` | integer | Configures the RSTP cost value at the interface | os10 |
72| ``intf.<interface name>.msti`` | list | Configures the MSTi interface name (see ``intf.<interface name>.msti``) | os10 |
73| ``msti.instance_number`` | integer or range | Specifies the MSTP instance number or range | os10 |
74| ``msti.priority`` | integer | Specifies the priority value to be configured at the interface | os10 |
75| ``msti.cost`` | integer | Specifies the cost value to be configured at the interface | os10 |
76| ``intf.<interface name>.vlan`` | list | Configures the VLAN interface name (see ``intf.<interface name>.vlan``)  | os10 |
77| ``vlan.range_or_id`` | integer or range | Specifies the VLAN ID or range | os10 |
78| ``vlan.priority`` | integer | Specifies the priority value to be configured at the interface | os10 |
79| ``vlan.cost`` | integer | Specifies the cost value to be configured at the interface | os10 |
80
81> **NOTE**: Asterisk (_*_) denotes the default value if none is specified.
82
83Connection variables
84--------------------
85
86Ansible Dell EMC network roles require connection information to establish communication with the nodes in your inventory. This information can exist in the Ansible *group_vars* or *host_vars* directories or inventory or in the playbook itself.
87
88| Key         | Required | Choices    | Description                                           |
89|-------------|----------|------------|-------------------------------------------------------|
90| ``ansible_host`` | yes      |            | Specifies the hostname or address for connecting to the remote device over the specified transport |
91| ``ansible_port`` | no       |            | Specifies the port used to build the connection to the remote device; if value is unspecified, the `ANSIBLE_REMOTE_PORT` option is used; it defaults to 22 |
92| ``ansible_ssh_user`` | no       |            | Specifies the username that authenticates the CLI login for the connection to the remote device; if value is unspecified, the `ANSIBLE_REMOTE_USER` environment variable value is used  |
93| ``ansible_ssh_pass`` | no       |            | Specifies the password that authenticates the connection to the remote device |
94| ``ansible_become`` | no       | yes, no\*   | Instructs the module to enter privileged mode on the remote device before sending any commands; if value is unspecified, the `ANSIBLE_BECOM`E environment variable value is used, and the device attempts to execute all commands in non-privileged mode |
95| ``ansible_become_method`` | no       | enable, sudo\*   | Instructs the module to allow the become method to be specified for handling privilege escalation; if value is unspecified, the `ANSIBLE_BECOME_METHOD` environment variable value is used |
96| ``ansible_become_pass`` | no       |            | Specifies the password to use if required to enter privileged mode on the remote device; if ``ansible_become`` is set to no this key is not applicable |
97| ``ansible_network_os`` | yes      | os10, null\*  | Loads the correct terminal and cliconf plugins to communicate with the remote device |
98
99> **NOTE**: Asterisk (\*) denotes the default value if none is specified.
100
101
102Example playbook
103----------------
104
105This example uses the *os10_xstp* role to configure different variants of spanning-tree. Based on the type of STP and defined objects, VLANs are associated and bridge priorities are assigned. It creates a *hosts* file with the switch details, and a *host_vars* file with connection variables. The corresponding role variables are defined in the *vars/main.yml* file at the role path.
106
107It writes a simple playbook that only references the *os10_xstp* role. By including the role, you automatically get access to all of the tasks to configure xSTP.
108
109**Sample hosts file**
110
111    spine1 ansible_host= <ip_address>
112
113**Sample host_vars/spine1**
114
115    hostname: spine1
116    ansible_become: yes
117    ansible_become_method: xxxxx
118    ansible_become_pass: xxxxx
119    ansible_ssh_user: xxxxx
120    ansible_ssh_pass: xxxxx
121    ansible_network_os: dellemc.os10.os10
122    build_dir: ../temp/temp_os10
123
124**Sample vars/main.yml**
125
126     os10_xstp:
127        type: rstp
128        enable: true
129        path_cost: true
130        mac_flush_timer: 4
131        rstp:
132          max_age: 6
133          hello_time: 7
134          forward_time: 7
135          force_version: stp
136          bridge_priority: 4096
137          mac_flush_threshold: 5
138        pvst:
139          vlan:
140            - range_or_id: 10
141              max_age: 6
142              enable: true
143              hello_time: 7
144              forward_time: 7
145              bridge_priority: 4096
146              mac_flush_threshold: 9
147        mstp:
148          max_age: 6
149          max_hops: 6
150          hello_time: 7
151          forward_time: 7
152          force_version: stp
153          mstp_instances:
154            - number_or_range: 1
155              enable: true
156              mac_flush_threshold: 9
157              bridge_priority: 4096
158          mst_config:
159             name: cfg1
160             revision: 5
161             cfg_list:
162               - number: 1
163                 vlans: 10,12
164                 vlans_state: present
165        intf:
166          ethernet 1/1/8:
167            edge_port: true
168            bpdu_filter: true
169            bpdu_guard: true
170            guard: loop
171            enable: true
172            link_type: point-to-point
173            msti:
174              - instance_number: 1
175                priority: 32
176                cost: 1
177            rstp:
178                priority: 32
179                cost: 7
180            vlan:
181                - range_or_id: 6
182                priority: 16
183                cost: 8
184
185
186**Simple playbook to setup system — spine.yml**
187
188    - hosts: spine
189      roles:
190         - dellemc.os10.os10_xstp
191
192**Run**
193
194    ansible-playbook -i hosts spine.yml
195
196(c) 2017-2020 Dell Inc. or its subsidiaries. All rights reserved.
197