|
| 1 | +# Copyright 2024 Cisco Systems, Inc. and its affiliates |
| 2 | +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | +# Helper playbooks to test modules and flows while developing them |
| 7 | + |
| 8 | +# Tested operations: |
| 9 | + |
| 10 | +# 0. Delete leftover objects |
| 11 | +# 1. Create Policy list |
| 12 | +# 2. Create already existing Policy list (should return not changed) |
| 13 | +# 3. Update Policy list |
| 14 | +# 4. Create Policy definition |
| 15 | +# 5. Update Policy definition |
| 16 | +# 6. Create centralized policy |
| 17 | +# 7. Activate centralized policy |
| 18 | +# 8. Create localized policy |
| 19 | +# 9. Delete all created objects |
| 20 | + |
| 21 | +- name: Testing playbook to verify cisco.catalystwan.device_templates module operations |
| 22 | + hosts: localhost |
| 23 | + gather_facts: false |
| 24 | + vars_files: |
| 25 | + - configuration_file_dev_vars.yml |
| 26 | + vars: |
| 27 | + manager_authentication: &manager_authentication |
| 28 | + url: "{{ (vmanage_instances | first).mgmt_public_ip }}" |
| 29 | + username: "{{ (vmanage_instances | first).admin_username }}" |
| 30 | + password: "{{ (vmanage_instances | first).admin_password }}" |
| 31 | + |
| 32 | + tasks: |
| 33 | + - name: Delete pre existing centralized policy |
| 34 | + cisco.catalystwan.policy: |
| 35 | + name: test_centralized_policy |
| 36 | + centralized: |
| 37 | + type: feature |
| 38 | + state: absent |
| 39 | + manager_credentials: |
| 40 | + <<: *manager_authentication |
| 41 | + |
| 42 | + - name: Delete pre existing localized policy |
| 43 | + cisco.catalystwan.policy: |
| 44 | + name: test_localized_policy |
| 45 | + localized: |
| 46 | + type: feature |
| 47 | + state: absent |
| 48 | + manager_credentials: |
| 49 | + <<: *manager_authentication |
| 50 | + |
| 51 | + - name: Delete pre existing policy definitions |
| 52 | + cisco.catalystwan.policy: |
| 53 | + name: test_hub_and_spoke_policy |
| 54 | + definition: |
| 55 | + type: "hub_and_spoke" |
| 56 | + state: absent |
| 57 | + manager_credentials: |
| 58 | + <<: *manager_authentication |
| 59 | + |
| 60 | + - name: Delete pre existing policy lists |
| 61 | + cisco.catalystwan.policy: |
| 62 | + name: "{{ item['name'] }}" |
| 63 | + list: |
| 64 | + type: "{{ item['type'] }}" |
| 65 | + state: absent |
| 66 | + manager_credentials: |
| 67 | + <<: *manager_authentication |
| 68 | + loop: |
| 69 | + - name: test_vpn_list |
| 70 | + type: vpn |
| 71 | + - name: test_hub_list |
| 72 | + type: site |
| 73 | + - name: test_spoke_list |
| 74 | + type: site |
| 75 | + |
| 76 | + - name: Create VPN list |
| 77 | + cisco.catalystwan.policy: |
| 78 | + name: test_vpn_list |
| 79 | + list: |
| 80 | + type: "vpn" |
| 81 | + entries: |
| 82 | + - vpn: 100 |
| 83 | + manager_credentials: |
| 84 | + <<: *manager_authentication |
| 85 | + register: result_vpn_list |
| 86 | + |
| 87 | + - name: Create existing VPN list again |
| 88 | + cisco.catalystwan.policy: |
| 89 | + name: test_vpn_list |
| 90 | + list: |
| 91 | + type: "vpn" |
| 92 | + entries: |
| 93 | + - vpn: 100 |
| 94 | + manager_credentials: |
| 95 | + <<: *manager_authentication |
| 96 | + register: result_vpn_list |
| 97 | + failed_when: result_vpn_list['changed'] |
| 98 | + |
| 99 | + - name: Update VPN list |
| 100 | + cisco.catalystwan.policy: |
| 101 | + name: test_vpn_list |
| 102 | + list: |
| 103 | + type: "vpn" |
| 104 | + entries: |
| 105 | + - vpn: 101 |
| 106 | + manager_credentials: |
| 107 | + <<: *manager_authentication |
| 108 | + register: result_vpn_list |
| 109 | + failed_when: not result_vpn_list['changed'] or "updated" not in result_vpn_list['msg'] |
| 110 | + |
| 111 | + - name: Create HUB list |
| 112 | + cisco.catalystwan.policy: |
| 113 | + name: test_hub_list |
| 114 | + list: |
| 115 | + type: "site" |
| 116 | + entries: |
| 117 | + - site_id: "100" |
| 118 | + manager_credentials: |
| 119 | + <<: *manager_authentication |
| 120 | + register: result_hub_list |
| 121 | + |
| 122 | + - name: Create SPOKE list |
| 123 | + cisco.catalystwan.policy: |
| 124 | + name: test_spoke_list |
| 125 | + list: |
| 126 | + type: "site" |
| 127 | + entries: |
| 128 | + - site_id: "1001" |
| 129 | + manager_credentials: |
| 130 | + <<: *manager_authentication |
| 131 | + register: result_spoke_list |
| 132 | + |
| 133 | + - name: Create hub and spoke policy |
| 134 | + cisco.catalystwan.policy: |
| 135 | + name: test_hub_and_spoke_policy |
| 136 | + definition: |
| 137 | + type: "hub_and_spoke" |
| 138 | + definition: |
| 139 | + vpnList: "{{ result_vpn_list['id'] }}" |
| 140 | + subDefinitions: |
| 141 | + - name: "My Hub-and-Spoke" |
| 142 | + equalPreference: true |
| 143 | + advertiseTloc: false |
| 144 | + spokes: |
| 145 | + - siteList: "{{ result_spoke_list['id'] }}" |
| 146 | + hubs: |
| 147 | + - siteList: "{{ result_spoke_list['id'] }}" |
| 148 | + manager_credentials: |
| 149 | + <<: *manager_authentication |
| 150 | + register: result_hub_and_spoke_policy |
| 151 | + |
| 152 | + - name: Update hub and spoke policy |
| 153 | + cisco.catalystwan.policy: |
| 154 | + name: test_hub_and_spoke_policy |
| 155 | + definition: |
| 156 | + type: "hub_and_spoke" |
| 157 | + definition: |
| 158 | + vpnList: "{{ result_vpn_list['id'] }}" |
| 159 | + subDefinitions: |
| 160 | + - name: "My Hub-and-Spoke" |
| 161 | + equalPreference: true |
| 162 | + advertiseTloc: false |
| 163 | + spokes: |
| 164 | + - siteList: "{{ result_spoke_list['id'] }}" |
| 165 | + hubs: |
| 166 | + - siteList: "{{ result_hub_list['id'] }}" |
| 167 | + manager_credentials: |
| 168 | + <<: *manager_authentication |
| 169 | + register: result_hub_and_spoke_policy |
| 170 | + |
| 171 | + - name: Create centralized policy |
| 172 | + cisco.catalystwan.policy: |
| 173 | + name: test_centralized_policy |
| 174 | + centralized: |
| 175 | + definition: |
| 176 | + assembly: |
| 177 | + - definitionId: "{{ result_hub_and_spoke_policy['id'] }}" |
| 178 | + type: "hubAndSpoke" |
| 179 | + manager_credentials: |
| 180 | + <<: *manager_authentication |
| 181 | + |
| 182 | + - name: Activate centralized policy |
| 183 | + cisco.catalystwan.policy: |
| 184 | + state: active |
| 185 | + name: test_centralized_policy |
| 186 | + centralized: |
| 187 | + definition: |
| 188 | + assembly: |
| 189 | + - definitionId: "{{ result_hub_and_spoke_policy['id'] }}" |
| 190 | + type: "hubAndSpoke" |
| 191 | + manager_credentials: |
| 192 | + <<: *manager_authentication |
| 193 | + |
| 194 | + - name: Create localized policy |
| 195 | + cisco.catalystwan.policy: |
| 196 | + name: test_localized_policy |
| 197 | + localized: |
| 198 | + definition: |
| 199 | + assembly: [] |
| 200 | + manager_credentials: |
| 201 | + <<: *manager_authentication |
| 202 | + |
| 203 | + - name: Delete centralized policy |
| 204 | + cisco.catalystwan.policy: |
| 205 | + name: test_centralized_policy |
| 206 | + centralized: |
| 207 | + type: feature |
| 208 | + state: absent |
| 209 | + manager_credentials: |
| 210 | + <<: *manager_authentication |
| 211 | + |
| 212 | + - name: Delete localized policy |
| 213 | + cisco.catalystwan.policy: |
| 214 | + name: test_localized_policy |
| 215 | + localized: |
| 216 | + type: feature |
| 217 | + state: absent |
| 218 | + manager_credentials: |
| 219 | + <<: *manager_authentication |
| 220 | + |
| 221 | + - name: Delete policy definitions |
| 222 | + cisco.catalystwan.policy: |
| 223 | + name: test_hub_and_spoke_policy |
| 224 | + definition: |
| 225 | + type: "hub_and_spoke" |
| 226 | + state: absent |
| 227 | + manager_credentials: |
| 228 | + <<: *manager_authentication |
| 229 | + |
| 230 | + - name: Delete policy lists |
| 231 | + cisco.catalystwan.policy: |
| 232 | + name: "{{ item['name'] }}" |
| 233 | + list: |
| 234 | + type: "{{ item['type'] }}" |
| 235 | + state: absent |
| 236 | + manager_credentials: |
| 237 | + <<: *manager_authentication |
| 238 | + loop: |
| 239 | + - name: test_vpn_list |
| 240 | + type: vpn |
| 241 | + - name: test_hub_list |
| 242 | + type: site |
| 243 | + - name: test_spoke_list |
| 244 | + type: site |
0 commit comments