mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Port eos tests to network_cli (#33586)
* Add eos and fix tests to run multiple connections * Update tests to report connection * Add missing START messages * Fix unspecified connection * Python 3 updates Exceptions don't have `.message` in Python 3 * Override `become` when using `connection=local` * Slight restructuring to make eapi easier later on * Move eapi toggle to prepare_eos * Pull out connection on eapi tasks
This commit is contained in:
@@ -1,27 +1,26 @@
|
||||
- debug: msg="START cli/config.yaml"
|
||||
---
|
||||
- debug: msg="START cli/config.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
#----
|
||||
- name: Setup
|
||||
eos_config:
|
||||
lines: no management api http-commands
|
||||
match: none
|
||||
provider: "{{ cli }}"
|
||||
connection: local
|
||||
become: yes
|
||||
|
||||
- name: Get running-config
|
||||
eos_command:
|
||||
commands: show running-config
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: config
|
||||
connection: local
|
||||
|
||||
- name: Set config
|
||||
eos_eapi:
|
||||
config: "{{ config.stdout[0] }}"
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: config
|
||||
connection: local
|
||||
|
||||
- name: Ensure that this triggered a change
|
||||
assert:
|
||||
@@ -33,15 +32,15 @@
|
||||
eos_command:
|
||||
commands: show running-config
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: config
|
||||
connection: local
|
||||
|
||||
- name: Set config
|
||||
eos_eapi:
|
||||
config: "{{ config.stdout[0] }}"
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: config
|
||||
connection: local
|
||||
|
||||
|
||||
- name: Idempotency check
|
||||
@@ -49,4 +48,4 @@
|
||||
that:
|
||||
- "config.changed == false"
|
||||
|
||||
- debug: msg="END cli/config.yaml"
|
||||
- debug: msg="END cli/config.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
@@ -8,15 +8,14 @@
|
||||
enable_local_http: yes
|
||||
local_http_port: 8181
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- eos_command:
|
||||
commands:
|
||||
- show management api http-commands | json
|
||||
provider: "{{ cli }}"
|
||||
register: http_config
|
||||
connection: local
|
||||
|
||||
- name: Expect endpoint ports to be set
|
||||
assert:
|
||||
@@ -32,8 +31,8 @@
|
||||
enable_local_http: yes
|
||||
local_http_port: 8181
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- name: Expect action to be idempotent
|
||||
assert:
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
enable_local_http: no
|
||||
enable_socket: no
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- debug: var=eos_eapi_output
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
- show management api http-commands | json
|
||||
provider: "{{ cli }}"
|
||||
register: http_config
|
||||
connection: local
|
||||
|
||||
- debug: var=http_config
|
||||
|
||||
@@ -36,8 +35,8 @@
|
||||
enable_local_http: no
|
||||
enable_socket: no
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- debug: var=eos_eapi_output
|
||||
when: debug
|
||||
|
||||
@@ -7,15 +7,14 @@
|
||||
enable_local_http: yes
|
||||
enable_socket: yes
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- eos_command:
|
||||
commands:
|
||||
- show management api http-commands | json
|
||||
provider: "{{ cli }}"
|
||||
register: http_config
|
||||
connection: local
|
||||
|
||||
- debug: var=http_config
|
||||
when: debug
|
||||
@@ -35,8 +34,8 @@
|
||||
enable_local_http: yes
|
||||
enable_socket: yes
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- debug: var=eos_eapi_output
|
||||
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
eos_eapi:
|
||||
state: started
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- eos_command:
|
||||
commands:
|
||||
- show management api http-commands | json
|
||||
provider: "{{ cli }}"
|
||||
register: http_config
|
||||
connection: local
|
||||
|
||||
- debug: var=http_config
|
||||
when: debug
|
||||
@@ -25,8 +24,8 @@
|
||||
eos_eapi:
|
||||
state: started
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- debug: var=eos_eapi_output
|
||||
when: debug
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
eos_eapi:
|
||||
state: stopped
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- eos_command:
|
||||
commands:
|
||||
- show management api http-commands | json
|
||||
provider: "{{ cli }}"
|
||||
register: http_config
|
||||
connection: local
|
||||
|
||||
- debug: var=http_config
|
||||
when: debug
|
||||
@@ -25,8 +24,8 @@
|
||||
eos_eapi:
|
||||
state: stopped
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- debug: var=eos_eapi_output
|
||||
when: debug
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
- debug: msg="START cli/vrf.yaml"
|
||||
---
|
||||
- debug: msg="START cli/vrf.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
|
||||
#----
|
||||
- name: Set invalid VRF
|
||||
eos_eapi:
|
||||
vrf: foobar
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure that setting VRF failed
|
||||
@@ -22,8 +21,8 @@
|
||||
eos_eapi:
|
||||
vrf: default
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
@@ -31,8 +30,8 @@
|
||||
eos_eapi:
|
||||
vrf: default
|
||||
provider: "{{ cli }}"
|
||||
become: yes
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
|
||||
- name: Ensure idempotent
|
||||
assert:
|
||||
@@ -48,10 +47,9 @@
|
||||
commands: show vrf
|
||||
provider: "{{ cli }}"
|
||||
register: eos_eapi_output
|
||||
connection: local
|
||||
when: false
|
||||
|
||||
#- debug:
|
||||
# msg: "{{ eos_eapi_output }}"
|
||||
|
||||
- debug: msg="END cli/vrf.yaml"
|
||||
- debug: msg="END cli/vrf.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
Reference in New Issue
Block a user