From f1cf83879748a5a5f6beb2236efb25ae1ec1cb00 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Mon, 19 Aug 2019 14:24:39 +0530 Subject: [PATCH] fix nxos CI failures (#60752) Signed-off-by: Trishna Guha --- .../targets/nxos_interfaces/meta/main.yml | 3 +- .../tests/cli/deleted.yaml | 101 ++++++++------- .../nxos_lag_interfaces/tests/cli/merged.yaml | 83 ++++++------ .../tests/cli/overridden.yaml | 118 +++++++++-------- .../tests/cli/replaced.yaml | 120 ++++++++++-------- 5 files changed, 222 insertions(+), 203 deletions(-) diff --git a/test/integration/targets/nxos_interfaces/meta/main.yml b/test/integration/targets/nxos_interfaces/meta/main.yml index 32cf5dda7ed..ae741cbdc71 100644 --- a/test/integration/targets/nxos_interfaces/meta/main.yml +++ b/test/integration/targets/nxos_interfaces/meta/main.yml @@ -1 +1,2 @@ -dependencies: [] +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_lag_interfaces/tests/cli/deleted.yaml b/test/integration/targets/nxos_lag_interfaces/tests/cli/deleted.yaml index 68bef590867..11d5e4a23bc 100644 --- a/test/integration/targets/nxos_lag_interfaces/tests/cli/deleted.yaml +++ b/test/integration/targets/nxos_lag_interfaces/tests/cli/deleted.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "Start nxos_lag_interfaces merged integration tests connection={{ ansible_connection }}" + msg: "Start nxos_lag_interfaces deleted integration tests connection={{ ansible_connection }}" - set_fact: test_int1="{{ nxos_int1 }}" - set_fact: test_int2="{{ nxos_int2 }}" @@ -9,49 +9,8 @@ nxos_feature: feature: lacp -- name: setup - nxos_config: - lines: - - "channel-group 10" - parents: "{{ item }}" - loop: - - "interface {{ test_int1 }}" - - "interface {{ test_int2 }}" - -- name: Gather LAG interfaces facts - nxos_facts: &facts - gather_subset: - - '!all' - - '!min' - gather_network_resources: lag_interfaces - -- name: deleted - nxos_lag_interfaces: &deleted - state: deleted - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - -- name: Gather LAG interfaces post facts - nxos_facts: *facts - -- assert: - that: - - "result.after|length == 0" - - "result.changed == true" - -- name: Idempotence - deleted - nxos_lag_interfaces: *deleted - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - nxos_config: +- name: Setup1 + nxos_config: &cleanup lines: - "no channel-group 10" parents: "{{ item }}" @@ -60,7 +19,53 @@ - "interface {{ test_int1 }}" - "interface {{ test_int2 }}" -- name: disable feature lacp - nxos_feature: - feature: lacp - state: disabled +- block: + - name: Setup2 + nxos_config: + lines: + - "channel-group 10" + parents: "{{ item }}" + loop: + - "interface {{ test_int1 }}" + - "interface {{ test_int2 }}" + + - name: Gather LAG interfaces facts + nxos_facts: &facts + gather_subset: + - '!all' + - '!min' + gather_network_resources: lag_interfaces + + - name: deleted + nxos_lag_interfaces: &deleted + state: deleted + register: result + + - assert: + that: + - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" + + - name: Gather LAG interfaces post facts + nxos_facts: *facts + + - assert: + that: + - "result.after|length == 0" + - "result.changed == true" + + - name: Idempotence - deleted + nxos_lag_interfaces: *deleted + register: result + + - assert: + that: + - "result.changed == false" + + always: + - name: teardown + nxos_config: *cleanup + + - name: disable feature lacp + nxos_feature: + feature: lacp + state: disabled diff --git a/test/integration/targets/nxos_lag_interfaces/tests/cli/merged.yaml b/test/integration/targets/nxos_lag_interfaces/tests/cli/merged.yaml index cd2ec4f8d52..742f29dee51 100644 --- a/test/integration/targets/nxos_lag_interfaces/tests/cli/merged.yaml +++ b/test/integration/targets/nxos_lag_interfaces/tests/cli/merged.yaml @@ -5,12 +5,12 @@ - set_fact: test_int1="{{ nxos_int1 }}" - set_fact: test_int2="{{ nxos_int2 }}" -- name: enable feature lacp +- name: Enable feature lacp nxos_feature: feature: lacp -- name: setup - nxos_config: +- name: Setup + nxos_config: &cleanup lines: - "no channel-group" parents: "{{ item }}" @@ -19,51 +19,46 @@ - "interface {{ test_int1 }}" - "interface {{ test_int2 }}" -- name: Merged - nxos_lag_interfaces: &merged - config: - - name: port-channel10 - members: - - member: "{{ test_int1 }}" - - member: "{{ test_int2 }}" - state: merged - register: result +- block: + - name: Merged + nxos_lag_interfaces: &merged + config: + - name: port-channel10 + members: + - member: "{{ test_int1 }}" + - member: "{{ test_int2 }}" + state: merged + register: result -- assert: - that: - - "result.before|length == 0" - - "result.changed == true" + - assert: + that: + - "result.before|length == 0" + - "result.changed == true" -- name: Gather LAG interfaces facts - nxos_facts: - gather_subset: - - '!all' - - '!min' - gather_network_resources: lag_interfaces + - name: Gather LAG interfaces facts + nxos_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: lag_interfaces -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" + - assert: + that: + - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" -- name: Idempotence - Merged - nxos_lag_interfaces: *merged - register: result + - name: Idempotence - Merged + nxos_lag_interfaces: *merged + register: result -- assert: - that: - - "result.changed == false" + - assert: + that: + - "result.changed == false" -- name: teardown - nxos_config: - lines: - - "no channel-group" - parents: "{{ item }}" - ignore_errors: yes - loop: - - "interface {{ test_int1 }}" - - "interface {{ test_int2 }}" + always: + - name: Teardown + nxos_config: *cleanup -- name: disable feature lacp - nxos_feature: - feature: lacp - state: disabled + - name: Disable feature lacp + nxos_feature: + feature: lacp + state: disabled diff --git a/test/integration/targets/nxos_lag_interfaces/tests/cli/overridden.yaml b/test/integration/targets/nxos_lag_interfaces/tests/cli/overridden.yaml index baa14c153af..7a55d9e70f4 100644 --- a/test/integration/targets/nxos_lag_interfaces/tests/cli/overridden.yaml +++ b/test/integration/targets/nxos_lag_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "Start nxos_lag_interfaces merged integration tests connection={{ ansible_connection }}" + msg: "Start nxos_lag_interfaces overridden integration tests connection={{ ansible_connection }}" - set_fact: test_int1="{{ nxos_int1 }}" - set_fact: test_int2="{{ nxos_int2 }}" @@ -10,54 +10,8 @@ nxos_feature: feature: lacp -- name: setup - nxos_config: - lines: - - "channel-group 10" - parents: "{{ item }}" - ignore_errors: yes - loop: - - "interface {{ test_int1 }}" - - "interface {{ test_int2 }}" - -- name: Gather LAG interfaces facts - nxos_facts: &facts - gather_subset: - - '!all' - - '!min' - gather_network_resources: lag_interfaces - -- name: Overridden - nxos_lag_interfaces: &overridden - config: - - name: port-channel19 - members: - - member: "{{ test_int3 }}" - state: overridden - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - - "result.changed == true" - -- name: Gather LAG interfaces post facts - nxos_facts: *facts - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" - -- name: Idempotence - Overridden - nxos_lag_interfaces: *overridden - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown1 - nxos_config: +- name: setup1 + nxos_config: &cleanup1 lines: - "no channel-group 10" parents: "{{ item }}" @@ -66,13 +20,67 @@ - "interface {{ test_int1 }}" - "interface {{ test_int2 }}" -- name: teardown2 - nxos_config: +- name: setup2 + nxos_config: &cleanup2 lines: - "no channel-group 19" parents: "interface {{ test_int3 }}" + ignore_errors: yes -- name: disable feature lacp - nxos_feature: - feature: lacp - state: disabled +- block: + - name: setup3 + nxos_config: + lines: + - "channel-group 10" + parents: "{{ item }}" + ignore_errors: yes + loop: + - "interface {{ test_int1 }}" + - "interface {{ test_int2 }}" + + - name: Gather LAG interfaces facts + nxos_facts: &facts + gather_subset: + - '!all' + - '!min' + gather_network_resources: lag_interfaces + + - name: Overridden + nxos_lag_interfaces: &overridden + config: + - name: port-channel19 + members: + - member: "{{ test_int3 }}" + state: overridden + register: result + + - assert: + that: + - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" + - "result.changed == true" + + - name: Gather LAG interfaces post facts + nxos_facts: *facts + + - assert: + that: + - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" + + - name: Idempotence - Overridden + nxos_lag_interfaces: *overridden + register: result + + - assert: + that: + - "result.changed == false" + always: + - name: teardown1 + nxos_config: *cleanup1 + + - name: teardown2 + nxos_config: *cleanup2 + + - name: disable feature lacp + nxos_feature: + feature: lacp + state: disabled diff --git a/test/integration/targets/nxos_lag_interfaces/tests/cli/replaced.yaml b/test/integration/targets/nxos_lag_interfaces/tests/cli/replaced.yaml index 5f740f861e6..e8dd6d26ac6 100644 --- a/test/integration/targets/nxos_lag_interfaces/tests/cli/replaced.yaml +++ b/test/integration/targets/nxos_lag_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "Start nxos_lag_interfaces merged integration tests connection={{ ansible_connection }}" + msg: "Start nxos_lag_interfaces replaced integration tests connection={{ ansible_connection }}" - set_fact: test_int1="{{ nxos_int1 }}" - set_fact: test_int2="{{ nxos_int2 }}" @@ -9,65 +9,75 @@ nxos_feature: feature: lacp -- name: setup - nxos_config: - lines: - - "channel-group 10" - parents: "{{ item }}" - ignore_errors: yes - loop: - - "interface {{ test_int1 }}" - - "interface {{ test_int2 }}" - -- name: Gather LAG interfaces facts - nxos_facts: &facts - gather_subset: - - '!all' - - '!min' - gather_network_resources: lag_interfaces - -- name: Replaced - nxos_lag_interfaces: &replaced - config: - - name: port-channel11 - members: - - member: "{{ test_int2 }}" - mode: active - state: replaced - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - -- name: Gather LAG interfaces post facts - nxos_facts: *facts - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" - -- name: Idempotence - Replaced - nxos_lag_interfaces: *replaced - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown1 - nxos_config: +- name: setup1 + nxos_config: &cleanup1 lines: - "no channel-group 10" parents: "interface {{ test_int1 }}" + ignore_errors: yes -- name: teardown2 - nxos_config: +- name: setup2 + nxos_config: &cleanup2 lines: - "no channel-group 11" parents: "interface {{ test_int2 }}" + ignore_errors: yes -- name: disable feature lacp - nxos_feature: - feature: lacp - state: disabled +- block: + - name: setup3 + nxos_config: + lines: + - "channel-group 10" + parents: "{{ item }}" + ignore_errors: yes + loop: + - "interface {{ test_int1 }}" + - "interface {{ test_int2 }}" + + - name: Gather LAG interfaces facts + nxos_facts: &facts + gather_subset: + - '!all' + - '!min' + gather_network_resources: lag_interfaces + + - name: Replaced + nxos_lag_interfaces: &replaced + config: + - name: port-channel11 + members: + - member: "{{ test_int2 }}" + mode: active + state: replaced + register: result + + - assert: + that: + - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" + + - name: Gather LAG interfaces post facts + nxos_facts: *facts + + - assert: + that: + - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" + + - name: Idempotence - Replaced + nxos_lag_interfaces: *replaced + register: result + + - assert: + that: + - "result.changed == false" + + always: + - name: teardown1 + nxos_config: *cleanup1 + + - name: teardown2 + nxos_config: *cleanup2 + + - name: disable feature lacp + nxos_feature: + feature: lacp + state: disabled