|
12 | 12 | state: deleted |
13 | 13 | register: result |
14 | 14 |
|
15 | | -- name: Assert |
16 | | - ansible.builtin.assert: |
| 15 | +- ansible.builtin.assert: |
17 | 16 | that: |
18 | 17 | - 'item["RETURN_CODE"] == 200' |
19 | | - loop: '{{ result.response }}' |
| 18 | + loop: '{{ result.response }}' |
20 | 19 |
|
21 | 20 |
|
22 | 21 | - block: |
|
25 | 24 | ## MERGE ## |
26 | 25 | ############################################## |
27 | 26 |
|
28 | | - - name: Create different non-existing service route peerings including all objects - false optional elements |
| 27 | + - name: Create different non-existing service route peerings including all objects - no optional elements |
29 | 28 | cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all |
30 | 29 | fabric: "{{ ansible_it_fabric }}" |
31 | 30 | service_fabric: "{{ ansible_it_service_fabric }}" |
32 | 31 | config: |
33 | 32 | - name: IT-FW-RP1 # mandatory |
34 | | - node_name: "{{ ansible_snode_1 }}" # mandatory |
35 | | - deploy_mode: intra_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] |
36 | | - inside_network: |
37 | | - name: Rp1-sn1-inside-net # mandatory |
| 33 | + node_name: "{{ ansible_snode_1 }}" # mandatory |
| 34 | + deploy_mode: intra_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] |
| 35 | + inside_network: # |
| 36 | + vrf: "{{ ansible_vrf_11 }}" # mandatory |
| 37 | + name: rp1-sn1-inside-net # mandatory |
38 | 38 | profile: |
39 | | - ipv4_gw: 192.161.1.1/24 # mandatory |
40 | | - next_hop: 192.161.1.100 # mandatory |
41 | | - outside_network: |
42 | | - vrf: "{{ ansible_vrf_11 }}" # mandatory |
43 | | - name: Rp1-sn1-outside-net # mandatory |
| 39 | + ipv4_gw: 192.161.1.1/24 # mandatory |
| 40 | + next_hop: 192.161.1.100 # mandatory |
| 41 | + outside_network: # |
| 42 | + vrf: "{{ ansible_vrf_11 }}" # mandatory |
| 43 | + name: rp1-sn1-outside-net # mandatory |
44 | 44 | profile: |
45 | | - ipv4_gw: 192.161.2.1/24 # mandatory |
| 45 | + ipv4_gw: 192.161.2.1/24 # mandatory |
46 | 46 |
|
47 | 47 | - name: IT-FW-RP2 # mandatory |
48 | | - node_name: "{{ ansible_snode_1 }}" # mandatory |
49 | | - deploy_mode: inter_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] |
| 48 | + node_name: "{{ ansible_snode_1 }}" # mandatory |
| 49 | + deploy_mode: inter_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] |
| 50 | + inside_network: # |
| 51 | + vrf: "{{ ansible_vrf_21 }}" # mandatory |
| 52 | + name: rp2-sn1-inside-net # mandatory |
| 53 | + profile: |
| 54 | + ipv4_gw: 192.162.1.1/24 # mandatory |
| 55 | + outside_network: # |
| 56 | + vrf: "{{ ansible_vrf_22 }}" # mandatory |
| 57 | + name: rp2-sn1-outside-net # mandatory |
| 58 | + profile: |
| 59 | + ipv4_gw: 192.162.2.1/24 # mandatory |
| 60 | + |
| 61 | + - name: IT-FW-RP3 # mandatory |
| 62 | + node_name: "{{ ansible_snode_1 }}" # mandatory |
| 63 | + deploy_mode: inter_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] |
| 64 | + peering_option: ebgp # optional, default is static, choices=[static, ebgp] |
50 | 65 | inside_network: |
51 | | - vrf: "{{ ansible_vrf_21 }}" # mandatory |
52 | | - name: Rp2-sn1-inside-net # mandatory |
| 66 | + vrf: "{{ ansible_vrf_31 }}" # mandatory |
| 67 | + name: rp3-sn1-inside-net # mandatory |
53 | 68 | profile: |
54 | | - ipv4_gw: 192.162.1.1/24 # mandatory |
| 69 | + ipv4_gw: 192.163.1.1/24 # mandatory |
| 70 | + ipv4_neighbor: 31.31.31.1 # mandatory |
| 71 | + ipv4_lo: 31.7.1.2 # mandatory |
| 72 | + ipv4_vpc_peer_lo: 31.7.1.3 # optional, default is '' |
| 73 | + ipv6_vpc_peer_lo: 2003:0702::1 # optional, default is '' |
55 | 74 | outside_network: |
56 | | - vrf: "{{ ansible_vrf_22 }}" # mandatory |
57 | | - name: Rp2-sn1-outside-net # mandatory |
| 75 | + vrf: "{{ ansible_vrf_32 }}" # mandatory |
| 76 | + name: rp3-sn1-outside-net # mandatory |
| 77 | + profile: |
| 78 | + ipv4_gw: 192.163.2.1/24 # mandatory |
| 79 | + ipv4_neighbor: 131.131.131.1 # mandatory |
| 80 | + ipv4_lo: 131.7.1.2 # mandatory |
| 81 | + ipv4_vpc_peer_lo: 131.7.1.3 # optional, default is '' |
| 82 | + ipv6_vpc_peer_lo: 2003:0704::1 # optional, default is '' |
| 83 | + adv_host: true # optional, default is false |
| 84 | + |
| 85 | + - name: IT-ADC-RP4 |
| 86 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 87 | + deploy_mode: one_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] |
| 88 | + peering_option: ebgp # optional, default is static, choices=[static, ebgp] |
| 89 | + first_arm: |
| 90 | + vrf: "{{ ansible_vrf_41 }}" # mandatory |
| 91 | + name: rp4-sn2-first-arm # mandatory |
| 92 | + profile: |
| 93 | + ipv4_gw: 192.164.1.1/24 # mandatory |
| 94 | + ipv4_neighbor: 41.41.41.1 # mandatory |
| 95 | + ipv4_lo: 41.7.1.2 # mandatory |
| 96 | + ipv4_vpc_peer_lo: 41.7.1.3 # optional, default is '' |
| 97 | + ipv6_vpc_peer_lo: 2004:0702::1 # optional, default is '' |
| 98 | + reverse_next_hop: 192.164.1.100 # mandatory |
| 99 | + |
| 100 | + - name: IT-ADC-RP5 |
| 101 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 102 | + deploy_mode: two_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] |
| 103 | + peering_option: ebgp # optional, default is static, choices=[static, ebgp] |
| 104 | + first_arm: |
| 105 | + vrf: "{{ ansible_vrf_51 }}" # mandatory |
| 106 | + name: rp5-sn2-first-arm # mandatory |
| 107 | + profile: |
| 108 | + ipv4_gw: 192.165.1.1/24 # mandatory |
| 109 | + ipv4_neighbor: 51.51.51.1 # mandatory |
| 110 | + ipv4_lo: 51.7.1.2 # mandatory |
| 111 | + ipv4_vpc_peer_lo: 51.7.1.3 # optional, default is '' |
| 112 | + ipv6_vpc_peer_lo: 2005:0702::1 # optional, default is '' |
| 113 | + second_arm: |
| 114 | + vrf: "{{ ansible_vrf_51 }}" # mandatory |
| 115 | + name: rp5-sn2-second-arm # mandatory |
| 116 | + profile: |
| 117 | + ipv4_gw: 192.165.2.1/24 # mandatory |
| 118 | + reverse_next_hop: 192.165.1.100 # mandatory |
| 119 | + |
| 120 | + - name: IT-ADC-RP6 |
| 121 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 122 | + deploy_mode: one_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] |
| 123 | + first_arm: |
| 124 | + vrf: "{{ ansible_vrf_61 }}" # mandatory |
| 125 | + name: rp6-sn2-first-arm # mandatory |
58 | 126 | profile: |
59 | | - ipv4_gw: 192.162.2.1/24 # mandatory |
| 127 | + ipv4_gw: 192.166.1.1/24 # mandatory |
| 128 | + reverse_next_hop: 192.166.1.100 # mandatory |
| 129 | + |
| 130 | + - name: IT-ADC-RP7 |
| 131 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 132 | + deploy_mode: two_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] |
| 133 | + first_arm: |
| 134 | + vrf: "{{ ansible_vrf_71 }}" # mandatory |
| 135 | + name: rp7-sn2-first-arm # mandatory |
| 136 | + profile: |
| 137 | + ipv4_gw: 192.167.1.1/24 # mandatory |
| 138 | + second_arm: |
| 139 | + vrf: "{{ ansible_vrf_71 }}" # mandatory |
| 140 | + name: rp7-sn2-second-arm # mandatory |
| 141 | + profile: |
| 142 | + ipv4_gw: 192.167.2.1/24 # mandatory |
| 143 | + reverse_next_hop: 192.167.1.100 # mandatory |
| 144 | + attach: true |
| 145 | + deploy: true |
| 146 | + state: merged |
| 147 | + register: result |
| 148 | + |
| 149 | + - ansible.builtin.assert: |
| 150 | + that: |
| 151 | + - 'result.changed == true' |
| 152 | + - '(result["diff"][0]["merged"] | length) == 7' |
| 153 | + - '(result["diff"][0]["deleted"] | length) == 0' |
| 154 | + - '(result["diff"][0]["modified"] | length) == 0' |
| 155 | + - '(result["diff"][0]["query"] | length) == 0' |
| 156 | + - '(result["diff"][0]["deploy"] | length) == 7' |
| 157 | + |
| 158 | + - ansible.builtin.assert: |
| 159 | + that: |
| 160 | + - 'item["RETURN_CODE"] == 200' |
| 161 | + loop: '{{ result.response }}' |
| 162 | + |
| 163 | + - name: Create service route peerings - Idempotence |
| 164 | + cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all |
| 165 | + register: result |
| 166 | + |
| 167 | + - ansible.builtin.assert: |
| 168 | + that: |
| 169 | + - 'result.changed == false' |
| 170 | + - '(result["diff"][0]["merged"] | length) == 0' |
| 171 | + - '(result["diff"][0]["deleted"] | length) == 0' |
| 172 | + - '(result["diff"][0]["modified"] | length) == 0' |
| 173 | + - '(result["diff"][0]["query"] | length) == 0' |
| 174 | + - '(result["diff"][0]["deploy"] | length) == 0' |
60 | 175 |
|
61 | 176 | ############################################## |
62 | | -## CLEANUP ## |
| 177 | +## CLEANUP ## |
63 | 178 | ############################################## |
64 | 179 |
|
65 | | - - name: Clean up - Delete all route peerings |
| 180 | + always: |
| 181 | + |
| 182 | + |
| 183 | + - name: Delete all created route peerings |
66 | 184 | cisco.dcnm.dcnm_service_route_peering: |
67 | | - state: deleted |
68 | 185 | fabric: "{{ ansible_it_fabric }}" |
69 | 186 | service_fabric: "{{ ansible_it_service_fabric }}" |
70 | | - config: [] |
71 | | - register: cleanup_result |
| 187 | + config: |
| 188 | + - name: IT-FW-RP1 # mandatory |
| 189 | + node_name: "{{ ansible_snode_1 }}" # mandatory |
| 190 | + |
| 191 | + - name: IT-FW-RP2 # mandatory |
| 192 | + node_name: "{{ ansible_snode_1 }}" # mandatory |
| 193 | + |
| 194 | + - name: IT-FW-RP3 # mandatory |
| 195 | + node_name: "{{ ansible_snode_1 }}" # mandatory |
| 196 | + |
| 197 | + - name: IT-ADC-RP4 # mandatory |
| 198 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 199 | + |
| 200 | + - name: IT-ADC-RP5 # mandatory |
| 201 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 202 | + |
| 203 | + - name: IT-ADC-RP6 # mandatory |
| 204 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 205 | + |
| 206 | + - name: IT-ADC-RP7 # mandatory |
| 207 | + node_name: "{{ ansible_snode_2 }}" # mandatory |
| 208 | + |
| 209 | + state: deleted |
| 210 | + register: result |
| 211 | + when: IT_CONTEXT is not defined |
| 212 | + |
| 213 | + - ansible.builtin.assert: |
| 214 | + that: |
| 215 | + - 'item["RETURN_CODE"] == 200' |
| 216 | + loop: '{{ result.response }}' |
| 217 | + when: IT_CONTEXT is not defined |
0 commit comments