Skip to content

Commit

Permalink
Cloudstack: fix support for some VPC service capabilities (ansible#45727
Browse files Browse the repository at this point in the history
)

* Fix support for VPC capabilities such as redundant routers or region level VPC

* Add integration test cases for "region level VPC" and "distributed router" capabilities
  • Loading branch information
dpassante authored and resmo committed Sep 17, 2018
1 parent 78e9f45 commit 05328eb
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
33 changes: 31 additions & 2 deletions lib/ansible/modules/cloud/cloudstack/cs_vpc_offering.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,36 @@
state: enabled
supported_services: [ Dns, Dhcp ]
service_providers:
- {service: 'dns', provider: 'virtualrouter'}
- {service: 'dhcp', provider: 'virtualrouter'}
- {service: 'dns', provider: 'VpcVirtualRouter'}
- {service: 'dhcp', provider: 'VpcVirtualRouter'}
# Create a vpc offering with redundant router
- local_action:
module: cs_vpc_offering
name: "my_vpc_offering"
display_text: "vpc offering description"
supported_services: [ Dns, Dhcp, SourceNat ]
service_providers:
- {service: 'dns', provider: 'VpcVirtualRouter'}
- {service: 'dhcp', provider: 'VpcVirtualRouter'}
- {service: 'SourceNat', provider: 'VpcVirtualRouter'}
service_capabilities:
- {service: 'SourceNat', capabilitytype: 'RedundantRouter', capabilityvalue: true}
# Create a region level vpc offering with distributed router
- local_action:
module: cs_vpc_offering
name: "my_vpc_offering"
display_text: "vpc offering description"
state: present
supported_services: [ Dns, Dhcp, SourceNat ]
service_providers:
- {service: 'dns', provider: 'VpcVirtualRouter'}
- {service: 'dhcp', provider: 'VpcVirtualRouter'}
- {service: 'SourceNat', provider: 'VpcVirtualRouter'}
service_capabilities:
- {service: 'Connectivity', capabilitytype: 'DistributedRouter', capabilityvalue: true}
- {service: 'Connectivity', capabilitytype: 'RegionLevelVPC', capabilityvalue: true}
# Remove a vpc offering
- local_action:
Expand Down Expand Up @@ -189,6 +217,7 @@ def create_vpc_offering(self):
'supportedservices': self.module.params.get('supported_services'),
'serviceproviderlist': self.module.params.get('service_providers'),
'serviceofferingid': self.get_service_offering_id(),
'servicecapabilitylist': self.module.params.get('service_capabilities'),
}

required_params = [
Expand Down
35 changes: 35 additions & 0 deletions test/integration/targets/cs_vpc_offering/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,30 @@
- vpcoffer.state == "Enabled"
- vpcoffer.display_text == "vpc offering description"

- name: test create enabled region level vpc offer with distrubuted router
cs_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
cs_vpc_offering:
name: "{{ cs_resource_prefix }}_vpc"
Expand All @@ -390,3 +414,14 @@
that:
- vpcoffer is successful
- vpcoffer is changed

- name: remove region level vpc offer with distrubuted router
cs_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

0 comments on commit 05328eb

Please sign in to comment.