diff --git a/lib/ansible/plugins/cliconf/vyos.py b/lib/ansible/plugins/cliconf/vyos.py index 84c137f9cf..8425721dc5 100644 --- a/lib/ansible/plugins/cliconf/vyos.py +++ b/lib/ansible/plugins/cliconf/vyos.py @@ -55,18 +55,18 @@ class Cliconf(CliconfBase): return self.send_command(b'show configuration commands') def edit_config(self, command): - for cmd in chain([b'configure'], to_list(command)): - self.send_command(cmd) + for cmd in chain(['configure'], to_list(command)): + self.send_command(to_bytes(cmd)) def get(self, command, prompt=None, answer=None, sendonly=False): return self.send_command(to_bytes(command), prompt=to_bytes(prompt), answer=to_bytes(answer), sendonly=sendonly) def commit(self, comment=None): if comment: - command = b'commit comment "{0}"'.format(comment) + command = 'commit comment "{0}"'.format(comment) else: - command = b'commit' - self.send_command(command) + command = 'commit' + self.send_command(to_bytes(command)) def discard_changes(self, *args, **kwargs): self.send_command(b'discard') diff --git a/test/integration/targets/vyos_banner/tasks/cli.yaml b/test/integration/targets/vyos_banner/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_banner/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml b/test/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml index 57de75db96..d513d2e184 100644 --- a/test/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml +++ b/test/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml @@ -1,4 +1,7 @@ --- +- debug: + msg: "cli/basic-no-login.yaml on connection={{ ansible_connection }}" + - name: Setup vyos_banner: banner: pre-login diff --git a/test/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml b/test/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml index a7d2f08650..bda84a8c8b 100644 --- a/test/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml +++ b/test/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml @@ -1,4 +1,7 @@ --- +- debug: + msg: "cli/basic-post-login.yaml on connection={{ ansible_connection }}" + - name: setup - remove post-login vyos_banner: banner: post-login diff --git a/test/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml b/test/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml index 0329b3f211..eb66a73b44 100644 --- a/test/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml +++ b/test/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml @@ -1,4 +1,7 @@ --- +- debug: + msg: "cli/basic-pre-login.yaml on connection={{ ansible_connection }}" + - name: setup - remove pre-login vyos_banner: banner: pre-login diff --git a/test/integration/targets/vyos_command/tasks/cli.yaml b/test/integration/targets/vyos_command/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_command/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_command/tests/cli/bad_operator.yaml b/test/integration/targets/vyos_command/tests/cli/bad_operator.yaml index b72cb94a22..9e9de9f7b6 100644 --- a/test/integration/targets/vyos_command/tests/cli/bad_operator.yaml +++ b/test/integration/targets/vyos_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 vyos_command: @@ -16,4 +16,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/vyos_command/tests/cli/contains.yaml b/test/integration/targets/vyos_command/tests/cli/contains.yaml index 56c8879084..85c6e86a18 100644 --- a/test/integration/targets/vyos_command/tests/cli/contains.yaml +++ b/test/integration/targets/vyos_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 vyos_command: @@ -17,4 +17,4 @@ - result.stdout is defined - result.stdout_lines is defined -- debug: msg="END cli/contains.yaml" +- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_command/tests/cli/invalid.yaml b/test/integration/targets/vyos_command/tests/cli/invalid.yaml index 961fda2292..e6d25e411f 100644 --- a/test/integration/targets/vyos_command/tests/cli/invalid.yaml +++ b/test/integration/targets/vyos_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 vyos_command: @@ -19,4 +19,4 @@ - assert: { that: result.failed } -- debug: msg="END cli/invalid.yaml" +- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_command/tests/cli/output.yaml b/test/integration/targets/vyos_command/tests/cli/output.yaml index 764c6e180c..e3644b7878 100644 --- a/test/integration/targets/vyos_command/tests/cli/output.yaml +++ b/test/integration/targets/vyos_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 vyos_command: @@ -41,4 +41,4 @@ - result.stdout_lines is defined - result.stdout_lines[2] | length >= 20 -- debug: msg="END cli/output.yaml" +- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_command/tests/cli/timeout.yaml b/test/integration/targets/vyos_command/tests/cli/timeout.yaml index fecae8aed7..4994ebff80 100644 --- a/test/integration/targets/vyos_command/tests/cli/timeout.yaml +++ b/test/integration/targets/vyos_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 vyos_command: @@ -15,4 +15,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/vyos_config/tasks/cli.yaml b/test/integration/targets/vyos_config/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_config/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_config/tests/cli/check_config.yaml b/test/integration/targets/vyos_config/tests/cli/check_config.yaml index 56ebb04eee..c7df344545 100644 --- a/test/integration/targets/vyos_config/tests/cli/check_config.yaml +++ b/test/integration/targets/vyos_config/tests/cli/check_config.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/config_check.yaml" +- debug: msg="START cli/config_check.yaml on connection={{ ansible_connection }}" - name: setup vyos_config: @@ -23,4 +23,4 @@ that: - "result.changed == false" -- debug: msg="END cli/config_check.yaml" +- debug: msg="END cli/config_check.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_config/tests/cli/comment.yaml b/test/integration/targets/vyos_config/tests/cli/comment.yaml index 0c1bf4e914..3c71dfc64d 100644 --- a/test/integration/targets/vyos_config/tests/cli/comment.yaml +++ b/test/integration/targets/vyos_config/tests/cli/comment.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/comment.yaml" +- debug: msg="START cli/comment.yaml on connection={{ ansible_connection }}" - name: setup vyos_config: @@ -31,4 +31,4 @@ lines: set system host-name {{ inventory_hostname_short }} match: none -- debug: msg="END cli/comment.yaml" +- debug: msg="END cli/comment.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_config/tests/cli/save.yaml b/test/integration/targets/vyos_config/tests/cli/save.yaml index 98e23af5fb..7b058a7be3 100644 --- a/test/integration/targets/vyos_config/tests/cli/save.yaml +++ b/test/integration/targets/vyos_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 vyos_config: @@ -51,4 +51,4 @@ match: none save: true -- debug: msg="END cli/simple.yaml" +- debug: msg="END cli/simple.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_config/tests/cli/simple.yaml b/test/integration/targets/vyos_config/tests/cli/simple.yaml index 99cff15263..a4a879957c 100644 --- a/test/integration/targets/vyos_config/tests/cli/simple.yaml +++ b/test/integration/targets/vyos_config/tests/cli/simple.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START cli/simple.yaml" +- debug: msg="START cli/simple.yaml on connection={{ ansible_connection }}" - name: setup vyos_config: @@ -30,4 +30,4 @@ lines: set system host-name {{ inventory_hostname_short }} match: none -- debug: msg="END cli/simple.yaml" +- debug: msg="END cli/simple.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/vyos_facts/tasks/cli.yaml b/test/integration/targets/vyos_facts/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_facts/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_interface/tasks/cli.yaml b/test/integration/targets/vyos_interface/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_interface/tasks/cli.yaml +++ b/test/integration/targets/vyos_interface/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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_interface/tests/cli/basic.yaml b/test/integration/targets/vyos_interface/tests/cli/basic.yaml index 5c5c4bb95e..0f1549a738 100644 --- a/test/integration/targets/vyos_interface/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_interface/tests/cli/basic.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START vyos_interface cli/basic.yaml" +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - name: Run vyos lsmod command vyos_command: diff --git a/test/integration/targets/vyos_interface/tests/cli/intent.yaml b/test/integration/targets/vyos_interface/tests/cli/intent.yaml index b9603a5d4d..fad955109a 100644 --- a/test/integration/targets/vyos_interface/tests/cli/intent.yaml +++ b/test/integration/targets/vyos_interface/tests/cli/intent.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START vyos_interface cli/intent.yaml" +- debug: msg="START cli/intent.yaml on connection={{ ansible_connection }}" - name: Run vyos lsmod command vyos_command: diff --git a/test/integration/targets/vyos_l3_interface/tasks/cli.yaml b/test/integration/targets/vyos_l3_interface/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_l3_interface/tasks/cli.yaml +++ b/test/integration/targets/vyos_l3_interface/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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_l3_interface/tests/cli/basic.yaml b/test/integration/targets/vyos_l3_interface/tests/cli/basic.yaml index 7f15b17205..ac9e9d9c1b 100644 --- a/test/integration/targets/vyos_l3_interface/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_l3_interface/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: Remove IP address vyos_l3_interface: name: eth1 diff --git a/test/integration/targets/vyos_linkagg/tasks/cli.yaml b/test/integration/targets/vyos_linkagg/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_linkagg/tasks/cli.yaml +++ b/test/integration/targets/vyos_linkagg/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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_linkagg/tests/cli/basic.yaml b/test/integration/targets/vyos_linkagg/tests/cli/basic.yaml index 27c2df1209..1a171a7027 100644 --- a/test/integration/targets/vyos_linkagg/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_linkagg/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="cli/basic.yaml on connection={{ ansible_connection }}" + - name: Remove linkagg vyos_linkagg: name: bond0 diff --git a/test/integration/targets/vyos_lldp/tasks/cli.yaml b/test/integration/targets/vyos_lldp/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_lldp/tasks/cli.yaml +++ b/test/integration/targets/vyos_lldp/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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_lldp/tests/cli/basic.yaml b/test/integration/targets/vyos_lldp/tests/cli/basic.yaml index ec2dfb42ff..bc7774f0ee 100644 --- a/test/integration/targets/vyos_lldp/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_lldp/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: Make sure LLDP is not running before tests vyos_config: lines: delete service lldp diff --git a/test/integration/targets/vyos_lldp_interface/tasks/cli.yaml b/test/integration/targets/vyos_lldp_interface/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_lldp_interface/tasks/cli.yaml +++ b/test/integration/targets/vyos_lldp_interface/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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml b/test/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml index 089d9b7a98..362d1817fe 100644 --- a/test/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: Make sure LLDP is not running before tests vyos_config: lines: delete service lldp diff --git a/test/integration/targets/vyos_logging/tasks/cli.yaml b/test/integration/targets/vyos_logging/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_logging/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_logging/tests/cli/basic.yaml b/test/integration/targets/vyos_logging/tests/cli/basic.yaml index 098770c347..6b13334216 100644 --- a/test/integration/targets/vyos_logging/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_logging/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: set-up logging vyos_logging: dest: console diff --git a/test/integration/targets/vyos_static_route/tasks/cli.yaml b/test/integration/targets/vyos_static_route/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_static_route/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_static_route/tests/cli/basic.yaml b/test/integration/targets/vyos_static_route/tests/cli/basic.yaml index b0190f7b15..f8fa87d9f7 100644 --- a/test/integration/targets/vyos_static_route/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_static_route/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: create static route vyos_static_route: prefix: 172.24.0.0/24 diff --git a/test/integration/targets/vyos_user/tasks/cli.yaml b/test/integration/targets/vyos_user/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_user/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_user/tests/cli/basic.yaml b/test/integration/targets/vyos_user/tests/cli/basic.yaml index dbd78ee117..346ecda33a 100644 --- a/test/integration/targets/vyos_user/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_user/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: Setup vyos_config: lines: diff --git a/test/integration/targets/vyos_vlan/tasks/cli.yaml b/test/integration/targets/vyos_vlan/tasks/cli.yaml index d675462dd0..890d3acf3e 100644 --- a/test/integration/targets/vyos_vlan/tasks/cli.yaml +++ b/test/integration/targets/vyos_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 case (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" + with_first_found: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/vyos_vlan/tests/cli/basic.yaml b/test/integration/targets/vyos_vlan/tests/cli/basic.yaml index dde914d1de..249d36ad97 100644 --- a/test/integration/targets/vyos_vlan/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_vlan/tests/cli/basic.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" + - name: setup - remove vlan used in test vyos_config: lines: diff --git a/test/integration/targets/vyos_vlan/tests/cli/multiple.yaml b/test/integration/targets/vyos_vlan/tests/cli/multiple.yaml index 942902f8bc..25bc1af095 100644 --- a/test/integration/targets/vyos_vlan/tests/cli/multiple.yaml +++ b/test/integration/targets/vyos_vlan/tests/cli/multiple.yaml @@ -1,4 +1,6 @@ --- +- debug: msg="START cli/multiple.yaml on connection={{ ansible_connection }}" + - name: setup - remove vlan used in test vyos_config: lines: