Skip to content

Commit

Permalink
Adding fixes for static routes and service groups
Browse files Browse the repository at this point in the history
  • Loading branch information
george-ghawali committed Dec 11, 2024
1 parent e87f2ca commit 2fbfbd6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down

0 comments on commit 2fbfbd6

Please sign in to comment.