From 2fbfbd6e2c5462afd0769e531c677c8183d7c7df Mon Sep 17 00:00:00 2001 From: George Ghawali Date: Wed, 11 Dec 2024 16:14:26 +0200 Subject: [PATCH] Adding fixes for static routes and service groups --- .../ntnx_service_groups/tasks/create.yml | 2 +- .../ntnx_static_routes/tasks/create.yml | 46 +++++++++++++++++-- .../ntnx_static_routes_info/tasks/info.yml | 4 ++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/ntnx_service_groups/tasks/create.yml b/tests/integration/targets/ntnx_service_groups/tasks/create.yml index 7fa4a6ba..9c7c13f6 100644 --- a/tests/integration/targets/ntnx_service_groups/tasks/create.yml +++ b/tests/integration/targets/ntnx_service_groups/tasks/create.yml @@ -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" diff --git a/tests/integration/targets/ntnx_static_routes/tasks/create.yml b/tests/integration/targets/ntnx_static_routes/tasks/create.yml index f4671fdd..69ecea87 100644 --- a/tests/integration/targets/ntnx_static_routes/tasks/create.yml +++ b/tests/integration/targets/ntnx_static_routes/tasks/create.yml @@ -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 + 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 }}" + d2: "{{ result.response.status.resources.static_routes_list[1].destination }}" + +- debug: + msg: "{{ result }}" + +- name: check info module response + assert: + that: + - result.response is defined + - result.changed == false ########################################################################################################### - name: Idempotency check @@ -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 diff --git a/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml b/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml index 870c7d69..d1a51223 100644 --- a/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml +++ b/tests/integration/targets/ntnx_static_routes_info/tasks/info.yml @@ -31,6 +31,10 @@ ########################################################################################################### +- 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 }}"