summaryrefslogtreecommitdiffstats
path: root/ansible_collections/arista/eos/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/arista/eos/tests')
-rw-r--r--ansible_collections/arista/eos/tests/config.yml2
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_bgp/defaults/main.yaml3
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_bgp/meta/main.yaml3
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/cli.yaml19
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/main.yaml5
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tests/cli/basic.yaml399
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/config.yaml6
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel.yaml6
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_after.yaml6
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_before.yaml6
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_facts/tests/cli/network_facts15
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/defaults/main.yaml2
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/meta/main.yaml3
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/cli.yaml19
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/eapi.yaml19
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/main.yaml10
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/cli/basic.yaml154
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/eapi/basic.yaml96
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_ospfv3/tests/common/merged.yaml13
-rw-r--r--ansible_collections/arista/eos/tests/integration/targets/eos_user/tests/cli/auth.yaml1
-rw-r--r--ansible_collections/arista/eos/tests/sanity/ignore-2.18.txt1
-rw-r--r--ansible_collections/arista/eos/tests/unit/compat/__init__.py0
-rw-r--r--ansible_collections/arista/eos/tests/unit/compat/mock.py129
-rw-r--r--ansible_collections/arista/eos/tests/unit/compat/unittest.py41
-rw-r--r--ansible_collections/arista/eos/tests/unit/mock/path.py4
-rw-r--r--ansible_collections/arista/eos/tests/unit/mock/procenv.py5
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acl_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acls.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_banner.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp.py400
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_address_family.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_global.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_command.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_config.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_eapi.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_hostname.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l2_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l3_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lag_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lldp_global.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging.py112
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging_global.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ntp_global.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospf_interfaces.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv2.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv3.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_prefix_lists.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_route_maps.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_snmp_server.py7
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_static_routes.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_system.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_user.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_vlans.py3
-rw-r--r--ansible_collections/arista/eos/tests/unit/modules/utils.py8
57 files changed, 107 insertions, 1468 deletions
diff --git a/ansible_collections/arista/eos/tests/config.yml b/ansible_collections/arista/eos/tests/config.yml
index 41f529264..c26ea5966 100644
--- a/ansible_collections/arista/eos/tests/config.yml
+++ b/ansible_collections/arista/eos/tests/config.yml
@@ -1,3 +1,3 @@
---
modules:
- python_requires: ">=3.6"
+ python_requires: ">=3.9"
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/defaults/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/defaults/main.yaml
deleted file mode 100644
index 9ef5ba516..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/defaults/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-testcase: "*"
-test_items: []
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/meta/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/meta/main.yaml
deleted file mode 100644
index d29186fe0..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/meta/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_eos_tests
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/cli.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/cli.yaml
deleted file mode 100644
index 57bedc474..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/cli.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: Collect all cli test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- register: test_cases
- delegate_to: localhost
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases (connection=ansible.netcommon.network_cli)
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.network_cli
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/main.yaml
deleted file mode 100644
index c3b429408..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tasks/main.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-- name: Invoke cli tasks
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - network_cli
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tests/cli/basic.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tests/cli/basic.yaml
deleted file mode 100644
index 794d21d3e..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp/tests/cli/basic.yaml
+++ /dev/null
@@ -1,399 +0,0 @@
----
-- name: Basic Tests
- ansible.builtin.debug: msg="START eos cli/eos_bgp.yaml on connection={{ ansible_connection }}"
-
-- name: Clear existing BGP config
- become: true
- ignore_errors: true
- arista.eos.eos_bgp: &id011
- operation: delete
-
-- name: Configure BGP with AS 64496 and a router-id
- become: true
- register: result
- arista.eos.eos_bgp: &id001
- operation: merge
- config:
- bgp_as: 64496
- router_id: 192.0.2.2
-
-- name: Assertion
- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id001
-
-- name: Assertion
- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure BGP neighbors
- become: true
- register: result
- arista.eos.eos_bgp: &id002
- 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
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id002
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure BGP neighbors with operation replace
- become: true
- register: result
- arista.eos.eos_bgp: &id003
- 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
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id003
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure root-level networks for BGP
- become: true
- register: result
- arista.eos.eos_bgp: &id004
- 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
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id004
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure root-level networks for BGP with operation replace
- become: true
- register: result
- arista.eos.eos_bgp: &id005
- 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
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id005
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure BGP route redistribute information
- become: true
- register: result
- arista.eos.eos_bgp: &id006
- operation: merge
- config:
- bgp_as: 64496
- redistribute:
- - protocol: ospf
- route_map: RMAP_1
-
- - protocol: rip
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id006
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure BGP route redistribute information with operation replace
- become: true
- register: result
- arista.eos.eos_bgp: &id007
- operation: replace
- config:
- bgp_as: 64496
- redistribute:
- - protocol: ospf
- route_map: RMAP_1
-
- - protocol: static
- route_map: RMAP_2
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id007
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure BGP neighbors under address family mode
- become: true
- register: result
- arista.eos.eos_bgp: &id008
- operation: merge
- config:
- bgp_as: 64496
- address_family:
- - afi: ipv4
- neighbors:
- - neighbor: 203.0.113.10
- activate: true
- default_originate: true
-
- - neighbor: 192.0.2.15
- activate: true
- graceful_restart: false
-
-- ansible.builtin.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"
- - "'no neighbor 192.0.2.15 graceful-restart' in result.commands"
-
-- name: Configure BGP neighbors under address family mode (idempotent)
- become: true
- register: result
- arista.eos.eos_bgp: *id008
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure networks under address family
- become: true
- register: result
- arista.eos.eos_bgp: &id009
- 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
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id009
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Configure networks under address family with operation replace
- become: true
- register: result
- arista.eos.eos_bgp: &id010
- 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
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_bgp: *id010
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Override all the exisiting BGP config
- become: true
- register: result
- arista.eos.eos_bgp:
- operation: override
- config:
- bgp_as: 64497
- router_id: 192.0.2.10
- log_neighbor_changes: true
-
-- ansible.builtin.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
- become: true
- register: result
- arista.eos.eos_bgp: *id011
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'no router bgp 64497' in result.commands"
-
-- name: Teardown again (idempotent)
- become: true
- register: result
- arista.eos.eos_bgp: *id011
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- ansible.builtin.debug: msg="END eos cli/eos_bgp.yaml on connection={{ ansible_connection }}"
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/config.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/config.yaml
index 892b7f1e7..0b1dbc134 100644
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/config.yaml
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/config.yaml
@@ -17,13 +17,13 @@
become: true
register: result
arista.eos.eos_config:
- lines: hostname foo
+ lines: hostname int_tests
config: "{{ config.stdout[0] }}"
- ansible.builtin.assert:
that:
- result.changed == true
- - "'hostname foo' in result.updates"
+ - "'hostname int_tests' in result.updates"
- name: get current running-config
become: true
@@ -35,7 +35,7 @@
become: true
register: result
arista.eos.eos_config:
- lines: hostname foo
+ lines: hostname int_tests
config: "{{ config.stdout[0] }}"
- ansible.builtin.assert:
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel.yaml
index e3a950986..ab8b29997 100644
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel.yaml
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel.yaml
@@ -4,6 +4,12 @@
- name: setup
become: true
arista.eos.eos_config:
+ lines:
+ - no hostname
+
+- name: setup
+ become: true
+ arista.eos.eos_config:
lines: hostname {{ inventory_hostname_short }}
match: none
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_after.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_after.yaml
index 66a60c0ae..2a3a304dc 100644
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_after.yaml
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_after.yaml
@@ -7,6 +7,12 @@
become: true
arista.eos.eos_config:
lines:
+ - no hostname
+
+- name: setup
+ become: true
+ arista.eos.eos_config:
+ lines:
- snmp-server contact ansible
- hostname {{ inventory_hostname_short }}
match: none
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_before.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_before.yaml
index 949767b2e..33f1a813d 100644
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_before.yaml
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/toplevel_before.yaml
@@ -7,6 +7,12 @@
become: true
arista.eos.eos_config:
lines:
+ - no hostname
+
+- name: setup
+ become: true
+ arista.eos.eos_config:
+ lines:
- snmp-server contact ansible
- hostname {{ inventory_hostname_short }}
match: none
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_facts/tests/cli/network_facts b/ansible_collections/arista/eos/tests/integration/targets/eos_facts/tests/cli/network_facts
new file mode 100644
index 000000000..32c715cf9
--- /dev/null
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_facts/tests/cli/network_facts
@@ -0,0 +1,15 @@
+---
+- ansible.builtin.debug: msg="START cli/network_resource_facts.yaml on connection={{ ansible_connection }}"
+
+- name: Gather arista network resource facts
+ arista.eos.eos_facts:
+ gather_subset: config
+ gather_network_resources:
+ - 'static_routes'
+ register: result
+
+- name: Assert that facts gathered was correctly generated
+ ansible.builtin.assert:
+ that:
+ - "result['ansible_facts']['ansible_network_resources']['static_routes'] == []"
+- ansible.builtin.debug: msg="END cli/network_resource_facts.yaml on connection={{ ansible_connection }}"
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/defaults/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/meta/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/meta/main.yaml
deleted file mode 100644
index d29186fe0..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/meta/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_eos_tests
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/cli.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/cli.yaml
deleted file mode 100644
index 57bedc474..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/cli.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: Collect all cli test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- register: test_cases
- delegate_to: localhost
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases (connection=ansible.netcommon.network_cli)
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.network_cli
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/eapi.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/eapi.yaml
deleted file mode 100644
index a5cc3bac9..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/eapi.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: Collect all eapi test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/eapi"
- patterns: "{{ testcase }}.yaml"
- delegate_to: localhost
- register: test_cases
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases (connection=ansible.netcommon.httpapi)
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.httpapi
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/main.yaml
deleted file mode 100644
index a821bf6be..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tasks/main.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
----
-- name: Invoke cli
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - network_cli
-
-- name: Invoke eapi
- ansible.builtin.include_tasks: eapi.yaml
- tags:
- - httpapi
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/cli/basic.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/cli/basic.yaml
deleted file mode 100644
index 56083e8ba..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/cli/basic.yaml
+++ /dev/null
@@ -1,154 +0,0 @@
----
-- ansible.builtin.debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
-
-- name: Set up host logging
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging host 172.16.0.1" in result.commands'
-
-- name: Set up host logging again (idempotent)
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Delete/disable host logging
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging host 172.16.0.1" in result.commands'
-
-- name: Delete/disable host logging (idempotent)
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Console logging with level warnings
- become: true
- register: result
- arista.eos.eos_logging:
- dest: console
- level: warnings
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging console warnings" in result.commands'
-
-- name: Configure buffer size
- become: true
- register: result
- arista.eos.eos_logging:
- dest: buffered
- size: 480000
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging buffered 480000" in result.commands'
-
-- name: Set up logging destination and facility at the same time
- become: true
- register: result
- arista.eos.eos_logging:
- dest: buffered
- size: 4096
- facility: local7
- level: informational
- state: present
-
-- ansible.builtin.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)
- become: true
- register: result
- arista.eos.eos_logging:
- dest: buffered
- size: 4096
- facility: local7
- level: informational
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Set up logging facility alone
- become: true
- register: result
- arista.eos.eos_logging:
- facility: local2
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging facility local2" in result.commands'
-
-- name: Set up logging facility (idempotent)
- become: true
- register: result
- arista.eos.eos_logging:
- facility: local2
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: remove logging as collection tearDown
- become: true
- register: result
- arista.eos.eos_logging:
- aggregate:
- - dest: console
- level: warnings
- state: absent
-
- - dest: buffered
- level: informational
- size: 4096
- state: absent
-
- - facility: local2
- state: absent
-
-- ansible.builtin.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/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/eapi/basic.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/eapi/basic.yaml
deleted file mode 100644
index ef1cade8c..000000000
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_logging/tests/eapi/basic.yaml
+++ /dev/null
@@ -1,96 +0,0 @@
----
-- ansible.builtin.debug: msg="START eapi/basic.yaml on connection={{ ansible_connection }}"
-
-- name: Set up host logging
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging host 172.16.0.1" in result.commands'
-
-- name: Set up host logging again (idempotent)
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Delete/disable host logging
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging host 172.16.0.1" in result.commands'
-
-- name: Delete/disable host logging (idempotent)
- become: true
- register: result
- arista.eos.eos_logging:
- dest: host
- name: 172.16.0.1
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Console logging with level warnings
- become: true
- register: result
- arista.eos.eos_logging:
- dest: console
- level: warnings
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging console warnings" in result.commands'
-
-- name: Configure buffer size
- become: true
- register: result
- arista.eos.eos_logging:
- dest: buffered
- size: 480000
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"logging buffered 480000" in result.commands'
-
-- name: remove logging as collection tearDown
- become: true
- register: result
- arista.eos.eos_logging:
- aggregate:
- - dest: console
- level: warnings
- state: absent
-
- - dest: buffered
- size: 480000
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '"no logging console" in result.commands'
- - '"no logging buffered" in result.commands'
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_ospfv3/tests/common/merged.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_ospfv3/tests/common/merged.yaml
index 430ac7b4c..77b4774b7 100644
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_ospfv3/tests/common/merged.yaml
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_ospfv3/tests/common/merged.yaml
@@ -109,7 +109,7 @@
- result.commands|length == 0
- result.changed == false
- - name: merge given ospfv3 configuration with timers.throttle option (expect warning).
+ - name: merge given ospfv3 configuration with timers option.
become: true
register: result
arista.eos.eos_ospfv3:
@@ -142,19 +142,11 @@
fips_restrictions: true
timers:
pacing: 7
- throttle:
- spf: true
- initial: 56
- max: 56
- min: 56
vrf: "default"
- - ansible.builtin.assert:
- that: "'The \\'timers\\' argument has been changed to have separate \\'lsa\\' and \\'spf\\' keys and \\'throttle\\' has been deprecated.' in result.warnings[0]"
-
- ansible.builtin.include_tasks: _remove_config.yaml
- - name: merge given ospfv3 configuration with timers.lsa option (expect warning).
+ - name: merge given ospfv3 configuration with timers.lsa option.
become: true
register: result
arista.eos.eos_ospfv3:
@@ -174,7 +166,6 @@
- ansible.builtin.assert:
that:
- - "'\\'timers lsa arrival\\' has changed to \\'timers lsa rx min interval\\'' in result.warnings[0]"
- '"timers lsa rx min interval 33" in result["commands"]'
always:
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_user/tests/cli/auth.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_user/tests/cli/auth.yaml
index 12f6bfe65..339a2b77e 100644
--- a/ansible_collections/arista/eos/tests/integration/targets/eos_user/tests/cli/auth.yaml
+++ b/ansible_collections/arista/eos/tests/integration/targets/eos_user/tests/cli/auth.yaml
@@ -16,6 +16,7 @@
-o StrictHostKeyChecking=no show version
responses:
(?i)password: pass123
+ ignore_errors: true
- name: test login with invalid password (should fail)
expect:
diff --git a/ansible_collections/arista/eos/tests/sanity/ignore-2.18.txt b/ansible_collections/arista/eos/tests/sanity/ignore-2.18.txt
new file mode 100644
index 000000000..4acb4eaa2
--- /dev/null
+++ b/ansible_collections/arista/eos/tests/sanity/ignore-2.18.txt
@@ -0,0 +1 @@
+plugins/action/eos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
diff --git a/ansible_collections/arista/eos/tests/unit/compat/__init__.py b/ansible_collections/arista/eos/tests/unit/compat/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/arista/eos/tests/unit/compat/__init__.py
+++ /dev/null
diff --git a/ansible_collections/arista/eos/tests/unit/compat/mock.py b/ansible_collections/arista/eos/tests/unit/compat/mock.py
deleted file mode 100644
index e4ce72b34..000000000
--- a/ansible_collections/arista/eos/tests/unit/compat/mock.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# 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
-
-"""
-Compat module for Python3.x's unittest.mock module
-"""
-import sys
-
-import _io
-
-
-# Python 2.7
-
-# Note: Could use the pypi mock library on python3.x as well as python2.x. It
-# is the same as the python3 stdlib mock library
-
-try:
- # Allow wildcard import because we really do want to import all of mock's
- # symbols into this compat shim
- # pylint: disable=wildcard-import,unused-wildcard-import
- from unittest.mock import *
-except ImportError:
- # Python 2
- # pylint: disable=wildcard-import,unused-wildcard-import
- try:
- from mock import *
- except ImportError:
- print("You need the mock library installed on python2.x to run tests")
-
-
-# Prior to 3.4.4, mock_open cannot handle binary read_data
-if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
- file_spec = None
-
- def _iterate_read_data(read_data):
- # Helper for mock_open:
- # Retrieve lines from read_data via a generator so that separate calls to
- # readline, read, and readlines are properly interleaved
- sep = b"\n" if isinstance(read_data, bytes) else "\n"
- data_as_list = [l + sep for l in read_data.split(sep)]
-
- if data_as_list[-1] == sep:
- # If the last line ended in a newline, the list comprehension will have an
- # extra entry that's just a newline. Remove this.
- data_as_list = data_as_list[:-1]
- else:
- # If there wasn't an extra newline by itself, then the file being
- # emulated doesn't have a newline to end the last line remove the
- # newline that our naive format() added
- data_as_list[-1] = data_as_list[-1][:-1]
-
- for line in data_as_list:
- yield line
-
- def mock_open(mock=None, read_data=""):
- """
- A helper function to create a mock to replace the use of `open`. It works
- for `open` called directly or used as a context manager.
-
- The `mock` argument is the mock object to configure. If `None` (the
- default) then a `MagicMock` will be created for you, with the API limited
- to methods or attributes available on standard file handles.
-
- `read_data` is a string for the `read` methoddline`, and `readlines` of the
- file handle to return. This is an empty string by default.
- """
-
- def _readlines_side_effect(*args, **kwargs):
- if handle.readlines.return_value is not None:
- return handle.readlines.return_value
- return list(_data)
-
- def _read_side_effect(*args, **kwargs):
- if handle.read.return_value is not None:
- return handle.read.return_value
- return type(read_data)().join(_data)
-
- def _readline_side_effect():
- if handle.readline.return_value is not None:
- while True:
- yield handle.readline.return_value
- for line in _data:
- yield line
-
- global file_spec
- if file_spec is None:
- file_spec = list(
- set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))),
- )
-
- if mock is None:
- mock = MagicMock(name="open", spec=open)
-
- handle = MagicMock(spec=file_spec)
- handle.__enter__.return_value = handle
-
- _data = _iterate_read_data(read_data)
-
- handle.write.return_value = None
- handle.read.return_value = None
- handle.readline.return_value = None
- handle.readlines.return_value = None
-
- handle.read.side_effect = _read_side_effect
- handle.readline.side_effect = _readline_side_effect()
- handle.readlines.side_effect = _readlines_side_effect
-
- mock.return_value = handle
- return mock
diff --git a/ansible_collections/arista/eos/tests/unit/compat/unittest.py b/ansible_collections/arista/eos/tests/unit/compat/unittest.py
deleted file mode 100644
index df4266ec9..000000000
--- a/ansible_collections/arista/eos/tests/unit/compat/unittest.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
-#
-# 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
-
-"""
-Compat module for Python2.7's unittest module
-"""
-
-import sys
-
-
-# Allow wildcard import because we really do want to import all of
-# unittests's symbols into this compat shim
-# pylint: disable=wildcard-import,unused-wildcard-import
-if sys.version_info < (2, 7):
- try:
- # Need unittest2 on python2.6
- from unittest2 import *
- except ImportError:
- print("You need unittest2 installed on python2.6.x to run tests")
-else:
- from unittest import *
diff --git a/ansible_collections/arista/eos/tests/unit/mock/path.py b/ansible_collections/arista/eos/tests/unit/mock/path.py
index fe27d505f..7d287a5fb 100644
--- a/ansible_collections/arista/eos/tests/unit/mock/path.py
+++ b/ansible_collections/arista/eos/tests/unit/mock/path.py
@@ -2,9 +2,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
-from ansible.utils.path import unfrackpath
+from unittest.mock import MagicMock
-from ansible_collections.arista.eos.tests.unit.compat.mock import MagicMock
+from ansible.utils.path import unfrackpath
mock_unfrackpath_noop = MagicMock(
diff --git a/ansible_collections/arista/eos/tests/unit/mock/procenv.py b/ansible_collections/arista/eos/tests/unit/mock/procenv.py
index e7a0080f0..e6e09464b 100644
--- a/ansible_collections/arista/eos/tests/unit/mock/procenv.py
+++ b/ansible_collections/arista/eos/tests/unit/mock/procenv.py
@@ -27,12 +27,11 @@ import sys
from contextlib import contextmanager
from io import BytesIO, StringIO
+from unittest import TestCase
from ansible.module_utils._text import to_bytes
from ansible.module_utils.six import PY3
-from ansible_collections.arista.eos.tests.unit.compat import unittest
-
@contextmanager
def swap_stdin_and_argv(stdin_data="", argv_data=tuple()):
@@ -78,7 +77,7 @@ def swap_stdout():
sys.stdout = old_stdout
-class ModuleTestCase(unittest.TestCase):
+class ModuleTestCase(TestCase):
def setUp(self, module_args=None):
if module_args is None:
module_args = {
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acl_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acl_interfaces.py
index f7904bd40..0e554420d 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acl_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acl_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_acl_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acls.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acls.py
index 4896d28b9..24ece5eff 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acls.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_acls.py
@@ -10,11 +10,12 @@ __metaclass__ = type
import itertools
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.acls.acls import (
add_commands,
)
from ansible_collections.arista.eos.plugins.modules import eos_acls
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_banner.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_banner.py
index 31cf2668d..ef174acf3 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_banner.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_banner.py
@@ -19,8 +19,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_banner
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp.py
deleted file mode 100644
index 7c7dc86c8..000000000
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp.py
+++ /dev/null
@@ -1,400 +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_collections.arista.eos.plugins.module_utils.network.eos.providers.cli.config.bgp.process import (
- Provider,
-)
-from ansible_collections.arista.eos.plugins.modules 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/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_address_family.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_address_family.py
index c6a4c673f..4409e7ab2 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_address_family.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_address_family.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_bgp_address_family
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_global.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_global.py
index 154814ed9..ef07006bb 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_global.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_bgp_global.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_bgp_global
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_command.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_command.py
index 7d3043dd8..a263dcf84 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_command.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_command.py
@@ -23,8 +23,9 @@ __metaclass__ = type
import json
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_command
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_config.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_config.py
index 3a28710ee..3d42e2f54 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_config.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_config.py
@@ -21,9 +21,10 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import MagicMock, patch
+
from ansible_collections.arista.eos.plugins.cliconf.eos import Cliconf
from ansible_collections.arista.eos.plugins.modules import eos_config
-from ansible_collections.arista.eos.tests.unit.compat.mock import MagicMock, patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_eapi.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_eapi.py
index c25582704..221a4ed5f 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_eapi.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_eapi.py
@@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_eapi
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_hostname.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_hostname.py
index b586a83c3..e08422cee 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_hostname.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_hostname.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_hostname
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_interfaces.py
index ce53f2470..18fb2d3f7 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l2_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l2_interfaces.py
index 53828688f..0d5e167b2 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l2_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l2_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_l2_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l3_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l3_interfaces.py
index a7970455e..e65609695 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l3_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_l3_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_l3_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp.py
index 7f8ed6071..e91191301 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp.py
@@ -7,8 +7,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_lacp
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp_interfaces.py
index 4fded7026..c155c684c 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lacp_interfaces.py
@@ -7,8 +7,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_lacp_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lag_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lag_interfaces.py
index 0c4c9a8f8..20be883a9 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lag_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lag_interfaces.py
@@ -7,8 +7,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_lag_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lldp_global.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lldp_global.py
index c87f27ad8..18142cedf 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lldp_global.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_lldp_global.py
@@ -7,8 +7,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_lldp_global
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging.py
deleted file mode 100644
index 1e166008f..000000000
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# (c) 2016 Red Hat Inc.
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
-
-# Make coding more python3-ish
-from __future__ import absolute_import, division, print_function
-
-
-__metaclass__ = type
-
-from ansible_collections.arista.eos.plugins.modules import eos_logging
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
-from ansible_collections.arista.eos.tests.unit.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_collections.arista.eos.plugins.modules.eos_logging.get_config",
- )
- self.get_config = self.mock_get_config.start()
-
- self.mock_load_config = patch(
- "ansible_collections.arista.eos.plugins.modules.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/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging_global.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging_global.py
index 2bf476395..c705d513c 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging_global.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_logging_global.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_logging_global
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ntp_global.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ntp_global.py
index 0296a1500..c2ca363b0 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ntp_global.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ntp_global.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_ntp_global
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospf_interfaces.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospf_interfaces.py
index 65ec34c2f..701c0c9f9 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospf_interfaces.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospf_interfaces.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_ospf_interfaces
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv2.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv2.py
index 8d3f3f746..42a1f6c3c 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv2.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv2.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_ospfv2
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv3.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv3.py
index eaa44f725..67e5188f4 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv3.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_ospfv3.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_ospfv3
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_prefix_lists.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_prefix_lists.py
index c130b313f..81b96ab71 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_prefix_lists.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_prefix_lists.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_prefix_lists
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_route_maps.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_route_maps.py
index 7ee0915b3..63e8678e2 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_route_maps.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_route_maps.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_route_maps
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_snmp_server.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_snmp_server.py
index 6475b666f..812e5ac06 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_snmp_server.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_snmp_server.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_snmp_server
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
@@ -400,7 +401,7 @@ class TestEosSnmp_ServerModule(TestEosModule):
"no snmp-server group group2 v3 priv write view2 notify view1",
"no snmp-server host host01 version 3 priv user01 udp-port 23",
"no snmp-server host host02 version 2c user01 udp-port 23",
- "snmp-server user user01 grp01 remote 1.1.1.1 udp-port 100 v3 md5 password123 priv aes abcdef",
+ "snmp-server user user01 grp01 remote 1.1.1.1 udp-port 100 v3 auth md5 password123 priv aes abcdef",
"no snmp-server vrf vrf01 local-interface Ethernet1",
"snmp-server vrf replacevrf",
"snmp-server chassis-id 123456",
@@ -450,7 +451,7 @@ class TestEosSnmp_ServerModule(TestEosModule):
"no snmp-server group group2 v3 priv write view2 notify view1",
"no snmp-server host host01 version 3 priv user01 udp-port 23",
"no snmp-server host host02 version 2c user01 udp-port 23",
- "snmp-server user user01 grp01 remote 1.1.1.1 udp-port 100 v3 localized abcdef md5 password123 priv aes abcdef",
+ "snmp-server user user01 grp01 remote 1.1.1.1 udp-port 100 v3 localized abcdef auth md5 password123 priv aes abcdef",
"snmp-server view view1 mib1 excluded",
"no snmp-server vrf vrf01 local-interface Ethernet1",
"snmp-server transport tcp",
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_static_routes.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_static_routes.py
index 9150ee77b..4b95d1ea7 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_static_routes.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_static_routes.py
@@ -10,11 +10,12 @@ __metaclass__ = type
import itertools
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.module_utils.network.eos.config.static_routes.static_routes import (
add_commands,
)
from ansible_collections.arista.eos.plugins.modules import eos_static_routes
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_system.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_system.py
index 14334bb48..dd7bfef04 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_system.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_system.py
@@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_system
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_user.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_user.py
index fa4ccac0a..eefa6f386 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_user.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_user.py
@@ -19,8 +19,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_user
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_vlans.py b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_vlans.py
index f707c88c4..4951329dd 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_vlans.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/network/eos/test_eos_vlans.py
@@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
+from unittest.mock import patch
+
from ansible_collections.arista.eos.plugins.modules import eos_vlans
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.arista.eos.tests.unit.modules.utils import set_module_args
from .eos_module import TestEosModule, load_fixture
diff --git a/ansible_collections/arista/eos/tests/unit/modules/utils.py b/ansible_collections/arista/eos/tests/unit/modules/utils.py
index 10ea1509d..87be9cf8e 100644
--- a/ansible_collections/arista/eos/tests/unit/modules/utils.py
+++ b/ansible_collections/arista/eos/tests/unit/modules/utils.py
@@ -4,12 +4,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
import json
+from unittest import TestCase
+from unittest.mock import patch
+
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
-from ansible_collections.arista.eos.tests.unit.compat import unittest
-from ansible_collections.arista.eos.tests.unit.compat.mock import patch
-
def set_module_args(args):
if "_ansible_remote_tmp" not in args:
@@ -40,7 +40,7 @@ def fail_json(*args, **kwargs):
raise AnsibleFailJson(kwargs)
-class ModuleTestCase(unittest.TestCase):
+class ModuleTestCase(TestCase):
def setUp(self):
self.mock_module = patch.multiple(
basic.AnsibleModule,