From 33491d3ae498b87139e7b873a761af09dec45cae Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Sun, 24 Nov 2024 21:40:13 +0100 Subject: [PATCH] add vpc_offering --- .../integration/targets/vpc_offering/aliases | 3 + .../targets/vpc_offering/meta/main.yml | 3 + .../targets/vpc_offering/tasks/main.yml | 448 ++++++++++++++++++ 3 files changed, 454 insertions(+) create mode 100644 tests/integration/targets/vpc_offering/aliases create mode 100644 tests/integration/targets/vpc_offering/meta/main.yml create mode 100644 tests/integration/targets/vpc_offering/tasks/main.yml diff --git a/tests/integration/targets/vpc_offering/aliases b/tests/integration/targets/vpc_offering/aliases new file mode 100644 index 00000000..1d747ed2 --- /dev/null +++ b/tests/integration/targets/vpc_offering/aliases @@ -0,0 +1,3 @@ +cloud/cs +cs/group2 +cs/group3 diff --git a/tests/integration/targets/vpc_offering/meta/main.yml b/tests/integration/targets/vpc_offering/meta/main.yml new file mode 100644 index 00000000..e9a5b9ee --- /dev/null +++ b/tests/integration/targets/vpc_offering/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - cs_common diff --git a/tests/integration/targets/vpc_offering/tasks/main.yml b/tests/integration/targets/vpc_offering/tasks/main.yml new file mode 100644 index 00000000..fec57b53 --- /dev/null +++ b/tests/integration/targets/vpc_offering/tasks/main.yml @@ -0,0 +1,448 @@ +--- +- name: setup + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify setup + assert: + that: + - vpcoffer is successful + +- name: test fail if missing name + ngine_io.cloudstack.vpc_offering: + register: vpcoffer + ignore_errors: true +- name: verify results of fail if missing name + assert: + that: + - vpcoffer is failed + - 'vpcoffer.msg == "missing required arguments: name"' + +- name: test fail if missing params + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + register: vpcoffer + ignore_errors: true +- name: verify results of fail if missing params + assert: + that: + - vpcoffer is failed + - 'vpcoffer.msg == "missing required arguments: display_text, supported_services"' + +- name: test create vpc offer in check mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + register: vpcoffer + check_mode: yes +- name: verify results of vpc offer in check mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: test create vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + register: vpcoffer +- name: verify results of vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + - vpcoffer.distributed == false + - vpcoffer.region_level == false + +- name: test create vpc offer idempotence + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + register: vpcoffer +- name: verify results of create vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + - vpcoffer.distributed == false + - vpcoffer.region_level == false + +- name: test enabling existing vpc offer in check_mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: enabled + register: vpcoffer + check_mode: yes +- name: verify results of enabling existing vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test enabling existing vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: enabled + register: vpcoffer +- name: verify results of enabling existing vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test enabling existing vpc offer idempotence + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: enabled + register: vpcoffer +- name: verify results of enabling existing vpc idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test disabling vpc offer in check_mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: disabled + register: vpcoffer + check_mode: yes +- name: verify results of disabling vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test disabling vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: disabled + register: vpcoffer +- name: verify results of disabling vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test disabling vpc offer idempotence + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: disabled + register: vpcoffer +- name: verify results of disabling vpc idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test rename vpc offer in check_mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description renamed" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: disabled + register: vpcoffer + check_mode: yes +- name: verify results of rename vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test rename vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description renamed" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: disabled + register: vpcoffer +- name: verify results of rename vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description renamed" + +- name: test rename vpc offer idempotence + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description renamed" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: disabled + register: vpcoffer +- name: verify results of rename vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description renamed" + +- name: test update offer with minimal params in check_mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description update" + register: vpcoffer + check_mode: yes +- name: verify results of update offer with minimal params in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description renamed" + +- name: test update offer with minimal params + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description update" + register: vpcoffer +- name: verify results of update offer with minimal params + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description update" + +- name: test update offer with minimal params idempotency + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description update" + register: vpcoffer +- name: verify results of update offer with minimal params idempotency + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description update" + +- name: test remove vpc offer in check_mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer + check_mode: yes +- name: verify results of rename vpc offer in check_mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Disabled" + - vpcoffer.display_text == "vpc offering description update" + +- name: test remove vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify results of rename vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: test remove vpc offer idempotence + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify results of rename vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + +- name: test create enabled vpc offer in check mode + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: enabled + register: vpcoffer + check_mode: yes +- name: verify results of create enabled vpc offer in check mode + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: test create enabled vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: enabled + register: vpcoffer +- name: verify results of create enabled vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test create enabled vpc offer idempotence + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: enabled + register: vpcoffer +- name: verify results of create enabled vpc offer idempotence + assert: + that: + - vpcoffer is successful + - vpcoffer is not changed + - vpcoffer.name == cs_resource_prefix + "_vpc" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + +- name: test create enabled region level vpc offer with distrubuted router + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc_drl" + display_text: "vpc offering description" + supported_services: + [Dns, PortForwarding, Dhcp, SourceNat, UserData, StaticNat, Vpn, Lb] + service_providers: + - { service: "dns", provider: "virtualrouter" } + - { service: "dhcp", provider: "virtualrouter" } + state: enabled + service_capabilities: + - { + service: "Connectivity", + capabilitytype: "DistributedRouter", + capabilityvalue: true, + } + - { + service: "Connectivity", + capabilitytype: "RegionLevelVPC", + capabilityvalue: true, + } + register: vpcoffer +- name: verify results of create enabled region level vpc offer with distrubuted router + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + - vpcoffer.name == cs_resource_prefix + "_vpc_drl" + - vpcoffer.state == "Enabled" + - vpcoffer.display_text == "vpc offering description" + - vpcoffer.distributed == true + - vpcoffer.region_level == true + +- name: remove vpc offer + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc" + state: absent + register: vpcoffer +- name: verify results of remove vpc offer + assert: + that: + - vpcoffer is successful + - vpcoffer is changed + +- name: remove region level vpc offer with distrubuted router + ngine_io.cloudstack.vpc_offering: + name: "{{ cs_resource_prefix }}_vpc_drl" + state: absent + register: vpcoffer +- name: verify results of remove region level vpc offer with distrubuted router + assert: + that: + - vpcoffer is successful + - vpcoffer is changed