mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-07-25 01:04:28 +00:00
Merge "Add ability to set tags in network modules"
This commit is contained in:
@@ -69,6 +69,9 @@
|
||||
external: false
|
||||
mtu: "{{ mtu }}"
|
||||
port_security_enabled: "{{ port_security_enabled }}"
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
register: result_create_nw_with_new_params
|
||||
ignore_errors: true
|
||||
|
||||
@@ -85,6 +88,8 @@
|
||||
- result_newparams.networks.0.mtu == mtu
|
||||
- "'is_port_security_enabled' in result_newparams.networks.0"
|
||||
- result_newparams.networks.0['is_port_security_enabled'] == port_security_enabled
|
||||
- "'foo' in result_newparams.networks.0.tags"
|
||||
- "'bar' in result_newparams.networks.0.tags"
|
||||
|
||||
- name: Delete network - generic and with new SDK params
|
||||
openstack.cloud.network:
|
||||
@@ -115,6 +120,9 @@
|
||||
external: false
|
||||
mtu: "{{ mtu }}"
|
||||
port_security_enabled: "{{ port_security_enabled }}"
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
register: result_create_nw_for_updates
|
||||
|
||||
- name: Update network - update failure
|
||||
@@ -147,6 +155,11 @@
|
||||
mtu: "{{ mtu - 50 }}"
|
||||
# NOTE: This property should be updated
|
||||
port_security_enabled: "{{ not port_security_enabled }}"
|
||||
# NOTE: This property should be updated
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
- baz
|
||||
register: result_nw_update_success
|
||||
|
||||
- name: Gather networks info - updates
|
||||
@@ -162,6 +175,29 @@
|
||||
- result_network_updates_info.networks.0.name == network_name_updates
|
||||
- result_network_updates_info.networks.0.mtu == mtu - 50
|
||||
- result_network_updates_info.networks.0['is_port_security_enabled'] == (not port_security_enabled)
|
||||
- "'foo' in result_network_updates_info.networks.0.tags"
|
||||
- "'bar' in result_network_updates_info.networks.0.tags"
|
||||
- "'baz' in result_network_updates_info.networks.0.tags"
|
||||
|
||||
- name: Update network - no change
|
||||
openstack.cloud.network:
|
||||
cloud: "{{ cloud }}"
|
||||
name: "{{ network_name_updates }}"
|
||||
state: present
|
||||
shared: "{{ network_shared }}"
|
||||
external: false
|
||||
mtu: "{{ mtu - 50 }}"
|
||||
port_security_enabled: "{{ not port_security_enabled }}"
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
- baz
|
||||
register: result_nw_update_no_change
|
||||
|
||||
- name: Verify networks info - no change
|
||||
assert:
|
||||
that:
|
||||
- result_nw_update_no_change is not changed
|
||||
|
||||
- name: Delete network - updates
|
||||
openstack.cloud.network:
|
||||
|
||||
@@ -325,6 +325,43 @@
|
||||
- ports.ports|rejectattr('device_owner', 'equalto', 'network:router_gateway')|sum(attribute='fixed_ips', start=[])|map(attribute='ip_address')|sort|list ==
|
||||
['10.7.7.1']
|
||||
|
||||
- name: Update router (add tags)
|
||||
openstack.cloud.router:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ router_name }}"
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
|
||||
- name: Gather routers info
|
||||
openstack.cloud.routers_info:
|
||||
cloud: "{{ cloud }}"
|
||||
name: "{{ router_name }}"
|
||||
register: info
|
||||
|
||||
- name: Verify tags
|
||||
assert:
|
||||
that:
|
||||
- info.routers.0.name == router_name
|
||||
- info.routers.0.id == router.router.id
|
||||
- "'foo' in info.routers.0.tags"
|
||||
- "'bar' in info.routers.0.tags"
|
||||
|
||||
- name: Update router (add tags) again
|
||||
openstack.cloud.router:
|
||||
cloud: "{{ cloud }}"
|
||||
state: present
|
||||
name: "{{ router_name }}"
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
register: router
|
||||
|
||||
- name: Assert idempotent module
|
||||
assert:
|
||||
that: router is not changed
|
||||
|
||||
# Admin operation
|
||||
- name: Create external network
|
||||
openstack.cloud.network:
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
gateway_ip: 192.168.0.1
|
||||
allocation_pool_start: 192.168.0.2
|
||||
allocation_pool_end: 192.168.0.254
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
register: subnet
|
||||
|
||||
- name: Assert changed
|
||||
@@ -66,6 +69,9 @@
|
||||
gateway_ip: 192.168.0.1
|
||||
allocation_pool_start: 192.168.0.2
|
||||
allocation_pool_end: 192.168.0.254
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
register: subnet
|
||||
|
||||
- name: Assert not changed
|
||||
@@ -90,6 +96,8 @@
|
||||
enable_dhcp: "{{ enable_subnet_dhcp }}"
|
||||
gateway_ip: 192.168.0.1
|
||||
cidr: 192.168.0.0/24
|
||||
tags:
|
||||
- bar
|
||||
register: subnet
|
||||
|
||||
- name: Verify Subnet info result
|
||||
@@ -124,6 +132,10 @@
|
||||
dns_nameservers:
|
||||
- 8.8.8.7
|
||||
cidr: 192.168.0.0/24
|
||||
tags:
|
||||
- foo
|
||||
- bar
|
||||
- baz
|
||||
register: subnet
|
||||
|
||||
- name: Assert changed
|
||||
|
||||
Reference in New Issue
Block a user