2017-07-12 19:19:02 +02:00
|
|
|
---
|
2018-05-18 00:47:15 +02:00
|
|
|
- debug: msg="START nxapi/sanity.yaml on connection={{ ansible_connection }}"
|
2017-07-12 19:19:02 +02:00
|
|
|
|
|
|
|
- name: "Disable feature BGP"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
|
|
|
state: disabled
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Run show running-config bgp - should fail"
|
|
|
|
nxos_command:
|
|
|
|
commands:
|
|
|
|
- sh running-config bgp
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &fail
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
|
|
|
|
- name: "Enable feature BGP"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
|
|
|
state: enabled
|
|
|
|
|
|
|
|
- name: "Configure BGP defaults"
|
|
|
|
nxos_bgp: &configure_default
|
|
|
|
asn: 65535
|
2018-05-30 19:03:20 +02:00
|
|
|
router_id: 192.0.2.1
|
2017-07-12 19:19:02 +02:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Run show running-config bgp - should pass"
|
|
|
|
nxos_command:
|
2017-09-11 10:45:56 +02:00
|
|
|
commands:
|
2018-05-18 00:47:15 +02:00
|
|
|
- sh running-config bgp
|
2017-07-12 19:19:02 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == false"
|
2017-09-13 15:31:47 +02:00
|
|
|
- "'65535' in result.stdout[0]|to_json"
|
2017-07-12 19:19:02 +02:00
|
|
|
|
|
|
|
- name: "Run an invalid command - should fail"
|
|
|
|
nxos_command:
|
|
|
|
commands:
|
|
|
|
- show interface bief
|
|
|
|
ignore_errors: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *fail
|
|
|
|
|
|
|
|
rescue:
|
|
|
|
- debug: msg="nxos_command sanity test failure detected"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: "Disable feature bgp"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
|
|
|
state: disabled
|
|
|
|
|
2018-05-18 00:47:15 +02:00
|
|
|
- debug: msg="END nxapi/sanity.yaml on connection={{ ansible_connection }}"
|