diff options
Diffstat (limited to 'tests')
281 files changed, 1180 insertions, 1780 deletions
| diff --git a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml index afbc291e..8ada933a 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 1ade232f..d6027633 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 17cc07d3..da8adb1f 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 526c657e..fc65c17e 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 35191722..64f6f34b 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 3a12be92..04a6aacd 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 07c9ac33..f05094f7 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 68dd47b9..fdbc00b4 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 31767978..6bd9c772 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 1071657c..8c6ac5c0 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 b4fe3db6..d7825822 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 9c7400ee..8df16771 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 9792125a..edee16b1 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 20225339..742951ff 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 7c1665fd..ef8856d0 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 46346c22..0af8775d 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 3a44a5ea..534227fb 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 f1b79b28..aeb4aa7b 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 abcb177b..e66aae76 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 5564a3ea..48ad53ae 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 61ed0548..2467a4fe 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 98bd1fce..8ed28748 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 5564a3ea..48ad53ae 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 95fdd980..f414b767 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 4300c10e..2df01354 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 4e2db4e9..3db59270 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 516b835c..db35410e 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 6b711443..55a96aa3 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 030b75d2..470553ff 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 3f3e489e..f397a27c 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 5564a3ea..48ad53ae 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 a7c3a11d..f6e8208d 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 f79bb9ac..27d1aa2d 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 5c869246..60cb2d8a 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 44df47ce..31620f40 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 3910952e..643a99e7 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 b94d95ec..82b7330d 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 528563e2..16d585e8 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 31a76448..e213bdf3 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 00c56358..ff244023 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 faa0ff15..9ec7a6e4 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 3e60c414..8b3dacd8 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 40a7f4ab..d2fd3ee7 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 38a18003..c95fc004 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 08447497..da1b02ca 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 078dd89c..f1a0a4d3 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 f7db06b3..b33aea89 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 d85654ce..1293f6a2 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 f7e91f87..eb42c02c 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 66c49bf2..1b9eb349 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 01d30b67..5776718e 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 c7032e10..105c647b 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 022dd502..3283ec6d 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 b2b00675..d82a0f6a 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 9155b7c1..ff3abb19 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 551736e4..12adf4f2 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 acb08034..b4fc7965 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 67bfd3c1..6a830f9d 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 e20670de..e1041715 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 16e563c2..9df51272 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 c30cf03e..ba71e710 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 6acc9518..aac79e58 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 bc955249..3e4c9723 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 6670fd7b..d3767441 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 eba16892..850aa603 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 762086f4..f3f42525 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 852a6bee..164afead 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 91da2a75..ed97d539 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 93eb2fe4..83496e0e 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 5f9df51d..2c052f4d 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 0509fc56..f3eacad5 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 f9b28c70..14ed1df8 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 d9fd76d1..a50ef648 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 f6c00bbb..b1aa8068 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 28ec797a..25c81b24 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 6acb9937..7d9b5221 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 615da43b..ca02d03f 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 686236f2..702930c5 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 298cf5d7..6353d1c7 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 56e747a9..2c12ff2f 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 9921e5dd..d4052c8a 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 a44fc2f3..a22fb60f 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 5030d718..e8f3591a 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 8b68c5a5..daf8045f 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 f003c0bb..5aefbb4d 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 852a6bee..164afead 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 f622cf94..8aeb46d4 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 5564a3ea..48ad53ae 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 563b1d7b..d5d86209 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 1fb0dd3e..c5acac9c 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 ff4aabfd..25ce28e0 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 9929dd7f..15393fb2 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 644fe080..dc6f0cec 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 d5ff2056..6640271b 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 02a28655..7bbf53ca 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 2c664bbd..c102602d 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 33082d5f..bee2a098 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 927a6cec..00b7e6e3 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 f6467425..4ad0b856 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 6679d6a0..dfc99201 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 5469bf58..11432ea9 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 ac8204f9..56f1ed6c 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 6e89eaed..22ac8a87 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 aa6e2473..9682fd79 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 ed7bc612..ce2df0d2 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 e6d7928c..781100fb 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 c080056d..c8b711b3 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 55e2bbf5..f5f6098a 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 e4392426..24c114d7 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 b8234491..7e5b37c6 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 f4c6cbc5..c086e2bd 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 b9c3abf0..1047f308 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 5e9f4c5a..59ff032b 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 9a833f5e..6859dc8e 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 2e8284f1..b0bd6038 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 4353cec4..406d30bd 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 11e2940d..208f21ea 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 a885f01a..c8ab3526 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 21bf96d0..c5b30afa 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 4ef40c9e..6c097e31 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 3e6ce408..e077e010 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 0ca52bed..a32e9d54 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 342e64b9..87bed904 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 3218e800..e76e3b25 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 e6189a3d..e23253bb 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 f43a8e81..0b06a742 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 a025047b..708623e7 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 852a6bee..164afead 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 91da2a75..ed97d539 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 93eb2fe4..83496e0e 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 f70fff14..2764ed6a 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 d47d3096..8d2283c1 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 1df1a8d6..e5eea383 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 366f8893..01caca5a 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 530e2add..81f406c4 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 5ac350d4..3c9032b1 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 2a22ad8f..ad36012b 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 2269e747..43def134 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 c660ac47..09524b08 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 1c1edd7e..8705509d 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 3b4dbc4d..6cd65ced 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 58cd9ffd..4efca68f 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 aff0f66f..f99b8fec 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 85a7cf2e..21b6e5ad 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 0db10d27..dae9a6e0 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 4e327e13..c260ec4a 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 328406b6..2c276723 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 a98b6161..89c8c767 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 9f358d5e..a4453752 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 73608705..9c963bc1 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 a61f5a7c..9fc0d706 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 cfa29f99..ac5c2030 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 8a805a6a..e11aa6a7 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 07606f94..e1fc3898 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 7efc2a7b..9407ffa7 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 e55da20f..da81c191 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 fb66d0a5..31f90ef9 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 2a475050..ca4537e6 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 55bec184..e0be4c3a 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 62870831..1bec41a0 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 3f714ced..b921bda3 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 74d25dbf..08291ba2 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 d8175540..2142aad2 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 6ded89a8..37937601 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 93eb2fe4..83496e0e 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 852a6bee..164afead 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 93eb2fe4..83496e0e 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 2999d630..fe68d565 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 356e9754..430b9d5e 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 76971d61..168ef17b 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 ee768529..f0983475 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 7d194d98..f9e599f6 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 a845c24b..9ef5ba51 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 cc5f7df1..d9c9ed7f 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 87b93c83..9afea2e0 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 852a6bee..164afead 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 91da2a75..ed97d539 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 93eb2fe4..83496e0e 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 1fa32c52..8cd2c8a6 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 184faa5a..7cdf3c42 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 e3721664..06627b0a 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 5f3d9c95..b1d65652 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 e189134d..4ecc1ac5 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 0b5a564e..2bfcaf6b 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 852a6bee..164afead 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 91da2a75..ed97d539 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 93eb2fe4..83496e0e 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 5564a3ea..48ad53ae 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 f292e5de..4c54ef64 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 5a5cccb8..5608d227 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 221f1b51..491f9c3b 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 e10f1bc6..bddb528c 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 f58ef398..6fded87a 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 a9112a51..d1bedc83 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 4b6e434a..06cad977 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 ff185232..81e72599 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 80ed8010..50af5edb 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 340fde9e..64e8044f 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 bc4e7880..87eaba60 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 00a7a264..edd3b5c2 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 a845c24b..9ef5ba51 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 8f7b62f9..b2746ce7 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 eade5a42..2dfa1ec0 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 diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py index b7df24ff..4bef4c21 100644 --- a/tests/unit/compat/mock.py +++ b/tests/unit/compat/mock.py @@ -24,6 +24,7 @@ __metaclass__ = type  Compat module for Python3.x's unittest.mock module  """  import sys +  import _io  # Python 2.7 @@ -102,9 +103,7 @@ if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):          global file_spec          if file_spec is None: -            file_spec = list( -                set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))) -            ) +            file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))          if mock is None:              mock = MagicMock(name="open", spec=open) diff --git a/tests/unit/mock/loader.py b/tests/unit/mock/loader.py index aea5df56..258dccd9 100644 --- a/tests/unit/mock/loader.py +++ b/tests/unit/mock/loader.py @@ -23,8 +23,8 @@ __metaclass__ = type  import os  from ansible.errors import AnsibleParserError -from ansible.parsing.dataloader import DataLoader  from ansible.module_utils._text import to_bytes, to_text +from ansible.parsing.dataloader import DataLoader  class DictDataLoader(DataLoader): diff --git a/tests/unit/mock/path.py b/tests/unit/mock/path.py index 74b02be8..3962f24f 100644 --- a/tests/unit/mock/path.py +++ b/tests/unit/mock/path.py @@ -1,10 +1,8 @@  from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import MagicMock  from ansible.utils.path import unfrackpath +from ansible_collections.vyos.vyos.tests.unit.compat.mock import MagicMock -mock_unfrackpath_noop = MagicMock( -    spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x -) +mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x) diff --git a/tests/unit/mock/procenv.py b/tests/unit/mock/procenv.py index 1587949e..06987e31 100644 --- a/tests/unit/mock/procenv.py +++ b/tests/unit/mock/procenv.py @@ -21,14 +21,15 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -import sys  import json - +import sys  from contextlib import contextmanager  from io import BytesIO, StringIO -from ansible_collections.vyos.vyos.tests.unit.compat import unittest -from ansible.module_utils.six import PY3 +  from ansible.module_utils._text import to_bytes +from ansible.module_utils.six import PY3 + +from ansible_collections.vyos.vyos.tests.unit.compat import unittest  @contextmanager diff --git a/tests/unit/mock/vault_helper.py b/tests/unit/mock/vault_helper.py index b34ae134..4c6c890c 100644 --- a/tests/unit/mock/vault_helper.py +++ b/tests/unit/mock/vault_helper.py @@ -17,7 +17,6 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  from ansible.module_utils._text import to_bytes -  from ansible.parsing.vault import VaultSecret @@ -37,6 +36,4 @@ class TextVaultSecret(VaultSecret):      @property      def bytes(self):          """The text encoded with encoding, unless we specifically set _bytes.""" -        return self._bytes or to_bytes( -            self.text, encoding=self.encoding, errors=self.errors -        ) +        return self._bytes or to_bytes(self.text, encoding=self.encoding, errors=self.errors) diff --git a/tests/unit/mock/yaml_helper.py b/tests/unit/mock/yaml_helper.py index 5df30aae..540055d2 100644 --- a/tests/unit/mock/yaml_helper.py +++ b/tests/unit/mock/yaml_helper.py @@ -2,11 +2,11 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  import io -import yaml +import yaml  from ansible.module_utils.six import PY3 -from ansible.parsing.yaml.loader import AnsibleLoader  from ansible.parsing.yaml.dumper import AnsibleDumper +from ansible.parsing.yaml.loader import AnsibleLoader  class YamlTestUtils(object): @@ -44,9 +44,7 @@ class YamlTestUtils(object):          obj_2 = loader.get_data()          # dump the gen 2 objects directory to strings -        string_from_object_dump_2 = self._dump_string( -            obj_2, dumper=AnsibleDumper -        ) +        string_from_object_dump_2 = self._dump_string(obj_2, dumper=AnsibleDumper)          # The gen 1 and gen 2 yaml strings          self.assertEqual(string_from_object_dump, string_from_object_dump_2) @@ -58,9 +56,7 @@ class YamlTestUtils(object):          loader_3 = self._loader(stream_3)          obj_3 = loader_3.get_data() -        string_from_object_dump_3 = self._dump_string( -            obj_3, dumper=AnsibleDumper -        ) +        string_from_object_dump_3 = self._dump_string(obj_3, dumper=AnsibleDumper)          self.assertEqual(obj, obj_3)          # should be transitive, but... @@ -92,12 +88,8 @@ class YamlTestUtils(object):          stream_obj_from_string = io.StringIO()          if PY3: -            yaml.dump( -                obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper -            ) -            yaml.dump( -                obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper -            ) +            yaml.dump(obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper) +            yaml.dump(obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper)          else:              yaml.dump(                  obj_from_stream, @@ -119,12 +111,8 @@ class YamlTestUtils(object):          stream_obj_from_string.seek(0)          if PY3: -            yaml_string_obj_from_stream = yaml.dump( -                obj_from_stream, Dumper=AnsibleDumper -            ) -            yaml_string_obj_from_string = yaml.dump( -                obj_from_string, Dumper=AnsibleDumper -            ) +            yaml_string_obj_from_stream = yaml.dump(obj_from_stream, Dumper=AnsibleDumper) +            yaml_string_obj_from_string = yaml.dump(obj_from_string, Dumper=AnsibleDumper)          else:              yaml_string_obj_from_stream = yaml.dump(                  obj_from_stream, Dumper=AnsibleDumper, encoding=None @@ -134,11 +122,7 @@ class YamlTestUtils(object):              )          assert yaml_string == yaml_string_obj_from_stream -        assert ( -            yaml_string -            == yaml_string_obj_from_stream -            == yaml_string_obj_from_string -        ) +        assert yaml_string == yaml_string_obj_from_stream == yaml_string_obj_from_string          assert (              yaml_string              == yaml_string_obj_from_stream diff --git a/tests/unit/modules/conftest.py b/tests/unit/modules/conftest.py index e19a1e04..013d1982 100644 --- a/tests/unit/modules/conftest.py +++ b/tests/unit/modules/conftest.py @@ -7,10 +7,9 @@ __metaclass__ = type  import json  import pytest - -from ansible.module_utils.six import string_types  from ansible.module_utils._text import to_bytes  from ansible.module_utils.common._collections_compat import MutableMapping +from ansible.module_utils.six import string_types  @pytest.fixture @@ -21,20 +20,11 @@ def patch_ansible_module(request, mocker):          if "ANSIBLE_MODULE_ARGS" not in request.param:              request.param = {"ANSIBLE_MODULE_ARGS": request.param}          if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]: -            request.param["ANSIBLE_MODULE_ARGS"][ -                "_ansible_remote_tmp" -            ] = "/tmp" -        if ( -            "_ansible_keep_remote_files" -            not in request.param["ANSIBLE_MODULE_ARGS"] -        ): -            request.param["ANSIBLE_MODULE_ARGS"][ -                "_ansible_keep_remote_files" -            ] = False +            request.param["ANSIBLE_MODULE_ARGS"]["_ansible_remote_tmp"] = "/tmp" +        if "_ansible_keep_remote_files" not in request.param["ANSIBLE_MODULE_ARGS"]: +            request.param["ANSIBLE_MODULE_ARGS"]["_ansible_keep_remote_files"] = False          args = json.dumps(request.param)      else: -        raise Exception( -            "Malformed data to the patch_ansible_module pytest fixture" -        ) +        raise Exception("Malformed data to the patch_ansible_module pytest fixture")      mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args)) diff --git a/tests/unit/modules/network/vyos/test_vyos_banner.py b/tests/unit/modules/network/vyos/test_vyos_banner.py index 4281cba6..08d4424f 100644 --- a/tests/unit/modules/network/vyos/test_vyos_banner.py +++ b/tests/unit/modules/network/vyos/test_vyos_banner.py @@ -18,11 +18,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_banner -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule @@ -53,9 +52,7 @@ class TestVyosBannerModule(TestVyosModule):      def test_vyos_banner_create(self):          set_module_args(dict(banner="pre-login", text="test\nbanner\nstring")) -        commands = [ -            "set system login banner pre-login 'test\\nbanner\\nstring'" -        ] +        commands = ["set system login banner pre-login 'test\\nbanner\\nstring'"]          self.execute_module(changed=True, commands=commands)      def test_vyos_banner_remove(self): diff --git a/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py b/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py index db39466d..a9f0ef1d 100644 --- a/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py +++ b/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py @@ -20,13 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from ansible_collections.vyos.vyos.plugins.modules import vyos_bgp_address_family  from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch -from ansible_collections.vyos.vyos.plugins.modules import ( -    vyos_bgp_address_family, -) -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -39,9 +36,7 @@ class TestVyosBgpafModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts." @@ -72,13 +67,9 @@ class TestVyosBgpafModule(TestVyosModule):                      address_family=[                          dict(                              afi="ipv4", -                            aggregate_address=[ -                                dict(prefix="192.0.2.0/24", as_set=True) -                            ], +                            aggregate_address=[dict(prefix="192.0.2.0/24", as_set=True)],                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                                  dict(prefix="192.2.13.0/24", backdoor=True),                              ],                          ), @@ -93,11 +84,7 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="export", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="export", route_map="map01")],                                      soft_reconfiguration=True,                                  ),                              ], @@ -125,13 +112,9 @@ class TestVyosBgpafModule(TestVyosModule):                      address_family=[                          dict(                              afi="ipv4", -                            aggregate_address=[ -                                dict(prefix="192.0.2.0/24", summary_only=True) -                            ], +                            aggregate_address=[dict(prefix="192.0.2.0/24", summary_only=True)],                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                              ],                          ),                          dict( @@ -145,9 +128,7 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv6", -                                    distribute_list=[ -                                        dict(action="export", acl=10) -                                    ], +                                    distribute_list=[dict(action="export", acl=10)],                                      route_server_client=True,                                  ),                              ], @@ -158,9 +139,7 @@ class TestVyosBgpafModule(TestVyosModule):                                  dict(                                      afi="ipv4",                                      filter_list=[ -                                        dict( -                                            action="export", path_list="list01" -                                        ), +                                        dict(action="export", path_list="list01"),                                      ],                                      capability=dict(orf="send"),                                  ) @@ -189,13 +168,9 @@ class TestVyosBgpafModule(TestVyosModule):                      address_family=[                          dict(                              afi="ipv4", -                            aggregate_address=[ -                                dict(prefix="192.0.2.0/24", as_set=True) -                            ], +                            aggregate_address=[dict(prefix="192.0.2.0/24", as_set=True)],                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                                  dict(prefix="192.2.13.0/24", backdoor=True),                              ],                          ), @@ -210,11 +185,7 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="export", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="export", route_map="map01")],                                      soft_reconfiguration=True,                                  ),                              ], @@ -243,13 +214,9 @@ class TestVyosBgpafModule(TestVyosModule):                      address_family=[                          dict(                              afi="ipv4", -                            aggregate_address=[ -                                dict(prefix="192.0.2.0/24", summary_only=True) -                            ], +                            aggregate_address=[dict(prefix="192.0.2.0/24", summary_only=True)],                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                              ],                          ),                          dict( @@ -263,17 +230,11 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="import", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="import", route_map="map01")],                                  ),                                  dict(                                      afi="ipv6", -                                    distribute_list=[ -                                        dict(action="export", acl=10) -                                    ], +                                    distribute_list=[dict(action="export", acl=10)],                                      route_server_client=True,                                  ),                              ], @@ -283,11 +244,7 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="export", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="export", route_map="map01")],                                  ),                              ],                          ), @@ -297,9 +254,7 @@ class TestVyosBgpafModule(TestVyosModule):                                  dict(                                      afi="ipv4",                                      filter_list=[ -                                        dict( -                                            action="export", path_list="list01" -                                        ), +                                        dict(action="export", path_list="list01"),                                      ],                                      capability=dict(orf="send"),                                  ) @@ -333,13 +288,9 @@ class TestVyosBgpafModule(TestVyosModule):                      address_family=[                          dict(                              afi="ipv4", -                            aggregate_address=[ -                                dict(prefix="192.0.2.0/24", as_set=True) -                            ], +                            aggregate_address=[dict(prefix="192.0.2.0/24", as_set=True)],                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                                  dict(prefix="192.2.13.0/24", backdoor=True),                              ],                          ), @@ -354,11 +305,7 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="export", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="export", route_map="map01")],                                      soft_reconfiguration=True,                                  ),                              ], @@ -388,9 +335,7 @@ class TestVyosBgpafModule(TestVyosModule):                          dict(                              afi="ipv4",                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                              ],                          ),                          dict( @@ -404,17 +349,11 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="import", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="import", route_map="map01")],                                  ),                                  dict(                                      afi="ipv6", -                                    distribute_list=[ -                                        dict(action="export", acl=10) -                                    ], +                                    distribute_list=[dict(action="export", acl=10)],                                      route_server_client=True,                                  ),                              ], @@ -481,9 +420,7 @@ class TestVyosBgpafModule(TestVyosModule):                          dict(                              afi="ipv4",                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                              ],                          ),                          dict( @@ -497,17 +434,11 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="import", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="import", route_map="map01")],                                  ),                                  dict(                                      afi="ipv6", -                                    distribute_list=[ -                                        dict(action="export", acl=10) -                                    ], +                                    distribute_list=[dict(action="export", acl=10)],                                      route_server_client=True,                                  ),                              ], @@ -517,9 +448,7 @@ class TestVyosBgpafModule(TestVyosModule):              )          )          result = self.execute_module(failed=True) -        self.assertIn( -            "Only one bgp instance is allowed per device", result["msg"] -        ) +        self.assertIn("Only one bgp instance is allowed per device", result["msg"])      def test_vyos_bgp_address_family_rendered(self):          set_module_args( @@ -530,13 +459,9 @@ class TestVyosBgpafModule(TestVyosModule):                      address_family=[                          dict(                              afi="ipv4", -                            aggregate_address=[ -                                dict(prefix="192.0.2.0/24", as_set=True) -                            ], +                            aggregate_address=[dict(prefix="192.0.2.0/24", as_set=True)],                              networks=[ -                                dict( -                                    prefix="192.1.13.0/24", route_map="map01" -                                ), +                                dict(prefix="192.1.13.0/24", route_map="map01"),                                  dict(prefix="192.2.13.0/24", backdoor=True),                              ],                          ), @@ -551,11 +476,7 @@ class TestVyosBgpafModule(TestVyosModule):                              address_family=[                                  dict(                                      afi="ipv4", -                                    route_map=[ -                                        dict( -                                            action="export", route_map="map01" -                                        ) -                                    ], +                                    route_map=[dict(action="export", route_map="map01")],                                      soft_reconfiguration=True,                                  ),                              ], @@ -613,9 +534,7 @@ class TestVyosBgpafModule(TestVyosModule):                          {"prefix": "192.1.13.0/24", "route_map": "map01"},                          {"prefix": "192.2.13.0/24", "backdoor": True},                      ], -                    "aggregate_address": [ -                        {"prefix": "192.0.2.0/24", "as_set": True} -                    ], +                    "aggregate_address": [{"prefix": "192.0.2.0/24", "as_set": True}],                  },                  {                      "afi": "ipv6", @@ -654,9 +573,7 @@ class TestVyosBgpafModule(TestVyosModule):                          {"prefix": "192.1.13.0/24", "route_map": "map01"},                          {"prefix": "192.2.13.0/24", "backdoor": True},                      ], -                    "aggregate_address": [ -                        {"prefix": "192.0.2.0/24", "as_set": True} -                    ], +                    "aggregate_address": [{"prefix": "192.0.2.0/24", "as_set": True}],                  },                  {                      "afi": "ipv6", diff --git a/tests/unit/modules/network/vyos/test_vyos_bgp_global.py b/tests/unit/modules/network/vyos/test_vyos_bgp_global.py index 465b249c..23f2e6a8 100644 --- a/tests/unit/modules/network/vyos/test_vyos_bgp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_bgp_global.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_bgp_global -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -38,23 +37,17 @@ class TestVyosBgpglobalModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_execute_show_command_config = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.bgp_global.bgp_global.Bgp_global._get_config"          ) -        self.execute_show_command_config = ( -            self.mock_execute_show_command_config.start() -        ) +        self.execute_show_command_config = self.mock_execute_show_command_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.bgp_global.bgp_global.Bgp_globalFacts.get_device_data" @@ -318,9 +311,7 @@ class TestVyosBgpglobalModule(TestVyosModule):              )          )          result = self.execute_module(failed=True) -        self.assertIn( -            "Only one bgp instance is allowed per device", result["msg"] -        ) +        self.assertIn("Only one bgp instance is allowed per device", result["msg"])      def test_vyos_bgp_global_replaced_af(self):          set_module_args( @@ -356,9 +347,7 @@ class TestVyosBgpglobalModule(TestVyosModule):                  state="replaced",              )          ) -        result = self.execute_module( -            failed=True, filename="vyos_bgp_global_af_config.cfg" -        ) +        result = self.execute_module(failed=True, filename="vyos_bgp_global_af_config.cfg")          self.assertIn(              "Use the _bgp_address_family module to delete the address_family under neighbor 5001::64, before replacing/deleting the neighbor.",              result["msg"], diff --git a/tests/unit/modules/network/vyos/test_vyos_command.py b/tests/unit/modules/network/vyos/test_vyos_command.py index a8a35695..7ed049be 100644 --- a/tests/unit/modules/network/vyos/test_vyos_command.py +++ b/tests/unit/modules/network/vyos/test_vyos_command.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_command -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -84,9 +83,7 @@ class TestVyosCommandModule(TestVyosModule):      def test_vyos_command_retries(self):          wait_for = 'result[0] contains "test string"' -        set_module_args( -            dict(commands=["show version"], wait_for=wait_for, retries=2) -        ) +        set_module_args(dict(commands=["show version"], wait_for=wait_for, retries=2))          self.execute_module(failed=True)          self.assertEqual(self.run_commands.call_count, 2) @@ -95,9 +92,7 @@ class TestVyosCommandModule(TestVyosModule):              'result[0] contains "VyOS maintainers"',              'result[0] contains "test string"',          ] -        set_module_args( -            dict(commands=["show version"], wait_for=wait_for, match="any") -        ) +        set_module_args(dict(commands=["show version"], wait_for=wait_for, match="any"))          self.execute_module()      def test_vyos_command_match_all(self): @@ -105,9 +100,7 @@ class TestVyosCommandModule(TestVyosModule):              'result[0] contains "VyOS maintainers"',              'result[0] contains "maintainers@vyos.net"',          ] -        set_module_args( -            dict(commands=["show version"], wait_for=wait_for, match="all") -        ) +        set_module_args(dict(commands=["show version"], wait_for=wait_for, match="all"))          self.execute_module()      def test_vyos_command_match_all_failure(self): @@ -116,7 +109,5 @@ class TestVyosCommandModule(TestVyosModule):              'result[0] contains "test string"',          ]          commands = ["show version", "show version"] -        set_module_args( -            dict(commands=commands, wait_for=wait_for, match="all") -        ) +        set_module_args(dict(commands=commands, wait_for=wait_for, match="all"))          self.execute_module(failed=True) diff --git a/tests/unit/modules/network/vyos/test_vyos_config.py b/tests/unit/modules/network/vyos/test_vyos_config.py index c282c710..def567af 100644 --- a/tests/unit/modules/network/vyos/test_vyos_config.py +++ b/tests/unit/modules/network/vyos/test_vyos_config.py @@ -21,15 +21,11 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import ( -    patch, -    MagicMock, -) -from ansible_collections.vyos.vyos.plugins.modules import vyos_config  from ansible_collections.vyos.vyos.plugins.cliconf.vyos import Cliconf -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.plugins.modules import vyos_config +from ansible_collections.vyos.vyos.tests.unit.compat.mock import MagicMock, patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -82,9 +78,7 @@ class TestVyosConfigModule(TestVyosModule):      def test_vyos_config_unchanged(self):          src = load_fixture("vyos_config_config.cfg") -        self.conn.get_diff = MagicMock( -            return_value=self.cliconf_obj.get_diff(src, src) -        ) +        self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, src))          set_module_args(dict(src=src))          self.execute_module() @@ -97,9 +91,7 @@ class TestVyosConfigModule(TestVyosModule):              "delete interfaces ethernet eth0 address",          ]          self.conn.get_diff = MagicMock( -            return_value=self.cliconf_obj.get_diff( -                candidate, self.running_config -            ) +            return_value=self.cliconf_obj.get_diff(candidate, self.running_config)          )          self.execute_module(changed=True, commands=commands) @@ -124,9 +116,7 @@ class TestVyosConfigModule(TestVyosModule):          set_module_args(dict(lines=commands))          candidate = "\n".join(commands)          self.conn.get_diff = MagicMock( -            return_value=self.cliconf_obj.get_diff( -                candidate, self.running_config -            ) +            return_value=self.cliconf_obj.get_diff(candidate, self.running_config)          )          self.execute_module(changed=True, commands=commands) @@ -135,9 +125,7 @@ class TestVyosConfigModule(TestVyosModule):          new_config = ["set system host-name router"]          set_module_args(dict(lines=new_config, config=config))          candidate = "\n".join(new_config) -        self.conn.get_diff = MagicMock( -            return_value=self.cliconf_obj.get_diff(candidate, config) -        ) +        self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate, config))          self.execute_module(changed=True, commands=new_config)      def test_vyos_config_match_none(self): @@ -148,8 +136,6 @@ class TestVyosConfigModule(TestVyosModule):          set_module_args(dict(lines=lines, match="none"))          candidate = "\n".join(lines)          self.conn.get_diff = MagicMock( -            return_value=self.cliconf_obj.get_diff( -                candidate, None, diff_match="none" -            ) +            return_value=self.cliconf_obj.get_diff(candidate, None, diff_match="none")          )          self.execute_module(changed=True, commands=lines, sort=False) diff --git a/tests/unit/modules/network/vyos/test_vyos_facts.py b/tests/unit/modules/network/vyos/test_vyos_facts.py index c0ef686d..727f69ba 100644 --- a/tests/unit/modules/network/vyos/test_vyos_facts.py +++ b/tests/unit/modules/network/vyos/test_vyos_facts.py @@ -19,11 +19,11 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  import json -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_facts -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -40,9 +40,7 @@ class TestVyosFactsModule(TestVyosModule):          self.mock_get_resource_connection = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection = ( -            self.mock_get_resource_connection.start() -        ) +        self.get_resource_connection = self.mock_get_resource_connection.start()          self.mock_get_capabilities = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.get_capabilities" diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py index c691f09f..367da225 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_firewall_global -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -47,16 +46,12 @@ class TestVyosFirewallRulesModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.firewall_global.firewall_global.Firewall_globalFacts.get_device_data" diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py index 186edaa6..fe646595 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py @@ -20,13 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from ansible_collections.vyos.vyos.plugins.modules import vyos_firewall_interfaces  from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch -from ansible_collections.vyos.vyos.plugins.modules import ( -    vyos_firewall_interfaces, -) -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -49,16 +46,12 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos." @@ -97,9 +90,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -116,9 +107,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -155,9 +144,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -174,9 +161,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -207,11 +192,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):          self.execute_module(changed=True, commands=commands)      def test_vyos_firewall_rule_set_03_deleted_per_interface(self): -        set_module_args( -            dict( -                config=[dict(name="eth0"), dict(name="eth2")], state="deleted" -            ) -        ) +        set_module_args(dict(config=[dict(name="eth0"), dict(name="eth2")], state="deleted"))          commands = [              "delete interfaces ethernet eth0 firewall",              "delete interfaces ethernet eth2 firewall", @@ -227,11 +208,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):          self.execute_module(changed=True, commands=commands)      def test_vyos_firewall_rule_set_03_deleted(self): -        set_module_args( -            dict( -                config=[dict(name="eth0"), dict(name="eth2")], state="deleted" -            ) -        ) +        set_module_args(dict(config=[dict(name="eth0"), dict(name="eth2")], state="deleted"))          commands = [              "delete interfaces ethernet eth0 firewall",              "delete interfaces ethernet eth2 firewall", @@ -239,11 +216,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):          self.execute_module(changed=True, commands=commands)      def test_vyos_firewall_rule_set_04_deleted_interface_idem(self): -        set_module_args( -            dict( -                config=[dict(name="eth1"), dict(name="eth3")], state="deleted" -            ) -        ) +        set_module_args(dict(config=[dict(name="eth1"), dict(name="eth3")], state="deleted"))          self.execute_module(changed=False, commands=[])      def test_vyos_firewall_rule_set_02_replaced_idem(self): @@ -263,9 +236,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -282,9 +253,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -307,9 +276,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -322,9 +289,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -337,9 +302,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -398,9 +361,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), @@ -417,9 +378,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):                              ),                              dict(                                  afi="ipv6", -                                rules=[ -                                    dict(name="V6-LOCAL", direction="local") -                                ], +                                rules=[dict(name="V6-LOCAL", direction="local")],                              ),                          ],                      ), diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py b/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py index c82ffc6f..623ab1ef 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_firewall_rules -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -47,16 +46,12 @@ class TestVyosFirewallRulesModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data"          ) @@ -271,14 +266,10 @@ class TestVyosFirewallRulesModule(TestVyosModule):                                              mac_address="38:00:25:19:76:0c",                                              port=2127,                                          ), -                                        destination=dict( -                                            address="192.0.1.0", port=2124 -                                        ), +                                        destination=dict(address="192.0.1.0", port=2124),                                          limit=dict(                                              burst=10, -                                            rate=dict( -                                                number=20, unit="second" -                                            ), +                                            rate=dict(number=20, unit="second"),                                          ),                                          recent=dict(count=10, time=20),                                          state=dict( @@ -467,14 +458,10 @@ class TestVyosFirewallRulesModule(TestVyosModule):                                              mac_address="38:00:25:19:76:0c",                                              port=2127,                                          ), -                                        destination=dict( -                                            address="2001:db8::11", port=2124 -                                        ), +                                        destination=dict(address="2001:db8::11", port=2124),                                          limit=dict(                                              burst=10, -                                            rate=dict( -                                                number=20, unit="second" -                                            ), +                                            rate=dict(number=20, unit="second"),                                          ),                                          recent=dict(count=10, time=20),                                          state=dict( @@ -614,9 +601,7 @@ class TestVyosFirewallRulesModule(TestVyosModule):                                      dict(                                          number="101",                                          protocol="icmp", -                                        icmp=dict( -                                            type_name="port-unreachable" -                                        ), +                                        icmp=dict(type_name="port-unreachable"),                                      )                                  ],                              ), diff --git a/tests/unit/modules/network/vyos/test_vyos_hostname.py b/tests/unit/modules/network/vyos/test_vyos_hostname.py index 54377da2..13d4e321 100644 --- a/tests/unit/modules/network/vyos/test_vyos_hostname.py +++ b/tests/unit/modules/network/vyos/test_vyos_hostname.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_hostname -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -38,16 +37,12 @@ class TestVyosHostnameModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.hostname.hostname.HostnameFacts.get_config" @@ -76,43 +71,31 @@ class TestVyosHostnameModule(TestVyosModule):          self.execute_module(changed=False, commands=[])      def test_vyos_hostname_replaced_idempotent(self): -        set_module_args( -            dict(config=dict(hostname="vyos_test"), state="replaced") -        ) +        set_module_args(dict(config=dict(hostname="vyos_test"), state="replaced"))          self.execute_module(changed=False, commands=[])      def test_vyos_hostname_overridden_idempotent(self): -        set_module_args( -            dict(config=dict(hostname="vyos_test"), state="overridden") -        ) +        set_module_args(dict(config=dict(hostname="vyos_test"), state="overridden"))          self.execute_module(changed=False, commands=[])      def test_vyos_hostname_merged(self):          set_module_args(dict(config=dict(hostname="vyos"))) -        self.execute_module( -            changed=True, commands=["set system host-name vyos"] -        ) +        self.execute_module(changed=True, commands=["set system host-name vyos"])      def test_vyos_hostname_replaced(self):          set_module_args(dict(config=dict(hostname="vyos"), state="replaced")) -        self.execute_module( -            changed=True, commands=["set system host-name vyos"] -        ) +        self.execute_module(changed=True, commands=["set system host-name vyos"])      def test_vyos_hostname_overridden(self):          set_module_args(dict(config=dict(hostname="vyos"), state="overridden"))      def test_vyos_hostname_deleted(self):          set_module_args(dict(state="deleted")) -        self.execute_module( -            changed=True, commands=["delete system host-name vyos_test"] -        ) +        self.execute_module(changed=True, commands=["delete system host-name vyos_test"])      def test_vyos_hostname_gathered(self):          set_module_args(dict(state="gathered")) -        result = self.execute_module( -            changed=False, filename="vyos_hostname_config.cfg" -        ) +        result = self.execute_module(changed=False, filename="vyos_hostname_config.cfg")          gathered_list = {"hostname": "vyos_test"}          self.assertEqual(sorted(gathered_list), sorted(result["gathered"])) @@ -124,11 +107,7 @@ class TestVyosHostnameModule(TestVyosModule):          self.assertEqual(sorted(parsed_list), sorted(result["parsed"]))      def test_vyos_hostname_rendered(self): -        set_module_args( -            dict(state="rendered", config=dict(hostname="vyos_test")) -        ) +        set_module_args(dict(state="rendered", config=dict(hostname="vyos_test")))          commands = ["set system host-name vyos_test"]          result = self.execute_module(changed=False) -        self.assertEqual( -            sorted(result["rendered"]), sorted(commands), result["rendered"] -        ) +        self.assertEqual(sorted(result["rendered"]), sorted(commands), result["rendered"]) diff --git a/tests/unit/modules/network/vyos/test_vyos_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_interfaces.py index c7961452..15950407 100644 --- a/tests/unit/modules/network/vyos/test_vyos_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_interfaces.py @@ -20,13 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type +from ansible_collections.vyos.vyos.plugins.modules import vyos_interfaces  from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch -from ansible_collections.vyos.vyos.plugins.modules import ( -    vyos_interfaces, -) -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -49,16 +46,12 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos." diff --git a/tests/unit/modules/network/vyos/test_vyos_logging_global.py b/tests/unit/modules/network/vyos/test_vyos_logging_global.py index 0f72aeb8..12da5717 100644 --- a/tests/unit/modules/network/vyos/test_vyos_logging_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_logging_global.py @@ -8,11 +8,11 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  from textwrap import dedent -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_logging_global -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule @@ -26,16 +26,12 @@ class TestVyosLoggingGlobalModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.logging_global.logging_global.Logging_globalFacts.get_logging_data" @@ -300,9 +296,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule):          )          playbook = dict(              config=dict( -                console=dict( -                    facilities=[dict(facility="local7", severity="emerg")] -                ), +                console=dict(facilities=[dict(facility="local7", severity="emerg")]),                  files=[                      dict(                          path="abc", @@ -353,9 +347,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule):              set system syslog console facility local6              """          ) -        playbook = dict( -            config=dict(console=dict(facilities=[dict(facility="local6")])) -        ) +        playbook = dict(config=dict(console=dict(facilities=[dict(facility="local6")])))          compare_cmds = []          playbook["state"] = "replaced"          set_module_args(playbook) @@ -372,9 +364,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule):          )          playbook = dict(              config=dict( -                console=dict( -                    facilities=[dict(facility="local7", severity="emerg")] -                ), +                console=dict(facilities=[dict(facility="local7", severity="emerg")]),                  files=[                      dict(                          path="abc", @@ -412,9 +402,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule):                  ],                  users=[                      dict(username="vyos"), -                    dict( -                        username="paul", facilities=[dict(facility="local7")] -                    ), +                    dict(username="paul", facilities=[dict(facility="local7")]),                  ],              )          ) diff --git a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py index 1db6c9b2..0a6119bd 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_ntp_global -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -38,16 +37,12 @@ class TestVyosNTPModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ntp_global.ntp_global.Ntp_globalFacts.get_config" @@ -79,9 +74,7 @@ class TestVyosNTPModule(TestVyosModule):                      listen_addresses=["10.2.3.1", "10.4.3.1"],                      servers=[                          dict(server="server1"), -                        dict( -                            server="server3", options=["noselect", "dynamic"] -                        ), +                        dict(server="server3", options=["noselect", "dynamic"]),                          dict(server="time1.vyos.net"),                          dict(server="time2.vyos.net"),                          dict(server="time3.vyos.net"), @@ -183,9 +176,7 @@ class TestVyosNTPModule(TestVyosModule):                      listen_addresses=["10.2.3.1", "10.4.3.1"],                      servers=[                          dict(server="server1"), -                        dict( -                            server="server3", options=["noselect", "dynamic"] -                        ), +                        dict(server="server3", options=["noselect", "dynamic"]),                          dict(server="time1.vyos.net"),                          dict(server="time2.vyos.net"),                          dict(server="time3.vyos.net"), @@ -204,9 +195,7 @@ class TestVyosNTPModule(TestVyosModule):                      listen_addresses=["10.9.9.1"],                      servers=[                          dict(server="server9"), -                        dict( -                            server="server6", options=["noselect", "dynamic"] -                        ), +                        dict(server="server6", options=["noselect", "dynamic"]),                          dict(server="time1.vyos.net"),                          dict(server="time2.vyos.net"),                          dict(server="time3.vyos.net"), @@ -238,9 +227,7 @@ class TestVyosNTPModule(TestVyosModule):                      listen_addresses=["10.2.3.1", "10.4.3.1"],                      servers=[                          dict(server="server1"), -                        dict( -                            server="server3", options=["noselect", "dynamic"] -                        ), +                        dict(server="server3", options=["noselect", "dynamic"]),                          dict(server="time1.vyos.net"),                          dict(server="time2.vyos.net"),                          dict(server="time3.vyos.net"), @@ -259,9 +246,7 @@ class TestVyosNTPModule(TestVyosModule):                      listen_addresses=["10.7.9.1"],                      servers=[                          dict(server="server79"), -                        dict( -                            server="server46", options=["noselect", "dynamic"] -                        ), +                        dict(server="server46", options=["noselect", "dynamic"]),                          dict(server="time1.vyos.net"),                          dict(server="time2.vyos.net"),                          dict(server="time3.vyos.net"), diff --git a/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py index 20b896d3..e8c3241d 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_ospf_interfaces -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -37,9 +36,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospf_interfaces.ospf_interfaces.Ospf_interfacesFacts.get_device_data" @@ -76,9 +73,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule):                              dict(                                  afi="ipv4",                                  cost=100, -                                authentication=dict( -                                    plaintext_password="abcdefg!" -                                ), +                                authentication=dict(plaintext_password="abcdefg!"),                                  priority=55,                              ),                              dict(afi="ipv6", mtu_ignore=True, instance=20), @@ -173,9 +168,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule):                              dict(                                  afi="ipv4",                                  cost=100, -                                authentication=dict( -                                    plaintext_password="abcdefg!" -                                ), +                                authentication=dict(plaintext_password="abcdefg!"),                                  priority=55,                              ),                          ], @@ -241,9 +234,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule):                              dict(                                  afi="ipv4",                                  cost=100, -                                authentication=dict( -                                    plaintext_password="abcdefg!" -                                ), +                                authentication=dict(plaintext_password="abcdefg!"),                                  priority=55,                              ),                          ], @@ -338,9 +329,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule):                              dict(                                  afi="ipv4",                                  cost=100, -                                authentication=dict( -                                    plaintext_password="abcdefg!" -                                ), +                                authentication=dict(plaintext_password="abcdefg!"),                                  priority=55,                              ),                              dict(afi="ipv6", mtu_ignore=True, instance=20), @@ -370,9 +359,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule):              "set interfaces bonding bond2 ipv6 ospfv3 passive",          ]          result = self.execute_module(changed=False) -        self.assertEqual( -            sorted(result["rendered"]), sorted(commands), result["rendered"] -        ) +        self.assertEqual(sorted(result["rendered"]), sorted(commands), result["rendered"])      def test_vyos_ospf_interfaces_parsed(self):          commands = [ @@ -437,14 +424,10 @@ class TestVyosOspfInterfacesModule(TestVyosModule):      def test_vyos_ospf_interfaces_gathered(self):          set_module_args(dict(state="gathered")) -        result = self.execute_module( -            changed=False, filename="vyos_ospf_interfaces_config.cfg" -        ) +        result = self.execute_module(changed=False, filename="vyos_ospf_interfaces_config.cfg")          gathered_list = [              { -                "address_family": [ -                    {"afi": "ipv6", "instance": "33", "mtu_ignore": True} -                ], +                "address_family": [{"afi": "ipv6", "instance": "33", "mtu_ignore": True}],                  "name": "eth0",              },              { diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv2.py b/tests/unit/modules/network/vyos/test_vyos_ospfv2.py index c3631d9c..e036f684 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv2.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv2.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_ospfv2 -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -47,16 +46,12 @@ class TestVyosOspfv2Module(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv2.ospfv2.Ospfv2Facts.get_device_data" @@ -271,9 +266,7 @@ class TestVyosOspfv2Module(TestVyosModule):      def test_vyos_ospfv2_gathered(self):          set_module_args(dict(state="gathered")) -        result = self.execute_module( -            changed=False, filename="vyos_ospfv2_config.cfg" -        ) +        result = self.execute_module(changed=False, filename="vyos_ospfv2_config.cfg")          gather_dict = {              "areas": [                  { @@ -378,9 +371,7 @@ set protocols ospf redistribute bgp metric-type '2'"""                  "router_id": "192.0.1.1",              },              "passive_interface": ["eth2", "eth1"], -            "redistribute": [ -                {"metric": 10, "metric_type": 2, "route_type": "bgp"} -            ], +            "redistribute": [{"metric": 10, "metric_type": 2, "route_type": "bgp"}],          }          self.assertEqual(sorted(parsed_list), sorted(result["parsed"])) @@ -430,6 +421,4 @@ set protocols ospf redistribute bgp metric-type '2'"""              "set protocols ospf area 4 network 192.0.2.0/24",          ]          result = self.execute_module(changed=False) -        self.assertEqual( -            sorted(result["rendered"]), sorted(commands), result["rendered"] -        ) +        self.assertEqual(sorted(result["rendered"]), sorted(commands), result["rendered"]) diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py index ec474619..d04b7f7e 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_ospfv3 -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -47,16 +46,12 @@ class TestVyosOspfv3Module(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv3.ospfv3.Ospfv3Facts.get_device_data" @@ -254,9 +249,7 @@ class TestVyosOspfv3Module(TestVyosModule):      def test_vyos_ospfv3_gathered(self):          set_module_args(dict(state="gathered")) -        result = self.execute_module( -            changed=False, filename="vyos_ospfv3_config.cfg" -        ) +        result = self.execute_module(changed=False, filename="vyos_ospfv3_config.cfg")          gather_dict = {              "areas": [                  { @@ -343,6 +336,4 @@ set protocols ospfv3 redistribute 'bgp'"""              "set protocols ospfv3 area 3 range 2001:db40::/32",          ]          result = self.execute_module(changed=False) -        self.assertEqual( -            sorted(result["rendered"]), sorted(commands), result["rendered"] -        ) +        self.assertEqual(sorted(result["rendered"]), sorted(commands), result["rendered"]) diff --git a/tests/unit/modules/network/vyos/test_vyos_ping.py b/tests/unit/modules/network/vyos/test_vyos_ping.py index 9b79ce63..ea8d2598 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ping.py +++ b/tests/unit/modules/network/vyos/test_vyos_ping.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_ping -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture diff --git a/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py b/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py index d1e1a8c8..e8d044d9 100644 --- a/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py +++ b/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py @@ -21,11 +21,11 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  from textwrap import dedent -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +  from ansible_collections.vyos.vyos.plugins.modules import vyos_prefix_lists -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule @@ -50,9 +50,7 @@ class TestVyosPrefixListsModule(TestVyosModule):          self.mock_get_resource_connection = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection = ( -            self.mock_get_resource_connection.start() -        ) +        self.get_resource_connection = self.mock_get_resource_connection.start()          self.mock_get_config = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.prefix_lists.prefix_lists.Prefix_listsFacts.get_config" diff --git a/tests/unit/modules/network/vyos/test_vyos_route_maps.py b/tests/unit/modules/network/vyos/test_vyos_route_maps.py index d11e5abc..6b50ad5b 100644 --- a/tests/unit/modules/network/vyos/test_vyos_route_maps.py +++ b/tests/unit/modules/network/vyos/test_vyos_route_maps.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_route_maps -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -38,16 +37,12 @@ class TestVyosRouteMapsModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.route_maps.route_maps.Route_mapsFacts.get_config" diff --git a/tests/unit/modules/network/vyos/test_vyos_snmp_server.py b/tests/unit/modules/network/vyos/test_vyos_snmp_server.py index 6cac77d3..60a0746a 100644 --- a/tests/unit/modules/network/vyos/test_vyos_snmp_server.py +++ b/tests/unit/modules/network/vyos/test_vyos_snmp_server.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_snmp_server -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -38,16 +37,12 @@ class TestVyosSnmpServerModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.snmp_server.snmp_server.Snmp_serverFacts.get_config" @@ -89,21 +84,13 @@ class TestVyosSnmpServerModule(TestVyosModule):                          users=[                              dict(                                  user="admin_user", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                              dict(                                  user="guest_user", -                                authentication=dict( -                                    type="sha", plaintext_key="opq1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="opq1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="opq1234567"), +                                privacy=dict(type="aes", plaintext_key="opq1234567"),                              ),                          ]                      ), @@ -131,21 +118,13 @@ class TestVyosSnmpServerModule(TestVyosModule):                          users=[                              dict(                                  user="admin_user", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                              dict(                                  user="guest_user", -                                authentication=dict( -                                    type="sha", plaintext_key="opq1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="opq1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="opq1234567"), +                                privacy=dict(type="aes", plaintext_key="opq1234567"),                              ),                          ]                      ), @@ -173,21 +152,13 @@ class TestVyosSnmpServerModule(TestVyosModule):                          users=[                              dict(                                  user="admin_user", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                              dict(                                  user="guest_user", -                                authentication=dict( -                                    type="sha", plaintext_key="opq1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="opq1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="opq1234567"), +                                privacy=dict(type="aes", plaintext_key="opq1234567"),                              ),                          ]                      ), @@ -213,9 +184,7 @@ class TestVyosSnmpServerModule(TestVyosModule):                      description="snmp_config",                      smux_peer="peer1",                      trap_source="1.1.1.1", -                    trap_target=dict( -                        address="10.10.1.1", community="switches", port="80" -                    ), +                    trap_target=dict(address="10.10.1.1", community="switches", port="80"),                      snmp_v3=dict(                          engine_id="34",                          groups=[ @@ -229,12 +198,8 @@ class TestVyosSnmpServerModule(TestVyosModule):                          trap_targets=[                              dict(                                  address="20.12.1.1", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                          ],                      ), @@ -275,9 +240,7 @@ class TestVyosSnmpServerModule(TestVyosModule):                      description="snmp_config",                      smux_peer="peer1",                      trap_source="1.1.1.1", -                    trap_target=dict( -                        address="10.10.1.1", community="switches", port="80" -                    ), +                    trap_target=dict(address="10.10.1.1", community="switches", port="80"),                      snmp_v3=dict(                          engine_id="34",                          groups=[ @@ -291,12 +254,8 @@ class TestVyosSnmpServerModule(TestVyosModule):                          trap_targets=[                              dict(                                  address="20.12.1.1", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                          ],                      ), @@ -350,9 +309,7 @@ class TestVyosSnmpServerModule(TestVyosModule):                      description="snmp_config",                      smux_peer="peer1",                      trap_source="1.1.1.1", -                    trap_target=dict( -                        address="10.10.1.1", community="switches", port="80" -                    ), +                    trap_target=dict(address="10.10.1.1", community="switches", port="80"),                      snmp_v3=dict(                          engine_id="34",                          groups=[ @@ -366,12 +323,8 @@ class TestVyosSnmpServerModule(TestVyosModule):                          trap_targets=[                              dict(                                  address="20.12.1.1", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                          ],                      ), @@ -434,9 +387,7 @@ class TestVyosSnmpServerModule(TestVyosModule):                      description="snmp_config",                      smux_peer="peer1",                      trap_source="1.1.1.1", -                    trap_target=dict( -                        address="10.10.1.1", community="switches", port="80" -                    ), +                    trap_target=dict(address="10.10.1.1", community="switches", port="80"),                      snmp_v3=dict(                          engine_id="34",                          groups=[ @@ -450,12 +401,8 @@ class TestVyosSnmpServerModule(TestVyosModule):                          trap_targets=[                              dict(                                  address="20.12.1.1", -                                authentication=dict( -                                    type="sha", plaintext_key="abc1234567" -                                ), -                                privacy=dict( -                                    type="aes", plaintext_key="abc1234567" -                                ), +                                authentication=dict(type="sha", plaintext_key="abc1234567"), +                                privacy=dict(type="aes", plaintext_key="abc1234567"),                              ),                          ],                      ), diff --git a/tests/unit/modules/network/vyos/test_vyos_static_routes.py b/tests/unit/modules/network/vyos/test_vyos_static_routes.py index 5577d9ce..df259924 100644 --- a/tests/unit/modules/network/vyos/test_vyos_static_routes.py +++ b/tests/unit/modules/network/vyos/test_vyos_static_routes.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_static_routes -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -47,16 +46,12 @@ class TestVyosStaticRoutesModule(TestVyosModule):          self.mock_get_resource_connection_config = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection"          ) -        self.get_resource_connection_config = ( -            self.mock_get_resource_connection_config.start() -        ) +        self.get_resource_connection_config = self.mock_get_resource_connection_config.start()          self.mock_get_resource_connection_facts = patch(              "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection"          ) -        self.get_resource_connection_facts = ( -            self.mock_get_resource_connection_facts.start() -        ) +        self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start()          self.mock_execute_show_command = patch(              "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data" @@ -128,12 +123,8 @@ class TestVyosStaticRoutesModule(TestVyosModule):                                      dict(                                          dest="192.0.2.32/28",                                          next_hops=[ -                                            dict( -                                                forward_router_address="192.0.2.9" -                                            ), -                                            dict( -                                                forward_router_address="192.0.2.10" -                                            ), +                                            dict(forward_router_address="192.0.2.9"), +                                            dict(forward_router_address="192.0.2.10"),                                          ],                                      )                                  ], @@ -197,12 +188,8 @@ class TestVyosStaticRoutesModule(TestVyosModule):                                      dict(                                          dest="192.0.2.32/28",                                          next_hops=[ -                                            dict( -                                                forward_router_address="192.0.2.9" -                                            ), -                                            dict( -                                                forward_router_address="192.0.2.10" -                                            ), +                                            dict(forward_router_address="192.0.2.9"), +                                            dict(forward_router_address="192.0.2.10"),                                          ],                                      )                                  ], @@ -228,12 +215,8 @@ class TestVyosStaticRoutesModule(TestVyosModule):                                      dict(                                          dest="192.0.2.48/28",                                          next_hops=[ -                                            dict( -                                                forward_router_address="192.0.2.9" -                                            ), -                                            dict( -                                                forward_router_address="192.0.2.10" -                                            ), +                                            dict(forward_router_address="192.0.2.9"), +                                            dict(forward_router_address="192.0.2.10"),                                          ],                                      )                                  ], @@ -264,12 +247,8 @@ class TestVyosStaticRoutesModule(TestVyosModule):                                      dict(                                          dest="192.0.2.32/28",                                          next_hops=[ -                                            dict( -                                                forward_router_address="192.0.2.9" -                                            ), -                                            dict( -                                                forward_router_address="192.0.2.10" -                                            ), +                                            dict(forward_router_address="192.0.2.9"), +                                            dict(forward_router_address="192.0.2.10"),                                          ],                                      )                                  ], diff --git a/tests/unit/modules/network/vyos/test_vyos_system.py b/tests/unit/modules/network/vyos/test_vyos_system.py index b763d9ca..36657206 100644 --- a/tests/unit/modules/network/vyos/test_vyos_system.py +++ b/tests/unit/modules/network/vyos/test_vyos_system.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_system -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -80,9 +79,7 @@ class TestVyosSystemModule(TestVyosModule):          self.execute_module(changed=True, commands=commands)      def test_vyos_system_domain_search(self): -        set_module_args( -            dict(domain_search=["foo.example.com", "bar.example.com"]) -        ) +        set_module_args(dict(domain_search=["foo.example.com", "bar.example.com"]))          commands = [              "set system domain-search domain 'foo.example.com'",              "set system domain-search domain 'bar.example.com'", diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py index 427036b5..5a1f69fd 100644 --- a/tests/unit/modules/network/vyos/test_vyos_user.py +++ b/tests/unit/modules/network/vyos/test_vyos_user.py @@ -20,11 +20,10 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible_collections.vyos.vyos.plugins.modules import vyos_user -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( -    set_module_args, -) +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +from ansible_collections.vyos.vyos.tests.unit.modules.utils import set_module_args +  from .vyos_module import TestVyosModule, load_fixture @@ -59,17 +58,13 @@ class TestVyosUserModule(TestVyosModule):          result = self.execute_module(changed=True)          self.assertEqual(              result["commands"], -            [ -                "set system login user ansible authentication plaintext-password test" -            ], +            ["set system login user ansible authentication plaintext-password test"],          )      def test_vyos_user_delete(self):          set_module_args(dict(name="ansible", state="absent"))          result = self.execute_module(changed=True) -        self.assertEqual( -            result["commands"], ["delete system login user ansible"] -        ) +        self.assertEqual(result["commands"], ["delete system login user ansible"])      def test_vyos_user_level(self):          set_module_args(dict(name="ansible", level="operator")) @@ -107,9 +102,7 @@ class TestVyosUserModule(TestVyosModule):          result = self.execute_module(changed=True)          self.assertEqual(              result["commands"], -            [ -                "set system login user test authentication plaintext-password test" -            ], +            ["set system login user test authentication plaintext-password test"],          )      def test_vyos_user_update_password_on_create_ok(self): @@ -133,7 +126,5 @@ class TestVyosUserModule(TestVyosModule):          result = self.execute_module(changed=True)          self.assertEqual(              result["commands"], -            [ -                "set system login user ansible authentication plaintext-password test" -            ], +            ["set system login user ansible authentication plaintext-password test"],          ) diff --git a/tests/unit/modules/network/vyos/vyos_module.py b/tests/unit/modules/network/vyos/vyos_module.py index cb7874fb..98a422d5 100644 --- a/tests/unit/modules/network/vyos/vyos_module.py +++ b/tests/unit/modules/network/vyos/vyos_module.py @@ -20,8 +20,8 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type -import os  import json +import os  from ansible_collections.vyos.vyos.tests.unit.modules.utils import (      AnsibleExitJson, @@ -29,7 +29,6 @@ from ansible_collections.vyos.vyos.tests.unit.modules.utils import (      ModuleTestCase,  ) -  fixture_path = os.path.join(os.path.dirname(__file__), "fixtures")  fixture_data = {} @@ -83,9 +82,7 @@ class TestVyosModule(ModuleTestCase):                      result["commands"],                  )              else: -                self.assertEqual( -                    commands, result["commands"], result["commands"] -                ) +                self.assertEqual(commands, result["commands"], result["commands"])          return result diff --git a/tests/unit/modules/utils.py b/tests/unit/modules/utils.py index 90023ced..779c68fe 100644 --- a/tests/unit/modules/utils.py +++ b/tests/unit/modules/utils.py @@ -3,11 +3,12 @@ from __future__ import absolute_import, division, print_function  __metaclass__ = type  import json -from ansible_collections.vyos.vyos.tests.unit.compat import unittest -from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch  from ansible.module_utils import basic  from ansible.module_utils._text import to_bytes +from ansible_collections.vyos.vyos.tests.unit.compat import unittest +from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch +  def set_module_args(args):      if "_ansible_remote_tmp" not in args: | 
