Inlined network_external variable

Change-Id: I4cbbd84eaed99dae40c72fbdf567b480a1f268a4
This commit is contained in:
Jakob Meng 2023-01-11 15:48:21 +01:00
parent eaa26c6b9c
commit 5aaa41c9c4
7 changed files with 9 additions and 44 deletions

View File

@ -28,7 +28,6 @@ expected_fields:
- updated_at
dns_domain: example.opendev.org
mtu: 1250
network_external: false
network_name: shade_network
network_name_newparams: newparams_network
network_name_updates: update_network

View File

@ -5,7 +5,7 @@
name: "{{ network_name }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
register: infonet
- name: Check output of creating network
@ -58,7 +58,7 @@
- "'is_shared' in result.networks.0"
- result.networks.0['is_shared']|lower == network_shared|lower
- "'is_router_external' in result.networks.0"
- result.networks[0]['is_router_external'] == {{ network_external }}
- not (result.networks[0]['is_router_external'] | bool)
- name: Create network - with new SDK params
openstack.cloud.network:
@ -66,7 +66,7 @@
name: "{{ network_name_newparams }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
register: result_create_nw_with_new_params
@ -112,7 +112,7 @@
name: "{{ network_name_updates }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
register: result_create_nw_for_updates
@ -123,7 +123,7 @@
name: "{{ network_name_updates }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
mtu: "{{ mtu }}"
port_security_enabled: "{{ port_security_enabled }}"
# You cannot update this property.
@ -142,7 +142,7 @@
name: "{{ network_name_updates }}"
state: present
shared: "{{ network_shared }}"
external: "{{ network_external }}"
external: false
# NOTE: This property should be updated
mtu: "{{ mtu - 50 }}"
# NOTE: This property should be updated

View File

@ -16,7 +16,7 @@
state: present
project: "{{ source_project.project.id }}"
shared: false
external: "{{ network_external }}"
external: true
register: network
- name: Create target project

View File

@ -39,7 +39,6 @@ expected_fields:
- tenant_id
- trunk_details
- updated_at
network_external: true
network_name: ansible_port_network
no_security_groups: True
port_name: ansible_port

View File

@ -4,7 +4,7 @@
cloud: "{{ cloud }}"
state: present
name: "{{ network_name }}"
external: "{{ network_external }}"
external: true
register: network
- name: Create subnet

View File

@ -19,7 +19,6 @@ expected_fields:
- updated_at
network_name: ansible_net
external_network_name: ansible_external_net
network_external: true
router_name: ansible_router
test_subnets:
- cloud: "{{ cloud }}"

View File

@ -331,9 +331,7 @@
cloud: "{{ cloud }}"
state: present
name: "{{ external_network_name }}"
external: "{{ network_external }}"
when:
- network_external
external: true
- name: Create subnet5
openstack.cloud.subnet:
@ -342,8 +340,6 @@
network_name: "{{ external_network_name }}"
name: shade_subnet5
cidr: 10.6.6.0/24
when:
- network_external
- name: Update router (add external gateway)
openstack.cloud.router:
@ -353,8 +349,6 @@
network: "{{ external_network_name }}"
interfaces:
- shade_subnet1
when:
- network_external
- name: Gather routers info
openstack.cloud.routers_info:
@ -392,8 +386,6 @@
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.100
when:
- network_external
- name: Gather routers info
openstack.cloud.routers_info:
@ -409,8 +401,6 @@
- info.routers.0.name == router_name
- (info.routers.0.external_gateway_info.external_fixed_ips|length) == 1
- info.routers.0.external_gateway_info.external_fixed_ips.0.ip_address == "10.6.6.100"
when:
- network_external
- name: Update router (add external fixed ips)
openstack.cloud.router:
@ -426,8 +416,6 @@
ip: 10.6.6.100
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
- name: Update router (add external fixed ips) again
openstack.cloud.router:
@ -442,8 +430,6 @@
ip: 10.6.6.100
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
register: router
- name: Assert idempotent module
@ -465,8 +451,6 @@
- (info.routers.0.external_gateway_info.external_fixed_ips|length) == 2
- info.routers.0.external_gateway_info.external_fixed_ips|map(attribute='ip_address')|sort|list ==
["10.6.6.100", "10.6.6.101"]
when:
- network_external
- name: Update router (remove external fixed ips)
openstack.cloud.router:
@ -479,8 +463,6 @@
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
- name: Update router (remove external fixed ips) again
openstack.cloud.router:
@ -493,8 +475,6 @@
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
register: router
- name: Assert idempotent module
@ -515,8 +495,6 @@
- info.routers.0.name == router_name
- (info.routers.0.external_gateway_info.external_fixed_ips|length) == 1
- info.routers.0.external_gateway_info.external_fixed_ips.0.ip_address == "10.6.6.101"
when:
- network_external
- name: Update router (disable external snat)
openstack.cloud.router:
@ -530,8 +508,6 @@
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
- name: Gather routers info
openstack.cloud.routers_info:
@ -546,8 +522,6 @@
that:
- info.routers.0.name == router_name
- not info.routers.0.external_gateway_info.enable_snat
when:
- network_external
- name: Update router (disable external snat) again
openstack.cloud.router:
@ -561,8 +535,6 @@
external_fixed_ips:
- subnet: shade_subnet5
ip: 10.6.6.101
when:
- network_external
register: router
- name: Assert idempotent module
@ -727,8 +699,6 @@
cloud: "{{ cloud }}"
state: absent
name: shade_subnet5
when:
- network_external
- name: Delete subnets 1-4
openstack.cloud.subnet:
@ -748,7 +718,5 @@
cloud: "{{ cloud }}"
state: absent
name: "{{ external_network_name }}"
when:
- network_external
- include_tasks: shared_network.yml