Update subnet module to be compatible with new sdk

Change-Id: Iba1604ee9c0b922b8fb7c6a278acf90d080a63e7
This commit is contained in:
Rafael Castillo
2022-06-08 17:09:02 -07:00
committed by Jakob Meng
parent 2419b5ab19
commit aa19d74cde
4 changed files with 450 additions and 255 deletions

View File

@@ -1,2 +1,26 @@
subnet_name: shade_subnet
enable_subnet_dhcp: false
expected_fields:
- allocation_pools
- cidr
- created_at
- description
- dns_nameservers
- gateway_ip
- host_routes
- id
- ip_version
- ipv6_address_mode
- ipv6_ra_mode
- is_dhcp_enabled
- name
- network_id
- prefix_length
- project_id
- revision_number
- segment_id
- service_types
- subnet_pool_id
- tags
- updated_at
- use_default_subnet_pool
subnet_name: shade_subnet

View File

@@ -1,4 +1,16 @@
---
- name: Delete subnet {{ subnet_name }} before test
openstack.cloud.subnet:
cloud: "{{ cloud }}"
name: "{{ subnet_name }}"
state: absent
- name: Delete network {{ network_name }} before test
openstack.cloud.network:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
state: absent
- name: Create network {{ network_name }}
openstack.cloud.network:
cloud: "{{ cloud }}"
@@ -19,6 +31,36 @@
gateway_ip: 192.168.0.1
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.254
register: subnet
- name: Assert changed
assert:
that: subnet is changed
- name: assert subnet fields
assert:
that: item in subnet.subnet
loop: "{{ expected_fields }}"
- name: Create subnet {{ subnet_name }} on network {{ network_name }} again
openstack.cloud.subnet:
cloud: "{{ cloud }}"
network_name: "{{ network_name }}"
name: "{{ subnet_name }}"
state: present
enable_dhcp: "{{ enable_subnet_dhcp }}"
dns_nameservers:
- 8.8.8.7
- 8.8.8.8
cidr: 192.168.0.0/24
gateway_ip: 192.168.0.1
allocation_pool_start: 192.168.0.2
allocation_pool_end: 192.168.0.254
register: subnet
- name: Assert not changed
assert:
that: subnet is not changed
- name: Update subnet
openstack.cloud.subnet:
@@ -29,12 +71,33 @@
dns_nameservers:
- 8.8.8.7
cidr: 192.168.0.0/24
register: subnet
- name: Assert changed
assert:
that: subnet is changed
- name: Delete subnet {{ subnet_name }}
openstack.cloud.subnet:
cloud: "{{ cloud }}"
name: "{{ subnet_name }}"
state: absent
register: subnet
- name: Assert changed
assert:
that: subnet is changed
- name: Delete subnet {{ subnet_name }} again
openstack.cloud.subnet:
cloud: "{{ cloud }}"
name: "{{ subnet_name }}"
state: absent
register: subnet
- name: Assert not changed
assert:
that: subnet is not changed
- name: Delete network {{ network_name }}
openstack.cloud.network: