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
This commit is contained in:
parent
439e64256f
commit
2db9878c76
2 changed files with 172 additions and 223 deletions
|
@ -1,22 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Copyright: (c) 2017, David Passante (@dpassante)
|
# Copyright (c) 2017, David Passante (@dpassante)
|
||||||
#
|
# Copyright (c) 2017, René Moser <mail@renemoser.net>
|
||||||
# This file is part of Ansible
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
|
@ -25,159 +12,112 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: cs_network_offering
|
module: cs_network_offering
|
||||||
|
|
||||||
short_description: Manages network offerings on Apache CloudStack based clouds.
|
short_description: Manages network offerings on Apache CloudStack based clouds.
|
||||||
|
|
||||||
description:
|
description:
|
||||||
- Create, update, enable, disable and remove network offerings.
|
- Create, update, enable, disable and remove network offerings.
|
||||||
|
|
||||||
version_added: '2.5'
|
version_added: '2.5'
|
||||||
|
|
||||||
author: "David Passante (@dpassante)"
|
author: "David Passante (@dpassante)"
|
||||||
|
|
||||||
options:
|
options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the network offering.
|
- State of the network offering.
|
||||||
choices: ['enabled', 'present', 'disabled', 'absent']
|
choices: [ enabled, present, disabled, absent]
|
||||||
required: false
|
|
||||||
default: present
|
default: present
|
||||||
display_text:
|
display_text:
|
||||||
description:
|
description:
|
||||||
- Display text of the network offerings
|
- Display text of the network offerings.
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
guest_ip_type:
|
guest_ip_type:
|
||||||
description:
|
description:
|
||||||
- Guest type of the network offering. Shared or Isolated
|
- Guest type of the network offering.
|
||||||
choices: ['Shared', 'Isolated']
|
choices: [ Shared, Isolated ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- The name of the network offering
|
- The name of the network offering.
|
||||||
required: true
|
required: true
|
||||||
default: null
|
|
||||||
supported_services:
|
supported_services:
|
||||||
description:
|
description:
|
||||||
- Services supported by the network offering
|
- Services supported by the network offering.
|
||||||
required: false
|
- One or more of the choices.
|
||||||
default: null
|
choices: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
|
aliases: [ supported_service ]
|
||||||
traffic_type:
|
traffic_type:
|
||||||
description:
|
description:
|
||||||
- The traffic type for the network offering.
|
- The traffic type for the network offering.
|
||||||
- Supported type in current release is GUEST only
|
default: Guest
|
||||||
required: false
|
|
||||||
default: GUEST
|
|
||||||
availability:
|
availability:
|
||||||
description:
|
description:
|
||||||
- The availability of network offering. Default value is Optional
|
- The availability of network offering. Default value is Optional
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
conserve_mode:
|
conserve_mode:
|
||||||
description:
|
description:
|
||||||
- true if the network offering is IP conserve mode enabled
|
- Whether the network offering has IP conserve mode enabled.
|
||||||
choices: ['true', 'false']
|
choices: [ yes, no ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
details:
|
details:
|
||||||
description:
|
description:
|
||||||
- Network offering details in key/value pairs.
|
- Network offering details in key/value pairs.
|
||||||
- Supported keys are internallbprovider/publiclbprovider
|
|
||||||
- with service provider as a value
|
- with service provider as a value
|
||||||
choices: ['internallbprovider', 'publiclbprovider']
|
choices: [ internallbprovider, publiclbprovider ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
egress_default_policy:
|
egress_default_policy:
|
||||||
description:
|
description:
|
||||||
- True if guest network default egress policy is allow.
|
- Whether the default egress policy is allow or to deny.
|
||||||
- false if default egress policy is deny
|
choices: [ allow, deny ]
|
||||||
choices: ['true', 'false']
|
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
persistent:
|
persistent:
|
||||||
description:
|
description:
|
||||||
- True if network offering supports persistent networks
|
- True if network offering supports persistent networks
|
||||||
- defaulted to false if not specified
|
- defaulted to false if not specified
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
keepalive_enabled:
|
keepalive_enabled:
|
||||||
description:
|
description:
|
||||||
- If true keepalive will be turned on in the loadbalancer.
|
- If true keepalive will be turned on in the loadbalancer.
|
||||||
- At the time of writing this has only an effect on haproxy;
|
- At the time of writing this has only an effect on haproxy.
|
||||||
- the mode http and httpclose options are unset in the haproxy conf file.
|
- the mode http and httpclose options are unset in the haproxy conf file.
|
||||||
choices: ['true', 'false']
|
choices: [ yes, no ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
max_connections:
|
max_connections:
|
||||||
description:
|
description:
|
||||||
- Maximum number of concurrent connections supported by the network offering
|
- Maximum number of concurrent connections supported by the network offering.
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
network_rate:
|
network_rate:
|
||||||
description:
|
description:
|
||||||
- Data transfer rate in megabits per second allowed
|
- Data transfer rate in megabits per second allowed.
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
service_capabilities:
|
service_capabilities:
|
||||||
description:
|
description:
|
||||||
- Desired service capabilities as part of network offering
|
- Desired service capabilities as part of network offering.
|
||||||
aliases: [ service_capability ]
|
aliases: [ service_capability ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
service_offering:
|
service_offering:
|
||||||
description:
|
description:
|
||||||
- The service offering name or ID used by virtual router provider
|
- The service offering name or ID used by virtual router provider.
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
service_provider_list:
|
service_provider_list:
|
||||||
description:
|
description:
|
||||||
- provider to service mapping
|
- Provider to service mapping.
|
||||||
- If not specified, the provider for the service
|
- If not specified, the provider for the service will be mapped to the default provider on the physical network.
|
||||||
- will be mapped to the default provider on the physical network
|
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
specify_ip_ranges:
|
specify_ip_ranges:
|
||||||
description:
|
description:
|
||||||
- true if network offering supports specifying ip ranges
|
- Wheter the network offering supports specifying IP ranges.
|
||||||
- defaulted to false if not specified
|
- Defaulted to C(no) by the API if not specified.
|
||||||
choices: ['true', 'false']
|
choices: [ yes, no ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
specify_vlan:
|
specify_vlan:
|
||||||
description:
|
description:
|
||||||
- true if network offering supports vlans
|
- Whether the network offering supports vlans or not.
|
||||||
choices: ['true', 'false']
|
choices: [ yes, no ]
|
||||||
required: false
|
|
||||||
default: null
|
|
||||||
extends_documentation_fragment: cloudstack
|
extends_documentation_fragment: cloudstack
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Create a network offering and enable it
|
- name: Create a network offering and enable it
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_network_offering
|
module: cs_network_offering
|
||||||
name: "my_network_offering"
|
name: my_network_offering
|
||||||
display_text: "network offering description"
|
display_text: network offering description
|
||||||
state: enabled
|
state: enabled
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
|
|
||||||
|
|
||||||
# Remove a network offering
|
- name: Remove a network offering
|
||||||
- local_action:
|
local_action:
|
||||||
module: cs_network_offering
|
module: cs_network_offering
|
||||||
name: "my_network_offering"
|
name: my_network_offering
|
||||||
display_text: "network offering description"
|
|
||||||
state: absent
|
state: absent
|
||||||
guest_ip_type: Isolated
|
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
|
||||||
service_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
@ -188,35 +128,65 @@ id:
|
||||||
type: string
|
type: string
|
||||||
sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f
|
sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f
|
||||||
name:
|
name:
|
||||||
description: The name of the network offering
|
description: The name of the network offering.
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: MyCustomNetworkOffering
|
sample: MyCustomNetworkOffering
|
||||||
display_text:
|
display_text:
|
||||||
description: The display text of the network offering
|
description: The display text of the network offering.
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: My network offering
|
sample: My network offering
|
||||||
state:
|
state:
|
||||||
description: The state of the network offering
|
description: The state of the network offering.
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: Enabled
|
sample: Enabled
|
||||||
guest_ip_type:
|
guest_ip_type:
|
||||||
description: Guest type of the network offering
|
description: Guest type of the network offering.
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: Isolated
|
sample: Isolated
|
||||||
availability:
|
availability:
|
||||||
description: The availability of network offering
|
description: The availability of network offering.
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: Optional
|
sample: Optional
|
||||||
service_offering:
|
service_offering_id:
|
||||||
description: The service offering name or ID
|
description: The service offering ID.
|
||||||
returned: success
|
returned: success
|
||||||
type: string
|
type: string
|
||||||
sample: c5f7a5fc-43f8-11e5-a151-feff819cdc9f
|
sample: c5f7a5fc-43f8-11e5-a151-feff819cdc9f
|
||||||
|
max_connections:
|
||||||
|
description: The maximum number of concurrents connections to be handled by LB.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
sample: 300
|
||||||
|
network_rate:
|
||||||
|
description: The network traffic transfer ate in Mbit/s.
|
||||||
|
returned: success
|
||||||
|
type: int
|
||||||
|
sample: 200
|
||||||
|
traffic_type:
|
||||||
|
description: The traffic type.
|
||||||
|
returned: success
|
||||||
|
type: string
|
||||||
|
sample: Guest
|
||||||
|
egress_default_policy:
|
||||||
|
description: Default egress policy.
|
||||||
|
returned: success
|
||||||
|
type: string
|
||||||
|
sample: allow
|
||||||
|
is_persistent:
|
||||||
|
description: Whether persistent networks are supported or not.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
sample: false
|
||||||
|
is_default:
|
||||||
|
description: Whether network offering is the default offering or not.
|
||||||
|
returned: success
|
||||||
|
type: bool
|
||||||
|
sample: false
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
@ -234,7 +204,12 @@ class AnsibleCloudStackNetworkOffering(AnsibleCloudStack):
|
||||||
self.returns = {
|
self.returns = {
|
||||||
'guestiptype': 'guest_ip_type',
|
'guestiptype': 'guest_ip_type',
|
||||||
'availability': 'availability',
|
'availability': 'availability',
|
||||||
'serviceofferingid': 'service_offering',
|
'serviceofferingid': 'service_offering_id',
|
||||||
|
'networkrate': 'network_rate',
|
||||||
|
'maxconnections': 'max_connections',
|
||||||
|
'traffictype': 'traffic_type',
|
||||||
|
'isdefault': 'is_default',
|
||||||
|
'ispersistent': 'is_persistent',
|
||||||
}
|
}
|
||||||
self.network_offering = None
|
self.network_offering = None
|
||||||
|
|
||||||
|
@ -290,14 +265,14 @@ class AnsibleCloudStackNetworkOffering(AnsibleCloudStack):
|
||||||
'availability': self.module.params.get('availability'),
|
'availability': self.module.params.get('availability'),
|
||||||
'conservemode': self.module.params.get('conserve_mode'),
|
'conservemode': self.module.params.get('conserve_mode'),
|
||||||
'details': self.module.params.get('details'),
|
'details': self.module.params.get('details'),
|
||||||
'egressdefaultpolicy': self.module.params.get('egress_default_policy'),
|
'egressdefaultpolicy': self.module.params.get('egress_default_policy') == 'allow',
|
||||||
'ispersistent': self.module.params.get('persistent'),
|
'ispersistent': self.module.params.get('persistent'),
|
||||||
'keepaliveenabled': self.module.params.get('keepalive_enabled'),
|
'keepaliveenabled': self.module.params.get('keepalive_enabled'),
|
||||||
'maxconnections': self.module.params.get('max_connections'),
|
'maxconnections': self.module.params.get('max_connections'),
|
||||||
'networkrate': self.module.params.get('network_rate'),
|
'networkrate': self.module.params.get('network_rate'),
|
||||||
'servicecapabilitylist': self.module.params.get('service_capabilities'),
|
'servicecapabilitylist': self.module.params.get('service_capabilities'),
|
||||||
'serviceofferingid': self.get_service_offering_id(),
|
'serviceofferingid': self.get_service_offering_id(),
|
||||||
'serviceproviderlist': self.module.params.get('service_provider_list'),
|
'serviceproviderlist': self.module.params.get('service_providers'),
|
||||||
'specifyipranges': self.module.params.get('specify_ip_ranges'),
|
'specifyipranges': self.module.params.get('specify_ip_ranges'),
|
||||||
'specifyvlan': self.module.params.get('specify_vlan'),
|
'specifyvlan': self.module.params.get('specify_vlan'),
|
||||||
}
|
}
|
||||||
|
@ -306,7 +281,7 @@ class AnsibleCloudStackNetworkOffering(AnsibleCloudStack):
|
||||||
'display_text',
|
'display_text',
|
||||||
'guest_ip_type',
|
'guest_ip_type',
|
||||||
'supported_services',
|
'supported_services',
|
||||||
'service_provider_list',
|
'service_providers',
|
||||||
]
|
]
|
||||||
|
|
||||||
self.module.fail_on_missing_params(required_params=required_params)
|
self.module.fail_on_missing_params(required_params=required_params)
|
||||||
|
@ -320,13 +295,10 @@ class AnsibleCloudStackNetworkOffering(AnsibleCloudStack):
|
||||||
def delete_network_offering(self):
|
def delete_network_offering(self):
|
||||||
network_offering = self.get_network_offering()
|
network_offering = self.get_network_offering()
|
||||||
|
|
||||||
if not network_offering:
|
if network_offering:
|
||||||
return network_offering
|
self.result['changed'] = True
|
||||||
|
if not self.module.check_mode:
|
||||||
self.result['changed'] = True
|
self.query_api('deleteNetworkOffering', id=network_offering['id'])
|
||||||
|
|
||||||
if not self.module.check_mode:
|
|
||||||
res = self.query_api('deleteNetworkOffering', id=network_offering['id'])
|
|
||||||
|
|
||||||
return network_offering
|
return network_offering
|
||||||
|
|
||||||
|
@ -340,9 +312,10 @@ class AnsibleCloudStackNetworkOffering(AnsibleCloudStack):
|
||||||
'displaytext': self.module.params.get('display_text'),
|
'displaytext': self.module.params.get('display_text'),
|
||||||
'name': self.module.params.get('name'),
|
'name': self.module.params.get('name'),
|
||||||
'availability': self.module.params.get('availability'),
|
'availability': self.module.params.get('availability'),
|
||||||
|
'maxconnections': self.module.params.get('max_connections'),
|
||||||
}
|
}
|
||||||
|
|
||||||
if args['state'] == 'enabled' or args['state'] == 'disabled':
|
if args['state'] in ['enabled', 'disabled']:
|
||||||
args['state'] = args['state'].title()
|
args['state'] = args['state'].title()
|
||||||
else:
|
else:
|
||||||
del args['state']
|
del args['state']
|
||||||
|
@ -356,6 +329,12 @@ class AnsibleCloudStackNetworkOffering(AnsibleCloudStack):
|
||||||
|
|
||||||
return network_offering
|
return network_offering
|
||||||
|
|
||||||
|
def get_result(self, network_offering):
|
||||||
|
super(AnsibleCloudStackNetworkOffering, self).get_result(network_offering)
|
||||||
|
if network_offering:
|
||||||
|
self.result['egress_default_policy'] = 'allow' if network_offering.get('egressdefaultpolicy') else 'deny'
|
||||||
|
return self.result
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = cs_argument_spec()
|
argument_spec = cs_argument_spec()
|
||||||
|
@ -364,19 +343,19 @@ def main():
|
||||||
display_text=dict(),
|
display_text=dict(),
|
||||||
guest_ip_type=dict(choices=['Shared', 'Isolated']),
|
guest_ip_type=dict(choices=['Shared', 'Isolated']),
|
||||||
name=dict(required=True),
|
name=dict(required=True),
|
||||||
supported_services=dict(),
|
supported_services=dict(type='list', aliases=['supported_service']),
|
||||||
traffic_type=dict(default='GUEST'),
|
traffic_type=dict(default='Guest'),
|
||||||
availability=dict(),
|
availability=dict(),
|
||||||
conserve_mode=dict(type='bool'),
|
conserve_mode=dict(type='bool'),
|
||||||
details=dict(type='list'),
|
details=dict(type='list'),
|
||||||
egress_default_policy=dict(type='bool'),
|
egress_default_policy=dict(choices=['allow', 'deny']),
|
||||||
persistent=dict(type='bool'),
|
persistent=dict(type='bool'),
|
||||||
keepalive_enabled=dict(type='bool'),
|
keepalive_enabled=dict(type='bool'),
|
||||||
max_connections=dict(type='int'),
|
max_connections=dict(type='int'),
|
||||||
network_rate=dict(type='int'),
|
network_rate=dict(type='int'),
|
||||||
service_capabilities=dict(type='list', aliases=['service_capability']),
|
service_capabilities=dict(type='list', aliases=['service_capability']),
|
||||||
service_offering=dict(),
|
service_offering=dict(),
|
||||||
service_provider_list=dict(type='list'),
|
service_providers=dict(type='list', aliases=['service_provider']),
|
||||||
specify_ip_ranges=dict(type='bool'),
|
specify_ip_ranges=dict(type='bool'),
|
||||||
specify_vlan=dict(type='bool'),
|
specify_vlan=dict(type='bool'),
|
||||||
))
|
))
|
||||||
|
@ -399,5 +378,6 @@ def main():
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
- name: setup
|
- name: setup
|
||||||
cs_network_offering: name={{ cs_resource_prefix }}_name state=absent
|
cs_network_offering:
|
||||||
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
|
state: absent
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify setup
|
- name: verify setup
|
||||||
assert:
|
assert:
|
||||||
|
@ -26,17 +28,18 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- netoffer is failed
|
- netoffer is failed
|
||||||
- 'netoffer.msg == "missing required arguments: display_text, guest_ip_type, supported_services, service_provider_list"'
|
- 'netoffer.msg == "missing required arguments: display_text, guest_ip_type, supported_services, service_providers"'
|
||||||
|
|
||||||
- name: test create network offer in check mode
|
- name: test create network offer in check mode
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
max_connections: 300
|
||||||
service_provider_list:
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
service_providers:
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
- name: verify results of network offer in check mode
|
- name: verify results of network offer in check mode
|
||||||
|
@ -50,10 +53,11 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
max_connections: 300
|
||||||
service_provider_list:
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
service_providers:
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of network offer
|
- name: verify results of network offer
|
||||||
assert:
|
assert:
|
||||||
|
@ -70,10 +74,11 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
max_connections: 300
|
||||||
service_provider_list:
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
service_providers:
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of create network offer idempotence
|
- name: verify results of create network offer idempotence
|
||||||
assert:
|
assert:
|
||||||
|
@ -85,19 +90,13 @@
|
||||||
- netoffer.state == "Disabled"
|
- netoffer.state == "Disabled"
|
||||||
- netoffer.display_text == "network offering description"
|
- netoffer.display_text == "network offering description"
|
||||||
|
|
||||||
- name: test enabling network offer in check_mode
|
- name: test enabling existing network offer in check_mode
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: enabled
|
state: enabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
- name: verify results of enabling network offer in check_mode
|
- name: verify results of enabling existing network offer in check_mode
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- netoffer is successful
|
- netoffer is successful
|
||||||
|
@ -107,18 +106,12 @@
|
||||||
- netoffer.state == "Disabled"
|
- netoffer.state == "Disabled"
|
||||||
- netoffer.display_text == "network offering description"
|
- netoffer.display_text == "network offering description"
|
||||||
|
|
||||||
- name: test enabling network offer
|
- name: test enabling existing network offer
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: enabled
|
state: enabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of enabling network offer
|
- name: verify results of enabling existing network offer
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- netoffer is successful
|
- netoffer is successful
|
||||||
|
@ -128,18 +121,12 @@
|
||||||
- netoffer.state == "Enabled"
|
- netoffer.state == "Enabled"
|
||||||
- netoffer.display_text == "network offering description"
|
- netoffer.display_text == "network offering description"
|
||||||
|
|
||||||
- name: test enabling network offer idempotence
|
- name: test enabling existing network offer idempotence
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: enabled
|
state: enabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of enabling network idempotence
|
- name: verify results of enabling existing network idempotence
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- netoffer is successful
|
- netoffer is successful
|
||||||
|
@ -154,10 +141,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: disabled
|
state: disabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
@ -176,10 +163,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: disabled
|
state: disabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of disabling network offer
|
- name: verify results of disabling network offer
|
||||||
|
@ -197,10 +184,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: disabled
|
state: disabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of disabling network idempotence
|
- name: verify results of disabling network idempotence
|
||||||
|
@ -218,10 +205,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description renamed"
|
display_text: "network offering description renamed"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: disabled
|
state: disabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
@ -240,10 +227,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description renamed"
|
display_text: "network offering description renamed"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: disabled
|
state: disabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of rename network offer
|
- name: verify results of rename network offer
|
||||||
|
@ -261,10 +248,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description renamed"
|
display_text: "network offering description renamed"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: disabled
|
state: disabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of rename network offer idempotence
|
- name: verify results of rename network offer idempotence
|
||||||
|
@ -281,6 +268,7 @@
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description update"
|
display_text: "network offering description update"
|
||||||
|
max_connections: 400
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
- name: verify results of update offer with minimal params in check_mode
|
- name: verify results of update offer with minimal params in check_mode
|
||||||
|
@ -292,11 +280,13 @@
|
||||||
- netoffer.guest_ip_type == "Isolated"
|
- netoffer.guest_ip_type == "Isolated"
|
||||||
- netoffer.state == "Disabled"
|
- netoffer.state == "Disabled"
|
||||||
- netoffer.display_text == "network offering description renamed"
|
- netoffer.display_text == "network offering description renamed"
|
||||||
|
- netoffer.max_connections == 300
|
||||||
|
|
||||||
- name: test update offer with minimal params
|
- name: test update offer with minimal params
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description update"
|
display_text: "network offering description update"
|
||||||
|
max_connections: 400
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of update offer with minimal params
|
- name: verify results of update offer with minimal params
|
||||||
assert:
|
assert:
|
||||||
|
@ -307,11 +297,13 @@
|
||||||
- netoffer.guest_ip_type == "Isolated"
|
- netoffer.guest_ip_type == "Isolated"
|
||||||
- netoffer.state == "Disabled"
|
- netoffer.state == "Disabled"
|
||||||
- netoffer.display_text == "network offering description update"
|
- netoffer.display_text == "network offering description update"
|
||||||
|
- netoffer.max_connections == 400
|
||||||
|
|
||||||
- name: test update offer with minimal params idempotency
|
- name: test update offer with minimal params idempotency
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description update"
|
display_text: "network offering description update"
|
||||||
|
max_connections: 400
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of update offer with minimal params idempotency
|
- name: verify results of update offer with minimal params idempotency
|
||||||
assert:
|
assert:
|
||||||
|
@ -322,16 +314,11 @@
|
||||||
- netoffer.guest_ip_type == "Isolated"
|
- netoffer.guest_ip_type == "Isolated"
|
||||||
- netoffer.state == "Disabled"
|
- netoffer.state == "Disabled"
|
||||||
- netoffer.display_text == "network offering description update"
|
- netoffer.display_text == "network offering description update"
|
||||||
|
- netoffer.max_connections == 400
|
||||||
|
|
||||||
- name: test remove network offer in check_mode
|
- name: test remove network offer in check_mode
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: absent
|
state: absent
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
@ -348,12 +335,6 @@
|
||||||
- name: test remove network offer
|
- name: test remove network offer
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: absent
|
state: absent
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of rename network offer
|
- name: verify results of rename network offer
|
||||||
|
@ -369,12 +350,6 @@
|
||||||
- name: test remove network offer idempotence
|
- name: test remove network offer idempotence
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: absent
|
state: absent
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of rename network offer idempotence
|
- name: verify results of rename network offer idempotence
|
||||||
|
@ -388,10 +363,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: enabled
|
state: enabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
@ -406,10 +381,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: enabled
|
state: enabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of create enabled network offer
|
- name: verify results of create enabled network offer
|
||||||
|
@ -427,10 +402,10 @@
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
name: "{{ cs_resource_prefix }}_name"
|
||||||
display_text: "network offering description"
|
display_text: "network offering description"
|
||||||
guest_ip_type: Isolated
|
guest_ip_type: Isolated
|
||||||
supported_services: Dns,PortForwarding,Dhcp,SourceNat,UserData,Firewall,StaticNat,Vpn,Lb
|
supported_services: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
|
||||||
service_provider_list:
|
service_providers:
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
- { service: 'dns', provider: 'virtualrouter' }
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
- { service: 'dhcp', provider: 'virtualrouter' }
|
||||||
state: enabled
|
state: enabled
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of create enabled network offer idempotence
|
- name: verify results of create enabled network offer idempotence
|
||||||
|
@ -446,12 +421,6 @@
|
||||||
- name: remove network offer
|
- name: remove network offer
|
||||||
cs_network_offering:
|
cs_network_offering:
|
||||||
name: "{{ cs_resource_prefix }}_name"
|
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_provider_list:
|
|
||||||
- {service: 'dns', provider: 'virtualrouter'}
|
|
||||||
- {service: 'dhcp', provider: 'virtualrouter'}
|
|
||||||
state: absent
|
state: absent
|
||||||
register: netoffer
|
register: netoffer
|
||||||
- name: verify results of remove network offer
|
- name: verify results of remove network offer
|
||||||
|
|
Loading…
Reference in a new issue