|
19 | 19 | use_proxy: '{{ aci_use_proxy | default(true) }}' |
20 | 20 | output_level: debug |
21 | 21 |
|
22 | | -# CLEAN ENVIRONMENT |
23 | | -- name: Remove the ansible_tenant |
24 | | - cisco.aci.aci_tenant: &aci_tenant_absent |
25 | | - <<: *aci_info |
26 | | - tenant: ansible_tenant |
27 | | - state: absent |
28 | | - |
29 | 22 | - name: Verify Cloud and Non-Cloud Sites in use. |
30 | 23 | ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml |
31 | 24 |
|
32 | 25 | - name: Execute tasks only for non-cloud sites |
33 | 26 | when: query_cloud.current == [] # This condition will execute only non-cloud sites |
34 | 27 | block: # block specifies execution of tasks within, based on conditions |
35 | | - - name: Add a new tenant |
36 | | - cisco.aci.aci_tenant: &aci_tenant_present |
| 28 | + |
| 29 | + - name: Remove the ansible_tenant |
| 30 | + cisco.aci.aci_tenant: &aci_tenant_absent |
37 | 31 | <<: *aci_info |
38 | 32 | tenant: ansible_tenant |
39 | | - description: Ansible tenant |
| 33 | + state: absent |
| 34 | + |
| 35 | + - name: Add a new tenant |
| 36 | + cisco.aci.aci_tenant: |
| 37 | + <<: *aci_tenant_absent |
40 | 38 | state: present |
41 | 39 |
|
42 | | - - name: Add a new action rule profile |
43 | | - cisco.aci.aci_tenant_action_rule_profile: &aci_action_rule_present |
| 40 | + - name: Add a two action rule profiles |
| 41 | + cisco.aci.aci_tenant_action_rule_profile: |
44 | 42 | <<: *aci_info |
45 | 43 | tenant: ansible_tenant |
46 | | - action_rule: ansible_action_rule |
47 | | - description: Ansible action rule profile for ansible_tenant tenant |
| 44 | + action_rule: "{{ item }}" |
| 45 | + description: description_on_create |
48 | 46 | state: present |
| 47 | + loop: |
| 48 | + - ansible_action_rule |
| 49 | + - ansible_action_rule_2 |
49 | 50 |
|
50 | 51 | - name: Add a set AS path action rule (check_mode) |
51 | 52 | cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_present |
52 | 53 | <<: *aci_info |
53 | 54 | tenant: ansible_tenant |
54 | 55 | action_rule: ansible_action_rule |
55 | | - last_as_number: 0 |
56 | 56 | criteria: prepend |
57 | 57 | state: present |
58 | 58 | check_mode: true |
59 | 59 | register: cm_add_action_rule_set_as_path |
60 | 60 |
|
61 | | - - name: Add a set AS path action rule again (normal_mode) |
| 61 | + - name: Add a set AS path action rule again |
62 | 62 | cisco.aci.aci_action_rule_set_as_path: |
63 | 63 | <<: *aci_action_rule_set_as_path_present |
64 | 64 | register: nm_add_action_rule_set_as_path |
65 | 65 |
|
66 | 66 | - name: Add a set AS path action rule again - testing idempotency |
67 | 67 | cisco.aci.aci_action_rule_set_as_path: |
68 | 68 | <<: *aci_action_rule_set_as_path_present |
69 | | - register: nm_add_action_rule_set_as_path_idempotency |
70 | | - |
71 | | - - name: Add a set AS path action rule |
72 | | - cisco.aci.aci_action_rule_set_as_path: |
73 | | - <<: *aci_info |
74 | | - tenant: ansible_tenant |
75 | | - action_rule: ansible_action_rule |
76 | | - last_as_number: 2 |
77 | | - criteria: prepend-last-as |
78 | | - state: present |
79 | | - register: nm_add_action_rule_set_as_path_2 |
| 69 | + register: nm_add_action_rule_set_as_path_again |
80 | 70 |
|
81 | 71 | - name: Asserts for set AS path action rule creation tasks |
82 | 72 | ansible.builtin.assert: |
83 | 73 | that: |
84 | 74 | - cm_add_action_rule_set_as_path is changed |
85 | 75 | - cm_add_action_rule_set_as_path.previous == [] |
86 | 76 | - cm_add_action_rule_set_as_path.current == [] |
| 77 | + - cm_add_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.lastnum is not defined |
| 78 | + - cm_add_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.criteria == "prepend" |
| 79 | + - cm_add_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.descr is not defined |
87 | 80 | - nm_add_action_rule_set_as_path is changed |
88 | 81 | - nm_add_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "0" |
89 | 82 | - nm_add_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend" |
90 | | - - nm_add_action_rule_set_as_path_idempotency is not changed |
91 | | - - nm_add_action_rule_set_as_path_2 is changed |
92 | | - - nm_add_action_rule_set_as_path_2.previous == [] |
93 | | - - nm_add_action_rule_set_as_path_2.current.0.rtctrlSetASPath.attributes.lastnum == "2" |
94 | | - - nm_add_action_rule_set_as_path_2.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as" |
| 83 | + - nm_add_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.descr == "" |
| 84 | + - nm_add_action_rule_set_as_path_again is not changed |
| 85 | + - nm_add_action_rule_set_as_path_again.previous == nm_add_action_rule_set_as_path_again.current == nm_add_action_rule_set_as_path.current |
| 86 | + |
| 87 | + - name: Update a set AS path action rule (check_mode) |
| 88 | + cisco.aci.aci_action_rule_set_as_path: &update_action_rule_set_as_path |
| 89 | + <<: *aci_action_rule_set_as_path_present |
| 90 | + description: description_on_update |
| 91 | + check_mode: true |
| 92 | + register: cm_update_action_rule_set_as_path |
| 93 | + |
| 94 | + - name: Update a set AS path action rule |
| 95 | + cisco.aci.aci_action_rule_set_as_path: |
| 96 | + <<: *update_action_rule_set_as_path |
| 97 | + register: nm_update_action_rule_set_as_path |
| 98 | + |
| 99 | + - name: Update a set AS path action rule again |
| 100 | + cisco.aci.aci_action_rule_set_as_path: |
| 101 | + <<: *update_action_rule_set_as_path |
| 102 | + register: nm_update_action_rule_set_as_path_again |
| 103 | + |
| 104 | + - name: Asserts for set AS path action rule update tasks |
| 105 | + ansible.builtin.assert: |
| 106 | + that: |
| 107 | + - cm_update_action_rule_set_as_path is changed |
| 108 | + - cm_update_action_rule_set_as_path.previous == nm_add_action_rule_set_as_path.current |
| 109 | + - cm_update_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.lastnum is not defined |
| 110 | + - cm_update_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.criteria == "prepend" |
| 111 | + - cm_update_action_rule_set_as_path.proposed.rtctrlSetASPath.attributes.descr == "description_on_update" |
| 112 | + - nm_update_action_rule_set_as_path is changed |
| 113 | + - nm_update_action_rule_set_as_path.previous == nm_add_action_rule_set_as_path.current |
| 114 | + - nm_update_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "0" |
| 115 | + - nm_update_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend" |
| 116 | + - nm_update_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.descr == "description_on_update" |
| 117 | + - nm_update_action_rule_set_as_path_again is not changed |
| 118 | + - nm_update_action_rule_set_as_path_again.previous == nm_update_action_rule_set_as_path_again.current == nm_update_action_rule_set_as_path.current |
| 119 | + |
| 120 | + - name: Create another set AS path action rule with prepend-last-as criteria |
| 121 | + cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_2_present |
| 122 | + <<: *aci_action_rule_set_as_path_present |
| 123 | + action_rule: ansible_action_rule_2 |
| 124 | + last_as: 2 |
| 125 | + criteria: prepend-last-as |
| 126 | + register: nm_create_another_action_rule_set_as_path |
| 127 | + |
| 128 | + - name: Update another set AS path action rule with prepend-last-as criteria |
| 129 | + cisco.aci.aci_action_rule_set_as_path: |
| 130 | + <<: *aci_action_rule_set_as_path_2_present |
| 131 | + last_as: 4 |
| 132 | + register: nm_update_another_action_rule_set_as_path |
| 133 | + |
| 134 | + - name: Asserts for set AS path action rule update tasks |
| 135 | + ansible.builtin.assert: |
| 136 | + that: |
| 137 | + - nm_create_another_action_rule_set_as_path is changed |
| 138 | + - nm_create_another_action_rule_set_as_path.previous == [] |
| 139 | + - nm_create_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "2" |
| 140 | + - nm_create_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as" |
| 141 | + - nm_update_another_action_rule_set_as_path is changed |
| 142 | + - nm_update_another_action_rule_set_as_path.previous == nm_create_another_action_rule_set_as_path.current |
| 143 | + - nm_update_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "4" |
| 144 | + - nm_update_another_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend-last-as" |
95 | 145 |
|
96 | 146 | - name: Query all set AS path action rules |
97 | 147 | cisco.aci.aci_action_rule_set_as_path: |
98 | 148 | <<: *aci_info |
99 | 149 | state: query |
100 | | - register: query_all_action_rule_set_as_path |
| 150 | + register: query_all |
101 | 151 |
|
102 | 152 | - name: Query ansible_action_rule_set_as_path set AS path action rule |
103 | 153 | cisco.aci.aci_action_rule_set_as_path: |
104 | 154 | <<: *aci_action_rule_set_as_path_present |
105 | 155 | state: query |
106 | | - register: query_action_rule_set_as_path |
| 156 | + register: query_one |
107 | 157 |
|
108 | 158 | - name: Asserts query tasks |
109 | 159 | ansible.builtin.assert: |
110 | 160 | that: |
111 | | - - query_all_action_rule_set_as_path is not changed |
112 | | - - query_all_action_rule_set_as_path.current|length >= 2 |
113 | | - - query_action_rule_set_as_path is not changed |
114 | | - - query_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.lastnum == "0" |
115 | | - - query_action_rule_set_as_path.current.0.rtctrlSetASPath.attributes.criteria == "prepend" |
| 161 | + - query_all is not changed |
| 162 | + - query_all.current | length >= 2 |
| 163 | + - query_one is not changed |
| 164 | + - query_one.current.0.rtctrlSetASPath.attributes.lastnum == "0" |
| 165 | + - query_one.current.0.rtctrlSetASPath.attributes.criteria == "prepend" |
116 | 166 |
|
117 | 167 | - name: Remove set AS path action rule (check_mode) |
118 | 168 | cisco.aci.aci_action_rule_set_as_path: &aci_action_rule_set_as_path_absent |
|
121 | 171 | check_mode: true |
122 | 172 | register: cm_remove_action_rule_set_as_path |
123 | 173 |
|
124 | | - - name: Remove set AS path action rule (normal_mode) |
| 174 | + - name: Remove set AS path action rule |
125 | 175 | cisco.aci.aci_action_rule_set_as_path: |
126 | 176 | <<: *aci_action_rule_set_as_path_absent |
127 | | - register: nm_remove_remove_action_rule_set_as_path |
| 177 | + register: nm_remove_action_rule_set_as_path |
128 | 178 |
|
129 | | - - name: Remove set AS path action rule again - testing previous Removal |
| 179 | + - name: Remove set AS path action rule again |
130 | 180 | cisco.aci.aci_action_rule_set_as_path: |
131 | 181 | <<: *aci_action_rule_set_as_path_absent |
132 | | - register: nm_remove_action_rule_set_as_path_idempotency |
| 182 | + register: nm_remove_action_rule_set_as_path_again |
133 | 183 |
|
134 | 184 | - name: Asserts deletion tasks |
135 | 185 | ansible.builtin.assert: |
136 | 186 | that: |
137 | 187 | - cm_remove_action_rule_set_as_path is changed |
138 | 188 | - cm_remove_action_rule_set_as_path.proposed == {} |
139 | | - - nm_remove_remove_action_rule_set_as_path is changed |
140 | | - - nm_remove_remove_action_rule_set_as_path.previous != [] |
141 | | - - nm_remove_remove_action_rule_set_as_path.method == "DELETE" |
142 | | - - nm_remove_action_rule_set_as_path_idempotency is not changed |
143 | | - - nm_remove_action_rule_set_as_path_idempotency.previous == [] |
| 189 | + - cm_remove_action_rule_set_as_path.previous == nm_update_action_rule_set_as_path.current |
| 190 | + - nm_remove_action_rule_set_as_path is changed |
| 191 | + - nm_remove_action_rule_set_as_path.previous == nm_update_action_rule_set_as_path.current |
| 192 | + - nm_remove_action_rule_set_as_path.current == [] |
| 193 | + - nm_remove_action_rule_set_as_path_again is not changed |
| 194 | + - nm_remove_action_rule_set_as_path_again.previous == nm_remove_action_rule_set_as_path_again.current == nm_remove_action_rule_set_as_path.current |
144 | 195 |
|
145 | 196 | - name: Remove the ansible_tenant - cleanup before ending tests |
146 | 197 | cisco.aci.aci_tenant: |
147 | | - <<: *aci_tenant_present |
148 | | - state: absent |
| 198 | + <<: *aci_tenant_absent |
0 commit comments