diff --git a/ansible/roles/test/tasks/lag_minlink.yml b/ansible/roles/test/tasks/lag_minlink.yml index e7af57c9b9f..11866fe2a18 100644 --- a/ansible/roles/test/tasks/lag_minlink.yml +++ b/ansible/roles/test/tasks/lag_minlink.yml @@ -12,8 +12,27 @@ login: "{{switch_login[hwsku_map[peer_hwsku]]}}" connection: switch - - pause: - seconds: "{{ wait_down_time }}" + - name: Set delay + set_fact: + delay: 5 + + - name: Set retries + set_fact: + retries: "{{ (wait_down_time | int / delay | float) | round(0, 'ceil') }}" + + - name: Let portchannel react to neighbor interface shutdown + pause: + seconds: "{{ deselect_time }}" + + - name: "Verify PortChannel interfaces are up correctly" + shell: bash -c "teamdctl {{ po }} state dump" | python -c "import sys, json; print json.load(sys.stdin)['ports']['{{ item }}']['runner']['selected']" + register: out + until: out.stdout == "True" + with_items: "{{ po_interfaces.keys() }}" + when: item != "{{ flap_intf }}" + become: "yes" + retries: "{{ retries | int }}" + delay: "{{ delay }}" - lag_facts: host={{ inventory_hostname }} @@ -44,8 +63,14 @@ login: "{{switch_login[hwsku_map[peer_hwsku]]}}" connection: switch - - pause: - seconds: 35 + - name: "Verify PortChannel interfaces are up correctly" + shell: bash -c "teamdctl {{ po }} state dump" | python -c "import sys, json; print json.load(sys.stdin)['ports']['{{ item }}']['link']['up']" + register: out + until: out.stdout == "True" + with_items: "{{ po_interfaces.keys() }}" + become: "yes" + retries: "{{ retries | int }}" + delay: "{{ delay }}" - lag_facts: host={{ inventory_hostname }} diff --git a/ansible/roles/test/tasks/single_lag_test.yml b/ansible/roles/test/tasks/single_lag_test.yml index 852eb5734cb..b9f2765954e 100644 --- a/ansible/roles/test/tasks/single_lag_test.yml +++ b/ansible/roles/test/tasks/single_lag_test.yml @@ -2,6 +2,12 @@ ### This playbook test one single port channel minimum link feature of one member interface shutdown ### and portchannel member interfaces sending ACP DU rate +# Set maximum value of "smart" timeout to be the same as before, +# user can now set own value outside the test, for example by passing '-e wait_timeout=5' +- set_fact: + wait_timeout: 30 + when: "wait_timeout is not defined" + # Gather information of port channel ports, minimum links and total interface member numbers - set_fact: po: "{{ item }}" @@ -31,7 +37,8 @@ - name: test fanout interface (physical) flap and lacp keep correct po status follow minimum links requirement include: lag_minlink.yml vars: - wait_down_time: 35 + deselect_time: 5 + wait_down_time: "{{ wait_timeout | int }}" ### Now figure out remote VM and interface info for the flapping lag member and run minlink test - set_fact: @@ -45,4 +52,5 @@ - name: test vm interface flap (no physical port down, more like remote port lock) that lag interface can change to correct po status follow minimum links requirement include: lag_minlink.yml vars: - wait_down_time: 120 + deselect_time: 95 + wait_down_time: "{{ wait_timeout | int }}"