1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/cs_network_offering/tasks/main.yml
René Moser 2db9878c76
cloudstack: streamline cs_network_offering (#34553)
* cs_network_offering: streamline docs a bit

* cs_network_offering: format traffic type as returned by API

* cs_network_offering: rename return to service_offering_id

* cs_network_offering: ensure absent tests don't require anyting else than name

* cs_network_offering: beautify the default_egress_policy param

* cs_network_offering: test enabling/disabling with existing syntax

* cs_network_offering: rename service_provider_list to service_providers

* cs_network_offering: allow update max_connections

* cs_network_offering: extend returns

* cs_network_offering: extend tests with max_connections
2018-01-07 17:30:52 +01:00

434 lines
15 KiB
YAML

---
- name: setup
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: absent
register: netoffer
- name: verify setup
assert:
that:
- netoffer is successful
- name: test fail if missing name
action: cs_network_offering
register: netoffer
ignore_errors: true
- name: verify results of fail if missing name
assert:
that:
- netoffer is failed
- 'netoffer.msg == "missing required arguments: name"'
- name: test fail if missing params
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
register: netoffer
ignore_errors: true
- name: verify results of fail if missing params
assert:
that:
- netoffer is failed
- 'netoffer.msg == "missing required arguments: display_text, guest_ip_type, supported_services, service_providers"'
- name: test create network offer in check mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
max_connections: 300
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
register: netoffer
check_mode: yes
- name: verify results of network offer in check mode
assert:
that:
- netoffer is successful
- netoffer is changed
- name: test create network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
max_connections: 300
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
register: netoffer
- name: verify results of network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description"
- name: test create network offer idempotence
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
max_connections: 300
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
register: netoffer
- name: verify results of create network offer idempotence
assert:
that:
- netoffer is successful
- netoffer is not changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description"
- name: test enabling existing network offer in check_mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: enabled
register: netoffer
check_mode: yes
- name: verify results of enabling existing network offer in check_mode
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description"
- name: test enabling existing network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: enabled
register: netoffer
- name: verify results of enabling existing network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Enabled"
- netoffer.display_text == "network offering description"
- name: test enabling existing network offer idempotence
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: enabled
register: netoffer
- name: verify results of enabling existing network idempotence
assert:
that:
- netoffer is successful
- netoffer is not changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Enabled"
- netoffer.display_text == "network offering description"
- name: test disabling network offer in check_mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: disabled
register: netoffer
check_mode: yes
- name: verify results of disabling network offer in check_mode
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Enabled"
- netoffer.display_text == "network offering description"
- name: test disabling network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: disabled
register: netoffer
- name: verify results of disabling network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description"
- name: test disabling network offer idempotence
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: disabled
register: netoffer
- name: verify results of disabling network idempotence
assert:
that:
- netoffer is successful
- netoffer is not changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description"
- name: test rename network offer in check_mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description renamed"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: disabled
register: netoffer
check_mode: yes
- name: verify results of rename network offer in check_mode
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description"
- name: test rename network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description renamed"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: disabled
register: netoffer
- name: verify results of rename network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description renamed"
- name: test rename network offer idempotence
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description renamed"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: disabled
register: netoffer
- name: verify results of rename network offer idempotence
assert:
that:
- netoffer is successful
- netoffer is not changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description renamed"
- name: test update offer with minimal params in check_mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description update"
max_connections: 400
register: netoffer
check_mode: yes
- name: verify results of update offer with minimal params in check_mode
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description renamed"
- netoffer.max_connections == 300
- name: test update offer with minimal params
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description update"
max_connections: 400
register: netoffer
- name: verify results of update offer with minimal params
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description update"
- netoffer.max_connections == 400
- name: test update offer with minimal params idempotency
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description update"
max_connections: 400
register: netoffer
- name: verify results of update offer with minimal params idempotency
assert:
that:
- netoffer is successful
- netoffer is not changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description update"
- netoffer.max_connections == 400
- name: test remove network offer in check_mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: absent
register: netoffer
check_mode: yes
- name: verify results of rename network offer in check_mode
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description update"
- name: test remove network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: absent
register: netoffer
- name: verify results of rename network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Disabled"
- netoffer.display_text == "network offering description update"
- name: test remove network offer idempotence
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: absent
register: netoffer
- name: verify results of rename network offer idempotence
assert:
that:
- netoffer is successful
- netoffer is not changed
- name: test create enabled network offer in check mode
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: enabled
register: netoffer
check_mode: yes
- name: verify results of create enabled network offer in check mode
assert:
that:
- netoffer is successful
- netoffer is changed
- name: test create enabled network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: enabled
register: netoffer
- name: verify results of create enabled network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Enabled"
- netoffer.display_text == "network offering description"
- name: test create enabled network offer idempotence
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
display_text: "network offering description"
guest_ip_type: Isolated
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
service_providers:
- { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' }
state: enabled
register: netoffer
- name: verify results of create enabled network offer idempotence
assert:
that:
- netoffer is successful
- netoffer is not changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Enabled"
- netoffer.display_text == "network offering description"
- name: remove network offer
cs_network_offering:
name: "{{ cs_resource_prefix }}_name"
state: absent
register: netoffer
- name: verify results of remove network offer
assert:
that:
- netoffer is successful
- netoffer is changed
- netoffer.name == "{{ cs_resource_prefix }}_name"
- netoffer.guest_ip_type == "Isolated"
- netoffer.state == "Enabled"
- netoffer.display_text == "network offering description"