diff options
author | Ansible Core Team <info@ansible.com> | 2020-03-09 09:40:34 +0000 |
---|---|---|
committer | Ansible Core Team <info@ansible.com> | 2020-03-09 09:40:34 +0000 |
commit | aee8e4f5ff0cf2dcc25a2a72f446add6367bf539 (patch) | |
tree | 05b8e114e103d4850b3222e7a1057ee8085b8afa /test | |
parent | 8997d84cff996a2b3723e22ec9bd5e412529b609 (diff) | |
download | ansible-aee8e4f5ff0cf2dcc25a2a72f446add6367bf539.tar.gz |
Migrated to arista.eos
Diffstat (limited to 'test')
379 files changed, 0 insertions, 16166 deletions
diff --git a/test/integration/targets/eos_acl_interfaces/defaults/main.yaml b/test/integration/targets/eos_acl_interfaces/defaults/main.yaml deleted file mode 100644 index ba02c507ee..0000000000 --- a/test/integration/targets/eos_acl_interfaces/defaults/main.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# testcase: "[^_].*" -# eos_acl_interfaces will not run on vEOS -testcase: "" -test_items: [] diff --git a/test/integration/targets/eos_acl_interfaces/meta/main.yaml b/test/integration/targets/eos_acl_interfaces/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_acl_interfaces/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_acl_interfaces/tasks/cli.yaml b/test/integration/targets/eos_acl_interfaces/tasks/cli.yaml deleted file mode 100644 index 5b16f46bde..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_acl_interfaces/tasks/eapi.yaml b/test/integration/targets/eos_acl_interfaces/tasks/eapi.yaml deleted file mode 100644 index 1109c6bf6a..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tasks/eapi.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_acl_interfaces/tasks/main.yaml b/test/integration/targets/eos_acl_interfaces/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/_parsed.cfg b/test/integration/targets/eos_acl_interfaces/tests/cli/_parsed.cfg deleted file mode 100644 index 59e767e969..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/_parsed.cfg +++ /dev/null @@ -1,6 +0,0 @@ -interface GigabitEthernet0/0 -ip access-group aclv401 in -ip access-group aclv402 out -ipv6 traffic-filter aclv601 out -interface GigabitEthernet0/1 -ipv6 traffic-filter aclv601 in diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/_populate.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/_populate.yaml deleted file mode 100644 index 8200bb730c..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/_populate.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Setup - eos_acl_interfaces: - config: - - name: "{{ Interfaces['int1'] }}" - access_groups: - - afi: ipv4 - acls: - - name: aclv401 - direction: in - - name: aclv402 - direction: out - - afi: ipv6 - acls: - - name: aclv601 - direction: out - - name: "{{ Interfaces['int2'] }}" - access_groups: - - afi: ipv6 - acls: - - name: aclv601 - direction: in - state: merged - become: yes diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 903bde3796..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Setup - eos_acl_interfaces: - config: - - name: "{{ Interfaces['int1'] }}" - - name: "{{ Interfaces['int2'] }}" - state: deleted - become: yes diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index d5814649cd..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,57 +0,0 @@ ---- -- debug: - msg: "Start eos_acl_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - - name: Delete attributes of given acl_interfaces of an afi. - eos_acl_interfaces: - config: - - name: "{{ Interfaces['int1'] }}" - access_groups: - - afi: ipv6 - state: deleted - register: result - - - assert: - that: - - "result.commands|length == 2" - - "result.changed == true" - - "'no ipv6 traffic-filter aclv601 out' in result.commands" - - - name: Delete attributes of given acl_interfaces configuration. - eos_acl_interfaces: - config: - - name: "{{ Interfaces['int1'] }}" - access_groups: - - afi: ipv4 - acls: - - name: aclv401 - direction: in - state: deleted - register: result - - - assert: - that: - - "result.commands|length == 2" - - "result.changed == true" - - "'no ip access-group aclv401 in' in result.commands" - - - - name: Delete attributes of given acl_interfaces of an interface. - eos_acl_interfaces: - config: - - name: "{{ Interfaces['int1'] }}" - state: deleted - register: result - - - assert: - that: - - "result.commands|length == 2" - - "result.changed == true" - - "'no ip access-group aclv402 out' in result.commands" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index e39c914cf1..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,57 +0,0 @@ -- debug: - msg: "START eos_acl_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - eos_acl_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - eos_acl_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - eos_acl_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden' - -- name: Rendered with empty config should give appropriate error message - eos_acl_interfaces: - config: - state: rendered - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state rendered' - -- name: Parsed with empty config should give appropriate error message - eos_acl_interfaces: - running_config: - state: parsed - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of running_config parameter must not be empty for state parsed' diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/gathered.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/gathered.yaml deleted file mode 100644 index 4d977b9094..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/gathered.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- debug: - msg: "START eos_acl_interfaces gathered integration tests on connection={{ ansible_connection }}" - - -- include_tasks: _populate.yaml - -- block: - - name: Gathered the provided configuration with the exisiting running configuration - eos_acl_interfaces: &gathered - config: - state: gathered - become: yes - register: result - - - name: Assert - assert: - that: - - "gathered['config'] | symmetric_difference(result.gathered) == []" - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 80beba69b9..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: - msg: "Start eos_acl_interfaces merged integration tests ansible_connection={{ ansible_connection }}" - - -- block: - - - name: merge given acl interfaces configuration - eos_acl_interfaces: &merged - config: - - name: "{{ Interfaces['int1'] }}" - access_groups: - - afi: ipv4 - acls: - - name: aclv401 - direction: in - - name: aclv402 - direction: out - - afi: ipv6 - acls: - - name: aclv601 - direction: out - - name: "{{ Interfaces['int2'] }}" - access_groups: - - afi: ipv6 - acls: - - name: aclv601 - direction: in - state: merged - become: yes - register: result - - - assert: - that: - - "result.commands|length == 6" - - "result.changed == true" - - "result.commands|symmetric_difference(merged.commands) == []" - - - name: Idempotency check - eos_acl_interfaces: *merged - become: yes - register: result - - - assert: - that: - - "result.commands|length == 0" - - "result.changed == false" - - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 483f04d813..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: - msg: "Start eos_acl_interfaces overridden integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - - name: override given acl interfaces configuration - eos_acl_interfaces: &overridden - config: - - name: "{{ Interfaces['int2'] }}" - access_groups: - - afi: ipv4 - acls: - - name: aclv401 - direction: in - state: overridden - become: yes - register: result - - - assert: - that: - - "result.commands|length == 7" - - "result.changed == true" - - "result.commands|symmetric_difference(overridden.commands) == []" - - - name: Idempotency check - eos_acl_interfaces: *overridden - become: yes - register: result - - - assert: - that: - - "result.commands|length == 0" - - "result.changed == false" - - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/parsed.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/parsed.yaml deleted file mode 100644 index 7f8cd6cd92..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/parsed.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- debug: - msg: "START eos_acl_interfaces parsed integration tests on connection={{ ansible_connection }}" - -- name: Provide the running configuration for parsing (config to be parsed) - eos_acl_interfaces: &parsed - running_config: - "{{ lookup('file', '_parsed.cfg') }}" - state: parsed - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "parsed['config']|symmetric_difference(result.parsed) == []" diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/rendered.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/rendered.yaml deleted file mode 100644 index a6d15cc4b9..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/rendered.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "Start eos_acl_interfaces rendered integration tests ansible_connection={{ ansible_connection }}" - - -- block: - - - name: render given acl interfaces configuration - eos_acl_interfaces: - config: - - name: "{{ Interfaces['int1'] }}" - access_groups: - - afi: ipv4 - acls: - - name: aclv401 - direction: in - - name: aclv402 - direction: out - - afi: ipv6 - acls: - - name: aclv601 - direction: out - - name: "{{ Interfaces['int2'] }}" - access_groups: - - afi: ipv6 - acls: - - name: aclv601 - direction: in - state: rendered - become: yes - register: result - - - assert: - that: - - "result.changed == false" - - "result.rendered|symmetric_difference(merged.commands) == []" diff --git a/test/integration/targets/eos_acl_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_acl_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index 310581fc10..0000000000 --- a/test/integration/targets/eos_acl_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: - msg: "Start eos_acl_interfaces replced integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- block: - - - name: replace given acl interfaces configuration - eos_acl_interfaces: &replaced - config: - - name: "{{ Interfaces['int2'] }}" - access_groups: - - afi: ipv4 - acls: - - name: aclv401 - direction: in - state: replaced - become: yes - register: result - - - assert: - that: - - "result.commands|length == 3" - - "result.changed == true" - - "result.commands|symmetric_difference(replaced.commands) == []" - - - name: Idempotency check - eos_acl_interfaces: *replaced - become: yes - register: result - - - assert: - that: - - "result.commands|length == 0" - - "result.changed == false" - - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acl_interfaces/vars/main.yaml b/test/integration/targets/eos_acl_interfaces/vars/main.yaml deleted file mode 100644 index f5fcd72a14..0000000000 --- a/test/integration/targets/eos_acl_interfaces/vars/main.yaml +++ /dev/null @@ -1,83 +0,0 @@ -Interfaces: - int1: - GigabitEthernet0/0 - int2: - GigabitEthernet0/1 - -deleted1: - commands: - - interface GigabitEthernet0/0 - - no ip access-group aclv401 in - - no ip access-group aclv402 out - - no ipv6 traffic-filter aclv601 out - -merged: - commands: - - interface GigabitEthernet0/0 - - ip access-group aclv401 in - - ip access-group aclv402 out - - ipv6 traffic-filter aclv601 out - - interface GigabitEthernet0/1 - - ipv6 traffic-filter aclv601 in - -replaced: - commands: - - interface GigabitEthernet0/1 - - no ipv6 traffic-filter aclv601 in - - ip access-group aclv401 in - -overridden: - commands: - - interface GigabitEthernet0/0 - - no ip access-group aclv401 in - - no ip access-group aclv402 out - - no ipv6 traffic-filter aclv601 out - - interface GigabitEthernet0/1 - - no ipv6 traffic-filter aclv601 in - - ip access-group aclv401 in - -# Interface names will changed based on the platform used. Following configs are wrt ios. -gathered: - config: - - name: Loopback888 - - access_groups: - - acls: - - direction: in - name: aclv401 - - direction: out - name: aclv402 - afi: ipv4 - - acls: - - direction: out - name: aclv601 - afi: ipv6 - name: GigabitEthernet0/0 - - access_groups: - - acls: - - direction: in - name: aclv601 - afi: ipv6 - name: GigabitEthernet0/1 - - name: GigabitEthernet0/2 - - name: GigabitEthernet0/3 - -parsed: - config: - - access_groups: - - acls: - - direction: in - name: aclv401 - - direction: out - name: aclv402 - afi: ipv4 - - acls: - - direction: out - name: aclv601 - afi: ipv6 - name: GigabitEthernet0/0 - - access_groups: - - acls: - - direction: in - name: aclv601 - afi: ipv6 - name: GigabitEthernet0/1 diff --git a/test/integration/targets/eos_acls/defaults/main.yaml b/test/integration/targets/eos_acls/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/eos_acls/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/eos_acls/meta/main.yaml b/test/integration/targets/eos_acls/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_acls/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_acls/tasks/cli.yaml b/test/integration/targets/eos_acls/tasks/cli.yaml deleted file mode 100644 index 66941b1f49..0000000000 --- a/test/integration/targets/eos_acls/tasks/cli.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/common" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_acls/tasks/eapi.yaml b/test/integration/targets/eos_acls/tasks/eapi.yaml deleted file mode 100644 index cb5f04d80c..0000000000 --- a/test/integration/targets/eos_acls/tasks/eapi.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/common" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_acls/tasks/main.yaml b/test/integration/targets/eos_acls/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_acls/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_acls/tests/common/_parsed.cfg b/test/integration/targets/eos_acls/tests/common/_parsed.cfg deleted file mode 100644 index 11758ce538..0000000000 --- a/test/integration/targets/eos_acls/tests/common/_parsed.cfg +++ /dev/null @@ -1,4 +0,0 @@ -ip access-list test1 -35 deny tcp 20.0.0.0/8 any log -45 remark Run by ansible -55 permit tcp any any diff --git a/test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml b/test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml deleted file mode 100644 index 5a655ce534..0000000000 --- a/test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Setup - cli_config: - config: "{{ lines }}" - become: yes - vars: - lines: | - ip access-list test1 - 35 deny tcp 20.0.0.0/8 any log - 45 remark Run by ansible - 55 permit tcp any any diff --git a/test/integration/targets/eos_acls/tests/common/_populate.yaml b/test/integration/targets/eos_acls/tests/common/_populate.yaml deleted file mode 100644 index 07ed5b9673..0000000000 --- a/test/integration/targets/eos_acls/tests/common/_populate.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- name: Setup - eos_acls: &merged - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - - grant: "permit" - protocol: "6" - source: - any: true - destination: - any: true - - name: test4 - aces: - - grant: "permit" - source: - any: true - port_protocol: - eq: "25" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - log: "true" - source: - any: true - state: merged - become: yes - register: result diff --git a/test/integration/targets/eos_acls/tests/common/_remove_config.yaml b/test/integration/targets/eos_acls/tests/common/_remove_config.yaml deleted file mode 100644 index a8a351d80b..0000000000 --- a/test/integration/targets/eos_acls/tests/common/_remove_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Setup - eos_acls: - config: - - afi: "ipv4" - - afi: "ipv6" - state: deleted - become: yes diff --git a/test/integration/targets/eos_acls/tests/common/deleted.yaml b/test/integration/targets/eos_acls/tests/common/deleted.yaml deleted file mode 100644 index 750e214d49..0000000000 --- a/test/integration/targets/eos_acls/tests/common/deleted.yaml +++ /dev/null @@ -1,168 +0,0 @@ ---- -- debug: - msg: "Start eos_acls deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config1: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 55 - grant: "permit" - protocol: "tcp" - source: - any: true - destination: - any: true - - remark: "Run by ansible" - sequence: 45 - - name: test4 - aces: - - grant: "permit" - sequence: 10 - source: - any: true - port_protocol: - eq: "smtp" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - sequence: 10 - log: "true" - source: - any: true - -- set_fact: - config2: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - sequence: 45 - - name: test4 - aces: - - grant: "permit" - sequence: 10 - source: - any: true - port_protocol: - eq: "smtp" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" -- set_fact: - config3: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - sequence: 45 - -- block: - - name: Delete attributes of given acls. - eos_acls: - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - state: deleted - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.commands|length == 2" - - "result.changed == true" - - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == [] " - become: yes - - - name: Delete afi of given acls. - eos_acls: - config: - - afi: "ipv6" - state: deleted - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.commands|length == 1" - - "result.changed == true" - - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == [] " - become: yes - - - name: Delete attributes of given named acl. - eos_acls: - config: - - afi: "ipv4" - acls: - - name: test4 - state: deleted - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.commands|length == 1" - - "result.changed == true" - - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == [] " - become: yes - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/tests/common/gathered.yaml b/test/integration/targets/eos_acls/tests/common/gathered.yaml deleted file mode 100644 index 0baedb13af..0000000000 --- a/test/integration/targets/eos_acls/tests/common/gathered.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: - msg: "START eos_acls gathered integration tests on connection={{ ansible_connection }}" - - -- include_tasks: _populate.yaml - -- block: - - name: Gathered the provided configuration with the exisiting running configuration - eos_acls: &gathered - config: - state: gathered - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - name: Assert - assert: - that: - - "ansible_facts.network_resources.acls | symmetric_difference(result.gathered) == []" - - - - name: Gather the existing running configuration (IDEMPOTENT) - eos_acls: *gathered - become: yes - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/tests/common/merged.yaml b/test/integration/targets/eos_acls/tests/common/merged.yaml deleted file mode 100644 index 9bfd233805..0000000000 --- a/test/integration/targets/eos_acls/tests/common/merged.yaml +++ /dev/null @@ -1,152 +0,0 @@ ---- -- debug: - msg: "Start eos_acls merged integration tests ansible_connection={{ ansible_connection }}" - - -- set_fact: - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - sequence: 45 - - grant: "permit" - sequence: 55 - protocol: "tcp" - source: - any: true - destination: - any: true - - name: test4 - aces: - - grant: "permit" - sequence: 10 - source: - any: true - port_protocol: - eq: "smtp" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - sequence: 10 - log: "true" - source: - any: true - -- block: - - name: merge attributes of given acls. - eos_acls: &merged - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - - grant: "permit" - protocol: "6" - source: - any: true - destination: - any: true - - name: test4 - aces: - - grant: "permit" - source: - any: true - port_protocol: - eq: "25" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - log: "true" - source: - any: true - state: merged - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.commands|length == 8" - - "result.changed == true" - become: yes - - - name: Idempotency check - eos_acls: *merged - become: yes - register: result - - - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - "ansible_facts.network_resources.acls|symmetric_difference(result.before) == []" - - - name: merge attributes with an existing ace - eos_acls: - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - log: true - ttl: - eq: 33 - source: - any: true - state: merged - become: yes - register: result - - - assert: - that: - - "result.changed == true" - - "result.commands|length == 3" - - "'no 35' in result.commands" - - "'35 deny tcp any any ttl eq 33 log' in result.commands" - - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/tests/common/overridden.yaml b/test/integration/targets/eos_acls/tests/common/overridden.yaml deleted file mode 100644 index 4c8e51998e..0000000000 --- a/test/integration/targets/eos_acls/tests/common/overridden.yaml +++ /dev/null @@ -1,71 +0,0 @@ ---- -- debug: - msg: "Start eos_acls merged integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 10 - grant: "permit" - protocol: "ospf" - source: - any: true - destination: - any: true - log: true - -- block: - - name: overriden attributes with given acls. - eos_acls: &overridden - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - grant: "permit" - sequence: 10 - protocol: "ospf" - source: - any: true - destination: - any: true - log: true - state: overridden - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.commands|length == 8" - - "result.changed == true" - - "'ip access-list test1' in result.commands" - - "'10 permit ospf any any log' in result.commands" - - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == []" - become: yes - - - name: Idempotency check - eos_acls: *overridden - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - "ansible_facts.network_resources.acls|symmetric_difference(result.before) == []" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/tests/common/parsed.yaml b/test/integration/targets/eos_acls/tests/common/parsed.yaml deleted file mode 100644 index ffadce84ed..0000000000 --- a/test/integration/targets/eos_acls/tests/common/parsed.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- debug: - msg: "START eos_acls parsed integration tests on connection={{ ansible_connection }}" - -- include_tasks: _parsed_cfg.yaml - -- name: Gather acls facts - eos_facts: - gather_subset: - - default - gather_network_resources: - - acls - become: yes - register: acls_facts - -- name: Provide the running configuration for parsing (config to be parsed) - eos_acls: &parsed - running_config: - "{{ lookup('file', '_parsed.cfg') }}" - state: parsed - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "ansible_facts.network_resources.acls|symmetric_difference(result.parsed) == []" - -- include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/tests/common/rendered.yaml b/test/integration/targets/eos_acls/tests/common/rendered.yaml deleted file mode 100644 index f447c52ac0..0000000000 --- a/test/integration/targets/eos_acls/tests/common/rendered.yaml +++ /dev/null @@ -1,80 +0,0 @@ ---- -- debug: - msg: "START eos_acls rendered integration tests on connection={{ ansible_connection }}" - - -- block: - - name: Structure provided configuration into device specific commands - eos_acls: &rendered - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - - grant: "permit" - protocol: "6" - source: - any: true - destination: - any: true - - name: test4 - aces: - - grant: "permit" - source: - any: true - port_protocol: - eq: "25" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - log: "true" - source: - any: true - state: rendered - become: yes - register: result - - - - name: Assert that correct set of commands were generated - vars: - lines: - - ip access-list test1 - - 35 deny tcp 20.0.0.0/8 any log - - remark Run by ansible - - permit tcp any any - - ip access-list test4 - - permit tcp any eq smtp any eq www ttl eq 55 - - ipv6 access-list standard test2 - - permit any log - - assert: - that: - - "{{ lines | symmetric_difference(result['rendered']) |length == 0 }}" - - - name: Structure provided configuration into device specific commands (IDEMPOTENT) - eos_acls: *rendered - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" diff --git a/test/integration/targets/eos_acls/tests/common/replaced.yaml b/test/integration/targets/eos_acls/tests/common/replaced.yaml deleted file mode 100644 index 068e177ef5..0000000000 --- a/test/integration/targets/eos_acls/tests/common/replaced.yaml +++ /dev/null @@ -1,94 +0,0 @@ ---- -- debug: - msg: "Start eos_acls replaced integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 10 - grant: "permit" - protocol: "ospf" - source: - any: true - destination: - any: true - log: true - - name: test4 - aces: - - grant: "permit" - sequence: 10 - source: - any: true - port_protocol: - eq: "smtp" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - sequence: 10 - log: "true" - source: - any: true - -- block: - - name: replace attributes with given acls. - eos_acls: &replaced - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - grant: "permit" - sequence: 10 - protocol: "ospf" - source: - any: true - destination: - any: true - log: true - state: replaced - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.commands|length == 5" - - "result.changed == true" - - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == []" - become: yes - - - name: Idempotency check - eos_acls: *replaced - become: yes - register: result - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - "ansible_facts.network_resources.acls|symmetric_difference(result.before) == []" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/tests/common/rtt.yaml b/test/integration/targets/eos_acls/tests/common/rtt.yaml deleted file mode 100644 index 4b78a8e782..0000000000 --- a/test/integration/targets/eos_acls/tests/common/rtt.yaml +++ /dev/null @@ -1,101 +0,0 @@ ---- -- debug: - msg: "Start eos_acls round trip integration tests ansible_connection={{ ansible_connection }}" - - -- block: - - name: merge attributes of given acls(apply base config). - eos_acls: &merged - config: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - - grant: "permit" - protocol: "6" - source: - any: true - destination: - any: true - - name: test4 - aces: - - grant: "permit" - source: - any: true - port_protocol: - eq: "25" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - log: "true" - source: - any: true - state: merged - become: yes - register: base_config - - - eos_facts: - gather_network_resources: acls - become: yes - - - assert: - that: - - "base_config.commands|length == 8" - - "base_config.changed == true" - - "ansible_facts.network_resources.acls|symmetric_difference(base_config.after) == []" - - - name: Apply the provided configuration (config to be reverted) - eos_acls: - config: - - afi: "ipv4" - acls: - - name: test3 - aces: - - sequence: 100 - grant: "permit" - protocol: "icmp" - source: - any: true - destination: - any: true - log: true - become: yes - register: result - - - name: Assert that changes were applied - assert: - that: - - "{{ round_trip['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - eos_acls: - config: "{{ ansible_facts['network_resources']['acls'] }}" - state: overridden - become: yes - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_acls/vars/main.yaml b/test/integration/targets/eos_acls/vars/main.yaml deleted file mode 100644 index 3efbfb76fa..0000000000 --- a/test/integration/targets/eos_acls/vars/main.yaml +++ /dev/null @@ -1,110 +0,0 @@ -round_trip: - after: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - sequence: 45 - - grant: "permit" - sequence: 55 - protocol: "tcp" - source: - any: true - destination: - any: true - - name: test3 - aces: - - sequence: 100 - grant: "permit" - protocol: "icmp" - source: - any: true - destination: - any: true - log: true - - name: test4 - aces: - - grant: "permit" - sequence: 10 - source: - any: true - port_protocol: - eq: "smtp" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - sequence: 10 - log: true - source: - any: true - - commands: - - "ip access-list test3" - - "100 permit icmp any any log" - -base_config: - after: - - afi: "ipv4" - acls: - - name: test1 - aces: - - sequence: 35 - grant: "deny" - protocol: "tcp" - source: - subnet_address: 20.0.0.0/8 - destination: - any: true - log: true - - remark: "Run by ansible" - sequence: 45 - - grant: "permit" - sequence: 55 - protocol: "tcp" - source: - any: true - destination: - any: true - - name: test4 - aces: - - grant: "permit" - sequence: 10 - source: - any: true - port_protocol: - eq: "smtp" - destination: - any: true - port_protocol: - eq: "www" - protocol: "tcp" - ttl: - eq: "55" - - afi: "ipv6" - acls: - - name: test2 - standard: true - aces: - - grant: "permit" - log: "true" - source: - any: true diff --git a/test/integration/targets/eos_banner/defaults/main.yaml b/test/integration/targets/eos_banner/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_banner/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_banner/meta/main.yml b/test/integration/targets/eos_banner/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_banner/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_banner/tasks/cli.yaml b/test/integration/targets/eos_banner/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_banner/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_banner/tasks/eapi.yaml b/test/integration/targets/eos_banner/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_banner/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_banner/tasks/main.yaml b/test/integration/targets/eos_banner/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_banner/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_banner/tests/cli/basic-login.yaml b/test/integration/targets/eos_banner/tests/cli/basic-login.yaml deleted file mode 100644 index b82566a1ac..0000000000 --- a/test/integration/targets/eos_banner/tests/cli/basic-login.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- debug: msg="START cli/basic-login.yaml on connection={{ ansible_connection }}" - -- name: Remove previous login banner - eos_config: - lines: no banner login - become: yes - -- name: Create login banner - eos_banner: &multiline - banner: login - text: | - Junk login banner - over multiple lines - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'banner login' in result.commands[0]" # does this break due to "contains?" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create login banner again (idempotent) - eos_banner: *multiline - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Remove login - eos_banner: &remove - banner: login - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no banner login' in result.commands" # does this break due to "contains?" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove login again (idempotent) - eos_banner: *remove - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml b/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml deleted file mode 100644 index 7c8319a7f5..0000000000 --- a/test/integration/targets/eos_banner/tests/cli/basic-motd.yaml +++ /dev/null @@ -1,84 +0,0 @@ ---- -- debug: msg="START cli/basic-motd.yaml on connection={{ ansible_connection }}" - -- name: Remove previous motd banner - eos_config: - lines: no banner motd - become: yes - -- name: Set motd - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'this is my motd banner' in result.commands" - - "'that has a multiline' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Set motd again (idempotent) - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Remove motd - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no banner motd' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove motd again (idempotent) - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_banner/tests/cli/net_banner.yaml b/test/integration/targets/eos_banner/tests/cli/net_banner.yaml deleted file mode 100644 index cc19483fa1..0000000000 --- a/test/integration/targets/eos_banner/tests/cli/net_banner.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eos cli/net_banner.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Remove previous motd banner (setup) - eos_config: - lines: no banner motd - become: yes - -- name: create motd - net_banner: - banner: motd - text: this is my motd banner configure by net_banner - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'this is my motd banner configure by net_banner' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove previous motd banner (teardown) - eos_config: - lines: no banner motd - become: yes - -- debug: msg="END eos cli/net_banner.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml b/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml deleted file mode 100644 index 4ed7dad39a..0000000000 --- a/test/integration/targets/eos_banner/tests/eapi/basic-login.yaml +++ /dev/null @@ -1,71 +0,0 @@ ---- -- debug: msg="START eapi/basic-login.yaml on connection={{ ansible_connection }}" - -- name: Remove previous login banner - eos_config: - lines: no banner login - become: yes - -- name: Create login banner - eos_banner: &multiline - banner: login - text: | - this is my login banner - that has a multiline - string - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'banner login' in result.commands[0]" # does this break due to "contains?" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create login banner again (idempotent) - eos_banner: *multiline - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Remove login - eos_banner: &remove - banner: login - text: | - this is my login banner - that has a multiline - string - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no banner login' in result.commands" # does this break due to "contains?" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove login again (idempotent) - eos_banner: *remove - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml b/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml deleted file mode 100644 index 9e91398b05..0000000000 --- a/test/integration/targets/eos_banner/tests/eapi/basic-motd.yaml +++ /dev/null @@ -1,84 +0,0 @@ ---- -- debug: msg="START eapi/basic-motd.yaml on connection={{ ansible_connection }}" - -- name: Remove previous motd banner - eos_config: - lines: no banner motd - become: yes - -- name: Set motd - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'this is my motd banner' in result.commands" - - "'that has a multiline' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Set motd again (idempotent) - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Remove motd - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no banner motd' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove motd again (idempotent) - eos_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml b/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml deleted file mode 100644 index 07b304fd5c..0000000000 --- a/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eos eapi/net_banner.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Remove previous motd banner (setup) - eos_config: - lines: no banner motd - become: yes - -- name: create motd - net_banner: - banner: motd - text: this is my motd banner configure by net_banner - state: present - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'this is my motd banner configure by net_banner' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove previous motd banner (teardown) - eos_config: - lines: no banner motd - become: yes - -- debug: msg="END eos eapi/net_banner.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_bgp/defaults/main.yaml b/test/integration/targets/eos_bgp/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_bgp/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_bgp/meta/main.yaml b/test/integration/targets/eos_bgp/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_bgp/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_bgp/tasks/cli.yaml b/test/integration/targets/eos_bgp/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_bgp/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_bgp/tasks/main.yaml b/test/integration/targets/eos_bgp/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/eos_bgp/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_bgp/tests/cli/basic.yaml b/test/integration/targets/eos_bgp/tests/cli/basic.yaml deleted file mode 100644 index 5e235f5f9b..0000000000 --- a/test/integration/targets/eos_bgp/tests/cli/basic.yaml +++ /dev/null @@ -1,395 +0,0 @@ -- debug: msg="START eos cli/eos_bgp.yaml on connection={{ ansible_connection }}" - -- name: Clear existing BGP config - eos_bgp: &rm - operation: delete - become: yes - ignore_errors: yes - -- name: Configure BGP with AS 64496 and a router-id - eos_bgp: &config - operation: merge - config: - bgp_as: 64496 - router_id: 192.0.2.2 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'router-id 192.0.2.2' in result.commands" - -- name: Configure BGP with AS 64496 and a router-id (idempotent) - eos_bgp: *config - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure BGP neighbors - eos_bgp: &nbr - operation: merge - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.10 - remote_as: 64496 - description: IBGP_NBR_1 - ebgp_multihop: 100 - timers: - keepalive: 300 - holdtime: 360 - - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'neighbor 192.0.2.10 remote-as 64496' in result.commands" - - "'neighbor 192.0.2.10 description IBGP_NBR_1' in result.commands" - - "'neighbor 192.0.2.10 ebgp-multihop 100' in result.commands" - - "'neighbor 192.0.2.10 timers 300 360' in result.commands" - - "'neighbor 192.0.2.15 remote-as 64496' in result.commands" - - "'neighbor 192.0.2.15 description IBGP_NBR_2' in result.commands" - - "'neighbor 192.0.2.15 ebgp-multihop 150' in result.commands" - -- name: Configure BGP neighbors (idempotent) - eos_bgp: *nbr - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure BGP neighbors with operation replace - eos_bgp: &nbr_rplc - operation: replace - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - ebgp_multihop: 150 - - - neighbor: 203.0.113.10 - remote_as: 64511 - description: EBGP_NBR_1 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'neighbor 203.0.113.10 remote-as 64511' in result.commands" - - "'neighbor 203.0.113.10 description EBGP_NBR_1' in result.commands" - - "'no neighbor 192.0.2.10' in result.commands" - -- name: Configure BGP neighbors with operation replace (idempotent) - eos_bgp: *nbr_rplc - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure root-level networks for BGP - eos_bgp: &net - operation: merge - config: - bgp_as: 64496 - networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - - prefix: 203.0.113.32 - masklen: 27 - route_map: RMAP_2 - become: yes - register: result - -- assert: - that: - - 'result.changed == True' - - "'router bgp 64496' in result.commands" - - "'network 203.0.113.0/27 route-map RMAP_1' in result.commands" - - "'network 203.0.113.32/27 route-map RMAP_2' in result.commands" - -- name: Configure root-level networks for BGP (idempotent) - eos_bgp: *net - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure root-level networks for BGP with operation replace - eos_bgp: &net_rplc - operation: replace - config: - bgp_as: 64496 - networks: - - prefix: 203.0.113.0 - masklen: 27 - route_map: RMAP_1 - - - prefix: 198.51.100.16 - masklen: 28 - become: yes - register: result - -- assert: - that: - - 'result.changed == True' - - "'router bgp 64496' in result.commands" - - "'network 198.51.100.16/28' in result.commands" - - "'no network 203.0.113.32/27' in result.commands" - -- name: Configure root-level networks for BGP with operation replace (idempotent) - eos_bgp: *net_rplc - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure BGP route redistribute information - eos_bgp: &rdr - operation: merge - config: - bgp_as: 64496 - redistribute: - - protocol: ospf - route_map: RMAP_1 - - - protocol: rip - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'redistribute ospf route-map RMAP_1' in result.commands" - - "'redistribute rip' in result.commands" - -- name: Configure BGP route redistribute information (idempotent) - eos_bgp: *rdr - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure BGP route redistribute information with operation replace - eos_bgp: &rdr_rplc - operation: replace - config: - bgp_as: 64496 - redistribute: - - protocol: ospf - route_map: RMAP_1 - - - protocol: static - route_map: RMAP_2 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'redistribute static route-map RMAP_2' in result.commands" - - "'no redistribute rip' in result.commands" - -- name: Configure BGP route redistribute information with operation replace (idempotent) - eos_bgp: *rdr_rplc - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure BGP neighbors under address family mode - eos_bgp: &af_nbr - operation: merge - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - neighbors: - - neighbor: 203.0.113.10 - activate: yes - default_originate: True - - - neighbor: 192.0.2.15 - activate: yes - graceful_restart: True - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'address-family ipv4' in result.commands" - - "'neighbor 203.0.113.10 activate' in result.commands" - - "'neighbor 203.0.113.10 default-originate' in result.commands" - - "'neighbor 192.0.2.15 activate' in result.commands" - - "'neighbor 192.0.2.15 graceful-restart' in result.commands" - -- name: Configure BGP neighbors under address family mode (idempotent) - eos_bgp: *af_nbr - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure networks under address family - eos_bgp: &af_net - operation: merge - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - networks: - - prefix: 198.51.100.48 - masklen: 28 - route_map: RMAP_1 - - - prefix: 192.0.2.64 - masklen: 27 - - - prefix: 203.0.113.160 - masklen: 27 - route_map: RMAP_2 - - - afi: ipv6 - networks: - - prefix: "2001:db8::" - masklen: 33 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'address-family ipv4' in result.commands" - - "'network 198.51.100.48/28 route-map RMAP_1' in result.commands" - - "'network 192.0.2.64/27' in result.commands" - - "'network 203.0.113.160/27 route-map RMAP_2' in result.commands" - - "'address-family ipv6' in result.commands" - - "'network 2001:db8::/33' in result.commands" - -- name: Configure networks under address family (idempotent) - eos_bgp: *af_net - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Configure networks under address family with operation replace - eos_bgp: &af_net_rplc - operation: replace - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - networks: - - prefix: 198.51.100.80 - masklen: 28 - - - prefix: 192.0.2.64 - masklen: 27 - - - prefix: 203.0.113.192 - masklen: 27 - - - afi: ipv6 - networks: - - prefix: "2001:db8:1000::" - masklen: 37 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"router bgp 64496" in result.commands' - - '"address-family ipv4" in result.commands' - - '"network 198.51.100.80/28" in result.commands' - - '"network 203.0.113.192/27" in result.commands' - - '"no network 198.51.100.48/28" in result.commands' - - '"no network 203.0.113.160/27" in result.commands' - - '"address-family ipv6" in result.commands' - - '"network 2001:db8:1000::/37" in result.commands' - - '"no network 2001:db8::/33" in result.commands' - -- name: Configure networks under address family with operation replace (idempotent) - eos_bgp: *af_net_rplc - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Override all the exisiting BGP config - eos_bgp: - operation: override - config: - bgp_as: 64497 - router_id: 192.0.2.10 - log_neighbor_changes: True - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'no router bgp 64496' in result.commands" - - "'router bgp 64497' in result.commands" - - "'router-id 192.0.2.10' in result.commands" - - "'bgp log-neighbor-changes' in result.commands" - -- name: Teardown - eos_bgp: *rm - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - "'no router bgp 64497' in result.commands" - -- name: Teardown again (idempotent) - eos_bgp: *rm - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END eos cli/eos_bgp.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/defaults/main.yaml b/test/integration/targets/eos_command/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_command/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_command/meta/main.yml b/test/integration/targets/eos_command/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_command/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_command/tasks/cli.yaml b/test/integration/targets/eos_command/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_command/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_command/tasks/eapi.yaml b/test/integration/targets/eos_command/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_command/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_command/tasks/main.yaml b/test/integration/targets/eos_command/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_command/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml b/test/integration/targets/eos_command/tests/cli/bad_operator.yaml deleted file mode 100644 index 08b00e1384..0000000000 --- a/test/integration/targets/eos_command/tests/cli/bad_operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START cli/bad_operator.yaml on connection={{ ansible_connection }}" - -- name: test bad operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name foo Management" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/cli_command.yaml b/test/integration/targets/eos_command/tests/cli/cli_command.yaml deleted file mode 100644 index bff29a6075..0000000000 --- a/test/integration/targets/eos_command/tests/cli/cli_command.yaml +++ /dev/null @@ -1,63 +0,0 @@ ---- -- debug: - msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}" - -- block: - - name: get output for single command - cli_command: - command: show version - register: result - - - assert: - that: - - "result.changed == false" - - "result.stdout is defined" - - - name: send invalid command - cli_command: - command: 'show foo' - register: result - ignore_errors: yes - - - assert: - that: - - "result.failed == true" - - "result.msg is defined" - - - name: get output in JSON format - cli_command: - command: show version | json - register: result - - - assert: - that: - - "result.changed == false" - - "result.stdout is defined" - - "result.json is defined" - - - name: command that does require become (should fail) - cli_command: - command: show running-config - become: no - ignore_errors: yes - register: result - - - assert: - that: - - 'result.failed == true' - - '"privileged mode required" in result.msg' - when: "ansible_connection == 'network_cli'" - -- block: - - name: test failure for local connection - cli_command: - command: show version - register: result - - - assert: - that: - - 'result.failed == true' - - "'Connection type local is not valid for this module' in result.msg" - when: "ansible_connection == 'local'" - -- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/contains.yaml b/test/integration/targets/eos_command/tests/cli/contains.yaml deleted file mode 100644 index 3707407a73..0000000000 --- a/test/integration/targets/eos_command/tests/cli/contains.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}" - -- name: test contains operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[0] contains EOS" - - "result[1].interfaces.Management1.name contains Manage" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/equal.yaml b/test/integration/targets/eos_command/tests/cli/equal.yaml deleted file mode 100644 index c4ce57b756..0000000000 --- a/test/integration/targets/eos_command/tests/cli/equal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/equal.yaml on connection={{ ansible_connection }}" - -- name: test eq operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name eq Management1" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test == operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name == Management1" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/equal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml b/test/integration/targets/eos_command/tests/cli/greaterthan.yaml deleted file mode 100644 index cc7d6f9d0a..0000000000 --- a/test/integration/targets/eos_command/tests/cli/greaterthan.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/greaterthan.yaml on connection={{ ansible_connection }}" - -- name: test gt operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu gt 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test > operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu > 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/greaterthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml deleted file mode 100644 index 9f4f8184c3..0000000000 --- a/test/integration/targets/eos_command/tests/cli/greaterthanorequal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/greaterthanorequal.yaml on connection={{ ansible_connection }}" - -- name: test ge operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu ge 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test >= operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu >= 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/greaterthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/invalid.yaml b/test/integration/targets/eos_command/tests/cli/invalid.yaml deleted file mode 100644 index 6005570e32..0000000000 --- a/test/integration/targets/eos_command/tests/cli/invalid.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}" - -- name: run invalid command - eos_command: - commands: ['show foo'] - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- name: run commands that include invalid command - eos_command: - commands: - - show version - - show foo - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/lessthan.yaml b/test/integration/targets/eos_command/tests/cli/lessthan.yaml deleted file mode 100644 index 8881158601..0000000000 --- a/test/integration/targets/eos_command/tests/cli/lessthan.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/lessthan.yaml on connection={{ ansible_connection }}" - -- name: test lt operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu lt 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test < operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu < 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/lessthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml b/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml deleted file mode 100644 index eef5008d0d..0000000000 --- a/test/integration/targets/eos_command/tests/cli/lessthanorequal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/lessthanorequal.yaml on connection={{ ansible_connection }}" - -- name: test le operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu le 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test <= operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu <= 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/lessthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/notequal.yaml b/test/integration/targets/eos_command/tests/cli/notequal.yaml deleted file mode 100644 index 386ba3fbea..0000000000 --- a/test/integration/targets/eos_command/tests/cli/notequal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/notequal.yaml on connection={{ ansible_connection }}" - -- name: test neq operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name neq Ethernet" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test != operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name != Ethernet" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/notequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/output.yaml b/test/integration/targets/eos_command/tests/cli/output.yaml deleted file mode 100644 index ba217635c8..0000000000 --- a/test/integration/targets/eos_command/tests/cli/output.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- debug: msg="START cli/output.yaml on connection={{ ansible_connection }}" - -- name: get output for single command - eos_command: - commands: ['show version'] - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: get output for multiple commands - eos_command: - commands: - - show version - - show interfaces - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/cli/timeout.yaml b/test/integration/targets/eos_command/tests/cli/timeout.yaml deleted file mode 100644 index 0a90c7efef..0000000000 --- a/test/integration/targets/eos_command/tests/cli/timeout.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}" - -- name: test bad condition - eos_command: - commands: - - show version - wait_for: - - "result[0] contains bad_value_string" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml b/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml deleted file mode 100644 index 6398480b4c..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/bad_operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START eapi/bad_operator.yaml" - -- name: test bad operator - eos_command: - commands: - - show version - - show interfaces Management1 - wait_for: - - "result[1].interfaces.Management1.name foo Management" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END eapi/bad_operator.yaml" diff --git a/test/integration/targets/eos_command/tests/eapi/contains.yaml b/test/integration/targets/eos_command/tests/eapi/contains.yaml deleted file mode 100644 index a733228f20..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/contains.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START eapi/contains.yaml on connection={{ ansible_connection }}" - -- name: test contains operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[0] contains EOS" - - "result[1].interfaces.Management1.name contains Manage" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/equal.yaml b/test/integration/targets/eos_command/tests/eapi/equal.yaml deleted file mode 100644 index f5e35e1f88..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/equal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/equal.yaml on connection={{ ansible_connection }}" - -- name: test eq operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name eq Management1" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test == operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name == Management1" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/equal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml b/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml deleted file mode 100644 index 42d0ce14c2..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/greaterthan.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/greaterthan.yaml on connection={{ ansible_connection }}" - -- name: test gt operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu gt 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test > operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu > 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/greaterthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml b/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml deleted file mode 100644 index d012c0c240..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/greaterthanorequal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/greaterthanorequal.yaml on connection={{ ansible_connection }}" - -- name: test ge operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu ge 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test >= operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu >= 0" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/greaterthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/invalid.yaml b/test/integration/targets/eos_command/tests/eapi/invalid.yaml deleted file mode 100644 index 06958414c0..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/invalid.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- debug: msg="START eapi/invalid.yaml" - -- name: run invalid command - eos_command: - commands: ['show foo'] - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- name: run commands that include invalid command - eos_command: - commands: - - show version - - show foo - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END eapi/invalid.yaml" diff --git a/test/integration/targets/eos_command/tests/eapi/lessthan.yaml b/test/integration/targets/eos_command/tests/eapi/lessthan.yaml deleted file mode 100644 index 96ff71abaf..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/lessthan.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/lessthan.yaml on connection={{ ansible_connection }}" - -- name: test lt operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu lt 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test < operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu < 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/lessthan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml b/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml deleted file mode 100644 index 0c89c69dc7..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/lessthanorequal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/lessthanorequal.yaml on connection={{ ansible_connection }}" - -- name: test le operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu le 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test <= operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.mtu <= 1600" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/lessthanorequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/notequal.yaml b/test/integration/targets/eos_command/tests/eapi/notequal.yaml deleted file mode 100644 index fc0f5c98d8..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/notequal.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/notequal.yaml on connection={{ ansible_connection }}" - -- name: test neq operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name neq Ethernet" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: test != operator - eos_command: - commands: - - show version - - show interfaces Management1 | json - wait_for: - - "result[1].interfaces.Management1.name != Ethernet" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/notequal.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_command/tests/eapi/output.yaml b/test/integration/targets/eos_command/tests/eapi/output.yaml deleted file mode 100644 index 6c2239c7dc..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/output.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- debug: msg="START eapi/output.yaml" - -- name: get output for single command - eos_command: - commands: ['show version'] - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: get output for multiple commands - eos_command: - commands: - - show version - - show interfaces - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END eapi/output.yaml" diff --git a/test/integration/targets/eos_command/tests/eapi/timeout.yaml b/test/integration/targets/eos_command/tests/eapi/timeout.yaml deleted file mode 100644 index 58a0d39fbd..0000000000 --- a/test/integration/targets/eos_command/tests/eapi/timeout.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START eapi/timeout.yaml" - -- name: test bad condition - eos_command: - commands: - - show version - wait_for: - - "result[0].version foo 4.15" - retries: 1 - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END eapi/timeout.yaml" diff --git a/test/integration/targets/eos_config/config.txt b/test/integration/targets/eos_config/config.txt deleted file mode 100644 index fba5bde0e0..0000000000 --- a/test/integration/targets/eos_config/config.txt +++ /dev/null @@ -1,21 +0,0 @@ -! -! boot system flash:/vEOS-lab.swi -! -transceiver qsfp default-mode 4x10G -! -hostname localhost -! -spanning-tree mode mstp -! -no aaa root -! -interface Ethernet1 -! -interface Ethernet2 -! -! -no ip routing -! -! -end - diff --git a/test/integration/targets/eos_config/defaults/main.yaml b/test/integration/targets/eos_config/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_config/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_config/meta/main.yml b/test/integration/targets/eos_config/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_config/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_config/tasks/cli.yaml b/test/integration/targets/eos_config/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_config/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_config/tasks/cli_config.yaml b/test/integration/targets/eos_config/tasks/cli_config.yaml deleted file mode 100644 index baaa0a139e..0000000000 --- a/test/integration/targets/eos_config/tasks/cli_config.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli_config test cases - find: - paths: "{{ role_path }}/tests/cli_config" - 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=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_config/tasks/eapi.yaml b/test/integration/targets/eos_config/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_config/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_config/tasks/main.yaml b/test/integration/targets/eos_config/tasks/main.yaml deleted file mode 100644 index 8befd2711f..0000000000 --- a/test/integration/targets/eos_config/tasks/main.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: cli_config.yaml, tags: ['cli_config'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_config/templates/basic/cmds.j2 b/test/integration/targets/eos_config/templates/basic/cmds.j2 deleted file mode 100644 index c68cce8e17..0000000000 --- a/test/integration/targets/eos_config/templates/basic/cmds.j2 +++ /dev/null @@ -1,4 +0,0 @@ -ip access-list test - 10 permit ip host 192.168.0.2 host 192.168.0.1 - 20 permit ip host 192.168.0.1 host 192.168.0.2 -! diff --git a/test/integration/targets/eos_config/templates/basic/config.j2 b/test/integration/targets/eos_config/templates/basic/config.j2 deleted file mode 100644 index 82a61b62df..0000000000 --- a/test/integration/targets/eos_config/templates/basic/config.j2 +++ /dev/null @@ -1,4 +0,0 @@ -interface Ethernet2 - description this is a test - shutdown - diff --git a/test/integration/targets/eos_config/templates/defaults/config.j2 b/test/integration/targets/eos_config/templates/defaults/config.j2 deleted file mode 100644 index 8ff8f305c0..0000000000 --- a/test/integration/targets/eos_config/templates/defaults/config.j2 +++ /dev/null @@ -1,3 +0,0 @@ -interface Ethernet2 - description this is a test - no shutdown diff --git a/test/integration/targets/eos_config/templates/defaults/test.j2 b/test/integration/targets/eos_config/templates/defaults/test.j2 deleted file mode 100644 index 82a61b62df..0000000000 --- a/test/integration/targets/eos_config/templates/defaults/test.j2 +++ /dev/null @@ -1,4 +0,0 @@ -interface Ethernet2 - description this is a test - shutdown - diff --git a/test/integration/targets/eos_config/tests/cli/backup.yaml b/test/integration/targets/eos_config/tests/cli/backup.yaml deleted file mode 100644 index e75a40afdb..0000000000 --- a/test/integration/targets/eos_config/tests/cli/backup.yaml +++ /dev/null @@ -1,134 +0,0 @@ ---- -- debug: msg="START cli/backup.yaml on connection={{ ansible_connection }}" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- name: delete backup files - file: - path: "{{ item.path }}" - state: absent - with_items: "{{backup_files.files|default([])}}" - -- name: configure device with config - eos_config: - src: basic/config.j2 - backup: yes - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "result.updates is defined" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- assert: - that: - - "backup_files.files is defined" - -- name: delete configurable backup file path - file: - path: "{{ item }}" - state: absent - with_items: - - "{{ role_path }}/backup_test_dir/" - - "{{ role_path }}/backup/backup.cfg" - -- name: take configuration backup in custom filename and directory path - eos_config: - backup: yes - backup_options: - filename: backup.cfg - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-1 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom filename - eos_config: - backup: yes - backup_options: - filename: backup.cfg - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-2 exist - find: - paths: "{{ role_path }}/backup/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom path and default filename - eos_config: - backup: yes - backup_options: - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-3 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- debug: msg="END cli/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/check_mode.yaml b/test/integration/targets/eos_config/tests/cli/check_mode.yaml deleted file mode 100644 index 3961239547..0000000000 --- a/test/integration/targets/eos_config/tests/cli/check_mode.yaml +++ /dev/null @@ -1,93 +0,0 @@ ---- -- debug: - msg: "START cli/check_mode.yaml on connection={{ ansible_connection }}" - -- name: invalid configuration in check mode - eos_config: - lines: - - ip address 119.31.1.1 255.255.255.256 - parents: interface Loopback911 - become: yes - check_mode: 1 - vars: - ansible_eos_use_sessions: 1 - register: result - ignore_errors: yes - -- assert: - that: - - "result.msg is defined" - - "result.failed == true" - - "'Invalid input' in result.msg" - -- name: valid configuration in check mode - eos_config: - before: - - "no ip access-list test" - src: basic/cmds.j2 - become: yes - check_mode: yes - register: config - -- name: check if session is removed - eos_command: - commands: - - show configuration sessions | json - become: yes - register: result - -- assert: - that: - - "config.session not in result.stdout[0].sessions" - -- name: configuration in check mode + no config session - eos_config: - lines: - - ip address 119.31.1.1 255.255.255.254 - parents: interface Loopback911 - become: yes - check_mode: 1 - vars: - ansible_eos_use_sessions: 0 - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: invalid configuration in check mode + no config session - eos_config: - lines: - - ip address 119.31.1.1 255.255.255.256 - parents: interface Loopback911 - diff_against: running - become: yes - check_mode: 1 - vars: - ansible_eos_use_sessions: 0 - register: result - ignore_errors: yes - -- assert: - that: - - "result.changed == true" - -- name: valid configuration in check mode + no config session - eos_config: - lines: - - ip address 119.31.1.1 255.255.255.255 - parents: interface Loopback911 - diff_against: running - become: yes - check_mode: yes - register: result - vars: - ansible_eos_use_sessions: 0 - -- assert: - that: - - "result.changed == true" - - "'session' not in result" - -- debug: msg="END cli/check_mode.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/config.yaml b/test/integration/targets/eos_config/tests/cli/config.yaml deleted file mode 100644 index 428326f058..0000000000 --- a/test/integration/targets/eos_config/tests/cli/config.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: msg="START cli/config.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - become: yes - -- name: get current running-config - eos_command: - commands: show running-config - become: yes - register: config - -- name: configure hostname - eos_config: - lines: hostname foo - config: "{{ config.stdout[0] }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - -- name: get current running-config - eos_command: - commands: show running-config - become: yes - register: config - -- name: configure hostname again - eos_config: - lines: hostname foo - config: "{{ config.stdout[0] }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - become: yes - -- debug: msg="END cli/config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/defaults.yaml b/test/integration/targets/eos_config/tests/cli/defaults.yaml deleted file mode 100644 index cd87b4e7d3..0000000000 --- a/test/integration/targets/eos_config/tests/cli/defaults.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- debug: msg="START cli/defaults.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - commands: - - no description - - shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: configure device with defaults included - eos_config: - src: defaults/config.j2 - defaults: yes - become: yes - register: result - -- debug: var=result - -- assert: - that: - - "result.changed == true" - - "result.updates is defined" - -- name: check device with defaults included - eos_config: - src: defaults/config.j2 - defaults: yes - become: yes - register: result - -- debug: var=result - -- assert: - that: - - "result.changed == false" - - "result.updates is not defined" - -- debug: msg="END cli/defaults.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/save.yaml b/test/integration/targets/eos_config/tests/cli/save.yaml deleted file mode 100644 index cad82c26b7..0000000000 --- a/test/integration/targets/eos_config/tests/cli/save.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START cli/save.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - - -- name: save config always - eos_config: &always - save_when: always - become: yes - register: result - -- assert: &changed - that: - - "result.changed == true" - -- name: save should always run - eos_config: *always - become: yes - register: result - -- assert: *changed - -- debug: msg="END cli/save.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/src_basic.yaml b/test/integration/targets/eos_config/tests/cli/src_basic.yaml deleted file mode 100644 index 174d814aa0..0000000000 --- a/test/integration/targets/eos_config/tests/cli/src_basic.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- debug: msg="START cli/src_basic.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: configure device with config - eos_config: - src: basic/config.j2 - become: yes - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is defined" - -- name: check device with config - eos_config: - src: basic/config.j2 - defaults: yes - become: yes - register: result - -- assert: - that: - - "result.changed == false" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" - -- debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/src_invalid.yaml b/test/integration/targets/eos_config/tests/cli/src_invalid.yaml deleted file mode 100644 index 8931c7cf87..0000000000 --- a/test/integration/targets/eos_config/tests/cli/src_invalid.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START cli/src_invalid.yaml on connection={{ ansible_connection }}" - - -# Defend https://github.com/ansible/ansible-modules-core/issues/4797 -- name: configure with invalid src - eos_config: - src: basic/foobar.j2 - become: yes - register: result - ignore_errors: yes - -- assert: - that: - - "result.changed == false" - - "result.failed == true" - - "result.msg == 'path specified in src not found'" - -- debug: msg="END cli/src_invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/src_match_none.yaml b/test/integration/targets/eos_config/tests/cli/src_match_none.yaml deleted file mode 100644 index 74c5043612..0000000000 --- a/test/integration/targets/eos_config/tests/cli/src_match_none.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- debug: msg="START cli/src_match_none.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: configure device with config - eos_config: - src: basic/config.j2 - match: none - become: yes - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - #- "result.updates is not defined" - -- name: check device with config - eos_config: - src: basic/config.j2 - defaults: yes - become: yes - register: result - -- assert: - that: - # Idempotent test -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.changed == false" - - "result.updates is not defined" - -- debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel.yaml b/test/integration/targets/eos_config/tests/cli/sublevel.yaml deleted file mode 100644 index 21c3f9caa4..0000000000 --- a/test/integration/targets/eos_config/tests/cli/sublevel.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: msg="START cli/sublevel.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: no vlan 10 - match: none - become: yes - -- name: configure sub level command - eos_config: - lines: name test - parents: vlan 10 - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 10' in result.updates" - - "'name test' in result.updates" - -- name: configure sub level command idempotent check - eos_config: - lines: name test - parents: vlan 10 - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no vlan 10 - match: none - become: yes - -- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml deleted file mode 100644 index 9fbd1412f6..0000000000 --- a/test/integration/targets/eos_config/tests/cli/sublevel_block.yaml +++ /dev/null @@ -1,61 +0,0 @@ ---- -- debug: msg="START cli/sublevel_block.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: none - become: yes - -- name: configure sub level command using block resplace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - after: exit - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'20 permit ip host 192.0.2.2 any log' in result.updates" - - "'30 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - -- name: check sub level command using block replace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - after: exit - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml deleted file mode 100644 index 5b733255da..0000000000 --- a/test/integration/targets/eos_config/tests/cli/sublevel_exact.yaml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- debug: msg="START cli/sublevel_exact.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - - 50 permit ip host 192.0.2.5 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: none - become: yes - -- name: configure sub level command using exact match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: exact - replace: block - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'20 permit ip host 192.0.2.2 any log' in result.updates" - - "'30 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - - "'50 permit ip host 192.0.2.5 any log' not in result.updates" - -- name: check sub level command using exact match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - match: exact - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml deleted file mode 100644 index be055f69e2..0000000000 --- a/test/integration/targets/eos_config/tests/cli/sublevel_strict.yaml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- debug: msg="START cli/sublevel_strict.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - - 50 permit ip host 192.0.2.5 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: none - become: yes - -- name: configure sub level command using strict match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.3 any log - - 30 permit ip host 192.0.2.2 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: strict - replace: block - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'30 permit ip host 192.0.2.2 any log' in result.updates" - - "'20 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - - "'50 permit ip host 192.0.2.5 any log' not in result.updates" - -- name: check sub level command using strict match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.3 any log - - 30 permit ip host 192.0.2.2 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - match: strict - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/sublevel_strict_mul_parents.yaml b/test/integration/targets/eos_config/tests/cli/sublevel_strict_mul_parents.yaml deleted file mode 100644 index 4db54724cf..0000000000 --- a/test/integration/targets/eos_config/tests/cli/sublevel_strict_mul_parents.yaml +++ /dev/null @@ -1,79 +0,0 @@ ---- -- debug: - msg: "START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - class-map type qos match-any c1 - - match ip access-group 10 - - policy-map type qos p1 - - class c1 - before: ['no policy-map type qos p1', 'no class-map type qos match-any c1'] - match: none - become: yes - -- block: - - name: configure sub level command using strict match - eos_config: - lines: - - set cos 1 - - set dscp 62 - parents: ['policy-map type qos p1', 'class c1'] - match: strict - # session-config diffs does not produce a diff here for some reason. - # check against running-config instead. - diff_against: running - register: result - become: yes - - - assert: - that: - - "result.changed == true" - - "'set cos 1' in result.updates" - - "'set dscp 62' in result.updates" - - - name: change sub level command order and config with strict match - eos_config: - lines: - - set dscp 62 - - set cos 1 - parents: ['policy-map type qos p1', 'class c1'] - match: strict - diff_against: running - register: result - become: yes - - - assert: - that: - - "result.changed == true" - - "'set cos 1' in result.updates" - - "'set dscp 62' in result.updates" - - - name: Config sub level command with strict match (Idempotency) - eos_config: - lines: - #EOS does not change order of class action if reconfigured - #so we have to use old order for Idempotency - - set cos 1 - - set dscp 62 - parents: ['policy-map type qos p1', 'class c1'] - match: strict - diff_against: running - register: result - become: yes - - - assert: - that: - - "result.changed == false" - - always: - - name: teardown - eos_config: - lines: - - no policy-map type qos p1 - - no class-map type qos match-any c1 - match: none - become: yes - -- debug: msg="END cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel.yaml b/test/integration/targets/eos_config/tests/cli/toplevel.yaml deleted file mode 100644 index 2c9211427c..0000000000 --- a/test/integration/targets/eos_config/tests/cli/toplevel.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START cli/toplevel.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - become: yes - -- name: configure top level command - eos_config: - lines: hostname foo - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - -- name: configure top level command idempotent check - eos_config: - lines: hostname foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - become: yes - -- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml b/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml deleted file mode 100644 index 56bf934435..0000000000 --- a/test/integration/targets/eos_config/tests/cli/toplevel_after.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- debug: msg="START cli/toplevel_after.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - snmp-server contact ansible - - "hostname {{ inventory_hostname_short }}" - match: none - become: yes - -- name: configure top level command with before - eos_config: - lines: hostname foo - after: snmp-server contact bar - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - - "'snmp-server contact bar' in result.updates" - -- name: configure top level command with before idempotent check - eos_config: - lines: hostname foo - after: snmp-server contact foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: - - no snmp-server contact - - hostname {{ inventory_hostname_short }} - match: none - become: yes - -- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml b/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml deleted file mode 100644 index 449e1bf36c..0000000000 --- a/test/integration/targets/eos_config/tests/cli/toplevel_before.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- debug: msg="START cli/toplevel_before.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - "snmp-server contact ansible" - - "hostname {{ inventory_hostname_short }}" - match: none - become: yes - -- name: configure top level command with before - eos_config: - lines: hostname foo - before: snmp-server contact bar - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - - "'snmp-server contact bar' in result.updates" - -- name: configure top level command with before idempotent check - eos_config: - lines: hostname foo - before: snmp-server contact foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: - - no snmp-server contact - - "hostname {{ inventory_hostname_short }}" - match: none - become: yes - -- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli_config/cli_backup.yaml b/test/integration/targets/eos_config/tests/cli_config/cli_backup.yaml deleted file mode 100644 index a431c01fde..0000000000 --- a/test/integration/targets/eos_config/tests/cli_config/cli_backup.yaml +++ /dev/null @@ -1,113 +0,0 @@ -- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" - -- name: delete configurable backup file path - file: - path: "{{ item }}" - state: absent - with_items: - - "{{ 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*" - register: backup_files - connection: local - -- name: delete backup files - file: - path: "{{ item.path }}" - state: absent - with_items: "{{backup_files.files|default([])}}" - -- name: take config backup - cli_config: - backup: yes - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- assert: - that: - - "backup_files.files is defined" - -- name: take configuration backup in custom filename and directory path - cli_config: - backup: yes - backup_options: - filename: backup.cfg - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-1 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom filename - cli_config: - backup: yes - backup_options: - filename: backup.cfg - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-2 exist - find: - paths: "{{ role_path }}/backup/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom path and default filename - cli_config: - backup: yes - backup_options: - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-3 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/cli_config/cli_basic.yaml b/test/integration/targets/eos_config/tests/cli_config/cli_basic.yaml deleted file mode 100644 index 73b3175ab8..0000000000 --- a/test/integration/targets/eos_config/tests/cli_config/cli_basic.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection }}" - -- name: setup - cli_config: &rm - config: | - interface Ethernet2 - no description - no shutdown - become: yes - -- name: configure device with config - cli_config: &conf - config: "{{ lookup('template', 'basic/config.j2') }}" - register: result - become: yes - -- assert: - that: - - "result.changed == true" - -- name: Idempotence - cli_config: *conf - register: result - become: yes - -- assert: - that: - - "result.changed == false" - -- name: teardown - cli_config: *rm - become: yes - -- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/eapi/backup.yaml b/test/integration/targets/eos_config/tests/eapi/backup.yaml deleted file mode 100644 index 45dfa4e0c7..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/backup.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- debug: msg="START eapi/backup.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- name: delete backup files - file: - path: "{{ item.path }}" - state: absent - with_items: "{{backup_files.files|default([])}}" - -- name: configure device with config - eos_config: - src: basic/config.j2 - backup: yes - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "result.updates is defined" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- assert: - that: - - "backup_files.files is defined" - -- debug: msg="END eapi/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_config/tests/eapi/defaults.yaml b/test/integration/targets/eos_config/tests/eapi/defaults.yaml deleted file mode 100644 index 70ef101eb9..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/defaults.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- debug: msg="START eapi/defaults.yaml" - -- name: setup - eos_config: - commands: - - no description - - shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: configure device with defaults included - eos_config: - src: defaults/config.j2 - defaults: yes - become: yes - register: result - -- debug: var=result - -- assert: - that: - - "result.changed == true" - - "result.updates is defined" - -- name: check device with defaults included - eos_config: - src: defaults/config.j2 - defaults: yes - become: yes - register: result - -- debug: var=result - -- assert: - that: - - "result.changed == false" - - "result.updates is not defined" - -- debug: msg="END eapi/defaults.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/save.yaml b/test/integration/targets/eos_config/tests/eapi/save.yaml deleted file mode 100644 index 9a6895bec5..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/save.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- debug: msg="START eapi/save.yaml" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - - -- name: save config always - eos_config: &always - save_when: always - become: yes - register: result - -- assert: &changed - that: - - "result.changed == true" - -- name: save should always run - eos_config: *always - become: yes - register: result - -- assert: *changed - -- debug: msg="END eapi/save.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/src_basic.yaml b/test/integration/targets/eos_config/tests/eapi/src_basic.yaml deleted file mode 100644 index bda5ffba98..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/src_basic.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- debug: msg="START eapi/src_basic.yaml" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: configure device with config - eos_config: - src: basic/config.j2 - become: yes - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is defined" - -- name: check device with config - eos_config: - src: basic/config.j2 - become: yes - register: result - -- assert: - that: - - "result.changed == false" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" - -- debug: msg="END eapi/src_basic.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml b/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml deleted file mode 100644 index d3deade606..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/src_invalid.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- debug: msg="START eapi/src_invalid.yaml" - - -# Defend https://github.com/ansible/ansible-modules-core/issues/4797 -- name: configure with invalid src - eos_config: - src: basic/foobar.j2 - register: result - ignore_errors: yes - -- assert: - that: - - "result.changed == false" - - "result.failed == true" - - "result.msg == 'path specified in src not found'" - -- debug: msg="END eapi/src_invalid.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml b/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml deleted file mode 100644 index 3485e33334..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/src_match_none.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: msg="START eapi/src_match_none.yaml" - -- name: setup - eos_config: - commands: - - no description - - no shutdown - parents: - - interface Ethernet2 - match: none - become: yes - -- name: configure device with config - eos_config: - src: basic/config.j2 - match: none - become: yes - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is defined" - -- name: check device with config - eos_config: - src: basic/config.j2 - become: yes - register: result - -- assert: - that: - # Idempotent test -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.changed == false" - - "result.updates is not defined" - -- debug: msg="END eapi/src_match_none.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel.yaml deleted file mode 100644 index 4e9017bf7d..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/sublevel.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- debug: msg="START eapi/sublevel.yaml" - -- name: setup - eos_config: - lines: no ip access-list test - match: none - become: yes - -- name: configure sub level command - eos_config: - lines: 10 permit ip any any log - parents: ip access-list test - after: exit - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip any any log' in result.updates" - -- name: configure sub level command idempotent check - eos_config: - lines: 10 permit ip any any log - parents: ip access-list test - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END eapi/sublevel.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml deleted file mode 100644 index e8a05dda0d..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/sublevel_block.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -- debug: msg="START eapi/sublevel_block.yaml" - -- name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - parents: ip access-list test - before: no ip access-list test - match: none - become: yes - -- name: configure sub level command using block resplace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - after: end - replace: block - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'20 permit ip host 192.0.2.2 any log' in result.updates" - - "'30 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - -- name: check sub level command using block replace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END eapi/sublevel_block.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml deleted file mode 100644 index 048b41a32a..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/sublevel_exact.yaml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- debug: msg="START eapi/sublevel_exact.yaml" - -- name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - - 50 permit ip host 192.0.2.5 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: none - become: yes - -- name: configure sub level command using exact match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: exact - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'20 permit ip host 192.0.2.2 any log' in result.updates" - - "'30 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - - "'50 permit ip host 192.0.2.5 any log' not in result.updates" - -- name: check sub level command using exact match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - before: no ip access-list test - parents: ip access-list test - match: exact - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END eapi/sublevel_exact.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml b/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml deleted file mode 100644 index cd88c16d95..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/sublevel_strict.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- debug: msg="START eapi/sublevel_strict.yaml" - -- name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - - 50 permit ip host 192.0.2.5 any log - parents: ip access-list test - before: no ip access-list test - match: none - become: yes - -- name: configure sub level command using strict match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.3 any log - - 30 permit ip host 192.0.2.2 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: strict - replace: block - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'30 permit ip host 192.0.2.2 any log' in result.updates" - - "'20 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - - "'50 permit ip host 192.0.2.5 any log' not in result.updates" - -- name: check sub level command using strict match - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.3 any log - - 30 permit ip host 192.0.2.2 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - match: strict - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip access-list test - match: none - become: yes - -- debug: msg="END eapi/sublevel_strict.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/toplevel.yaml b/test/integration/targets/eos_config/tests/eapi/toplevel.yaml deleted file mode 100644 index ef3c276418..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/toplevel.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START eapi/toplevel.yaml" - -- name: setup - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - become: yes - -- name: configure top level command - eos_config: - lines: hostname foo - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - -- name: configure top level command idempotent check - eos_config: - lines: hostname foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - become: yes - -- debug: msg="END eapi/toplevel.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml b/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml deleted file mode 100644 index 4e091dd2af..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/toplevel_after.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- debug: msg="START eapi/toplevel_after.yaml" - -- name: setup - eos_config: - lines: - - snmp-server contact ansible - - "hostname {{ inventory_hostname_short }}" - match: none - become: yes - -- name: configure top level command with before - eos_config: - lines: hostname foo - after: snmp-server contact bar - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - - "'snmp-server contact bar' in result.updates" - -- name: configure top level command with before idempotent check - eos_config: - lines: hostname foo - after: snmp-server contact foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: - - no snmp-server contact - - hostname {{ inventory_hostname_short }} - match: none - become: yes - -- debug: msg="END eapi/toplevel_after.yaml" diff --git a/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml b/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml deleted file mode 100644 index 6ba92ab140..0000000000 --- a/test/integration/targets/eos_config/tests/eapi/toplevel_before.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- debug: msg="START eapi/toplevel_before.yaml" - -- name: setup - eos_config: - lines: - - "snmp-server contact ansible" - - "hostname {{ inventory_hostname_short }}" - match: none - become: yes - -- name: configure top level command with before - eos_config: - lines: hostname foo - before: snmp-server contact bar - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - - "'snmp-server contact bar' in result.updates" - -- name: configure top level command with before idempotent check - eos_config: - lines: hostname foo - before: snmp-server contact foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: - - no snmp-server contact - - "hostname {{ inventory_hostname_short }}" - match: none - become: yes - -- debug: msg="END eapi/toplevel_before.yaml" diff --git a/test/integration/targets/eos_eapi/defaults/main.yaml b/test/integration/targets/eos_eapi/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_eapi/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_eapi/meta/main.yml b/test/integration/targets/eos_eapi/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_eapi/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_eapi/tasks/cli.yaml b/test/integration/targets/eos_eapi/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_eapi/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_eapi/tasks/main.yaml b/test/integration/targets/eos_eapi/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/eos_eapi/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_eapi/tests/cli/badtransport.yaml b/test/integration/targets/eos_eapi/tests/cli/badtransport.yaml deleted file mode 100644 index 2c10e6558d..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/badtransport.yaml +++ /dev/null @@ -1,14 +0,0 @@ -- debug: msg="START CLI/BADTRANSPORT.YAML" - -- block: - - name: Expect transport other than cli to fail - eos_eapi: - provider: "{{ eapi }}" - register: eos_eapi_output - ignore_errors: yes - - - assert: - that: eos_eapi_output.failed == true - when: "ansible_connection == 'local'" - -- debug: msg="START CLI/BADTRANSPORT.YAML" diff --git a/test/integration/targets/eos_eapi/tests/cli/config.yaml b/test/integration/targets/eos_eapi/tests/cli/config.yaml deleted file mode 100644 index a22289d904..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/config.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: msg="START cli/config.yaml on connection={{ ansible_connection }}" - -- name: Setup - eos_config: - lines: no management api http-commands - match: none - provider: "{{ cli }}" - become: yes - -- name: Get running-config - eos_command: - commands: show running-config - provider: "{{ cli }}" - become: yes - register: config - -- name: Set config - eos_eapi: - config: "{{ config.stdout[0] }}" - provider: "{{ cli }}" - become: yes - register: config - -- name: Ensure that this triggered a change - assert: - that: - - "config.changed == true" - -#--- -- name: Get running-config again - eos_command: - commands: show running-config - provider: "{{ cli }}" - become: yes - register: config - -- name: Set config - eos_eapi: - config: "{{ config.stdout[0] }}" - provider: "{{ cli }}" - become: yes - register: config - - -- name: Idempotency check - assert: - that: - - "config.changed == false" - -- debug: msg="END cli/config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_eapi/tests/cli/configure.yaml b/test/integration/targets/eos_eapi/tests/cli/configure.yaml deleted file mode 100644 index fecdccfcec..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/configure.yaml +++ /dev/null @@ -1,43 +0,0 @@ -- debug: msg="START CLI/CONFIGURE.YAML" - -- name: Change endpoint ports - eos_eapi: - enable_http: false - http_port: 81 - https_port: 4443 - enable_local_http: yes - enable_https: yes - local_http_port: 8181 - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- eos_command: - commands: - - show management api http-commands | json - provider: "{{ cli }}" - register: http_config - -- name: Expect endpoint ports to be set - assert: - that: - - http_config.stdout[0].httpServer.port == 80 - - http_config.stdout[0].httpsServer.port == 4443 - - http_config.stdout[0].localHttpServer.port == 8181 - -- name: Change endpoint ports again - eos_eapi: - http_port: 80 - https_port: 4443 - enable_local_http: yes - local_http_port: 8181 - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- name: Expect action to be idempotent - assert: - that: - - "eos_eapi_output.changed == false" - -- debug: msg="END CLI/CONFIGURE.YAML" diff --git a/test/integration/targets/eos_eapi/tests/cli/off.yaml b/test/integration/targets/eos_eapi/tests/cli/off.yaml deleted file mode 100644 index 43634e152c..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/off.yaml +++ /dev/null @@ -1,49 +0,0 @@ -- debug: msg="START CLI/OFF.YAML" - -- name: Turn all endpoints off - eos_eapi: - enable_http: no - enable_https: no - enable_local_http: no - enable_socket: no - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- debug: var=eos_eapi_output - -- eos_command: - commands: - - show management api http-commands | json - provider: "{{ cli }}" - register: http_config - -- debug: var=http_config - -- name: Expect all EAPI endpoints to be in off state - assert: - that: - - http_config.stdout[0].httpServer.running == false - - http_config.stdout[0].httpsServer.running == false - - http_config.stdout[0].localHttpServer.running == false - - http_config.stdout[0].unixSocketServer.running == false - -- name: Turn all endpoints off again - eos_eapi: - enable_http: no - enable_https: no - enable_local_http: no - enable_socket: no - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- debug: var=eos_eapi_output - when: debug - -- name: Expect action to be idempotent - assert: - that: - - "eos_eapi_output.changed == false" - -- debug: msg="END CLI/OFF.YAML" diff --git a/test/integration/targets/eos_eapi/tests/cli/on.yaml b/test/integration/targets/eos_eapi/tests/cli/on.yaml deleted file mode 100644 index b19499f90b..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/on.yaml +++ /dev/null @@ -1,47 +0,0 @@ -- debug: msg="START CLI/ON.YAML" - -- name: Turn on all endpoints - eos_eapi: - enable_http: yes - enable_https: yes - enable_local_http: yes - enable_socket: yes - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- eos_command: - commands: - - show management api http-commands | json - provider: "{{ cli }}" - register: http_config - -- debug: var=http_config - when: debug - -- name: Expect all EAPI endpoints to be in on state - assert: - that: - - http_config.stdout[0].httpServer.running == true - - http_config.stdout[0].httpsServer.running == true - - http_config.stdout[0].localHttpServer.running == true - - http_config.stdout[0].unixSocketServer.running == true - -- name: Turn on all endpoints again - eos_eapi: - enable_http: yes - enable_https: yes - enable_local_http: yes - enable_socket: yes - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- debug: var=eos_eapi_output - -- name: Expect action to be idempotent - assert: - that: - - "eos_eapi_output.changed == false" - -- debug: msg="START CLI/ON.YAML" diff --git a/test/integration/targets/eos_eapi/tests/cli/start.yaml b/test/integration/targets/eos_eapi/tests/cli/start.yaml deleted file mode 100644 index 5212aea57b..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/start.yaml +++ /dev/null @@ -1,38 +0,0 @@ -- debug: msg="START CLI/START.YAML" - -- name: Set state to started - eos_eapi: - state: started - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- eos_command: - commands: - - show management api http-commands | json - provider: "{{ cli }}" - register: http_config - -- debug: var=http_config - when: debug - -- name: Expect EAPI state is on - assert: - that: http_config.stdout[0].enabled == true - -- name: Set state to running again - eos_eapi: - state: started - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- debug: var=eos_eapi_output - when: debug - -- name: Expect action to be idempotent - assert: - that: - - "eos_eapi_output.changed == false" - -- debug: msg="STOP CLI/START.YAML" diff --git a/test/integration/targets/eos_eapi/tests/cli/stop.yaml b/test/integration/targets/eos_eapi/tests/cli/stop.yaml deleted file mode 100644 index 3d29af4555..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/stop.yaml +++ /dev/null @@ -1,38 +0,0 @@ -- debug: msg="START CLI/STOP.YAML" - -- name: Set state to stopped - eos_eapi: - state: stopped - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- eos_command: - commands: - - show management api http-commands | json - provider: "{{ cli }}" - register: http_config - -- debug: var=http_config - when: debug - -- name: Expect EAPI state is off - assert: - that: http_config.stdout[0].enabled == false - -- name: Set state to stopped again - eos_eapi: - state: stopped - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- debug: var=eos_eapi_output - when: debug - -- name: Expect action to be idempotent - assert: - that: - - "eos_eapi_output.changed == false" - -- debug: msg="STOP CLI/ENABLE.YAML" diff --git a/test/integration/targets/eos_eapi/tests/cli/vrf.yaml b/test/integration/targets/eos_eapi/tests/cli/vrf.yaml deleted file mode 100644 index 606d03dcb1..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/vrf.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -- debug: msg="START cli/vrf.yaml on connection={{ ansible_connection }}" - -- name: Set invalid VRF - eos_eapi: - vrf: foobar - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - ignore_errors: true - -- name: Ensure that setting VRF failed - assert: - that: - - "eos_eapi_output.failed == true" - - "eos_eapi_output.changed == false" - - eos_eapi_output.msg == "vrf `foobar` is not configured on the system" - -#---- -- name: Set VRF to default - eos_eapi: - vrf: default - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - ignore_errors: true - - -- name: Set VRF to default again (idempotent) - eos_eapi: - vrf: default - provider: "{{ cli }}" - become: yes - register: eos_eapi_output - -- name: Ensure idempotent - assert: - that: - - "eos_eapi_output.changed == false" - - -# ----- -# FIXME Future: Idempotent test -# Add in an extra vrt and swap between that and default to ensure idempotency -- name: DEBUG show vrf - eos_command: - commands: show vrf - provider: "{{ cli }}" - register: eos_eapi_output - when: false - -#- debug: -# msg: "{{ eos_eapi_output }}" - -- debug: msg="END cli/vrf.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_eapi/tests/cli/zzz_reset.1 b/test/integration/targets/eos_eapi/tests/cli/zzz_reset.1 deleted file mode 100644 index b489ae80fc..0000000000 --- a/test/integration/targets/eos_eapi/tests/cli/zzz_reset.1 +++ /dev/null @@ -1,38 +0,0 @@ -- debug: msg="START CLI/RESET.YAML" - -- name: Change endpoint ports back to default values - eos_config: - lines: default management api http-commands - match: none - provider: "{{ cli }}" - register: eos_eapi_output - connection: local - -- eos_command: - commands: - - show management api http-commands | json - provider: "{{ cli }}" - register: http_config - connection: local - -- name: Expect endpoint ports to have default port values - assert: - that: - - http_config.stdout[0].httpServer.port == 80 - - http_config.stdout[0].httpsServer.port == 443 - - http_config.stdout[0].localHttpServer.port == 8080 - -- name: Change endpoint ports back to default values again - eos_config: - lines: default management api http-commands - match: none - provider: "{{ cli }}" - register: eos_eapi_output - connection: local - -- name: Expect action to be idempotent - assert: - that: - - "eos_eapi_output.changed == false" - -- debug: msg="END CLI/RESET.YAML" diff --git a/test/integration/targets/eos_facts/defaults/main.yaml b/test/integration/targets/eos_facts/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_facts/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_facts/meta/main.yml b/test/integration/targets/eos_facts/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_facts/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_facts/tasks/cli.yaml b/test/integration/targets/eos_facts/tasks/cli.yaml deleted file mode 100644 index 44ed324673..0000000000 --- a/test/integration/targets/eos_facts/tasks/cli.yaml +++ /dev/null @@ -1,24 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli - -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_local diff --git a/test/integration/targets/eos_facts/tasks/eapi.yaml b/test/integration/targets/eos_facts/tasks/eapi.yaml deleted file mode 100644 index 6ae12ebc1f..0000000000 --- a/test/integration/targets/eos_facts/tasks/eapi.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - 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 cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi - -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_local diff --git a/test/integration/targets/eos_facts/tasks/main.yaml b/test/integration/targets/eos_facts/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_facts/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_facts/tests/cli/all_facts.yaml b/test/integration/targets/eos_facts/tests/cli/all_facts.yaml deleted file mode 100644 index 18f3282924..0000000000 --- a/test/integration/targets/eos_facts/tests/cli/all_facts.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- debug: msg="START cli/all_facts.yaml on connection={{ ansible_connection }}" - -- name: test getting all facts - eos_facts: - gather_subset: - - all - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'config' in result.ansible_facts.ansible_net_gather_subset" - - "'hardware' in result.ansible_facts.ansible_net_gather_subset" - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_filesystems is defined" - # Check that these facts not only are present, but are valid (positive integers) - - "result.ansible_facts.ansible_net_memfree_mb > 1" - - "result.ansible_facts.ansible_net_memtotal_mb > 1" - -- debug: msg="END cli/all_facts.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/cli/default_facts.yaml b/test/integration/targets/eos_facts/tests/cli/default_facts.yaml deleted file mode 100644 index 7e05f01390..0000000000 --- a/test/integration/targets/eos_facts/tests/cli/default_facts.yaml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- debug: msg="START cli/default_facts.yaml on connection={{ ansible_connection }}" - -- name: test getting default facts - eos_facts: - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'hardware' in result.ansible_facts.ansible_net_gather_subset" - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - - "result.ansible_facts.ansible_net_filesystems is defined" - # ... and not present - - "'config' not in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_filesystems is defined" #hw - - "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw - - "result.ansible_facts.ansible_net_interfaces.Management1" # interfaces - - # ... and not present - - "result.ansible_facts.ansible_net_config is not defined" # config - -- debug: msg="END cli/default_facts.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml b/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml deleted file mode 100644 index c310430cd0..0000000000 --- a/test/integration/targets/eos_facts/tests/cli/invalid_subset.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- debug: msg="START cli/invalid_subset.yaml on connection={{ ansible_connection }}" - -- name: test invalid subset (foobar) - eos_facts: - gather_subset: - - "foobar" - provider: "{{ cli }}" - become: yes - register: result - ignore_errors: true - - -- assert: - that: - # Failures shouldn't return changes - - "result.changed == false" - # It's a failure - - "result.failed == true" - # Sensible Failure message - - "'Subset must be one of' in result.msg" - -- debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml b/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml deleted file mode 100644 index 1954bcb8e4..0000000000 --- a/test/integration/targets/eos_facts/tests/cli/not_hardware.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START cli/not_hardware.yaml on connection={{ ansible_connection }}" - -- name: test not hardware - eos_facts: - gather_subset: - - "!hardware" - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'config' in result.ansible_facts.ansible_net_gather_subset" - - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - # ... and not present - - "'hardware' not in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_interfaces.Management1" # interfaces - # ... and not present - - "result.ansible_facts.ansible_net_filesystems is not defined" - -- debug: msg="END cli/not_hardware.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml b/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml deleted file mode 100644 index ba701b4577..0000000000 --- a/test/integration/targets/eos_facts/tests/eapi/all_facts.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- debug: msg="START eapi/all_facts.yaml on connection={{ ansible_connection }}" - -- name: test getting all facts - eos_facts: - gather_subset: - - all - provider: "{{ eapi }}" - become: yes - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'config' in result.ansible_facts.ansible_net_gather_subset" - - "'hardware' in result.ansible_facts.ansible_net_gather_subset" - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_filesystems is defined" - # Check that these facts not only are present, but are valid (positive integers) - - "result.ansible_facts.ansible_net_memfree_mb > 1" - - "result.ansible_facts.ansible_net_memtotal_mb > 1" - -- debug: msg="END eapi/all_facts.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml b/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml deleted file mode 100644 index 3c6d70ac57..0000000000 --- a/test/integration/targets/eos_facts/tests/eapi/default_facts.yaml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- debug: msg="START eapi/default_facts.yaml on connection={{ ansible_connection }}" - -- name: test getting default facts - eos_facts: - provider: "{{ eapi }}" - become: yes - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'hardware' in result.ansible_facts.ansible_net_gather_subset" - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - - "result.ansible_facts.ansible_net_filesystems is defined" - # ... and not present - - "'config' not in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_filesystems is defined" #hw - - "result.ansible_facts.ansible_net_memtotal_mb > 10" #hw - - "result.ansible_facts.ansible_net_interfaces.Management1" # interfaces - - # ... and not present - - "result.ansible_facts.ansible_net_config is not defined" # config - -- debug: msg="END eapi/default_facts.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml b/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml deleted file mode 100644 index de583038fb..0000000000 --- a/test/integration/targets/eos_facts/tests/eapi/invalid_subset.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- debug: msg="START eapi/invalid_subset.yaml on connection={{ ansible_connection }}" - -- name: test invalid subset (foobar) - eos_facts: - gather_subset: - - "foobar" - provider: "{{ eapi }}" - become: yes - register: result - ignore_errors: true - - -- assert: - that: - # Failures shouldn't return changes - - "result.changed == false" - # It's a failure - - "result.failed == true" - # Sensible Failure message - - "'Subset must be one of' in result.msg" - -- debug: msg="END eapi/invalid_subset.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml b/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml deleted file mode 100644 index 7b1d4c797e..0000000000 --- a/test/integration/targets/eos_facts/tests/eapi/not_hardware.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START eapi/not_hardware.yaml on connection={{ ansible_connection }}" - -- name: test not hardware - eos_facts: - gather_subset: - - "!hardware" - provider: "{{ eapi }}" - become: yes - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'config' in result.ansible_facts.ansible_net_gather_subset" - - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - # ... and not present - - "'hardware' not in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_interfaces.Management1" # interfaces - # ... and not present - - "result.ansible_facts.ansible_net_filesystems is not defined" - -- debug: msg="END eapi/not_hardware.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_interface/defaults/main.yaml b/test/integration/targets/eos_interface/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_interface/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_interface/meta/main.yml b/test/integration/targets/eos_interface/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_interface/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_interface/tasks/cli.yaml b/test/integration/targets/eos_interface/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_interface/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_interface/tasks/eapi.yaml b/test/integration/targets/eos_interface/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_interface/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_interface/tasks/main.yaml b/test/integration/targets/eos_interface/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_interface/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_interface/tests/cli/basic.yaml b/test/integration/targets/eos_interface/tests/cli/basic.yaml deleted file mode 100644 index 14aca747fe..0000000000 --- a/test/integration/targets/eos_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,229 +0,0 @@ ---- -- debug: msg="START eos_interface cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - test_interface_2: ethernet2 - -- name: Configure interface (setup) - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-1 - mtu: 1800 - state: present - become: yes - register: result - -- name: Configure interface - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-initial - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface-initial" in result.commands' - -- name: Confgure interface (idempotent) - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-initial - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Confgure interface parameters - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface - mtu: 2000 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface" in result.commands' - - '"mtu 2000" in result.commands' - -- name: Change interface parameters - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-1 - mtu: 1800 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface-1" in result.commands' - - '"mtu 1800" in result.commands' - -- name: Disable interface - eos_interface: - name: "{{ test_interface_1 }}" - enabled: False - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"shutdown" in result.commands' - -- name: Enable interface - eos_interface: - name: "{{ test_interface_1 }}" - enabled: True - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no shutdown" in result.commands' - -- name: Confgure second interface (setup) - eos_interface: - name: "{{ test_interface_2 }}" - description: test-interface-initial - mtu: 1800 - state: present - become: yes - register: result - -- name: Add interface aggregate - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}", mtu: 2000, description: test-interface-1 } - - { name: "{{ test_interface_2 }}", mtu: 2000, description: test-interface-2 } - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"mtu 2000" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"description test-interface-2" in result.commands' - - '"mtu 2000" in result.commands' - -- name: Add interface aggregate (idempotent) - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}", mtu: 2000, description: test-interface-1 } - - { name: "{{ test_interface_2 }}", mtu: 2000, description: test-interface-2 } - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Disable interface aggregate - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - enabled: False - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"shutdown" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"shutdown" in result.commands' - -- name: Enable interface aggregate - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - enabled: True - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no shutdown" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"no shutdown" in result.commands' - -- name: loopback interface setup - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: absent - become: yes - -- name: Create loopback interface aggregate - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface loopback9" in result.commands' - - '"interface loopback10" in result.commands' - -- name: Delete loopback interface aggregate - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface loopback9" in result.commands' - - '"no interface loopback10" in result.commands' - -- name: Delete loopback interface aggregate (idempotent) - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END eos_interface cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_interface/tests/cli/intent.yaml b/test/integration/targets/eos_interface/tests/cli/intent.yaml deleted file mode 100644 index 1432636015..0000000000 --- a/test/integration/targets/eos_interface/tests/cli/intent.yaml +++ /dev/null @@ -1,151 +0,0 @@ ---- -- debug: msg="START eos_interface cli/intent.yaml on connection={{ ansible_connection }}" - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - test_interface_2: ethernet2 - -- name: Check intent arguments - eos_interface: - name: "{{ test_interface_1 }}" - state: up - tx_rate: ge(0) - rx_rate: ge(0) - become: yes - register: result - -- assert: - that: - - "result.failed == false" - -- name: Check intent arguments (failed condition) - eos_interface: - name: "{{ test_interface_1 }}" - state: down - tx_rate: gt(0) - rx_rate: lt(0) - ignore_errors: yes - become: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(down)' in result.failed_conditions" - - "'tx_rate gt(0)' in result.failed_conditions" - - "'rx_rate lt(0)' in result.failed_conditions" - -- name: Config + intent - eos_interface: - name: "{{ test_interface_1 }}" - enabled: False - state: down - become: yes - register: result - -- assert: - that: - - "result.failed == false" - -- name: Config + intent (fail) - eos_interface: - name: "{{ test_interface_1 }}" - enabled: False - state: up - ignore_errors: yes - become: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(up)' in result.failed_conditions" - -- name: Register show neighbors detail - eos_command: - commands: - - show lldp neighbors management1 - become: yes - register: show_lldp_neighbors_result - -- block: - - name: Check neighbors intent arguments - eos_interface: - name: management1 - neighbors: - - port: eth0 - host: an-vyos-02 - become: yes - register: result - - - assert: - that: - - "result.failed == false" - - - name: Check neighbors intent arguments (failed condition) - eos_interface: - name: management1 - neighbors: - - port: dummy_port - host: dummy_host - ignore_errors: yes - become: yes - register: result - - - assert: - that: - - "result.failed == true" - - "'host dummy_host' in result.failed_conditions" - - "'port dummy_port' in result.failed_conditions" - when: '"an-vyos-02" in show_lldp_neighbors_result.stdout[0]' - -- name: Aggregate config + intent (pass) - eos_interface: - aggregate: - - name: "{{ test_interface_1 }}" - enabled: True - state: up - ignore_errors: yes - become: yes - register: result - -- assert: - that: - - "result.failed == false" - -- block: - - name: Aggregate neighbors intent (pass) - eos_interface: - aggregate: - - name: management1 - neighbors: - - port: eth0 - host: an-vyos-02 - ignore_errors: yes - become: yes - register: result - - - assert: - that: - - "result.failed == false" - - - name: Aggregate neighbors intent (fail) - eos_interface: - aggregate: - - name: management1 - neighbors: - - port: eth0 - host: an-vyos-02 - - port: dummy_port - host: dummy_host - ignore_errors: yes - become: yes - register: result - - - assert: - that: - - "result.failed == true" - - "'host dummy_host' in result.failed_conditions" - - "'port dummy_port' in result.failed_conditions" - when: "'an-vyos-02' in show_lldp_neighbors_result.stdout[0]" diff --git a/test/integration/targets/eos_interface/tests/cli/net_interface.yaml b/test/integration/targets/eos_interface/tests/cli/net_interface.yaml deleted file mode 100644 index e10003f90b..0000000000 --- a/test/integration/targets/eos_interface/tests/cli/net_interface.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- debug: msg="START eos cli/net_interface.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - -- name: Configure interface (setup) - net_interface: - name: "{{ test_interface_1 }}" - description: test-interface-1 - mtu: 1800 - state: present - become: yes - register: result - -- name: Configure interface description using platform agnostic module - net_interface: - name: "{{ test_interface_1 }}" - description: test-interface-initial - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface-initial" in result.commands' - -- name: Confgure interface parameters - net_interface: - name: "{{ test_interface_1 }}" - description: test-interface - mtu: 2000 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface" in result.commands' - - '"mtu 2000" in result.commands' - -- debug: msg="END eos cli/net_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_interface/tests/eapi/basic.yaml b/test/integration/targets/eos_interface/tests/eapi/basic.yaml deleted file mode 100644 index ae40f3d001..0000000000 --- a/test/integration/targets/eos_interface/tests/eapi/basic.yaml +++ /dev/null @@ -1,229 +0,0 @@ ---- -- debug: msg="START eos_interface eapi/basic.yaml on connection={{ ansible_connection }}" - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - test_interface_2: ethernet2 - -- name: Configure interface (setup) - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-1 - mtu: 1800 - state: present - become: yes - register: result - -- name: Configure interface - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-initial - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface-initial" in result.commands' - -- name: Confgure interface (idempotent) - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-initial - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Confgure interface parameters - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface - mtu: 2000 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface" in result.commands' - - '"mtu 2000" in result.commands' - -- name: Change interface parameters - eos_interface: - name: "{{ test_interface_1 }}" - description: test-interface-1 - mtu: 1800 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface-1" in result.commands' - - '"mtu 1800" in result.commands' - -- name: Disable interface - eos_interface: - name: "{{ test_interface_1 }}" - enabled: False - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"shutdown" in result.commands' - -- name: Enable interface - eos_interface: - name: "{{ test_interface_1 }}" - enabled: True - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no shutdown" in result.commands' - -- name: Confgure second interface (setup) - eos_interface: - name: "{{ test_interface_2 }}" - description: test-interface-initial - mtu: 1800 - state: present - become: yes - register: result - -- name: Add interface aggregate - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}", mtu: 2000, description: test-interface-1 } - - { name: "{{ test_interface_2 }}", mtu: 2000, description: test-interface-2 } - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"mtu 2000" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"description test-interface-2" in result.commands' - - '"mtu 2000" in result.commands' - -- name: Add interface aggregate (idempotent) - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}", mtu: 2000, description: test-interface-1 } - - { name: "{{ test_interface_2 }}", mtu: 2000, description: test-interface-2 } - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Disable interface aggregate - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - enabled: False - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"shutdown" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"shutdown" in result.commands' - -- name: Enable interface aggregate - eos_interface: - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - enabled: True - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no shutdown" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"no shutdown" in result.commands' - -- name: loopback interface setup - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: absent - become: yes - -- name: Create loopback interface aggregate - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface loopback9" in result.commands' - - '"interface loopback10" in result.commands' - -- name: Delete loopback interface aggregate - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface loopback9" in result.commands' - - '"no interface loopback10" in result.commands' - -- name: Delete loopback interface aggregate (idempotent) - eos_interface: - aggregate: - - name: loopback9 - - name: loopback10 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END eos_interface eapi/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_interface/tests/eapi/intent.yaml b/test/integration/targets/eos_interface/tests/eapi/intent.yaml deleted file mode 100644 index 1be696018e..0000000000 --- a/test/integration/targets/eos_interface/tests/eapi/intent.yaml +++ /dev/null @@ -1,156 +0,0 @@ ---- -- debug: msg="START eos_interface eapi/intent.yaml on connection={{ ansible_connection }}" - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - test_interface_2: ethernet2 - -- name: Make sure LLDP is running - eos_config: - lines: lldp run - become: yes - -- name: Check intent arguments - eos_interface: - name: "{{ test_interface_1 }}" - state: up - tx_rate: ge(0) - rx_rate: ge(0) - become: yes - register: result - -- assert: - that: - - "result.failed == false" - -- name: Check intent arguments (failed condition) - eos_interface: - name: "{{ test_interface_1 }}" - state: down - tx_rate: gt(0) - rx_rate: lt(0) - ignore_errors: yes - become: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(down)' in result.failed_conditions" - - "'tx_rate gt(0)' in result.failed_conditions" - - "'rx_rate lt(0)' in result.failed_conditions" - -- name: Config + intent - eos_interface: - name: "{{ test_interface_1 }}" - enabled: False - state: down - become: yes - register: result - -- assert: - that: - - "result.failed == false" - -- name: Config + intent (fail) - eos_interface: - name: "{{ test_interface_1 }}" - enabled: False - state: up - ignore_errors: yes - become: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(up)' in result.failed_conditions" - -- name: Register show neighbors detail - eos_command: - commands: - - show lldp neighbors management1 - become: yes - register: show_lldp_neighbors_result - -- block: - - name: Check neighbors intent arguments - eos_interface: - name: management1 - neighbors: - - port: eth0 - host: an-vyos-02 - become: yes - register: result - - - assert: - that: - - "result.failed == false" - - - name: Check neighbors intent arguments (failed condition) - eos_interface: - name: management1 - neighbors: - - port: dummy_port - host: dummy_host - ignore_errors: yes - become: yes - register: result - - - assert: - that: - - "result.failed == true" - - "'host dummy_host' in result.failed_conditions" - - "'port dummy_port' in result.failed_conditions" - when: '"an-vyos-02" in show_lldp_neighbors_result.stdout[0]' - -- name: Aggregate config + intent (pass) - eos_interface: - aggregate: - - name: "{{ test_interface_1 }}" - enabled: True - state: up - ignore_errors: yes - become: yes - register: result - -- assert: - that: - - "result.failed == false" - -- block: - - name: Aggregate neighbors intent (pass) - eos_interface: - aggregate: - - name: management1 - neighbors: - - port: eth0 - host: an-vyos-02 - ignore_errors: yes - become: yes - register: result - - - assert: - that: - - "result.failed == false" - - - name: Aggregate neighbors intent (fail) - eos_interface: - aggregate: - - name: management1 - neighbors: - - port: eth0 - host: an-vyos-02 - - port: dummy_port - host: dummy_host - ignore_errors: yes - become: yes - register: result - - - assert: - that: - - "result.failed == true" - - "'host dummy_host' in result.failed_conditions" - - "'port dummy_port' in result.failed_conditions" - when: "'an-vyos-02' in show_lldp_neighbors_result.stdout[0]" diff --git a/test/integration/targets/eos_interface/tests/eapi/net_interface.yaml b/test/integration/targets/eos_interface/tests/eapi/net_interface.yaml deleted file mode 100644 index 03d6dd12cc..0000000000 --- a/test/integration/targets/eos_interface/tests/eapi/net_interface.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- debug: msg="START eos eapi/net_interface.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - -- name: Configure interface (setup) - net_interface: - name: "{{ test_interface_1 }}" - description: test-interface-1 - mtu: 1800 - state: present - become: yes - register: result - -- name: Configure interface description using platform agnostic module - net_interface: - name: "{{ test_interface_1 }}" - description: test-interface-initial - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface-initial" in result.commands' - -- name: Confgure interface parameters - net_interface: - name: "{{ test_interface_1 }}" - description: test-interface - mtu: 2000 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"description test-interface" in result.commands' - - '"mtu 2000" in result.commands' - -- debug: msg="END eos eapi/net_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_interfaces/defaults/main.yaml b/test/integration/targets/eos_interfaces/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_interfaces/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_interfaces/meta/main.yml b/test/integration/targets/eos_interfaces/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_interfaces/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_interfaces/tasks/main.yaml b/test/integration/targets/eos_interfaces/tasks/main.yaml deleted file mode 100644 index 068963b4c3..0000000000 --- a/test/integration/targets/eos_interfaces/tasks/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index b447fb6b72..0000000000 --- a/test/integration/targets/eos_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- name: Returns interfaces to default parameters - eos_interfaces: - config: "{{ config }}" - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0" - -- set_fact: - expected_config: - - name: Ethernet1 - duplex: auto - enabled: True - - name: Ethernet2 - duplex: auto - enabled: True - mtu: "3000" - -- assert: - that: - - "expected_config|difference(ansible_facts.network_resources.interfaces)|length == 0" diff --git a/test/integration/targets/eos_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 8030f09d58..0000000000 --- a/test/integration/targets/eos_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - enabled: True - - name: Ethernet2 - description: 'Configured by Ansible' - speed: '10' - duplex: full - enabled: False - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- name: Merge provided configuration with device configuration - eos_interfaces: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0" - -- set_fact: - expected_config: - - name: Ethernet1 - description: Interface 1 - speed: 40g - duplex: full - enabled: True - - name: Ethernet2 - description: 'Configured by Ansible' - speed: '10' - duplex: full - enabled: False - mtu: "3000" - -- assert: - that: - - "expected_config|difference(ansible_facts.network_resources.interfaces)|length == 0" diff --git a/test/integration/targets/eos_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index b1b1777bfe..0000000000 --- a/test/integration/targets/eos_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - duplex: auto - enabled: true - - name: Ethernet2 - duplex: auto - description: 'Configured by Ansible' - enabled: false - - name: Management1 - enabled: true - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- name: Overrides device configuration of all interfaces with provided configuration - eos_interfaces: - config: "{{ config }}" - state: overridden - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0" - -- assert: - that: - - "config|difference(ansible_facts.network_resources.interfaces)|length == 0" diff --git a/test/integration/targets/eos_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index ab9fd6fd2e..0000000000 --- a/test/integration/targets/eos_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - duplex: auto - enabled: True - - name: Ethernet2 - description: 'Configured by Ansible' - duplex: auto - enabled: False - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- name: Replaces device configuration of listed interfaces with provided configuration - eos_interfaces: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0" - -- assert: - that: - - "config|difference(ansible_facts.network_resources.interfaces)|length == 0" diff --git a/test/integration/targets/eos_interfaces/tests/cli/reset_config.yml b/test/integration/targets/eos_interfaces/tests/cli/reset_config.yml deleted file mode 100644 index 0613582955..0000000000 --- a/test/integration/targets/eos_interfaces/tests/cli/reset_config.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- name: Reset initial config - cli_config: - config: | - interface Ethernet1 - description "Interface 1" - no shutdown - no mtu - speed forced 40gfull - interface Ethernet2 - no description - no shutdown - mtu 3000 - speed auto - become: yes - -- eos_facts: - gather_network_resources: interfaces - become: yes - -- set_fact: - expected_config: - - name: Ethernet1 - description: Interface 1 - speed: 40g - duplex: full - enabled: True - - name: Ethernet2 - enabled: True - mtu: "3000" - duplex: auto - -- assert: - that: - - "expected_config|difference(ansible_facts.network_resources.interfaces) == []" diff --git a/test/integration/targets/eos_l2_interface/defaults/main.yaml b/test/integration/targets/eos_l2_interface/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_l2_interface/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_l2_interface/meta/main.yaml b/test/integration/targets/eos_l2_interface/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_l2_interface/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_l2_interface/tasks/cli.yaml b/test/integration/targets/eos_l2_interface/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_l2_interface/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_l2_interface/tasks/eapi.yaml b/test/integration/targets/eos_l2_interface/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_l2_interface/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_l2_interface/tasks/main.yaml b/test/integration/targets/eos_l2_interface/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_l2_interface/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_l2_interface/tests/cli/basic.yaml b/test/integration/targets/eos_l2_interface/tests/cli/basic.yaml deleted file mode 100644 index 80482e6626..0000000000 --- a/test/integration/targets/eos_l2_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,108 +0,0 @@ ---- -- debug: - msg: "START eos_l2_interface cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Delete test interface switchports - eos_l2_interface: &clear - name: Ethernet1 - state: absent - become: yes - -- name: Set switchport mode to access on vlan 4000 - eos_l2_interface: &vlan-4000 - name: Ethernet1 - state: present - mode: access - access_vlan: 4000 - become: yes - register: result - -- assert: &changed - that: - - 'result.changed == true' - -- name: Set switchport mode to access on vlan 4000 again (idempotent) - eos_l2_interface: *vlan-4000 - become: yes - register: result - -- assert: &unchanged - that: - - 'result.changed == false' - -- name: Change access vlan to 4001 - eos_l2_interface: &vlan-4001 - name: Ethernet1 - state: present - mode: access - access_vlan: 4001 - become: yes - register: result - -- assert: *changed - -- name: Change access vlan to 4001 again (idempotent) - eos_l2_interface: *vlan-4001 - become: yes - register: result - -- assert: *unchanged - -- name: Change switchport mode to trunk - eos_l2_interface: &trunk - name: Ethernet1 - state: present - mode: trunk - become: yes - register: result - -- assert: *changed - -- name: Change switchport mode to trunk (idempotent) - eos_l2_interface: *trunk - become: yes - register: result - -- assert: *unchanged - -- name: Change switchport mode to trunk and set native vlan to 4001 - eos_l2_interface: &trunk-native - name: Ethernet1 - state: present - mode: trunk - native_vlan: 4001 - become: yes - register: result - -- assert: *changed - -- name: Change switchport mode to trunk and set native vlan to 4001 again (idempotent) - eos_l2_interface: *trunk-native - become: yes - register: result - -- assert: *unchanged - -- name: Set trunk allowed vlans to 20 and 4000 - eos_l2_interface: &trunk-allowed - name: Ethernet1 - state: present - mode: trunk - trunk_allowed_vlans: 20,4000 - become: yes - register: result - -- assert: *changed - -- name: Set trunk allowed vlans to 20 and 4000 again (idempotent) - eos_l2_interface: *trunk-allowed - become: yes - register: result - -- assert: *unchanged - -- name: Tear down switchports - eos_l2_interface: *clear - become: yes - -- debug: msg="END eos_l2_interface cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml b/test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml deleted file mode 100644 index d406b0bd4a..0000000000 --- a/test/integration/targets/eos_l2_interface/tests/cli/no_interface.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START eos_l2_interface/cli/no_interface.yaml on connection={{ ansible_connection }}" - -- name: Create fake interface - eos_interface: - name: Management0 - become: yes - -- block: - - name: eos_l2_interface shouldn't fail - eos_l2_interface: &no_switchport - name: Ethernet1 - state: absent - become: yes - register: result - - - assert: - that: "'Interface does not exist' in result.warnings[0]" - - always: - - name: Cleanup fake interface - cli_config: - config: no interface Management0 - become: yes - -- name: eos_l2_interface should still not fail - eos_l2_interface: *no_switchport - become: yes - register: result - -- assert: - that: "result.warnings is not defined" - -- debug: - msg: "END eos_l2_interface/cli/no_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l2_interface/tests/eapi/basic.yaml b/test/integration/targets/eos_l2_interface/tests/eapi/basic.yaml deleted file mode 100644 index d87b71782b..0000000000 --- a/test/integration/targets/eos_l2_interface/tests/eapi/basic.yaml +++ /dev/null @@ -1,108 +0,0 @@ ---- -- debug: - msg: "START eos_l2_interface eapi/basic.yaml on connection={{ ansible_connection }}" - -- name: Delete test interface switchports - eos_l2_interface: &clear - name: Ethernet1 - state: absent - become: yes - -- name: Set switchport mode to access on vlan 4000 - eos_l2_interface: &vlan-4000 - name: Ethernet1 - state: present - mode: access - access_vlan: 4000 - become: yes - register: result - -- assert: &changed - that: - - 'result.changed == true' - -- name: Set switchport mode to access on vlan 4000 again (idempotent) - eos_l2_interface: *vlan-4000 - become: yes - register: result - -- assert: &unchanged - that: - - 'result.changed == false' - -- name: Change access vlan to 4001 - eos_l2_interface: &vlan-4001 - name: Ethernet1 - state: present - mode: access - access_vlan: 4001 - become: yes - register: result - -- assert: *changed - -- name: Change access vlan to 4001 again (idempotent) - eos_l2_interface: *vlan-4001 - become: yes - register: result - -- assert: *unchanged - -- name: Change switchport mode to trunk - eos_l2_interface: &trunk - name: Ethernet1 - state: present - mode: trunk - become: yes - register: result - -- assert: *changed - -- name: Change switchport mode to trunk (idempotent) - eos_l2_interface: *trunk - become: yes - register: result - -- assert: *unchanged - -- name: Change switchport mode to trunk and set native vlan to 4001 - eos_l2_interface: &trunk-native - name: Ethernet1 - state: present - mode: trunk - native_vlan: 4001 - become: yes - register: result - -- assert: *changed - -- name: Change switchport mode to trunk and set native vlan to 4001 again (idempotent) - eos_l2_interface: *trunk-native - become: yes - register: result - -- assert: *unchanged - -- name: Set trunk allowed vlans to 20 and 4000 - eos_l2_interface: &trunk-allowed - name: Ethernet1 - state: present - mode: trunk - trunk_allowed_vlans: 20,4000 - become: yes - register: result - -- assert: *changed - -- name: Set trunk allowed vlans to 20 and 4000 again (idempotent) - eos_l2_interface: *trunk-allowed - become: yes - register: result - -- assert: *unchanged - -- name: Tear down switchports - eos_l2_interface: *clear - become: yes - -- debug: msg="END eos_l2_interface eapi/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml b/test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml deleted file mode 100644 index a5b9977515..0000000000 --- a/test/integration/targets/eos_l2_interface/tests/eapi/no_interface.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: - msg: "START eos_l2_interface/eapi/no_interface.yaml on connection={{ ansible_connection }}" - -- name: Create fake interface - eos_interface: - name: Management0 - become: yes - -- block: - - name: eos_l2_interface shouldn't fail - eos_l2_interface: &no_switchport - name: Ethernet1 - state: absent - become: yes - register: result - - - assert: - that: "'Interface does not exist' in result.warnings[0]" - - always: - - name: Cleanup fake interface - eos_config: - lines: - - no interface Management0 - become: yes - -- name: eos_l2_interface should still not fail - eos_l2_interface: *no_switchport - become: yes - register: result - -- assert: - that: "result.warnings is not defined" - -- debug: - msg: "END eos_l2_interface/eapi/no_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l2_interfaces/defaults/main.yaml b/test/integration/targets/eos_l2_interfaces/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_l2_interfaces/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_l2_interfaces/meta/main.yml b/test/integration/targets/eos_l2_interfaces/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_l2_interfaces/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_l2_interfaces/tasks/main.yaml b/test/integration/targets/eos_l2_interfaces/tasks/main.yaml deleted file mode 100644 index 35abc8e876..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tasks/main.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- block: - - name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli - - always: - - name: Clean up test state - include: "{{ role_path }}/tests/cli/cleanup.yml ansible_connection=network_cli" diff --git a/test/integration/targets/eos_l2_interfaces/tests/cli/cleanup.yml b/test/integration/targets/eos_l2_interfaces/tests/cli/cleanup.yml deleted file mode 100644 index 2f4e7d1185..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tests/cli/cleanup.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Remove all vlans - cli_config: - config: no vlan 1-4094 - become: yes - -- name: Completely remove vlans from interfaces - cli_config: - config: | - interface {{ item }} - no switchport mode - no switchport access vlan - no switchport trunk native vlan - with_items: - - Ethernet1 - - Ethernet2 - become: yes diff --git a/test/integration/targets/eos_l2_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_l2_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 6bc0099e29..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - - name: Ethernet2 - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- name: Delete EOS L2 interfaces as in given arguments. - eos_l2_interfaces: - config: "{{ config }}" - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }} + [{'name': 'Management1'}]" - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l2_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_l2_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 68cc55c0d8..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - mode: trunk - trunk: - native_vlan: 10 - - name: Ethernet2 - access: - vlan: 30 - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- name: Merge provided configuration with device configuration - eos_l2_interfaces: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: - - name: Ethernet1 - mode: trunk - access: - vlan: 20 - trunk: - native_vlan: 10 - - name: Ethernet2 - mode: trunk - access: - vlan: 30 - trunk: - native_vlan: 20 - - name: Management1 - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l2_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_l2_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 8fe7f45990..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet2 - access: - vlan: 30 - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- name: Override device configuration of all L2 interfaces on device with provided configuration. - eos_l2_interfaces: - config: "{{ config }}" - state: overridden - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }} + [{'name': 'Ethernet1'}, {'name': 'Management1'}]" - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l2_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_l2_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index 4b697cb3fb..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - trunk: - native_vlan: 20 - trunk_allowed_vlans: - - 5-10 - - "15" - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- name: Replace device configuration of specified L2 interfaces with provided configuration. - eos_l2_interfaces: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }} + [{'mode': 'trunk', 'name': 'Ethernet2', 'trunk': {'native_vlan': 20}}, {'name': 'Management1'}]" - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l2_interfaces/tests/cli/reset_config.yml b/test/integration/targets/eos_l2_interfaces/tests/cli/reset_config.yml deleted file mode 100644 index b14f0d1d9a..0000000000 --- a/test/integration/targets/eos_l2_interfaces/tests/cli/reset_config.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: Reset state - cli_config: - config: | - interface Ethernet1 - switchport access vlan 20 - no switchport mode - no switchport trunk native vlan - no switchport trunk allowed vlan - interface Ethernet2 - no switchport access vlan - switchport trunk native vlan 20 - switchport mode trunk - become: yes - -- eos_facts: - gather_network_resources: l2_interfaces - become: yes - -- set_fact: - expected_config: - - name: Ethernet1 - access: - vlan: 20 - - mode: trunk - name: Ethernet2 - trunk: - native_vlan: 20 - - name: Management1 - -- assert: - that: - - "ansible_facts.network_resources.l2_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l3_interface/defaults/main.yaml b/test/integration/targets/eos_l3_interface/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_l3_interface/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_l3_interface/meta/main.yaml b/test/integration/targets/eos_l3_interface/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_l3_interface/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_l3_interface/tasks/cli.yaml b/test/integration/targets/eos_l3_interface/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_l3_interface/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_l3_interface/tasks/eapi.yaml b/test/integration/targets/eos_l3_interface/tasks/eapi.yaml deleted file mode 100644 index 1109c6bf6a..0000000000 --- a/test/integration/targets/eos_l3_interface/tasks/eapi.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_l3_interface/tasks/main.yaml b/test/integration/targets/eos_l3_interface/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_l3_interface/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml b/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml deleted file mode 100644 index 56b96541aa..0000000000 --- a/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,194 +0,0 @@ ---- -- debug: - msg: "START eos_l3_interface cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - test_interface_2: ethernet2 - ipv4_addr_1: 192.0.2.5/24 - ipv4_addr_2: 198.51.100.15/24 - ipv4_addr_3: 203.0.113.25/28 - ipv4_addr_4: 203.0.113.225/28 - ipv6_addr_1: 2001:DB8:123::/64 - ipv6_addr_2: 2001:DB8:ABC::/64 - ipv6_addr_3: 2001:DB8::/48 - ipv6_addr_4: 2001:DB8:FFFF::/90 - -- name: Delete interface ipv4 and ipv6 address(setup) - eos_l3_interface: &clear - name: "{{ test_interface_1 }}" - state: absent - become: yes - register: result - -- name: Configure interface ipv4 address - eos_l3_interface: &ipv4 - name: "{{ test_interface_1 }}" - ipv4: "{{ ipv4_addr_1 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_1 }}" in result.commands' - -- name: Configure interface ipv4 address (idempotent) - eos_l3_interface: *ipv4 - become: yes - register: result - -- assert: &unchanged - that: - - 'result.changed == false' - -- name: Change interface ipv4 address - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv4: "{{ ipv4_addr_2 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_2 }}" in result.commands' - -- name: Configure interface ipv6 address - eos_l3_interface: &ipv6 - name: "{{ test_interface_1 }}" - ipv6: "{{ ipv6_addr_1 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - -- name: Configure interface ipv6 address (idempotent) - eos_l3_interface: *ipv6 - become: yes - register: result - -- assert: *unchanged - -- name: Change interface ipv6 address - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv6: "{{ ipv6_addr_2 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - -- name: Delete interface ipv4 and ipv6 address - eos_l3_interface: *clear - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no ip address" in result.commands' - - '"no ipv6 address" in result.commands' - -- name: Delete interface ipv4 and ipv6 address (idempotent) - eos_l3_interface: *clear - become: yes - register: result - -- assert: *unchanged - -- name: Delete second interface ipv4 and ipv6 address (setup) - eos_l3_interface: - name: "{{ test_interface_2 }}" - state: absent - become: yes - register: result - -- name: Configure ipv4 and ipv6 address using aggregate - eos_l3_interface: &aggregate - aggregate: - - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_3 }}", ipv6: "{{ ipv6_addr_3 }}" } - - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_1 }}", ipv6: "{{ ipv6_addr_1 }}" } - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_3 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_3 }}" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address {{ ipv4_addr_1 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - -- name: Configure ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: *aggregate - become: yes - register: result - -- assert: *unchanged - -- name: Change ipv4 and ipv6 address using aggregate - eos_l3_interface: - aggregate: - - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_2 }}", ipv6: "{{ ipv6_addr_2 }}" } - - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_4 }}", ipv6: "{{ ipv6_addr_4 }}" } - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_2 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address {{ ipv4_addr_4 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_4 }}" in result.commands' - - -- name: Delete ipv4 and ipv6 address using aggregate - eos_l3_interface: &clear_both - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no ip address" in result.commands' - - '"no ipv6 address" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"no ip address" in result.commands' - - '"no ipv6 address" in result.commands' - -- name: Delete ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: *clear_both - become: yes - register: result - -- assert: *unchanged - -- debug: - msg: "END eos_l3_interface cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l3_interface/tests/cli/net_l3_interface.yaml b/test/integration/targets/eos_l3_interface/tests/cli/net_l3_interface.yaml deleted file mode 100644 index 4e63075e6c..0000000000 --- a/test/integration/targets/eos_l3_interface/tests/cli/net_l3_interface.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- debug: msg="START eos cli/net_l3_interface.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - -- name: Delete interface ipv4 and ipv6 address(setup) - net_l3_interface: - name: "{{ test_interface_1 }}" - state: absent - become: yes - register: result - -- name: Configure interface ipv4 address using platform agnostic module - net_l3_interface: - name: "{{ test_interface_1 }}" - ipv4: 192.108.0.1/24 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 192.108.0.1/24" in result.commands' - -- name: Delete interface ipv4 and ipv6 address(teardown) - net_l3_interface: - name: "{{ test_interface_1 }}" - state: absent - become: yes - register: result - -- debug: msg="END eos cli/net_l3_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml b/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml deleted file mode 100644 index 1918950ca7..0000000000 --- a/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml +++ /dev/null @@ -1,194 +0,0 @@ ---- -- debug: - msg: "START eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}" - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - test_interface_2: ethernet2 - ipv4_addr_1: 192.0.2.5/24 - ipv4_addr_2: 198.51.100.15/24 - ipv4_addr_3: 203.0.113.25/28 - ipv4_addr_4: 203.0.113.225/28 - ipv6_addr_1: 2001:DB8:123::/64 - ipv6_addr_2: 2001:DB8:ABC::/64 - ipv6_addr_3: 2001:DB8::/48 - ipv6_addr_4: 2001:DB8:FFFF::/90 - -- name: Delete interface ipv4 and ipv6 address(setup) - eos_l3_interface: &clear - name: "{{ test_interface_1 }}" - state: absent - become: yes - register: result - -- name: Configure interface ipv4 address - eos_l3_interface: &ipv4 - name: "{{ test_interface_1 }}" - ipv4: "{{ ipv4_addr_1 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_1 }}" in result.commands' - -- name: Configure interface ipv4 address (idempotent) - eos_l3_interface: *ipv4 - become: yes - register: result - -- assert: &unchanged - that: - - 'result.changed == false' - -- name: Change interface ipv4 address - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv4: "{{ ipv4_addr_2 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_2 }}" in result.commands' - -- name: Configure interface ipv6 address - eos_l3_interface: &ipv6 - name: "{{ test_interface_1 }}" - ipv6: "{{ ipv6_addr_1 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - -- name: Configure interface ipv6 address (idempotent) - eos_l3_interface: *ipv6 - become: yes - register: result - -- assert: *unchanged - -- name: Change interface ipv6 address - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv6: "{{ ipv6_addr_2 }}" - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - -- name: Delete interface ipv4 and ipv6 address - eos_l3_interface: *clear - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no ip address" in result.commands' - - '"no ipv6 address" in result.commands' - -- name: Delete interface ipv4 and ipv6 address (idempotent) - eos_l3_interface: *clear - become: yes - register: result - -- assert: *unchanged - -- name: Delete second interface ipv4 and ipv6 address (setup) - eos_l3_interface: - name: "{{ test_interface_2 }}" - state: absent - become: yes - register: result - -- name: Configure ipv4 and ipv6 address using aggregate - eos_l3_interface: &aggregate - aggregate: - - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_3 }}", ipv6: "{{ ipv6_addr_3 }}" } - - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_1 }}", ipv6: "{{ ipv6_addr_1 }}" } - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_3 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_3 }}" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address {{ ipv4_addr_1 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - -- name: Configure ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: *aggregate - become: yes - register: result - -- assert: *unchanged - -- name: Change ipv4 and ipv6 address using aggregate - eos_l3_interface: - aggregate: - - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_2 }}", ipv6: "{{ ipv6_addr_2 }}" } - - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_4 }}", ipv6: "{{ ipv6_addr_4 }}" } - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address {{ ipv4_addr_2 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address {{ ipv4_addr_4 }}" in result.commands' - - '"ipv6 address {{ ipv6_addr_4 }}" in result.commands' - - -- name: Delete ipv4 and ipv6 address using aggregate - eos_l3_interface: &clear_both - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"no ip address" in result.commands' - - '"no ipv6 address" in result.commands' - - '"interface {{ test_interface_2 }}" in result.commands' - - '"no ip address" in result.commands' - - '"no ipv6 address" in result.commands' - -- name: Delete ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: *clear_both - become: yes - register: result - -- assert: *unchanged - -- debug: - msg: "END eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml b/test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml deleted file mode 100644 index 9d81bea893..0000000000 --- a/test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- debug: msg="START eos eapi/net_l3_interface.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - -- name: Delete interface ipv4 and ipv6 address(setup) - net_l3_interface: - name: "{{ test_interface_1 }}" - state: absent - become: yes - register: result - -- name: Configure interface ipv4 address using platform agnostic module - net_l3_interface: - name: "{{ test_interface_1 }}" - ipv4: 192.108.0.1/24 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 192.108.0.1/24" in result.commands' - -- name: Delete interface ipv4 and ipv6 address(teardown) - net_l3_interface: - name: "{{ test_interface_1 }}" - state: absent - become: yes - register: result - -- debug: msg="END eos eapi/net_l3_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l3_interfaces/defaults/main.yaml b/test/integration/targets/eos_l3_interfaces/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_l3_interfaces/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_l3_interfaces/meta/main.yaml b/test/integration/targets/eos_l3_interfaces/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_l3_interfaces/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_l3_interfaces/tasks/main.yaml b/test/integration/targets/eos_l3_interfaces/tasks/main.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_l3_interfaces/tasks/main.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_l3_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_l3_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 43483358f6..0000000000 --- a/test/integration/targets/eos_l3_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - - name: Ethernet2 - other_config: - - name: Management1 - ipv4: - - address: dhcp - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- name: Delete EOS L3 interfaces as in given arguments. - eos_l3_interfaces: - config: "{{ config }}" - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.after) == []" - become: yes - -- set_fact: - expected_config: "{{ config }} + {{ other_config }}" - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l3_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_l3_interfaces/tests/cli/merged.yaml deleted file mode 100644 index dd36fd371d..0000000000 --- a/test/integration/targets/eos_l3_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - ipv4: - - address: 198.51.100.14/24 - - name: Ethernet2 - ipv4: - - address: 203.0.113.227/31 - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- name: Merge provided configuration with device configuration. - eos_l3_interfaces: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.after) == []" - become: yes - -- set_fact: - expected_config: - - name: Ethernet1 - ipv4: - - address: 198.51.100.14/24 - - address: 203.0.113.27/31 - secondary: true - - name: Ethernet2 - ipv4: - - address: 203.0.113.227/31 - ipv6: - - address: 2001:db8::1/64 - - name: Management1 - ipv4: - - address: dhcp - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l3_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_l3_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index d7c7b97e7d..0000000000 --- a/test/integration/targets/eos_l3_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - ipv6: - - address: 2001:db8:feed::1/96 - - name: Ethernet2 - ipv6: - - address: 2001:db8::1/64 - - name: Management1 - ipv4: - - address: dhcp - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- name: Override device configuration of all L3 interfaces on device with provided configuration. - eos_l3_interfaces: - config: "{{ config }}" - state: overridden - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.after) == []" - become: yes - -- set_fact: - expected_config: "{{ config }}" - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l3_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_l3_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index f1f84ab2a5..0000000000 --- a/test/integration/targets/eos_l3_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet2 - ipv4: - - address: 203.0.113.205/31 - other_config: - - name: Ethernet1 - ipv4: - - address: 192.0.2.12/24 - - address: 203.0.113.27/31 - secondary: true - - name: Management1 - ipv4: - - address: dhcp - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- name: Replace device configuration of specified L3 interfaces with provided configuration. - eos_l3_interfaces: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.after) == []" - become: yes - -- set_fact: - expected_config: "{{ config }} + {{ other_config }}" - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_l3_interfaces/tests/cli/reset_config.yml b/test/integration/targets/eos_l3_interfaces/tests/cli/reset_config.yml deleted file mode 100644 index 3efc086a4b..0000000000 --- a/test/integration/targets/eos_l3_interfaces/tests/cli/reset_config.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- name: Reset state - cli_config: - config: | - interface Ethernet1 - ip address 192.0.2.12/24 - ip address 203.0.113.27/31 secondary - no ipv6 address - interface Ethernet2 - no ip address - ipv6 address 2001:db8::1/64 - interface Management1 - ip address dhcp - no ipv6 address - become: yes - -- eos_facts: - gather_network_resources: l3_interfaces - become: yes - -- set_fact: - expected_config: - - name: Ethernet1 - ipv4: - - address: 192.0.2.12/24 - - address: 203.0.113.27/31 - secondary: true - - name: Ethernet2 - ipv6: - - address: 2001:db8::1/64 - - name: Management1 - ipv4: - - address: dhcp - -- assert: - that: - - "ansible_facts.network_resources.l3_interfaces|symmetric_difference(expected_config) == []" diff --git a/test/integration/targets/eos_lacp/defaults/main.yaml b/test/integration/targets/eos_lacp/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_lacp/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_lacp/meta/main.yml b/test/integration/targets/eos_lacp/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_lacp/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_lacp/tasks/main.yaml b/test/integration/targets/eos_lacp/tasks/main.yaml deleted file mode 100644 index 068963b4c3..0000000000 --- a/test/integration/targets/eos_lacp/tasks/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lacp/tests/cli/deleted.yaml b/test/integration/targets/eos_lacp/tests/cli/deleted.yaml deleted file mode 100644 index 78367c21af..0000000000 --- a/test/integration/targets/eos_lacp/tests/cli/deleted.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- eos_facts: - gather_network_resources: lacp - become: yes - -- name: Returns lacp to default parameters - eos_lacp: - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp == result.before" - -- eos_facts: - gather_network_resources: lacp - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp == result.after" - -- assert: - that: - - "ansible_facts.network_resources.lacp == {}" diff --git a/test/integration/targets/eos_lacp/tests/cli/merged.yaml b/test/integration/targets/eos_lacp/tests/cli/merged.yaml deleted file mode 100644 index 9f9b96be92..0000000000 --- a/test/integration/targets/eos_lacp/tests/cli/merged.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - system: - priority: 20 - -- eos_facts: - gather_network_resources: lacp - become: yes - -- name: Merge provided lacp configuration with device configuration - eos_lacp: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp == result.before" - -- eos_facts: - gather_network_resources: lacp - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp == result.after" - -- assert: - that: - - "config == ansible_facts.network_resources.lacp" diff --git a/test/integration/targets/eos_lacp/tests/cli/replaced.yaml b/test/integration/targets/eos_lacp/tests/cli/replaced.yaml deleted file mode 100644 index 4272d0cdc7..0000000000 --- a/test/integration/targets/eos_lacp/tests/cli/replaced.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - system: - priority: 20 - -- eos_facts: - gather_network_resources: lacp - become: yes - -- name: Replaces device lacp configuration with provided configuration - eos_lacp: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp == result.before" - -- eos_facts: - gather_network_resources: lacp - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp == result.after" - -- assert: - that: - - "config == ansible_facts.network_resources.lacp" diff --git a/test/integration/targets/eos_lacp/tests/cli/reset_config.yml b/test/integration/targets/eos_lacp/tests/cli/reset_config.yml deleted file mode 100644 index 9bfbbf5244..0000000000 --- a/test/integration/targets/eos_lacp/tests/cli/reset_config.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Reset initial config - cli_config: - config: | - lacp system-priority 10 - become: yes - -- eos_facts: - gather_network_resources: lacp - become: yes - -- set_fact: - expected_config: - system: - priority: 10 - -- assert: - that: - - "expected_config == ansible_facts.network_resources.lacp" diff --git a/test/integration/targets/eos_lacp_interfaces/defaults/main.yaml b/test/integration/targets/eos_lacp_interfaces/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_lacp_interfaces/meta/main.yml b/test/integration/targets/eos_lacp_interfaces/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_lacp_interfaces/tasks/main.yaml b/test/integration/targets/eos_lacp_interfaces/tasks/main.yaml deleted file mode 100644 index 068963b4c3..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/tasks/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lacp_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_lacp_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index ceed51e75b..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - other_config: - - name: Ethernet2 - rate: fast - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- name: Returns vlans to default parameters - eos_lacp_interfaces: - config: "{{ config }}" - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ other_config }}" - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lacp_interfaces) == []" diff --git a/test/integration/targets/eos_lacp_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_lacp_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 8f3a4eadff..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - rate: fast - - name: Ethernet2 - rate: normal - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- name: Merge provided configuration with device configuration - eos_lacp_interfaces: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: - - name: Ethernet1 - port_priority: 30 - rate: fast - - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lacp_interfaces) == []" diff --git a/test/integration/targets/eos_lacp_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_lacp_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index b858a822dc..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - rate: fast - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- name: Overrides device configuration of all vlans with provided configuration - eos_lacp_interfaces: - config: "{{ config }}" - state: overridden - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }}" - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lacp_interfaces) == []" diff --git a/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index f33b32fd15..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - rate: fast - port_priority: 45 - other_config: - - name: Ethernet2 - rate: fast - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- name: Replaces device configuration of listed vlans with provided configuration - eos_lacp_interfaces: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }} + {{ other_config }}" - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lacp_interfaces) == []" diff --git a/test/integration/targets/eos_lacp_interfaces/tests/cli/reset_config.yml b/test/integration/targets/eos_lacp_interfaces/tests/cli/reset_config.yml deleted file mode 100644 index 45caea1f4a..0000000000 --- a/test/integration/targets/eos_lacp_interfaces/tests/cli/reset_config.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Reset initial config - cli_config: - config: | - interface Ethernet1 - lacp port-priority 30 - lacp rate normal - interface Ethernet2 - no lacp port-priority - lacp rate fast - become: yes - -- eos_facts: - gather_network_resources: lacp_interfaces - become: yes - -- set_fact: - expected_config: - - name: Ethernet1 - port_priority: 30 - - name: Ethernet2 - rate: fast - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lacp_interfaces) == []" diff --git a/test/integration/targets/eos_lag_interfaces/defaults/main.yaml b/test/integration/targets/eos_lag_interfaces/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_lag_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_lag_interfaces/meta/main.yaml b/test/integration/targets/eos_lag_interfaces/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_lag_interfaces/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_lag_interfaces/tasks/main.yaml b/test/integration/targets/eos_lag_interfaces/tasks/main.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_lag_interfaces/tasks/main.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lag_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_lag_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index dbf63d64bf..0000000000 --- a/test/integration/targets/eos_lag_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: "Port-Channel5" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- name: Delete EOS L3 interfaces as in given arguments. - eos_lag_interfaces: - config: "{{ config }}" - state: deleted - become: yes - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces == []" diff --git a/test/integration/targets/eos_lag_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_lag_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 2399cc73e1..0000000000 --- a/test/integration/targets/eos_lag_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: "Port-Channel5" - members: - - member: Ethernet2 - mode: "on" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- name: Merge provided configuration with device configuration. - eos_lag_interfaces: - config: "{{ config }}" - state: merged - become: yes - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" - -- set_fact: - expected_config: - - name: "Port-Channel5" - members: - - member: Ethernet1 - mode: "on" - - member: Ethernet2 - mode: "on" - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(expected_config)|length == 0" diff --git a/test/integration/targets/eos_lag_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_lag_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index e62d3f335b..0000000000 --- a/test/integration/targets/eos_lag_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: "Port-Channel10" - members: - - member: Ethernet2 - mode: "on" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- name: Override device configuration of all LAGs on device with provided configuration. - eos_lag_interfaces: - config: "{{ config }}" - state: overridden - become: yes - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(config)|length == 0" diff --git a/test/integration/targets/eos_lag_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_lag_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index f1e8a255f8..0000000000 --- a/test/integration/targets/eos_lag_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: "Port-Channel10" - members: - - member: Ethernet2 - mode: "on" - other_config: - - name: "Port-Channel5" - members: - - member: Ethernet1 - mode: "on" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- name: Replace device configuration of specified LAGs with provided configuration. - eos_lag_interfaces: - config: "{{ config }}" - state: replaced - become: yes - register: result - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.before)|length == 0" - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(result.after)|length == 0" - -- set_fact: - expected_config: "{{ config }} + {{ other_config }}" - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(expected_config)|length == 0" diff --git a/test/integration/targets/eos_lag_interfaces/tests/cli/reset_config.yml b/test/integration/targets/eos_lag_interfaces/tests/cli/reset_config.yml deleted file mode 100644 index ba7cf513a2..0000000000 --- a/test/integration/targets/eos_lag_interfaces/tests/cli/reset_config.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: Reset state - cli_config: - config: | - interface Ethernet1 - channel-group 5 mode on - interface Ethernet2 - no channel-group - no interface Port-Channel10 - become: yes - -- eos_facts: - gather_network_resources: lag_interfaces - become: yes - -- set_fact: - expected_config: - - name: "Port-Channel5" - members: - - member: Ethernet1 - mode: "on" - -- assert: - that: - - "ansible_facts.network_resources.lag_interfaces|symmetric_difference(expected_config)|length == 0" diff --git a/test/integration/targets/eos_linkagg/defaults/main.yaml b/test/integration/targets/eos_linkagg/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_linkagg/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_linkagg/meta/main.yaml b/test/integration/targets/eos_linkagg/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_linkagg/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_linkagg/tasks/cli.yaml b/test/integration/targets/eos_linkagg/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_linkagg/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_linkagg/tasks/main.yaml b/test/integration/targets/eos_linkagg/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/eos_linkagg/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_linkagg/tests/cli/basic.yaml b/test/integration/targets/eos_linkagg/tests/cli/basic.yaml deleted file mode 100644 index e49dff8697..0000000000 --- a/test/integration/targets/eos_linkagg/tests/cli/basic.yaml +++ /dev/null @@ -1,190 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml" - -- name: setup - remove config used in test(part1) - eos_config: - lines: - - no interface port-channel 20 - - no interface port-channel 100 - provider: "{{ cli }}" - become: yes - -- name: setup - remove config used in test(part2) - eos_config: - lines: - - no channel-group 20 - provider: "{{ cli }}" - parents: "{{ item }}" - loop: - - interface Ethernet1 - - interface Ethernet2 - become: yes - -- name: create linkagg - eos_linkagg: &create - group: 20 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'interface port-channel 20' in result.commands" - -- name: create linkagg(Idempotence) - eos_linkagg: *create - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: set link aggregation group to members - eos_linkagg: &configure_member - group: 20 - mode: active - members: - - Ethernet1 - - Ethernet2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'interface Ethernet1' in result.commands" - - "'channel-group 20 mode active' in result.commands" - - "'interface Ethernet2' in result.commands" - - "'channel-group 20 mode active' in result.commands" - -- name: set link aggregation group to members(Idempotence) - eos_linkagg: *configure_member - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: remove link aggregation group from member - eos_linkagg: &remove_member - group: 20 - mode: active - members: - - Ethernet2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'interface Ethernet1' in result.commands" - - "'no channel-group 20' in result.commands" - -- name: remove link aggregation group from member(Idempotence) - eos_linkagg: *remove_member - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: remove linkagg - eos_linkagg: &remove - group: 20 - state: absent - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no interface port-channel 20' in result.commands" - -- name: remove linkagg(Idempotence) - eos_linkagg: *remove - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: create aggregate of linkagg definitions - eos_linkagg: &create_agg - aggregate: - - { group: 20, min_links: 3 } - - { group: 100, min_links: 4 } - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'interface port-channel 20' in result.commands" - - "'port-channel min-links 3' in result.commands" - - "'interface port-channel 100' in result.commands" - - "'port-channel min-links 4' in result.commands" - -- name: create aggregate of linkagg definitions(Idempotence) - eos_linkagg: *create_agg - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: remove aggregate of linkagg definitions - eos_linkagg: &remove_agg - aggregate: - - { group: 20, min_links: 3 } - - { group: 100, min_links: 4 } - provider: "{{ cli }}" - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no interface port-channel 20' in result.commands" - - "'no interface port-channel 100' in result.commands" - -- name: remove aggregate of linkagg definitions(Idempotence) - eos_linkagg: *remove_agg - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown(part1) - eos_config: - lines: - - no interface port-channel 20 - - no interface port-channel 100 - provider: "{{ cli }}" - become: yes - -- name: teardown(part2) - eos_config: - lines: - - no channel-group 20 - provider: "{{ cli }}" - parents: "{{ item }}" - become: yes - loop: - - interface Ethernet1 - - interface Ethernet2 - -- debug: msg="END cli/basic.yaml" diff --git a/test/integration/targets/eos_lldp/defaults/main.yaml b/test/integration/targets/eos_lldp/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_lldp/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_lldp/meta/main.yaml b/test/integration/targets/eos_lldp/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_lldp/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_lldp/tasks/cli.yaml b/test/integration/targets/eos_lldp/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_lldp/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lldp/tasks/eapi.yaml b/test/integration/targets/eos_lldp/tasks/eapi.yaml deleted file mode 100644 index 12f4dc948b..0000000000 --- a/test/integration/targets/eos_lldp/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lldp/tasks/main.yaml b/test/integration/targets/eos_lldp/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_lldp/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_lldp/tests/cli/basic.yaml b/test/integration/targets/eos_lldp/tests/cli/basic.yaml deleted file mode 100644 index d9b78318b2..0000000000 --- a/test/integration/targets/eos_lldp/tests/cli/basic.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: msg="START eos_lldp cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Make sure LLDP is not running before tests - eos_config: - lines: no lldp run - become: yes - -- name: Enable LLDP service - eos_lldp: - state: present - register: result - become: yes - -- assert: - that: - - 'result.changed == true' - - '"lldp run" in result.commands' - -- name: Enable LLDP service again (idempotent) - eos_lldp: - state: present - register: result - become: yes - -- assert: - that: - - 'result.changed == false' - -- name: Disable LLDP service - eos_lldp: - state: absent - register: result - become: yes - -- assert: - that: - - 'result.changed == true' - - '"no lldp run" in result.commands' - -- name: Disable LLDP service (idempotent) - eos_lldp: - state: absent - register: result - become: yes - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END eos_lldp cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_lldp/tests/eapi/basic.yaml b/test/integration/targets/eos_lldp/tests/eapi/basic.yaml deleted file mode 100644 index 06579d9574..0000000000 --- a/test/integration/targets/eos_lldp/tests/eapi/basic.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: msg="START eos_lldp eapi/basic.yaml on connection={{ ansible_connection }}" - -- name: Make sure LLDP is not running before tests - eos_config: - lines: no lldp run - become: yes - -- name: Enable LLDP service - eos_lldp: - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"lldp run" in result.commands' - -- name: Enable LLDP service again (idempotent) - eos_lldp: - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Disable LLDP service - eos_lldp: - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no lldp run" in result.commands' - -- name: Disable LLDP service (idempotent) - eos_lldp: - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END eos_lldp eapi/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_lldp_global/defaults/main.yaml b/test/integration/targets/eos_lldp_global/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_lldp_global/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_lldp_global/meta/main.yml b/test/integration/targets/eos_lldp_global/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_lldp_global/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_lldp_global/tasks/main.yaml b/test/integration/targets/eos_lldp_global/tasks/main.yaml deleted file mode 100644 index 068963b4c3..0000000000 --- a/test/integration/targets/eos_lldp_global/tasks/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lldp_global/tests/cli/deleted.yaml b/test/integration/targets/eos_lldp_global/tests/cli/deleted.yaml deleted file mode 100644 index 98233e1a1e..0000000000 --- a/test/integration/targets/eos_lldp_global/tests/cli/deleted.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- name: Returns LLDP configuration to default parameters - eos_lldp_global: - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == result.before" - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == result.after" - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == {}" diff --git a/test/integration/targets/eos_lldp_global/tests/cli/merged.yaml b/test/integration/targets/eos_lldp_global/tests/cli/merged.yaml deleted file mode 100644 index 7cbc16f41d..0000000000 --- a/test/integration/targets/eos_lldp_global/tests/cli/merged.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - holdtime: 100 - tlv_select: - management_address: False - port_description: False - system_description: True - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- name: Merge provided LLDP configuration with device configuration - eos_lldp_global: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == result.before" - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == result.after" - -- set_fact: - expected_config: - timer: 3000 - holdtime: 100 - reinit: 5 - tlv_select: - management_address: False - port_description: False - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == expected_config" diff --git a/test/integration/targets/eos_lldp_global/tests/cli/replaced.yaml b/test/integration/targets/eos_lldp_global/tests/cli/replaced.yaml deleted file mode 100644 index f8cbcd13cc..0000000000 --- a/test/integration/targets/eos_lldp_global/tests/cli/replaced.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - holdtime: 100 - tlv_select: - management_address: False - port_description: False - system_description: True - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- name: Replaces device configuration with provided LLDP configuration - eos_lldp_global: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == result.before" - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == result.after" - -- set_fact: - expected_config: - holdtime: 100 - tlv_select: - management_address: False - port_description: False - -- assert: - that: - - "ansible_facts.network_resources.lldp_global == expected_config" diff --git a/test/integration/targets/eos_lldp_global/tests/cli/reset_config.yml b/test/integration/targets/eos_lldp_global/tests/cli/reset_config.yml deleted file mode 100644 index 4e5fd33746..0000000000 --- a/test/integration/targets/eos_lldp_global/tests/cli/reset_config.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: Reset initial config - cli_config: - config: | - lldp timer 3000 - lldp holdtime 100 - lldp reinit 5 - no lldp tlv-select management-address - no lldp tlv-select system-description - lldp tlv-select port-description - become: yes - -- eos_facts: - gather_network_resources: lldp_global - become: yes - -- set_fact: - expected_config: - timer: 3000 - holdtime: 100 - reinit: 5 - tlv_select: - management_address: False - system_description: False - -- assert: - that: - - "expected_config == ansible_facts.network_resources.lldp_global" diff --git a/test/integration/targets/eos_lldp_interfaces/defaults/main.yaml b/test/integration/targets/eos_lldp_interfaces/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_lldp_interfaces/meta/main.yml b/test/integration/targets/eos_lldp_interfaces/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_lldp_interfaces/tasks/main.yaml b/test/integration/targets/eos_lldp_interfaces/tasks/main.yaml deleted file mode 100644 index 068963b4c3..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/tasks/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_lldp_interfaces/tests/cli/deleted.yaml b/test/integration/targets/eos_lldp_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index b3f94f93da..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - expected_config: - - name: Ethernet2 - transmit: False - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- name: Returns interface lldp parameterss to default parameters - eos_lldp_interfaces: - config: "{{ config }}" - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.after) == []" - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces == expected_config" diff --git a/test/integration/targets/eos_lldp_interfaces/tests/cli/merged.yaml b/test/integration/targets/eos_lldp_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 4d56ca50a6..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - transmit: False - - name: Ethernet2 - transmit: False - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- name: Merge provided configuration with device configuration - eos_lldp_interfaces: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: - - name: Ethernet1 - transmit: False - receive: False - - name: Ethernet2 - transmit: False - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lldp_interfaces) == []" diff --git a/test/integration/targets/eos_lldp_interfaces/tests/cli/overridden.yaml b/test/integration/targets/eos_lldp_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 82ad0beb89..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - transmit: False - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- name: Override the LLDP configuration of all interfaces with provided configuration - eos_lldp_interfaces: - config: "{{ config }}" - state: overridden - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.after) == []" - -- assert: - that: - - "config|symmetric_difference(ansible_facts.network_resources.lldp_interfaces) == []" diff --git a/test/integration/targets/eos_lldp_interfaces/tests/cli/replaced.yaml b/test/integration/targets/eos_lldp_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index 56f3d34580..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - name: Ethernet1 - transmit: False - other_config: - - name: Ethernet2 - transmit: False - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- name: Replace existing LLDP configuration of specified interfaces with provided configuration - eos_lldp_interfaces: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- assert: - that: - - "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }} + {{ other_config }}" - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lldp_interfaces) == []" diff --git a/test/integration/targets/eos_lldp_interfaces/tests/cli/reset_config.yml b/test/integration/targets/eos_lldp_interfaces/tests/cli/reset_config.yml deleted file mode 100644 index 99688d8478..0000000000 --- a/test/integration/targets/eos_lldp_interfaces/tests/cli/reset_config.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Reset initial config - cli_config: - config: | - interface Ethernet1 - no lldp receive - lldp transmit - interface Ethernet2 - lldp receive - no lldp transmit - become: yes - -- eos_facts: - gather_network_resources: lldp_interfaces - become: yes - -- set_fact: - expected_config: - - name: Ethernet1 - receive: False - - name: Ethernet2 - transmit: False - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.lldp_interfaces) == []" diff --git a/test/integration/targets/eos_logging/defaults/main.yaml b/test/integration/targets/eos_logging/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_logging/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_logging/meta/main.yaml b/test/integration/targets/eos_logging/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_logging/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_logging/tasks/cli.yaml b/test/integration/targets/eos_logging/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_logging/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_logging/tasks/eapi.yaml b/test/integration/targets/eos_logging/tasks/eapi.yaml deleted file mode 100644 index 12f4dc948b..0000000000 --- a/test/integration/targets/eos_logging/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_logging/tasks/main.yaml b/test/integration/targets/eos_logging/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_logging/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_logging/tests/cli/basic.yaml b/test/integration/targets/eos_logging/tests/cli/basic.yaml deleted file mode 100644 index d8d90018df..0000000000 --- a/test/integration/targets/eos_logging/tests/cli/basic.yaml +++ /dev/null @@ -1,147 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Set up host logging - eos_logging: - dest: host - name: 172.16.0.1 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging host 172.16.0.1" in result.commands' - -- name: Set up host logging again (idempotent) - eos_logging: - dest: host - name: 172.16.0.1 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Delete/disable host logging - eos_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging host 172.16.0.1" in result.commands' - -- name: Delete/disable host logging (idempotent) - eos_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Console logging with level warnings - eos_logging: - dest: console - level: warnings - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging console warnings" in result.commands' - - -- name: Configure buffer size - eos_logging: - dest: buffered - size: 480000 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging buffered 480000" in result.commands' - -- name: Set up logging destination and facility at the same time - eos_logging: - dest: buffered - size: 4096 - facility: local7 - level: informational - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging buffered 4096 informational" in result.commands' - - '"logging facility local7" in result.commands' - -- name: Set up logging destination and facility at the same time again (idempotent) - eos_logging: - dest: buffered - size: 4096 - facility: local7 - level: informational - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Set up logging facility alone - eos_logging: - facility: local2 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging facility local2" in result.commands' - -- name: Set up logging facility (idempotent) - eos_logging: - facility: local2 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: remove logging as collection tearDown - eos_logging: - aggregate: - - { dest: console, level: warnings, state: absent } - - { dest: buffered, level: informational, size: 4096, state: absent } - - { facility: local2, state: absent } - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging console" in result.commands' - - '"no logging buffered" in result.commands' - - '"no logging facility local2" in result.commands' diff --git a/test/integration/targets/eos_logging/tests/cli/net_logging.yaml b/test/integration/targets/eos_logging/tests/cli/net_logging.yaml deleted file mode 100644 index 2944ebf454..0000000000 --- a/test/integration/targets/eos_logging/tests/cli/net_logging.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START eos cli/net_logging.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Delete/disable host logging- setup - net_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- name: Set up host logging using platform agnostic module - net_logging: - dest: host - name: 172.16.0.1 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging host 172.16.0.1" in result.commands' - -- name: Delete/disable host logging- teardown - net_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- debug: msg="END eos cli/net_logging.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_logging/tests/eapi/basic.yaml b/test/integration/targets/eos_logging/tests/eapi/basic.yaml deleted file mode 100644 index 2c6a963d4a..0000000000 --- a/test/integration/targets/eos_logging/tests/eapi/basic.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -- debug: msg="START eapi/basic.yaml on connection={{ ansible_connection }}" - -- name: Set up host logging - eos_logging: - dest: host - name: 172.16.0.1 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging host 172.16.0.1" in result.commands' - -- name: Set up host logging again (idempotent) - eos_logging: - dest: host - name: 172.16.0.1 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Delete/disable host logging - eos_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging host 172.16.0.1" in result.commands' - -- name: Delete/disable host logging (idempotent) - eos_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Console logging with level warnings - eos_logging: - dest: console - level: warnings - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging console warnings" in result.commands' - -- name: Configure buffer size - eos_logging: - dest: buffered - size: 480000 - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging buffered 480000" in result.commands' - -- name: remove logging as collection tearDown - eos_logging: - aggregate: - - { dest: console, level: warnings, state: absent } - - { dest: buffered, size: 480000, state: absent } - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging console" in result.commands' - - '"no logging buffered" in result.commands' diff --git a/test/integration/targets/eos_logging/tests/eapi/net_logging.yaml b/test/integration/targets/eos_logging/tests/eapi/net_logging.yaml deleted file mode 100644 index 15ed833e4a..0000000000 --- a/test/integration/targets/eos_logging/tests/eapi/net_logging.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START eos eapi/net_logging.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Delete/disable host logging- setup - net_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- name: Set up host logging using platform agnostic module - net_logging: - dest: host - name: 172.16.0.1 - state: present - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging host 172.16.0.1" in result.commands' - -- name: Delete/disable host logging- teardown - net_logging: - dest: host - name: 172.16.0.1 - state: absent - become: yes - register: result - -- debug: msg="END eos eapi/net_logging.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_smoke/defaults/main.yaml b/test/integration/targets/eos_smoke/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_smoke/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_smoke/meta/main.yml b/test/integration/targets/eos_smoke/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_smoke/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_smoke/tasks/cli.yaml b/test/integration/targets/eos_smoke/tasks/cli.yaml deleted file mode 100644 index 9538b811df..0000000000 --- a/test/integration/targets/eos_smoke/tasks/cli.yaml +++ /dev/null @@ -1,24 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli - -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_local diff --git a/test/integration/targets/eos_smoke/tasks/eapi.yaml b/test/integration/targets/eos_smoke/tasks/eapi.yaml deleted file mode 100644 index 6ae12ebc1f..0000000000 --- a/test/integration/targets/eos_smoke/tasks/eapi.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - 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 cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi - -- name: run test cases (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_local diff --git a/test/integration/targets/eos_smoke/tasks/main.yaml b/test/integration/targets/eos_smoke/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_smoke/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_smoke/tests/cli/common_config.yaml b/test/integration/targets/eos_smoke/tests/cli/common_config.yaml deleted file mode 100644 index e314b8a3d1..0000000000 --- a/test/integration/targets/eos_smoke/tests/cli/common_config.yaml +++ /dev/null @@ -1,109 +0,0 @@ ---- -# eos_config -> NetworkConfig, dumps - -- debug: msg="START cli/common_config.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - provider: "{{ cli }}" - become: yes - -- name: get current running-config - eos_command: - commands: show running-config - provider: "{{ cli }}" - become: yes - register: config - -- name: configure hostname - eos_config: - lines: hostname foo - config: "{{ config.stdout[0] }}" - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - -- name: get current running-config - eos_command: - commands: show running-config - provider: "{{ cli }}" - become: yes - register: config - -- name: teardown - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - provider: "{{ cli }}" - become: yes - -# hit block and diffs -- block: - - name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: strict - provider: "{{ cli }}" - become: yes - - - name: configure sub level command using block replace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ cli }}" - match: line - become: yes - register: result - - - assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'20 permit ip host 192.0.2.2 any log' in result.updates" - - "'30 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - - - name: check sub level command using block replace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ cli }}" - match: exact - become: yes - register: result - - always: - - name: teardown - eos_config: - lines: no ip access-list test - match: none - provider: "{{ cli }}" - become: yes - -- debug: msg="END cli/common_config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_smoke/tests/cli/common_utils.yaml b/test/integration/targets/eos_smoke/tests/cli/common_utils.yaml deleted file mode 100644 index 60c69b78ff..0000000000 --- a/test/integration/targets/eos_smoke/tests/cli/common_utils.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -# eos_static_route -> remove_default_spec, validate_ip_address, validate_prefix -# eos_interface -> conditional -# eos_command -> ComplexList - -- debug: msg="START cli/common_utils.yaml on connection={{ ansible_connection }}" - -# hit remove_default_spec() validate_ip_address() validate_prefix() ComplexList -- name: setup - remove config used in test - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - provider: "{{ cli }}" - become: yes - -- name: configure static route - eos_static_route: - address: 192.168.3.0/24 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip route 192.168.3.0/24 192.168.0.1 2' in result.commands" - -- name: configure static route - eos_static_route: - address: 192.168.3.0/250 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ cli }}" - become: yes - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: teardown - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - provider: "{{ cli }}" - become: yes - -- debug: msg="END cli/common_utils.yaml on connection={{ ansible_connection }}" - -# hit conditional() -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - -- name: Check intent arguments - eos_interface: - name: "{{ test_interface_1 }}" - state: up - tx_rate: ge(0) - rx_rate: ge(0) - provider: "{{ cli }}" - become: yes - register: result diff --git a/test/integration/targets/eos_smoke/tests/cli/misc_tests.yaml b/test/integration/targets/eos_smoke/tests/cli/misc_tests.yaml deleted file mode 100644 index a11703589d..0000000000 --- a/test/integration/targets/eos_smoke/tests/cli/misc_tests.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START cli/misc_tests.yaml on connection={{ ansible_connection }}" - - -# test become and unbecome -- block: - - name: command that does require become (should fail) - eos_command: - commands: show running-config - provider: "{{ cli }}" - become: no - ignore_errors: yes - register: result - - - assert: - that: - - 'result.failed == true' - - '"privileged mode required" in result.msg' - - - name: command that doesn't require become - eos_command: - commands: show uptime - provider: "{{ cli }}" - become: no - - # Test that transport values are properly ignored - - name: wrong transport specified - eos_command: - commands: show version - transport: eapi - - - name: wrong transport specified in provider - eos_command: - commands: show version - provider: "{{ eapi }}" - - when: "ansible_connection != 'local'" diff --git a/test/integration/targets/eos_smoke/tests/cli/reboot.yaml b/test/integration/targets/eos_smoke/tests/cli/reboot.yaml deleted file mode 100644 index a83c7815d4..0000000000 --- a/test/integration/targets/eos_smoke/tests/cli/reboot.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- block: - - cli_command: - command: reload power - prompt: - - "yes/no/cancel/diff]" - - "confirm]" - answer: - - "no" - - "" - check_all: yes - become: yes - - - wait_for_connection: - delay: 20 - sleep: 10 - - - cli_command: - command: show version - when: ansible_connection.endswith("network_cli") diff --git a/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml b/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml deleted file mode 100644 index d9441ee1ea..0000000000 --- a/test/integration/targets/eos_smoke/tests/eapi/common_config.yaml +++ /dev/null @@ -1,109 +0,0 @@ ---- -# eos_config -> NetworkConfig, dumps - -- debug: msg="START cli/common_config.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - provider: "{{ eapi }}" - become: yes - -- name: get current running-config - eos_command: - commands: show running-config - provider: "{{ eapi }}" - become: yes - register: config - -- name: configure hostname - eos_config: - lines: hostname foo - config: "{{ config.stdout[0] }}" - provider: "{{ eapi }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.updates" - -- name: get current running-config - eos_command: - commands: show running-config - provider: "{{ eapi }}" - become: yes - register: config - -- name: teardown - eos_config: - lines: hostname {{ inventory_hostname_short }} - match: none - provider: "{{ eapi }}" - become: yes - -# hit block and diffs -- block: - - name: setup - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - parents: ip access-list test - before: no ip access-list test - after: exit - match: strict - provider: "{{ eapi }}" - become: yes - - - name: configure sub level command using block replace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ eapi }}" - match: line - become: yes - register: result - - - assert: - that: - - "result.changed == true" - - "'ip access-list test' in result.updates" - - "'10 permit ip host 192.0.2.1 any log' in result.updates" - - "'20 permit ip host 192.0.2.2 any log' in result.updates" - - "'30 permit ip host 192.0.2.3 any log' in result.updates" - - "'40 permit ip host 192.0.2.4 any log' in result.updates" - - - name: check sub level command using block replace - eos_config: - lines: - - 10 permit ip host 192.0.2.1 any log - - 20 permit ip host 192.0.2.2 any log - - 30 permit ip host 192.0.2.3 any log - - 40 permit ip host 192.0.2.4 any log - parents: ip access-list test - replace: block - after: exit - provider: "{{ eapi }}" - match: exact - become: yes - register: result - - always: - - name: teardown - eos_config: - lines: no ip access-list test - match: none - provider: "{{ eapi }}" - become: yes - -- debug: msg="END cli/common_config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_smoke/tests/eapi/common_utils.yaml b/test/integration/targets/eos_smoke/tests/eapi/common_utils.yaml deleted file mode 100644 index 783c6e8a26..0000000000 --- a/test/integration/targets/eos_smoke/tests/eapi/common_utils.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -# eos_static_route -> remove_default_spec, validate_ip_address, validate_prefix -# eos_interface -> conditional -# eos_command -> ComplexList - -- debug: msg="START cli/common_utils.yaml on connection={{ ansible_connection }}" - -# hit remove_default_spec() validate_ip_address() validate_prefix() ComplexList -- name: setup - remove config used in test - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - provider: "{{ eapi }}" - become: yes - -- name: configure static route - eos_static_route: - address: 192.168.3.0/24 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ eapi }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip route 192.168.3.0/24 192.168.0.1 2' in result.commands" - -- name: configure static route - eos_static_route: - address: 192.168.3.0/250 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ eapi }}" - become: yes - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: teardown - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - provider: "{{ eapi }}" - become: yes - -- debug: msg="END cli/common_utils.yaml on connection={{ ansible_connection }}" - -# hit conditional() -- name: Set test interface - set_fact: - test_interface_1: ethernet1 - -- name: Check intent arguments - eos_interface: - name: "{{ test_interface_1 }}" - state: up - tx_rate: ge(0) - rx_rate: ge(0) - provider: "{{ eapi }}" - become: yes - register: result diff --git a/test/integration/targets/eos_static_route/defaults/main.yaml b/test/integration/targets/eos_static_route/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_static_route/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_static_route/meta/main.yaml b/test/integration/targets/eos_static_route/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_static_route/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_static_route/tasks/cli.yaml b/test/integration/targets/eos_static_route/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_static_route/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_static_route/tasks/main.yaml b/test/integration/targets/eos_static_route/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/eos_static_route/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_static_route/tests/cli/basic.yaml b/test/integration/targets/eos_static_route/tests/cli/basic.yaml deleted file mode 100644 index 572dec4917..0000000000 --- a/test/integration/targets/eos_static_route/tests/cli/basic.yaml +++ /dev/null @@ -1,118 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: setup - remove config used in test - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - - no ip route 192.168.4.0/24 192.168.0.1 - - no ip route 192.168.5.0/24 192.168.0.1 - provider: "{{ cli }}" - become: yes - -- name: configure static route - eos_static_route: &single_route - address: 192.168.3.0/24 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip route 192.168.3.0/24 192.168.0.1 2' in result.commands" - -- name: configure static route(Idempotence) - eos_static_route: *single_route - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: delete static route - eos_static_route: &delete_single - address: 192.168.3.0/24 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ cli }}" - state: absent - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no ip route 192.168.3.0/24 192.168.0.1' in result.commands" - -- name: delete static route - eos_static_route: *delete_single - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: configure static routes using aggregate - eos_static_route: &configure_aggregate - aggregate: - - { address: 192.168.4.0/24, next_hop: 192.168.0.1 } - - { address: 192.168.5.0/24, next_hop: 192.168.0.1 } - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip route 192.168.4.0/24 192.168.0.1 1' in result.commands" - - "'ip route 192.168.5.0/24 192.168.0.1 1' in result.commands" - -- name: configure static routes using aggregate(Idemporence) - eos_static_route: *configure_aggregate - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: delete static routes using aggregate - eos_static_route: &delete_aggregate - aggregate: - - { address: 192.168.4.0/24, next_hop: 192.168.0.1 } - - { address: 192.168.5.0/24, next_hop: 192.168.0.1 } - state: absent - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no ip route 192.168.4.0/24 192.168.0.1' in result.commands" - - "'no ip route 192.168.5.0/24 192.168.0.1' in result.commands" - -- name: delete static routes using aggregate(Idempotence) - eos_static_route: *delete_aggregate - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - - no ip route 192.168.4.0/24 192.168.0.1 - - no ip route 192.168.5.0/24 192.168.0.1 - provider: "{{ cli }}" - become: yes - -- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_static_route/tests/cli/net_static_route.yaml b/test/integration/targets/eos_static_route/tests/cli/net_static_route.yaml deleted file mode 100644 index 5a69438b71..0000000000 --- a/test/integration/targets/eos_static_route/tests/cli/net_static_route.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- debug: msg="START eos cli/net_static_route.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - remove config used in test - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - provider: "{{ cli }}" - become: yes - -- name: configure static route using platform agnostic module - net_static_route: - address: 192.168.3.0/24 - next_hop: 192.168.0.1 - admin_distance: 2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'ip route 192.168.3.0/24 192.168.0.1 2' in result.commands" - -- name: teardown - remove config used in test - eos_config: - lines: - - no ip route 192.168.3.0/24 192.168.0.1 - provider: "{{ cli }}" - become: yes - -- debug: msg="END eos cli/net_static_route.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_static_routes/defaults/main.yaml b/test/integration/targets/eos_static_routes/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/eos_static_routes/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/eos_static_routes/meta/main.yaml b/test/integration/targets/eos_static_routes/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_static_routes/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_static_routes/tasks/cli.yaml b/test/integration/targets/eos_static_routes/tasks/cli.yaml deleted file mode 100644 index 5b16f46bde..0000000000 --- a/test/integration/targets/eos_static_routes/tasks/cli.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_static_routes/tasks/eapi.yaml b/test/integration/targets/eos_static_routes/tasks/eapi.yaml deleted file mode 100644 index 1109c6bf6a..0000000000 --- a/test/integration/targets/eos_static_routes/tasks/eapi.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/eos_static_routes/tasks/main.yaml b/test/integration/targets/eos_static_routes/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_static_routes/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_static_routes/tests/cli/_parsed.cfg b/test/integration/targets/eos_static_routes/tests/cli/_parsed.cfg deleted file mode 100644 index a4bb4d6549..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/_parsed.cfg +++ /dev/null @@ -1,7 +0,0 @@ -ip route 10.1.1.0/24 Management1 -ip route 10.1.1.0/24 Ethernet1 20.1.1.3 track bfd 200 -ip route 10.50.0.0/16 Management1 -ip route 23.1.0.0/16 Nexthop-Group testgrp tag 42 -ip route vrf testvrf 120.1.1.0/24 Ethernet1 23 -ip route vrf vrftest1 77.77.1.0/24 33.1.1.1 -ipv6 route 1000:10::/64 Ethernet1 67 tag 98 diff --git a/test/integration/targets/eos_static_routes/tests/cli/_populate.yaml b/test/integration/targets/eos_static_routes/tests/cli/_populate.yaml deleted file mode 100644 index 98f1ff9725..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/_populate.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: Setup - cli_config: - config: "{{ lines }}" - become: yes - vars: - lines: | - vrf definition testvrf - vrf definition vrftest1 - ip route 10.1.1.0/24 Management1 - ip route 10.1.1.0/24 Ethernet1 20.1.1.3 track bfd 200 - ip route 10.50.0.0/16 Management1 - ip route 23.1.0.0/16 Nexthop-Group testgrp tag 42 - ip route vrf testvrf 120.1.1.0/24 Ethernet1 23 - ip route vrf vrftest1 77.77.1.0/24 33.1.1.1 - ipv6 route 1000:10::/64 Ethernet1 67 tag 98 diff --git a/test/integration/targets/eos_static_routes/tests/cli/_remove_config.yaml b/test/integration/targets/eos_static_routes/tests/cli/_remove_config.yaml deleted file mode 100644 index aa95912d80..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Setup - cli_config: - config: "{{ lines }}" - become: yes - vars: - lines: | - no vrf definition testvrf - no vrf definition vrftest1 - no ip route 10.1.1.0/24 Management1 - no ip route 10.1.1.0/24 Ethernet1 20.1.1.3 track bfd 200 - no ip route 10.50.0.0/16 Management1 - no ip route 23.1.0.0/16 Nexthop-Group testgrp tag 42 - no ip route 155.55.1.0/24 Nexthop-Group testgrp tag 100 - no ip route 122.1.19.0/24 Nexthop-Group testgrp 21 - no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23 - no ip route vrf vrftest1 77.77.1.0/24 33.1.1.1 - no ipv6 route 1000:10::/64 Ethernet1 67 tag 98 - no ipv6 route vrf testvrf 1120:10::/64 Ethernet1 55 - no ipv6 route 1000:10::/64 Ethernet1 55 diff --git a/test/integration/targets/eos_static_routes/tests/cli/deleted.yaml b/test/integration/targets/eos_static_routes/tests/cli/deleted.yaml deleted file mode 100644 index 3b5dcb5739..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/deleted.yaml +++ /dev/null @@ -1,224 +0,0 @@ ---- -- debug: - msg: "Start eos_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - -- set_fact: - config1: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - interface: Ethernet1 - admin_distance: 23 - vrf: testvrf - -- set_fact: - config2: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - admin_distance: 23 - interface: Ethernet1 - vrf: testvrf - -- set_fact: - config3: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - interface: Ethernet1 - admin_distance: 23 - vrf: testvrf - - -- name: Delete attributes of given static routes - dest specific. - eos_static_routes: &deleted - config: - - vrf: "testvrf" - address_families: - - afi: 'ipv4' - routes: - - dest: '120.1.1.0/24' - - address_families: - - afi: 'ipv6' - routes: - - dest: '1000:10::/64' - state: deleted - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config) == []" - - '"no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23" in result.commands' - - '"no ipv6 route 1000:10::/64 Ethernet1 67 tag 98" in result.commands' - become: yes - -- name: Idempotency check - eos_static_routes: *deleted - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - -- include_tasks: _populate.yaml - -- name: Delete attributes of given static routes - afi specific. - eos_static_routes: - config: - - address_families: - - afi: 'ipv6' - state: deleted - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config1) == []" - - '"no ipv6 route 1000:10::/64 Ethernet1 67 tag 98" in result.commands' - become: yes - -- name: Delete attributes of given static routes - vrf specific. - eos_static_routes: - config: - - vrf: vrftest1 - state: deleted - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config2) == []" - - '"no ip route vrf vrftest1 77.77.1.0/24 33.1.1.1" in result.commands' - become: yes - -- name: Delete attributes of given static routes - nexthop specific. - eos_static_routes: - config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - state: deleted - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config3) == []" - - '"no ip route 10.1.1.0/24 Management1" in result.commands' - become: yes - -- include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/gathered.yaml b/test/integration/targets/eos_static_routes/tests/cli/gathered.yaml deleted file mode 100644 index f89a6c0809..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/gathered.yaml +++ /dev/null @@ -1,75 +0,0 @@ ---- -- debug: - msg: "START eos_static_routes gathered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Gathered the provided configuration with the exisiting running configuration - eos_static_routes: &gathered - config: - state: gathered - become: yes - register: result - - - set_fact: - config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - afi: ipv6 - routes: - - dest: 1000:10::/64 - next_hops: - - admin_distance: 67 - interface: Ethernet1 - tag: 98 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - admin_distance: 23 - interface: Ethernet1 - vrf: testvrf - - - name: Assert that gathered dicts was correctly generated - assert: - that: - - " config | symmetric_difference(result['gathered']) == []" - - - name: Gather the existing running configuration (IDEMPOTENT) - eos_static_routes: *gathered - become: yes - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/merged.yaml b/test/integration/targets/eos_static_routes/tests/cli/merged.yaml deleted file mode 100644 index 55ecdb5b84..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/merged.yaml +++ /dev/null @@ -1,102 +0,0 @@ ---- -- debug: - msg: "Start eos_static_routes merged integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - dest: 155.55.1.0/24 - next_hops: - - nexthop_grp: testgrp - tag: 100 - - afi: ipv6 - routes: - - dest: 1000:10::/64 - next_hops: - - admin_distance: 67 - interface: Ethernet1 - tag: 98 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - admin_distance: 23 - interface: Ethernet1 - - afi: ipv6 - routes: - - dest: 1120:10::/64 - next_hops: - - admin_distance: 55 - interface: Ethernet1 - vrf: testvrf - -- name: merge attributes of given static routes. - eos_static_routes: &merged - config: - - vrf: "testvrf" - address_families: - - afi: 'ipv6' - routes: - - dest: '1120:10::/64' - next_hops: - - interface: Ethernet1 - admin_distance: 55 - - address_families: - - afi: 'ipv4' - routes: - - dest: '155.55.1.0/24' - next_hops: - - nexthop_grp: testgrp - tag: 100 - state: merged - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config) == []" - - '"ipv6 route vrf testvrf 1120:10::/64 Ethernet1 55" in result.commands' - - '"ip route 155.55.1.0/24 Nexthop-Group testgrp tag 100" in result.commands' - become: yes - -- name: Idempotency check - eos_static_routes: *merged - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - -- include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/overridden.yaml b/test/integration/targets/eos_static_routes/tests/cli/overridden.yaml deleted file mode 100644 index 5af837fdf0..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/overridden.yaml +++ /dev/null @@ -1,61 +0,0 @@ ---- -- debug: - msg: "Start eos_static_routes merged integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - address_families: - - afi: ipv6 - routes: - - dest: 1120:10::/64 - next_hops: - - admin_distance: 55 - interface: Ethernet1 - vrf: testvrf - -- name: Override attributes of given static routes. - eos_static_routes: &overridden - config: - - vrf: "testvrf" - address_families: - - afi: 'ipv6' - routes: - - dest: '1120:10::/64' - next_hops: - - interface: Ethernet1 - admin_distance: 55 - state: overridden - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config) == []" - - "result.commands|length == 8" - - '"no ipv6 route 1000:10::/64 Ethernet1 67 tag 98" in result.commands' - - '"no ip route 23.1.0.0/16 Nexthop-Group testgrp tag 42" in result.commands' - - '"no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23" in result.commands' - - '"no ip route 10.50.0.0/16 Management1" in result.commands' - - '"no ip route 10.1.1.0/24 Management1" in result.commands' - - '"no ip route 10.1.1.0/24 Ethernet1 20.1.1.3 track bfd 200" in result.commands' - - '"no ip route vrf vrftest1 77.77.1.0/24 33.1.1.1" in result.commands' - - '"ipv6 route vrf testvrf 1120:10::/64 Ethernet1 55" in result.commands' - become: yes - -- name: Idempotency check - eos_static_routes: *overridden - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - -- include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/parsed.yaml b/test/integration/targets/eos_static_routes/tests/cli/parsed.yaml deleted file mode 100644 index aaaabb449a..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/parsed.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: - msg: "START eos_static_routes parsed integration tests on connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- name: Gather static_routes facts - eos_facts: - gather_subset: - - default - gather_network_resources: - - static_routes - become: yes - register: static_routes_facts - -- name: Provide the running configuration for parsing (config to be parsed) - eos_static_routes: &parsed - running_config: - "{{ lookup('file', '_parsed.cfg') }}" - state: parsed - become: yes - register: result - -- assert: - that: - - "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed']) |length == 0 }}" - -- name: Gather the existing running configuration (IDEMPOTENT) - eos_static_routes: *parsed - become: yes - register: result - -- assert: - that: - - "result['changed'] == false" - -- include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/rendered.yaml b/test/integration/targets/eos_static_routes/tests/cli/rendered.yaml deleted file mode 100644 index d188702d48..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/rendered.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -- debug: - msg: "START eos_static_routes rendered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Structure provided configuration into device specific commands - eos_static_routes: &rendered - config: - - vrf: "testvrf" - address_families: - - afi: 'ipv6' - routes: - - dest: '1120:10::/64' - next_hops: - - interface: Ethernet1 - admin_distance: 55 - - address_families: - - afi: 'ipv4' - routes: - - dest: '155.55.1.0/24' - next_hops: - - nexthop_grp: testgrp - tag: 100 - state: rendered - become: yes - register: result - - - - name: Assert that correct set of commands were generated - vars: - lines: - - ipv6 route vrf testvrf 1120:10::/64 Ethernet1 55 - - ip route 155.55.1.0/24 Nexthop-Group testgrp tag 100 - - assert: - that: - - "{{ lines | symmetric_difference(result['rendered']) |length == 0 }}" - - - name: Structure provided configuration into device specific commands (IDEMPOTENT) - eos_static_routes: *rendered - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/replaced.yaml b/test/integration/targets/eos_static_routes/tests/cli/replaced.yaml deleted file mode 100644 index 1a8353803e..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/replaced.yaml +++ /dev/null @@ -1,90 +0,0 @@ ---- -- debug: - msg: "Start eos_static_routes merged integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - afi: ipv6 - routes: - - dest: 1000:10::/64 - next_hops: - - admin_distance: 67 - interface: Ethernet1 - tag: 98 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - admin_distance: 23 - interface: Ethernet1 - - afi: ipv6 - routes: - - dest: 1000:10::/64 - next_hops: - - admin_distance: 55 - interface: Ethernet1 - vrf: testvrf - -- name: Replace attributes of given static routes. - eos_static_routes: &replaced - config: - - vrf: "testvrf" - address_families: - - afi: 'ipv6' - routes: - - dest: '1000:10::/64' - next_hops: - - interface: Ethernet1 - admin_distance: 55 - state: replaced - become: yes - register: result - -- eos_facts: - gather_network_resources: static_routes - become: yes - -- assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config) == []" - - '"ipv6 route vrf testvrf 1000:10::/64 Ethernet1 55" in result.commands' - become: yes - -- name: Idempotency check - eos_static_routes: *replaced - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - -- include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_static_routes/tests/cli/rtt.yaml b/test/integration/targets/eos_static_routes/tests/cli/rtt.yaml deleted file mode 100644 index 1890b1f833..0000000000 --- a/test/integration/targets/eos_static_routes/tests/cli/rtt.yaml +++ /dev/null @@ -1,177 +0,0 @@ ---- -- debug: - msg: "Start eos_static_routes merged integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _populate.yaml - -- set_fact: - config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - dest: 155.55.1.0/24 - next_hops: - - nexthop_grp: testgrp - tag: 100 - - afi: ipv6 - routes: - - dest: 1000:10::/64 - next_hops: - - admin_distance: 67 - interface: Ethernet1 - tag: 98 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - admin_distance: 23 - interface: Ethernet1 - - afi: ipv6 - routes: - - dest: 1120:10::/64 - next_hops: - - admin_distance: 55 - interface: Ethernet1 - vrf: testvrf - - - revert_config: - - address_families: - - afi: ipv4 - routes: - - dest: 10.1.1.0/24 - next_hops: - - interface: Management1 - - admin_distance: 200 - forward_router_address: 20.1.1.3 - interface: Ethernet1 - track: bfd - - dest: 10.50.0.0/16 - next_hops: - - interface: Management1 - - dest: 23.1.0.0/16 - next_hops: - - nexthop_grp: testgrp - tag: 42 - - dest: 122.1.19.0/24 - next_hops: - - admin_distance: 21 - nexthop_grp: testgrp - - dest: 155.55.1.0/24 - next_hops: - - nexthop_grp: testgrp - tag: 100 - - afi: ipv6 - routes: - - dest: 1000:10::/64 - next_hops: - - admin_distance: 67 - interface: Ethernet1 - tag: 98 - - address_families: - - afi: ipv4 - routes: - - dest: 77.77.1.0/24 - next_hops: - - interface: 33.1.1.1 - vrf: vrftest1 - - address_families: - - afi: ipv4 - routes: - - dest: 120.1.1.0/24 - next_hops: - - admin_distance: 23 - interface: Ethernet1 - - afi: ipv6 - routes: - - dest: 1120:10::/64 - next_hops: - - admin_distance: 55 - interface: Ethernet1 - vrf: testvrf - -- block: - - name: merge attributes of given static routes. - eos_static_routes: - config: - - vrf: "testvrf" - address_families: - - afi: 'ipv6' - routes: - - dest: '1120:10::/64' - next_hops: - - interface: Ethernet1 - admin_distance: 55 - - address_families: - - afi: 'ipv4' - routes: - - dest: '155.55.1.0/24' - next_hops: - - nexthop_grp: testgrp - tag: 100 - state: merged - become: yes - register: base_config - - - eos_facts: - gather_network_resources: static_routes - become: yes - - - assert: - that: - - "ansible_facts.network_resources.static_routes|symmetric_difference(config) == []" - - - name: Apply the provided configuration (config to be reverted) - eos_static_routes: - config: - - address_families: - - afi: 'ipv4' - routes: - - dest: '122.1.19.0/24' - next_hops: - - nexthop_grp: testgrp - admin_distance: 21 - state: merged - become: yes - register: result - - - assert: - that: - - "result.after|symmetric_difference(revert_config) == []" - - - name: Revert back to base config using facts round trip - eos_static_routes: - config: "{{ ansible_facts['network_resources']['static_routes'] }}" - state: overridden - become: yes - register: revert - - - name: Assert that config was reverted - assert: - that: - - "ansible_facts.network_resources.static_routes | symmetric_difference(revert.after) == []" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/eos_system/defaults/main.yaml b/test/integration/targets/eos_system/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_system/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_system/meta/main.yml b/test/integration/targets/eos_system/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_system/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_system/tasks/cli.yaml b/test/integration/targets/eos_system/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_system/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_system/tasks/eapi.yaml b/test/integration/targets/eos_system/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_system/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_system/tasks/main.yaml b/test/integration/targets/eos_system/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_system/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_system/tests/cli/net_system.yaml b/test/integration/targets/eos_system/tests/cli/net_system.yaml deleted file mode 100644 index 136b633481..0000000000 --- a/test/integration/targets/eos_system/tests/cli/net_system.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START eos cli/net_system.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - match: none - become: yes - -- name: configure domain_list using platform agnostic module - net_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain-list ansible.com' in result.commands" - - "'ip domain-list redhat.com' in result.commands" - -- name: teardown - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - match: none - become: yes - -- debug: msg="END eos cli/net_system.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml b/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml deleted file mode 100644 index 993bc93053..0000000000 --- a/test/integration/targets/eos_system/tests/cli/set_domain_list.yaml +++ /dev/null @@ -1,122 +0,0 @@ ---- -- debug: msg="START cli/set_domain_list.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - match: none - become: yes - -- name: configure domain_list - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain-list ansible.com' in result.commands" - - "'ip domain-list redhat.com' in result.commands" - -- name: verify domain_list - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: remove one entry - eos_system: - domain_list: - - ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'no ip domain-list redhat.com' in result.commands" - -- name: verify remove one entry - eos_system: - domain_list: - - ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: add one entry - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain-list redhat.com' in result.commands" - -- name: verify add one entry - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: add and remove one entry - eos_system: - domain_list: - - ansible.com - - eng.ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'no ip domain-list redhat.com' in result.commands" - - "'ip domain-list eng.ansible.com' in result.commands" - - result.commands|length == 2 - -- name: verify add and remove one entry - eos_system: - domain_list: - - ansible.com - - eng.ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - - no ip domain-list eng.ansible.com - match: none - become: yes - -- debug: msg="END cli/set_domain_list.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml b/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml deleted file mode 100644 index b4903b4a2e..0000000000 --- a/test/integration/targets/eos_system/tests/cli/set_domain_name.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START cli/set_domain_name.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: no ip domain-name - match: none - become: yes - -- name: configure domain_name - eos_system: - domain_name: eng.ansible.com - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify domain_name - eos_system: - domain_name: eng.ansible.com - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip domain-name - match: none - become: yes - -- debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_hostname.yaml b/test/integration/targets/eos_system/tests/cli/set_hostname.yaml deleted file mode 100644 index 17fe6ad2cb..0000000000 --- a/test/integration/targets/eos_system/tests/cli/set_hostname.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START cli/set_hostname.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: hostname switch - match: none - become: yes - -- name: configure hostname - eos_system: - hostname: foo - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify hostname - eos_system: - hostname: foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: "hostname {{ inventory_hostname }}" - match: none - become: yes - -- debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml deleted file mode 100644 index 229d207525..0000000000 --- a/test/integration/targets/eos_system/tests/cli/set_lookup_source.yaml +++ /dev/null @@ -1,68 +0,0 @@ ---- -- debug: msg="START cli/set_lookup_source.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - no ip domain lookup source-interface - - vrf definition ansible - match: none - become: yes - -- name: configure lookup_source - eos_system: - lookup_source: Management1 - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain lookup source-interface Management1' in result.commands" - -- name: verify lookup_source - eos_system: - lookup_source: Management1 - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: change to vrf - eos_system: - lookup_source: - - interface: Management1 - vrf: ansible - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'no ip domain lookup source-interface Management1' in result.commands" - - "'ip domain lookup vrf ansible source-interface Management1' in result.commands" - - result.commands|length == 2 - -- name: verify change to vrf - eos_system: - lookup_source: - - interface: Management1 - vrf: ansible - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - eos_config: - lines: - - no ip domain lookup source-interface - - no vrf definition ansible - match: none - become: yes - -- debug: msg="END cli/set_lookup_source.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml b/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml deleted file mode 100644 index 849e8c1757..0000000000 --- a/test/integration/targets/eos_system/tests/cli/set_name_servers.yaml +++ /dev/null @@ -1,93 +0,0 @@ ---- -- debug: msg="START cli/set_name_servers.yaml on connection={{ ansible_connection }}" - -- name: setup - eos_config: - lines: - - no ip name-server - - vrf definition ansible - match: none - become: yes - -- name: configure name_servers - eos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - become: yes - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 3 - - "'ip name-server 192.0.2.1' in result.commands" - - "'ip name-server 192.0.2.2' in result.commands" - - "'ip name-server 192.0.2.3' in result.commands" - -- name: verify name_servers - eos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - become: yes - register: result - -- assert: - that: - - result.changed == false - -#- name: change to vrf -# eos_system: -# name_servers: -# - 192.0.2.1 -# - { server: 192.0.2.2, vrf: ansible } -# - 192.0.2.3 -# become: yes -# register: result - -#- assert: -# that: -# - result.changed == true -# - result.commands|length == 2 -# - "'no ip name-server 192.0.2.2' in result.commands" -# - "'ip name-server 192.0.2.2 vrf ansible' in result.commands" - -#- name: verify change to vrf -# eos_system: -# name_servers: -# - 192.0.2.1 -# - { server: 192.0.2.2, vrf: ansible } -# - 192.0.2.3 -# become: yes -# register: result -# -#- assert: -# that: -# - result.changed == false - -- name: remove one - eos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - become: yes - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 1 - - "'no ip name-server 192.0.2.3' in result.commands" - -- name: teardown - eos_config: - lines: - - no ip domain lookup source-interface - - no vrf definition ansible - match: none - become: yes - -- debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/eapi/net_system.yaml b/test/integration/targets/eos_system/tests/eapi/net_system.yaml deleted file mode 100644 index d08f2a8e8a..0000000000 --- a/test/integration/targets/eos_system/tests/eapi/net_system.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START eos eapi/net_system.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - match: none - become: yes - -- name: configure domain_list using platform agnostic module - net_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain-list ansible.com' in result.commands" - - "'ip domain-list redhat.com' in result.commands" - -- name: teardown - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - match: none - become: yes - -- debug: msg="END eos eapi/net_system.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml b/test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml deleted file mode 100644 index f6370fa062..0000000000 --- a/test/integration/targets/eos_system/tests/eapi/set_domain_list.yaml +++ /dev/null @@ -1,122 +0,0 @@ ---- -- debug: msg="START eapi/set_domain_list.yaml" - -- name: setup - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - match: none - become: yes - -- name: configure domain_list - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain-list ansible.com' in result.commands" - - "'ip domain-list redhat.com' in result.commands" - -- name: verify domain_list - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: remove one entry - eos_system: - domain_list: - - ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'no ip domain-list redhat.com' in result.commands" - -- name: verify remove one entry - eos_system: - domain_list: - - ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: add one entry - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain-list redhat.com' in result.commands" - -- name: verify add one entry - eos_system: - domain_list: - - ansible.com - - redhat.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: add and remove one entry - eos_system: - domain_list: - - ansible.com - - eng.ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'no ip domain-list redhat.com' in result.commands" - - "'ip domain-list eng.ansible.com' in result.commands" - - result.commands|length == 2 - -- name: verify add and remove one entry - eos_system: - domain_list: - - ansible.com - - eng.ansible.com - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - eos_config: - lines: - - no ip domain-list ansible.com - - no ip domain-list redhat.com - - no ip domain-list eng.ansible.com - match: none - become: yes - -- debug: msg="END eapi/set_domain_list.yaml" diff --git a/test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml b/test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml deleted file mode 100644 index 57725c81f9..0000000000 --- a/test/integration/targets/eos_system/tests/eapi/set_domain_name.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START eapi/set_domain_name.yaml" - -- name: setup - eos_config: - lines: no ip domain-name - match: none - become: yes - -- name: configure domain_name - eos_system: - domain_name: eng.ansible.com - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify domain_name - eos_system: - domain_name: eng.ansible.com - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: no ip domain-name - match: none - become: yes - -- debug: msg="END eapi/set_domain_name.yaml" diff --git a/test/integration/targets/eos_system/tests/eapi/set_hostname.yaml b/test/integration/targets/eos_system/tests/eapi/set_hostname.yaml deleted file mode 100644 index b2a17d4d2b..0000000000 --- a/test/integration/targets/eos_system/tests/eapi/set_hostname.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START eapi/set_hostname.yaml" - -- name: setup - eos_config: - lines: hostname switch - match: none - become: yes - -- name: configure hostname - eos_system: - hostname: foo - become: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify hostname - eos_system: - hostname: foo - become: yes - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - eos_config: - lines: "hostname {{ inventory_hostname }}" - match: none - become: yes - -- debug: msg="END eapi/set_hostname.yaml" diff --git a/test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml b/test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml deleted file mode 100644 index a5a1c998a6..0000000000 --- a/test/integration/targets/eos_system/tests/eapi/set_lookup_source.yaml +++ /dev/null @@ -1,68 +0,0 @@ ---- -- debug: msg="START eapi/set_lookup_source.yaml" - -- name: setup - eos_config: - lines: - - no ip domain lookup source-interface - - vrf definition ansible - match: none - become: yes - -- name: configure lookup_source - eos_system: - lookup_source: Management1 - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'ip domain lookup source-interface Management1' in result.commands" - -- name: verify lookup_source - eos_system: - lookup_source: Management1 - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: change to vrf - eos_system: - lookup_source: - - interface: Management1 - vrf: ansible - become: yes - register: result - -- assert: - that: - - result.changed == true - - "'no ip domain lookup source-interface Management1' in result.commands" - - "'ip domain lookup vrf ansible source-interface Management1' in result.commands" - - result.commands|length == 2 - -- name: verify change to vrf - eos_system: - lookup_source: - - interface: Management1 - vrf: ansible - become: yes - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - eos_config: - lines: - - no ip domain lookup source-interface - - no vrf definition ansible - match: none - become: yes - -- debug: msg="END eapi/set_lookup_source.yaml" diff --git a/test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml b/test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml deleted file mode 100644 index 514e1c7a34..0000000000 --- a/test/integration/targets/eos_system/tests/eapi/set_name_servers.yaml +++ /dev/null @@ -1,93 +0,0 @@ ---- -- debug: msg="START eapi/set_name_servers.yaml" - -- name: setup - eos_config: - lines: - - no ip name-server - - vrf definition ansible - match: none - become: yes - -- name: configure name_servers - eos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - become: yes - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 3 - - "'ip name-server 192.0.2.1' in result.commands" - - "'ip name-server 192.0.2.2' in result.commands" - - "'ip name-server 192.0.2.3' in result.commands" - -- name: verify name_servers - eos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - become: yes - register: result - -- assert: - that: - - result.changed == false - -#- name: change to vrf -# eos_system: -# name_servers: -# - 192.0.2.1 -# - { server: 192.0.2.2, vrf: ansible } -# - 192.0.2.3 -# become: yes -# register: result - -#- assert: -# that: -# - result.changed == true -# - result.commands|length == 2 -# - "'no ip name-server 192.0.2.2' in result.commands" -# - "'ip name-server 192.0.2.2 vrf ansible' in result.commands" - -#- name: verify change to vrf -# eos_system: -# name_servers: -# - 192.0.2.1 -# - { server: 192.0.2.2, vrf: ansible } -# - 192.0.2.3 -# become: yes -# register: result -# -#- assert: -# that: -# - result.changed == false - -- name: remove one - eos_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - become: yes - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 1 - - "'no ip name-server 192.0.2.3' in result.commands" - -- name: teardown - eos_config: - lines: - - no ip domain lookup source-interface - - no vrf definition ansible - match: none - become: yes - -- debug: msg="END eapi/set_name_servers.yaml" diff --git a/test/integration/targets/eos_user/defaults/main.yaml b/test/integration/targets/eos_user/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_user/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_user/meta/main.yaml b/test/integration/targets/eos_user/meta/main.yaml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_user/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_user/tasks/cli.yaml b/test/integration/targets/eos_user/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_user/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_user/tasks/eapi.yaml b/test/integration/targets/eos_user/tasks/eapi.yaml deleted file mode 100644 index 2cf18b6b53..0000000000 --- a/test/integration/targets/eos_user/tasks/eapi.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all eapi test cases - find: - paths: "{{ role_path }}/tests/eapi" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_httpapi diff --git a/test/integration/targets/eos_user/tasks/main.yaml b/test/integration/targets/eos_user/tasks/main.yaml deleted file mode 100644 index 970e74171e..0000000000 --- a/test/integration/targets/eos_user/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: eapi.yaml, tags: ['eapi'] } diff --git a/test/integration/targets/eos_user/tests/cli/auth.yaml b/test/integration/targets/eos_user/tests/cli/auth.yaml deleted file mode 100644 index bb7e022e51..0000000000 --- a/test/integration/targets/eos_user/tests/cli/auth.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- block: - - name: Create user with password - eos_user: - name: auth_user - privilege: 15 - role: network-operator - state: present - provider: "{{ cli }}" - configured_password: pass123 - become: yes - - - name: test login - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version" - responses: - (?i)password: "pass123" - - - name: test login with invalid password (should fail) - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version" - responses: - (?i)password: "badpass" - ignore_errors: yes - register: results - - - name: check that attempt failed - assert: - that: - - results.failed - - always: - - name: delete user - eos_user: - name: auth_user - state: absent - provider: "{{ cli }}" - become: yes - register: result diff --git a/test/integration/targets/eos_user/tests/cli/basic.yaml b/test/integration/targets/eos_user/tests/cli/basic.yaml deleted file mode 100644 index cc12ab88fd..0000000000 --- a/test/integration/targets/eos_user/tests/cli/basic.yaml +++ /dev/null @@ -1,96 +0,0 @@ ---- -- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Set Up - eos_config: - lines: - - no username ansibletest1 - - no username ansibletest2 - - no username ansibletest3 - - no username ansibletest4 - provider: "{{ cli }}" - become: yes - -- name: Create user with role - eos_user: - name: ansibletest1 - privilege: 15 - role: network-operator - state: present - configured_password: test1 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[0]' - - '"role network-operator" in result.commands[1]' - - '"privilege 15" in result.commands[2]' - -- name: Create user with priv level and update_password - eos_user: - name: ansibletest4 - privilege: 15 - state: present - configured_password: test1 - update_password: on_create - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[0]' - - '"privilege 15" in result.commands[1]' - -- name: Collection of users - eos_user: - aggregate: - - { name: ansibletest2, configured_password: test2 } - - { name: ansibletest3, configured_password: test3 } - state: present - role: network-operator - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"role network-operator" in result.commands[1]' - - '"secret" in result.commands[0]' - - '"username" in result.commands[2]' - - '"role network-operator" in result.commands[3]' - - '"secret" in result.commands[2]' - -- name: Add user without password or nopassword arg(Should fail) - eos_user: - name: faileduser1 - privilege: 15 - state: present - provider: "{{ cli }}" - become: yes - ignore_errors: yes - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.failed == true' - - 'result.msg == "configured_password, sshkey or nopassword should be provided"' - -- name: tearDown - eos_config: - lines: - - no username ansibletest1 - - no username ansibletest2 - - no username ansibletest3 - - no username ansibletest4 - provider: "{{ cli }}" - become: yes diff --git a/test/integration/targets/eos_user/tests/cli/net_user.yaml b/test/integration/targets/eos_user/tests/cli/net_user.yaml deleted file mode 100644 index e5eeb5c181..0000000000 --- a/test/integration/targets/eos_user/tests/cli/net_user.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: msg="START eos cli/net_user.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Set Up - eos_config: - lines: - - no username ansibletest1 - provider: "{{ cli }}" - become: yes - -- name: Create user with role using platform agnostic module - net_user: - name: ansibletest1 - privilege: 15 - role: network-operator - state: present - configured_password: test1 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[0]' - - '"role network-operator" in result.commands[1]' - - '"privilege 15" in result.commands[2]' - -- name: Teardown - eos_config: - lines: - - no username ansibletest1 - provider: "{{ cli }}" - become: yes - -- debug: msg="END eos cli/net_user.yaml on connection={{ ansible_connection }}"
\ No newline at end of file diff --git a/test/integration/targets/eos_vlan/defaults/main.yaml b/test/integration/targets/eos_vlan/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_vlan/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_vlan/meta/main.yml b/test/integration/targets/eos_vlan/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_vlan/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_vlan/tasks/cli.yaml b/test/integration/targets/eos_vlan/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_vlan/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_vlan/tasks/main.yaml b/test/integration/targets/eos_vlan/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/eos_vlan/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_vlan/tests/cli/basic.yaml b/test/integration/targets/eos_vlan/tests/cli/basic.yaml deleted file mode 100644 index 11b869d01c..0000000000 --- a/test/integration/targets/eos_vlan/tests/cli/basic.yaml +++ /dev/null @@ -1,282 +0,0 @@ ---- - -- name: setup - remove vlans used in test - eos_config: - lines: - - no vlan 4000 - - no vlan 4001 - - no vlan 4002 - provider: "{{ cli }}" - become: yes - -- name: setup - remove switchport settings on interface Ethernet1 used in test - eos_config: - lines: - - switchport - - no switchport access vlan 4000 - parents: interface Ethernet1 - provider: "{{ cli }}" - become: yes - -- name: setup - remove switchport settings on interface Ethernet2 used in test - eos_config: - lines: - - switchport - - no switchport access vlan 4000 - parents: interface Ethernet2 - provider: "{{ cli }}" - become: yes - -- name: Create vlan - eos_vlan: - vlan_id: 4000 - name: vlan-4000 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 4000' in result.commands" - - "'name vlan-4000' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create vlan again (idempotent) - eos_vlan: - vlan_id: 4000 - name: vlan-4000 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Change vlan name and state - eos_vlan: - vlan_id: 4000 - name: vlan-4000-new - state: suspend - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 4000' in result.commands" - - "'name vlan-4000-new' in result.commands" - - "'state suspend' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Change vlan name and state again (idempotent) - eos_vlan: - vlan_id: 4000 - name: vlan-4000-new - state: suspend - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Unsuspend vlan - eos_vlan: - vlan_id: 4000 - state: active - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 4000' in result.commands" - - "'state active' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Add interfaces to vlan and check state - eos_vlan: - vlan_id: 4000 - state: present - interfaces: - - Ethernet1 - - Ethernet2 - associated_interfaces: - - Ethernet1 - - Ethernet2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 4000' in result.commands" - - "'interface Ethernet1' in result.commands" - - "'switchport access vlan 4000' in result.commands" - - "'interface Ethernet2' in result.commands" - - "'switchport access vlan 4000' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Add interfaces to vlan again (idempotent) - eos_vlan: - vlan_id: 4000 - state: present - interfaces: - - Ethernet 1 # interface name space scenario - - Ethernet 2 # interface name space scenario - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: vlan interface intent fail - eos_vlan: - vlan_id: 4000 - state: present - associated_interfaces: - - test - provider: "{{ cli }}" - become: yes - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == True" - -- name: Remove interface from vlan - eos_vlan: - vlan_id: 4000 - state: present - interfaces: - - Ethernet1 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 4000' in result.commands" - - "'interface Ethernet2' in result.commands" - - "'no switchport access vlan 4000' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Remove interface from vlan again (idempotent) - eos_vlan: - vlan_id: 4000 - state: present - interfaces: - - Ethernet 1 # space scenario - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Create aggregate of vlans - eos_vlan: - aggregate: - - {vlan_id: 4000, state: absent} - - {vlan_id: 4001, name: vlan-4001} - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no vlan 4000' in result.commands" - - "'vlan 4001' in result.commands" - - "'name vlan-4001' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create aggregate of vlans again (idempotent) - eos_vlan: - aggregate: - - {vlan_id: 4000, state: absent} - - {vlan_id: 4001, name: vlan-4001} - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Create vlan with purge - eos_vlan: - aggregate: - - {vlan_id: 4002, name: vlan-4002} - name: vlan-4002 - state: present - purge: yes - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'no vlan 4001' in result.commands" - - "'vlan 4002' in result.commands" - - "'name vlan-4002' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create vlan with purge - eos_vlan: - aggregate: - - {vlan_id: 4002, name: vlan-4002} - name: vlan-4002 - state: present - purge: yes - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_vlan/tests/cli/net_vlan.yaml b/test/integration/targets/eos_vlan/tests/cli/net_vlan.yaml deleted file mode 100644 index 8fcb93b13d..0000000000 --- a/test/integration/targets/eos_vlan/tests/cli/net_vlan.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- debug: msg="START eos cli/net_vlan.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - remove vlans used in test - eos_config: - lines: - - no vlan 4000 - provider: "{{ cli }}" - become: yes - -- name: Create vlan using platform agnostic vlan module - net_vlan: - vlan_id: 4000 - name: vlan-4000 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vlan 4000' in result.commands" - - "'name vlan-4000' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: setup - remove vlans used in test - eos_config: - lines: - - no vlan 4000 - provider: "{{ cli }}" - become: yes - -- debug: msg="END eos cli/net_vlan.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_vlans/defaults/main.yaml b/test/integration/targets/eos_vlans/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/eos_vlans/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/eos_vlans/meta/main.yml b/test/integration/targets/eos_vlans/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_vlans/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_vlans/tasks/main.yaml b/test/integration/targets/eos_vlans/tasks/main.yaml deleted file mode 100644 index 068963b4c3..0000000000 --- a/test/integration/targets/eos_vlans/tasks/main.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - delegate_to: localhost - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_vlans/tests/cli/deleted.yaml b/test/integration/targets/eos_vlans/tests/cli/deleted.yaml deleted file mode 100644 index 6cd5130428..0000000000 --- a/test/integration/targets/eos_vlans/tests/cli/deleted.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - vlan_id: 20 - -- eos_facts: - gather_network_resources: vlans - become: yes - -- name: Returns vlans to default parameters - eos_vlans: - config: "{{ config }}" - state: deleted - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: vlans - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: - - vlan_id: 10 - name: ten - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.vlans) == []" diff --git a/test/integration/targets/eos_vlans/tests/cli/idempotent.yaml b/test/integration/targets/eos_vlans/tests/cli/idempotent.yaml deleted file mode 100644 index d88e318ba9..0000000000 --- a/test/integration/targets/eos_vlans/tests/cli/idempotent.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- eos_facts: - gather_network_resources: vlans - become: yes - -- name: Ensures that facts are idempotent through replace - eos_vlans: - config: "{{ ansible_facts.network_resources.vlans }}" - state: replaced - register: result - become: yes - -- eos_facts: - gather_network_resources: vlans - become: yes - -- assert: - that: - - "result.changed == False" - - "result.commands == []" - - "ansible_facts.network_resources.vlans|symmetric_difference(result.before) == []" diff --git a/test/integration/targets/eos_vlans/tests/cli/merged.yaml b/test/integration/targets/eos_vlans/tests/cli/merged.yaml deleted file mode 100644 index 5ad3f08597..0000000000 --- a/test/integration/targets/eos_vlans/tests/cli/merged.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - vlan_id: 20 - state: suspend - -- eos_facts: - gather_network_resources: vlans - become: yes - -- name: Merge provided configuration with device configuration - eos_vlans: - config: "{{ config }}" - state: merged - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: vlans - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: - - vlan_id: 10 - name: ten - - vlan_id: 20 - name: twenty - state: suspend - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.vlans) == []" diff --git a/test/integration/targets/eos_vlans/tests/cli/overridden.yaml b/test/integration/targets/eos_vlans/tests/cli/overridden.yaml deleted file mode 100644 index ea406b6b47..0000000000 --- a/test/integration/targets/eos_vlans/tests/cli/overridden.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - vlan_id: 20 - state: suspend - - vlan_id: 50 - name: fifty - -- eos_facts: - gather_network_resources: vlans - become: yes - -- name: Overrides device configuration of all vlans with provided configuration - eos_vlans: - config: "{{ config }}" - state: overridden - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: vlans - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }}" - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.vlans) == []" diff --git a/test/integration/targets/eos_vlans/tests/cli/replaced.yaml b/test/integration/targets/eos_vlans/tests/cli/replaced.yaml deleted file mode 100644 index 13d68274d2..0000000000 --- a/test/integration/targets/eos_vlans/tests/cli/replaced.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- include_tasks: reset_config.yml - -- set_fact: - config: - - vlan_id: 20 - state: suspend - name: twentyreplaced - other_config: - - vlan_id: 10 - name: ten - -- eos_facts: - gather_network_resources: vlans - become: yes - -- name: Replaces device configuration of listed vlans with provided configuration - eos_vlans: - config: "{{ config }}" - state: replaced - register: result - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.before) == []" - -- eos_facts: - gather_network_resources: vlans - become: yes - -- assert: - that: - - "ansible_facts.network_resources.vlans|symmetric_difference(result.after) == []" - -- set_fact: - expected_config: "{{ config }} + {{ other_config }}" - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.vlans) == []" diff --git a/test/integration/targets/eos_vlans/tests/cli/reset_config.yml b/test/integration/targets/eos_vlans/tests/cli/reset_config.yml deleted file mode 100644 index 513a1199b1..0000000000 --- a/test/integration/targets/eos_vlans/tests/cli/reset_config.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: Reset initial config - cli_config: - config: | - no vlan 1-4094 - vlan 10 - name ten - vlan 20 - name twenty - become: yes - -- eos_facts: - gather_network_resources: vlans - become: yes - -- set_fact: - expected_config: - - vlan_id: 10 - name: ten - - vlan_id: 20 - name: twenty - -- assert: - that: - - "expected_config|symmetric_difference(ansible_facts.network_resources.vlans) == []" diff --git a/test/integration/targets/eos_vrf/aliases b/test/integration/targets/eos_vrf/aliases deleted file mode 100644 index e69de29bb2..0000000000 --- a/test/integration/targets/eos_vrf/aliases +++ /dev/null diff --git a/test/integration/targets/eos_vrf/defaults/main.yaml b/test/integration/targets/eos_vrf/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/eos_vrf/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/eos_vrf/meta/main.yml b/test/integration/targets/eos_vrf/meta/main.yml deleted file mode 100644 index e5c8cd02f0..0000000000 --- a/test/integration/targets/eos_vrf/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_eos_tests diff --git a/test/integration/targets/eos_vrf/tasks/cli.yaml b/test/integration/targets/eos_vrf/tasks/cli.yaml deleted file mode 100644 index 82d196e4ed..0000000000 --- a/test/integration/targets/eos_vrf/tasks/cli.yaml +++ /dev/null @@ -1,17 +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 cases (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: connection_network_cli diff --git a/test/integration/targets/eos_vrf/tasks/main.yaml b/test/integration/targets/eos_vrf/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/eos_vrf/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/eos_vrf/tests/cli/basic.yaml b/test/integration/targets/eos_vrf/tests/cli/basic.yaml deleted file mode 100644 index b702495705..0000000000 --- a/test/integration/targets/eos_vrf/tests/cli/basic.yaml +++ /dev/null @@ -1,307 +0,0 @@ ---- - -- name: setup - remove vrf - eos_vrf: - name: "{{ item }}" - state: absent - provider: "{{ cli }}" - become: yes - with_items: - - test - - test1 - - test2 - - test3 - - test4 - - test5 - -- name: Create vrf - eos_vrf: - name: test - rd: 1:200 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vrf definition test' in result.commands" - - "'rd 1:200' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create vrf again (idempotent) - eos_vrf: - name: test - rd: 1:200 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Modify rd - eos_vrf: - name: test - rd: 1:201 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vrf definition test' in result.commands" - - "'rd 1:201' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Modify rd again (idempotent) - eos_vrf: - name: test - rd: 1:201 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Add Ethernet2 to vrf and check interface assigned state - eos_vrf: - name: test - rd: 1:201 - state: present - interfaces: - - Ethernet2 - associated_interfaces: - - Ethernet2 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'interface ethernet2' in result.commands" - - "'vrf forwarding test' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Add Ethernet2 to vrf again (idempotent) - eos_vrf: - name: test - rd: 1:201 - state: present - interfaces: - - ethernet 2 # interface name modified to test case insensitive and space scenario - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'session_name' not in result.commands" - -- name: vrf interface intent fail - eos_vrf: - name: test - state: present - associated_interfaces: - - test - provider: "{{ cli }}" - become: yes - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == True" - -- name: Add multiple interfaces to vrf - eos_vrf: - name: test1 - rd: 1:202 - state: present - interfaces: - - loopback10 - - loopback11 - - loopback12 - - loopback13 - - loopback14 - - loopback15 - - loopback1000 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'interface loopback10' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'interface loopback11' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'interface loopback12' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'interface loopback13' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'interface loopback14' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'interface loopback15' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'interface loopback1000' in result.commands" - - "'vrf forwarding test1' in result.commands" - - "'ansible_1' in result.session_name" - -- name: Add multiple interfaces to vrf (idempotent) - eos_vrf: - name: test1 - rd: 1:202 - state: present - interfaces: - - loopback10 - - loopback11 - - loopback12 - - loopback13 - - loopback14 - - loopback15 - - loopback1000 - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - -- name: setup - remove vrf - eos_vrf: - name: "{{ item }}" - state: absent - provider: "{{ cli }}" - become: yes - with_items: - - test1 - - test2 - - test3 - -- name: Create aggregate of VRFs - eos_vrf: - aggregate: - - { name: test2, rd: "1:202" } - - { name: test3, rd: "1:203" } - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vrf definition test2' in result.commands" - - "'rd 1:202' in result.commands" - - "'vrf definition test3' in result.commands" - - "'rd 1:203' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Create aggregate of VRFs again (idempotent) - eos_vrf: - aggregate: - - { name: test2, rd: "1:202" } - - { name: test3, rd: "1:203" } - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "result.session_name is not defined" - -- name: Create aggregate of VRFs with purge - eos_vrf: - aggregate: - - { name: test4, rd: "1:204" } - - { name: test5, rd: "1:205" } - state: present - purge: yes - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vrf definition test4' in result.commands" - - "'rd 1:204' in result.commands" - - "'vrf definition test5' in result.commands" - - "'rd 1:205' in result.commands" - - "'no vrf definition test' in result.commands" - - "'no vrf definition test2' in result.commands" - - "'no vrf definition test3' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: Delete VRFs - eos_vrf: - name: test - state: absent - provider: "{{ cli }}" - become: yes - -- name: Delete VRFs again (idempotent) - eos_vrf: - name: test - state: absent - provider: "{{ cli }}" - become: yes - -- name: Delete aggregate of VRFs - eos_vrf: - aggregate: - - { name: test1 } - - { name: test2 } - - { name: test3 } - - { name: test4 } - - { name: test5 } - state: absent - provider: "{{ cli }}" - become: yes - -- name: Delete VRFs again (idempotent) - eos_vrf: - aggregate: - - { name: test1 } - - { name: test2 } - - { name: test3 } - - { name: test4 } - - { name: test5 } - state: absent - provider: "{{ cli }}" - become: yes - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/eos_vrf/tests/cli/net_vrf.yaml b/test/integration/targets/eos_vrf/tests/cli/net_vrf.yaml deleted file mode 100644 index c7abce9f20..0000000000 --- a/test/integration/targets/eos_vrf/tests/cli/net_vrf.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- debug: msg="START eos cli/net_vrf.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - remove vrf - net_vrf: - name: test - state: absent - provider: "{{ cli }}" - become: yes - -- name: Create vrf using platform agnostic vrf module - net_vrf: - name: test - rd: 1:200 - state: present - provider: "{{ cli }}" - become: yes - register: result - -- assert: - that: - - "result.changed == true" - - "'vrf definition test' in result.commands" - - "'rd 1:200' in result.commands" - # Ensure sessions contains epoc. Will fail after 18th May 2033 - - "'ansible_1' in result.session_name" - -- name: teardown - remove vrf - net_vrf: - name: test - state: absent - provider: "{{ cli }}" - become: yes - -- debug: msg="END eos cli/net_vrf.yaml on connection={{ ansible_connection }}" diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index d339216d38..948c760854 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -94,18 +94,6 @@ lib/ansible/module_utils/network/dellos6/dellos6.py future-import-boilerplate lib/ansible/module_utils/network/dellos6/dellos6.py metaclass-boilerplate lib/ansible/module_utils/network/dellos9/dellos9.py future-import-boilerplate lib/ansible/module_utils/network/dellos9/dellos9.py metaclass-boilerplate -lib/ansible/module_utils/network/eos/eos.py future-import-boilerplate -lib/ansible/module_utils/network/eos/eos.py metaclass-boilerplate -lib/ansible/module_utils/network/eos/providers/cli/config/bgp/address_family.py future-import-boilerplate -lib/ansible/module_utils/network/eos/providers/cli/config/bgp/address_family.py metaclass-boilerplate -lib/ansible/module_utils/network/eos/providers/cli/config/bgp/neighbors.py future-import-boilerplate -lib/ansible/module_utils/network/eos/providers/cli/config/bgp/neighbors.py metaclass-boilerplate -lib/ansible/module_utils/network/eos/providers/cli/config/bgp/process.py future-import-boilerplate -lib/ansible/module_utils/network/eos/providers/cli/config/bgp/process.py metaclass-boilerplate -lib/ansible/module_utils/network/eos/providers/module.py future-import-boilerplate -lib/ansible/module_utils/network/eos/providers/module.py metaclass-boilerplate -lib/ansible/module_utils/network/eos/providers/providers.py future-import-boilerplate -lib/ansible/module_utils/network/eos/providers/providers.py metaclass-boilerplate lib/ansible/module_utils/network/ios/ios.py future-import-boilerplate lib/ansible/module_utils/network/ios/ios.py metaclass-boilerplate lib/ansible/module_utils/network/ios/providers/cli/config/base.py future-import-boilerplate @@ -1681,121 +1669,6 @@ lib/ansible/modules/network/dellos9/dellos9_facts.py validate-modules:doc-requir lib/ansible/modules/network/dellos9/dellos9_facts.py validate-modules:parameter-list-no-elements lib/ansible/modules/network/dellos9/dellos9_facts.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/network/dellos9/dellos9_facts.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/_eos_interface.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/_eos_l2_interface.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/_eos_l3_interface.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/_eos_linkagg.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/_eos_vlan.py future-import-boilerplate -lib/ansible/modules/network/eos/_eos_vlan.py metaclass-boilerplate -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/_eos_vlan.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/eos_banner.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_banner.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_banner.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_banner.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_bgp.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/eos_bgp.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/eos_bgp.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_bgp.py validate-modules:doc-type-does-not-match-spec -lib/ansible/modules/network/eos/eos_bgp.py validate-modules:invalid-ansiblemodule-schema -lib/ansible/modules/network/eos/eos_bgp.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_command.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_command.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_command.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_command.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_command.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_command.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_config.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_config.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_config.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_config.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_config.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_config.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_eapi.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_eapi.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_eapi.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/eos/eos_eapi.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_eapi.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_eapi.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_facts.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_facts.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_interfaces.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_l2_interfaces.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_lldp.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/eos_lldp.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_lldp.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_logging.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_logging.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_logging.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/eos_logging.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/eos_logging.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_logging.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_logging.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/eos_logging.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_logging.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/_eos_static_route.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/eos_system.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_system.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_system.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_system.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_system.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_system.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_user.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_user.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_user.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/eos_user.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/eos_user.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_user.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_user.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/eos_user.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_user.py validate-modules:undocumented-parameter -lib/ansible/modules/network/eos/eos_vrf.py future-import-boilerplate -lib/ansible/modules/network/eos/eos_vrf.py metaclass-boilerplate -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:doc-missing-type -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/eos/eos_vrf.py validate-modules:undocumented-parameter lib/ansible/modules/network/f5/bigip_apm_acl.py validate-modules:doc-elements-mismatch lib/ansible/modules/network/f5/bigip_apm_acl.py validate-modules:doc-required-mismatch lib/ansible/modules/network/f5/bigip_apm_network_access.py validate-modules:doc-required-mismatch @@ -3362,7 +3235,6 @@ lib/ansible/plugins/action/bigiq.py action-plugin-docs # undocumented action plu lib/ansible/plugins/action/dellos10.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/dellos6.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/dellos9.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` -lib/ansible/plugins/action/eos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` @@ -3390,8 +3262,6 @@ lib/ansible/plugins/doc_fragments/dellos6.py future-import-boilerplate lib/ansible/plugins/doc_fragments/dellos6.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/dellos9.py future-import-boilerplate lib/ansible/plugins/doc_fragments/dellos9.py metaclass-boilerplate -lib/ansible/plugins/doc_fragments/eos.py future-import-boilerplate -lib/ansible/plugins/doc_fragments/eos.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/f5.py future-import-boilerplate lib/ansible/plugins/doc_fragments/f5.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/files.py future-import-boilerplate diff --git a/test/units/modules/network/eos/eos_module.py b/test/units/modules/network/eos/eos_module.py deleted file mode 100644 index fb0398cdac..0000000000 --- a/test/units/modules/network/eos/eos_module.py +++ /dev/null @@ -1,103 +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 - -import json -import os - -from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase - - -fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') -fixture_data = {} - - -def load_fixture(name): - path = os.path.join(fixture_path, name) - - if path in fixture_data: - return fixture_data[path] - - with open(path) as f: - data = f.read() - try: - data = json.loads(data) - except Exception: - pass - - fixture_data[path] = data - return data - - -class TestEosModule(ModuleTestCase): - - def execute_module(self, failed=False, changed=False, commands=None, inputs=None, sort=True, defaults=False, transport='cli', filename=None): - - if filename is None: - self.load_fixtures(commands, transport=transport) - else: - self.load_fixtures(commands, transport=transport, filename=filename) - - if failed: - result = self.failed() - self.assertTrue(result['failed'], result) - else: - result = self.changed(changed) - self.assertEqual(result['changed'], changed, result) - if commands is not None: - if transport == 'eapi': - cmd = [] - value = [] - for item in result['commands']: - cmd.append(item['cmd']) - if 'input' in item: - value.append(item['input']) - if sort: - self.assertEqual(sorted(commands), sorted(cmd), cmd) - else: - self.assertEqual(commands, cmd, cmd) - if inputs: - self.assertEqual(inputs, value, value) - else: - if sort: - self.assertEqual(sorted(commands), sorted(result['commands']), result['commands']) - else: - self.assertEqual(commands, result['commands'], result['commands']) - - return result - - def failed(self): - with self.assertRaises(AnsibleFailJson) as exc: - self.module.main() - - result = exc.exception.args[0] - self.assertTrue(result['failed'], result) - return result - - def changed(self, changed=False): - with self.assertRaises(AnsibleExitJson) as exc: - self.module.main() - - result = exc.exception.args[0] - self.assertEqual(result['changed'], changed, result) - return result - - def load_fixtures(self, commands=None, transport='cli', filename=None): - pass diff --git a/test/units/modules/network/eos/fixtures/eos_acl_interfaces_config.cfg b/test/units/modules/network/eos/fixtures/eos_acl_interfaces_config.cfg deleted file mode 100644 index 3a60567925..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_acl_interfaces_config.cfg +++ /dev/null @@ -1,6 +0,0 @@ -interface GigabitEthernet0/0 -ip access-group aclv404 in -ipv6 access-group aclv601 out -interface GigabitEthernet0/1 -ipv6 access-group aclv601 in - diff --git a/test/units/modules/network/eos/fixtures/eos_acls_config.cfg b/test/units/modules/network/eos/fixtures/eos_acls_config.cfg deleted file mode 100644 index fa4e4aae57..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_acls_config.cfg +++ /dev/null @@ -1,3 +0,0 @@ -ip access-list test1 - 35 deny tcp 20.0.0.0/8 any log - 45 permit tcp any any diff --git a/test/units/modules/network/eos/fixtures/eos_banner_show_banner.txt b/test/units/modules/network/eos/fixtures/eos_banner_show_banner.txt deleted file mode 100644 index a134a31753..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_banner_show_banner.txt +++ /dev/null @@ -1,3 +0,0 @@ -this is a sample -mulitline banner -used for testing diff --git a/test/units/modules/network/eos/fixtures/eos_bgp_config.cfg b/test/units/modules/network/eos/fixtures/eos_bgp_config.cfg deleted file mode 100644 index 3df62417d1..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_bgp_config.cfg +++ /dev/null @@ -1,24 +0,0 @@ -router bgp 64496 - bgp router-id 192.0.2.1 - bgp log-neighbor-changes - neighbor 198.51.100.102 remote-as 64498 - neighbor 198.51.100.102 timers 300 360 - neighbor 192.0.2.111 remote-as 64496 - neighbor 192.0.2.111 update-source Ethernet1 - neighbor 203.0.113.5 remote-as 64511 - neighbor 203.0.113.5 maximum-routes 500 - redistribute ospf route-map RMAP_1 - address-family ipv4 - neighbor 198.51.100.102 activate - neighbor 198.51.100.102 graceful-restart - neighbor 198.51.100.102 default-originate - neighbor 198.51.100.102 weight 25 - neighbor 192.0.2.111 activate - neighbor 192.0.2.111 default-originate - network 192.0.2.0/27 route-map RMAP_1 - network 198.51.100.0/24 route-map RMAP_2 - ! - address-family ipv6 - network 2001:db8:8000::/34 - network 2001:db8:c000::/34 - diff --git a/test/units/modules/network/eos/fixtures/eos_command_show_version.txt b/test/units/modules/network/eos/fixtures/eos_command_show_version.txt deleted file mode 100644 index 07c427ba92..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_command_show_version.txt +++ /dev/null @@ -1,15 +0,0 @@ -Arista vEOS -Hardware version: -Serial number: -System MAC address: 0050.564a.009e - -Software image version: 4.15.4F -Architecture: i386 -Internal build version: 4.15.4F-2923910.4154F -Internal build ID: d8a3c846-c735-4766-93cd-82bb7427da51 - -Uptime: 30 weeks, 3 days, 18 hours and 28 minutes -Total memory: 1897592 kB -Free memory: 63424 kB - - diff --git a/test/units/modules/network/eos/fixtures/eos_config_candidate.cfg b/test/units/modules/network/eos/fixtures/eos_config_candidate.cfg deleted file mode 100644 index b11bc93e25..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_config_candidate.cfg +++ /dev/null @@ -1,7 +0,0 @@ -hostname switch01 -! -interface Ethernet1 - description test interface - no shutdown -! -ip routing diff --git a/test/units/modules/network/eos/fixtures/eos_config_config.cfg b/test/units/modules/network/eos/fixtures/eos_config_config.cfg deleted file mode 100644 index 6a471371a5..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_config_config.cfg +++ /dev/null @@ -1,26 +0,0 @@ -! -hostname localhost -ip domain-name eng.ansible.com -! -vrf definition mgmt -! -vrf definition test -! -interface Management1 - ip address 192.168.1.1/24 -! -interface Ethernet1 - shutdown -! -interface Ethernet2 - shutdown -! -interface Ethernet3 - shutdown -! -interface Ethernet4 - shutdown -! -interface Ethernet5 - shutdown -! diff --git a/test/units/modules/network/eos/fixtures/eos_config_config_updated.cfg b/test/units/modules/network/eos/fixtures/eos_config_config_updated.cfg deleted file mode 100644 index 416cd59974..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_config_config_updated.cfg +++ /dev/null @@ -1,26 +0,0 @@ -! -hostname changed -ip domain-name eng.ansible.com -! -vrf definition mgmt -! -vrf definition test -! -interface Management1 - ip address 192.168.1.1/24 -! -interface Ethernet1 - shutdown -! -interface Ethernet2 - shutdown -! -interface Ethernet3 - shutdown -! -interface Ethernet4 - shutdown -! -interface Ethernet5 - shutdown -! diff --git a/test/units/modules/network/eos/fixtures/eos_eapi_show_mgmt.json b/test/units/modules/network/eos/fixtures/eos_eapi_show_mgmt.json deleted file mode 100644 index 444d47d30d..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_eapi_show_mgmt.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "httpServer": { - "running": true, - "configured": true, - "port": 80 - }, - "users": { - "admin": { - "requestCount": 17153, - "bytesOut": 19950055, - "lastHitTime": 1484142997.1464522, - "bytesIn": 3189628 - } - }, - "localHttpServer": { - "running": true, - "configured": true, - "port": 8080 - }, - "executionTime": 6642.150056908686, - "dscpValue": 0, - "bytesOut": 19950055, - "enabled": true, - "httpsServer": { - "running": true, - "configured": true, - "port": 443 - }, - "corsOrigins": [], - "hitCount": 17318, - "vrf": "default", - "urls": [ - "Management1 : https://172.26.4.24:443", - "Management1 : http://172.26.4.24:80", - "Unix Socket : unix:/var/run/command-api.sock", - "Local : http://localhost:8080/command-api" - ], - "lastHitTime": 1484142997.146127, - "unixSocketServer": { - "running": true, - "configured": true - }, - "requestCount": 17153, - "commandCount": 59298, - "bytesIn": 3189628 -} - diff --git a/test/units/modules/network/eos/fixtures/eos_eapi_show_mgmt_unconfigured.json b/test/units/modules/network/eos/fixtures/eos_eapi_show_mgmt_unconfigured.json deleted file mode 100644 index 8a17b19abc..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_eapi_show_mgmt_unconfigured.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "httpServer": { - "running": false, - "configured": false, - "port": 80 - }, - "users": { - "admin": { - "requestCount": 17153, - "bytesOut": 19950055, - "lastHitTime": 1484142997.1464522, - "bytesIn": 3189628 - } - }, - "localHttpServer": { - "running": false, - "configured": false, - "port": 8080 - }, - "executionTime": 6642.150056908686, - "dscpValue": 0, - "bytesOut": 19950055, - "enabled": false, - "httpsServer": { - "running": false, - "configured": false, - "port": 443 - }, - "corsOrigins": [], - "hitCount": 17318, - "vrf": "default", - "urls": [], - "lastHitTime": 1484142997.146127, - "unixSocketServer": { - "running": false, - "configured": false - }, - "requestCount": 17153, - "commandCount": 59298, - "bytesIn": 3189628 -} - diff --git a/test/units/modules/network/eos/fixtures/eos_eapi_show_vrf.text b/test/units/modules/network/eos/fixtures/eos_eapi_show_vrf.text deleted file mode 100644 index b320bdc63a..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_eapi_show_vrf.text +++ /dev/null @@ -1,11 +0,0 @@ -Maximum number of vrfs allowed: 14 - Vrf RD Protocols State Interfaces ---------- ----------- --------------- -------------------- -------------------- - mgmt 1:101 ipv4,ipv6 v4:no routing, - v6:no routing - - test 1:100 ipv4,ipv6 v4:routing, Ethernet5, Ethernet6 - v6:no routing - - - diff --git a/test/units/modules/network/eos/fixtures/eos_interfaces_config.cfg b/test/units/modules/network/eos/fixtures/eos_interfaces_config.cfg deleted file mode 100644 index 8cd6f1fc00..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_interfaces_config.cfg +++ /dev/null @@ -1,5 +0,0 @@ -interface Ethernet1 - description "Interface 1" -interface Ethernet2 -interface Management1 - description "Management interface" diff --git a/test/units/modules/network/eos/fixtures/eos_l2_interfaces_config.cfg b/test/units/modules/network/eos/fixtures/eos_l2_interfaces_config.cfg deleted file mode 100644 index 08f75d18db..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_l2_interfaces_config.cfg +++ /dev/null @@ -1,12 +0,0 @@ -interface Ethernet1 - switchport access vlan 20 -! -interface Ethernet2 - switchport trunk native vlan 20 - switchport mode trunk -! -interface Management1 - ip address dhcp - ipv6 address auto-config -! - diff --git a/test/units/modules/network/eos/fixtures/eos_lacp_config.cfg b/test/units/modules/network/eos/fixtures/eos_lacp_config.cfg deleted file mode 100644 index 729ece989a..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_lacp_config.cfg +++ /dev/null @@ -1 +0,0 @@ -lacp system-priority 10 diff --git a/test/units/modules/network/eos/fixtures/eos_lacp_interfaces_config.cfg b/test/units/modules/network/eos/fixtures/eos_lacp_interfaces_config.cfg deleted file mode 100644 index 452e2a9f90..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_lacp_interfaces_config.cfg +++ /dev/null @@ -1,4 +0,0 @@ -interface Ethernet1 - lacp port-priority 30 -interface Ethernet2 - lacp rate fast diff --git a/test/units/modules/network/eos/fixtures/eos_logging_config.cfg b/test/units/modules/network/eos/fixtures/eos_logging_config.cfg deleted file mode 100644 index 192835906c..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_logging_config.cfg +++ /dev/null @@ -1,6 +0,0 @@ -! -logging host 175.16.0.10 -logging console warnings -logging buffered 50000 informational -logging facility local7 -! diff --git a/test/units/modules/network/eos/fixtures/eos_static_routes_config.cfg b/test/units/modules/network/eos/fixtures/eos_static_routes_config.cfg deleted file mode 100644 index 6ec815d7dc..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_static_routes_config.cfg +++ /dev/null @@ -1,3 +0,0 @@ -ip route 10.1.1.0/24 Management1 -ip route vrf testvrf 120.1.1.0/24 Ethernet1 23 -ipv6 route 1000:10::/64 Ethernet1 67 tag 98 diff --git a/test/units/modules/network/eos/fixtures/eos_static_routes_config1.cfg b/test/units/modules/network/eos/fixtures/eos_static_routes_config1.cfg deleted file mode 100644 index db829ee8c1..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_static_routes_config1.cfg +++ /dev/null @@ -1 +0,0 @@ -ip route 10.1.1.0/24 Management1 diff --git a/test/units/modules/network/eos/fixtures/eos_system_config.cfg b/test/units/modules/network/eos/fixtures/eos_system_config.cfg deleted file mode 100644 index 08837ec406..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_system_config.cfg +++ /dev/null @@ -1,12 +0,0 @@ -! -hostname switch01 -ip domain lookup source-interface Management1 -ip name-server vrf mgmt 8.8.4.4 -ip name-server vrf default 8.8.8.8 -ip domain-name eng.ansible.com -ip domain-list ansible.com -ip domain-list ops.ansible.com -! -vrf definition mgmt -! -vrf definition test diff --git a/test/units/modules/network/eos/fixtures/eos_user_config.cfg b/test/units/modules/network/eos/fixtures/eos_user_config.cfg deleted file mode 100644 index 76d7695378..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_user_config.cfg +++ /dev/null @@ -1,2 +0,0 @@ -username admin role network-admin secret 5 $1$mdQIUxjg$3t3lzBpfKfITKvFm1uEIY. -username ansible role network-admin secret 5 $1$3yWSXiIi$VdzV59ChiurrNdGxlDeAW/ diff --git a/test/units/modules/network/eos/fixtures/eos_vlan_config.cfg b/test/units/modules/network/eos/fixtures/eos_vlan_config.cfg deleted file mode 100644 index 25d26a3602..0000000000 --- a/test/units/modules/network/eos/fixtures/eos_vlan_config.cfg +++ /dev/null @@ -1,2 +0,0 @@ -vlan_id 10 - name ten diff --git a/test/units/modules/network/eos/test_eos_acl_interfaces.py b/test/units/modules/network/eos/test_eos_acl_interfaces.py deleted file mode 100644 index f0e28d177c..0000000000 --- a/test/units/modules/network/eos/test_eos_acl_interfaces.py +++ /dev/null @@ -1,285 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_acl_interfaces -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosAclInterfacesModule(TestEosModule): - module = eos_acl_interfaces - - def setUp(self): - super(TestEosAclInterfacesModule, self).setUp() - - self.mock_get_config = patch( - 'ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch( - 'ansible.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.module_utils.network.common.facts.facts.get_resource_connection' - ) - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start( - ) - - self.mock_edit_config = patch( - 'ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config' - ) - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch( - 'ansible.module_utils.network.eos.facts.acl_interfaces.acl_interfaces.Acl_interfacesFacts.get_device_data' - ) - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosAclInterfacesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli', filename=None): - if filename is None: - filename = 'eos_acl_interfaces_config.cfg' - - def load_from_file(*args, **kwargs): - output = load_fixture(filename) - return output - - self.execute_show_command.side_effect = load_from_file - - def test_eos_acl_interfaces_merged(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv401", - direction="in"), - dict(name="aclv402", - direction="out") - ]), - dict(afi="ipv6", - acls=[ - dict(name="aclv601", - direction="in") - ]) - ]), - dict(name="GigabitEthernet0/1", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv401", - direction="in") - ]) - ]) - ], state="merged")) - commands = ['interface GigabitEthernet0/0', 'ip access-group aclv401 in', - 'ip access-group aclv402 out', 'ipv6 access-group aclv601 in', 'interface GigabitEthernet0/1', - 'ip access-group aclv401 in'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acl_interfaces_merged_idempotent(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv404", - direction="in"), - ]), - dict(afi="ipv6", - acls=[dict(name="aclv601", direction="out")]) - ]), - dict(name="GigabitEthernet0/1", - access_groups=[ - dict(afi="ipv6", - acls=[dict(name="aclv601", direction="in")]) - ]) - ], state="merged")) - self.execute_module(changed=False, commands=[]) - - def test_eos_acl_interfaces_replaced(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv401", - direction="in"), - dict(name="aclv402", - direction="out") - ]), - ]) - ], state="replaced")) - commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in', - 'no ipv6 access-group aclv601 out', 'ip access-group aclv402 out', - 'ip access-group aclv401 in'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acl_interfaces_replaced_idempotent(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv404", - direction="in"), - ]), - dict(afi="ipv6", - acls=[dict(name="aclv601", direction="out")]) - ]), - ], state="replaced")) - self.execute_module(changed=False, commands=[]) - - def test_eos_acl_interfaces_overridden(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv401", - direction="in"), - dict(name="aclv402", - direction="out") - ]), - ]) - ], state="overridden")) - commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in', - 'no ipv6 access-group aclv601 out', 'ip access-group aclv402 out', - 'ip access-group aclv401 in', 'interface GigabitEthernet0/1', - 'no ipv6 access-group aclv601 in'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acl_interfaces_overridden_idempotent(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv404", - direction="in"), - ]), - dict(afi="ipv6", - acls=[dict(name="aclv601", direction="out")]) - ]), - dict(name="GigabitEthernet0/1", - access_groups=[ - dict(afi="ipv6", - acls=[ - dict(name="aclv601", - direction="in") - ]) - ]) - ], state="overridden")) - self.execute_module(changed=False, commands=[]) - - def test_eos_acl_interfaces_deletedafi(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv6")]) - ], state="deleted")) - commands = ['interface GigabitEthernet0/0', 'no ipv6 access-group aclv601 out'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acl_interfaces_deletedint(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0") - ], state="deleted")) - commands = ['interface GigabitEthernet0/0', 'no ipv6 access-group aclv601 out', - 'no ip access-group aclv404 in'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acl_interfaces_deletedacl(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv404", - direction="in"), - ]), - ]) - ], state="deleted")) - commands = ['interface GigabitEthernet0/0', 'no ip access-group aclv404 in'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acl_interfaces_gathered(self): - set_module_args( - dict(state="gathered")) - result = self.execute_module(changed=False, filename='eos_acl_interfaces_config.cfg') - gathered_list = [{'access_groups': [{'acls': [{'direction': 'in', 'name': 'aclv404'}], 'afi': 'ipv4'}, - {'acls': [{'direction': 'out', 'name': 'aclv601'}], 'afi': 'ipv6'}], - 'name': 'GigabitEthernet0/0'}, - {'access_groups': [{'acls': [{'direction': 'in', 'name': 'aclv601'}], 'afi': 'ipv6'}], - 'name': 'GigabitEthernet0/1'}] - self.assertEqual(gathered_list, result['gathered']) - - def test_eos_acl_interfaces_parsed(self): - set_module_args( - dict(running_config="interface GigabitEthernet0/0\nipv6 access-group aclv601 out\nip access-group aclv404 in", - state="parsed")) - result = self.execute_module(changed=False) - parsed_list = [{'access_groups': [{'acls': [{'direction': 'in', 'name': 'aclv404'}], 'afi': 'ipv4'}, - {'acls': [{'direction': 'out', 'name': 'aclv601'}], 'afi': 'ipv6'}], - 'name': 'GigabitEthernet0/0'}] - self.assertEqual(parsed_list, result['parsed']) - - def test_eos_acl_interfaces_rendered(self): - set_module_args( - dict(config=[ - dict(name="GigabitEthernet0/0", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv401", - direction="in"), - dict(name="aclv402", - direction="out") - ]), - dict(afi="ipv6", - acls=[dict(name="aclv601", direction="in")]) - ]), - dict(name="GigabitEthernet0/1", - access_groups=[ - dict(afi="ipv4", - acls=[ - dict(name="aclv401", - direction="in") - ]) - ]) - ], state="rendered")) - commands = ['interface GigabitEthernet0/0', 'ip access-group aclv401 in', - 'ip access-group aclv402 out', 'ipv6 access-group aclv601 in', 'interface GigabitEthernet0/1', - 'ip access-group aclv401 in'] - result = self.execute_module(changed=False) - self.assertEqual(sorted(result['rendered']), sorted(commands), result['rendered']) diff --git a/test/units/modules/network/eos/test_eos_acls.py b/test/units/modules/network/eos/test_eos_acls.py deleted file mode 100644 index 6a0947d2d2..0000000000 --- a/test/units/modules/network/eos/test_eos_acls.py +++ /dev/null @@ -1,278 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_acls -from ansible.module_utils.network.eos.config.acls.acls import add_commands -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture -import itertools - - -class TestEosAclsModule(TestEosModule): - module = eos_acls - - def setUp(self): - super(TestEosAclsModule, self).setUp() - - self.mock_get_config = patch( - 'ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch( - 'ansible.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.module_utils.network.common.facts.facts.get_resource_connection' - ) - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start( - ) - - self.mock_edit_config = patch( - 'ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config' - ) - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch( - 'ansible.module_utils.network.eos.facts.acls.acls.AclsFacts.get_device_data' - ) - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosAclsModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli', filename=None): - if filename is None: - filename = 'eos_acls_config.cfg' - - def load_from_file(*args, **kwargs): - output = load_fixture(filename) - return output - - self.execute_show_command.side_effect = load_from_file - - def test_eos_acls_merged(self): - set_module_args( - dict(config=[ - dict(afi="ipv6", - acls=[ - dict(name="test2", - standard="true", - aces=[ - dict(sequence="10", - grant="permit", - protocol="ospf", - source=dict(subnet_address="30.2.0.0/8"), - destination=dict(any="true"), - log="true") - ]) - ]) - ], state="merged")) - commands = ['ipv6 access-list standard test2', '10 permit ospf 30.2.0.0/8 any log'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_merged_idempotent(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(sequence="35", - grant="deny", - protocol="tcp", - source=dict(subnet_address="20.0.0.0/8"), - destination=dict(any="true"), - log="true"), - dict(grant="permit", - source=dict(any="true"), - destination=dict(any="true"), - protocol=6) - ]) - ]) - ], state="merged")) - self.execute_module(changed=False, commands=[]) - - def test_eos_acls_replaced(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(sequence="10", - grant="permit", - protocol="ospf", - source=dict(subnet_address="30.2.0.0/8"), - destination=dict(any="true"), - log="true") - ]) - ]) - ], state="replaced")) - commands = ['ip access-list test1', 'no 35', 'no 45', '10 permit ospf 30.2.0.0/8 any log'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_replaced_idempotent(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(sequence="35", - grant="deny", - protocol="tcp", - source=dict(subnet_address="20.0.0.0/8"), - destination=dict(any="true"), - log="true"), - dict(grant="permit", - source=dict(any="true"), - destination=dict(any="true"), - sequence="45", - protocol="tcp") - ]) - ]) - ], state="replaced")) - self.execute_module(changed=False, commands=[]) - - def test_eos_acls_overridden(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(sequence="10", - grant="permit", - protocol="ospf", - source=dict(subnet_address="30.2.0.0/8"), - destination=dict(any="true"), - log="true") - ]) - ]) - ], state="overridden")) - commands = ['ip access-list test1', 'no 35', 'no 45', 'ip access-list test1', '10 permit ospf 30.2.0.0/8 any log'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_overridden_idempotent(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(sequence="35", - grant="deny", - protocol="tcp", - source=dict(subnet_address="20.0.0.0/8"), - destination=dict(any="true"), - log="true"), - dict(grant="permit", - source=dict(any="true"), - destination=dict(any="true"), - sequence="45", - protocol="tcp") - ]) - ]) - ], state="overridden")) - self.execute_module(changed=False, commands=[]) - - def test_eos_acls_deletedaces(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(grant="permit", - sequence="45", - source=dict(any="true"), - destination=dict(any="true"), - protocol=6) - ]) - ]) - ], state="deleted")) - commands = ['ip access-list test1', 'no 45'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_deletedacls(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1") - ]) - ], state="deleted")) - commands = ['no ip access-list test1'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_deletedafis(self): - set_module_args( - dict(config=[ - dict(afi="ipv4") - ], state="deleted")) - commands = ['no ip access-list test1'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_gathered(self): - set_module_args( - dict(config=[], - state="gathered")) - result = self.execute_module(changed=False, filename='eos_acls_config.cfg') - commands = [] - for gathered_cmds in result['gathered']: - cfg = add_commands(gathered_cmds) - commands.append(cfg) - commands = list(itertools.chain(*commands)) - config_commands = ['ip access-list test1', '35 deny tcp 20.0.0.0/8 any log', '45 permit tcp any any'] - self.assertEqual(sorted(config_commands), sorted(commands), result['gathered']) - - def test_eos_acls_rendered(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="test1", - aces=[ - dict(grant="permit", - sequence="45", - source=dict(any="true"), - destination=dict(any="true"), - protocol=6) - ]) - ]) - ], state="rendered")) - commands = ['ip access-list test1', '45 permit tcp any any'] - result = self.execute_module(changed=False) - self.assertEqual(sorted(result['rendered']), sorted(commands), result['rendered']) - - def test_eos_acls_parsed(self): - set_module_args( - dict(running_config="ipv6 access-list test2\n 10 permit icmpv6 host 10.2.33.1 any ttl eq 25", - state="parsed")) - commands = ['ipv6 access-list test2', '10 permit icmpv6 host 10.2.33.1 any ttl eq 25'] - result = self.execute_module(changed=False) - parsed_commands = [] - for cmds in result['parsed']: - cfg = add_commands(cmds) - parsed_commands.append(cfg) - parsed_commands = list(itertools.chain(*parsed_commands)) - self.assertEqual(sorted(parsed_commands), sorted(commands), result['parsed']) diff --git a/test/units/modules/network/eos/test_eos_banner.py b/test/units/modules/network/eos/test_eos_banner.py deleted file mode 100644 index 611aff6dc5..0000000000 --- a/test/units/modules/network/eos/test_eos_banner.py +++ /dev/null @@ -1,85 +0,0 @@ -# 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 units.compat.mock import patch -from ansible.modules.network.eos import eos_banner -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - -CLI = dict(transport="cli") -EAPI = dict(transport="eapi") - - -class TestEosBannerModule(TestEosModule): - - module = eos_banner - - def setUp(self): - super(TestEosBannerModule, self).setUp() - - self.mock_run_commands = patch('ansible.modules.network.eos.eos_banner.run_commands') - self.run_commands = self.mock_run_commands.start() - - self.mock_load_config = patch('ansible.modules.network.eos.eos_banner.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestEosBannerModule, self).tearDown() - - self.mock_run_commands.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if transport == 'cli': - self.run_commands.return_value = [load_fixture('eos_banner_show_banner.txt').strip()] - else: - self.run_commands.return_value = [{'loginBanner': load_fixture('eos_banner_show_banner.txt').strip()}] - - self.load_config.return_value = dict(diff=None, session='session') - - def test_eos_banner_create_with_cli_transport(self): - set_module_args(dict(banner='login', text='test\nbanner\nstring', provider=CLI)) - commands = ['banner login', 'test', 'banner', 'string', 'EOF'] - self.execute_module(changed=True, commands=commands) - - def test_eos_banner_remove_with_cli_transport(self): - set_module_args(dict(banner='login', state='absent', provider=CLI)) - commands = ['no banner login'] - self.execute_module(changed=True, commands=commands) - - def test_eos_banner_create_with_eapi_transport(self): - set_module_args(dict(banner='login', text='test\nbanner\nstring', provider=EAPI)) - commands = ['banner login'] - inputs = ['test\nbanner\nstring'] - self.execute_module(changed=True, commands=commands, inputs=inputs, transport='eapi') - - def test_eos_banner_remove_with_eapi_transport(self): - set_module_args(dict(banner='login', state='absent', provider=EAPI)) - commands = ['no banner login'] - self.execute_module(changed=True, commands=commands, transport='eapi') - - def test_eos_banner_nochange_with_cli_transport(self): - banner_text = load_fixture('eos_banner_show_banner.txt').strip() - set_module_args(dict(banner='login', text=banner_text, provider=CLI)) - self.execute_module() - - def test_eos_banner_nochange_with_eapi_transport(self): - banner_text = load_fixture('eos_banner_show_banner.txt').strip() - set_module_args(dict(banner='login', text=banner_text, provider=EAPI)) - self.execute_module(transport='eapi') diff --git a/test/units/modules/network/eos/test_eos_bgp.py b/test/units/modules/network/eos/test_eos_bgp.py deleted file mode 100644 index d39f80feeb..0000000000 --- a/test/units/modules/network/eos/test_eos_bgp.py +++ /dev/null @@ -1,197 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible.module_utils.network.eos.providers.cli.config.bgp.process import Provider -from ansible.modules.network.eos import eos_bgp -from .eos_module import TestEosModule, load_fixture - - -class TestFrrBgpModule(TestEosModule): - module = eos_bgp - - def setUp(self): - super(TestFrrBgpModule, self).setUp() - self._bgp_config = load_fixture('eos_bgp_config.cfg') - - def test_eos_bgp(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, router_id='192.0.2.2', networks=None, - address_family=None), operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ['router bgp 64496', 'router-id 192.0.2.2', 'exit']) - - def test_eos_bgp_idempotent(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, router_id='192.0.2.1', - networks=None, address_family=None), operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_eos_bgp_remove(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, networks=None, address_family=None), operation='delete')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ['no router bgp 64496']) - - def test_eos_bgp_neighbor(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, neighbors=[dict(neighbor='198.51.100.12', remote_as=64498)], - networks=None, address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ['router bgp 64496', 'neighbor 198.51.100.12 remote-as 64498', 'exit']) - - def test_eos_bgp_neighbor_idempotent(self): - neighbors = [dict(neighbor='198.51.100.102', remote_as=64498, timers=dict(keepalive=300, holdtime=360)), - dict(neighbor='203.0.113.5', remote_as=64511, maximum_prefix=500)] - obj = Provider(params=dict(config=dict(bgp_as=64496, neighbors=neighbors, networks=None, address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_eos_bgp_network(self): - obj = Provider( - params=dict(config=dict(bgp_as=64496, networks=[dict(prefix='203.0.113.0', masklen=24, route_map='RMAP_1')], - address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(sorted(commands), sorted(['router bgp 64496', 'network 203.0.113.0/24 route-map RMAP_1', 'exit'])) - - def test_eos_bgp_network_idempotent(self): - obj = Provider( - params=dict(config=dict(bgp_as=64496, networks=[dict(prefix='192.0.2.0', masklen=27, route_map='RMAP_1'), - dict(prefix='198.51.100.0', masklen=24, route_map='RMAP_2')], - address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_eos_bgp_redistribute(self): - rd_1 = dict(protocol='rip', route_map='RMAP_1') - - config = dict(bgp_as=64496, redistribute=[rd_1], networks=None, address_family=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - cmd = ['router bgp 64496', 'redistribute rip route-map RMAP_1', 'exit'] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_eos_bgp_redistribute_idempotent(self): - rd_1 = dict(protocol='ospf', route_map='RMAP_1') - config = dict(bgp_as=64496, redistribute=[rd_1], networks=None, address_family=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_eos_bgp_address_family_neighbors(self): - af_nbr_1 = dict(neighbor='198.51.100.104', default_originate=True, activate=True) - af_nbr_2 = dict(neighbor='198.51.100.105', activate=True, weight=30, graceful_restart=True) - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', neighbors=[af_nbr_1, af_nbr_2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - cmd = ['router bgp 64496', 'address-family ipv4', 'neighbor 198.51.100.104 activate', - 'neighbor 198.51.100.104 default-originate', 'neighbor 198.51.100.105 weight 30', - 'neighbor 198.51.100.105 activate', 'neighbor 198.51.100.105 graceful-restart', 'exit', 'exit'] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_eos_bgp_address_family_neighbors_idempotent(self): - af_nbr_1 = dict(neighbor='198.51.100.102', activate=True, graceful_restart=True, default_originate=True, weight=25) - af_nbr_2 = dict(neighbor='192.0.2.111', activate=True, default_originate=True) - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', neighbors=[af_nbr_1, af_nbr_2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_eos_bgp_address_family_networks(self): - net = dict(prefix='203.0.113.128', masklen=26, route_map='RMAP_1') - net2 = dict(prefix='203.0.113.192', masklen=26, route_map='RMAP_2') - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', networks=[net, net2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - cmd = ['router bgp 64496', 'address-family ipv4', 'network 203.0.113.128/26 route-map RMAP_1', - 'network 203.0.113.192/26 route-map RMAP_2', 'exit', 'exit'] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_eos_bgp_address_family_networks_idempotent(self): - net = dict(prefix='2001:db8:8000::', masklen=34, route_map=None) - net2 = dict(prefix='2001:db8:c000::', masklen=34, route_map=None) - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv6', networks=[net, net2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_eos_bgp_operation_override(self): - net_1 = dict(prefix='2001:0db8:0800::', masklen=38, route_map='RMAP_1') - net_2 = dict(prefix='2001:0db8:1c00::', masklen=38, route_map='RMAP_2') - nbr_1 = dict(neighbor='203.0.113.111', remote_as=64511, update_source='Ethernet2') - nbr_2 = dict(neighbor='203.0.113.120', remote_as=64511, timers=dict(keepalive=300, holdtime=360)) - af_nbr_1 = dict(neighbor='203.0.113.111', activate=True) - af_nbr_2 = dict(neighbor='203.0.113.120', activate=True, default_originate=True) - - af_1 = dict(afi='ipv4', neighbors=[af_nbr_1, af_nbr_2]) - af_2 = dict(afi='ipv6', networks=[net_1, net_2]) - config = dict(bgp_as=64496, neighbors=[nbr_1, nbr_2], address_family=[af_1, af_2], - networks=None) - - obj = Provider(params=dict(config=config, operation='override')) - commands = obj.render(self._bgp_config) - - cmd = ['no router bgp 64496', 'router bgp 64496', 'neighbor 203.0.113.111 remote-as 64511', - 'neighbor 203.0.113.111 update-source Ethernet2', 'neighbor 203.0.113.120 remote-as 64511', - 'neighbor 203.0.113.120 timers 300 360', 'address-family ipv4', - 'neighbor 203.0.113.111 activate', 'neighbor 203.0.113.120 default-originate', 'neighbor 203.0.113.120 activate', - 'exit', 'address-family ipv6', 'network 2001:0db8:0800::/38 route-map RMAP_1', - 'network 2001:0db8:1c00::/38 route-map RMAP_2', - 'exit', 'exit'] - - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_eos_bgp_operation_replace(self): - net = dict(prefix='203.0.113.0', masklen=27, route_map='RMAP_1') - net2 = dict(prefix='192.0.2.32', masklen=29, route_map='RMAP_2') - net_3 = dict(prefix='2001:db8:8000::', masklen=34, route_map=None) - net_4 = dict(prefix='2001:db8:c000::', masklen=34, route_map=None) - - af_1 = dict(afi='ipv4', networks=[net, net2]) - af_2 = dict(afi='ipv6', networks=[net_3, net_4]) - - config = dict(bgp_as=64496, address_family=[af_1, af_2], networks=None) - obj = Provider(params=dict(config=config, operation='replace')) - commands = obj.render(self._bgp_config) - - cmd = ['router bgp 64496', 'address-family ipv4', 'network 203.0.113.0/27 route-map RMAP_1', - 'network 192.0.2.32/29 route-map RMAP_2', 'no network 192.0.2.0/27', 'no network 198.51.100.0/24', - 'exit', 'exit'] - - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_eos_bgp_operation_replace_with_new_as(self): - nbr = dict(neighbor='203.0.113.124', remote_as=64496, update_source='Ethernet3') - - config = dict(bgp_as=64497, neighbors=[nbr], networks=None, address_family=None) - obj = Provider(params=dict(config=config, operation='replace')) - commands = obj.render(self._bgp_config) - - cmd = ['no router bgp 64496', 'router bgp 64497', 'neighbor 203.0.113.124 remote-as 64496', - 'neighbor 203.0.113.124 update-source Ethernet3', 'exit'] - - self.assertEqual(sorted(commands), sorted(cmd)) diff --git a/test/units/modules/network/eos/test_eos_command.py b/test/units/modules/network/eos/test_eos_command.py deleted file mode 100644 index da4ce25838..0000000000 --- a/test/units/modules/network/eos/test_eos_command.py +++ /dev/null @@ -1,107 +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 - -import json - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_command -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosCommandModule(TestEosModule): - - module = eos_command - - def setUp(self): - super(TestEosCommandModule, self).setUp() - self.mock_run_commands = patch('ansible.modules.network.eos.eos_command.run_commands') - self.run_commands = self.mock_run_commands.start() - - def tearDown(self): - super(TestEosCommandModule, self).tearDown() - self.mock_run_commands.stop() - - def load_fixtures(self, commands=None, transport='cli'): - def load_from_file(*args, **kwargs): - module, commands = args - output = list() - - for item in commands: - try: - obj = json.loads(item['command']) - command = obj['command'] - except ValueError: - command = item['command'] - filename = str(command).replace(' ', '_') - filename = 'eos_command_%s.txt' % filename - output.append(load_fixture(filename)) - return output - - self.run_commands.side_effect = load_from_file - - def test_eos_command_simple(self): - set_module_args(dict(commands=['show version'])) - result = self.execute_module() - self.assertEqual(len(result['stdout']), 1) - self.assertTrue(result['stdout'][0].startswith('Arista')) - - def test_eos_command_multiple(self): - set_module_args(dict(commands=['show version', 'show version'])) - result = self.execute_module() - self.assertEqual(len(result['stdout']), 2) - self.assertTrue(result['stdout'][0].startswith('Arista')) - - def test_eos_command_wait_for(self): - wait_for = 'result[0] contains "Arista vEOS"' - set_module_args(dict(commands=['show version'], wait_for=wait_for)) - self.execute_module() - - def test_eos_command_wait_for_fails(self): - wait_for = 'result[0] contains "test string"' - set_module_args(dict(commands=['show version'], wait_for=wait_for)) - self.execute_module(failed=True) - self.assertEqual(self.run_commands.call_count, 10) - - def test_eos_command_retries(self): - wait_for = 'result[0] contains "test string"' - 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) - - def test_eos_command_match_any(self): - wait_for = ['result[0] contains "Arista"', - 'result[0] contains "test string"'] - set_module_args(dict(commands=['show version'], wait_for=wait_for, match='any')) - self.execute_module() - - def test_eos_command_match_all(self): - wait_for = ['result[0] contains "Arista"', - 'result[0] contains "Software image"'] - set_module_args(dict(commands=['show version'], wait_for=wait_for, match='all')) - self.execute_module() - - def test_eos_command_match_all_failure(self): - wait_for = ['result[0] contains "Arista"', - 'result[0] contains "test string"'] - commands = ['show version', 'show version'] - set_module_args(dict(commands=commands, wait_for=wait_for, match='all')) - self.execute_module(failed=True) diff --git a/test/units/modules/network/eos/test_eos_config.py b/test/units/modules/network/eos/test_eos_config.py deleted file mode 100644 index 98f3dbf6d0..0000000000 --- a/test/units/modules/network/eos/test_eos_config.py +++ /dev/null @@ -1,210 +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 units.compat.mock import patch, MagicMock -from ansible.modules.network.eos import eos_config -from ansible.plugins.cliconf.eos import Cliconf -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosConfigModule(TestEosModule): - - module = eos_config - - def setUp(self): - super(TestEosConfigModule, self).setUp() - self.mock_get_config = patch('ansible.modules.network.eos.eos_config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_get_connection = patch('ansible.modules.network.eos.eos_config.get_connection') - self.get_connection = self.mock_get_connection.start() - - self.mock_load_config = patch('ansible.modules.network.eos.eos_config.load_config') - self.load_config = self.mock_load_config.start() - self.mock_run_commands = patch('ansible.modules.network.eos.eos_config.run_commands') - self.run_commands = self.mock_run_commands.start() - - self.mock_supports_sessions = patch('ansible.plugins.cliconf.eos.Cliconf.supports_sessions') - self.supports_sessions = self.mock_supports_sessions.start() - self.mock_supports_sessions.return_value = True - - self.conn = self.get_connection() - self.conn.edit_config = MagicMock() - - self.cliconf_obj = Cliconf(MagicMock()) - self.running_config = load_fixture('eos_config_config.cfg') - - def tearDown(self): - super(TestEosConfigModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_get_connection.stop() - self.mock_supports_sessions.stop() - - def load_fixtures(self, commands=None, transport='cli'): - self.get_config.return_value = load_fixture('eos_config_config.cfg') - self.load_config.return_value = dict(diff=None, session='session') - - def test_eos_config_no_change(self): - lines = ['hostname localhost'] - config = '\n'.join(lines) - args = dict(lines=lines) - set_module_args(args) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(config, config)) - self.execute_module() - - def test_eos_config_src(self): - src = load_fixture('eos_config_candidate.cfg') - args = dict(src=src) - set_module_args(args) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, self.running_config)) - result = self.execute_module(changed=True) - config = ['hostname switch01', 'interface Ethernet1', - 'description test interface', 'no shutdown', 'ip routing'] - self.assertEqual(sorted(config), sorted(result['commands']), result['commands']) - - def test_eos_config_lines(self): - lines = ['hostname switch01', 'ip domain-name eng.ansible.com'] - args = dict(lines=lines) - set_module_args(args) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - result = self.execute_module(changed=True) - config = ['hostname switch01'] - - self.assertEqual(sorted(config), sorted(result['commands']), result['commands']) - - def test_eos_config_before(self): - lines = ['hostname switch01', 'ip domain-name eng.ansible.com'] - before = ['before command'] - args = dict(lines=lines, - before=before) - set_module_args(args) - - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - result = self.execute_module(changed=True) - config = ['before command', 'hostname switch01'] - self.assertEqual(sorted(config), sorted(result['commands']), result['commands']) - self.assertEqual('before command', result['commands'][0]) - - def test_eos_config_after(self): - lines = ['hostname switch01', 'ip domain-name eng.ansible.com'] - args = dict(lines=lines, - after=['after command']) - - set_module_args(args) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - result = self.execute_module(changed=True) - config = ['after command', 'hostname switch01'] - - self.assertEqual(sorted(config), sorted(result['commands']), result['commands']) - self.assertEqual('after command', result['commands'][-1]) - - def test_eos_config_parents(self): - lines = ['ip address 1.2.3.4/5', 'no shutdown'] - parents = ['interface Ethernet10'] - args = dict(lines=lines, parents=parents) - candidate = parents + lines - set_module_args(args) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(candidate), self.running_config)) - - result = self.execute_module(changed=True) - config = ['interface Ethernet10', 'ip address 1.2.3.4/5', 'no shutdown'] - - self.assertEqual(config, result['commands'], result['commands']) - - def test_eos_config_src_and_lines_fails(self): - args = dict(src='foo', lines='foo') - set_module_args(args) - self.execute_module(failed=True) - - def test_eos_config_match_exact_requires_lines(self): - args = dict(match='exact') - set_module_args(args) - self.execute_module(failed=True) - - def test_eos_config_match_strict_requires_lines(self): - args = dict(match='strict') - set_module_args(args) - self.execute_module(failed=True) - - def test_eos_config_replace_block_requires_lines(self): - args = dict(replace='block') - set_module_args(args) - self.execute_module(failed=True) - - def test_eos_config_replace_config_requires_src(self): - args = dict(replace='config') - set_module_args(args) - self.execute_module(failed=True) - - def test_eos_config_backup_returns__backup__(self): - args = dict(backup=True) - set_module_args(args) - result = self.execute_module() - self.assertIn('__backup__', result) - - def test_eos_config_save_when(self): - mock_run_commands = patch('ansible.modules.network.eos.eos_config.run_commands') - run_commands = mock_run_commands.start() - - run_commands.return_value = [load_fixture('eos_config_config.cfg'), - load_fixture('eos_config_config.cfg')] - - args = dict(save_when='modified') - set_module_args(args) - self.execute_module() - - run_commands.return_value = [load_fixture('eos_config_config.cfg'), - load_fixture('eos_config_config_updated.cfg')] - - args = dict(save_when='modified') - set_module_args(args) - self.execute_module(changed=True) - - mock_run_commands.stop() - - def test_eos_config_save_changed_true(self): - commands = ['hostname foo', 'interface GigabitEthernet0/0', 'no ip address'] - set_module_args(dict(save_when='changed', lines=commands)) - self.execute_module(changed=True) - self.assertEqual(self.run_commands.call_count, 1) - self.assertEqual(self.get_config.call_count, 1) - self.assertEqual(self.load_config.call_count, 1) - args = self.run_commands.call_args[0][1][0]['command'] - self.assertIn('copy running-config startup-config', args) - - def test_eos_config_save_changed_false(self): - set_module_args(dict(save_when='changed')) - self.execute_module(changed=False) - self.assertEqual(self.run_commands.call_count, 0) - self.assertEqual(self.get_config.call_count, 0) - self.assertEqual(self.load_config.call_count, 0) - - def test_eos_config_save_always(self): - self.run_commands.return_value = "hostname foo" - set_module_args(dict(save_when='always')) - self.execute_module(changed=True) - self.assertEqual(self.run_commands.call_count, 1) - self.assertEqual(self.get_config.call_count, 0) - self.assertEqual(self.load_config.call_count, 0) - args = self.run_commands.call_args[0][1][0]['command'] - self.assertIn('copy running-config startup-config', args) diff --git a/test/units/modules/network/eos/test_eos_eapi.py b/test/units/modules/network/eos/test_eos_eapi.py deleted file mode 100644 index 09ff08cdf2..0000000000 --- a/test/units/modules/network/eos/test_eos_eapi.py +++ /dev/null @@ -1,162 +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 units.compat.mock import patch -from ansible.modules.network.eos import eos_eapi -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosEapiModule(TestEosModule): - - module = eos_eapi - - def setUp(self): - super(TestEosEapiModule, self).setUp() - - self.mock_run_commands = patch('ansible.modules.network.eos.eos_eapi.run_commands') - self.run_commands = self.mock_run_commands.start() - - self.mock_load_config = patch('ansible.modules.network.eos.eos_eapi.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_verify_state = patch('ansible.modules.network.eos.eos_eapi.verify_state') - self.verify_state = self.mock_verify_state.start() - - self.command_fixtures = {} - - def tearDown(self): - super(TestEosEapiModule, self).tearDown() - - self.mock_run_commands.stop() - self.mock_load_config.stop() - - # hack for older version of mock - # should be using patch.stopall() but CI is still failing - try: - self.mock_verify_state.stop() - except RuntimeError: - pass - - def load_fixtures(self, commands=None, transport='eapi'): - def run_commands(module, commands, **kwargs): - output = list() - for cmd in commands: - output.append(load_fixture(self.command_fixtures[cmd])) - return output - - self.run_commands.side_effect = run_commands - self.load_config.return_value = dict(diff=None, session='session') - - def start_configured(self, *args, **kwargs): - self.command_fixtures = { - 'show vrf': 'eos_eapi_show_vrf.text', - 'show management api http-commands | json': 'eos_eapi_show_mgmt.json' - } - return self.execute_module(*args, **kwargs) - - def start_unconfigured(self, *args, **kwargs): - self.command_fixtures = { - 'show vrf': 'eos_eapi_show_vrf.text', - 'show management api http-commands | json': 'eos_eapi_show_mgmt_unconfigured.json' - } - return self.execute_module(*args, **kwargs) - - def test_eos_eapi_http_enable(self): - set_module_args(dict(http=True)) - commands = ['management api http-commands', 'protocol http port 80', - 'no shutdown'] - self.start_unconfigured(changed=True, commands=commands) - - def test_eos_eapi_http_disable(self): - set_module_args(dict(http=False)) - commands = ['management api http-commands', 'no protocol http'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_http_port(self): - set_module_args(dict(http_port=81)) - commands = ['management api http-commands', 'protocol http port 81'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_http_invalid(self): - set_module_args(dict(http_port=80000)) - self.start_unconfigured(failed=True) - - def test_eos_eapi_https_enable(self): - set_module_args(dict(https=True)) - commands = ['management api http-commands', 'protocol https port 443', - 'no shutdown'] - self.start_unconfigured(changed=True, commands=commands) - - def test_eos_eapi_https_disable(self): - set_module_args(dict(https=False)) - commands = ['management api http-commands', 'no protocol https'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_https_port(self): - set_module_args(dict(https_port=8443)) - commands = ['management api http-commands', 'protocol https port 8443'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_local_http_enable(self): - set_module_args(dict(local_http=True)) - commands = ['management api http-commands', 'protocol http localhost port 8080', - 'no shutdown'] - self.start_unconfigured(changed=True, commands=commands) - - def test_eos_eapi_local_http_disable(self): - set_module_args(dict(local_http=False)) - commands = ['management api http-commands', 'no protocol http localhost'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_local_http_port(self): - set_module_args(dict(local_http_port=81)) - commands = ['management api http-commands', 'protocol http localhost port 81'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_vrf(self): - set_module_args(dict(vrf='test')) - commands = ['management api http-commands', 'no shutdown', 'vrf test', 'no shutdown'] - self.start_unconfigured(changed=True, commands=commands) - - def test_eos_eapi_change_from_default_vrf(self): - set_module_args(dict(vrf='test')) - commands = ['management api http-commands', 'vrf test', 'no shutdown'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_default(self): - set_module_args(dict()) - self.start_configured(changed=False, commands=[]) - - def test_eos_eapi_vrf_missing(self): - set_module_args(dict(vrf='missing')) - self.start_unconfigured(failed=True) - - def test_eos_eapi_state_absent(self): - set_module_args(dict(state='stopped')) - commands = ['management api http-commands', 'shutdown'] - self.start_configured(changed=True, commands=commands) - - def test_eos_eapi_state_failed(self): - self.mock_verify_state.stop() - set_module_args(dict(state='stopped', timeout=1)) - result = self.start_configured(failed=True) - 'timeout expired before eapi running state changed' in result['msg'] diff --git a/test/units/modules/network/eos/test_eos_interfaces.py b/test/units/modules/network/eos/test_eos_interfaces.py deleted file mode 100644 index 41adb74105..0000000000 --- a/test/units/modules/network/eos/test_eos_interfaces.py +++ /dev/null @@ -1,181 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_interfaces -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosInterfacesModule(TestEosModule): - module = eos_interfaces - - def setUp(self): - super(TestEosInterfacesModule, self).setUp() - - self.mock_get_config = patch('ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch('ansible.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.module_utils.network.common.facts.facts.get_resource_connection') - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() - - self.mock_edit_config = patch('ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config') - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch('ansible.module_utils.network.eos.facts.interfaces.interfaces.InterfacesFacts.get_device_data') - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosInterfacesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli'): - def load_from_file(*args, **kwargs): - return load_fixture('eos_interfaces_config.cfg') - self.execute_show_command.side_effect = load_from_file - - def test_eos_interfaces_merged(self): - set_module_args(dict( - config=[dict( - name="Ethernet3", - description="Ethernet_3" - )], state="merged" - )) - commands = ['interface Ethernet3', 'description Ethernet_3'] - self.execute_module(changed=True, commands=commands) - - def test_eos_interfaces_merged_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - description="Interface 1" - )], state="merged" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_interfaces_replaced(self): - set_module_args(dict( - config=[dict( - name="Ethernet3", - description="Ethernet_3", - mtu=1000 - )], state="replaced" - )) - commands = ['interface Ethernet3', 'description Ethernet_3', 'mtu 1000'] - self.execute_module(changed=True, commands=commands) - - # Bug : 63805 - # def test_eos_interfaces_replaced_idempotent(self): - # set_module_args(dict( - # config=[dict( - # name="Ethernet1", - # description="Interface 1" - # )], state="replaced" - # )) - # self.execute_module(changed=False, commands=[]) - - def test_eos_interfaces_delete(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - )], state="deleted" - )) - commands = ['interface Ethernet1', 'no description', 'no shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_eos_interfaces_speed_forced(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - description="Interface_1", - speed="forced 40g", - duplex="full" - )], state="replaced" - )) - commands = ['interface Ethernet1', 'description Interface_1', 'speed forced 40gfull', 'no shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_eos_interfaces_speed_full(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - description="Interface_1", - speed="1000g", - duplex="full" - )], state="replaced" - )) - commands = ['interface Ethernet1', 'description Interface_1', 'speed 1000gfull', 'no shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_eos_interfaces_speed_auto(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - description="Interface_1", - speed="auto", - duplex="full" - )], state="replaced" - )) - commands = ['interface Ethernet1', 'description Interface_1', 'speed auto', 'no shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_eos_interfaces_speed_half(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - description="Interface_1", - speed="1000g", - duplex="half" - )], state="replaced" - )) - commands = ['interface Ethernet1', 'description Interface_1', 'speed 1000ghalf', 'no shutdown'] - self.execute_module(changed=True, commands=commands) - - # Bug # 63760 - # def test_eos_interfaces_overridden(self): - # set_module_args(dict( - # config=[dict( - # name="Ethernet3", - # description="Ethernet_3", - # mtu=1000 - # ), - # dict( - # name="Ethernet1", - # description="Ethernet 1" - # )], state="overridden" - # )) - # commands = ['interface Ethernet3', 'description Ethernet_3', 'mtu 1000', 'interface Ethernet1', - # 'description Ethernet 1', 'interface Management1', 'no description', 'no ip address'] - # self.execute_module(changed=True, commands=commands) - - # def test_eos_interfaces_overridden_idempotent(self): - # set_module_args(dict( - # config=[dict( - # name="Ethernet1", - # description="Interface 1" - # ), - # dict( - # name="Ethernet2", - # ), - # dict( - # name="Management 1", - # description="Management interface" - # )], state="overridden" - # )) - # self.execute_module(changed=False, commands=[]) diff --git a/test/units/modules/network/eos/test_eos_l2_interfaces.py b/test/units/modules/network/eos/test_eos_l2_interfaces.py deleted file mode 100644 index 9c548e9594..0000000000 --- a/test/units/modules/network/eos/test_eos_l2_interfaces.py +++ /dev/null @@ -1,150 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_l2_interfaces -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosL2InterfacesModule(TestEosModule): - module = eos_l2_interfaces - - def setUp(self): - super(TestEosL2InterfacesModule, self).setUp() - - self.mock_get_config = patch('ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch('ansible.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.module_utils.network.common.facts.facts.get_resource_connection') - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() - - self.mock_edit_config = patch('ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config') - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch('ansible.module_utils.network.eos.facts.l2_interfaces.l2_interfaces.L2_interfacesFacts.get_device_data') - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosL2InterfacesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli'): - def load_from_file(*args, **kwargs): - return load_fixture('eos_l2_interfaces_config.cfg') - self.execute_show_command.side_effect = load_from_file - - def test_eos_l2_interfaces_merged(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - trunk=dict(native_vlan=10) - ), dict( - name="Ethernet2", - access=dict(vlan=30), - )], state="merged" - )) - commands = ['interface Ethernet1', 'switchport trunk native vlan 10', - 'interface Ethernet2', 'switchport access vlan 30'] - self.execute_module(changed=True, commands=commands) - - def test_eos_l2_interfaces_merged_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - trunk=dict(native_vlan=20) - ), dict( - name="Ethernet1", - access=dict(vlan=20), - )], state="merged" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_l2_interfaces_replaced(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - mode="trunk", - trunk=dict(native_vlan=50) - ), dict( - name="Ethernet3", - access=dict(vlan=30), - )], state="replaced" - )) - commands = ['interface Ethernet2', - 'switchport trunk native vlan 50', - 'interface Ethernet3', - 'switchport access vlan 30'] - self.execute_module(changed=True, commands=commands) - - def test_eos_l2_interfaces_replaced_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - mode="trunk", - trunk=dict(native_vlan=20), - ), dict( - name="Ethernet1", - access=dict(vlan=20), - )], state="replaced" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_l2_interfaces_overridden(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - mode="trunk", - trunk=dict(native_vlan=50) - )], state="overridden" - )) - commands = ['interface Ethernet2', - 'switchport trunk native vlan 50', - 'interface Ethernet1', - 'no switchport access vlan' - ] - self.execute_module(changed=True, commands=commands) - - def test_eos_l2_interfaces_overridden_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - mode="trunk", - trunk=dict(native_vlan=20) - ), dict( - name="Ethernet1", - access=dict(vlan=20), - )], state="overridden" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_l2_interfaces_deleted(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - mode="trunk", - trunk=dict(native_vlan=20) - ), dict( - name="Ethernet1", - access=dict(vlan=20), - )], state="deleted" - )) - commands = ['interface Ethernet2', 'no switchport mode', 'no switchport trunk native vlan', - 'interface Ethernet1', 'no switchport access vlan'] - self.execute_module(changed=True, commands=commands) diff --git a/test/units/modules/network/eos/test_eos_lacp.py b/test/units/modules/network/eos/test_eos_lacp.py deleted file mode 100644 index ce19e66ccf..0000000000 --- a/test/units/modules/network/eos/test_eos_lacp.py +++ /dev/null @@ -1,106 +0,0 @@ -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_lacp -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosLacpInterfacesModule(TestEosModule): - module = eos_lacp - - def setUp(self): - super(TestEosLacpInterfacesModule, self).setUp() - - self.mock_get_config = patch('ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch('ansible.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.module_utils.network.common.facts.facts.get_resource_connection') - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() - - self.mock_edit_config = patch('ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config') - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch('ansible.module_utils.network.eos.facts.lacp.lacp.LacpFacts.get_device_data') - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosLacpInterfacesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli'): - def load_from_file(*args, **kwargs): - return load_fixture('eos_lacp_config.cfg') - self.execute_show_command.side_effect = load_from_file - - def test_eos_lacp_default(self): - set_module_args(dict( - config=dict( - system=dict(priority=50) - ) - )) - commands = ['lacp system-priority 50'] - self.execute_module(changed=True, commands=commands) - - def test_eos_lacp_default_idempotent(self): - set_module_args(dict( - config=dict( - system=dict(priority=10) - ) - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_lacp_merged(self): - set_module_args(dict( - config=dict( - system=dict(priority=50) - ), state="merged" - )) - commands = ['lacp system-priority 50'] - self.execute_module(changed=True, commands=commands) - - def test_eos_lacp_merged_idempotent(self): - set_module_args(dict( - config=dict( - system=dict(priority=10) - ), state="merged" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_l3_interfaces_replaced(self): - set_module_args(dict( - config=dict( - system=dict(priority=20) - ), state="replaced" - )) - commands = ['lacp system-priority 20'] - self.execute_module(changed=True, commands=commands) - - def test_eos_l3_interfaces_replaced_idempotent(self): - set_module_args(dict( - config=dict( - system=dict(priority=10) - ), state="replaced" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_l3_interfaces_deleted(self): - set_module_args(dict(state="deleted")) - commands = ['no lacp system-priority'] - self.execute_module(changed=True, commands=commands) diff --git a/test/units/modules/network/eos/test_eos_lacp_interfaces.py b/test/units/modules/network/eos/test_eos_lacp_interfaces.py deleted file mode 100644 index 1beeac69a8..0000000000 --- a/test/units/modules/network/eos/test_eos_lacp_interfaces.py +++ /dev/null @@ -1,148 +0,0 @@ -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_lacp_interfaces -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosLacpInterfacesModule(TestEosModule): - module = eos_lacp_interfaces - - def setUp(self): - super(TestEosLacpInterfacesModule, self).setUp() - - self.mock_get_config = patch('ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch('ansible.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.module_utils.network.common.facts.facts.get_resource_connection') - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() - - self.mock_edit_config = patch('ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config') - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch('ansible.module_utils.network.eos.facts.lacp_interfaces.lacp_interfaces.Lacp_interfacesFacts.get_device_data') - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosLacpInterfacesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli'): - def load_from_file(*args, **kwargs): - return load_fixture('eos_lacp_interfaces_config.cfg') - self.execute_show_command.side_effect = load_from_file - - def test_eos_lacp_interfaces_default(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - port_priority=45, - rate="normal" - )] - )) - commands = ['interface Ethernet1', 'lacp port-priority 45', 'lacp rate normal'] - self.execute_module(changed=True, commands=commands) - - def test_eos_lacp_interfaces_default_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - rate="fast" - )] - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_lacp_interfaces_merged(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - port_priority=45, - rate="normal" - ), dict( - name="Ethernet2", - rate="normal" - )], state="merged" - )) - commands = ['interface Ethernet1', 'lacp port-priority 45', 'lacp rate normal', - 'interface Ethernet2', 'lacp rate normal'] - self.execute_module(changed=True, commands=commands) - - def test_eos_lacp_interfaces_merged_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - rate="fast" - )], state="merged" - )) - self.execute_module(changed=False, commands=[]) - - # Bug #64453 - # def test_eos_lacp_interfaces_replaced(self): - # set_module_args(dict( - # config=[dict( - # name="Ethernet1", - # port_priority=45, - # rate="normal" - # )], state="replaced" - # )) - # commands = ['interface Ethernet1', 'lacp port-priority 45', 'lacp rate normal'] - # self.execute_module(changed=True, commands=commands) - - def test_eos_lacp_interfaces_replaced_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - rate="fast" - )], state="replaced" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_lacp_interfaces_overridden(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - port_priority=45, - rate="normal" - )], state="overridden" - )) - commands = ['interface Ethernet1', 'lacp port-priority 45', 'lacp rate normal', - 'interface Ethernet2', 'no lacp port-priority', 'no lacp rate'] - self.execute_module(changed=True, commands=commands) - - def test_eos_lacp_interfaces_overridden_idempotent(self): - set_module_args(dict( - config=[dict( - name="Ethernet1", - port_priority=30 - ), dict( - name="Ethernet2", - rate="fast" - )], state="overridden" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_lacp_interfaces_deleted(self): - set_module_args(dict( - config=[dict( - name="Ethernet2", - )], state="deleted" - )) - commands = ['interface Ethernet2', 'no lacp rate'] - self.execute_module(changed=True, commands=commands) diff --git a/test/units/modules/network/eos/test_eos_logging.py b/test/units/modules/network/eos/test_eos_logging.py deleted file mode 100644 index f6be40b4f4..0000000000 --- a/test/units/modules/network/eos/test_eos_logging.py +++ /dev/null @@ -1,101 +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 units.compat.mock import patch -from ansible.modules.network.eos import eos_logging -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosLoggingModule(TestEosModule): - - module = eos_logging - - def setUp(self): - super(TestEosLoggingModule, self).setUp() - self._log_config = load_fixture('eos_logging_config.cfg') - - self.mock_get_config = patch('ansible.modules.network.eos.eos_logging.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.eos.eos_logging.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestEosLoggingModule, self).tearDown() - - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - self.get_config.return_value = load_fixture('eos_logging_config.cfg') - self.load_config.return_value = dict(diff=None, session='session') - - def test_eos_setup_host_logging_idempotenet(self): - set_module_args(dict(dest='host', name='175.16.0.10', state='present')) - self.execute_module(changed=False, commands=[]) - - def test_eos_setup_host_logging(self): - set_module_args(dict(dest='host', name='175.16.0.1', state='present')) - commands = ['logging host 175.16.0.1'] - self.execute_module(changed=True, commands=commands) - - def test_eos_buffer_size_outofrange(self): - set_module_args(dict(dest='buffered', size=5)) - result = self.execute_module(failed=True) - self.assertEqual(result['msg'], "size must be between 10 and 2147483647") - - def test_eos_buffer_size_datatype(self): - set_module_args(dict(dest='buffered', size='ten')) - result = self.execute_module(failed=True) - self.assertIn("we were unable to convert to int", result['msg']) - - def test_eos_buffer_size(self): - set_module_args(dict(dest='buffered', size=5000)) - commands = ['logging buffered 5000'] - self.execute_module(changed=True, commands=commands) - - def test_eos_buffer_size_idempotent(self): - set_module_args(dict(dest='buffered', size=50000, level='informational')) - self.execute_module(changed=False, commands=[]) - - def test_eos_facilty(self): - set_module_args(dict(facility='local2')) - commands = ['logging facility local2'] - self.execute_module(changed=True, commands=commands) - - def test_eos_facility_idempotent(self): - set_module_args(dict(facility='local7')) - self.execute_module(changed=False, commands=[]) - - def test_eos_level(self): - set_module_args(dict(dest='console', level='critical')) - commands = ['logging console critical'] - self.execute_module(changed=True, commands=commands) - - def test_eos_level_idempotent(self): - set_module_args(dict(dest='console', level='warnings')) - self.execute_module(changed=False, commands=[]) - - def test_eos_logging_state_absent(self): - set_module_args(dict(dest='host', name='175.16.0.10', state='absent')) - commands = ['no logging host 175.16.0.10'] - self.execute_module(changed=True, commands=commands) diff --git a/test/units/modules/network/eos/test_eos_static_routes.py b/test/units/modules/network/eos/test_eos_static_routes.py deleted file mode 100644 index ce7c0c437b..0000000000 --- a/test/units/modules/network/eos/test_eos_static_routes.py +++ /dev/null @@ -1,308 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_static_routes -from ansible.module_utils.network.eos.config.static_routes.static_routes import add_commands -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture -import itertools - - -class TestEosStaticRoutesModule(TestEosModule): - module = eos_static_routes - - def setUp(self): - super(TestEosStaticRoutesModule, self).setUp() - - self.mock_get_config = patch( - 'ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch( - 'ansible.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.module_utils.network.common.facts.facts.get_resource_connection' - ) - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start( - ) - - self.mock_edit_config = patch( - 'ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config' - ) - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch( - 'ansible.module_utils.network.eos.facts.static_routes.static_routes.Static_routesFacts.get_device_data' - ) - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosStaticRoutesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli', filename=None): - if filename is None: - filename = 'eos_static_routes_config.cfg' - - def load_from_file(*args, **kwargs): - output = load_fixture(filename) - return output - - self.execute_show_command.side_effect = load_from_file - - def test_eos_static_routes_merged(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv6", - routes=[ - dict(dest="1200:10::/64", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=55) - ]) - ]) - ]) - ], state="merged")) - commands = ['ipv6 route vrf testvrf 1200:10::/64 Ethernet1 55'] - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_merged_idempotent(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv4", - routes=[ - dict(dest="120.1.1.0/24", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=23) - ]) - ]) - ]) - ], state="merged")) - self.execute_module(changed=False, commands=[]) - - def test_eos_static_routes_default(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv6", - routes=[ - dict(dest="1200:10::/64", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=55) - ]) - ]) - ]) - ])) - commands = ['ipv6 route vrf testvrf 1200:10::/64 Ethernet1 55'] - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_default_idempotent(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv4", - routes=[ - dict(dest="120.1.1.0/24", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=23) - ]) - ]) - ]) - ])) - self.execute_module(changed=False, commands=[]) - - def test_eos_static_routes_replaced(self): - set_module_args( - dict(config=[ - dict(address_families=[ - dict(afi="ipv6", - routes=[ - dict(dest="1000:10::/64", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=55) - ]) - ]) - ]) - ], state="replaced")) - commands = [ - 'ipv6 route 1000:10::/64 Ethernet1 55', - 'no ipv6 route 1000:10::/64 Ethernet1 67 tag 98' - ] - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_replaced_idempotent(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv4", - routes=[ - dict(dest="120.1.1.0/24", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=23) - ]) - ]) - ]) - ], state="replaced")) - self.execute_module(changed=False, commands=[]) - - def test_eos_static_routes_overridden(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv6", - routes=[ - dict(dest="1200:10::/64", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=55) - ]) - ]) - ]) - ], state="overridden")) - commands = [ - 'ipv6 route vrf testvrf 1200:10::/64 Ethernet1 55', - 'no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23', - 'no ip route 10.1.1.0/24 Management1', - 'no ipv6 route 1000:10::/64 Ethernet1 67 tag 98' - ] - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_overridden_idempotent(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv4", - routes=[ - dict(dest="120.1.1.0/24", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=23) - ]) - ]) - ]), - dict(address_families=[ - dict(afi="ipv4", - routes=[ - dict(dest="10.1.1.0/24", - next_hops=[ - dict(interface="Management1") - ]) - ]) - ]), - dict(address_families=[ - dict(afi="ipv6", - routes=[ - dict(dest="1000:10::/64", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=67, - tag=98) - ]) - ]) - ]) - ], state="overridden")) - self.execute_module(changed=False, commands=[]) - - def test_eos_static_routes_deletedvrf(self): - set_module_args(dict(config=[dict(vrf="testvrf", )], state="deleted")) - commands = ['no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23'] - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_deletedroute(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv4", routes=[dict(dest="120.1.1.0/24")]) - ]) - ], state="deleted")) - commands = ['no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23'] - - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_deletedafi(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", address_families=[dict(afi="ipv4")]) - ], state="deleted")) - commands = ['no ip route vrf testvrf 120.1.1.0/24 Ethernet1 23'] - self.execute_module(changed=True, commands=commands) - - def test_eos_static_routes_gathered(self): - set_module_args( - dict(config=[], - state="gathered")) - result = self.execute_module(changed=False, filename='eos_static_routes_config.cfg') - commands = [] - for gathered_cmds in result['gathered']: - cfg = add_commands(gathered_cmds) - commands.append(cfg) - commands = list(itertools.chain(*commands)) - config_commands = ['ip route 10.1.1.0/24 Management1', 'ipv6 route 1000:10::/64 Ethernet1 67 tag 98', - 'ip route vrf testvrf 120.1.1.0/24 Ethernet1 23'] - self.assertEqual(sorted(config_commands), sorted(commands), result['gathered']) - - def test_eos_static_routes_rendered(self): - set_module_args( - dict(config=[ - dict(vrf="testvrf", - address_families=[ - dict(afi="ipv6", - routes=[ - dict(dest="1200:10::/64", - next_hops=[ - dict(interface="Ethernet1", - admin_distance=55) - ]) - ]) - ]) - ], state="rendered")) - commands = ['ipv6 route vrf testvrf 1200:10::/64 Ethernet1 55'] - result = self.execute_module(changed=False) - self.assertEqual(sorted(result['rendered']), sorted(commands), result['rendered']) - - def test_eos_static_routes_parsed(self): - set_module_args( - dict(running_config="ipv6 route vrf testvrf 1200:10::/64 Ethernet1 55", - state="parsed")) - commands = ['ipv6 route vrf testvrf 1200:10::/64 Ethernet1 55'] - result = self.execute_module(changed=False) - parsed_commands = [] - for cmds in result['parsed']: - cfg = add_commands(cmds) - parsed_commands.append(cfg) - parsed_commands = list(itertools.chain(*parsed_commands)) - self.assertEqual(sorted(parsed_commands), sorted(commands), result['parsed']) diff --git a/test/units/modules/network/eos/test_eos_system.py b/test/units/modules/network/eos/test_eos_system.py deleted file mode 100644 index 3dfb4ca523..0000000000 --- a/test/units/modules/network/eos/test_eos_system.py +++ /dev/null @@ -1,110 +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 units.compat.mock import patch -from ansible.modules.network.eos import eos_system -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosSystemModule(TestEosModule): - - module = eos_system - - def setUp(self): - super(TestEosSystemModule, self).setUp() - - self.mock_get_config = patch('ansible.modules.network.eos.eos_system.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.eos.eos_system.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestEosSystemModule, self).tearDown() - - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - self.get_config.return_value = load_fixture('eos_system_config.cfg') - self.load_config.return_value = dict(diff=None, session='session') - - def test_eos_system_hostname_changed(self): - set_module_args(dict(hostname='foo')) - commands = ['hostname foo'] - self.execute_module(changed=True, commands=commands) - - def test_eos_system_domain_name(self): - set_module_args(dict(domain_name='test.com')) - commands = ['ip domain-name test.com'] - self.execute_module(changed=True, commands=commands) - - def test_eos_system_domain_list(self): - set_module_args(dict(domain_list=['ansible.com', 'redhat.com'])) - commands = ['no ip domain-list ops.ansible.com', - 'ip domain-list redhat.com'] - self.execute_module(changed=True, commands=commands) - - def test_eos_system_lookup_source(self): - set_module_args(dict(lookup_source=['Ethernet1'])) - commands = ['no ip domain lookup source-interface Management1', - 'ip domain lookup source-interface Ethernet1'] - self.execute_module(changed=True, commands=commands) - - def test_eos_system_lookup_source_complex(self): - lookup_source = [{'interface': 'Management1', 'vrf': 'mgmt'}, - {'interface': 'Ethernet1'}] - set_module_args(dict(lookup_source=lookup_source)) - commands = ['no ip domain lookup source-interface Management1', - 'ip domain lookup vrf mgmt source-interface Management1', - 'ip domain lookup source-interface Ethernet1'] - self.execute_module(changed=True, commands=commands) - - # def test_eos_system_name_servers(self): - # name_servers = ['8.8.8.8', '8.8.4.4'] - # set_module_args(dict(name_servers=name_servers)) - # commands = ['ip name-server 8.8.4.4', - # 'no ip name-server vrf mgmt 8.8.4.4'] - # self.execute_module(changed=True, commands=commands) - - # def rest_eos_system_name_servers_complex(self): - # name_servers = dict(server='8.8.8.8', vrf='test') - # set_module_args(dict(name_servers=name_servers)) - # commands = ['ip name-server vrf test 8.8.8.8', - # 'no ip name-server vrf default 8.8.8.8', - # 'no ip name-server vrf mgmt 8.8.4.4'] - # self.execute_module(changed=True, commands=commands) - - def test_eos_system_state_absent(self): - set_module_args(dict(state='absent')) - commands = ['no ip domain-name', 'no hostname'] - self.execute_module(changed=True, commands=commands) - - def test_eos_system_no_change(self): - set_module_args(dict(hostname='switch01', domain_name='eng.ansible.com')) - commands = [] - self.execute_module(commands=commands) - - def test_eos_system_missing_vrf(self): - name_servers = dict(server='8.8.8.8', vrf='missing') - set_module_args(dict(name_servers=name_servers)) - self.execute_module(failed=True) diff --git a/test/units/modules/network/eos/test_eos_user.py b/test/units/modules/network/eos/test_eos_user.py deleted file mode 100644 index cf539c21c1..0000000000 --- a/test/units/modules/network/eos/test_eos_user.py +++ /dev/null @@ -1,100 +0,0 @@ -# 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 units.compat.mock import patch -from ansible.modules.network.eos import eos_user -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosUserModule(TestEosModule): - - module = eos_user - - def setUp(self): - super(TestEosUserModule, self).setUp() - - self.mock_get_config = patch('ansible.modules.network.eos.eos_user.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.eos.eos_user.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestEosUserModule, self).tearDown() - - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - self.get_config.return_value = load_fixture('eos_user_config.cfg') - self.load_config.return_value = dict(diff=None, session='session') - - def test_eos_user_create(self): - set_module_args(dict(name='test', nopassword=True)) - commands = ['username test nopassword'] - self.execute_module(changed=True, commands=commands) - - def test_eos_user_delete(self): - set_module_args(dict(name='ansible', state='absent')) - commands = ['no username ansible'] - self.execute_module(changed=True, commands=commands) - - def test_eos_user_password(self): - set_module_args(dict(name='ansible', configured_password='test')) - commands = ['username ansible secret test'] - self.execute_module(changed=True, commands=commands) - - def test_eos_user_privilege(self): - set_module_args(dict(name='ansible', privilege=15, configured_password='test')) - result = self.execute_module(changed=True) - self.assertIn('username ansible privilege 15', result['commands']) - - def test_eos_user_privilege_invalid(self): - set_module_args(dict(name='ansible', privilege=25, configured_password='test')) - self.execute_module(failed=True) - - def test_eos_user_purge(self): - set_module_args(dict(purge=True)) - commands = ['no username ansible'] - self.execute_module(changed=True, commands=commands) - - def test_eos_user_role(self): - set_module_args(dict(name='ansible', role='test', configured_password='test')) - result = self.execute_module(changed=True) - self.assertIn('username ansible role test', result['commands']) - - def test_eos_user_sshkey(self): - set_module_args(dict(name='ansible', sshkey='test')) - commands = ['username ansible sshkey test'] - self.execute_module(changed=True, commands=commands) - - def test_eos_user_update_password_changed(self): - set_module_args(dict(name='test', configured_password='test', update_password='on_create')) - commands = ['username test secret test'] - self.execute_module(changed=True, commands=commands) - - def test_eos_user_update_password_on_create_ok(self): - set_module_args(dict(name='ansible', configured_password='test', update_password='on_create')) - self.execute_module() - - def test_eos_user_update_password_always(self): - set_module_args(dict(name='ansible', configured_password='test', update_password='always')) - commands = ['username ansible secret test'] - self.execute_module(changed=True, commands=commands) diff --git a/test/units/modules/network/eos/test_eos_vlans.py b/test/units/modules/network/eos/test_eos_vlans.py deleted file mode 100644 index 63f4d38d14..0000000000 --- a/test/units/modules/network/eos/test_eos_vlans.py +++ /dev/null @@ -1,172 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.eos import eos_vlans -from units.modules.utils import set_module_args -from .eos_module import TestEosModule, load_fixture - - -class TestEosVlansModule(TestEosModule): - module = eos_vlans - - def setUp(self): - super(TestEosVlansModule, self).setUp() - - self.mock_get_config = patch('ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch('ansible.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.module_utils.network.common.facts.facts.get_resource_connection') - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() - - self.mock_edit_config = patch('ansible.module_utils.network.eos.providers.providers.CliProvider.edit_config') - self.edit_config = self.mock_edit_config.start() - - self.mock_execute_show_command = patch('ansible.module_utils.network.eos.config.vlans.vlans.Vlans.get_vlans_facts') - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestEosVlansModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_edit_config.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None, transport='cli'): - file_cmd = load_fixture('eos_vlan_config.cfg').split() - file_cmd_dict = {} - for i in range(0, len(file_cmd), 2): - if file_cmd[i] == 'vlan_id': - y = int(file_cmd[i + 1]) - else: - y = file_cmd[i + 1] - file_cmd_dict.update({file_cmd[i]: y}) - self.execute_show_command.return_value = [file_cmd_dict] - - def test_eos_vlan_default(self): - self.execute_show_command.return_value = [] - set_module_args(dict( - config=[dict( - vlan_id=30, - name="thirty" - )] - )) - commands = ['vlan 30', 'name thirty'] - self.execute_module(changed=True, commands=commands) - - def test_eos_vlan_default_idempotent(self): - self.execute_show_command.return_value = load_fixture('eos_vlan_config.cfg') - set_module_args(dict( - config=[dict( - vlan_id=10, - name="ten" - )] - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_vlan_merged(self): - self.execute_show_command.return_value = [] - set_module_args(dict( - config=[dict( - vlan_id=30, - name="thirty" - )], state="merged" - )) - commands = ['vlan 30', 'name thirty'] - self.execute_module(changed=True, commands=commands) - - def test_eos_vlan_merged_idempotent(self): - self.execute_show_command.return_value = load_fixture('eos_vlan_config.cfg') - set_module_args(dict( - config=[dict( - vlan_id=10, - name="ten" - )], state="merged" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_vlan_replaced(self): - self.execute_show_command.return_value = [] - set_module_args(dict( - config=[dict( - vlan_id=10, - name="tenreplaced", - state="suspend" - )], state="replaced" - )) - commands = ['vlan 10', 'name tenreplaced', 'state suspend'] - self.execute_module(changed=True, commands=commands) - - def test_eos_vlan_replaced_idempotent(self): - self.execute_show_command.return_value = load_fixture('eos_vlan_config.cfg') - set_module_args(dict( - config=[dict( - vlan_id=10, - name="ten" - )], state="replaced" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_vlan_overridden(self): - self.execute_show_command.return_value = [] - set_module_args(dict( - config=[dict( - vlan_id=30, - name="thirty", - state="suspend" - )], state="overridden" - )) - commands = ['no vlan 10', 'vlan 30', 'name thirty', 'state suspend'] - self.execute_module(changed=True, commands=commands) - - def test_eos_vlan_overridden_idempotent(self): - self.execute_show_command.return_value = load_fixture('eos_vlan_config.cfg') - set_module_args(dict( - config=[dict( - vlan_id=10, - name="ten" - )], state="overridden" - )) - self.execute_module(changed=False, commands=[]) - - def test_eos_vlan_deleted(self): - set_module_args(dict( - config=[dict( - vlan_id=10, - name="ten", - )], state="deleted" - )) - commands = ['no vlan 10'] - self.execute_module(changed=True, commands=commands) - - def test_eos_vlan_id_datatype(self): - set_module_args(dict( - config=[dict( - vlan_id="thirty" - )] - )) - result = self.execute_module(failed=True) - self.assertIn("we were unable to convert to int", result['msg']) - - def test_eos_vlan_state_datatype(self): - set_module_args(dict( - config=[dict( - vlan_id=30, - state=10 - )] - )) - result = self.execute_module(failed=True) - self.assertIn("value of state must be one of: active, suspend", result['msg']) |