Change subnets_info module to work with new SDK

Change-Id: Ie23604c34ed9fb17eeb15bf73db9019ca9ebc7d8
This commit is contained in:
Kristian Kucerak
2022-09-12 11:27:19 +00:00
committed by Jakob Meng
parent c13fac3796
commit 97fa59bf6f
4 changed files with 125 additions and 36 deletions

View File

@@ -5,6 +5,7 @@ expected_fields:
- created_at
- description
- dns_nameservers
- dns_publish_fixed_ip
- gateway_ip
- host_routes
- id

View File

@@ -62,6 +62,49 @@
assert:
that: subnet is not changed
- name: Get Subnet Info with name
openstack.cloud.subnets_info:
cloud: "{{ cloud }}"
name: "{{ subnet_name }}"
register: subnet
- name: assert subnet fields
assert:
that: item in subnet.subnets[0]
loop: "{{ expected_fields }}"
- name: Get Subnet Info with filters
openstack.cloud.subnets_info:
cloud: "{{ cloud }}"
filters:
enable_dhcp: "{{ enable_subnet_dhcp }}"
gateway_ip: 192.168.0.1
cidr: 192.168.0.0/24
register: subnet
- name: Verify Subnet info result
assert:
that:
- subnet is not changed
- subnet.subnets is defined
- subnet.subnets | length > 0
- name: Get Subnet Info with name and improper filter values
openstack.cloud.subnets_info:
cloud: "{{ cloud }}"
name: "{{ subnet_name }}"
filters:
gateway_ip: 192.168.16.1
cidr: 192.168.16.0/24
register: subnet
- name: Verify Subnet info result
assert:
that:
- subnet is not changed
- subnet.subnets is defined
- subnet.subnets | length == 0
- name: Update subnet
openstack.cloud.subnet:
cloud: "{{ cloud }}"

View File

@@ -51,16 +51,16 @@
assert:
that:
- idem1 is not changed
- subnet_result.openstack_subnets is defined
- subnet_result.openstack_subnets | length == 1
- subnet_result.openstack_subnets[0].allocation_pools is defined
- subnet_result.openstack_subnets[0].allocation_pools | length == 1
- subnet_result.subnets is defined
- subnet_result.subnets | length == 1
- subnet_result.subnets[0].allocation_pools is defined
- subnet_result.subnets[0].allocation_pools | length == 1
- name: Verify Subnet Allocation Pools
assert:
that:
- subnet_result.openstack_subnets[0].allocation_pools.0.start == '192.168.0.2'
- subnet_result.openstack_subnets[0].allocation_pools.0.end == '192.168.0.8'
- subnet_result.subnets[0].allocation_pools.0.start == '192.168.0.2'
- subnet_result.subnets[0].allocation_pools.0.end == '192.168.0.8'
- name: Delete subnet {{ subnet_name }}
openstack.cloud.subnet: