diff --git a/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml b/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml index 2c9e264d9..882e12d0c 100644 --- a/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml +++ b/tests/integration/targets/nutanix_subnets/tasks/create_subnet.yml @@ -1,345 +1,345 @@ -- name: VLAN subnet without IPAM - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: VLAN subnet without IPAM - vlan_subnet: - vlan_id: "{{ vlan_subnets_ids.0 }}" - virtual_switch: - name: "{{ virtual_switch.name }}" - cluster: - uuid: "{{ cluster.uuid }}" - register: result - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create VLAN subnet without IPAM " - success_msg: " VLAN subnet without IPAM created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: VLAN subnet with IPAM - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: VLAN subnet with IPAM - vlan_subnet: - vlan_id: "{{ vlan_subnets_ids.1 }}" - virtual_switch: - uuid: "{{ virtual_switch.uuid }}" - cluster: - name: "{{ cluster.name }}" - ipam: - network_ip: "{{ ip_address_management.network_ip }}" - network_prefix: "{{ ip_address_management.network_prefix }}" - gateway_ip: "{{ ip_address_management.gateway_ip_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create VLAN subnet with IPAM " - success_msg: " VLAN subnet with IPAM created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: VLAN subnet with IPAM and IP pools - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: VLAN subnet with IPAM and IP pools - vlan_subnet: - vlan_id: "{{vlan_subnets_ids.2}}" - virtual_switch: - name: "{{ virtual_switch.name }}" - cluster: - name: "{{ cluster.name }}" - ipam: - network_ip: "{{ ip_address_management.network_ip }}" - network_prefix: "{{ ip_address_management.network_prefix }}" - gateway_ip: "{{ ip_address_management.gateway_ip_address }}" - ip_pools: - - start_ip: "{{ ip_address_pools.start_address }}" - end_ip: "{{ ip_address_pools.end_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create VLAN subnet with IPAM and IP pools" - success_msg: " VLAN subnet with IPAM and IP pools created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: VLAN subnet with IPAM IP pools and DHCP - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: VLAN subnet with IPAM IP pools and DHCP - vlan_subnet: - vlan_id: "{{vlan_subnets_ids.3}}" - virtual_switch: - name: "{{ virtual_switch.name }}" - cluster: - name: "{{ cluster.name }}" - ipam: - network_ip: "{{ ip_address_management.network_ip }}" - network_prefix: "{{ ip_address_management.network_prefix }}" - gateway_ip: "{{ ip_address_management.gateway_ip_address }}" - ip_pools: - - start_ip: "{{ ip_address_pools.start_address }}" - end_ip: "{{ ip_address_pools.end_address }}" - dhcp: - dns_servers: "{{ dhcp_settings.dns_servers }}" - domain_search: "{{ dhcp_settings.domain_search }}" - domain_name: "{{ dhcp_settings.domain_name }}" - tftp_server_name: "{{ dhcp_settings.tftp_server_name }}" - boot_file: "{{ dhcp_settings.boot_file }}" - dhcp_server_ip: "{{ dhcp_server_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create VLAN subnet with IPAM, IP pools and DHCP " - success_msg: " VLAN subnet with IPAM, IP pools and DHCP created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: VLAN subnet with IPAM multiple IP pools and DHCP - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: VLAN subnet with IPAM multiple IP pools and DHCP - vlan_subnet: - vlan_id: "{{ vlan_subnets_ids.4 }}" - virtual_switch: - name: "{{ virtual_switch.name }}" - cluster: - name: "{{ cluster.name }}" - ipam: - network_ip: "{{ ip_address_management.network_ip }}" - network_prefix: "{{ ip_address_management.network_prefix }}" - gateway_ip: "{{ ip_address_management.gateway_ip_address }}" - ip_pools: - - start_ip: "{{ ip_address_pools.start_address }}" - end_ip: "{{ ip_address_pools.end_address }}" - - start_ip: "{{ ip_address_pools.start_address_2 }}" - end_ip: "{{ ip_address_pools.end_address_2 }}" - dhcp: - dns_servers: "{{ dhcp_settings.dns_servers }}" - domain_search: "{{ dhcp_settings.domain_search }}" - domain_name: "{{ dhcp_settings.domain_name }}" - tftp_server_name: "{{ dhcp_settings.tftp_server_name }}" - boot_file: "{{ dhcp_settings.boot_file }}" - dhcp_server_ip: "{{ dhcp_server_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create VLAN subnet with IPAM, multiple IP pools and DHCP " - success_msg: " VLAN subnet with IPAM, multiple IP pools and DHCP created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: External subnet without NAT - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: " External subnet without NAT " - external_subnet: - vlan_id: "{{external_nonat_subnet.vlan_id}}" - enable_nat: false - cluster: - uuid: "{{ cluster.uuid }}" - ipam: - network_ip: "{{ external_nonat_subnet.network_ip }}" - network_prefix: "{{ external_nonat_subnet.network_prefix }}" - gateway_ip: "{{ external_nonat_subnet.gateway_ip_address }}" - ip_pools: - - start_ip: "{{ external_nonat_subnet.dhcp.start_address }}" - end_ip: "{{ external_nonat_subnet.dhcp.end_address }}" - - start_ip: "{{ external_nonat_subnet.static.start_address }}" - end_ip: "{{ external_nonat_subnet.static.end_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create External subnet without NAT " - success_msg: " External subnet without NAT created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - - - -- name: External subnet with NAT - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: " External subnet with NAT " - external_subnet: - vlan_id: "{{ external_nat_subnet.vlan_id }}" - enable_nat: True - cluster: - name: "{{ cluster.name }}" - ipam: - network_ip: "{{ external_nat_subnet.network_ip }}" - network_prefix: "{{ external_nat_subnet.network_prefix }}" - gateway_ip: "{{ external_nat_subnet.gateway_ip_address }}" - ip_pools: - - start_ip: "{{ external_nat_subnet.dhcp.start_address }}" - end_ip: "{{ external_nat_subnet.dhcp.end_address }}" - - start_ip: "{{ external_nat_subnet.static.start_address }}" - end_ip: "{{ external_nat_subnet.static.end_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create External subnet with NAT " - success_msg: " External subnet with NAT created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: Overlay Subnet with minimum requirements - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: Overlay Subnet with minimum requirements - overlay_subnet: - vpc: - uuid: "{{ vpc.uuid }}" - ipam: - network_ip: "{{ ip_address_management.network_ip }}" - network_prefix: "{{ ip_address_management.network_prefix }}" - gateway_ip: "{{ ip_address_management.gateway_ip_address }}" - register: result - ignore_errors: true - -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create Overlay Subnet with minimum requirements " - success_msg: " Overlay Subnet with minimum requirements created successfully " - -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: Delete all Created Subnets - ntnx_subnets: - state: absent - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - subnet_uuid: "{{ item }}" - register: result - loop: "{{ todelete }}" - ignore_errors: True - -- set_fact: - todelete: [] - -- name: Overlay Subnet with IP_pools and DHCP - ntnx_subnets: - state: present - nutanix_host: "{{ ip }}" - validate_certs: false - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - name: Overlay Subnet with IP_pools and DHCP - overlay_subnet: - vpc: - name: "{{ vpc.name }}" - ipam: - network_ip: "{{ ip_address_management.network_ip }}" - network_prefix: "{{ ip_address_management.network_prefix }}" - gateway_ip: "{{ ip_address_management.gateway_ip_address }}" - ip_pools: - - start_ip: "{{ ip_address_pools.start_address }}" - end_ip: "{{ ip_address_pools.end_address }}" - dhcp: - dns_servers: "{{ dhcp_settings.dns_servers }}" - domain_search: "{{ dhcp_settings.domain_search }}" - domain_name: "{{ dhcp_settings.domain_name }}" - tftp_server_name: "{{ dhcp_settings.tftp_server_name }}" - boot_file: "{{ dhcp_settings.boot_file }}" - register: result - ignore_errors: true -- name: Creation Status - assert: - that: - - result.response is defined - - result.response.status.state == 'COMPLETE' - fail_msg: " Unable to create Overlay Subnet with IP_pools and DHCP " - success_msg: " Overlay Subnet with IP_pools and DHCP created successfully " -- set_fact: - todelete: "{{ todelete + [ result.subnet_uuid ] }}" - -- name: Delete all Created Subnets - ntnx_subnets: - state: absent - nutanix_host: "{{ ip }}" - nutanix_username: "{{ username }}" - nutanix_password: "{{ password }}" - validate_certs: false - subnet_uuid: "{{ item }}" - register: result - loop: "{{ todelete }}" - ignore_errors: True +- name: VLAN subnet without IPAM + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: VLAN subnet without IPAM + vlan_subnet: + vlan_id: "{{ vlan_subnets_ids.0 }}" + virtual_switch: + name: "{{ virtual_switch.name }}" + cluster: + uuid: "{{ cluster.uuid }}" + register: result + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create VLAN subnet without IPAM " + success_msg: " VLAN subnet without IPAM created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: VLAN subnet with IPAM + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: VLAN subnet with IPAM + vlan_subnet: + vlan_id: "{{ vlan_subnets_ids.1 }}" + virtual_switch: + uuid: "{{ virtual_switch.uuid }}" + cluster: + name: "{{ cluster.name }}" + ipam: + network_ip: "{{ ip_address_management.network_ip }}" + network_prefix: "{{ ip_address_management.network_prefix }}" + gateway_ip: "{{ ip_address_management.gateway_ip_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create VLAN subnet with IPAM " + success_msg: " VLAN subnet with IPAM created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: VLAN subnet with IPAM and IP pools + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: VLAN subnet with IPAM and IP pools + vlan_subnet: + vlan_id: "{{vlan_subnets_ids.2}}" + virtual_switch: + name: "{{ virtual_switch.name }}" + cluster: + name: "{{ cluster.name }}" + ipam: + network_ip: "{{ ip_address_management.network_ip }}" + network_prefix: "{{ ip_address_management.network_prefix }}" + gateway_ip: "{{ ip_address_management.gateway_ip_address }}" + ip_pools: + - start_ip: "{{ ip_address_pools.start_address }}" + end_ip: "{{ ip_address_pools.end_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create VLAN subnet with IPAM and IP pools" + success_msg: " VLAN subnet with IPAM and IP pools created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: VLAN subnet with IPAM IP pools and DHCP + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: VLAN subnet with IPAM IP pools and DHCP + vlan_subnet: + vlan_id: "{{vlan_subnets_ids.3}}" + virtual_switch: + name: "{{ virtual_switch.name }}" + cluster: + name: "{{ cluster.name }}" + ipam: + network_ip: "{{ ip_address_management.network_ip }}" + network_prefix: "{{ ip_address_management.network_prefix }}" + gateway_ip: "{{ ip_address_management.gateway_ip_address }}" + ip_pools: + - start_ip: "{{ ip_address_pools.start_address }}" + end_ip: "{{ ip_address_pools.end_address }}" + dhcp: + dns_servers: "{{ dhcp_settings.dns_servers }}" + domain_search: "{{ dhcp_settings.domain_search }}" + domain_name: "{{ dhcp_settings.domain_name }}" + tftp_server_name: "{{ dhcp_settings.tftp_server_name }}" + boot_file: "{{ dhcp_settings.boot_file }}" + dhcp_server_ip: "{{ dhcp_server_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create VLAN subnet with IPAM, IP pools and DHCP " + success_msg: " VLAN subnet with IPAM, IP pools and DHCP created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: VLAN subnet with IPAM multiple IP pools and DHCP + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: VLAN subnet with IPAM multiple IP pools and DHCP + vlan_subnet: + vlan_id: "{{ vlan_subnets_ids.4 }}" + virtual_switch: + name: "{{ virtual_switch.name }}" + cluster: + name: "{{ cluster.name }}" + ipam: + network_ip: "{{ ip_address_management.network_ip }}" + network_prefix: "{{ ip_address_management.network_prefix }}" + gateway_ip: "{{ ip_address_management.gateway_ip_address }}" + ip_pools: + - start_ip: "{{ ip_address_pools.start_address }}" + end_ip: "{{ ip_address_pools.end_address }}" + - start_ip: "{{ ip_address_pools.start_address_2 }}" + end_ip: "{{ ip_address_pools.end_address_2 }}" + dhcp: + dns_servers: "{{ dhcp_settings.dns_servers }}" + domain_search: "{{ dhcp_settings.domain_search }}" + domain_name: "{{ dhcp_settings.domain_name }}" + tftp_server_name: "{{ dhcp_settings.tftp_server_name }}" + boot_file: "{{ dhcp_settings.boot_file }}" + dhcp_server_ip: "{{ dhcp_server_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create VLAN subnet with IPAM, multiple IP pools and DHCP " + success_msg: " VLAN subnet with IPAM, multiple IP pools and DHCP created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: External subnet without NAT + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: " External subnet without NAT " + external_subnet: + vlan_id: "{{external_nonat_subnet.vlan_id}}" + enable_nat: false + cluster: + uuid: "{{ cluster.uuid }}" + ipam: + network_ip: "{{ external_nonat_subnet.network_ip }}" + network_prefix: "{{ external_nonat_subnet.network_prefix }}" + gateway_ip: "{{ external_nonat_subnet.gateway_ip_address }}" + ip_pools: + - start_ip: "{{ external_nonat_subnet.dhcp.start_address }}" + end_ip: "{{ external_nonat_subnet.dhcp.end_address }}" + - start_ip: "{{ external_nonat_subnet.static.start_address }}" + end_ip: "{{ external_nonat_subnet.static.end_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create External subnet without NAT " + success_msg: " External subnet without NAT created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + + + +- name: External subnet with NAT + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: " External subnet with NAT " + external_subnet: + vlan_id: "{{ external_nat_subnet.vlan_id }}" + enable_nat: True + cluster: + name: "{{ cluster.name }}" + ipam: + network_ip: "{{ external_nat_subnet.network_ip }}" + network_prefix: "{{ external_nat_subnet.network_prefix }}" + gateway_ip: "{{ external_nat_subnet.gateway_ip_address }}" + ip_pools: + - start_ip: "{{ external_nat_subnet.dhcp.start_address }}" + end_ip: "{{ external_nat_subnet.dhcp.end_address }}" + - start_ip: "{{ external_nat_subnet.static.start_address }}" + end_ip: "{{ external_nat_subnet.static.end_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create External subnet with NAT " + success_msg: " External subnet with NAT created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: Overlay Subnet with minimum requirements + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: Overlay Subnet with minimum requirements + overlay_subnet: + vpc: + uuid: "{{ vpc.uuid }}" + ipam: + network_ip: "{{ ip_address_management.network_ip }}" + network_prefix: "{{ ip_address_management.network_prefix }}" + gateway_ip: "{{ ip_address_management.gateway_ip_address }}" + register: result + ignore_errors: true + +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create Overlay Subnet with minimum requirements " + success_msg: " Overlay Subnet with minimum requirements created successfully " + +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: Delete all Created Subnets + ntnx_subnets: + state: absent + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + subnet_uuid: "{{ item }}" + register: result + loop: "{{ todelete }}" + ignore_errors: True + +- set_fact: + todelete: [] + +- name: Overlay Subnet with IP_pools and DHCP + ntnx_subnets: + state: present + nutanix_host: "{{ ip }}" + validate_certs: false + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + name: Overlay Subnet with IP_pools and DHCP + overlay_subnet: + vpc: + name: "{{ vpc.name }}" + ipam: + network_ip: "{{ ip_address_management.network_ip }}" + network_prefix: "{{ ip_address_management.network_prefix }}" + gateway_ip: "{{ ip_address_management.gateway_ip_address }}" + ip_pools: + - start_ip: "{{ ip_address_pools.start_address }}" + end_ip: "{{ ip_address_pools.end_address }}" + dhcp: + dns_servers: "{{ dhcp_settings.dns_servers }}" + domain_search: "{{ dhcp_settings.domain_search }}" + domain_name: "{{ dhcp_settings.domain_name }}" + tftp_server_name: "{{ dhcp_settings.tftp_server_name }}" + boot_file: "{{ dhcp_settings.boot_file }}" + register: result + ignore_errors: true +- name: Creation Status + assert: + that: + - result.response is defined + - result.response.status.state == 'COMPLETE' + fail_msg: " Unable to create Overlay Subnet with IP_pools and DHCP " + success_msg: " Overlay Subnet with IP_pools and DHCP created successfully " +- set_fact: + todelete: "{{ todelete + [ result.subnet_uuid ] }}" + +- name: Delete all Created Subnets + ntnx_subnets: + state: absent + nutanix_host: "{{ ip }}" + nutanix_username: "{{ username }}" + nutanix_password: "{{ password }}" + validate_certs: false + subnet_uuid: "{{ item }}" + register: result + loop: "{{ todelete }}" + ignore_errors: True