diff options
author | Patryk D. Cichy <patryk.d.cichy@gmail.com> | 2019-03-28 21:53:32 +0100 |
---|---|---|
committer | René Moser <mail@renemoser.net> | 2019-03-28 21:53:32 +0100 |
commit | 43514e9d93455a94521dd0d1f5c29bf9e07ca5bf (patch) | |
tree | 6f5ae7be3ec633a3274b2dd760e8049159083a12 /test/integration/targets/cs_traffic_type | |
parent | 601d20117d897a467c08ba0508ee17f0623e4ef7 (diff) | |
download | ansible-43514e9d93455a94521dd0d1f5c29bf9e07ca5bf.tar.gz |
Add a new CloudStack module - cs_traffic_type (#54451)
* Add get_physical_network to AnsibleCloudStack
* Add new module cs_traffic_type
Diffstat (limited to 'test/integration/targets/cs_traffic_type')
-rw-r--r-- | test/integration/targets/cs_traffic_type/aliases | 2 | ||||
-rw-r--r-- | test/integration/targets/cs_traffic_type/meta/main.yml | 3 | ||||
-rw-r--r-- | test/integration/targets/cs_traffic_type/tasks/main.yml | 173 |
3 files changed, 178 insertions, 0 deletions
diff --git a/test/integration/targets/cs_traffic_type/aliases b/test/integration/targets/cs_traffic_type/aliases new file mode 100644 index 0000000000..c89c86d7d2 --- /dev/null +++ b/test/integration/targets/cs_traffic_type/aliases @@ -0,0 +1,2 @@ +cloud/cs +shippable/cs/group1 diff --git a/test/integration/targets/cs_traffic_type/meta/main.yml b/test/integration/targets/cs_traffic_type/meta/main.yml new file mode 100644 index 0000000000..e9a5b9eeae --- /dev/null +++ b/test/integration/targets/cs_traffic_type/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/test/integration/targets/cs_traffic_type/tasks/main.yml b/test/integration/targets/cs_traffic_type/tasks/main.yml new file mode 100644 index 0000000000..54e155de3a --- /dev/null +++ b/test/integration/targets/cs_traffic_type/tasks/main.yml @@ -0,0 +1,173 @@ +--- +# Create a new zone - the default one is enabled +- name: assure zone for tests + cs_zone: + name: cs-test-zone + state: present + dns1: 8.8.8.8 + network_type: advanced + register: cszone + +- name: ensure the zone is disabled + cs_zone: + name: "{{ cszone.name }}" + state: disabled + register: cszone + +- name: setup a network + cs_physical_network: + name: net01 + zone: "{{ cszone.name }}" + isolation_method: VLAN + broadcast_domain_range: ZONE + ignore_errors: true + register: pn + + +- name: fail on missing params + cs_traffic_type: + ignore_errors: true + register: tt +- name: validate fail on missing params + assert: + that: + - tt is failed + - 'tt.msg == "missing required arguments: physical_network, traffic_type"' + +- name: add a traffic type in check mode + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + zone: "{{ pn.zone }}" + register: tt + check_mode: yes +- name: validate add a traffic type in check mode + assert: + that: + - tt is changed + - tt.zone == pn.zone + +- name: add a traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + zone: "{{ pn.zone }}" + register: tt +- name: validate add a traffic type + assert: + that: + - tt is changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + +- name: add a traffic type idempotence + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + zone: "{{ pn.zone }}" + register: tt +- name: validate add a traffic type idempotence + assert: + that: + - tt is not changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + +- name: update traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + kvm_networklabel: cloudbr0 + zone: "{{ pn.zone }}" + register: tt +- name: validate update traffic type + assert: + that: + - tt is changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + - tt.kvm_networklabel == 'cloudbr0' + +- name: update traffic type idempotence + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Guest + kvm_networklabel: cloudbr0 + zone: "{{ pn.zone }}" + register: tt +- name: validate update traffic type idempotence + assert: + that: + - tt is not changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Guest' + - tt.zone == pn.zone + - tt.kvm_networklabel == 'cloudbr0' + +- name: add a removable traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + kvm_networklabel: cloudbr1 + zone: "{{ pn.zone }}" + register: tt +- name: validate add a removable traffic type + assert: + that: + - tt is changed + - tt.physical_network == pn.id + - tt.traffic_type == 'Public' + - tt.zone == pn.zone + - tt.kvm_networklabel == 'cloudbr1' + +- name: remove traffic type in check mode + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + state: absent + zone: "{{ pn.zone }}" + check_mode: yes + register: tt +- name: validate remove traffic type in check mode + assert: + that: + - tt is changed + +- name: remove traffic type + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + state: absent + zone: "{{ pn.zone }}" + register: tt +- name: validate remove traffic type + assert: + that: + - tt is changed + - tt.zone == pn.zone + +- name: remove traffic type idempotence + cs_traffic_type: + physical_network: "{{ pn.name }}" + traffic_type: Public + state: absent + zone: "{{ pn.zone }}" + register: tt +- name: validate + assert: + that: + - tt is not changed + - tt.zone == pn.zone + +- name: cleanup + block: + - cs_physical_network: + name: "{{ pn.name }}" + zone: "{{ cszone.name }}" + state: absent + - cs_zone: + name: "{{ cszone.name }}" + state: absent
\ No newline at end of file |