diff options
author | Kate Case <kcase@redhat.com> | 2022-10-13 13:11:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-13 13:11:19 -0400 |
commit | 5c6a97ae5052684aed513427f81dc1da96c094e3 (patch) | |
tree | 62cf80483b7f46551fec0bbcc7f5c5b50db1b2a5 /tests | |
parent | 7712afd90de9a2b4f6d91f3fbea77de20d6ed40e (diff) | |
download | vyos.vyos-5c6a97ae5052684aed513427f81dc1da96c094e3.tar.gz vyos.vyos-5c6a97ae5052684aed513427f81dc1da96c094e3.zip |
Remove deprecated modules and provider (#277)
* Remove deprecated modules and provider
* Remove tests for removed modules
* Remove references to vyos_argument_spec
Diffstat (limited to 'tests')
38 files changed, 0 insertions, 1667 deletions
diff --git a/tests/integration/targets/vyos_banner/tasks/cli.yaml b/tests/integration/targets/vyos_banner/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_banner/tasks/cli.yaml +++ b/tests/integration/targets/vyos_banner/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_command/tasks/cli.yaml b/tests/integration/targets/vyos_command/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_command/tasks/cli.yaml +++ b/tests/integration/targets/vyos_command/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_config/tasks/cli.yaml b/tests/integration/targets/vyos_config/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_config/tasks/cli.yaml +++ b/tests/integration/targets/vyos_config/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_facts/tasks/cli.yaml b/tests/integration/targets/vyos_facts/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_facts/tasks/cli.yaml +++ b/tests/integration/targets/vyos_facts/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_interface/defaults/main.yaml b/tests/integration/targets/vyos_interface/defaults/main.yaml deleted file mode 100644 index a845c24..0000000 --- a/tests/integration/targets/vyos_interface/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: '*' -test_items: [] diff --git a/tests/integration/targets/vyos_interface/tasks/cli.yaml b/tests/integration/targets/vyos_interface/tasks/cli.yaml deleted file mode 100644 index b23cb60..0000000 --- a/tests/integration/targets/vyos_interface/tasks/cli.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_interface/tasks/main.yaml b/tests/integration/targets/vyos_interface/tasks/main.yaml deleted file mode 100644 index 07b0f2e..0000000 --- a/tests/integration/targets/vyos_interface/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: cli.yaml diff --git a/tests/integration/targets/vyos_interface/tests/cli/basic.yaml b/tests/integration/targets/vyos_interface/tests/cli/basic.yaml deleted file mode 100644 index b50d7da..0000000 --- a/tests/integration/targets/vyos_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,248 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Run vyos lsmod command - register: lsmod_out - vyos.vyos.vyos_command: - commands: - - lsmod - -- name: Set up - delete interface - vyos.vyos.vyos_interface: - name: eth1 - state: absent - -- name: Set up - Create interface - register: result - vyos.vyos.vyos_interface: - name: eth1 - state: present - description: test-interface - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1" in result.commands' - - "\"set interfaces ethernet eth1 description 'test-interface'\" in result.commands" - -- name: Configure interface params - when: "'virtio_net' not in lsmod_out.stdout[0]" - register: result - vyos.vyos.vyos_interface: - name: eth1 - state: present - description: test-interface-1 - speed: 100 - duplex: half - mtu: 256 - -- assert: - that: - - result.changed == true - - "\"set interfaces ethernet eth1 description 'test-interface-1'\" in result.commands" - - '"set interfaces ethernet eth1 speed 100" in result.commands' - - '"set interfaces ethernet eth1 duplex half" in result.commands' - - '"set interfaces ethernet eth1 mtu 256" in result.commands' - when: "'virtio_net' not in lsmod_out.stdout[0]" - -- name: Configure interface params (idempotent) - register: result - when: "'virtio_net' not in lsmod_out.stdout[0]" - vyos.vyos.vyos_interface: - name: eth1 - state: present - description: test-interface-1 - speed: 100 - duplex: half - mtu: 256 - -- assert: - that: - - result.changed == false - when: "'virtio' not in lsmod_out.stdout[0]" - -- name: Change interface params - register: result - when: "'virtio_net' not in lsmod_out.stdout[0]" - vyos.vyos.vyos_interface: - name: eth1 - state: present - description: test-interface-2 - speed: 1000 - duplex: full - mtu: 512 - -- assert: - that: - - result.changed == true - - "\"set interfaces ethernet eth1 description 'test-interface-2'\" in result.commands" - - '"set interfaces ethernet eth1 speed 1000" in result.commands' - - '"set interfaces ethernet eth1 duplex full" in result.commands' - - '"set interfaces ethernet eth1 mtu 512" in result.commands' - when: "'virtio_net' not in lsmod_out.stdout[0]" - -- name: Disable interface - register: result - vyos.vyos.vyos_interface: - name: eth1 - enabled: false - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1 disable" in result.commands' - -- name: Enable interface - register: result - vyos.vyos.vyos_interface: - name: eth1 - enabled: true - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 disable" in result.commands' - -- name: Delete interface - register: result - vyos.vyos.vyos_interface: - name: eth1 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1" in result.commands' - -- name: Delete interface (idempotent) - register: result - vyos.vyos.vyos_interface: - name: eth1 - state: absent - -- assert: - that: - - result.changed == false - -- name: Aggregate setup- delete interface - register: result - vyos.vyos.vyos_interface: - name: eth2 - state: absent - -- name: Set interface on aggregate - register: result - when: "'virtio_net' not in lsmod_out.stdout[0]" - vyos.vyos.vyos_interface: - aggregate: - - - name: eth1 - description: test-interface-1 - speed: 100 - duplex: half - mtu: 512 - - - name: eth2 - description: test-interface-2 - speed: 1000 - duplex: full - mtu: 256 - -- assert: - that: - - result.changed == true - - "\"set interfaces ethernet eth1 description 'test-interface-1'\" in result.commands" - - '"set interfaces ethernet eth1 speed 100" in result.commands' - - '"set interfaces ethernet eth1 duplex half" in result.commands' - - '"set interfaces ethernet eth1 mtu 512" in result.commands' - - "\"set interfaces ethernet eth2 description 'test-interface-2'\" in result.commands" - - '"set interfaces ethernet eth2 speed 1000" in result.commands' - - '"set interfaces ethernet eth2 duplex full" in result.commands' - - '"set interfaces ethernet eth2 mtu 256" in result.commands' - when: "'virtio_net' not in lsmod_out.stdout[0]" - -- name: Set interface on aggregate (idempotent) - register: result - when: "'virtio_net' not in lsmod_out.stdout[0]" - vyos.vyos.vyos_interface: - aggregate: - - - name: eth1 - description: test-interface-1 - speed: 100 - duplex: half - mtu: 512 - - - name: eth2 - description: test-interface-2 - speed: 1000 - duplex: full - mtu: 256 - -- assert: - that: - - result.changed == false - when: "'virtio_net' not in lsmod_out.stdout[0]" - -- name: Disable interface on aggregate - register: result - vyos.vyos.vyos_interface: - aggregate: - - - name: eth1 - - - name: eth2 - description: test-interface - enabled: false - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1 disable" in result.commands' - - '"set interfaces ethernet eth2 disable" in result.commands' - -- name: Enable interface on aggregate - register: result - vyos.vyos.vyos_interface: - aggregate: - - - name: eth1 - - - name: eth2 - enabled: true - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 disable" in result.commands' - - '"delete interfaces ethernet eth2 disable" in result.commands' - -- name: Delete interface aggregate - register: result - vyos.vyos.vyos_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1" in result.commands' - - '"delete interfaces ethernet eth2" in result.commands' - -- name: Delete interface aggregate (idempotent) - register: result - vyos.vyos.vyos_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: absent - -- assert: - that: - - result.changed == false diff --git a/tests/integration/targets/vyos_l3_interface/defaults/main.yaml b/tests/integration/targets/vyos_l3_interface/defaults/main.yaml deleted file mode 100644 index a845c24..0000000 --- a/tests/integration/targets/vyos_l3_interface/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: '*' -test_items: [] diff --git a/tests/integration/targets/vyos_l3_interface/tasks/cli.yaml b/tests/integration/targets/vyos_l3_interface/tasks/cli.yaml deleted file mode 100644 index b23cb60..0000000 --- a/tests/integration/targets/vyos_l3_interface/tasks/cli.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_l3_interface/tasks/main.yaml b/tests/integration/targets/vyos_l3_interface/tasks/main.yaml deleted file mode 100644 index 07b0f2e..0000000 --- a/tests/integration/targets/vyos_l3_interface/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: cli.yaml diff --git a/tests/integration/targets/vyos_l3_interface/tests/cli/basic.yaml b/tests/integration/targets/vyos_l3_interface/tests/cli/basic.yaml deleted file mode 100644 index 2ffb1ab..0000000 --- a/tests/integration/targets/vyos_l3_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,231 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Remove IP address - vyos.vyos.vyos_l3_interface: - name: eth1 - state: absent - -- name: Remove IP address - vyos.vyos.vyos_l3_interface: - name: eth2 - state: absent - -- name: Set IPv4 address - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv4: 192.168.2.10/24 - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1 address 192.168.2.10/24" in result.commands' - -- name: Set IPv4 address (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv4: 192.168.2.10/24 - -- assert: - that: - - result.changed == false - -- name: Set IPv6 address - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv6: fd5d:12c9:2201:1::1/64 - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1 address fd5d:12c9:2201:1::1/64" in result.commands' - -- name: Set IPv6 address (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv6: fd5d:12c9:2201:1::1/64 - -- assert: - that: - - result.changed == false - -- name: Remove all IP addresses - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 address" in result.commands' - -- name: Remove all IP addresses again (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - state: absent - -- assert: - that: - - result.changed == false - -- name: Set IPv4 and IPv6 address - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv4: 192.168.2.10/24 - ipv6: fd5d:12c9:2201:1::1/64 - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1 address 192.168.2.10/24" in result.commands' - - '"set interfaces ethernet eth1 address fd5d:12c9:2201:1::1/64" in result.commands' - -- name: Set IPv4 and IPv6 address again (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv4: 192.168.2.10/24 - ipv6: fd5d:12c9:2201:1::1/64 - -- assert: - that: - - result.changed == false - -- name: Remove IPv4 address - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv4: 192.168.2.10/24 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 address 192.168.2.10/24" in result.commands' - -- name: Remove IPv4 address again (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv4: 192.168.2.10/24 - state: absent - -- assert: - that: - - result.changed == false - -- name: Remove IPv6 address - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv6: fd5d:12c9:2201:1::1/64 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 address fd5d:12c9:2201:1::1/64" in result.commands' - -- name: Remove IPv6 address again (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - name: eth1 - ipv6: fd5d:12c9:2201:1::1/64 - state: absent - -- assert: - that: - - result.changed == false - -- name: Set IP addresses on aggregate - register: result - vyos.vyos.vyos_l3_interface: - aggregate: - - - name: eth1 - ipv4: 192.168.2.10/24 - - - name: eth2 - ipv4: 192.168.3.10/24 - ipv6: fd5d:12c9:2201:1::1/64 - - - name: eth2 - ipv4: 192.168.4.10/24 - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth1 address 192.168.2.10/24" in result.commands' - - '"set interfaces ethernet eth2 address 192.168.3.10/24" in result.commands' - - '"set interfaces ethernet eth2 address fd5d:12c9:2201:1::1/64" in result.commands' - - '"set interfaces ethernet eth2 address 192.168.4.10/24" in result.commands' - -- name: Set IP addresses on aggregate (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - aggregate: - - - name: eth1 - ipv4: 192.168.2.10/24 - - - name: eth2 - ipv4: 192.168.3.10/24 - ipv6: fd5d:12c9:2201:1::1/64 - - - name: eth2 - ipv4: 192.168.4.10/24 - -- assert: - that: - - result.changed == false - -- name: Remove IP addresses on aggregate - register: result - vyos.vyos.vyos_l3_interface: - aggregate: - - - name: eth1 - ipv4: 192.168.2.10/24 - - - name: eth2 - ipv4: 192.168.3.10/24 - ipv6: fd5d:12c9:2201:1::1/64 - - - name: eth2 - ipv4: 192.168.4.10/24 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 address 192.168.2.10/24" in result.commands' - - '"delete interfaces ethernet eth2 address 192.168.3.10/24" in result.commands' - - '"delete interfaces ethernet eth2 address fd5d:12c9:2201:1::1/64" in result.commands' - - '"delete interfaces ethernet eth2 address 192.168.4.10/24" in result.commands' - -- name: Remove IP addresses on aggregate (idempotent) - register: result - vyos.vyos.vyos_l3_interface: - aggregate: - - - name: eth1 - ipv4: 192.168.2.10/24 - - - name: eth2 - ipv4: 192.168.3.10/24 - ipv6: fd5d:12c9:2201:1::1/64 - - - name: eth2 - ipv4: 192.168.4.10/24 - state: absent - -- assert: - that: - - result.changed == false diff --git a/tests/integration/targets/vyos_linkagg/defaults/main.yaml b/tests/integration/targets/vyos_linkagg/defaults/main.yaml deleted file mode 100644 index a845c24..0000000 --- a/tests/integration/targets/vyos_linkagg/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: '*' -test_items: [] diff --git a/tests/integration/targets/vyos_linkagg/tasks/cli.yaml b/tests/integration/targets/vyos_linkagg/tasks/cli.yaml deleted file mode 100644 index b23cb60..0000000 --- a/tests/integration/targets/vyos_linkagg/tasks/cli.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_linkagg/tasks/main.yaml b/tests/integration/targets/vyos_linkagg/tasks/main.yaml deleted file mode 100644 index 07b0f2e..0000000 --- a/tests/integration/targets/vyos_linkagg/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: cli.yaml diff --git a/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml b/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml deleted file mode 100644 index ffe0c42..0000000 --- a/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml +++ /dev/null @@ -1,200 +0,0 @@ ---- -- debug: msg="cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Remove linkagg - vyos.vyos.vyos_linkagg: - name: bond0 - state: absent - -- name: Remove linkagg - vyos.vyos.vyos_linkagg: - name: bond1 - state: absent - -- name: Create linkagg - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - members: - - eth1 - state: present - -- assert: - that: - - result.changed == true - - '"set interfaces bonding bond0 mode 802.3ad" in result.commands' - - '"set interfaces ethernet eth1 bond-group bond0" in result.commands' - -- name: Create linkagg again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - members: - - eth1 - state: present - -- assert: - that: - - result.changed == false - -- name: Add linkagg member - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - members: - - eth2 - state: present - -- assert: - that: - - result.changed == true - - '"set interfaces ethernet eth2 bond-group bond0" in result.commands' - -- name: Add linkagg member again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - members: - - eth2 - state: present - -- assert: - that: - - result.changed == false - -- name: Disable linkagg - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - state: down - -- assert: - that: - - result.changed == true - - '"set interfaces bonding bond0 disable" in result.commands' - -- name: Disable linkagg again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - state: down - -- assert: - that: - - result.changed == false - -- name: Enable linkagg - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - state: up - -- assert: - that: - - result.changed == true - - '"delete interfaces bonding bond0 disable" in result.commands[0]' - -- name: Enable linkagg again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - state: up - -- assert: - that: - - result.changed == false - -- name: Remove linkagg - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 bond-group" in result.commands' - - '"delete interfaces ethernet eth2 bond-group" in result.commands' - - '"delete interfaces bonding bond0" in result.commands' - -- name: Remove linkagg again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - name: bond0 - state: absent - -- assert: - that: - - result.changed == false - -- name: Create collection of linkagg definitions - register: result - vyos.vyos.vyos_linkagg: - aggregate: - - - name: bond0 - members: - - eth1 - - - name: bond1 - members: - - eth2 - state: present - -- assert: - that: - - result.changed == true - - '"set interfaces bonding bond0 mode 802.3ad" in result.commands' - - '"set interfaces ethernet eth1 bond-group bond0" in result.commands' - - '"set interfaces bonding bond1 mode 802.3ad" in result.commands' - - '"set interfaces ethernet eth2 bond-group bond1" in result.commands' - -- name: Create collection of linkagg definitions again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - aggregate: - - - name: bond0 - members: - - eth1 - - - name: bond1 - members: - - eth2 - state: present - -- assert: - that: - - result.changed == false - -- name: Remove collection of linkagg definitions - register: result - vyos.vyos.vyos_linkagg: - aggregate: - - - name: bond0 - - - name: bond1 - state: absent - -- assert: - that: - - result.changed == true - - '"delete interfaces ethernet eth1 bond-group" in result.commands' - - '"delete interfaces bonding bond0" in result.commands' - - '"delete interfaces ethernet eth2 bond-group" in result.commands' - - '"delete interfaces bonding bond1" in result.commands' - -- name: Remove collection of linkagg definitions again (idempotent) - register: result - vyos.vyos.vyos_linkagg: - aggregate: - - - name: bond0 - - - name: bond1 - state: absent - -- assert: - that: - - result.changed == false diff --git a/tests/integration/targets/vyos_lldp/aliases b/tests/integration/targets/vyos_lldp/aliases deleted file mode 100644 index 8071e1f..0000000 --- a/tests/integration/targets/vyos_lldp/aliases +++ /dev/null @@ -1 +0,0 @@ -shippable/vyos/group1 diff --git a/tests/integration/targets/vyos_lldp/defaults/main.yaml b/tests/integration/targets/vyos_lldp/defaults/main.yaml deleted file mode 100644 index a845c24..0000000 --- a/tests/integration/targets/vyos_lldp/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: '*' -test_items: [] diff --git a/tests/integration/targets/vyos_lldp/tasks/cli.yaml b/tests/integration/targets/vyos_lldp/tasks/cli.yaml deleted file mode 100644 index b23cb60..0000000 --- a/tests/integration/targets/vyos_lldp/tasks/cli.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_lldp/tasks/main.yaml b/tests/integration/targets/vyos_lldp/tasks/main.yaml deleted file mode 100644 index 07b0f2e..0000000 --- a/tests/integration/targets/vyos_lldp/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: cli.yaml diff --git a/tests/integration/targets/vyos_lldp/tests/cli/basic.yaml b/tests/integration/targets/vyos_lldp/tests/cli/basic.yaml deleted file mode 100644 index b108bbf..0000000 --- a/tests/integration/targets/vyos_lldp/tests/cli/basic.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Make sure LLDP is not running before tests - vyos.vyos.vyos_config: - lines: delete service lldp - -- name: Enable LLDP service - register: result - vyos.vyos.vyos_lldp: - state: present - -- assert: - that: - - result.changed == true - - '"set service lldp" in result.commands' - -- name: Enable LLDP service again (idempotent) - register: result - vyos.vyos.vyos_lldp: - state: present - -- assert: - that: - - result.changed == false - -- name: Disable LLDP service - register: result - vyos.vyos.vyos_lldp: - state: absent - -- assert: - that: - - result.changed == true - - '"delete service lldp" in result.commands' - -- name: - register: result - vyos.vyos.vyos_lldp: - state: absent - -- assert: - that: - - result.changed == false diff --git a/tests/integration/targets/vyos_lldp_interface/aliases b/tests/integration/targets/vyos_lldp_interface/aliases deleted file mode 100644 index 8071e1f..0000000 --- a/tests/integration/targets/vyos_lldp_interface/aliases +++ /dev/null @@ -1 +0,0 @@ -shippable/vyos/group1 diff --git a/tests/integration/targets/vyos_lldp_interface/defaults/main.yaml b/tests/integration/targets/vyos_lldp_interface/defaults/main.yaml deleted file mode 100644 index a845c24..0000000 --- a/tests/integration/targets/vyos_lldp_interface/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: '*' -test_items: [] diff --git a/tests/integration/targets/vyos_lldp_interface/tasks/cli.yaml b/tests/integration/targets/vyos_lldp_interface/tasks/cli.yaml deleted file mode 100644 index b23cb60..0000000 --- a/tests/integration/targets/vyos_lldp_interface/tasks/cli.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_lldp_interface/tasks/main.yaml b/tests/integration/targets/vyos_lldp_interface/tasks/main.yaml deleted file mode 100644 index 07b0f2e..0000000 --- a/tests/integration/targets/vyos_lldp_interface/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: cli.yaml diff --git a/tests/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml b/tests/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml deleted file mode 100644 index 2697f48..0000000 --- a/tests/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,181 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Make sure LLDP is not running before tests - vyos.vyos.vyos_config: - lines: delete service lldp - -- name: Create LLDP configuration - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: present - -- assert: - that: - - result.changed == true - - '"set service lldp interface eth1" in result.commands' - -- name: Create LLDP configuration again (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: present - -- assert: - that: - - result.changed == false - -- name: Disable LLDP configuration - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: disabled - -- assert: - that: - - result.changed == true - - '"set service lldp interface eth1 disable" in result.commands' - -- name: Disable LLDP configuration again (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: disabled - -- assert: - that: - - result.changed == false - -- name: Enable LLDP configuration - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: enabled - -- assert: - that: - - result.changed == true - - '"delete service lldp interface eth1 disable" in result.commands' - -- name: Enable LLDP configuration again (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: enabled - -- assert: - that: - - result.changed == false - -- name: Delete LLDP configuration - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: absent - -- assert: - that: - - result.changed == true - - '"delete service lldp interface eth1" in result.commands' - -- name: Delete LLDP configuration again (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - name: eth1 - state: absent - -- assert: - that: - - result.changed == false - -- name: Create aggregate of LLDP interface configurations - register: result - vyos.vyos.vyos_lldp_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: present - -- assert: - that: - - result.changed == true - - '"set service lldp interface eth1" in result.commands' - - '"set service lldp interface eth2" in result.commands' - -- name: Create aggregate of LLDP interface configurations again (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: present - -- assert: - that: - - result.changed == false - -- name: Override LLDP interface configuration on aggregate - register: result - vyos.vyos.vyos_lldp_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: disabled - state: present - -- assert: - that: - - result.changed == true - - '"set service lldp interface eth2 disable" in result.commands' - -- name: Override LLDP interface configuration on aggregate again (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: disabled - state: present - -- assert: - that: - - result.changed == false - -- name: Delete aggregate of LLDP interface configurations - register: result - vyos.vyos.vyos_lldp_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: absent - -- assert: - that: - - result.changed == true - - '"delete service lldp interface eth1" in result.commands' - - '"delete service lldp interface eth2" in result.commands' - -- name: Delete aggregate of LLDP interface configurations (idempotent) - register: result - vyos.vyos.vyos_lldp_interface: - aggregate: - - - name: eth1 - - - name: eth2 - state: absent - -- assert: - that: - - result.changed == false diff --git a/tests/integration/targets/vyos_logging/tasks/cli.yaml b/tests/integration/targets/vyos_logging/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_logging/tasks/cli.yaml +++ b/tests/integration/targets/vyos_logging/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_static_route/aliases b/tests/integration/targets/vyos_static_route/aliases deleted file mode 100644 index 8071e1f..0000000 --- a/tests/integration/targets/vyos_static_route/aliases +++ /dev/null @@ -1 +0,0 @@ -shippable/vyos/group1 diff --git a/tests/integration/targets/vyos_static_route/defaults/main.yaml b/tests/integration/targets/vyos_static_route/defaults/main.yaml deleted file mode 100644 index a845c24..0000000 --- a/tests/integration/targets/vyos_static_route/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: '*' -test_items: [] diff --git a/tests/integration/targets/vyos_static_route/tasks/cli.yaml b/tests/integration/targets/vyos_static_route/tasks/cli.yaml deleted file mode 100644 index b23cb60..0000000 --- a/tests/integration/targets/vyos_static_route/tasks/cli.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=ansible.netcommon.network_cli) - include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' - with_items: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_static_route/tasks/main.yaml b/tests/integration/targets/vyos_static_route/tasks/main.yaml deleted file mode 100644 index 07b0f2e..0000000 --- a/tests/integration/targets/vyos_static_route/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: cli.yaml diff --git a/tests/integration/targets/vyos_static_route/tests/cli/basic.yaml b/tests/integration/targets/vyos_static_route/tests/cli/basic.yaml deleted file mode 100644 index be93e89..0000000 --- a/tests/integration/targets/vyos_static_route/tests/cli/basic.yaml +++ /dev/null @@ -1,137 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: create static route - register: result - vyos.vyos.vyos_static_route: - prefix: 172.24.0.0/24 - next_hop: 192.168.42.64 - state: present - -- assert: - that: - - result.changed == true - - '"set protocols static route 172.24.0.0/24 next-hop 192.168.42.64" in result.commands' - -- name: create static route again (idempotent) - register: result - vyos.vyos.vyos_static_route: - prefix: 172.24.0.0 - mask: 24 - next_hop: 192.168.42.64 - state: present - -- assert: - that: - - result.changed == false - -- name: modify admin distance of static route - register: result - vyos.vyos.vyos_static_route: - prefix: 172.24.0.0/24 - next_hop: 192.168.42.64 - admin_distance: 1 - state: present - -- assert: - that: - - result.changed == true - - '"set protocols static route 172.24.0.0/24 next-hop 192.168.42.64 distance - 1" in result.commands' - -- name: modify admin distance of static route again (idempotent) - register: result - vyos.vyos.vyos_static_route: - prefix: 172.24.0.0 - mask: 24 - next_hop: 192.168.42.64 - admin_distance: 1 - state: present - -- assert: - that: - - result.changed == false - -- name: delete static route - register: result - vyos.vyos.vyos_static_route: - prefix: 172.24.0.0/24 - next_hop: 192.168.42.64 - admin_distance: 1 - state: absent - -- assert: - that: - - result.changed == true - - '"delete protocols static route 172.24.0.0/24" in result.commands' - -- name: delete static route again (idempotent) - register: result - vyos.vyos.vyos_static_route: - prefix: 172.24.0.0/24 - next_hop: 192.168.42.64 - admin_distance: 1 - state: absent - -- assert: - that: - - result.changed == false - -- name: Add static route collections - register: result - vyos.vyos.vyos_static_route: - aggregate: - - - prefix: 172.24.1.0/24 - next_hop: 192.168.42.64 - - - prefix: 172.24.2.0 - mask: 24 - next_hop: 192.168.42.64 - state: present - -- assert: - that: - - result.changed == true - - '"set protocols static route 172.24.1.0/24 next-hop 192.168.42.64" in result.commands' - - '"set protocols static route 172.24.2.0/24 next-hop 192.168.42.64" in result.commands' - -- name: Add and remove static route collections with overrides - register: result - vyos.vyos.vyos_static_route: - aggregate: - - - prefix: 172.24.1.0/24 - next_hop: 192.168.42.64 - - - prefix: 172.24.2.0/24 - next_hop: 192.168.42.64 - state: absent - - - prefix: 172.24.3.0/24 - next_hop: 192.168.42.64 - state: present - -- assert: - that: - - result.changed == true - - '"delete protocols static route 172.24.2.0/24" in result.commands' - - '"set protocols static route 172.24.3.0/24 next-hop 192.168.42.64" in result.commands' - -- name: Remove static route collections - register: result - vyos.vyos.vyos_static_route: - aggregate: - - - prefix: 172.24.1.0/24 - next_hop: 192.168.42.64 - - - prefix: 172.24.3.0/24 - next_hop: 192.168.42.64 - state: absent - -- assert: - that: - - result.changed == true - - '"delete protocols static route 172.24.1.0/24" in result.commands' - - '"delete protocols static route 172.24.3.0/24" in result.commands' diff --git a/tests/integration/targets/vyos_system/tasks/cli.yaml b/tests/integration/targets/vyos_system/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_system/tasks/cli.yaml +++ b/tests/integration/targets/vyos_system/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_user/tasks/cli.yaml b/tests/integration/targets/vyos_user/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_user/tasks/cli.yaml +++ b/tests/integration/targets/vyos_user/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/integration/targets/vyos_vlan/tasks/cli.yaml b/tests/integration/targets/vyos_vlan/tasks/cli.yaml index b23cb60..8f7b62f 100644 --- a/tests/integration/targets/vyos_vlan/tasks/cli.yaml +++ b/tests/integration/targets/vyos_vlan/tasks/cli.yaml @@ -16,11 +16,3 @@ loop_var: test_case_to_run tags: - network_cli - -- name: run test case (connection=local) - include: '{{ test_case_to_run }} ansible_connection=local' - with_first_found: '{{ test_items }}' - loop_control: - loop_var: test_case_to_run - tags: - - local diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 59d08b5..5a69ef6 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -1,15 +1,3 @@ -plugins/modules/vyos_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/vyos_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/modules/vyos_l3_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/vyos_l3_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/modules/vyos_linkagg.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/vyos_linkagg.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/modules/vyos_static_route.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/vyos_static_route.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/modules/vyos_lldp.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/vyos_lldp.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/modules/vyos_lldp_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/vyos_lldp_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict plugins/modules/vyos_logging.py validate-modules:deprecation-mismatch # 2.9 expects METADATA plugins/modules/vyos_logging.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` diff --git a/tests/unit/modules/network/vyos/test_vyos_interface.py b/tests/unit/modules/network/vyos/test_vyos_interface.py deleted file mode 100644 index 0e959c3..0000000 --- a/tests/unit/modules/network/vyos/test_vyos_interface.py +++ /dev/null @@ -1,288 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -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_interface -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( - set_module_args, -) -from .vyos_module import TestVyosModule, load_fixture - - -class TestVyosInterfaceModule(TestVyosModule): - - module = vyos_interface - - def setUp(self): - super(TestVyosInterfaceModule, self).setUp() - self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.get_config" - ) - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.load_config" - ) - self.load_config = self.mock_load_config.start() - - self.mock_execute_interfaces_command = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.get_interfaces_data" - ) - self.execute_interfaces_command = ( - self.mock_execute_interfaces_command.start() - ) - self.mock_execute_lldp_command = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_interface.get_lldp_neighbor" - ) - self.execute_lldp_command = self.mock_execute_lldp_command.start() - - # self.mock_get_config = patch( - # "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" - # ) - # self.get_config = self.mock_get_config.start() - - # self.mock_load_config = patch( - # "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" - # ) - # self.load_config = self.mock_load_config.start() - - # 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.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() - # ) - - def tearDown(self): - super(TestVyosInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_lldp_command.stop() - self.mock_execute_interfaces_command.stop() - - def load_fixtures(self, commands=None, filename=None): - self.get_config.return_value = load_fixture( - "vyos_interface_config.cfg" - ) - self.execute_interfaces_command.return_value = [ - 0, - load_fixture("vyos_interface_config.cfg"), - None, - ] - self.execute_lldp_command.return_value = [ - 0, - load_fixture("vyos_lldp_neighbor_config.cfg"), - None, - ] - self.load_config.return_value = dict(diff=None, session="session") - - def test_vyos_setup_int(self): - set_module_args( - dict( - name="eth1", - enabled=True, - state="present", - speed="100", - duplex="half", - ) - ) - commands = [ - "set interfaces ethernet eth1 speed 100", - "set interfaces ethernet eth1 duplex half", - ] - self.execute_module(changed=True, commands=commands) - - def test_vyos_setup_required_params(self): - set_module_args( - dict( - name="eth1", - enabled=True, - state="present", - speed="100", - ) - ) - result = self.execute_module(failed=True) - self.assertIn( - "parameters are required together: speed, duplex", result["msg"] - ) - - def test_vyos_setup_int_idempotent(self): - set_module_args( - dict( - name="eth1", - enabled=True, - state="present", - ) - ) - self.execute_module(changed=False, commands=[]) - - def test_vyos_disable_int(self): - set_module_args( - dict( - name="eth1", - state="absent", - ) - ) - commands = ["delete interfaces ethernet eth1"] - self.execute_module(changed=True, commands=commands) - - def test_vyos_setup_int_aggregate(self): - set_module_args( - dict( - aggregate=[ - dict( - name="eth1", - enabled=True, - state="present", - mtu="512", - duplex="half", - speed="100", - ), - dict( - name="eth2", - enabled=True, - state="present", - speed="1000", - duplex="full", - mtu="256", - ), - ] - ) - ) - commands = [ - "set interfaces ethernet eth1 speed 100", - "set interfaces ethernet eth1 duplex half", - "set interfaces ethernet eth1 mtu 512", - "set interfaces ethernet eth2 speed 1000", - "set interfaces ethernet eth2 duplex full", - "set interfaces ethernet eth2 mtu 256", - ] - self.execute_module(changed=True, commands=commands) - - def test_vyos_delete_int_aggregate(self): - set_module_args( - dict( - aggregate=[ - dict( - name="eth1", - state="absent", - ), - dict( - name="eth2", - state="absent", - ), - ] - ) - ) - commands = [ - "delete interfaces ethernet eth1", - "delete interfaces ethernet eth2", - ] - self.execute_module(changed=True, commands=commands) - - def test_vyos_disable_int_aggregate(self): - set_module_args( - dict( - aggregate=[ - dict( - name="eth1", - enabled=False, - ), - dict( - name="eth2", - enabled=False, - ), - ] - ) - ) - commands = [ - "set interfaces ethernet eth1 disable", - "set interfaces ethernet eth2 disable", - ] - self.execute_module(changed=True, commands=commands) - - def test_vyos_intent_wrongport(self): - set_module_args( - dict( - name="eth0", - neighbors=[dict(port="dummy_port", host="dummy_host")], - ) - ) - result = self.execute_module(failed=True) - self.assertIn( - "One or more conditional statements have not been satisfied", - result["msg"], - ) - - def test_vyos_intent_neighbor_fail(self): - set_module_args( - dict( - name="eth0", - neighbors=[ - dict( - port="eth0", - ) - ], - ) - ) - result = self.execute_module(failed=True) - self.assertIn( - "One or more conditional statements have not been satisfied", - result["msg"], - ) - - def test_vyos_intent_neighbor(self): - set_module_args( - dict( - name="eth1", - neighbors=[ - dict( - port="eth0", - ) - ], - ) - ) - self.execute_module(failed=False) - - def test_vyos_intent_neighbor_aggregate(self): - set_module_args( - dict( - aggregate=[ - dict( - name="eth1", - neighbors=[ - dict( - port="eth0", - ) - ], - ) - ] - ) - ) - self.execute_module(failed=False) diff --git a/tests/unit/modules/network/vyos/test_vyos_static_route.py b/tests/unit/modules/network/vyos/test_vyos_static_route.py deleted file mode 100644 index 62bff19..0000000 --- a/tests/unit/modules/network/vyos/test_vyos_static_route.py +++ /dev/null @@ -1,73 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -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_route -from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( - set_module_args, -) -from .vyos_module import TestVyosModule - - -class TestVyosStaticRouteModule(TestVyosModule): - - module = vyos_static_route - - def setUp(self): - super(TestVyosStaticRouteModule, self).setUp() - - self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_static_route.get_config" - ) - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_static_route.load_config" - ) - - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestVyosStaticRouteModule, self).tearDown() - - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, filename=None): - self.get_config.return_value = "" - self.load_config.return_value = dict(diff=None, session="session") - - def test_vyos_static_route_present(self): - set_module_args( - dict( - prefix="172.26.0.0/16", - next_hop="172.26.4.1", - admin_distance="1", - ) - ) - result = self.execute_module(changed=True) - self.assertEqual( - result["commands"], - [ - "set protocols static route 172.26.0.0/16 next-hop 172.26.4.1 distance 1" - ], - ) |