|
1 | | ---- |
2 | | -- name: DEBUG start spine_leaf_basic |
| 1 | +- name: Start dcnm_fabric spine_leaf_basic test |
3 | 2 | ansible.builtin.debug: |
4 | | - msg: "Starting dcnm_fabric spine_leaf_basic test (role_path={{ role_path }})" |
| 3 | + msg: "Starting dcnm_fabric spine_leaf_basic test" |
5 | 4 |
|
6 | | -- name: CLEANUP interfaces |
| 5 | +- name: Display role path |
| 6 | + ansible.builtin.debug: |
| 7 | + msg: "Role Path {{ role_path }}" |
| 8 | + |
| 9 | +- name: Cleanup - Reset or Default Ethernet Interfaces |
7 | 10 | cisco.dcnm.dcnm_interface: |
8 | 11 | fabric: "{{ fabric_name }}" |
9 | 12 | state: deleted |
10 | 13 | config: |
11 | 14 | - name: "Ethernet1/3" |
12 | 15 | - name: "Ethernet1/4" |
13 | 16 |
|
14 | | -- name: CLEANUP networks |
| 17 | +- name: Cleanup - Delete Networks |
15 | 18 | cisco.dcnm.dcnm_network: |
16 | 19 | fabric: "{{ fabric_name }}" |
17 | 20 | state: deleted |
18 | 21 |
|
19 | | -- name: CLEANUP vrfs |
| 22 | +- name: Cleanup - Delete Tenant VRF |
20 | 23 | cisco.dcnm.dcnm_vrf: |
21 | 24 | fabric: "{{ fabric_name }}" |
22 | 25 | state: deleted |
23 | 26 |
|
24 | | -- block: |
25 | | - - name: MERGE access ethernet interfaces |
26 | | - cisco.dcnm.dcnm_interface: &interfaces_cfg |
| 27 | +- name: Execute spine_leaf_basic workflow |
| 28 | + block: |
| 29 | + - name: Configure access ethernet interfaces |
| 30 | + cisco.dcnm.dcnm_interface: &config_interfaces |
27 | 31 | fabric: "{{ fabric_name }}" |
28 | 32 | state: merged |
29 | 33 | config: |
|
36 | 40 | profile: |
37 | 41 | admin_state: true |
38 | 42 | mode: access |
39 | | - speed: Auto |
| 43 | + speed: 'Auto' |
40 | 44 | bpdu_guard: true |
41 | 45 | port_type_fast: true |
42 | 46 | mtu: default |
43 | 47 | access_vlan: 55 |
44 | | - description: "Access interface for vlan55" |
| 48 | + cmds: |
| 49 | + - no shutdown |
| 50 | + description: "Access interface for vlan55" |
45 | 51 | - name: "Ethernet1/4" |
46 | 52 | type: eth |
47 | 53 | switch: |
|
51 | 57 | profile: |
52 | 58 | admin_state: true |
53 | 59 | mode: access |
54 | | - speed: Auto |
| 60 | + speed: 'Auto' |
55 | 61 | bpdu_guard: true |
56 | 62 | port_type_fast: true |
57 | 63 | mtu: default |
58 | 64 | access_vlan: 65 |
59 | | - description: "Access interface for vlan65" |
60 | | - register: interfaces_result |
61 | | - - name: ASSERT interfaces merged |
| 65 | + cmds: |
| 66 | + - no shutdown |
| 67 | + description: "Access interface for vlan65" |
| 68 | + register: result |
| 69 | + |
| 70 | + - name: ASSERT - Interfaces created |
62 | 71 | ansible.builtin.assert: |
63 | 72 | that: |
64 | | - - 'interfaces_result.changed' |
65 | | - - name: INTERFACES idempotence |
66 | | - cisco.dcnm.dcnm_interface: *interfaces_cfg |
67 | | - register: interfaces_idem |
68 | | - - name: ASSERT interfaces idempotence |
| 73 | + - 'result.changed == true' |
| 74 | + - 'result.response[0].RETURN_CODE == 200' |
| 75 | + - 'result.response[1].RETURN_CODE == 200' |
| 76 | + |
| 77 | + - name: Configure access ethernet interfaces - Idempotence |
| 78 | + cisco.dcnm.dcnm_interface: *config_interfaces |
| 79 | + register: result |
| 80 | + |
| 81 | + - name: ASSERT - Interface idempotence |
69 | 82 | ansible.builtin.assert: |
70 | 83 | that: |
71 | | - - 'interfaces_idem.changed == false' |
| 84 | + - 'result.changed == false' |
| 85 | + - 'result.response | length == 0' |
72 | 86 |
|
73 | | - - name: MERGE tenant VRF green_red |
74 | | - cisco.dcnm.dcnm_vrf: &vrf_cfg |
| 87 | + - name: Add Tenant VRF |
| 88 | + cisco.dcnm.dcnm_vrf: &add_vrf |
75 | 89 | fabric: "{{ fabric_name }}" |
76 | 90 | state: merged |
77 | 91 | config: |
|
82 | 96 | - ip_address: "{{ leaf1 }}" |
83 | 97 | - ip_address: "{{ leaf3 }}" |
84 | 98 | deploy: true |
85 | | - register: vrf_result |
86 | | - - name: QUERY vrf until DEPLOYED |
87 | | - cisco.dcnm.dcnm_vrf: |
88 | | - fabric: "{{ fabric_name }}" |
89 | | - state: query |
90 | | - register: vrf_query |
91 | | - until: |
92 | | - - "vrf_query.response[0].parent.vrfStatus is search('DEPLOYED')" |
93 | | - retries: 30 |
94 | | - delay: 2 |
95 | | - - name: ASSERT vrf merged |
| 99 | + register: result |
| 100 | + |
| 101 | + - name: ASSERT - VRF created |
96 | 102 | ansible.builtin.assert: |
97 | 103 | that: |
98 | | - - 'vrf_result.changed' |
99 | | - - name: VRF idempotence |
100 | | - cisco.dcnm.dcnm_vrf: *vrf_cfg |
101 | | - register: vrf_idem |
102 | | - - name: ASSERT vrf idempotence |
| 104 | + - 'result.changed == true' |
| 105 | + - 'result.response[0].RETURN_CODE == 200' |
| 106 | + - 'result.response[1].RETURN_CODE == 200' |
| 107 | + - 'result.response[2].RETURN_CODE == 200' |
| 108 | + |
| 109 | + - name: Add Tenant VRF - Idempotence |
| 110 | + cisco.dcnm.dcnm_vrf: *add_vrf |
| 111 | + register: result |
| 112 | + |
| 113 | + - name: ASSERT - VRF idempotence |
103 | 114 | ansible.builtin.assert: |
104 | 115 | that: |
105 | | - - 'vrf_idem.changed == false' |
| 116 | + - 'result.changed == false' |
| 117 | + - 'result.response | length == 0' |
106 | 118 |
|
107 | | - - name: MERGE networks l2vni_4000 & l2vni_7000 |
108 | | - cisco.dcnm.dcnm_network: &net_cfg |
| 119 | + - name: Add Networks |
| 120 | + cisco.dcnm.dcnm_network: &add_networks |
109 | 121 | fabric: "{{ fabric_name }}" |
110 | 122 | state: merged |
111 | 123 | config: |
|
116 | 128 | gw_ip_subnet: '192.168.1.1/24' |
117 | 129 | attach: |
118 | 130 | - ip_address: "{{ leaf1 }}" |
119 | | - ports: |
120 | | - - Ethernet1/3 |
| 131 | + ports: [Ethernet1/3] |
| 132 | + deploy: true |
121 | 133 | - ip_address: "{{ leaf3 }}" |
122 | | - ports: |
123 | | - - Ethernet1/3 |
124 | | - deploy: true |
| 134 | + ports: [Ethernet1/3] |
| 135 | + deploy: true |
125 | 136 | - net_name: l2vni_7000 |
126 | 137 | vrf_name: green_red |
127 | 138 | net_id: 7000 |
128 | 139 | vlan_id: 65 |
129 | 140 | gw_ip_subnet: '192.168.2.1/24' |
130 | 141 | attach: |
131 | 142 | - ip_address: "{{ leaf1 }}" |
132 | | - ports: |
133 | | - - Ethernet1/4 |
| 143 | + ports: [] |
| 144 | + deploy: true |
134 | 145 | - ip_address: "{{ leaf3 }}" |
135 | | - ports: |
136 | | - - Ethernet1/4 |
137 | | - deploy: true |
138 | | - register: net_result |
139 | | - - name: ASSERT networks merged |
| 146 | + ports: [] |
| 147 | + deploy: true |
| 148 | + register: result |
| 149 | + |
| 150 | + - name: ASSERT - Networks created |
140 | 151 | ansible.builtin.assert: |
141 | 152 | that: |
142 | | - - 'net_result.changed' |
143 | | - - name: WAIT before networks idempotence |
| 153 | + - 'result.changed == true' |
| 154 | + - 'result.response[0].RETURN_CODE == 200' |
| 155 | + - 'result.response[1].RETURN_CODE == 200' |
| 156 | + - 'result.response[2].RETURN_CODE == 200' |
| 157 | + - 'result.response[3].RETURN_CODE == 200' |
| 158 | + |
| 159 | + - name: Sleep before checking network idempotence |
144 | 160 | ansible.builtin.wait_for: |
145 | 161 | timeout: 30 |
146 | | - - name: NETWORKS idempotence |
147 | | - cisco.dcnm.dcnm_network: *net_cfg |
148 | | - register: net_idem |
149 | | - - name: ASSERT networks idempotence |
| 162 | + |
| 163 | + - name: Add Networks - Idempotence |
| 164 | + cisco.dcnm.dcnm_network: *add_networks |
| 165 | + register: result |
| 166 | + |
| 167 | + - name: ASSERT - Network idempotence |
150 | 168 | ansible.builtin.assert: |
151 | 169 | that: |
152 | | - - 'net_idem.changed == false' |
153 | | - |
| 170 | + - 'result.changed == false' |
| 171 | + - 'result.response | length == 0' |
154 | 172 | always: |
155 | | - - name: DEBUG end spine_leaf_basic |
| 173 | + - name: End dcnm_fabric spine_leaf_basic test |
156 | 174 | ansible.builtin.debug: |
157 | 175 | msg: "End dcnm_fabric spine_leaf_basic test" |
0 commit comments