Skip to content
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
4 changes: 4 additions & 0 deletions ansible/roles/test/tasks/crm/crm_test_ipv4_route.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
- name: Get NH IP
command: ip -4 neigh show dev {{crm_intf}} nud reachable nud stale
register: out

- fail: msg="Get Next Hop IP failed. Neighbour not found"
when: out.stdout == ""

- set_fact: nh_ip="{{out.stdout.split()[0]}}"

- name: Add IPv4 route
Expand Down
11 changes: 10 additions & 1 deletion ansible/roles/test/tasks/crm/crm_test_ipv6_route.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@
- set_fact: crm_stats_ipv6_route_available={{out.stdout}}

- name: Get NH IP
shell: ip -6 neigh show dev {{crm_intf}} nud reachable nud stale | grep -v fe80
shell: ip -6 neigh show dev {{crm_intf}} nud reachable nud stale
register: out

- name: Grep NH IP
shell: echo {{ out.stdout }} | grep -v fe80
register: out
ignore_errors: yes

- fail: msg="Get Next Hop IP failed. Neighbour not found"
when: out.stdout == ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks this will never execute because grep will fail in previous task if didn't find anything.
Could you add an error message for this case?
Or better to ignore grep failure in previous task and fail here.

Copy link
Copy Markdown
Contributor Author

@romankachur-mlnx romankachur-mlnx Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split Get Hext Hop IPv6 into two steps:
shell: ip -6 neigh show dev {{crm_intf}} nud reachable nud stale
shell: echo {{ out.stdout }} | grep -v fe80

Now fail: msg="Get Next Hop IP failed. Neighbour not found" definitely means empty grep result (and not ip -6 neigh show dev failure)


- set_fact: nh_ip="{{out.stdout.split()[0]}}"

- name: Add IPv6 route
Expand Down
8 changes: 8 additions & 0 deletions ansible/roles/test/tasks/crm/crm_test_nexthop_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@
- name: Get NH IP 1
command: ip -4 neigh show dev {{crm_intf}} nud reachable nud stale
register: out

- fail: msg="Get Next Hop IP failed. Neighbour not found"
when: out.stdout == ""

- set_fact: nh_ip1="{{out.stdout.split()[0]}}"

- name: Get NH IP 2
command: ip -4 neigh show dev {{crm_intf1}} nud reachable nud stale
register: out

- fail: msg="Get Next Hop IP failed. Neighbour not found"
when: out.stdout == ""

- set_fact: nh_ip2="{{out.stdout.split()[0]}}"

- name: Add nexthop group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@
- name: Get NH IP 1
command: ip -4 neigh show dev {{crm_intf}} nud reachable nud stale
register: out

- fail: msg="Get Next Hop IP failed. Neighbour not found"
when: out.stdout == ""

- set_fact: nh_ip1="{{out.stdout.split()[0]}}"

- name: Get NH IP 2
command: ip -4 neigh show dev {{crm_intf1}} nud reachable nud stale
register: out

- fail: msg="Get Next Hop IP failed. Neighbour not found"
when: out.stdout == ""

- set_fact: nh_ip2="{{out.stdout.split()[0]}}"

- name: Add nexthop group members
Expand Down