diff options
author | Kate Case <kcase@redhat.com> | 2023-01-25 08:37:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 08:37:58 -0500 |
commit | e9911888f6dcdf9031f3fdb2e32c52e45815fdbe (patch) | |
tree | dc22abb4a329ef04e98685b81d074679dc24c456 /tests/integration | |
parent | bcfe61a3b6ff69f08450f3dbd8f0f1827fb18ab3 (diff) | |
download | vyos-ansible-collection-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.tar.gz vyos-ansible-collection-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.zip |
Add prettier and isort to pre-commit. (#270)
* Add prettier and isort to pre-commit.
* Bump line-length to 100
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'tests/integration')
249 files changed, 918 insertions, 1116 deletions
diff --git a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml index afbc291..8ada933 100644 --- a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml +++ b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml @@ -1,9 +1,10 @@ --- - name: Ensure required interfaces are present in running-config vars: - lines: "set interfaces ethernet eth0 address dhcp\nset interfaces ethernet eth0\ + lines: + "set interfaces ethernet eth0 address dhcp\nset interfaces ethernet eth0\ \ speed auto\nset interfaces ethernet eth0 duplex auto\nset interfaces ethernet\ \ eth1\nset interfaces ethernet eth2\ndelete interfaces loopback lo\n" ignore_errors: true ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_banner/defaults/main.yaml b/tests/integration/targets/vyos_banner/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_banner/defaults/main.yaml +++ b/tests/integration/targets/vyos_banner/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_banner/tasks/cli.yaml b/tests/integration/targets/vyos_banner/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_banner/tasks/cli.yaml +++ b/tests/integration/targets/vyos_banner/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml index 1ade232..d602763 100644 --- a/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-no-login.yaml @@ -15,7 +15,7 @@ state: absent - debug: - msg: '{{ result }}' + msg: "{{ result }}" - assert: that: diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml index 17cc07d..da8adb1 100644 --- a/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-post-login.yaml @@ -15,7 +15,7 @@ state: present - debug: - msg: '{{ result }}' + msg: "{{ result }}" - assert: that: diff --git a/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml b/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml index 526c657..fc65c17 100644 --- a/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml +++ b/tests/integration/targets/vyos_banner/tests/cli/basic-pre-login.yaml @@ -15,7 +15,7 @@ state: present - debug: - msg: '{{ result }}' + msg: "{{ result }}" - assert: that: diff --git a/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml b/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml b/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml index 3519172..64f6f34 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_address_family deleted integration tests on connection={{ + msg: + START vyos_bgp_address_family deleted integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_bgp_address_family: &id001 @@ -33,7 +33,8 @@ - result.commands|symmetric_difference(deleted.commands) == [] - result.after == ansible_facts['network_resources']['bgp_address_family'] - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 @@ -44,5 +45,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml index 3a12be9..04a6aac 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_address_family empty_config integration tests on connection={{ + msg: + START vyos_bgp_address_family empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml index 07c9ac3..f05094f 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_address_family gathered integration tests on connection={{ + msg: + START vyos_bgp_address_family gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_bgp_address_family: diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml index 68dd47b..fdbc00b 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_address_family overridden integration tests on connection={{ + msg: + START vyos_bgp_address_family overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_bgp_address_family: &id001 @@ -42,7 +42,8 @@ - result.commands|symmetric_difference(overridden.commands) == [] - result.after == ansible_facts['network_resources']['bgp_address_family'] - - name: Replace the existing configuration with the provided running configuration + - name: + Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 @@ -53,5 +54,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml index 3176797..6bd9c77 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_address_family parsed integration tests on connection={{ ansible_connection + msg: + START vyos_bgp_address_family parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml index 1071657..8c6ac5c 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml @@ -1,10 +1,10 @@ --- - debug: - msg: START vyos_bgp_address_family rendered integration tests on connection={{ + msg: + START vyos_bgp_address_family rendered integration tests on connection={{ ansible_connection }} - block: - - name: Render the given config in the form of native config. register: result vyos.vyos.vyos_bgp_address_family: &id001 diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml index b4fe3db..d782582 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_address_family replaced integration tests on connection={{ + msg: + START vyos_bgp_address_family replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_bgp_address_family: &id001 @@ -42,7 +42,8 @@ - result.commands|symmetric_difference(replaced.commands) == [] - result.after == ansible_facts['network_resources']['bgp_address_family'] - - name: Replace the existing configuration with the provided running configuration + - name: + Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 @@ -53,5 +54,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/defaults/main.yaml b/tests/integration/targets/vyos_bgp_global/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_bgp_global/defaults/main.yaml +++ b/tests/integration/targets/vyos_bgp_global/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_bgp_global/tasks/cli.yaml b/tests/integration/targets/vyos_bgp_global/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_bgp_global/tasks/cli.yaml +++ b/tests/integration/targets/vyos_bgp_global/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml index 9c7400e..8df1677 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_bgp_global: &id001 @@ -26,7 +25,8 @@ - result.commands|symmetric_difference(deleted.commands) == [] - result.after == ansible_facts['network_resources']['bgp_global'] - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *id001 @@ -37,5 +37,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml index 9792125..edee16b 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_af.yaml - block: - - name: Delete the existing configuration, in presence of an af under neighbor. register: result ignore_errors: true @@ -22,5 +21,4 @@ - result.msg == 'Use the _bgp_address_family module to delete the address_family under neighbor 5001::64, before replacing/deleting the neighbor.' always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml index 2022533..742951f 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_bgp_global: diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml index 7c1665f..ef8856d 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_bgp_global parsed integration tests on connection={{ ansible_connection + msg: + START vyos_bgp_global parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml index 46346c2..0af8775 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Purge the provided configuration register: result vyos.vyos.vyos_bgp_global: &id001 @@ -27,5 +26,4 @@ - ansible_facts.network_resources.bgp_global == [] always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml index 3a44a5e..534227f 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml @@ -4,7 +4,6 @@ ansible_connection }} - block: - - name: Render given bgp_global configuration register: result vyos.vyos.vyos_bgp_global: &id001 diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml index f1b79b2..aeb4aa7 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_bgp_global: &id001 @@ -56,7 +55,8 @@ - result.commands|symmetric_difference(replaced.commands) == [] - result.after == ansible_facts['network_resources']['bgp_global'] - - name: Replace the existing configuration with the provided running configuration + - name: + Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *id001 @@ -67,5 +67,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml index abcb177..e66aae7 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_af.yaml - block: - - name: Replace the existing af configuration with the provided running configuration register: result ignore_errors: true @@ -52,5 +51,4 @@ - result.msg == 'Use the _bgp_address_family module to delete the address_family under neighbor 5001::64, before replacing/deleting the neighbor.' always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_command/defaults/main.yaml b/tests/integration/targets/vyos_command/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_command/defaults/main.yaml +++ b/tests/integration/targets/vyos_command/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_command/tasks/cli.yaml b/tests/integration/targets/vyos_command/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_command/tasks/cli.yaml +++ b/tests/integration/targets/vyos_command/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_command/tasks/redirection.yaml b/tests/integration/targets/vyos_command/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_command/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_command/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_command/tests/cli/cli_command.yaml b/tests/integration/targets/vyos_command/tests/cli/cli_command.yaml index 61ed054..2467a4f 100644 --- a/tests/integration/targets/vyos_command/tests/cli/cli_command.yaml +++ b/tests/integration/targets/vyos_command/tests/cli/cli_command.yaml @@ -3,7 +3,6 @@ msg: START cli/cli_command.yaml on connection={{ ansible_connection }} - block: - - name: get output for single command register: result ansible.netcommon.cli_command: @@ -27,7 +26,6 @@ when: ansible_connection == 'ansible.netcommon.network_cli' - block: - - name: test failure for local connection register: result ignore_errors: true diff --git a/tests/integration/targets/vyos_config/defaults/main.yaml b/tests/integration/targets/vyos_config/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_config/defaults/main.yaml +++ b/tests/integration/targets/vyos_config/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_config/tasks/cli.yaml b/tests/integration/targets/vyos_config/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_config/tasks/cli.yaml +++ b/tests/integration/targets/vyos_config/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_config/tasks/cli_config.yaml b/tests/integration/targets/vyos_config/tasks/cli_config.yaml index 98bd1fc..8ed2874 100644 --- a/tests/integration/targets/vyos_config/tasks/cli_config.yaml +++ b/tests/integration/targets/vyos_config/tasks/cli_config.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli_config test cases find: - paths: '{{ role_path }}/tests/cli_config' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli_config" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_config/tasks/redirection.yaml b/tests/integration/targets/vyos_config/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_config/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_config/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_config/tests/cli/backup.yaml b/tests/integration/targets/vyos_config/tests/cli/backup.yaml index 95fdd98..f414b76 100644 --- a/tests/integration/targets/vyos_config/tests/cli/backup.yaml +++ b/tests/integration/targets/vyos_config/tests/cli/backup.yaml @@ -3,16 +3,16 @@ - name: collect any backup files find: - paths: '{{ role_path }}/backup' - pattern: '{{ inventory_hostname_short }}_config*' + paths: "{{ role_path }}/backup" + pattern: "{{ inventory_hostname_short }}_config*" register: backup_files connection: local - name: delete backup files file: - path: '{{ item.path }}' + path: "{{ item.path }}" state: absent - with_items: '{{backup_files.files|default([])}}' + with_items: "{{backup_files.files|default([])}}" - name: take configure backup register: result @@ -25,8 +25,8 @@ - name: collect any backup files find: - paths: '{{ role_path }}/backup' - pattern: '{{ inventory_hostname_short }}_config*' + paths: "{{ role_path }}/backup" + pattern: "{{ inventory_hostname_short }}_config*" register: backup_files connection: local @@ -36,11 +36,11 @@ - name: delete configurable backup file path file: - path: '{{ item }}' + path: "{{ item }}" state: absent with_items: - - '{{ role_path }}/backup_test_dir/' - - '{{ role_path }}/backup/backup.cfg' + - "{{ role_path }}/backup_test_dir/" + - "{{ role_path }}/backup/backup.cfg" - name: take configuration backup in custom filename and directory path register: result @@ -48,7 +48,7 @@ backup: true backup_options: filename: backup.cfg - dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - assert: that: @@ -56,7 +56,7 @@ - name: check if the backup file-1 exist find: - paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg' + paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg" register: backup_file connection: local @@ -77,7 +77,7 @@ - name: check if the backup file-2 exist find: - paths: '{{ role_path }}/backup/backup.cfg' + paths: "{{ role_path }}/backup/backup.cfg" register: backup_file connection: local @@ -90,7 +90,7 @@ vyos.vyos.vyos_config: backup: true backup_options: - dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - assert: that: @@ -98,8 +98,8 @@ - name: check if the backup file-3 exist find: - paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' - pattern: '{{ inventory_hostname_short }}_config*' + paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" + pattern: "{{ inventory_hostname_short }}_config*" register: backup_file connection: local diff --git a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml index 4300c10..2df0135 100644 --- a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml +++ b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml @@ -16,7 +16,7 @@ - name: Check that multiple duplicate lines collapse into a single commands assert: that: - - '{{ result.commands|length }} == 1' + - "{{ result.commands|length }} == 1" - name: Check that set is correctly prepended assert: @@ -52,6 +52,6 @@ - assert: that: - - '{{ result.filtered|length }} == 2' + - "{{ result.filtered|length }} == 2" - debug: msg="END cli/config_check.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/vyos_config/tests/cli/simple.yaml b/tests/integration/targets/vyos_config/tests/cli/simple.yaml index 4e2db4e..3db5927 100644 --- a/tests/integration/targets/vyos_config/tests/cli/simple.yaml +++ b/tests/integration/targets/vyos_config/tests/cli/simple.yaml @@ -34,7 +34,7 @@ - name: Configuring when commands starts with whitespaces register: result vyos.vyos.vyos_config: - src: '{{ role_path }}/tests/cli/config.cfg' + src: "{{ role_path }}/tests/cli/config.cfg" - assert: that: diff --git a/tests/integration/targets/vyos_config/tests/cli_config/cli_backup.yaml b/tests/integration/targets/vyos_config/tests/cli_config/cli_backup.yaml index 516b835..db35410 100644 --- a/tests/integration/targets/vyos_config/tests/cli_config/cli_backup.yaml +++ b/tests/integration/targets/vyos_config/tests/cli_config/cli_backup.yaml @@ -3,24 +3,24 @@ - name: delete configurable backup file path file: - path: '{{ item }}' + path: "{{ item }}" state: absent with_items: - - '{{ role_path }}/backup_test_dir/' - - '{{ role_path }}/backup/backup.cfg' + - "{{ role_path }}/backup_test_dir/" + - "{{ role_path }}/backup/backup.cfg" - name: collect any backup files find: - paths: '{{ role_path }}/backup' - pattern: '{{ inventory_hostname_short }}_config*' + paths: "{{ role_path }}/backup" + pattern: "{{ inventory_hostname_short }}_config*" register: backup_files connection: local - name: delete backup files file: - path: '{{ item.path }}' + path: "{{ item.path }}" state: absent - with_items: '{{backup_files.files|default([])}}' + with_items: "{{backup_files.files|default([])}}" - name: take config backup register: result @@ -33,8 +33,8 @@ - name: collect any backup files find: - paths: '{{ role_path }}/backup' - pattern: '{{ inventory_hostname_short }}_config*' + paths: "{{ role_path }}/backup" + pattern: "{{ inventory_hostname_short }}_config*" register: backup_files connection: local @@ -48,7 +48,7 @@ backup: true backup_options: filename: backup.cfg - dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - assert: that: @@ -56,7 +56,7 @@ - name: check if the backup file-1 exist find: - paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg' + paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg" register: backup_file connection: local @@ -77,7 +77,7 @@ - name: check if the backup file-2 exist find: - paths: '{{ role_path }}/backup/backup.cfg' + paths: "{{ role_path }}/backup/backup.cfg" register: backup_file connection: local @@ -90,7 +90,7 @@ ansible.netcommon.cli_config: backup: true backup_options: - dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - assert: that: @@ -98,8 +98,8 @@ - name: check if the backup file-3 exist find: - paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' - pattern: '{{ inventory_hostname_short }}_config*' + paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" + pattern: "{{ inventory_hostname_short }}_config*" register: backup_file connection: local diff --git a/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml b/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml index 6b71144..55a96aa 100644 --- a/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml +++ b/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml @@ -1,5 +1,6 @@ --- -- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection +- debug: + msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection }}" - name: setup - remove interface description diff --git a/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml b/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml index 030b75d..470553f 100644 --- a/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml +++ b/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml @@ -1,5 +1,6 @@ --- -- debug: msg="START cli_config/cli_comment.yaml on connection={{ ansible_connection +- debug: + msg="START cli_config/cli_comment.yaml on connection={{ ansible_connection }}" - name: setup @@ -28,5 +29,6 @@ - name: teardown ansible.netcommon.cli_config: *id001 -- debug: msg="END cli_config/cli_comment.yaml on connection={{ ansible_connection +- debug: + msg="END cli_config/cli_comment.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml index 3f3e489..f397a27 100644 --- a/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml @@ -16,7 +16,7 @@ - name: Check that multiple duplicate lines collapse into a single commands assert: that: - - '{{ result.commands|length }} == 1' + - "{{ result.commands|length }} == 1" - name: Check that set is correctly prepended assert: @@ -52,7 +52,7 @@ - assert: that: - - '{{ result.filtered|length }} == 2' + - "{{ result.filtered|length }} == 2" - name: Remove interface description and delete temp user vyos.vyos.config: &cleanup @@ -80,7 +80,7 @@ backup: true backup_options: filename: backup_with_alias.cfg - dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - assert: that: @@ -88,7 +88,7 @@ - name: check if the backup file-4 exist find: - paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg' + paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg" register: backup_file connection: local diff --git a/tests/integration/targets/vyos_facts/defaults/main.yaml b/tests/integration/targets/vyos_facts/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_facts/defaults/main.yaml +++ b/tests/integration/targets/vyos_facts/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_facts/tasks/cli.yaml b/tests/integration/targets/vyos_facts/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_facts/tasks/cli.yaml +++ b/tests/integration/targets/vyos_facts/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_facts/tasks/redirection.yaml b/tests/integration/targets/vyos_facts/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_facts/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_facts/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml index a7c3a11..f6e8208 100644 --- a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml +++ b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml @@ -52,7 +52,7 @@ that: - result.changed == false - "{{ result['ansible_facts']['available_network_resources'] | symmetric_difference(result['ansible_facts']['ansible_net_gather_network_resources']) |length\ - \ == 0 }}" + \ == 0 }}" - name: test getting default facts register: result diff --git a/tests/integration/targets/vyos_firewall_global/defaults/main.yaml b/tests/integration/targets/vyos_firewall_global/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_firewall_global/defaults/main.yaml +++ b/tests/integration/targets/vyos_firewall_global/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_firewall_global/tasks/cli.yaml b/tests/integration/targets/vyos_firewall_global/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_firewall_global/tasks/cli.yaml +++ b/tests/integration/targets/vyos_firewall_global/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_firewall_global/tasks/redirection.yaml b/tests/integration/targets/vyos_firewall_global/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_firewall_global/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_firewall_global/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml index f79bb9a..27d1aa2 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set firewall all-ping 'enable'\nset firewall broadcast-ping 'enable'\n\ + lines: + "set firewall all-ping 'enable'\nset firewall broadcast-ping 'enable'\n\ set firewall config-trap 'enable'\nset firewall group address-group MGMT-HOSTS\ \ address '192.0.1.1'\nset firewall group address-group MGMT-HOSTS address\ \ '192.0.1.3'\nset firewall group address-group MGMT-HOSTS address '192.0.1.5'\n\ @@ -15,4 +16,4 @@ \ log 'enable'\nset firewall state-policy invalid action 'reject'\nset firewall\ \ syn-cookies 'enable'\nset firewall twa-hazards-protection 'enable'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/_remove_config.yaml index 5c86924..60cb2d8 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/_remove_config.yaml @@ -3,4 +3,4 @@ vars: lines: "delete firewall\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml index 44df47c..31620f4 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: Start vyos_firewall_global deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_global deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete attributes of firewall. register: result vyos.vyos.vyos_firewall_global: &id001 @@ -44,5 +44,4 @@ that: - "{{ deleted['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml index 3910952..643a99e 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_global empty_config integration tests on connection={{ + msg: + START vyos_firewall_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml index b94d95e..82b7330 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_global parsed integration tests on connection={{ ansible_connection + msg: + START vyos_firewall_global parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather firewall_global facts register: firewall_global_facts vyos.vyos.vyos_facts: @@ -25,7 +25,8 @@ - name: Assert that correct parsing done assert: - that: "{{ ansible_facts['network_resources']['firewall_global'] == result['parsed']\ + that: + "{{ ansible_facts['network_resources']['firewall_global'] == result['parsed']\ \ }}" - name: Gather the existing running configuration (IDEMPOTENT) @@ -37,5 +38,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml index 528563e..16d585e 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_firewall_global: &id001 @@ -22,7 +21,6 @@ all: true broadcast: true state_policy: - - connection_type: established action: accept log: true @@ -30,7 +28,6 @@ - connection_type: invalid action: reject route_redirects: - - afi: ipv4 ip_src_route: true icmp_redirects: @@ -38,11 +35,9 @@ receive: false group: address_group: - - name: SALES-HOSTS description: Sales office hosts address list members: - - address: 192.0.2.1 - address: 192.0.2.2 @@ -52,16 +47,13 @@ - name: ENG-HOSTS description: Sales office hosts address list members: - - address: 192.0.3.1 - address: 192.0.3.2 network_group: - - name: MGMT description: This group has the Management network addresses members: - - address: 192.0.1.0/24 state: rendered @@ -80,5 +72,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml index 31a7644..e213bdf 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed firewall with provided configurations register: result vyos.vyos.vyos_firewall_global: &id001 @@ -22,7 +21,6 @@ all: true broadcast: true state_policy: - - connection_type: established action: accept log: true @@ -30,7 +28,6 @@ - connection_type: invalid action: reject route_redirects: - - afi: ipv4 ip_src_route: true icmp_redirects: @@ -38,11 +35,9 @@ receive: false group: address_group: - - name: SALES-HOSTS description: Sales office hosts address list members: - - address: 192.0.2.1 - address: 192.0.2.2 @@ -52,16 +47,13 @@ - name: ENG-HOSTS description: Sales office hosts address list members: - - address: 192.0.3.1 - address: 192.0.3.2 network_group: - - name: MGMT description: This group has the Management network addresses members: - - address: 192.0.1.0/24 state: replaced @@ -81,7 +73,8 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: Replace device configurations of listed firewall with provided configurarions + - name: + Replace device configurations of listed firewall with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *id001 @@ -96,5 +89,4 @@ that: - "{{ replaced['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml index 00c5635..ff24402 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: START vyos_firewall_global round trip integration tests on connection={{ + msg: + START vyos_firewall_global round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_firewall_global: @@ -20,7 +20,6 @@ all: true broadcast: true state_policy: - - connection_type: established action: accept log: true @@ -28,7 +27,6 @@ - connection_type: invalid action: reject route_redirects: - - afi: ipv4 ip_src_route: true icmp_redirects: @@ -36,22 +34,18 @@ receive: false group: address_group: - - name: MGMT-HOSTS description: This group has the Management hosts address list members: - - address: 192.0.1.1 - address: 192.0.1.3 - address: 192.0.1.5 network_group: - - name: MGMT description: This group has the Management network addresses members: - - address: 192.0.1.0/24 state: merged @@ -90,5 +84,4 @@ assert: that: "{{ base_config['after'] == revert['after']}}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_global/vars/main.yaml b/tests/integration/targets/vyos_firewall_global/vars/main.yaml index faa0ff1..9ec7a6e 100644 --- a/tests/integration/targets/vyos_firewall_global/vars/main.yaml +++ b/tests/integration/targets/vyos_firewall_global/vars/main.yaml @@ -185,7 +185,7 @@ rendered: - set firewall source-validation 'strict' deleted: commands: - - 'delete firewall ' + - "delete firewall " after: [] round_trip: after: diff --git a/tests/integration/targets/vyos_firewall_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_firewall_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_firewall_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_firewall_interfaces/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml index 3e60c41..8b3dacd 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set interfaces ethernet eth1 firewall in name 'INBOUND' \nset interfaces\ + lines: + "set interfaces ethernet eth1 firewall in name 'INBOUND' \nset interfaces\ \ ethernet eth1 firewall out name 'OUTBOUND' \nset interfaces ethernet eth1\ \ firewall local name 'LOCAL' \nset interfaces ethernet eth1 firewall local\ \ ipv6-name 'V6-LOCAL'\nset interfaces ethernet eth2 firewall in name 'INBOUND'\n\ @@ -9,4 +10,4 @@ \ ethernet eth2 firewall local name 'LOCAL' \nset interfaces ethernet eth2\ \ firewall local ipv6-name 'V6-LOCAL'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml index 40a7f4a..d2fd3ee 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set firewall name 'INBOUND'\nset firewall name 'OUTBOUND'\nset firewall\ + lines: + "set firewall name 'INBOUND'\nset firewall name 'OUTBOUND'\nset firewall\ \ name 'LOCAL'\nset firewall ipv6-name 'V6-LOCAL'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml index 38a1800..c95fc00 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml @@ -1,7 +1,8 @@ --- - name: Remove Config vars: - lines: "delete interfaces ethernet eth1 firewall\ndelete interfaces ethernet\ + lines: + "delete interfaces ethernet eth1 firewall\ndelete interfaces ethernet\ \ eth2 firewall\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml index 0844749..da1b02c 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml @@ -4,4 +4,4 @@ lines: "delete firewall name INBOUND\ndelete firewall name OUTBOUND\ndelete\ \ firewall name LOCAL\ndelete firewall ipv6-name V6-LOCAL\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml index 078dd89..f1a0a4d 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,12 +9,10 @@ - include_tasks: _populate.yaml - block: - - name: Delete attributes of given firewall rules. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 - name: eth2 @@ -52,7 +51,6 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml index f7db06b..b33aea8 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,22 +9,18 @@ - include_tasks: _populate.yaml - block: - - name: Delete firewall interfaces based on IP address type provided. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 - afi: ipv6 - name: eth2 access_rules: - - afi: ipv4 - afi: ipv6 @@ -62,7 +59,6 @@ - "{{ deleted_afi['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml index d85654c..1293f6a 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete all the firewall interfaces. register: result vyos.vyos.vyos_firewall_interfaces: &id001 @@ -48,7 +48,6 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml index f7e91f8..eb42c02 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -8,18 +9,14 @@ - include_tasks: _populate.yaml - block: - - name: Delete firewall interface. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - direction: in name: INBOUND state: deleted @@ -57,7 +54,6 @@ - "{{ deleted_single['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml index 66c49bf..1b9eb34 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces empty_config integration tests on connection={{ + msg: + START vyos_firewall_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml index 01d30b6..5776718 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces overridden integration tests on connection={{ + msg: + START vyos_firewall_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,18 +13,14 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: out state: overridden @@ -60,7 +57,6 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml index c7032e1..105c647 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces parsed integration tests on connection={{ + msg: + START vyos_firewall_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,7 +13,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather firewall_interfaces facts register: firewall_interfaces_facts vyos.vyos.vyos_facts: @@ -29,7 +29,8 @@ - name: Assert that correct parsing done assert: - that: "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed'])\ + that: + "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed'])\ \ |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) @@ -41,7 +42,6 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml index 022dd50..3283ec6 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml @@ -1,21 +1,18 @@ --- - debug: - msg: START vyos_firewall_interfaces rendered integration tests on connection={{ + msg: + START vyos_firewall_interfaces rendered integration tests on connection={{ ansible_connection }} - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -27,16 +24,13 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -48,7 +42,6 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local state: rendered @@ -68,5 +61,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml index b2b0067..d82a0f6 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces replaced integration tests on connection={{ + msg: + START vyos_firewall_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,34 +13,27 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed firewall rules with provided configurations register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - name: OUTBOUND direction: out - afi: ipv6 rules: - - name: V6-LOCAL direction: local - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in state: replaced @@ -77,7 +71,6 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml index 9155b7c..ff3abb1 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_interfaces round trip integration tests on connection={{ + msg: + START vyos_firewall_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,18 +11,14 @@ - include_tasks: _populate_rule_sets.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_firewall_interfaces: config: - - name: eth1 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -33,7 +30,6 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local state: merged @@ -49,13 +45,10 @@ register: result vyos.vyos.vyos_firewall_interfaces: config: - - name: eth2 access_rules: - - afi: ipv4 rules: - - name: INBOUND direction: in @@ -67,14 +60,14 @@ - afi: ipv6 rules: - - name: V6-LOCAL direction: local state: merged - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -85,10 +78,10 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/defaults/main.yaml b/tests/integration/targets/vyos_firewall_rules/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_firewall_rules/defaults/main.yaml +++ b/tests/integration/targets/vyos_firewall_rules/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_firewall_rules/tasks/cli.yaml b/tests/integration/targets/vyos_firewall_rules/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_firewall_rules/tasks/cli.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml index 551736e..12adf4f 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set firewall group address-group 'inbound'\nset firewall ipv6-name UPLINK\ + lines: + "set firewall group address-group 'inbound'\nset firewall ipv6-name UPLINK\ \ default-action 'accept'\nset firewall ipv6-name UPLINK description 'This\ \ is ipv6 specific rule-set'\nset firewall ipv6-name UPLINK rule 1 action\ \ 'accept'\nset firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule\ @@ -24,4 +25,4 @@ \ firewall name INBOUND rule 103 state new 'disable'\nset firewall name INBOUND\ \ rule 103 state related 'enable'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/_remove_config.yaml index acb0803..b4fc796 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/_remove_config.yaml @@ -3,4 +3,4 @@ vars: lines: "delete firewall ipv6-name\ndelete firewall name\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml index 67bfd3c..6a830f9 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_rules deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete firewall rule set. register: result vyos.vyos.vyos_firewall_rules: &id001 @@ -52,5 +52,4 @@ - "{{ deleted_rs['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml index e20670d..e104171 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_rules deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete firewall rule. register: result vyos.vyos.vyos_firewall_rules: &id001 config: - - afi: ipv6 - afi: ipv4 @@ -50,5 +49,4 @@ - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml index 16e563c..9df5127 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{ + msg: + Start vyos_firewall_rules deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete all the firewall rules. register: result vyos.vyos.vyos_firewall_rules: &id001 @@ -46,5 +46,4 @@ - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml index c30cf03..ba71e71 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_rules empty_config integration tests on connection={{ + msg: + START vyos_firewall_rules empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml index 6acc951..aac79e5 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml @@ -8,20 +8,16 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_firewall_rules: &id001 config: - - afi: ipv4 rule_sets: - - name: Downlink description: IPv4 INBOUND rule set default_action: accept rules: - - number: 501 action: accept description: Rule 501 is configured by Ansible @@ -65,5 +61,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml index bc95524..3e4c972 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_rules parsed integration tests on connection={{ ansible_connection + msg: + START vyos_firewall_rules parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided Firewall rules config to agnostic model diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml index 6670fd7..d376744 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml @@ -1,32 +1,28 @@ --- - debug: - msg: START vyos_firewall_rules rendered integration tests on connection={{ ansible_connection + msg: + START vyos_firewall_rules rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_firewall_rules: config: - - afi: ipv6 rule_sets: - - name: UPLINK description: This is ipv6 specific rule-set default_action: accept - afi: ipv4 rule_sets: - - name: INBOUND description: IPv4 INBOUND rule set default_action: accept rules: - - number: 101 action: accept description: Rule 101 is configured by Ansible diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml index eba1689..850aa60 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_firewall_rules replaced integration tests on connection={{ ansible_connection + msg: + START vyos_firewall_rules replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,28 +9,23 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed firewall rules with provided configurations register: result vyos.vyos.vyos_firewall_rules: &id001 config: - - afi: ipv6 rule_sets: - - name: UPLINK description: This is ipv6 specific rule-set default_action: accept - afi: ipv4 rule_sets: - - name: INBOUND description: IPv4 INBOUND rule set default_action: accept rules: - - number: 101 action: accept description: Rule 101 is configured by Ansible @@ -74,5 +70,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml index 762086f..f3f4252 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml @@ -6,20 +6,16 @@ - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_firewall_rules: config: - - afi: ipv6 rule_sets: - - name: UPLINK description: This is ipv6 specific rule-set default_action: accept rules: - - number: 1 action: accept description: Fwipv6-Rule 1 is configured by Ansible @@ -32,12 +28,10 @@ - afi: ipv4 rule_sets: - - name: INBOUND description: IPv4 INBOUND rule set default_action: accept rules: - - number: 101 action: accept description: Rule 101 is configured by Ansible @@ -60,15 +54,12 @@ register: result vyos.vyos.vyos_firewall_rules: config: - - afi: ipv4 rule_sets: - - name: INBOUND description: IPv4 INBOUND rule set default_action: accept rules: - - number: 103 action: accept description: Rule 103 is configured by Ansible @@ -83,7 +74,8 @@ - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -94,8 +86,8 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/defaults/main.yaml b/tests/integration/targets/vyos_hostname/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_hostname/defaults/main.yaml +++ b/tests/integration/targets/vyos_hostname/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_hostname/meta/main.yaml b/tests/integration/targets/vyos_hostname/meta/main.yaml index 91da2a7..ed97d53 100644 --- a/tests/integration/targets/vyos_hostname/meta/main.yaml +++ b/tests/integration/targets/vyos_hostname/meta/main.yaml @@ -1,2 +1 @@ --- -... diff --git a/tests/integration/targets/vyos_hostname/tasks/cli.yaml b/tests/integration/targets/vyos_hostname/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_hostname/tasks/cli.yaml +++ b/tests/integration/targets/vyos_hostname/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml b/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml index 5f9df51..2c052f4 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml @@ -7,7 +7,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_hostname: &id001 @@ -25,7 +24,8 @@ that: - result.after == {} - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_hostname: *id001 @@ -36,5 +36,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml b/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml index 0509fc5..f3eacad 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_hostname: @@ -24,5 +23,4 @@ - result.gathered == ansible_facts['network_resources']['hostname'] always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml b/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml index f9b28c7..14ed1df 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml @@ -24,7 +24,6 @@ - result.after == ansible_facts['network_resources']['hostname'] - result.after == merged.after - - name: Assert that before dicts were correctly generated assert: that: diff --git a/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml b/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml index d9fd76d..a50ef64 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml @@ -26,7 +26,6 @@ - result.after == ansible_facts['network_resources']['hostname'] - result.after == merged.after - - name: override the provided configuration with the existing running configuration (IDEMPOTENT) diff --git a/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml b/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml index f6c00bb..b1aa806 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_hostname parsed integration tests on connection={{ ansible_connection + msg: + START vyos_hostname parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) @@ -9,7 +10,6 @@ running_config: "{{ lookup('file', '_parsed.cfg') }}" state: parsed - - name: Assert that config was correctly parsed assert: that: diff --git a/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml b/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml index 28ec797..25c81b2 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml @@ -10,7 +10,7 @@ register: result vyos.vyos.vyos_hostname: config: - hostname: 'vyosTest' + hostname: "vyosTest" state: rendered - assert: diff --git a/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml b/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml index 6acb993..7d9b522 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml @@ -26,7 +26,6 @@ - result.after == ansible_facts['network_resources']['hostname'] - result.after == merged.after - - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT) diff --git a/tests/integration/targets/vyos_hostname/vars/main.yaml b/tests/integration/targets/vyos_hostname/vars/main.yaml index 615da43..ca02d03 100644 --- a/tests/integration/targets/vyos_hostname/vars/main.yaml +++ b/tests/integration/targets/vyos_hostname/vars/main.yaml @@ -4,7 +4,7 @@ merged: commands: - set system host-name vyosTest after: - hostname: 'vyosTest' + hostname: "vyosTest" deleted: commands: diff --git a/tests/integration/targets/vyos_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_interfaces/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_interfaces/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml index 686236f..702930c 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set interfaces ethernet \"{{ intf }}\" description 'Configured by Ansible'\n\ + lines: + "set interfaces ethernet \"{{ intf }}\" description 'Configured by Ansible'\n\ set interfaces ethernet \"{{ intf }}\" speed 'auto'\nset interfaces ethernet\ \ \"{{ intf }}\" duplex 'auto'\nset interfaces ethernet \"{{ intf }}\" mtu\ \ '1500'\nset interfaces ethernet \"{{ intf }}\" vif 200\nset interfaces ethernet\ @@ -12,4 +13,4 @@ loop_control: loop_var: intf ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml index 298cf5d..6353d1c 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml @@ -1,7 +1,8 @@ --- - name: Remove Config vars: - lines: "delete interfaces ethernet \"{{ intf }}\" description\ndelete interfaces\ + lines: + "delete interfaces ethernet \"{{ intf }}\" description\ndelete interfaces\ \ ethernet \"{{ intf }}\" speed\ndelete interfaces ethernet \"{{ intf }}\"\ \ duplex\ndelete interfaces ethernet \"{{ intf }}\" mtu\ndelete interfaces\ \ ethernet \"{{ intf }}\" disable\ndelete interfaces ethernet \"{{ intf }}\"\ @@ -12,4 +13,4 @@ loop_control: loop_var: intf ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml index 56e747a..2c12ff2 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection + msg: + Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete attributes of given interfaces register: result vyos.vyos.vyos_interfaces: &id001 config: - - name: eth1 - name: eth2 @@ -49,5 +48,4 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml index 9921e5d..d4052c8 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces overridden integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,12 +9,10 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_interfaces: &id001 config: - - name: eth0 speed: auto duplex: auto @@ -55,5 +54,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml index a44fc2f..a22fb60 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml index 5030d71..e8f3591 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces rendered integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_interfaces: @@ -43,5 +43,4 @@ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml index 8b68c5a..daf8045 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_interfaces replaced integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,16 +9,13 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed interfaces with provided configurations register: result vyos.vyos.vyos_interfaces: &id001 config: - - name: eth1 description: Replaced by Ansible vifs: - - vlan_id: 100 description: VIF 100 - Replaced by Ansible @@ -43,7 +41,8 @@ - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - - name: Replace device configurations of listed interfaces with provided configurarions + - name: + Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_interfaces: *id001 @@ -59,5 +58,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml index f003c0b..5aefbb4 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: START vyos_interfaces round trip integration tests on connection={{ ansible_connection + msg: + START vyos_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_interfaces: config: - - name: eth0 enabled: true duplex: auto @@ -21,7 +20,6 @@ description: Interface - 1 mtu: 1500 vifs: - - vlan_id: 100 description: Eth1 - VIF 100 mtu: 200 @@ -46,12 +44,10 @@ register: result vyos.vyos.vyos_interfaces: config: - - name: eth1 description: Interface 1 - Description (WILL BE REVERTED) mtu: 1200 vifs: - - vlan_id: 100 description: Eth1 - VIF 100 (WILL BE REVERTED) mtu: 400 @@ -68,7 +64,8 @@ - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -79,8 +76,8 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_l3_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_l3_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_l3_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_l3_interfaces/tasks/cli.yaml index f622cf9..8aeb46d 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -12,9 +12,9 @@ delegate_to: localhost - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_l3_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_l3_interfaces/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml index 563b1d7..d5d8620 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml @@ -1,9 +1,10 @@ --- - name: Setup vars: - lines: "set interfaces ethernet eth1 address '192.0.2.14/24'\nset interfaces\ + lines: + "set interfaces ethernet eth1 address '192.0.2.14/24'\nset interfaces\ \ ethernet eth2 address '192.0.2.10/24'\nset interfaces ethernet eth2 address\ \ '192.0.2.11/24'\nset interfaces ethernet eth2 address '2001:db8::10/32'\n\ set interfaces ethernet eth2 address '2001:db8::12/32'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml index 1fb0dd3..c5acac9 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml @@ -1,7 +1,8 @@ --- - name: Remove Config vars: - lines: "delete interfaces ethernet \"{{ intf }}\" address\ndelete interfaces\ + lines: + "delete interfaces ethernet \"{{ intf }}\" address\ndelete interfaces\ \ ethernet \"{{ intf }}\" vif\n" loop: - eth1 @@ -9,4 +10,4 @@ loop_control: loop_var: intf ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml index ff4aabf..25ce28e 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml @@ -1,19 +1,18 @@ --- - debug: - msg: Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection + msg: + Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - include_tasks: _populate.yaml - name: Delete attributes of given interfaces register: result vyos.vyos.vyos_l3_interfaces: &id001 config: - - name: eth1 - name: eth2 @@ -51,5 +50,4 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml index 9929dd7..15393fb 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_l3_interfaces empty_config integration tests on connection={{ + msg: + START vyos_l3_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml index 644fe08..dc6f0ce 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml @@ -1,27 +1,24 @@ --- - debug: - msg: START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection + msg: + START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - include_tasks: _populate.yaml - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_l3_interfaces: &id001 config: - - name: eth0 ipv4: - - address: dhcp - name: eth1 ipv4: - - address: 192.0.2.15/24 state: overridden @@ -57,5 +54,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml index d5ff205..6640271 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_l3_nterfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_l3_nterfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml index 02a2865..7bbf53c 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_l3_interfaces rendered integration tests on connection={{ ansible_connection + msg: + START vyos_l3_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_l3_interfaces: &id001 @@ -40,5 +40,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml index 2c664bb..c102602 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml @@ -1,27 +1,24 @@ --- - debug: - msg: START vyos_l3_interfaces replaced integration tests on connection={{ ansible_connection + msg: + START vyos_l3_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - include_tasks: _populate.yaml - name: Replace device configurations of listed interfaces with provided configurations register: result vyos.vyos.vyos_l3_interfaces: &id001 config: - - name: eth1 ipv4: - - address: 192.0.2.19/24 - name: eth2 ipv6: - - address: 2001:db8::11/32 state: replaced @@ -42,7 +39,8 @@ - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - - name: Replace device configurations of listed interfaces with provided configurarions + - name: + Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_l3_interfaces: *id001 @@ -58,5 +56,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml index 33082d5..bee2a09 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml @@ -7,7 +7,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.l3_interfaces: &id001 @@ -39,5 +38,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml index 927a6ce..00b7e6e 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml @@ -3,4 +3,4 @@ vars: lines: "set interfaces bonding bond0\nset interfaces bonding bond1\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml index f646742..4ad0b85 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml @@ -1,11 +1,12 @@ --- - name: Setup vars: - lines: "set interfaces bonding bond0\nset interfaces bonding bond0 hash-policy\ + lines: + "set interfaces bonding bond0\nset interfaces bonding bond0 hash-policy\ \ 'layer2'\nset interfaces bonding bond0 mode 'active-backup'\nset interfaces\ \ ethernet eth1 bond-group bond0\nset interfaces bonding bond1\nset interfaces\ \ bonding bond0 primary 'eth1'\nset interfaces bonding bond1 hash-policy 'layer2+3'\n\ set interfaces bonding bond1 mode 'active-backup'\nset interfaces ethernet\ \ eth2 bond-group bond1\nset interfaces bonding bond1 primary 'eth2'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml index 6679d6a..dfc9920 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml @@ -3,4 +3,4 @@ vars: lines: "delete interfaces bonding bond0\ndelete interfaces bonding bond1\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml index 5469bf5..11432ea 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml @@ -1,10 +1,11 @@ --- - name: Remove Config vars: - lines: "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ + lines: + "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ \ eth1 bond-group bond0\ndelete interfaces bonding bond0 mode\ndelete interfaces\ \ bonding bond0 primary\ndelete interfaces bonding bond1 hash-policy\ndelete\ \ interfaces ethernet eth2 bond-group bond1\ndelete interfaces bonding bond1\ \ mode\ndelete interfaces bonding bond1 primary\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml index ac8204f..56f1ed6 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: Start vyos_lag_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete attributes of given LAG interfaces. register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - - name: bond0 - name: bond1 @@ -49,5 +48,4 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml index 6e89eae..22ac8a8 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces empty_config integration tests on connection={{ + msg: + START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml index aa6e247..9682fd7 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml @@ -10,16 +10,13 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - - name: bond1 mode: active-backup members: - - member: eth2 primary: eth2 hash_policy: layer2 @@ -57,5 +54,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml index ed7bc61..ce2df0d 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather lag_interfaces facts register: lag_interfaces_facts vyos.vyos.vyos_facts: @@ -25,9 +25,9 @@ - name: Assert that correct parsing done assert: - that: "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\ + that: + "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml index e6d7928..781100f 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection + msg: + START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_lag_interfaces: @@ -34,5 +34,4 @@ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml index c080056..c8b711b 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection + msg: + START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,18 +9,15 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed LAG interfaces with provided configurations register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - - name: bond1 mode: 802.3ad hash_policy: layer2 members: - - member: eth2 state: replaced @@ -56,5 +54,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml index 55e2bbf..f5f6098 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml @@ -8,17 +8,14 @@ - include_tasks: _remove_bond.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_lag_interfaces: config: - - name: bond0 hash_policy: layer2 mode: active-backup members: - - member: eth1 primary: eth1 @@ -26,7 +23,6 @@ hash_policy: layer2+3 mode: active-backup members: - - member: eth2 primary: eth2 state: merged @@ -42,25 +38,23 @@ register: result vyos.vyos.vyos_lag_interfaces: config: - - name: bond0 hash_policy: layer2+3 mode: 802.3ad members: - - member: eth1 - name: bond1 hash_policy: layer2 mode: xor-hash members: - - member: eth2 state: merged - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -71,8 +65,8 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/defaults/main.yaml b/tests/integration/targets/vyos_lldp_global/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_lldp_global/defaults/main.yaml +++ b/tests/integration/targets/vyos_lldp_global/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_lldp_global/tasks/cli.yaml b/tests/integration/targets/vyos_lldp_global/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_lldp_global/tasks/cli.yaml +++ b/tests/integration/targets/vyos_lldp_global/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml index e439242..24c114d 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set service lldp\nset service lldp legacy-protocols 'cdp'\nset service\ + lines: + "set service lldp\nset service lldp legacy-protocols 'cdp'\nset service\ \ lldp management-address '192.0.2.17'\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml index b823449..7e5b37c 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml @@ -1,7 +1,8 @@ --- - name: Remove Config vars: - lines: "delete service lldp legacy-protocols\ndelete service lldp management-address\n\ + lines: + "delete service lldp legacy-protocols\ndelete service lldp management-address\n\ delete service lldp\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml index f4c6cbc..c086e2b 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml @@ -6,7 +6,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete attributes of LLDP service. register: result vyos.vyos.vyos_lldp_global: &id001 @@ -43,5 +42,4 @@ that: - "{{ deleted['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml index b9c3abf..1047f30 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lldp_global parsed integration tests on connection={{ ansible_connection + msg: + START vyos_lldp_global parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided LLDP global config to agnostic model diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml index 5e9f4c5..59ff032 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml @@ -6,7 +6,6 @@ - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_lldp_global: @@ -24,5 +23,4 @@ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml index 9a833f5..6859dc8 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lldp_global replaced integration tests on connection={{ ansible_connection + msg: + START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of LLDP service with provided configurations register: result vyos.vyos.vyos_lldp_global: &id001 @@ -36,7 +36,8 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: Replace device configurations of LLDP service with provided configurarions + - name: + Replace device configurations of LLDP service with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_global: *id001 @@ -51,5 +52,4 @@ that: - "{{ replaced['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml index 2e8284f..b0bd603 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: START vyos_lldp_global round trip integration tests on connection={{ ansible_connection + msg: + START vyos_lldp_global round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_lldp_global: @@ -49,5 +49,4 @@ assert: that: "{{ base_config['after'] == revert['after'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_lldp_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_lldp_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_lldp_interfaces/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml index 4353cec..406d30b 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml @@ -1,7 +1,8 @@ --- - name: Setup vars: - lines: "set service lldp interface eth1\nset service lldp interface eth1 location\ + lines: + "set service lldp interface eth1\nset service lldp interface eth1 location\ \ civic-based country-code US\nset service lldp interface eth1 location civic-based\ \ ca-type 0 ca-value ENGLISH\nset service lldp interface eth2\nset service\ \ lldp interface eth2 location coordinate-based latitude 33.524449N\nset service\ @@ -9,4 +10,4 @@ \ lldp interface eth2 location coordinate-based datum WGS84\nset service lldp\ \ interface eth2 location coordinate-based longitude 222.267255W\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml index 11e2940..208f21e 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml @@ -1,8 +1,9 @@ --- - name: Setup vars: - lines: "set service lldp interface eth2\nset service lldp interface eth2 location\ + lines: + "set service lldp interface eth2\nset service lldp interface eth2 location\ \ civic-based country-code US\nset service lldp interface eth2 location civic-based\ \ ca-type 0 ca-value ENGLISH\nset service lldp interface eth2 disable\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_remove_config.yaml index a885f01..c8ab352 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_remove_config.yaml @@ -3,4 +3,4 @@ vars: lines: "delete service lldp interface\ndelete service lldp\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml index 21bf96d..c5b30af 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml @@ -1,17 +1,16 @@ --- - debug: - msg: Start vyos_lldp_interfaces deleted integration tests ansible_connection={{ + msg: + Start vyos_lldp_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete attributes of given LLDP interfaces. register: result vyos.vyos.vyos_lldp_interfaces: &id001 config: - - name: eth1 - name: eth2 @@ -50,5 +49,4 @@ - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml index 4ef40c9..6c097e3 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lldp_interfaces empty_config integration tests on connection={{ + msg: + START vyos_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml index 3e6ce40..e077e01 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lldp_interfaces overridden integration tests on connection={{ + msg: + START vyos_lldp_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,12 +9,10 @@ - include_tasks: _populate_intf.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_lldp_interfaces: &id001 config: - - name: eth2 location: elin: 0000000911 @@ -52,5 +51,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml index 0ca52be..a32e9d5 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_lldp_nterfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_lldp_nterfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml index 342e64b..87bed90 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: START vyos_lldp_interfaces rendered integration tests on connection={{ ansible_connection + msg: + START vyos_lldp_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_lldp_interfaces: @@ -33,5 +33,4 @@ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml index 3218e80..e76e3b2 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml @@ -8,20 +8,18 @@ - include_tasks: _populate.yaml - block: - - - name: Replace device configurations of listed LLDP interfaces with provided + - name: + Replace device configurations of listed LLDP interfaces with provided configurations register: result vyos.vyos.vyos_lldp_interfaces: &id001 config: - - name: eth2 enable: false location: civic_based: country_code: US ca_info: - - ca_type: 0 ca_value: ENGLISH @@ -52,7 +50,8 @@ - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - - name: Replace device configurations of listed LLDP interfaces with provided + - name: + Replace device configurations of listed LLDP interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_interfaces: *id001 @@ -68,5 +67,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml index e6189a3..e23253b 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml @@ -1,23 +1,21 @@ --- - debug: - msg: START vyos_lldp_interfaces round trip integration tests on connection={{ + msg: + START vyos_lldp_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_lldp_interfaces: config: - - name: eth1 location: civic_based: country_code: US ca_info: - - ca_type: 0 ca_value: ENGLISH state: merged @@ -33,7 +31,6 @@ register: result vyos.vyos.vyos_lldp_interfaces: config: - - name: eth2 location: coordinate_based: @@ -45,7 +42,8 @@ - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -56,8 +54,8 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml index f43a8e8..0b06a74 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml @@ -12,7 +12,6 @@ register: result vyos.vyos.lldp_interfaces: &id001 config: - - name: eth2 location: elin: 0000000911 diff --git a/tests/integration/targets/vyos_logging/defaults/main.yaml b/tests/integration/targets/vyos_logging/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_logging/defaults/main.yaml +++ b/tests/integration/targets/vyos_logging/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_logging/tasks/cli.yaml b/tests/integration/targets/vyos_logging/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_logging/tasks/cli.yaml +++ b/tests/integration/targets/vyos_logging/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_logging/tests/cli/basic.yaml b/tests/integration/targets/vyos_logging/tests/cli/basic.yaml index a025047..708623e 100644 --- a/tests/integration/targets/vyos_logging/tests/cli/basic.yaml +++ b/tests/integration/targets/vyos_logging/tests/cli/basic.yaml @@ -84,7 +84,6 @@ register: result vyos.vyos.vyos_logging: aggregate: - - dest: file name: test1 facility: all @@ -106,7 +105,6 @@ register: result vyos.vyos.vyos_logging: aggregate: - - dest: console facility: all level: info @@ -132,7 +130,6 @@ register: result vyos.vyos.vyos_logging: aggregate: - - dest: console facility: all level: info diff --git a/tests/integration/targets/vyos_logging_global/defaults/main.yaml b/tests/integration/targets/vyos_logging_global/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_logging_global/defaults/main.yaml +++ b/tests/integration/targets/vyos_logging_global/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_logging_global/meta/main.yaml b/tests/integration/targets/vyos_logging_global/meta/main.yaml index 91da2a7..ed97d53 100644 --- a/tests/integration/targets/vyos_logging_global/meta/main.yaml +++ b/tests/integration/targets/vyos_logging_global/meta/main.yaml @@ -1,2 +1 @@ --- -... diff --git a/tests/integration/targets/vyos_logging_global/tasks/cli.yaml b/tests/integration/targets/vyos_logging_global/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_logging_global/tasks/cli.yaml +++ b/tests/integration/targets/vyos_logging_global/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml index f70fff1..2764ed6 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_logging_global empty_config integration tests on connection={{ + msg: + START vyos_logging_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml index d47d309..8d2283c 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml @@ -6,7 +6,8 @@ - include_tasks: _remove_config.yaml -- block: # no after state match because 1.1.8 vyos does show all commands on show command +- block: + # no after state match because 1.1.8 vyos does show all commands on show command - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.vyos_logging_global: &id001 diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml index 1df1a8d..e5eea38 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml @@ -7,7 +7,8 @@ - include_tasks: _populate.yaml -- block: # no after state match because 1.1.8 vyos does show all commands on show command +- block: + # no after state match because 1.1.8 vyos does show all commands on show command - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_logging_global: &id001 @@ -35,5 +36,4 @@ vyos.vyos.vyos_logging_global: *id001 always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml index 366f889..01caca5 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_logging_global rendered integration tests on connection={{ ansible_connection + msg: + START vyos_logging_global rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_logging_global: &id001 @@ -46,5 +46,4 @@ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ntp_global/defaults/main.yaml b/tests/integration/targets/vyos_ntp_global/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_ntp_global/defaults/main.yaml +++ b/tests/integration/targets/vyos_ntp_global/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_ntp_global/tasks/cli.yaml b/tests/integration/targets/vyos_ntp_global/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_ntp_global/tasks/cli.yaml +++ b/tests/integration/targets/vyos_ntp_global/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml index 530e2ad..81f406c 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml @@ -7,7 +7,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_ntp_global: &id001 @@ -25,7 +24,8 @@ that: - result.after == populate.config - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ntp_global: *id001 @@ -36,5 +36,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml index 5ac350d..3c9032b 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_ntp_global: diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml index 2a22ad8..ad36012 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml @@ -37,7 +37,6 @@ - result.after == ansible_facts['network_resources']['ntp_global'] - result.after == merged.after - - name: Assert that before dicts were correctly generated assert: that: diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml index 2269e74..43def13 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_ntp_global: &id001 @@ -38,7 +37,8 @@ - result.after == ansible_facts['network_resources']['ntp_global'] - result.after == overridden.after - - name: Override the existing configuration with the provided running configuration + - name: + Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ntp_global: *id001 @@ -49,5 +49,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml index c660ac4..09524b0 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_ntp_global parsed integration tests on connection={{ ansible_connection + msg: + START vyos_ntp_global parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) @@ -9,7 +10,6 @@ running_config: "{{ lookup('file', '_parsed.cfg') }}" state: parsed - - name: Assert that config was correctly parsed assert: that: diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml index 1c1edd7..8705509 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml @@ -6,7 +6,6 @@ - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_ntp_global: &id001 diff --git a/tests/integration/targets/vyos_ntp_global/vars/main.yaml b/tests/integration/targets/vyos_ntp_global/vars/main.yaml index 3b4dbc4..6cd65ce 100644 --- a/tests/integration/targets/vyos_ntp_global/vars/main.yaml +++ b/tests/integration/targets/vyos_ntp_global/vars/main.yaml @@ -62,7 +62,6 @@ overridden: - set system ntp server server2 preempt - set system ntp server server_add preempt - after: servers: - server: 0.pool.ntp.org diff --git a/tests/integration/targets/vyos_ospf_interfaces/defaults/main.yaml b/tests/integration/targets/vyos_ospf_interfaces/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/defaults/main.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_ospf_interfaces/tasks/cli.yaml b/tests/integration/targets/vyos_ospf_interfaces/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tasks/cli.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml index 58cd9ff..4efca68 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_ospf_interfaces: &id001 @@ -26,7 +25,8 @@ - result.commands|symmetric_difference(deleted.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == [] - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 @@ -37,5 +37,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml index aff0f66..f99b8fe 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_ospf_interfaces empty_config integration tests on connection={{ + msg: + START vyos_ospf_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml index 85a7cf2..21b6e5a 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_ospf_interfaces: diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml index 0db10d2..dae9a6e 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_ospf_interfaces overridden integration tests on connection={{ + msg: + START vyos_ospf_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_ospf_interfaces: &id001 @@ -33,7 +33,8 @@ - result.commands|symmetric_difference(overridden.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == [] - - name: Override the existing configuration with the provided running configuration + - name: + Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 @@ -44,5 +45,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml index 4e327e1..c260ec4 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_ospfv3_interfaces parsed integration tests on connection={{ ansible_connection + msg: + START vyos_ospfv3_interfaces parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml index 328406b..2c27672 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml @@ -6,7 +6,6 @@ - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_ospf_interfaces: diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml index a98b616..89c8c76 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_ospf_interfaces: &id001 @@ -44,7 +43,8 @@ - result.commands|symmetric_difference(replaced.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == [] - - name: Replace the existing configuration with the provided running configuration + - name: + Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 @@ -55,5 +55,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv2/defaults/main.yaml b/tests/integration/targets/vyos_ospfv2/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_ospfv2/defaults/main.yaml +++ b/tests/integration/targets/vyos_ospfv2/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_ospfv2/tasks/cli.yaml b/tests/integration/targets/vyos_ospfv2/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_ospfv2/tasks/cli.yaml +++ b/tests/integration/targets/vyos_ospfv2/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_ospfv2/tasks/redirection.yaml b/tests/integration/targets/vyos_ospfv2/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_ospfv2/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_ospfv2/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml index 9f358d5..a445375 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml @@ -2,34 +2,34 @@ - name: Setup vars: lines: "set protocols ospf mpls-te 'enable' \n - set protocols ospf mpls-te router-address '192.0.11.11' \n - set protocols ospf redistribute bgp metric-type '2' \n - set protocols ospf redistribute bgp metric '10'\n - set protocols ospf default-information originate metric-type '2' \n - set protocols ospf default-information originate 'always' \n - set protocols ospf default-information originate metric '10' \n - set protocols ospf default-information originate route-map 'ingress' \n - set protocols ospf auto-cost reference-bandwidth '2' \n - set protocols ospf parameters router-id '192.0.1.1' \n - set protocols ospf parameters 'opaque-lsa' \n - set protocols ospf parameters abr-type 'cisco' \n - set protocols ospf parameters 'rfc1583-compatibility' \n - set protocols ospf passive-interface 'eth1' \n - set protocols ospf passive-interface 'eth2' \n - set protocols ospf max-metric router-lsa on-shutdown '10' \n - set protocols ospf max-metric router-lsa 'administrative' \n - set protocols ospf max-metric router-lsa on-startup '10' \n - set protocols ospf log-adjacency-changes 'detail' \n - set protocols ospf neighbor 192.0.11.12 priority '2' \n - set protocols ospf neighbor 192.0.11.12 poll-interval '10' \n - set protocols ospf area 2 authentication 'plaintext-password' \n - set protocols ospf area 2 shortcut 'enable' \n - set protocols ospf area 2 area-type 'normal' \n - set protocols ospf area 3 area-type 'nssa' \n - set protocols ospf area 4 range 192.0.3.0/24 cost '10' \n - set protocols ospf area 4 range 192.0.4.0/24 cost '12' \n - set protocols ospf area 4 area-type stub default-cost '20' \n - set protocols ospf area 4 network '192.0.2.0/24'" + set protocols ospf mpls-te router-address '192.0.11.11' \n + set protocols ospf redistribute bgp metric-type '2' \n + set protocols ospf redistribute bgp metric '10'\n + set protocols ospf default-information originate metric-type '2' \n + set protocols ospf default-information originate 'always' \n + set protocols ospf default-information originate metric '10' \n + set protocols ospf default-information originate route-map 'ingress' \n + set protocols ospf auto-cost reference-bandwidth '2' \n + set protocols ospf parameters router-id '192.0.1.1' \n + set protocols ospf parameters 'opaque-lsa' \n + set protocols ospf parameters abr-type 'cisco' \n + set protocols ospf parameters 'rfc1583-compatibility' \n + set protocols ospf passive-interface 'eth1' \n + set protocols ospf passive-interface 'eth2' \n + set protocols ospf max-metric router-lsa on-shutdown '10' \n + set protocols ospf max-metric router-lsa 'administrative' \n + set protocols ospf max-metric router-lsa on-startup '10' \n + set protocols ospf log-adjacency-changes 'detail' \n + set protocols ospf neighbor 192.0.11.12 priority '2' \n + set protocols ospf neighbor 192.0.11.12 poll-interval '10' \n + set protocols ospf area 2 authentication 'plaintext-password' \n + set protocols ospf area 2 shortcut 'enable' \n + set protocols ospf area 2 area-type 'normal' \n + set protocols ospf area 3 area-type 'nssa' \n + set protocols ospf area 4 range 192.0.3.0/24 cost '10' \n + set protocols ospf area 4 range 192.0.4.0/24 cost '12' \n + set protocols ospf area 4 area-type stub default-cost '20' \n + set protocols ospf area 4 network '192.0.2.0/24'" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml index 7360870..9c963bc 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml @@ -3,4 +3,4 @@ vars: lines: "delete protocols ospf\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml index a61f5a7..9fc0d70 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml @@ -6,7 +6,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete attributes of ospfv2. register: result vyos.vyos.vyos_ospfv2: &id001 @@ -44,5 +43,4 @@ that: - "{{ deleted['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml index cfa29f9..ac5c203 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection + msg: + START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided ospfv2 config to agnostic model diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml index 8a805a6..e11aa6a 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml @@ -6,12 +6,11 @@ - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: 'detail' + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -22,48 +21,48 @@ always: true metric: 10 metric_type: 2 - route_map: 'ingress' + route_map: "ingress" mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 redistribute: - - route_type: 'bgp' + - route_type: "bgp" metric: 10 metric_type: 2 passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" parameters: - router_id: '192.0.1.1' + router_id: "192.0.1.1" opaque_lsa: true rfc1583_compatibility: true - abr_type: 'cisco' + abr_type: "cisco" areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" area_type: stub: default_cost: 20 network: - - address: '192.0.2.0/24' + - address: "192.0.2.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 state: rendered diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml index 07606f9..e1fc389 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml @@ -8,12 +8,11 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed ospfv2 routes with provided configurations register: result vyos.vyos.vyos_ospfv2: &id001 config: - log_adjacency_changes: 'detail' + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -24,44 +23,44 @@ always: true metric: 10 metric_type: 2 - route_map: 'ingress' + route_map: "ingress" mpls_te: enabled: true - router_address: '192.0.22.22' + router_address: "192.0.22.22" auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 redistribute: - - route_type: 'bgp' + - route_type: "bgp" metric: 10 metric_type: 2 passive_interface: - - 'eth1' + - "eth1" parameters: - router_id: '192.0.1.1' + router_id: "192.0.1.1" opaque_lsa: true rfc1583_compatibility: true - abr_type: 'cisco' + abr_type: "cisco" areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '4' + shortcut: "enable" + - area_id: "4" area_type: stub: default_cost: 20 network: - - address: '192.0.2.0/24' - - address: '192.0.12.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' + - address: "192.0.2.0/24" + - address: "192.0.12.0/24" + - address: "192.0.22.0/24" + - address: "192.0.32.0/24" range: - - address: '1.1.2.0/24' + - address: "1.1.2.0/24" cost: 10 state: replaced @@ -81,7 +80,8 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: Replace device configurations of listed ospfv2 routes with provided configurarions + - name: + Replace device configurations of listed ospfv2 routes with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv2: *id001 @@ -96,5 +96,4 @@ that: - "{{ replaced['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml index 7efc2a7..9407ffa 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml @@ -6,12 +6,11 @@ - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: 'detail' + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -22,48 +21,48 @@ always: true metric: 10 metric_type: 2 - route_map: 'ingress' + route_map: "ingress" mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 redistribute: - - route_type: 'bgp' + - route_type: "bgp" metric: 10 metric_type: 2 passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" parameters: - router_id: '192.0.1.1' + router_id: "192.0.1.1" opaque_lsa: true rfc1583_compatibility: true - abr_type: 'cisco' + abr_type: "cisco" areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" area_type: stub: default_cost: 20 network: - - address: '192.0.2.0/24' + - address: "192.0.2.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 state: merged @@ -79,23 +78,23 @@ vyos.vyos.vyos_ospfv2: config: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '4' + shortcut: "enable" + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.12.0/24' - - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' + - address: "192.0.12.0/24" + - address: "192.0.2.0/24" + - address: "192.0.22.0/24" + - address: "192.0.32.0/24" range: - - address: '1.1.2.0/24' + - address: "1.1.2.0/24" cost: 10 auto_cost: reference_bandwidth: 2 @@ -104,8 +103,8 @@ always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -113,22 +112,22 @@ on_startup: 10 mpls_te: enabled: true - router_address: '192.0.22.22' + router_address: "192.0.22.22" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' + - "eth1" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" state: replaced - name: Assert that changes were applied @@ -145,5 +144,4 @@ assert: that: "{{ base_config['after'] == revert['after']}}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv2/vars/main.yaml b/tests/integration/targets/vyos_ospfv2/vars/main.yaml index e55da20..da81c19 100644 --- a/tests/integration/targets/vyos_ospfv2/vars/main.yaml +++ b/tests/integration/targets/vyos_ospfv2/vars/main.yaml @@ -40,26 +40,26 @@ merged: - set protocols ospf area 4 network 192.0.2.0/24 after: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.2.0/24' + - address: "192.0.2.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 auto_cost: reference_bandwidth: 2 @@ -68,8 +68,8 @@ merged: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -77,46 +77,46 @@ merged: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" merged_update: before: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.2.0/24' + - address: "192.0.2.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 auto_cost: reference_bandwidth: 2 @@ -125,8 +125,8 @@ merged_update: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -134,43 +134,43 @@ merged_update: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" after: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" network: - - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' + - address: "192.0.2.0/24" + - address: "192.0.22.0/24" + - address: "192.0.32.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 auto_cost: reference_bandwidth: 2 @@ -179,8 +179,8 @@ merged_update: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -188,49 +188,49 @@ merged_update: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" commands: - delete protocols ospf area 4 area-type stub - set protocols ospf area 4 network 192.0.22.0/24 - set protocols ospf area 4 network 192.0.32.0/24 populate: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.2.0/24' + - address: "192.0.2.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 auto_cost: reference_bandwidth: 2 @@ -239,8 +239,8 @@ populate: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -248,23 +248,23 @@ populate: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" replaced: commands: - delete protocols ospf passive-interface eth2 @@ -281,23 +281,23 @@ replaced: - set protocols ospf area 4 network 192.0.32.0/24 after: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '4' + shortcut: "enable" + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.12.0/24' - - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' + - address: "192.0.12.0/24" + - address: "192.0.2.0/24" + - address: "192.0.22.0/24" + - address: "192.0.32.0/24" range: - - address: '1.1.2.0/24' + - address: "1.1.2.0/24" cost: 10 auto_cost: reference_bandwidth: 2 @@ -306,8 +306,8 @@ replaced: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -315,22 +315,22 @@ replaced: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.22.22' + router_address: "192.0.22.22" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' + - "eth1" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" rendered: commands: - set protocols ospf mpls-te enable @@ -372,26 +372,26 @@ rendered: parsed: after: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' + shortcut: "enable" + - area_id: "3" area_type: nssa: set: true - - area_id: '4' + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.2.0/24' + - address: "192.0.2.0/24" range: - - address: '192.0.3.0/24' + - address: "192.0.3.0/24" cost: 10 - - address: '192.0.4.0/24' + - address: "192.0.4.0/24" cost: 12 auto_cost: reference_bandwidth: 2 @@ -400,8 +400,8 @@ parsed: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -409,47 +409,47 @@ parsed: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: "192.0.11.11" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' - - 'eth2' + - "eth1" + - "eth2" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" deleted: commands: - - 'delete protocols ospf' + - "delete protocols ospf" after: {} round_trip: after: areas: - - area_id: '2' + - area_id: "2" area_type: normal: true authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '4' + shortcut: "enable" + - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: '192.0.12.0/24' - - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' + - address: "192.0.12.0/24" + - address: "192.0.2.0/24" + - address: "192.0.22.0/24" + - address: "192.0.32.0/24" range: - - address: '1.1.2.0/24' + - address: "1.1.2.0/24" cost: 10 auto_cost: reference_bandwidth: 2 @@ -458,8 +458,8 @@ round_trip: always: true metric: 10 metric_type: 2 - route_map: 'ingress' - log_adjacency_changes: 'detail' + route_map: "ingress" + log_adjacency_changes: "detail" max_metric: router_lsa: administrative: true @@ -467,19 +467,19 @@ round_trip: on_startup: 10 mpls_te: enabled: true - router_address: '192.0.22.22' + router_address: "192.0.22.22" neighbor: - - neighbor_id: '192.0.11.12' + - neighbor_id: "192.0.11.12" poll_interval: 10 priority: 2 parameters: - abr_type: 'cisco' + abr_type: "cisco" opaque_lsa: true rfc1583_compatibility: true - router_id: '192.0.1.1' + router_id: "192.0.1.1" passive_interface: - - 'eth1' + - "eth1" redistribute: - metric: 10 metric_type: 2 - route_type: 'bgp' + route_type: "bgp" diff --git a/tests/integration/targets/vyos_ospfv3/defaults/main.yaml b/tests/integration/targets/vyos_ospfv3/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_ospfv3/defaults/main.yaml +++ b/tests/integration/targets/vyos_ospfv3/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_ospfv3/tasks/cli.yaml b/tests/integration/targets/vyos_ospfv3/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_ospfv3/tasks/cli.yaml +++ b/tests/integration/targets/vyos_ospfv3/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_ospfv3/tasks/redirection.yaml b/tests/integration/targets/vyos_ospfv3/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_ospfv3/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_ospfv3/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml index fb66d0a..31f90ef 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml @@ -2,12 +2,12 @@ - name: Setup vars: lines: "set protocols ospfv3 area 2 export-list 'export1' \n - set protocols ospfv3 area 2 import-list 'import1' \n - set protocols ospfv3 area 2 range '2001:db10::/32' \n - set protocols ospfv3 area 2 range '2001:db20::/32' \n - set protocols ospfv3 area 2 range '2001:db30::/32' \n - set protocols ospfv3 area 3 range '2001:db40::/32' \n - set protocols ospfv3 parameters router-id '192.0.2.10' \n - set protocols ospfv3 redistribute 'bgp'" + set protocols ospfv3 area 2 import-list 'import1' \n + set protocols ospfv3 area 2 range '2001:db10::/32' \n + set protocols ospfv3 area 2 range '2001:db20::/32' \n + set protocols ospfv3 area 2 range '2001:db30::/32' \n + set protocols ospfv3 area 3 range '2001:db40::/32' \n + set protocols ospfv3 parameters router-id '192.0.2.10' \n + set protocols ospfv3 redistribute 'bgp'" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml index 2a47505..ca4537e 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml @@ -3,4 +3,4 @@ vars: lines: "delete protocols ospfv3\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml index 55bec18..e0be4c3 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml @@ -6,7 +6,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete ospfv3 routes register: result vyos.vyos.vyos_ospfv3: &id001 @@ -44,5 +43,4 @@ that: - "{{ deleted['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml index 6287083..1bec41a 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_ospfv3 parsed integration tests on connection={{ ansible_connection + msg: + START vyos_ospfv3 parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided ospfv3 config to agnostic model diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml index 3f714ce..b921bda 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml @@ -6,26 +6,25 @@ - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: 'bgp' + - route_type: "bgp" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' + - address: "2001:db10::/32" + - address: "2001:db20::/32" + - address: "2001:db30::/32" + - area_id: "3" range: - - address: '2001:db40::/32' + - address: "2001:db40::/32" state: rendered - name: Assert that correct set of commands were generated diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml index 74d25db..08291ba 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml @@ -8,27 +8,26 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed ospfv3 routes with provided configurations register: result vyos.vyos.vyos_ospfv3: &id001 config: redistribute: - - route_type: 'bgp' + - route_type: "bgp" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db30::/32' - - address: '2001:db50::/32' - - area_id: '4' + - address: "2001:db10::/32" + - address: "2001:db30::/32" + - address: "2001:db50::/32" + - area_id: "4" range: - - address: '2001:db60::/32' + - address: "2001:db60::/32" state: replaced - name: Assert that correct set of commands were generated @@ -47,7 +46,8 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: Replace device configurations of listed ospfv3 routes with provided configurarions + - name: + Replace device configurations of listed ospfv3 routes with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv3: *id001 @@ -62,5 +62,4 @@ that: - "{{ replaced['after'] == result['before'] }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml index d817554..2142aad 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml @@ -6,26 +6,25 @@ - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_ospfv3: config: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' + - address: "2001:db10::/32" + - address: "2001:db20::/32" + - address: "2001:db30::/32" + - area_id: "3" range: - - address: '2001:db40::/32' + - address: "2001:db40::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' + - route_type: "bgp" state: merged - name: Gather ospfv3 facts @@ -40,21 +39,21 @@ vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: 'bgp' + - route_type: "bgp" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db30::/32' - - address: '2001:db50::/32' - - area_id: '4' + - address: "2001:db10::/32" + - address: "2001:db30::/32" + - address: "2001:db50::/32" + - area_id: "4" range: - - address: '2001:db60::/32' + - address: "2001:db60::/32" state: replaced - name: Assert that changes were applied @@ -71,5 +70,4 @@ assert: that: "{{ base_config['after'] == revert['after']}}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospfv3/vars/main.yaml b/tests/integration/targets/vyos_ospfv3/vars/main.yaml index 6ded89a..3793760 100644 --- a/tests/integration/targets/vyos_ospfv3/vars/main.yaml +++ b/tests/integration/targets/vyos_ospfv3/vars/main.yaml @@ -14,59 +14,58 @@ merged: - set protocols ospfv3 area 3 range 2001:db40::/32 after: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' + - address: "2001:db10::/32" + - address: "2001:db20::/32" + - address: "2001:db30::/32" + - area_id: "3" range: - - address: '2001:db40::/32' + - address: "2001:db40::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' - + - route_type: "bgp" merged_update: commands: - set protocols ospfv3 area 3 range 2001:db70::/32 after: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' + - address: "2001:db10::/32" + - address: "2001:db20::/32" + - address: "2001:db30::/32" + - area_id: "3" range: - - address: '2001:db40::/32' - - address: '2001:db70::/32' + - address: "2001:db40::/32" + - address: "2001:db70::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' + - route_type: "bgp" populate: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' + - address: "2001:db10::/32" + - address: "2001:db20::/32" + - address: "2001:db30::/32" + - area_id: "3" range: - - address: '2001:db40::/32' + - address: "2001:db40::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' + - route_type: "bgp" replaced: commands: - delete protocols ospfv3 area 2 range 2001:db20::/32 @@ -76,20 +75,20 @@ replaced: - set protocols ospfv3 area 4 range 2001:db60::/32 after: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db30::/32' - - address: '2001:db50::/32' - - area_id: '4' + - address: "2001:db10::/32" + - address: "2001:db30::/32" + - address: "2001:db50::/32" + - area_id: "4" range: - - address: '2001:db60::/32' + - address: "2001:db60::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' + - route_type: "bgp" rendered: commands: - set protocols ospfv3 redistribute bgp @@ -105,38 +104,38 @@ rendered: parsed: after: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' + - address: "2001:db10::/32" + - address: "2001:db20::/32" + - address: "2001:db30::/32" + - area_id: "3" range: - - address: '2001:db40::/32' + - address: "2001:db40::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' + - route_type: "bgp" deleted: commands: - - 'delete protocols ospfv3' + - "delete protocols ospfv3" after: {} round_trip: after: areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' + - area_id: "2" + export_list: "export1" + import_list: "import1" range: - - address: '2001:db10::/32' - - address: '2001:db30::/32' - - address: '2001:db50::/32' - - area_id: '4' + - address: "2001:db10::/32" + - address: "2001:db30::/32" + - address: "2001:db50::/32" + - area_id: "4" range: - - address: '2001:db60::/32' + - address: "2001:db60::/32" parameters: - router_id: '192.0.2.10' + router_id: "192.0.2.10" redistribute: - - route_type: 'bgp' + - route_type: "bgp" diff --git a/tests/integration/targets/vyos_prefix_lists/tasks/cli.yaml b/tests/integration/targets/vyos_prefix_lists/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_prefix_lists/tasks/cli.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_route_maps/defaults/main.yaml b/tests/integration/targets/vyos_route_maps/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_route_maps/defaults/main.yaml +++ b/tests/integration/targets/vyos_route_maps/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_route_maps/tasks/cli.yaml b/tests/integration/targets/vyos_route_maps/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_route_maps/tasks/cli.yaml +++ b/tests/integration/targets/vyos_route_maps/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml index 2999d63..fe68d56 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_route_maps: &id001 @@ -27,7 +26,8 @@ - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *id001 @@ -38,5 +38,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml index 356e975..430b9d5 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_route_maps: diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml index 76971d6..168ef17 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate.yaml - block: - - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_route_maps: &id001 @@ -40,7 +39,8 @@ - result.commands|symmetric_difference(overridden.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == [] - - name: Override the existing configuration with the provided running configuration + - name: + Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *id001 @@ -51,5 +51,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml index ee76852..f098347 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_route_maps parsed integration tests on connection={{ ansible_connection + msg: + START vyos_route_maps parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml index 7d194d9..f9e599f 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml @@ -6,7 +6,6 @@ - include_tasks: _remove_config.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_route_maps: &id001 diff --git a/tests/integration/targets/vyos_smoke/defaults/main.yaml b/tests/integration/targets/vyos_smoke/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_smoke/defaults/main.yaml +++ b/tests/integration/targets/vyos_smoke/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_smoke/tasks/cli.yaml b/tests/integration/targets/vyos_smoke/tasks/cli.yaml index cc5f7df..d9c9ed7 100644 --- a/tests/integration/targets/vyos_smoke/tasks/cli.yaml +++ b/tests/integration/targets/vyos_smoke/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case with single_user_mode (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli ansible_network_single_user_mode=True' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli ansible_network_single_user_mode=True" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_smoke/tests/cli/caching.yaml b/tests/integration/targets/vyos_smoke/tests/cli/caching.yaml index 87b93c8..9afea2e 100644 --- a/tests/integration/targets/vyos_smoke/tests/cli/caching.yaml +++ b/tests/integration/targets/vyos_smoke/tests/cli/caching.yaml @@ -1,84 +1,84 @@ --- - block: - - debug: msg="START connection={{ ansible_connection }} cli/caching.yaml" + - debug: msg="START connection={{ ansible_connection }} cli/caching.yaml" - - set_fact: - interface_cmds: - - set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1' - - set interfaces ethernet eth1 mtu '1500' - - set interfaces ethernet eth1 duplex 'auto' - - set interfaces ethernet eth1 speed 'auto' - - set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101' - - set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)' - - set interfaces ethernet eth2 mtu '600' - l3_interface_cmds: - - set interfaces ethernet eth1 address '192.0.2.10/24' - - set interfaces ethernet eth1 address '2001:db8::10/32' - - set interfaces ethernet eth2 address '198.51.100.10/24' + - set_fact: + interface_cmds: + - set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1' + - set interfaces ethernet eth1 mtu '1500' + - set interfaces ethernet eth1 duplex 'auto' + - set interfaces ethernet eth1 speed 'auto' + - set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101' + - set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)' + - set interfaces ethernet eth2 mtu '600' + l3_interface_cmds: + - set interfaces ethernet eth1 address '192.0.2.10/24' + - set interfaces ethernet eth1 address '2001:db8::10/32' + - set interfaces ethernet eth2 address '198.51.100.10/24' - - name: Remove interfaces from config before actual testing - ignore_errors: true - vyos.vyos.vyos_config: &rem - lines: - - delete interfaces ethernet eth1 - - delete interfaces ethernet eth2 - match: none + - name: Remove interfaces from config before actual testing + ignore_errors: true + vyos.vyos.vyos_config: &rem + lines: + - delete interfaces ethernet eth1 + - delete interfaces ethernet eth2 + match: none - - name: Merge base interfaces configuration - register: result - vyos.vyos.vyos_interfaces: &merged - config: - - name: eth1 - description: Configured by Ansible - Interface 1 - mtu: 1500 - speed: auto - duplex: auto - vifs: - - vlan_id: 101 - description: Eth1 - VIF 101 + - name: Merge base interfaces configuration + register: result + vyos.vyos.vyos_interfaces: &merged + config: + - name: eth1 + description: Configured by Ansible - Interface 1 + mtu: 1500 + speed: auto + duplex: auto + vifs: + - vlan_id: 101 + description: Eth1 - VIF 101 - - name: eth2 - description: Configured by Ansible - Interface 2 (ADMIN DOWN) - mtu: 600 - state: merged + - name: eth2 + description: Configured by Ansible - Interface 2 (ADMIN DOWN) + mtu: 600 + state: merged - - assert: - that: - - "{{ interface_cmds | symmetric_difference(result['commands']) |length == 0 }}" + - assert: + that: + - "{{ interface_cmds | symmetric_difference(result['commands']) |length == 0 }}" - - name: Merge base interfaces configuration (IDEMPOTENT) - register: result - vyos.vyos.vyos_interfaces: *merged + - name: Merge base interfaces configuration (IDEMPOTENT) + register: result + vyos.vyos.vyos_interfaces: *merged - - assert: - that: - - result.changed == False + - assert: + that: + - result.changed == False - - name: Merge L3 interfaces configuration - register: result - vyos.vyos.vyos_l3_interfaces: &mergedl3 - config: - - name: eth1 - ipv4: - - address: 192.0.2.10/24 - ipv6: - - address: 2001:db8::10/32 - - name: eth2 - ipv4: - - address: 198.51.100.10/24 - state: merged + - name: Merge L3 interfaces configuration + register: result + vyos.vyos.vyos_l3_interfaces: &mergedl3 + config: + - name: eth1 + ipv4: + - address: 192.0.2.10/24 + ipv6: + - address: 2001:db8::10/32 + - name: eth2 + ipv4: + - address: 198.51.100.10/24 + state: merged - - assert: - that: - - "{{ l3_interface_cmds | symmetric_difference(result['commands']) |length == 0 }}" + - assert: + that: + - "{{ l3_interface_cmds | symmetric_difference(result['commands']) |length == 0 }}" - - name: Merge L3 interfaces configuration (IDEMPOTENT) - register: result - vyos.vyos.vyos_l3_interfaces: *mergedl3 + - name: Merge L3 interfaces configuration (IDEMPOTENT) + register: result + vyos.vyos.vyos_l3_interfaces: *mergedl3 - - assert: - that: - - result.changed == False + - assert: + that: + - result.changed == False always: - name: cleanup vyos.vyos.vyos_config: *rem diff --git a/tests/integration/targets/vyos_snmp_server/defaults/main.yaml b/tests/integration/targets/vyos_snmp_server/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_snmp_server/defaults/main.yaml +++ b/tests/integration/targets/vyos_snmp_server/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_snmp_server/meta/main.yaml b/tests/integration/targets/vyos_snmp_server/meta/main.yaml index 91da2a7..ed97d53 100644 --- a/tests/integration/targets/vyos_snmp_server/meta/main.yaml +++ b/tests/integration/targets/vyos_snmp_server/meta/main.yaml @@ -1,2 +1 @@ --- -... diff --git a/tests/integration/targets/vyos_snmp_server/tasks/cli.yaml b/tests/integration/targets/vyos_snmp_server/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_snmp_server/tasks/cli.yaml +++ b/tests/integration/targets/vyos_snmp_server/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml index 1fa32c5..8cd2c8a 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml @@ -7,7 +7,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Delete the provided configuration register: result vyos.vyos.vyos_snmp_server: &id001 @@ -25,7 +24,8 @@ that: - result.after == {} - - name: Delete the existing configuration with the provided running configuration + - name: + Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 @@ -36,5 +36,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml index 184faa5..7cdf3c4 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_snmp_server: diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml index e372166..06627b0 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml @@ -42,7 +42,6 @@ - result.after == ansible_facts['network_resources']['snmp_server'] - result.after == merged.after - - name: Assert that before dicts were correctly generated assert: that: diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml index 5f3d9c9..b1d6565 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_snmp_server: &id001 @@ -51,8 +50,8 @@ - result.after == ansible_facts['network_resources']['snmp_server'] - result.commands|length == 13 - - - name: Override the existing configuration with the provided running configuration + - name: + Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 @@ -63,5 +62,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml index e189134..4ecc1ac 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_snmp_server parsed integration tests on connection={{ ansible_connection + msg: + START vyos_snmp_server parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) @@ -9,7 +10,6 @@ running_config: "{{ lookup('file', '_parsed.cfg') }}" state: parsed - - name: Assert that config was correctly parsed assert: that: diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml index 0b5a564..2bfcaf6 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml @@ -8,7 +8,6 @@ - include_tasks: _populate_config.yaml - block: - - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_snmp_server: &id001 @@ -51,8 +50,8 @@ - result.after == ansible_facts['network_resources']['snmp_server'] - result.commands|length == 13 - - - name: Replace the existing configuration with the provided running configuration + - name: + Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 @@ -63,5 +62,4 @@ - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/defaults/main.yaml b/tests/integration/targets/vyos_static_routes/defaults/main.yaml index 852a6be..164afea 100644 --- a/tests/integration/targets/vyos_static_routes/defaults/main.yaml +++ b/tests/integration/targets/vyos_static_routes/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '[^_].*' +testcase: "[^_].*" test_items: [] diff --git a/tests/integration/targets/vyos_static_routes/meta/main.yaml b/tests/integration/targets/vyos_static_routes/meta/main.yaml index 91da2a7..ed97d53 100644 --- a/tests/integration/targets/vyos_static_routes/meta/main.yaml +++ b/tests/integration/targets/vyos_static_routes/meta/main.yaml @@ -1,2 +1 @@ --- -... diff --git a/tests/integration/targets/vyos_static_routes/tasks/cli.yaml b/tests/integration/targets/vyos_static_routes/tasks/cli.yaml index 93eb2fe..83496e0 100644 --- a/tests/integration/targets/vyos_static_routes/tasks/cli.yaml +++ b/tests/integration/targets/vyos_static_routes/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: Collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" use_regex: true register: test_cases delegate_to: localhost @@ -11,9 +11,9 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }}' + include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.network_cli - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_static_routes/tasks/redirection.yaml b/tests/integration/targets/vyos_static_routes/tasks/redirection.yaml index 5564a3e..48ad53a 100644 --- a/tests/integration/targets/vyos_static_routes/tasks/redirection.yaml +++ b/tests/integration/targets/vyos_static_routes/tasks/redirection.yaml @@ -1,8 +1,8 @@ --- - name: collect all redirection cli test cases find: - paths: '{{ role_path }}/tests/redirection/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/redirection/cli" + patterns: "{{ testcase }}.yaml" register: shortname_test_cases delegate_to: localhost @@ -10,7 +10,7 @@ set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml index f292e5d..4c54ef6 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml @@ -9,4 +9,4 @@ set protocols static route6 2001:db8:1000::/36 blackhole distance '2'\nset\ \ protocols static route6 2001:db8:1000::/36\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml index 5a5cccb..5608d22 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/_remove_config.yaml @@ -3,4 +3,4 @@ vars: lines: "delete protocols static route\ndelete protocols static route6\n" ansible.netcommon.cli_config: - config: '{{ lines }}' + config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml index 221f1b5..491f9c3 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml @@ -1,19 +1,17 @@ --- - debug: - msg: Start vyos_static_routes deleted integration tests ansible_connection={{ + msg: + Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete static route based on afi. register: result vyos.vyos.vyos_static_routes: &id001 config: - - address_families: - - afi: ipv4 - afi: ipv6 @@ -52,5 +50,4 @@ - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml index e10f1bc..bddb528 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml @@ -1,12 +1,12 @@ --- - debug: - msg: Start vyos_static_routes deleted integration tests ansible_connection={{ + msg: + Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Delete all the static routes. register: result vyos.vyos.vyos_static_routes: &id001 @@ -46,5 +46,4 @@ - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml index f58ef39..6fded87 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_static_routes empty_config integration tests on connection={{ + msg: + START vyos_static_routes empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml index a9112a5..d1bedc8 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml @@ -8,20 +8,15 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_static_routes: &id001 config: - - address_families: - - afi: ipv4 routes: - - dest: 198.0.2.48/28 next_hops: - - forward_router_address: 192.0.2.18 state: overridden @@ -57,5 +52,4 @@ - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml index 4b6e434..06cad97 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_static_routes parsed integration tests on connection={{ ansible_connection + msg: + START vyos_static_routes parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,7 +9,6 @@ - include_tasks: _populate.yaml - block: - - name: Gather static_routes facts register: static_routes_facts vyos.vyos.vyos_facts: @@ -25,7 +25,8 @@ - name: Assert that correct parsing done assert: - that: "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed'])\ + that: + "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed'])\ \ |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) @@ -37,5 +38,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml index ff18523..81e7259 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_static_routes rendered integration tests on connection={{ ansible_connection + msg: + START vyos_static_routes rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,36 +9,28 @@ - include_tasks: _populate.yaml - block: - - name: Structure provided configuration into device specific commands register: result vyos.vyos.vyos_static_routes: &id001 config: - - address_families: - - afi: ipv4 routes: - - dest: 192.0.2.32/28 blackhole_config: type: blackhole next_hops: - - forward_router_address: 192.0.2.10 - forward_router_address: 192.0.2.9 - address_families: - - afi: ipv6 routes: - - dest: 2001:db8:1000::/36 blackhole_config: distance: 2 next_hops: - - forward_router_address: 2001:db8:2000:2::1 - forward_router_address: 2001:db8:2000:2::2 @@ -58,5 +51,4 @@ that: - result['changed'] == false always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml index 80ed801..50af5ed 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml @@ -1,6 +1,7 @@ --- - debug: - msg: START vyos_static_routes replaced integration tests on connection={{ ansible_connection + msg: + START vyos_static_routes replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -8,23 +9,18 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed static routes with provided configurations register: result vyos.vyos.vyos_static_routes: &id001 config: - - address_families: - - afi: ipv4 routes: - - dest: 192.0.2.32/28 blackhole_config: distance: 2 next_hops: - - forward_router_address: 192.0.2.7 - forward_router_address: 192.0.2.8 @@ -65,5 +61,4 @@ - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml index 340fde9..64e8044 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml @@ -6,36 +6,28 @@ - include_tasks: _remove_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: ipv4 routes: - - dest: 192.0.2.32/28 blackhole_config: type: blackhole next_hops: - - forward_router_address: 192.0.2.10 - forward_router_address: 192.0.2.9 - address_families: - - afi: ipv6 routes: - - dest: 2001:db8:1000::/36 blackhole_config: distance: 2 next_hops: - - forward_router_address: 2001:db8:2000:2::1 - forward_router_address: 2001:db8:2000:2::2 @@ -52,17 +44,13 @@ register: result vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: ipv4 routes: - - dest: 192.0.2.32/28 blackhole_config: distance: 2 next_hops: - - forward_router_address: 192.0.2.7 - forward_router_address: 192.0.2.8 @@ -72,7 +60,8 @@ - name: Assert that changes were applied assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ + that: + "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip @@ -83,8 +72,8 @@ - name: Assert that config was reverted assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ + that: + "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_system/defaults/main.yaml b/tests/integration/targets/vyos_system/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_system/defaults/main.yaml +++ b/tests/integration/targets/vyos_system/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_system/tasks/cli.yaml b/tests/integration/targets/vyos_system/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_system/tasks/cli.yaml +++ b/tests/integration/targets/vyos_system/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_user/defaults/main.yaml b/tests/integration/targets/vyos_user/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_user/defaults/main.yaml +++ b/tests/integration/targets/vyos_user/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_user/tasks/cli.yaml b/tests/integration/targets/vyos_user/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_user/tasks/cli.yaml +++ b/tests/integration/targets/vyos_user/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_user/tests/cli/auth.yaml b/tests/integration/targets/vyos_user/tests/cli/auth.yaml index bc4e788..87eaba6 100644 --- a/tests/integration/targets/vyos_user/tests/cli/auth.yaml +++ b/tests/integration/targets/vyos_user/tests/cli/auth.yaml @@ -1,6 +1,5 @@ --- - block: - - name: Create user with password vyos.vyos.vyos_user: name: auth_user @@ -10,7 +9,8 @@ - name: test login via ssh with new user expect: - command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) + command: + ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper show version' responses: @@ -18,7 +18,8 @@ - name: test login via ssh with invalid password (should fail) expect: - command: ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) + command: + ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper show version' responses: @@ -31,7 +32,6 @@ that: - results.failed always: - - name: delete user register: result vyos.vyos.vyos_user: diff --git a/tests/integration/targets/vyos_user/tests/cli/basic.yaml b/tests/integration/targets/vyos_user/tests/cli/basic.yaml index 00a7a26..edd3b5c 100644 --- a/tests/integration/targets/vyos_user/tests/cli/basic.yaml +++ b/tests/integration/targets/vyos_user/tests/cli/basic.yaml @@ -25,7 +25,6 @@ register: result vyos.vyos.vyos_user: aggregate: - - name: ansibletest2 - name: ansibletest3 @@ -55,7 +54,6 @@ register: result vyos.vyos.vyos_user: aggregate: - - name: ansibletest2 - name: ansibletest3 @@ -71,7 +69,6 @@ register: result vyos.vyos.vyos_user: users: - - name: ansibletest1 - name: ansibletest2 diff --git a/tests/integration/targets/vyos_vlan/defaults/main.yaml b/tests/integration/targets/vyos_vlan/defaults/main.yaml index a845c24..9ef5ba5 100644 --- a/tests/integration/targets/vyos_vlan/defaults/main.yaml +++ b/tests/integration/targets/vyos_vlan/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: '*' +testcase: "*" test_items: [] diff --git a/tests/integration/targets/vyos_vlan/tasks/cli.yaml b/tests/integration/targets/vyos_vlan/tasks/cli.yaml index 8f7b62f..b2746ce 100644 --- a/tests/integration/targets/vyos_vlan/tasks/cli.yaml +++ b/tests/integration/targets/vyos_vlan/tasks/cli.yaml @@ -1,8 +1,8 @@ --- - name: collect all cli test cases find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases delegate_to: localhost @@ -10,8 +10,8 @@ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' + include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli" + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: diff --git a/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml b/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml index eade5a4..2dfa1ec 100644 --- a/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml +++ b/tests/integration/targets/vyos_vlan/tests/cli/basic.yaml @@ -74,7 +74,6 @@ register: result vyos.vyos.vyos_vlan: &id004 aggregate: - - vlan_id: 101 name: voice interfaces: eth0 |