diff --git a/lib/ansible/plugins/action/eos_config.py b/lib/ansible/plugins/action/eos_config.py index 9513fe2d3c..276f7b0e3c 100644 --- a/lib/ansible/plugins/action/eos_config.py +++ b/lib/ansible/plugins/action/eos_config.py @@ -41,7 +41,7 @@ class ActionModule(_ActionModule): try: self._handle_template() 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) @@ -55,7 +55,7 @@ class ActionModule(_ActionModule): # strip out any keys that have two leading and two trailing # underscore characters - for key in result.keys(): + for key in list(result.keys()): if PRIVATE_KEYS_RE.match(key): del result[key] diff --git a/test/integration/targets/eos_banner/tasks/cli.yaml b/test/integration/targets/eos_banner/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_banner/tasks/cli.yaml +++ b/test/integration/targets/eos_banner/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_banner/tasks/eapi.yaml b/test/integration/targets/eos_banner/tasks/eapi.yaml index abca2c7ba1..bda1df677a 100644 --- a/test/integration/targets/eos_banner/tasks/eapi.yaml +++ b/test/integration/targets/eos_banner/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - 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 - eos_eapi: - http: yes - https: yes - local_http: no - enable_socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_banner/tests/cli/basic-login.yaml b/test/integration/targets/eos_banner/tests/cli/basic-login.yaml index f8748be57b..beeeb2893d 100644 --- a/test/integration/targets/eos_banner/tests/cli/basic-login.yaml +++ b/test/integration/targets/eos_banner/tests/cli/basic-login.yaml @@ -1,9 +1,12 @@ --- +- debug: msg="START cli/basic-login.yaml on connection={{ ansible_connection }}" + - name: Remove previous login banner eos_config: lines: no banner login authorize: yes provider: "{{ cli }}" + become: yes - name: Create login banner eos_banner: @@ -14,6 +17,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -32,6 +36,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -47,6 +52,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -62,6 +68,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: diff --git a/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml b/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml index 859d293d07..84c9183939 100644 --- a/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml +++ b/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml @@ -1,9 +1,12 @@ --- +- debug: msg="START cli/basic-motd.yaml on connection={{ ansible_connection }}" + - name: Remove previous motd banner eos_config: lines: no banner motd authorize: yes provider: "{{ cli }}" + become: yes - name: Create motd eos_banner: @@ -15,6 +18,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -35,6 +39,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -54,6 +59,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -73,6 +79,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: diff --git a/test/integration/targets/eos_command/tasks/cli.yaml b/test/integration/targets/eos_command/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_command/tasks/cli.yaml +++ b/test/integration/targets/eos_command/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_command/tasks/eapi.yaml b/test/integration/targets/eos_command/tasks/eapi.yaml index 00a159a98e..bda1df677a 100644 --- a/test/integration/targets/eos_command/tasks/eapi.yaml +++ b/test/integration/targets/eos_command/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable eapi - eos_eapi: - http: yes - https: yes - local_http: no - enable_socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml index 3e40a3ba7e..95a233caba 100644 --- a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml +++ b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml @@ -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 eos_command: @@ -17,4 +17,4 @@ - "result.failed == true" - "result.msg is defined" -- debug: msg="END cli/bad_operator.yaml" +- debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/contains.yaml b/test/integration/targets/eos_command/tests/cli/contains.yaml index 5ce87ce893..8a57fdaf64 100644 --- a/test/integration/targets/eos_command/tests/cli/contains.yaml +++ b/test/integration/targets/eos_command/tests/cli/contains.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/contains.yaml" +- debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}" - name: test contains operator eos_command: @@ -17,4 +17,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/contains.yaml" +- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/equal.yaml b/test/integration/targets/eos_command/tests/cli/equal.yaml index 7041e767d3..46adbc023c 100644 --- a/test/integration/targets/eos_command/tests/cli/equal.yaml +++ b/test/integration/targets/eos_command/tests/cli/equal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/equal.yaml" +- debug: msg="START cli/equal.yaml on connection={{ ansible_connection }}" - name: test eq operator eos_command: @@ -31,4 +31,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/equal.yaml" +- debug: msg="END cli/equal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml index 18b5a0af65..576b444cc4 100644 --- a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml +++ b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/greaterthan.yaml" +- debug: msg="START cli/greaterthan.yaml on connection={{ ansible_connection }}" - name: test gt operator eos_command: @@ -31,4 +31,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/greaterthan.yaml" +- debug: msg="END cli/greaterthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml index a258a4ef0c..c998de7fcf 100644 --- a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml +++ b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/greaterthanorequal.yaml" +- debug: msg="START cli/greaterthanorequal.yaml on connection={{ ansible_connection }}" - name: test ge operator eos_command: @@ -31,4 +31,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/greaterthanorequal.yaml" +- debug: msg="END cli/greaterthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/invalid.yaml b/test/integration/targets/eos_command/tests/cli/invalid.yaml index ed01459aaa..9650e194cd 100644 --- a/test/integration/targets/eos_command/tests/cli/invalid.yaml +++ b/test/integration/targets/eos_command/tests/cli/invalid.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/invalid.yaml" +- debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}" - name: run invalid command eos_command: @@ -27,4 +27,4 @@ - "result.failed == true" - "result.msg is defined" -- debug: msg="END cli/invalid.yaml" +- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/lessthan.yaml b/test/integration/targets/eos_command/tests/cli/lessthan.yaml index b0ed69ea8b..13a0aa795b 100644 --- a/test/integration/targets/eos_command/tests/cli/lessthan.yaml +++ b/test/integration/targets/eos_command/tests/cli/lessthan.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/lessthan.yaml" +- debug: msg="START cli/lessthan.yaml on connection={{ ansible_connection }}" - name: test lt operator eos_command: @@ -31,4 +31,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/lessthan.yaml" +- debug: msg="END cli/lessthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml index 35085e62ee..b790c44b7f 100644 --- a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml +++ b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/lessthanorequal.yaml" +- debug: msg="START cli/lessthanorequal.yaml on connection={{ ansible_connection }}" - name: test le operator eos_command: @@ -31,4 +31,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/lessthanorequal.yaml" +- debug: msg="END cli/lessthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/notequal.yaml b/test/integration/targets/eos_command/tests/cli/notequal.yaml index beab4c0ed0..36678ee9f2 100644 --- a/test/integration/targets/eos_command/tests/cli/notequal.yaml +++ b/test/integration/targets/eos_command/tests/cli/notequal.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/notequal.yaml" +- debug: msg="START cli/notequal.yaml on connection={{ ansible_connection }}" - name: test neq operator eos_command: @@ -31,4 +31,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/notequal.yaml" +- debug: msg="END cli/notequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/output.yaml b/test/integration/targets/eos_command/tests/cli/output.yaml index 43e7eb1236..d65367b561 100644 --- a/test/integration/targets/eos_command/tests/cli/output.yaml +++ b/test/integration/targets/eos_command/tests/cli/output.yaml @@ -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 eos_command: @@ -25,4 +25,4 @@ - "result.changed == false" - "result.stdout is defined" -- debug: msg="END cli/output.yaml" +- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/timeout.yaml b/test/integration/targets/eos_command/tests/cli/timeout.yaml index 02d49ea9cb..f72e1e63eb 100644 --- a/test/integration/targets/eos_command/tests/cli/timeout.yaml +++ b/test/integration/targets/eos_command/tests/cli/timeout.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/timeout.yaml" +- debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}" - name: test bad condition eos_command: @@ -16,4 +16,4 @@ - "result.failed == true" - "result.msg is defined" -- debug: msg="END cli/timeout.yaml" +- debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tasks/cli.yaml b/test/integration/targets/eos_config/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_config/tasks/cli.yaml +++ b/test/integration/targets/eos_config/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_config/tasks/eapi.yaml b/test/integration/targets/eos_config/tasks/eapi.yaml index 76cf2a04da..bda1df677a 100644 --- a/test/integration/targets/eos_config/tasks/eapi.yaml +++ b/test/integration/targets/eos_config/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable eapi - eos_eapi: - http: yes - https: yes - local_http: no - socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_config/tests/cli/backup.yaml b/test/integration/targets/eos_config/tests/cli/backup.yaml index 47ff0f5259..4c582f6a48 100644 --- a/test/integration/targets/eos_config/tests/cli/backup.yaml +++ b/test/integration/targets/eos_config/tests/cli/backup.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/backup.yaml" +- debug: msg="START cli/backup.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -10,13 +10,14 @@ - interface Ethernet2 match: none provider: "{{ cli }}" + become: yes - name: collect any backup files find: paths: "{{ role_path }}/backup" pattern: "{{ inventory_hostname_short }}_config*" register: backup_files - delegate_to: localhost + connection: local - name: delete backup files file: @@ -29,6 +30,7 @@ src: basic/config.j2 backup: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -41,10 +43,10 @@ paths: "{{ role_path }}/backup" pattern: "{{ inventory_hostname_short }}_config*" register: backup_files - delegate_to: localhost + connection: local - assert: that: - "backup_files.files is defined" -- debug: msg="END cli/backup.yaml" +- debug: msg="END cli/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/config.yaml b/test/integration/targets/eos_config/tests/cli/config.yaml index c84decc6af..6f552ebce2 100644 --- a/test/integration/targets/eos_config/tests/cli/config.yaml +++ b/test/integration/targets/eos_config/tests/cli/config.yaml @@ -1,16 +1,18 @@ --- -- debug: msg="START cli/config.yaml" +- debug: msg="START cli/config.yaml on connection={{ ansible_connection }}" - name: setup eos_config: lines: hostname {{ inventory_hostname_short }} match: none provider: "{{ cli }}" + become: yes - name: get current running-config eos_command: commands: show running-config provider: "{{ cli }}" + become: yes register: config - name: configure hostname @@ -18,6 +20,7 @@ lines: hostname foo config: "{{ config.stdout[0] }}" provider: "{{ cli }}" + become: yes register: result - assert: @@ -29,6 +32,7 @@ eos_command: commands: show running-config provider: "{{ cli }}" + become: yes register: config - name: configure hostname again @@ -36,6 +40,7 @@ lines: hostname foo config: "{{ config.stdout[0] }}" provider: "{{ cli }}" + become: yes register: result - assert: @@ -47,5 +52,6 @@ lines: hostname {{ inventory_hostname_short }} match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/config.yaml" +- debug: msg="END cli/config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/defaults.yaml b/test/integration/targets/eos_config/tests/cli/defaults.yaml index c80556c8d3..aa775721a9 100644 --- a/test/integration/targets/eos_config/tests/cli/defaults.yaml +++ b/test/integration/targets/eos_config/tests/cli/defaults.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/defaults.yaml" +- debug: msg="START cli/defaults.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -10,12 +10,14 @@ - interface Ethernet2 match: none provider: "{{ cli }}" + become: yes - name: configure device with defaults included eos_config: src: defaults/config.j2 defaults: yes provider: "{{ cli }}" + become: yes register: result - debug: var=result @@ -30,6 +32,7 @@ src: defaults/config.j2 defaults: yes provider: "{{ cli }}" + become: yes register: result - debug: var=result @@ -39,4 +42,4 @@ - "result.changed == false" - "result.updates is not defined" -- debug: msg="END cli/defaults.yaml" +- debug: msg="END cli/defaults.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/save.yaml b/test/integration/targets/eos_config/tests/cli/save.yaml index 72cc4d0f9b..55b11ddfed 100644 --- a/test/integration/targets/eos_config/tests/cli/save.yaml +++ b/test/integration/targets/eos_config/tests/cli/save.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/save.yaml" +- debug: msg="START cli/save.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -10,12 +10,14 @@ - interface Ethernet2 match: none provider: "{{ cli }}" + become: yes - name: save config always eos_config: save_when: always provider: "{{ cli }}" + become: yes register: result - assert: @@ -26,10 +28,11 @@ eos_config: save_when: always provider: "{{ cli }}" + become: yes register: result - assert: that: - "result.changed == true" -- debug: msg="END cli/save.yaml" +- debug: msg="END cli/save.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/src_basic.yaml b/test/integration/targets/eos_config/tests/cli/src_basic.yaml index 6ab4e252cd..fb10b9c7eb 100644 --- a/test/integration/targets/eos_config/tests/cli/src_basic.yaml +++ b/test/integration/targets/eos_config/tests/cli/src_basic.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/src_basic.yaml" +- debug: msg="START cli/src_basic.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -10,11 +10,13 @@ - interface Ethernet2 match: none provider: "{{ cli }}" + become: yes - name: configure device with config eos_config: src: basic/config.j2 provider: "{{ cli }}" + become: yes register: result - assert: @@ -28,6 +30,7 @@ src: basic/config.j2 defaults: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -36,4 +39,4 @@ # https://github.com/ansible/ansible-modules-core/issues/4807 - "result.updates is not defined" -- debug: msg="END cli/src_basic.yaml" +- debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/src_invalid.yaml b/test/integration/targets/eos_config/tests/cli/src_invalid.yaml index 53f7be8bca..64bad95784 100644 --- a/test/integration/targets/eos_config/tests/cli/src_invalid.yaml +++ b/test/integration/targets/eos_config/tests/cli/src_invalid.yaml @@ -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 @@ -7,6 +7,7 @@ eos_config: src: basic/foobar.j2 provider: "{{ cli }}" + become: yes register: result ignore_errors: yes @@ -16,4 +17,4 @@ - "result.failed == true" - "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 }}" diff --git a/test/integration/targets/eos_config/tests/cli/src_match_none.yaml b/test/integration/targets/eos_config/tests/cli/src_match_none.yaml index fe67c5beb0..0d73a27e18 100644 --- a/test/integration/targets/eos_config/tests/cli/src_match_none.yaml +++ b/test/integration/targets/eos_config/tests/cli/src_match_none.yaml @@ -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 eos_config: @@ -10,12 +10,14 @@ - interface Ethernet2 match: none provider: "{{ cli }}" + become: yes - name: configure device with config eos_config: src: basic/config.j2 provider: "{{ cli }}" match: none + become: yes register: result - assert: @@ -29,6 +31,7 @@ src: basic/config.j2 defaults: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -38,4 +41,4 @@ - "result.changed == false" - "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 }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel.yaml b/test/integration/targets/eos_config/tests/cli/sublevel.yaml index dd4eb74d75..4e6f5ca3a6 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel.yaml @@ -1,17 +1,19 @@ --- -- debug: msg="START cli/sublevel.yaml" +- debug: msg="START cli/sublevel.yaml on connection={{ ansible_connection }}" - name: setup eos_config: lines: no vlan 10 match: none provider: "{{ cli }}" + become: yes - name: configure sub level command eos_config: lines: name test parents: vlan 10 provider: "{{ cli }}" + become: yes register: result - assert: @@ -25,6 +27,7 @@ lines: name test parents: vlan 10 provider: "{{ cli }}" + become: yes register: result - assert: @@ -36,6 +39,7 @@ lines: no vlan 10 match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/sublevel.yaml" +- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml index 00dd249a52..c55f7b8e69 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/sublevel_block.yaml" +- debug: msg="START cli/sublevel_block.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -12,6 +12,7 @@ after: exit match: none provider: "{{ cli }}" + become: yes - name: configure sub level command using block resplace eos_config: @@ -24,6 +25,7 @@ replace: block after: exit provider: "{{ cli }}" + become: yes register: result - assert: @@ -46,6 +48,7 @@ replace: block after: exit provider: "{{ cli }}" + become: yes register: result - assert: @@ -57,5 +60,6 @@ lines: no ip access-list test match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/sublevel_block.yaml" +- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml index 45c72135ad..c4a9c48430 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/sublevel_exact.yaml" +- debug: msg="START cli/sublevel_exact.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -14,6 +14,7 @@ after: exit match: none provider: "{{ cli }}" + become: yes - name: configure sub level command using exact match eos_config: @@ -28,6 +29,7 @@ match: exact replace: block provider: "{{ cli }}" + become: yes register: result - assert: @@ -50,6 +52,7 @@ parents: ip access-list test match: exact provider: "{{ cli }}" + become: yes register: result - assert: @@ -61,5 +64,6 @@ lines: no ip access-list test match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/sublevel_exact.yaml" +- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml index c389aab947..61907befcb 100644 --- a/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml +++ b/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/sublevel_strict.yaml" +- debug: msg="START cli/sublevel_strict.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -14,6 +14,7 @@ after: exit match: none provider: "{{ cli }}" + become: yes - name: configure sub level command using strict match eos_config: @@ -28,6 +29,7 @@ match: strict replace: block provider: "{{ cli }}" + become: yes register: result - assert: @@ -50,6 +52,7 @@ parents: ip access-list test match: strict provider: "{{ cli }}" + become: yes register: result - assert: @@ -61,5 +64,6 @@ lines: no ip access-list test match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/sublevel_strict.yaml" +- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel.yaml b/test/integration/targets/eos_config/tests/cli/toplevel.yaml index fa294ea27f..c11389135d 100644 --- a/test/integration/targets/eos_config/tests/cli/toplevel.yaml +++ b/test/integration/targets/eos_config/tests/cli/toplevel.yaml @@ -1,16 +1,18 @@ --- -- debug: msg="START cli/toplevel.yaml" +- debug: msg="START cli/toplevel.yaml on connection={{ ansible_connection }}" - name: setup eos_config: lines: hostname veos01 match: none provider: "{{ cli }}" + become: yes - name: configure top level command eos_config: lines: hostname foo provider: "{{ cli }}" + become: yes register: result - assert: @@ -22,6 +24,7 @@ eos_config: lines: hostname foo provider: "{{ cli }}" + become: yes register: result - assert: @@ -33,5 +36,6 @@ lines: hostname veos01 match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/toplevel.yaml" +- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml b/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml index dacf461a8a..bab44776b9 100644 --- a/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml +++ b/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/toplevel_after.yaml" +- debug: msg="START cli/toplevel_after.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -8,12 +8,14 @@ - hostname veos01 match: none provider: "{{ cli }}" + become: yes - name: configure top level command with before eos_config: lines: hostname foo after: snmp-server contact bar provider: "{{ cli }}" + become: yes register: result - assert: @@ -27,6 +29,7 @@ lines: hostname foo after: snmp-server contact foo provider: "{{ cli }}" + become: yes register: result - assert: @@ -40,5 +43,6 @@ - hostname veos01 match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/toplevel_after.yaml" +- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml b/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml index b133e7f766..9670df1f7d 100644 --- a/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml +++ b/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/toplevel_before.yaml" +- debug: msg="START cli/toplevel_before.yaml on connection={{ ansible_connection }}" - name: setup eos_config: @@ -8,12 +8,14 @@ - hostname veos01 match: none provider: "{{ cli }}" + become: yes - name: configure top level command with before eos_config: lines: hostname foo before: snmp-server contact bar provider: "{{ cli }}" + become: yes register: result - assert: @@ -27,6 +29,7 @@ lines: hostname foo before: snmp-server contact foo provider: "{{ cli }}" + become: yes register: result - assert: @@ -40,5 +43,6 @@ - no snmp-server contact match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/toplevel_before.yaml" +- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_eapi/tasks/cli.yaml b/test/integration/targets/eos_eapi/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_eapi/tasks/cli.yaml +++ b/test/integration/targets/eos_eapi/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_eapi/tests/cli/config.yaml b/test/integration/targets/eos_eapi/tests/cli/config.yaml index 15cebd9518..a22289d904 100644 --- a/test/integration/targets/eos_eapi/tests/cli/config.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/config.yaml @@ -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 }}" diff --git a/test/integration/targets/eos_eapi/tests/cli/configure.yaml b/test/integration/targets/eos_eapi/tests/cli/configure.yaml index 3f32f4dfc7..6594a3bee4 100644 --- a/test/integration/targets/eos_eapi/tests/cli/configure.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/configure.yaml @@ -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: diff --git a/test/integration/targets/eos_eapi/tests/cli/off.yaml b/test/integration/targets/eos_eapi/tests/cli/off.yaml index 68e73fa047..43634e152c 100644 --- a/test/integration/targets/eos_eapi/tests/cli/off.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/off.yaml @@ -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 diff --git a/test/integration/targets/eos_eapi/tests/cli/on.yaml b/test/integration/targets/eos_eapi/tests/cli/on.yaml index ec8e8ba467..b19499f90b 100644 --- a/test/integration/targets/eos_eapi/tests/cli/on.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/on.yaml @@ -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 diff --git a/test/integration/targets/eos_eapi/tests/cli/start.yaml b/test/integration/targets/eos_eapi/tests/cli/start.yaml index e7ac7e46cd..5212aea57b 100644 --- a/test/integration/targets/eos_eapi/tests/cli/start.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/start.yaml @@ -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 diff --git a/test/integration/targets/eos_eapi/tests/cli/stop.yaml b/test/integration/targets/eos_eapi/tests/cli/stop.yaml index 1b380fa940..3d29af4555 100644 --- a/test/integration/targets/eos_eapi/tests/cli/stop.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/stop.yaml @@ -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 diff --git a/test/integration/targets/eos_eapi/tests/cli/vrf.yaml b/test/integration/targets/eos_eapi/tests/cli/vrf.yaml index e71f5e38b1..606d03dcb1 100644 --- a/test/integration/targets/eos_eapi/tests/cli/vrf.yaml +++ b/test/integration/targets/eos_eapi/tests/cli/vrf.yaml @@ -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 }}" diff --git a/test/integration/targets/eos_facts/tasks/cli.yaml b/test/integration/targets/eos_facts/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_facts/tasks/cli.yaml +++ b/test/integration/targets/eos_facts/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_facts/tasks/eapi.yaml b/test/integration/targets/eos_facts/tasks/eapi.yaml index 00a159a98e..bda1df677a 100644 --- a/test/integration/targets/eos_facts/tasks/eapi.yaml +++ b/test/integration/targets/eos_facts/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable eapi - eos_eapi: - http: yes - https: yes - local_http: no - enable_socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_facts/tests/cli/all_facts.yaml b/test/integration/targets/eos_facts/tests/cli/all_facts.yaml index 1f107f99f2..8183fed980 100644 --- a/test/integration/targets/eos_facts/tests/cli/all_facts.yaml +++ b/test/integration/targets/eos_facts/tests/cli/all_facts.yaml @@ -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 @@ -7,6 +7,7 @@ provider: "{{ cli }}" gather_subset: - all + become: yes register: result @@ -28,4 +29,4 @@ - "result.ansible_facts.ansible_net_memfree_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 }}" diff --git a/test/integration/targets/eos_facts/tests/cli/default_facts.yaml b/test/integration/targets/eos_facts/tests/cli/default_facts.yaml index 0330978927..bdf6ac4793 100644 --- a/test/integration/targets/eos_facts/tests/cli/default_facts.yaml +++ b/test/integration/targets/eos_facts/tests/cli/default_facts.yaml @@ -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 eos_facts: provider: "{{ cli }}" + become: yes register: result - assert: @@ -28,4 +29,4 @@ # ... and not present - "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 }}" diff --git a/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml b/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml index a232bc1aaf..0eb2d3626c 100644 --- a/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml +++ b/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml @@ -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) @@ -45,4 +45,4 @@ -- debug: msg="END cli/invalid_subset.yaml" +- debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml b/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml index 56e96595f3..5679049b86 100644 --- a/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml +++ b/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml @@ -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 @@ -7,6 +7,7 @@ provider: "{{ cli }}" gather_subset: - "!hardware" + become: yes register: result - assert: @@ -27,4 +28,4 @@ # ... and not present - "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 }}" diff --git a/test/integration/targets/eos_logging/tasks/cli.yaml b/test/integration/targets/eos_logging/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_logging/tasks/cli.yaml +++ b/test/integration/targets/eos_logging/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_logging/tasks/eapi.yaml b/test/integration/targets/eos_logging/tasks/eapi.yaml index 00a159a98e..bda1df677a 100644 --- a/test/integration/targets/eos_logging/tasks/eapi.yaml +++ b/test/integration/targets/eos_logging/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable eapi - eos_eapi: - http: yes - https: yes - local_http: no - enable_socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_logging/tests/cli/basic.yaml b/test/integration/targets/eos_logging/tests/cli/basic.yaml index 8a0b7fa156..9dd6efca40 100644 --- a/test/integration/targets/eos_logging/tests/cli/basic.yaml +++ b/test/integration/targets/eos_logging/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: Set up host logging eos_logging: dest: host @@ -6,6 +8,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -20,6 +23,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -33,6 +37,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -47,6 +52,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -60,6 +66,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -73,6 +80,7 @@ size: 480000 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -87,6 +95,7 @@ - { dest: buffered, size: 480000, state: absent } authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: diff --git a/test/integration/targets/eos_static_route/tasks/cli.yaml b/test/integration/targets/eos_static_route/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_static_route/tasks/cli.yaml +++ b/test/integration/targets/eos_static_route/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_static_route/tests/cli/basic.yaml b/test/integration/targets/eos_static_route/tests/cli/basic.yaml index ec5b71674c..5fdd990da1 100644 --- a/test/integration/targets/eos_static_route/tests/cli/basic.yaml +++ b/test/integration/targets/eos_static_route/tests/cli/basic.yaml @@ -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 eos_config: @@ -9,6 +9,7 @@ - no ip route 192.168.5.0/24 192.168.0.1 authorize: yes provider: "{{ cli }}" + become: yes - name: configure static route eos_static_route: &single_route @@ -17,6 +18,7 @@ admin_distance: 2 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -26,6 +28,7 @@ - name: configure static route(Idempotence) eos_static_route: *single_route + become: yes register: result - assert: @@ -40,6 +43,7 @@ authorize: yes provider: "{{ cli }}" state: absent + become: yes register: result - assert: @@ -49,6 +53,7 @@ - name: delete static route eos_static_route: *delete_single + become: yes register: result - assert: @@ -62,6 +67,7 @@ - { address: 192.168.5.0/24, next_hop: 192.168.0.1 } authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -72,6 +78,7 @@ - name: configure static routes using aggregate(Idemporence) eos_static_route: *configure_aggregate + become: yes register: result - assert: @@ -86,6 +93,7 @@ authorize: yes state: absent provider: "{{ cli }}" + become: yes register: result - assert: @@ -96,6 +104,7 @@ - name: delete static routes using aggregate(Idempotence) eos_static_route: *delete_aggregate + become: yes register: result - assert: @@ -110,5 +119,6 @@ - no ip route 192.168.5.0/24 192.168.0.1 authorize: yes provider: "{{ cli }}" + become: yes -- debug: msg="END cli/basic.yaml" +- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tasks/cli.yaml b/test/integration/targets/eos_system/tasks/cli.yaml index ec835e9eb6..a6f7ae0351 100644 --- a/test/integration/targets/eos_system/tasks/cli.yaml +++ b/test/integration/targets/eos_system/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - 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 - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_system/tasks/eapi.yaml b/test/integration/targets/eos_system/tasks/eapi.yaml index abca2c7ba1..bda1df677a 100644 --- a/test/integration/targets/eos_system/tasks/eapi.yaml +++ b/test/integration/targets/eos_system/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - 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 - eos_eapi: - http: yes - https: yes - local_http: no - enable_socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml b/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml index b605c3097f..c5ffa626b5 100644 --- a/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml +++ b/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml @@ -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 eos_config: @@ -8,6 +8,7 @@ - no ip domain-list redhat.com match: none provider: "{{ cli }}" + become: yes - name: configure domain_list eos_system: @@ -15,6 +16,7 @@ - ansible.com - redhat.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -29,6 +31,7 @@ - ansible.com - redhat.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -40,6 +43,7 @@ domain_list: - ansible.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -52,6 +56,7 @@ domain_list: - ansible.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -64,6 +69,7 @@ - ansible.com - redhat.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -77,6 +83,7 @@ - ansible.com - redhat.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -89,6 +96,7 @@ - ansible.com - eng.ansible.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -104,6 +112,7 @@ - ansible.com - eng.ansible.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -118,5 +127,6 @@ - no ip domain-list eng.ansible.com match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/set_domain_list.yaml" +- debug: msg="END cli/set_domain_list.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml b/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml index ecaa4668a6..30d4e509c8 100644 --- a/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml +++ b/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml @@ -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 eos_config: lines: no ip domain-name match: none provider: "{{ cli }}" + become: yes - name: configure domain_name eos_system: domain_name: eng.ansible.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -21,6 +23,7 @@ eos_system: domain_name: eng.ansible.com provider: "{{ cli }}" + become: yes register: result - assert: @@ -32,5 +35,6 @@ lines: no ip domain-name match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/set_domain_name.yaml" +- debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_hostname.yaml b/test/integration/targets/eos_system/tests/cli/set_hostname.yaml index db80a97b3c..898cedcf1a 100644 --- a/test/integration/targets/eos_system/tests/cli/set_hostname.yaml +++ b/test/integration/targets/eos_system/tests/cli/set_hostname.yaml @@ -1,16 +1,18 @@ --- -- debug: msg="START cli/set_hostname.yaml" +- debug: msg="START cli/set_hostname.yaml on connection={{ ansible_connection }}" - name: setup eos_config: lines: hostname switch match: none provider: "{{ cli }}" + become: yes - name: configure hostname eos_system: hostname: foo provider: "{{ cli }}" + become: yes register: result - assert: @@ -21,6 +23,7 @@ eos_system: hostname: foo provider: "{{ cli }}" + become: yes register: result - assert: @@ -32,5 +35,6 @@ lines: "hostname {{ inventory_hostname }}" match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/set_hostname.yaml" +- debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml index 9e65367726..754136c3a2 100644 --- a/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml +++ b/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml @@ -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 eos_config: @@ -8,11 +8,13 @@ - vrf definition ansible match: none provider: "{{ cli }}" + become: yes - name: configure lookup_source eos_system: lookup_source: Management1 provider: "{{ cli }}" + become: yes register: result - assert: @@ -24,6 +26,7 @@ eos_system: lookup_source: Management1 provider: "{{ cli }}" + become: yes register: result - assert: @@ -36,6 +39,7 @@ - interface: Management1 vrf: ansible provider: "{{ cli }}" + become: yes register: result - assert: @@ -51,6 +55,7 @@ - interface: Management1 vrf: ansible provider: "{{ cli }}" + become: yes register: result - assert: @@ -64,5 +69,6 @@ - no vrf definition ansible match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/set_lookup_source.yaml" +- debug: msg="END cli/set_lookup_source.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml b/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml index bdd3d17c48..1ca4eb59e5 100644 --- a/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml +++ b/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml @@ -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 eos_config: @@ -8,6 +8,7 @@ - vrf definition ansible match: none provider: "{{ cli }}" + become: yes - name: configure name_servers eos_system: @@ -16,6 +17,7 @@ - 2.2.2.2 - 3.3.3.3 provider: "{{ cli }}" + become: yes register: result - assert: @@ -33,6 +35,7 @@ - 2.2.2.2 - 3.3.3.3 provider: "{{ cli }}" + become: yes register: result - assert: @@ -74,6 +77,7 @@ - 1.1.1.1 - 2.2.2.2 provider: "{{ cli }}" + become: yes register: result - assert: @@ -89,5 +93,6 @@ - no vrf definition ansible match: none provider: "{{ cli }}" + become: yes -- debug: msg="END cli/set_name_servers.yaml" +- debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_user/tasks/cli.yaml b/test/integration/targets/eos_user/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_user/tasks/cli.yaml +++ b/test/integration/targets/eos_user/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_user/tasks/eapi.yaml b/test/integration/targets/eos_user/tasks/eapi.yaml index 00a159a98e..bda1df677a 100644 --- a/test/integration/targets/eos_user/tasks/eapi.yaml +++ b/test/integration/targets/eos_user/tasks/eapi.yaml @@ -3,26 +3,14 @@ find: paths: "{{ role_path }}/tests/eapi" patterns: "{{ testcase }}.yaml" + delegate_to: localhost register: test_cases - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: enable eapi - eos_eapi: - http: yes - https: yes - local_http: no - enable_socket: yes - provider: "{{ cli }}" - -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test case (connection=local) + include: "{{ test_case_to_run }} ansible_connection=local" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run - -- name: disable eapi - eos_eapi: - state: stopped - provider: "{{ cli }}" diff --git a/test/integration/targets/eos_user/tests/cli/auth.yaml b/test/integration/targets/eos_user/tests/cli/auth.yaml index 4da4a5dd56..04e6c90e1a 100644 --- a/test/integration/targets/eos_user/tests/cli/auth.yaml +++ b/test/integration/targets/eos_user/tests/cli/auth.yaml @@ -9,6 +9,7 @@ authorize: yes provider: "{{ cli }}" configured_password: pass123 + become: yes - name: test login expect: @@ -36,4 +37,5 @@ state: absent provider: "{{ cli }}" authorize: yes + become: yes register: result diff --git a/test/integration/targets/eos_user/tests/cli/basic.yaml b/test/integration/targets/eos_user/tests/cli/basic.yaml index 381f25b4c7..0efee72ff5 100644 --- a/test/integration/targets/eos_user/tests/cli/basic.yaml +++ b/test/integration/targets/eos_user/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: Set Up eos_config: lines: @@ -7,6 +9,7 @@ - no username ansibletest3 - no username ansibletest4 provider: "{{ cli }}" + become: yes - name: Create user with role eos_user: @@ -17,6 +20,7 @@ configured_password: test1 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -36,6 +40,7 @@ authorize: yes update_password: on_create provider: "{{ cli }}" + become: yes register: result - assert: @@ -54,6 +59,7 @@ state: present role: network-operator provider: "{{ cli }}" + become: yes register: result - assert: @@ -73,6 +79,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes ignore_errors: yes register: result @@ -90,3 +97,5 @@ - no username ansibletest3 - no username ansibletest4 provider: "{{ cli }}" + authorize: yes + become: yes diff --git a/test/integration/targets/eos_vlan/tasks/cli.yaml b/test/integration/targets/eos_vlan/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_vlan/tasks/cli.yaml +++ b/test/integration/targets/eos_vlan/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_vlan/tests/cli/basic.yaml b/test/integration/targets/eos_vlan/tests/cli/basic.yaml index f22d57715e..d6d9c66cd9 100644 --- a/test/integration/targets/eos_vlan/tests/cli/basic.yaml +++ b/test/integration/targets/eos_vlan/tests/cli/basic.yaml @@ -8,6 +8,7 @@ - no vlan 4002 authorize: yes provider: "{{ cli }}" + become: yes - name: setup - remove switchport settings on interface Ethernet1 used in test eos_config: @@ -17,6 +18,7 @@ parents: interface Ethernet1 authorize: yes provider: "{{ cli }}" + become: yes - name: setup - remove switchport settings on interface Ethernet2 used in test eos_config: @@ -26,6 +28,7 @@ parents: interface Ethernet2 authorize: yes provider: "{{ cli }}" + become: yes - name: Create vlan eos_vlan: @@ -34,6 +37,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -51,6 +55,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -67,6 +72,7 @@ state: suspend authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -85,6 +91,7 @@ state: suspend authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -100,6 +107,7 @@ state: active authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -119,6 +127,7 @@ - Ethernet2 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -141,6 +150,7 @@ - Ethernet2 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -158,6 +168,7 @@ - Ethernet1 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -177,6 +188,7 @@ - Ethernet1 authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -194,6 +206,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -213,6 +226,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -231,6 +245,7 @@ purge: yes authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -251,6 +266,7 @@ purge: yes authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: diff --git a/test/integration/targets/eos_vrf/tasks/cli.yaml b/test/integration/targets/eos_vrf/tasks/cli.yaml index d675462dd0..a6f7ae0351 100644 --- a/test/integration/targets/eos_vrf/tasks/cli.yaml +++ b/test/integration/targets/eos_vrf/tasks/cli.yaml @@ -4,12 +4,19 @@ paths: "{{ role_path }}/tests/cli" patterns: "{{ testcase }}.yaml" register: test_cases + delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case - include: "{{ test_case_to_run }}" +- name: run test cases (connection=network_cli) + include: "{{ test_case_to_run }} ansible_connection=network_cli" with_items: "{{ test_items }}" loop_control: 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 diff --git a/test/integration/targets/eos_vrf/tests/cli/basic.yaml b/test/integration/targets/eos_vrf/tests/cli/basic.yaml index 546b314d87..231bf57aed 100644 --- a/test/integration/targets/eos_vrf/tests/cli/basic.yaml +++ b/test/integration/targets/eos_vrf/tests/cli/basic.yaml @@ -6,6 +6,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes - name: setup - remove vrf eos_vrf: @@ -13,6 +14,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes - name: setup - remove vrf eos_vrf: @@ -20,6 +22,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes - name: Create vrf eos_vrf: @@ -28,6 +31,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -45,6 +49,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -61,6 +66,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -78,6 +84,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -96,6 +103,7 @@ interfaces: - Ethernet2 provider: "{{ cli }}" + become: yes register: result - assert: @@ -115,6 +123,7 @@ interfaces: - Ethernet2 provider: "{{ cli }}" + become: yes register: result - assert: @@ -132,6 +141,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -152,6 +162,7 @@ state: present authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -170,6 +181,7 @@ purge: yes authorize: yes provider: "{{ cli }}" + become: yes register: result - assert: @@ -191,6 +203,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes - name: Delete VRFs again (idempotent) eos_vrf: @@ -198,6 +211,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes - name: Delete aggregate of VRFs eos_vrf: @@ -209,6 +223,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes - name: Delete VRFs again (idempotent) eos_vrf: @@ -220,6 +235,7 @@ state: absent authorize: yes provider: "{{ cli }}" + become: yes # FIXME add in tests for everything defined in docs # FIXME Test state:absent + test: diff --git a/test/integration/targets/prepare_eos_tests/tasks/main.yml b/test/integration/targets/prepare_eos_tests/tasks/main.yml index e3b66ff462..1f2e2fc5b9 100644 --- a/test/integration/targets/prepare_eos_tests/tasks/main.yml +++ b/test/integration/targets/prepare_eos_tests/tasks/main.yml @@ -4,9 +4,8 @@ - no shutdown - no switchport parents: int Ethernet1 - authorize: yes - provider: "{{ cli }}" - connection: local + become: yes + connection: network_cli - name: Enable Ethernet2 interface and disable switchport eos_config: @@ -14,6 +13,15 @@ - no shutdown - no switchport parents: int Ethernet2 - authorize: yes - provider: "{{ cli }}" - connection: local + become: yes + connection: network_cli + +- name: enable eapi + eos_eapi: + http: yes + https: yes + local_http: no + enable_socket: yes + become: yes + connection: network_cli + tags: eapi diff --git a/test/runner/lib/manage_ci.py b/test/runner/lib/manage_ci.py index 14d4625b94..b66ec97d9a 100644 --- a/test/runner/lib/manage_ci.py +++ b/test/runner/lib/manage_ci.py @@ -72,17 +72,11 @@ class ManageNetworkCI(object): def wait(self): """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 = [ 'ansible_host=%s' % self.core_ci.connection.hostname, '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_network_os=%s' % self.core_ci.platform, ] name = '%s-%s' % (self.core_ci.platform, self.core_ci.version.replace('.', '-'))