ansible/test/integration/targets/nxos_bfd_interfaces/tests/cli/overridden.yaml
Chris Van Heuveln f890c9692f nxos_bfd_interfaces: new module (#61407)
* bfd_interfaces: initial commit

* fix state methods, add more UT

* Add integration tests, support for N6K

* minor comment cleanups

* lint 1

* lint 2

* lint 3

* lint 4

* lint 5

* retrigger shippable

* retrigger shippable

* PR review updates: /bfd_echo/echo/, updated tests

* fix overridden logic and integration test
2019-08-29 09:36:10 +05:30

67 lines
1.7 KiB
YAML

---
- debug:
msg: "Start nxos_bfd_interfaces overridden integration tests connection={{ ansible_connection }}"
- set_fact: test_int1="{{ nxos_int1 }}"
- set_fact: test_int2="{{ nxos_int2 }}"
- set_fact:
bfd_enable: enable
bfd_disable: disable
when: platform is not search('N5K|N6K')
- name: setup1
cli_config: &setup_teardown
config: |
no feature bfd
default interface {{ test_int1 }}
default interface {{ test_int2 }}
- block:
- name: setup2
cli_config:
config: |
feature bfd
interface {{ test_int1 }}
no switchport
interface {{ test_int2 }}
no switchport
- name: setup initial bfd state
nxos_bfd_interfaces:
config:
- name: "{{ test_int1 }}"
bfd: "{{ bfd_disable|default(omit)}}"
echo: enable
- name: "{{ test_int2 }}"
bfd: "{{ bfd_enable|default(omit)}}"
echo: disable
state: merged
- name: Overridden
nxos_bfd_interfaces: &overridden
config:
- name: "{{ test_int1 }}"
bfd: "{{ bfd_disable|default(omit)}}"
echo: disable
state: overridden
register: result
- assert:
that:
- result.changed == true
- result.commands[1] == 'bfd echo' # test_int2 reset to defaults
- result.commands[3] == 'no bfd echo' # test_int1 set to playval
msg: "Assert failed. 'result.commands': {{ result.commands }}"
- name: Idempotence - Overridden
nxos_bfd_interfaces: *overridden
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *setup_teardown