c371ed8d30
* Fix over-byte * Fix nxos_l2_interface docs * Update connections for tasks * Add default ssh port * Only report provider when using connection=local * Send empty provider when connection=network_cli * Fix find tasks
76 lines
1.6 KiB
YAML
76 lines
1.6 KiB
YAML
---
|
|
- debug: msg="START TRANSPORT:CLI nxos_command sanity test"
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
when: ansible_connection == "local"
|
|
|
|
- name: "Disable feature BGP"
|
|
nxos_feature:
|
|
feature: bgp
|
|
state: disabled
|
|
provider: "{{ cli }}"
|
|
|
|
- block:
|
|
- name: "Run show running-config bgp - should fail"
|
|
nxos_command:
|
|
commands:
|
|
- sh running-config bgp
|
|
provider: "{{ cli }}"
|
|
ignore_errors: yes
|
|
register: result
|
|
|
|
- assert: &fail
|
|
that:
|
|
- "result.failed == true"
|
|
- "'Invalid command' in result.msg"
|
|
|
|
- name: "Enable feature BGP"
|
|
nxos_feature:
|
|
feature: bgp
|
|
state: enabled
|
|
provider: "{{ cli }}"
|
|
|
|
- name: "Configure BGP defaults"
|
|
nxos_bgp: &configure_default
|
|
asn: 65535
|
|
router_id: 1.1.1.1
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert: &true
|
|
that:
|
|
- "result.changed == true"
|
|
|
|
- name: "Run show running-config bgp - should pass"
|
|
nxos_command:
|
|
commands:
|
|
- sh running-config bgp
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == false"
|
|
- "'65535' in result.stdout[0]"
|
|
|
|
- name: "Run an invalid command - should fail"
|
|
nxos_command:
|
|
commands:
|
|
- show interface bief
|
|
provider: "{{ cli }}"
|
|
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
|
|
provider: "{{ cli }}"
|
|
|
|
- debug: msg="END TRANSPORT:CLI nxos_command sanity test"
|