Fix nxos_bgp tests and prepare_nxos_tests refactor (#35694)

This commit is contained in:
Mike Wiebe 2018-02-05 01:43:30 -05:00 committed by Trishna Guha
parent 109bc89bbe
commit 0de810fdf7
5 changed files with 87 additions and 22 deletions

View file

@ -3,6 +3,12 @@
- debug: msg="Using provider={{ connection.transport }}" - debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local" when: ansible_connection == "local"
- debug: msg="This bgp_disable_policy is not supported on {{ image_version }}"
when: imagetag is search("A8|D1")
- set_fact: bgp_disable_policy="false"
- set_fact: bgp_disable_policy="true"
when: imagetag is not search("A8|D1")
- name: "Disable feature BGP" - name: "Disable feature BGP"
nxos_feature: nxos_feature:
feature: bgp feature: bgp
@ -18,8 +24,6 @@
ignore_errors: yes ignore_errors: yes
- block: - block:
# these tasks will fail on N3k A8 code and n7k running helsinki
# due to no support
- name: "set disable policy" - name: "set disable policy"
nxos_bgp: &set1 nxos_bgp: &set1
asn: 65535 asn: 65535
@ -28,18 +32,22 @@
disable_policy_batching_ipv6_prefix_list: v6_p disable_policy_batching_ipv6_prefix_list: v6_p
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
when: bgp_disable_policy
- assert: &true - assert: &true
that: that:
- "result.changed == true" - "result.changed == true"
when: bgp_disable_policy
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *set1 nxos_bgp: *set1
register: result register: result
when: bgp_disable_policy
- assert: &false - assert: &false
that: that:
- "result.changed == false" - "result.changed == false"
when: bgp_disable_policy
- name: "reset disable policy" - name: "reset disable policy"
nxos_bgp: &reset1 nxos_bgp: &reset1
@ -49,14 +57,18 @@
disable_policy_batching_ipv6_prefix_list: default disable_policy_batching_ipv6_prefix_list: default
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
when: bgp_disable_policy
- assert: *true - assert: *true
when: bgp_disable_policy
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *reset1 nxos_bgp: *reset1
register: result register: result
when: bgp_disable_policy
- assert: *false - assert: *false
when: bgp_disable_policy
rescue: rescue:
- debug: msg="Tests can fail on A8 or helsinki images" - debug: msg="Tests can fail on A8 or helsinki images"

View file

@ -3,12 +3,19 @@
- debug: msg="Using provider={{ connection.transport }}" - debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local" when: ansible_connection == "local"
- debug: msg="This test is not supported on {{ image_version }}"
when: imagetag is search("D1")
- set_fact: test_helsinki="false"
- set_fact: test_helsinki="true"
when: imagetag is not search("D1")
- name: "Disable feature BGP" - name: "Disable feature BGP"
nxos_feature: nxos_feature:
feature: bgp feature: bgp
state: disabled state: disabled
provider: "{{ connection }}" provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
when: test_helsinki
- name: "Enable feature BGP" - name: "Enable feature BGP"
nxos_feature: nxos_feature:
@ -16,6 +23,7 @@
state: enabled state: enabled
provider: "{{ connection }}" provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
when: test_helsinki
- block: - block:
# these tasks will fail on n7k running helsinki # these tasks will fail on n7k running helsinki
@ -33,19 +41,23 @@
provider: "{{ connection }}" provider: "{{ connection }}"
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
when: test_helsinki
- assert: &true - assert: &true
that: that:
- "result.changed == true" - "result.changed == true"
when: test_helsinki
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *set1 nxos_bgp: *set1
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
when: test_helsinki
- assert: &false - assert: &false
that: that:
- "result.changed == false" - "result.changed == false"
when: test_helsinki
- name: "reset helsinki" - name: "reset helsinki"
nxos_bgp: &reset1 nxos_bgp: &reset1
@ -61,15 +73,19 @@
provider: "{{ connection }}" provider: "{{ connection }}"
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
when: test_helsinki
- assert: *true - assert: *true
when: test_helsinki
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *reset1 nxos_bgp: *reset1
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
when: test_helsinki
- assert: *false - assert: *false
when: test_helsinki
rescue: rescue:
- debug: msg="Tests can fail on helsinki images" - debug: msg="Tests can fail on helsinki images"
@ -81,5 +97,6 @@
state: disabled state: disabled
provider: "{{ connection }}" provider: "{{ connection }}"
ignore_errors: yes ignore_errors: yes
when: test_helsinki
- debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test" - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"

View file

@ -3,6 +3,13 @@
- debug: msg="Using provider={{ connection.transport }}" - debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local" when: ansible_connection == "local"
- debug: msg="This bgp_isolate is not supported on {{ image_version }}"
when: imagetag is search("A8")
- set_fact: bgp_isolate="false"
- set_fact: bgp_isolate="true"
when: imagetag is not search("A8")
- name: "Disable feature BGP" - name: "Disable feature BGP"
nxos_feature: nxos_feature:
feature: bgp feature: bgp
@ -26,18 +33,22 @@
isolate: false isolate: false
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
when: bgp_isolate
- assert: &true - assert: &true
that: that:
- "result.changed == true" - "result.changed == true"
when: bgp_isolate
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *set1 nxos_bgp: *set1
register: result register: result
when: bgp_isolate
- assert: &false - assert: &false
that: that:
- "result.changed == false" - "result.changed == false"
when: bgp_isolate
- name: "reset isolate" - name: "reset isolate"
nxos_bgp: &reset1 nxos_bgp: &reset1
@ -45,14 +56,18 @@
isolate: true isolate: true
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
when: bgp_isolate
- assert: *true - assert: *true
when: bgp_isolate
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *reset1 nxos_bgp: *reset1
register: result register: result
when: bgp_isolate
- assert: *false - assert: *false
when: bgp_isolate
rescue: rescue:
- debug: msg="Tests can fail on A8 images" - debug: msg="Tests can fail on A8 images"

View file

@ -3,6 +3,14 @@
- debug: msg="Using provider={{ connection.transport }}" - debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local" when: ansible_connection == "local"
- set_fact: bgp_best_path_limit="false"
- set_fact: bgp_best_path_limit="true"
when: imagetag is not search("I2")
- set_fact: bgp_suppress_fib_supported="false"
- set_fact: bgp_suppress_fib_supported="true"
when: imagetag is not search("A8|D1|I2|I4")
- name: "Disable feature BGP" - name: "Disable feature BGP"
nxos_feature: nxos_feature:
feature: bgp feature: bgp
@ -57,11 +65,13 @@
nxos_bgp: *reset1 nxos_bgp: *reset1
with_items: "{{ vrfs }}" with_items: "{{ vrfs }}"
register: result register: result
when: bgp_best_path_limit
- assert: *false - assert: *false
when: bgp_best_path_limit
# this task will fail on n9k running I2 or I4 # Property does not nvgen on some images
# due to no support # still try and set it but don't check idempotence
- name: "set suppress fib" - name: "set suppress fib"
nxos_bgp: &set2 nxos_bgp: &set2
asn: 65535 asn: 65535
@ -70,12 +80,15 @@
register: result register: result
- assert: *true - assert: *true
when: bgp_suppress_fib_supported
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *set2 nxos_bgp: *set2
register: result register: result
when: bgp_suppress_fib_supported
- assert: *false - assert: *false
when: bgp_suppress_fib_supported
- name: "reset suppress fib" - name: "reset suppress fib"
nxos_bgp: &reset2 nxos_bgp: &reset2
@ -85,12 +98,15 @@
register: result register: result
- assert: *true - assert: *true
when: bgp_suppress_fib_supported
- name: "Check Idempotence" - name: "Check Idempotence"
nxos_bgp: *reset2 nxos_bgp: *reset2
register: result register: result
when: bgp_suppress_fib_supported
- assert: *false - assert: *false
when: bgp_suppress_fib_supported
rescue: rescue:
- debug: msg="Tests can fail on I2/I4/A8/Fretta or helsinki images" - debug: msg="Tests can fail on I2/I4/A8/Fretta or helsinki images"

View file

@ -82,21 +82,26 @@
# Create matrix of simple keys based on platform # Create matrix of simple keys based on platform
# and image version for use within test playbooks. # and image version for use within test playbooks.
- set_fact: imagetag="" - set_fact: imagetag=""
- set_fact: imagetag="I2" - set_fact: imagemr=""
when: image_version is search("7.0\(3\)I2")
- set_fact: imagetag="I3" # Examples
when: image_version is search("7.0\(3\)I3") # 8.0(1)
- set_fact: imagetag="I4" # 7.3(0)D1(1)
when: image_version is search("7.0\(3\)I4") # 7.0(3)IHD8(1)
- set_fact: imagetag="I5" - set_fact: imagetag="{{ image_version[0:3] }}"
when: image_version is search("7.0\(3\)I5") when: image_version is search("\d\.\d\(\d\)")
- set_fact: imagetag="I6" - set_fact: imagetag="{{ image_version[6:8] }}"
when: image_version is search("7.0\(3\)I6") when: image_version is search("\d\.\d\(\d\)\S\S\(\d\)")
- set_fact: imagetag="I7" - set_fact: imagetag="{{ image_version[6:10] }}"
when: image_version is search("7.0\(3\)I7") when: image_version is search("\d\.\d\(\d\)\S\S\S\S\(\d\)")
- set_fact: imagetag="F1"
when: image_version is search("7.0\(3\)F1") - set_fact: imagemr="{{ image_version[4:5] }}"
- set_fact: imagetag="F2" when: image_version is search("\d\.\d\(\d\)")
when: image_version is search("7.0\(3\)F2") - set_fact: imagemr="{{ image_version[9:10] }}"
- set_fact: imagetag="F3" when: image_version is search("\d\.\d\(\d\)\S\S\(\d\)")
when: image_version is search("7.0\(3\)F3") - set_fact: imagemr="{{ image_version[11:12] }}"
when: image_version is search("\d\.\d\(\d\)\S\S\S\S\(\d\)")
- debug: msg="IMAGE VERSION {{ image_version }}"
- debug: msg="IMAGE TAG {{ imagetag }}"
- debug: msg="IMAGE MR {{ imagemr }}"