Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding integration fixes for V3 #533

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/integration/targets/ntnx_address_groups/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import update.yml
ansible.builtin.import_tasks: "update.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import update.yml
ansible.builtin.import_tasks: "update.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import create.yml
ansible.builtin.import_tasks: "address_groups_info.yml"
- name: Import create.yml
ansible.builtin.import_tasks: "address_groups_info.yml"
6 changes: 3 additions & 3 deletions tests/integration/targets/ntnx_categories/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import all_operations.yml
ansible.builtin.import_tasks: "all_operations.yml"
- name: Import all_operations.yml
ansible.builtin.import_tasks: "all_operations.yml"
6 changes: 3 additions & 3 deletions tests/integration/targets/ntnx_categories_info/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import info.yml
ansible.builtin.import_tasks: "info.yml"
- name: Import info.yml
ansible.builtin.import_tasks: "info.yml"
6 changes: 3 additions & 3 deletions tests/integration/targets/ntnx_clusters_info/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import get_clusters_info.yml
ansible.builtin.import_tasks: "get_clusters_info.yml"
- name: Import get_clusters_info.yml
ansible.builtin.import_tasks: "get_clusters_info.yml"
6 changes: 3 additions & 3 deletions tests/integration/targets/ntnx_hosts_info/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import get_hosts_info.yml
ansible.builtin.import_tasks: "get_hosts_info.yml"
- name: Import get_hosts_info.yml
ansible.builtin.import_tasks: "get_hosts_info.yml"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import info.yml
ansible.builtin.import_tasks: "info.yml"
- name: Import info.yml
ansible.builtin.import_tasks: "info.yml"
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Initializing variables
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import update.yml
ansible.builtin.import_tasks: "update.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import update.yml
ansible.builtin.import_tasks: "update.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
14 changes: 7 additions & 7 deletions tests/integration/targets/ntnx_images/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Set module defaults
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import update.yml
ansible.builtin.import_tasks: "update.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import update.yml
ansible.builtin.import_tasks: "update.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
6 changes: 3 additions & 3 deletions tests/integration/targets/ntnx_images_info/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: Set module defaults
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import info.yml
ansible.builtin.import_tasks: "info.yml"
- name: Import info.yml
ansible.builtin.import_tasks: "info.yml"
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
- result.response.service_group.service_list[1].udp_port_range_list[2].start_port == 99
- result.response.service_group.service_list[1].udp_port_range_list[2].end_port == 99
- result.response.service_group.service_list[2].protocol == "ICMP"
- result.response.service_group.service_list[2].icmp_type_code_list == []
- result.response.service_group.service_list[2].icmp_type_code_list == [{}]
fail_msg: "Fail: Unable to create tcp service group "
success_msg: "Pass: tcp service group created successfully"

Expand Down
46 changes: 42 additions & 4 deletions tests/integration/targets/ntnx_static_routes/tasks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,36 @@
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.changed == true
- result.response.status.resources.static_routes_list[0]["is_active"] == true
- ("{{d1}}" == "10.2.2.0/24" and "{{d2}}" == "10.2.3.0/24") or ("{{d2}}" == "10.2.2.0/24" and "{{d1}}" == "10.2.3.0/24")
- result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"
- result.response.status.resources.static_routes_list[1]["is_active"] == true
- result.response.status.resources.static_routes_list[1]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"
- result.response.status.resources.default_route["is_active"] == true
- result.response.status.resources.default_route["destination"] == "0.0.0.0/0"
- result.response.status.resources.default_route["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"

fail_msg: "Fail: Unable to update static routes of vpc"
success_msg: "Succes: static routes updated successfully"

- name: Wait 1 minute for static routes to be become active

Check failure on line 44 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (pause).
pause:
seconds: 60

- name: get all static routes

Check failure on line 48 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[casing]

All names should start with an uppercase letter.
ntnx_static_routes_info:
vpc_uuid: "{{ vpc.uuid }}"
register: result

- set_fact:

Check failure on line 53 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (set_fact).

Check failure on line 53 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[missing]

All tasks should be named.
d1: "{{ result.response.status.resources.static_routes_list[0].destination }}"
d2: "{{ result.response.status.resources.static_routes_list[1].destination }}"

- debug:

Check failure on line 57 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (debug).

Check failure on line 57 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

name[missing]

All tasks should be named.
msg: "{{ result }}"

- name: check info module response

Check failure on line 60 in tests/integration/targets/ntnx_static_routes/tasks/create.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (assert).
assert:
that:
- result.response is defined
- result.changed == false
###########################################################################################################

- name: Idempotency check
Expand Down Expand Up @@ -91,12 +109,32 @@
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.changed == true
- result.response.status.resources.static_routes_list[0]["is_active"] == true
- result.response.status.resources.static_routes_list[0]["destination"] == "10.2.4.0/24"
- result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"
fail_msg: "Static routes overriding failed"
success_msg: "Static routes overriden successfully"

- name: Wait 1 minute for static routes to be become active
pause:
seconds: 60

- name: get all static routes
ntnx_static_routes_info:
vpc_uuid: "{{ vpc.uuid }}"
register: result

- set_fact:
d1: "{{ result.response.status.resources.static_routes_list[0].destination }}"

- name: check info module response
assert:
that:
- result.response is defined
- result.changed == false
- result.response.status.resources.static_routes_list[0]["is_active"] == true
- result.response.status.resources.static_routes_list[0]["destination"] == "10.2.4.0/24"
- result.response.status.resources.static_routes_list[0]["nexthop"]["external_subnet_reference"]["name"] == "{{ external_nat_subnet.name }}"

###########################################################################################################

- name: Netgative scenario of cretaing multiple default routes
Expand Down
10 changes: 7 additions & 3 deletions tests/integration/targets/ntnx_static_routes_info/tasks/info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
uuid: "{{ external_nat_subnet.uuid }}"
register: result

- name: Update static routes list Status
- name: Create new static routes status
ansible.builtin.assert:
that:
- result.response is defined
- result.response.status.state == 'COMPLETE'
- result.changed == true
fail_msg: "Fail: Unable to update static routes of vpc"
success_msg: "Succes: static routes updated successfully"
fail_msg: "Fail: Unable to create static routes for vpc"
success_msg: "Success: Static routes created"

###########################################################################################################

- name: Wait 60 seconds for static routes to be created
pause:
seconds: 60

- name: Get all static routes
ntnx_static_routes_info:
vpc_uuid: "{{ vpc.uuid }}"
Expand Down
26 changes: 13 additions & 13 deletions tests/integration/targets/nutanix_vms/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
- name: Set module defaults
module_defaults:
group/nutanix.ncp.ntnx:
group/nutanix.ncp.ntnx:
nutanix_host: "{{ ip }}"
nutanix_username: "{{ username }}"
nutanix_password: "{{ password }}"
validate_certs: "{{ validate_certs }}"
block:
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import negtaive_scenarios.yml
ansible.builtin.import_tasks: "negtaive_scenarios.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
- name: Import vm_operations.yml
ansible.builtin.import_tasks: "vm_operations.yml"
- name: Import vm_update.yml
ansible.builtin.import_tasks: "vm_update.yml"
- name: Import negtaive_vm_update.yml
ansible.builtin.import_tasks: "negtaive_vm_update.yml"
- name: Import create.yml
ansible.builtin.import_tasks: "create.yml"
- name: Import negtaive_scenarios.yml
ansible.builtin.import_tasks: "negtaive_scenarios.yml"
- name: Import delete.yml
ansible.builtin.import_tasks: "delete.yml"
- name: Import vm_operations.yml
ansible.builtin.import_tasks: "vm_operations.yml"
- name: Import vm_update.yml
ansible.builtin.import_tasks: "vm_update.yml"
- name: Import negtaive_vm_update.yml
ansible.builtin.import_tasks: "negtaive_vm_update.yml"
Loading