1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02: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:
Nathaniel Case 2017-12-19 15:49:49 -05:00 committed by GitHub
parent f64b276f6a
commit 513c75079e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 393 additions and 249 deletions

View file

@ -41,7 +41,7 @@ class ActionModule(_ActionModule):
try: try:
self._handle_template() self._handle_template()
except ValueError as exc: except ValueError as exc:
return dict(failed=True, msg=exc.message) return dict(failed=True, msg=to_text(exc))
result = super(ActionModule, self).run(tmp, task_vars) result = super(ActionModule, self).run(tmp, task_vars)
@ -55,7 +55,7 @@ class ActionModule(_ActionModule):
# strip out any keys that have two leading and two trailing # strip out any keys that have two leading and two trailing
# underscore characters # underscore characters
for key in result.keys(): for key in list(result.keys()):
if PRIVATE_KEYS_RE.match(key): if PRIVATE_KEYS_RE.match(key):
del result[key] del result[key]

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" #" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -1,9 +1,12 @@
--- ---
- debug: msg="START cli/basic-login.yaml on connection={{ ansible_connection }}"
- name: Remove previous login banner - name: Remove previous login banner
eos_config: eos_config:
lines: no banner login lines: no banner login
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Create login banner - name: Create login banner
eos_banner: eos_banner:
@ -14,6 +17,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -32,6 +36,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -47,6 +52,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -62,6 +68,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:

View file

@ -1,9 +1,12 @@
--- ---
- debug: msg="START cli/basic-motd.yaml on connection={{ ansible_connection }}"
- name: Remove previous motd banner - name: Remove previous motd banner
eos_config: eos_config:
lines: no banner motd lines: no banner motd
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Create motd - name: Create motd
eos_banner: eos_banner:
@ -15,6 +18,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -35,6 +39,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -54,6 +59,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -73,6 +79,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/bad_operator.yaml" - debug: msg="START cli/bad_operator.yaml on connection={{ ansible_connection }}"
- name: test bad operator - name: test bad operator
eos_command: eos_command:
@ -17,4 +17,4 @@
- "result.failed == true" - "result.failed == true"
- "result.msg is defined" - "result.msg is defined"
- debug: msg="END cli/bad_operator.yaml" - debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/contains.yaml" - debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}"
- name: test contains operator - name: test contains operator
eos_command: eos_command:
@ -17,4 +17,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/contains.yaml" - debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/equal.yaml" - debug: msg="START cli/equal.yaml on connection={{ ansible_connection }}"
- name: test eq operator - name: test eq operator
eos_command: eos_command:
@ -31,4 +31,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/equal.yaml" - debug: msg="END cli/equal.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/greaterthan.yaml" - debug: msg="START cli/greaterthan.yaml on connection={{ ansible_connection }}"
- name: test gt operator - name: test gt operator
eos_command: eos_command:
@ -31,4 +31,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/greaterthan.yaml" - debug: msg="END cli/greaterthan.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/greaterthanorequal.yaml" - debug: msg="START cli/greaterthanorequal.yaml on connection={{ ansible_connection }}"
- name: test ge operator - name: test ge operator
eos_command: eos_command:
@ -31,4 +31,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/greaterthanorequal.yaml" - debug: msg="END cli/greaterthanorequal.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/invalid.yaml" - debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}"
- name: run invalid command - name: run invalid command
eos_command: eos_command:
@ -27,4 +27,4 @@
- "result.failed == true" - "result.failed == true"
- "result.msg is defined" - "result.msg is defined"
- debug: msg="END cli/invalid.yaml" - debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/lessthan.yaml" - debug: msg="START cli/lessthan.yaml on connection={{ ansible_connection }}"
- name: test lt operator - name: test lt operator
eos_command: eos_command:
@ -31,4 +31,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/lessthan.yaml" - debug: msg="END cli/lessthan.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/lessthanorequal.yaml" - debug: msg="START cli/lessthanorequal.yaml on connection={{ ansible_connection }}"
- name: test le operator - name: test le operator
eos_command: eos_command:
@ -31,4 +31,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/lessthanorequal.yaml" - debug: msg="END cli/lessthanorequal.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/notequal.yaml" - debug: msg="START cli/notequal.yaml on connection={{ ansible_connection }}"
- name: test neq operator - name: test neq operator
eos_command: eos_command:
@ -31,4 +31,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/notequal.yaml" - debug: msg="END cli/notequal.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/output.yaml" - debug: msg="START cli/output.yaml on connection={{ ansible_connection }}"
- name: get output for single command - name: get output for single command
eos_command: eos_command:
@ -25,4 +25,4 @@
- "result.changed == false" - "result.changed == false"
- "result.stdout is defined" - "result.stdout is defined"
- debug: msg="END cli/output.yaml" - debug: msg="END cli/output.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/timeout.yaml" - debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}"
- name: test bad condition - name: test bad condition
eos_command: eos_command:
@ -16,4 +16,4 @@
- "result.failed == true" - "result.failed == true"
- "result.msg is defined" - "result.msg is defined"
- debug: msg="END cli/timeout.yaml" - debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}"

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/backup.yaml" - debug: msg="START cli/backup.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -10,13 +10,14 @@
- interface Ethernet2 - interface Ethernet2
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: collect any backup files - name: collect any backup files
find: find:
paths: "{{ role_path }}/backup" paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*" pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files register: backup_files
delegate_to: localhost connection: local
- name: delete backup files - name: delete backup files
file: file:
@ -29,6 +30,7 @@
src: basic/config.j2 src: basic/config.j2
backup: yes backup: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -41,10 +43,10 @@
paths: "{{ role_path }}/backup" paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*" pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files register: backup_files
delegate_to: localhost connection: local
- assert: - assert:
that: that:
- "backup_files.files is defined" - "backup_files.files is defined"
- debug: msg="END cli/backup.yaml" - debug: msg="END cli/backup.yaml on connection={{ ansible_connection }}"

View file

@ -1,16 +1,18 @@
--- ---
- debug: msg="START cli/config.yaml" - debug: msg="START cli/config.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
lines: hostname {{ inventory_hostname_short }} lines: hostname {{ inventory_hostname_short }}
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: get current running-config - name: get current running-config
eos_command: eos_command:
commands: show running-config commands: show running-config
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: config register: config
- name: configure hostname - name: configure hostname
@ -18,6 +20,7 @@
lines: hostname foo lines: hostname foo
config: "{{ config.stdout[0] }}" config: "{{ config.stdout[0] }}"
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -29,6 +32,7 @@
eos_command: eos_command:
commands: show running-config commands: show running-config
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: config register: config
- name: configure hostname again - name: configure hostname again
@ -36,6 +40,7 @@
lines: hostname foo lines: hostname foo
config: "{{ config.stdout[0] }}" config: "{{ config.stdout[0] }}"
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -47,5 +52,6 @@
lines: hostname {{ inventory_hostname_short }} lines: hostname {{ inventory_hostname_short }}
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/config.yaml" - debug: msg="END cli/config.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/defaults.yaml" - debug: msg="START cli/defaults.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -10,12 +10,14 @@
- interface Ethernet2 - interface Ethernet2
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure device with defaults included - name: configure device with defaults included
eos_config: eos_config:
src: defaults/config.j2 src: defaults/config.j2
defaults: yes defaults: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- debug: var=result - debug: var=result
@ -30,6 +32,7 @@
src: defaults/config.j2 src: defaults/config.j2
defaults: yes defaults: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- debug: var=result - debug: var=result
@ -39,4 +42,4 @@
- "result.changed == false" - "result.changed == false"
- "result.updates is not defined" - "result.updates is not defined"
- debug: msg="END cli/defaults.yaml" - debug: msg="END cli/defaults.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/save.yaml" - debug: msg="START cli/save.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -10,12 +10,14 @@
- interface Ethernet2 - interface Ethernet2
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: save config always - name: save config always
eos_config: eos_config:
save_when: always save_when: always
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -26,10 +28,11 @@
eos_config: eos_config:
save_when: always save_when: always
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
that: that:
- "result.changed == true" - "result.changed == true"
- debug: msg="END cli/save.yaml" - debug: msg="END cli/save.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/src_basic.yaml" - debug: msg="START cli/src_basic.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -10,11 +10,13 @@
- interface Ethernet2 - interface Ethernet2
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure device with config - name: configure device with config
eos_config: eos_config:
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -28,6 +30,7 @@
src: basic/config.j2 src: basic/config.j2
defaults: yes defaults: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -36,4 +39,4 @@
# https://github.com/ansible/ansible-modules-core/issues/4807 # https://github.com/ansible/ansible-modules-core/issues/4807
- "result.updates is not defined" - "result.updates is not defined"
- debug: msg="END cli/src_basic.yaml" - debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/src_invalid.yaml" - debug: msg="START cli/src_invalid.yaml on connection={{ ansible_connection }}"
# Defend https://github.com/ansible/ansible-modules-core/issues/4797 # Defend https://github.com/ansible/ansible-modules-core/issues/4797
@ -7,6 +7,7 @@
eos_config: eos_config:
src: basic/foobar.j2 src: basic/foobar.j2
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
ignore_errors: yes ignore_errors: yes
@ -16,4 +17,4 @@
- "result.failed == true" - "result.failed == true"
- "result.msg == 'path specified in src not found'" - "result.msg == 'path specified in src not found'"
- debug: msg="END cli/src_invalid.yaml" - debug: msg="END cli/src_invalid.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/src_match_none.yaml" - debug: msg="START cli/src_match_none.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -10,12 +10,14 @@
- interface Ethernet2 - interface Ethernet2
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure device with config - name: configure device with config
eos_config: eos_config:
src: basic/config.j2 src: basic/config.j2
provider: "{{ cli }}" provider: "{{ cli }}"
match: none match: none
become: yes
register: result register: result
- assert: - assert:
@ -29,6 +31,7 @@
src: basic/config.j2 src: basic/config.j2
defaults: yes defaults: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -38,4 +41,4 @@
- "result.changed == false" - "result.changed == false"
- "result.updates is not defined" - "result.updates is not defined"
- debug: msg="END cli/src_match_none.yaml" - debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}"

View file

@ -1,17 +1,19 @@
--- ---
- debug: msg="START cli/sublevel.yaml" - debug: msg="START cli/sublevel.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
lines: no vlan 10 lines: no vlan 10
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure sub level command - name: configure sub level command
eos_config: eos_config:
lines: name test lines: name test
parents: vlan 10 parents: vlan 10
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -25,6 +27,7 @@
lines: name test lines: name test
parents: vlan 10 parents: vlan 10
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -36,6 +39,7 @@
lines: no vlan 10 lines: no vlan 10
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/sublevel.yaml" - debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/sublevel_block.yaml" - debug: msg="START cli/sublevel_block.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -12,6 +12,7 @@
after: exit after: exit
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure sub level command using block resplace - name: configure sub level command using block resplace
eos_config: eos_config:
@ -24,6 +25,7 @@
replace: block replace: block
after: exit after: exit
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -46,6 +48,7 @@
replace: block replace: block
after: exit after: exit
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -57,5 +60,6 @@
lines: no ip access-list test lines: no ip access-list test
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/sublevel_block.yaml" - debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/sublevel_exact.yaml" - debug: msg="START cli/sublevel_exact.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -14,6 +14,7 @@
after: exit after: exit
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure sub level command using exact match - name: configure sub level command using exact match
eos_config: eos_config:
@ -28,6 +29,7 @@
match: exact match: exact
replace: block replace: block
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -50,6 +52,7 @@
parents: ip access-list test parents: ip access-list test
match: exact match: exact
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -61,5 +64,6 @@
lines: no ip access-list test lines: no ip access-list test
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/sublevel_exact.yaml" - debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/sublevel_strict.yaml" - debug: msg="START cli/sublevel_strict.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -14,6 +14,7 @@
after: exit after: exit
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure sub level command using strict match - name: configure sub level command using strict match
eos_config: eos_config:
@ -28,6 +29,7 @@
match: strict match: strict
replace: block replace: block
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -50,6 +52,7 @@
parents: ip access-list test parents: ip access-list test
match: strict match: strict
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -61,5 +64,6 @@
lines: no ip access-list test lines: no ip access-list test
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/sublevel_strict.yaml" - debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}"

View file

@ -1,16 +1,18 @@
--- ---
- debug: msg="START cli/toplevel.yaml" - debug: msg="START cli/toplevel.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
lines: hostname veos01 lines: hostname veos01
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure top level command - name: configure top level command
eos_config: eos_config:
lines: hostname foo lines: hostname foo
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -22,6 +24,7 @@
eos_config: eos_config:
lines: hostname foo lines: hostname foo
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -33,5 +36,6 @@
lines: hostname veos01 lines: hostname veos01
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/toplevel.yaml" - debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/toplevel_after.yaml" - debug: msg="START cli/toplevel_after.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -8,12 +8,14 @@
- hostname veos01 - hostname veos01
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure top level command with before - name: configure top level command with before
eos_config: eos_config:
lines: hostname foo lines: hostname foo
after: snmp-server contact bar after: snmp-server contact bar
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -27,6 +29,7 @@
lines: hostname foo lines: hostname foo
after: snmp-server contact foo after: snmp-server contact foo
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -40,5 +43,6 @@
- hostname veos01 - hostname veos01
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/toplevel_after.yaml" - debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/toplevel_before.yaml" - debug: msg="START cli/toplevel_before.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -8,12 +8,14 @@
- hostname veos01 - hostname veos01
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure top level command with before - name: configure top level command with before
eos_config: eos_config:
lines: hostname foo lines: hostname foo
before: snmp-server contact bar before: snmp-server contact bar
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -27,6 +29,7 @@
lines: hostname foo lines: hostname foo
before: snmp-server contact foo before: snmp-server contact foo
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -40,5 +43,6 @@
- no snmp-server contact - no snmp-server contact
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/toplevel_before.yaml" - debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}"

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,27 +1,26 @@
- debug: msg="START cli/config.yaml" ---
- debug: msg="START cli/config.yaml on connection={{ ansible_connection }}"
#----
- name: Setup - name: Setup
eos_config: eos_config:
lines: no management api http-commands lines: no management api http-commands
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
connection: local become: yes
- name: Get running-config - name: Get running-config
eos_command: eos_command:
commands: show running-config commands: show running-config
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: config register: config
connection: local
- name: Set config - name: Set config
eos_eapi: eos_eapi:
config: "{{ config.stdout[0] }}" config: "{{ config.stdout[0] }}"
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: config register: config
connection: local
- name: Ensure that this triggered a change - name: Ensure that this triggered a change
assert: assert:
@ -33,15 +32,15 @@
eos_command: eos_command:
commands: show running-config commands: show running-config
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: config register: config
connection: local
- name: Set config - name: Set config
eos_eapi: eos_eapi:
config: "{{ config.stdout[0] }}" config: "{{ config.stdout[0] }}"
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: config register: config
connection: local
- name: Idempotency check - name: Idempotency check
@ -49,4 +48,4 @@
that: that:
- "config.changed == false" - "config.changed == false"
- debug: msg="END cli/config.yaml" - debug: msg="END cli/config.yaml on connection={{ ansible_connection }}"

View file

@ -8,15 +8,14 @@
enable_local_http: yes enable_local_http: yes
local_http_port: 8181 local_http_port: 8181
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- eos_command: - eos_command:
commands: commands:
- show management api http-commands | json - show management api http-commands | json
provider: "{{ cli }}" provider: "{{ cli }}"
register: http_config register: http_config
connection: local
- name: Expect endpoint ports to be set - name: Expect endpoint ports to be set
assert: assert:
@ -32,8 +31,8 @@
enable_local_http: yes enable_local_http: yes
local_http_port: 8181 local_http_port: 8181
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- name: Expect action to be idempotent - name: Expect action to be idempotent
assert: assert:

View file

@ -7,8 +7,8 @@
enable_local_http: no enable_local_http: no
enable_socket: no enable_socket: no
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- debug: var=eos_eapi_output - debug: var=eos_eapi_output
@ -17,7 +17,6 @@
- show management api http-commands | json - show management api http-commands | json
provider: "{{ cli }}" provider: "{{ cli }}"
register: http_config register: http_config
connection: local
- debug: var=http_config - debug: var=http_config
@ -36,8 +35,8 @@
enable_local_http: no enable_local_http: no
enable_socket: no enable_socket: no
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- debug: var=eos_eapi_output - debug: var=eos_eapi_output
when: debug when: debug

View file

@ -7,15 +7,14 @@
enable_local_http: yes enable_local_http: yes
enable_socket: yes enable_socket: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- eos_command: - eos_command:
commands: commands:
- show management api http-commands | json - show management api http-commands | json
provider: "{{ cli }}" provider: "{{ cli }}"
register: http_config register: http_config
connection: local
- debug: var=http_config - debug: var=http_config
when: debug when: debug
@ -35,8 +34,8 @@
enable_local_http: yes enable_local_http: yes
enable_socket: yes enable_socket: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- debug: var=eos_eapi_output - debug: var=eos_eapi_output

View file

@ -4,15 +4,14 @@
eos_eapi: eos_eapi:
state: started state: started
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- eos_command: - eos_command:
commands: commands:
- show management api http-commands | json - show management api http-commands | json
provider: "{{ cli }}" provider: "{{ cli }}"
register: http_config register: http_config
connection: local
- debug: var=http_config - debug: var=http_config
when: debug when: debug
@ -25,8 +24,8 @@
eos_eapi: eos_eapi:
state: started state: started
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- debug: var=eos_eapi_output - debug: var=eos_eapi_output
when: debug when: debug

View file

@ -4,15 +4,14 @@
eos_eapi: eos_eapi:
state: stopped state: stopped
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- eos_command: - eos_command:
commands: commands:
- show management api http-commands | json - show management api http-commands | json
provider: "{{ cli }}" provider: "{{ cli }}"
register: http_config register: http_config
connection: local
- debug: var=http_config - debug: var=http_config
when: debug when: debug
@ -25,8 +24,8 @@
eos_eapi: eos_eapi:
state: stopped state: stopped
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- debug: var=eos_eapi_output - debug: var=eos_eapi_output
when: debug when: debug

View file

@ -1,13 +1,12 @@
- debug: msg="START cli/vrf.yaml" ---
- debug: msg="START cli/vrf.yaml on connection={{ ansible_connection }}"
#----
- name: Set invalid VRF - name: Set invalid VRF
eos_eapi: eos_eapi:
vrf: foobar vrf: foobar
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
ignore_errors: true ignore_errors: true
- name: Ensure that setting VRF failed - name: Ensure that setting VRF failed
@ -22,8 +21,8 @@
eos_eapi: eos_eapi:
vrf: default vrf: default
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
ignore_errors: true ignore_errors: true
@ -31,8 +30,8 @@
eos_eapi: eos_eapi:
vrf: default vrf: default
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: eos_eapi_output register: eos_eapi_output
connection: local
- name: Ensure idempotent - name: Ensure idempotent
assert: assert:
@ -48,10 +47,9 @@
commands: show vrf commands: show vrf
provider: "{{ cli }}" provider: "{{ cli }}"
register: eos_eapi_output register: eos_eapi_output
connection: local
when: false when: false
#- debug: #- debug:
# msg: "{{ eos_eapi_output }}" # msg: "{{ eos_eapi_output }}"
- debug: msg="END cli/vrf.yaml" - debug: msg="END cli/vrf.yaml on connection={{ ansible_connection }}"

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/all_facts.yaml" - debug: msg="START cli/all_facts.yaml on connection={{ ansible_connection }}"
- name: test getting all facts - name: test getting all facts
@ -7,6 +7,7 @@
provider: "{{ cli }}" provider: "{{ cli }}"
gather_subset: gather_subset:
- all - all
become: yes
register: result register: result
@ -28,4 +29,4 @@
- "result.ansible_facts.ansible_net_memfree_mb > 1" - "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1" - "result.ansible_facts.ansible_net_memtotal_mb > 1"
- debug: msg="END cli/all_facts.yaml" - debug: msg="END cli/all_facts.yaml on connection={{ ansible_connection }}"

View file

@ -1,10 +1,11 @@
--- ---
- debug: msg="START cli/default_facts.yaml" - debug: msg="START cli/default_facts.yaml on connection={{ ansible_connection }}"
- name: test getting default facts - name: test getting default facts
eos_facts: eos_facts:
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -28,4 +29,4 @@
# ... and not present # ... and not present
- "result.ansible_facts.ansible_net_config is not defined" # config - "result.ansible_facts.ansible_net_config is not defined" # config
- debug: msg="END cli/default.yaml" - debug: msg="END cli/default.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/invalid_subset.yaml" - debug: msg="START cli/invalid_subset.yaml on connection={{ ansible_connection }}"
- name: test invalid subset (foobar) - name: test invalid subset (foobar)
@ -45,4 +45,4 @@
- debug: msg="END cli/invalid_subset.yaml" - debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/not_hardware_facts.yaml" - debug: msg="START cli/not_hardware_facts.yaml on connection={{ ansible_connection }}"
- name: test not hardware - name: test not hardware
@ -7,6 +7,7 @@
provider: "{{ cli }}" provider: "{{ cli }}"
gather_subset: gather_subset:
- "!hardware" - "!hardware"
become: yes
register: result register: result
- assert: - assert:
@ -27,4 +28,4 @@
# ... and not present # ... and not present
- "result.ansible_facts.ansible_net_filesystems is not defined" - "result.ansible_facts.ansible_net_filesystems is not defined"
- debug: msg="END cli/not_hardware_facts.yaml" - debug: msg="END cli/not_hardware_facts.yaml on connection={{ ansible_connection }}"

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -1,4 +1,6 @@
--- ---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
- name: Set up host logging - name: Set up host logging
eos_logging: eos_logging:
dest: host dest: host
@ -6,6 +8,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -20,6 +23,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -33,6 +37,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -47,6 +52,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -60,6 +66,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -73,6 +80,7 @@
size: 480000 size: 480000
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -87,6 +95,7 @@
- { dest: buffered, size: 480000, state: absent } - { dest: buffered, size: 480000, state: absent }
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/basic.yaml" - debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
- name: setup - remove config used in test - name: setup - remove config used in test
eos_config: eos_config:
@ -9,6 +9,7 @@
- no ip route 192.168.5.0/24 192.168.0.1 - no ip route 192.168.5.0/24 192.168.0.1
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure static route - name: configure static route
eos_static_route: &single_route eos_static_route: &single_route
@ -17,6 +18,7 @@
admin_distance: 2 admin_distance: 2
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -26,6 +28,7 @@
- name: configure static route(Idempotence) - name: configure static route(Idempotence)
eos_static_route: *single_route eos_static_route: *single_route
become: yes
register: result register: result
- assert: - assert:
@ -40,6 +43,7 @@
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
state: absent state: absent
become: yes
register: result register: result
- assert: - assert:
@ -49,6 +53,7 @@
- name: delete static route - name: delete static route
eos_static_route: *delete_single eos_static_route: *delete_single
become: yes
register: result register: result
- assert: - assert:
@ -62,6 +67,7 @@
- { address: 192.168.5.0/24, next_hop: 192.168.0.1 } - { address: 192.168.5.0/24, next_hop: 192.168.0.1 }
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -72,6 +78,7 @@
- name: configure static routes using aggregate(Idemporence) - name: configure static routes using aggregate(Idemporence)
eos_static_route: *configure_aggregate eos_static_route: *configure_aggregate
become: yes
register: result register: result
- assert: - assert:
@ -86,6 +93,7 @@
authorize: yes authorize: yes
state: absent state: absent
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -96,6 +104,7 @@
- name: delete static routes using aggregate(Idempotence) - name: delete static routes using aggregate(Idempotence)
eos_static_route: *delete_aggregate eos_static_route: *delete_aggregate
become: yes
register: result register: result
- assert: - assert:
@ -110,5 +119,6 @@
- no ip route 192.168.5.0/24 192.168.0.1 - no ip route 192.168.5.0/24 192.168.0.1
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/basic.yaml" - debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" #" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" #" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/set_domain_list.yaml" - debug: msg="START cli/set_domain_list.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -8,6 +8,7 @@
- no ip domain-list redhat.com - no ip domain-list redhat.com
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure domain_list - name: configure domain_list
eos_system: eos_system:
@ -15,6 +16,7 @@
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -29,6 +31,7 @@
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -40,6 +43,7 @@
domain_list: domain_list:
- ansible.com - ansible.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -52,6 +56,7 @@
domain_list: domain_list:
- ansible.com - ansible.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -64,6 +69,7 @@
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -77,6 +83,7 @@
- ansible.com - ansible.com
- redhat.com - redhat.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -89,6 +96,7 @@
- ansible.com - ansible.com
- eng.ansible.com - eng.ansible.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -104,6 +112,7 @@
- ansible.com - ansible.com
- eng.ansible.com - eng.ansible.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -118,5 +127,6 @@
- no ip domain-list eng.ansible.com - no ip domain-list eng.ansible.com
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/set_domain_list.yaml" - debug: msg="END cli/set_domain_list.yaml on connection={{ ansible_connection }}"

View file

@ -1,16 +1,18 @@
--- ---
- debug: msg="START cli/set_domain_name.yaml" - debug: msg="START cli/set_domain_name.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
lines: no ip domain-name lines: no ip domain-name
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure domain_name - name: configure domain_name
eos_system: eos_system:
domain_name: eng.ansible.com domain_name: eng.ansible.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -21,6 +23,7 @@
eos_system: eos_system:
domain_name: eng.ansible.com domain_name: eng.ansible.com
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -32,5 +35,6 @@
lines: no ip domain-name lines: no ip domain-name
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/set_domain_name.yaml" - debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}"

View file

@ -1,16 +1,18 @@
--- ---
- debug: msg="START cli/set_hostname.yaml" - debug: msg="START cli/set_hostname.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
lines: hostname switch lines: hostname switch
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure hostname - name: configure hostname
eos_system: eos_system:
hostname: foo hostname: foo
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -21,6 +23,7 @@
eos_system: eos_system:
hostname: foo hostname: foo
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -32,5 +35,6 @@
lines: "hostname {{ inventory_hostname }}" lines: "hostname {{ inventory_hostname }}"
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/set_hostname.yaml" - debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/set_lookup_source.yaml" - debug: msg="START cli/set_lookup_source.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -8,11 +8,13 @@
- vrf definition ansible - vrf definition ansible
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure lookup_source - name: configure lookup_source
eos_system: eos_system:
lookup_source: Management1 lookup_source: Management1
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -24,6 +26,7 @@
eos_system: eos_system:
lookup_source: Management1 lookup_source: Management1
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -36,6 +39,7 @@
- interface: Management1 - interface: Management1
vrf: ansible vrf: ansible
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -51,6 +55,7 @@
- interface: Management1 - interface: Management1
vrf: ansible vrf: ansible
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -64,5 +69,6 @@
- no vrf definition ansible - no vrf definition ansible
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/set_lookup_source.yaml" - debug: msg="END cli/set_lookup_source.yaml on connection={{ ansible_connection }}"

View file

@ -1,5 +1,5 @@
--- ---
- debug: msg="START cli/set_name_servers.yaml" - debug: msg="START cli/set_name_servers.yaml on connection={{ ansible_connection }}"
- name: setup - name: setup
eos_config: eos_config:
@ -8,6 +8,7 @@
- vrf definition ansible - vrf definition ansible
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: configure name_servers - name: configure name_servers
eos_system: eos_system:
@ -16,6 +17,7 @@
- 2.2.2.2 - 2.2.2.2
- 3.3.3.3 - 3.3.3.3
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -33,6 +35,7 @@
- 2.2.2.2 - 2.2.2.2
- 3.3.3.3 - 3.3.3.3
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -74,6 +77,7 @@
- 1.1.1.1 - 1.1.1.1
- 2.2.2.2 - 2.2.2.2
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -89,5 +93,6 @@
- no vrf definition ansible - no vrf definition ansible
match: none match: none
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- debug: msg="END cli/set_name_servers.yaml" - debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection }}"

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -3,26 +3,14 @@
find: find:
paths: "{{ role_path }}/tests/eapi" paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases register: test_cases
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: enable eapi - name: run test case (connection=local)
eos_eapi: include: "{{ test_case_to_run }} ansible_connection=local"
http: yes
https: yes
local_http: no
enable_socket: yes
provider: "{{ cli }}"
- name: run test case
include: "{{ test_case_to_run }}"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: disable eapi
eos_eapi:
state: stopped
provider: "{{ cli }}"

View file

@ -9,6 +9,7 @@
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
configured_password: pass123 configured_password: pass123
become: yes
- name: test login - name: test login
expect: expect:
@ -36,4 +37,5 @@
state: absent state: absent
provider: "{{ cli }}" provider: "{{ cli }}"
authorize: yes authorize: yes
become: yes
register: result register: result

View file

@ -1,4 +1,6 @@
--- ---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
- name: Set Up - name: Set Up
eos_config: eos_config:
lines: lines:
@ -7,6 +9,7 @@
- no username ansibletest3 - no username ansibletest3
- no username ansibletest4 - no username ansibletest4
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Create user with role - name: Create user with role
eos_user: eos_user:
@ -17,6 +20,7 @@
configured_password: test1 configured_password: test1
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -36,6 +40,7 @@
authorize: yes authorize: yes
update_password: on_create update_password: on_create
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -54,6 +59,7 @@
state: present state: present
role: network-operator role: network-operator
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -73,6 +79,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
ignore_errors: yes ignore_errors: yes
register: result register: result
@ -90,3 +97,5 @@
- no username ansibletest3 - no username ansibletest3
- no username ansibletest4 - no username ansibletest4
provider: "{{ cli }}" provider: "{{ cli }}"
authorize: yes
become: yes

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -8,6 +8,7 @@
- no vlan 4002 - no vlan 4002
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: setup - remove switchport settings on interface Ethernet1 used in test - name: setup - remove switchport settings on interface Ethernet1 used in test
eos_config: eos_config:
@ -17,6 +18,7 @@
parents: interface Ethernet1 parents: interface Ethernet1
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: setup - remove switchport settings on interface Ethernet2 used in test - name: setup - remove switchport settings on interface Ethernet2 used in test
eos_config: eos_config:
@ -26,6 +28,7 @@
parents: interface Ethernet2 parents: interface Ethernet2
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Create vlan - name: Create vlan
eos_vlan: eos_vlan:
@ -34,6 +37,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -51,6 +55,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -67,6 +72,7 @@
state: suspend state: suspend
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -85,6 +91,7 @@
state: suspend state: suspend
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -100,6 +107,7 @@
state: active state: active
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -119,6 +127,7 @@
- Ethernet2 - Ethernet2
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -141,6 +150,7 @@
- Ethernet2 - Ethernet2
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -158,6 +168,7 @@
- Ethernet1 - Ethernet1
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -177,6 +188,7 @@
- Ethernet1 - Ethernet1
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -194,6 +206,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -213,6 +226,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -231,6 +245,7 @@
purge: yes purge: yes
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -251,6 +266,7 @@
purge: yes purge: yes
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:

View file

@ -4,12 +4,19 @@
paths: "{{ role_path }}/tests/cli" paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml" patterns: "{{ testcase }}.yaml"
register: test_cases register: test_cases
delegate_to: localhost
- name: set test_items - name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case - name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }}" include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}" with_items: "{{ test_items }}"
loop_control: loop_control:
loop_var: test_case_to_run loop_var: test_case_to_run
- name: run test case (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
with_first_found: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -6,6 +6,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: setup - remove vrf - name: setup - remove vrf
eos_vrf: eos_vrf:
@ -13,6 +14,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: setup - remove vrf - name: setup - remove vrf
eos_vrf: eos_vrf:
@ -20,6 +22,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Create vrf - name: Create vrf
eos_vrf: eos_vrf:
@ -28,6 +31,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -45,6 +49,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -61,6 +66,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -78,6 +84,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -96,6 +103,7 @@
interfaces: interfaces:
- Ethernet2 - Ethernet2
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -115,6 +123,7 @@
interfaces: interfaces:
- Ethernet2 - Ethernet2
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -132,6 +141,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -152,6 +162,7 @@
state: present state: present
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -170,6 +181,7 @@
purge: yes purge: yes
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
register: result register: result
- assert: - assert:
@ -191,6 +203,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Delete VRFs again (idempotent) - name: Delete VRFs again (idempotent)
eos_vrf: eos_vrf:
@ -198,6 +211,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Delete aggregate of VRFs - name: Delete aggregate of VRFs
eos_vrf: eos_vrf:
@ -209,6 +223,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
- name: Delete VRFs again (idempotent) - name: Delete VRFs again (idempotent)
eos_vrf: eos_vrf:
@ -220,6 +235,7 @@
state: absent state: absent
authorize: yes authorize: yes
provider: "{{ cli }}" provider: "{{ cli }}"
become: yes
# FIXME add in tests for everything defined in docs # FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test: # FIXME Test state:absent + test:

View file

@ -4,9 +4,8 @@
- no shutdown - no shutdown
- no switchport - no switchport
parents: int Ethernet1 parents: int Ethernet1
authorize: yes become: yes
provider: "{{ cli }}" connection: network_cli
connection: local
- name: Enable Ethernet2 interface and disable switchport - name: Enable Ethernet2 interface and disable switchport
eos_config: eos_config:
@ -14,6 +13,15 @@
- no shutdown - no shutdown
- no switchport - no switchport
parents: int Ethernet2 parents: int Ethernet2
authorize: yes become: yes
provider: "{{ cli }}" connection: network_cli
connection: local
- name: enable eapi
eos_eapi:
http: yes
https: yes
local_http: no
enable_socket: yes
become: yes
connection: network_cli
tags: eapi

View file

@ -72,17 +72,11 @@ class ManageNetworkCI(object):
def wait(self): def wait(self):
"""Wait for instance to respond to ansible ping.""" """Wait for instance to respond to ansible ping."""
if self.core_ci.platform in ('vyos',):
connection_type = 'network_cli'
else:
connection_type = 'local'
extra_vars = [ extra_vars = [
'ansible_host=%s' % self.core_ci.connection.hostname, 'ansible_host=%s' % self.core_ci.connection.hostname,
'ansible_port=%s' % self.core_ci.connection.port, 'ansible_port=%s' % self.core_ci.connection.port,
'ansible_connection=%s' % connection_type, 'ansible_connection=local',
'ansible_ssh_private_key_file=%s' % self.core_ci.ssh_key.key, 'ansible_ssh_private_key_file=%s' % self.core_ci.ssh_key.key,
'ansible_network_os=%s' % self.core_ci.platform,
] ]
name = '%s-%s' % (self.core_ci.platform, self.core_ci.version.replace('.', '-')) name = '%s-%s' % (self.core_ci.platform, self.core_ci.version.replace('.', '-'))