diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:35 +0000 |
commit | 7fec0b69a082aaeec72fee0612766aa42f6b1b4d (patch) | |
tree | efb569b86ca4da888717f5433e757145fa322e08 /ansible_collections/arista/eos/tests/integration/targets | |
parent | Releasing progress-linux version 7.7.0+dfsg-3~progress7.99u1. (diff) | |
download | ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.tar.xz ansible-7fec0b69a082aaeec72fee0612766aa42f6b1b4d.zip |
Merging upstream version 9.4.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/arista/eos/tests/integration/targets')
8 files changed, 249 insertions, 1 deletions
diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed.cfg b/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed.cfg index 346535809..63315d2fc 100644 --- a/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed.cfg +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed.cfg @@ -1,3 +1,6 @@ +ipv6 access-list test2 + 10 deny icmpv6 any any reject-route hop-limit eq 20 +! ip access-list test1 35 deny tcp 20.0.0.0/8 any log 45 remark Run by ansible diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml index 4380ec233..9e10f1ca4 100644 --- a/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml @@ -8,3 +8,5 @@ - "35 deny tcp 20.0.0.0/8 any log" - "45 remark Run by ansible" - "55 permit tcp any any" + - "ipv6 access-list test2" + - "10 deny icmpv6 any any reject-route hop-limit eq 20" diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_bgp_global/tests/common/overridden.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp_global/tests/common/overridden.yaml new file mode 100644 index 000000000..289af59c5 --- /dev/null +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_bgp_global/tests/common/overridden.yaml @@ -0,0 +1,68 @@ +--- +- ansible.builtin.debug: + msg: Start eos_bgp_global overridden integration tests ansible_connection={{ + ansible_connection }} + +- ansible.builtin.include_tasks: _remove_config.yaml + +- ansible.builtin.include_tasks: _populate.yaml + +- block: + - name: Override given bgp_global configuration + become: true + register: result + arista.eos.eos_bgp_global: &overridden + state: "overridden" + config: + as_number: "65536" + vrfs: + - vrf: "vrf02" + redistribute: + - protocol: "isis" + isis_level: "level-2" + timers: + holdtime: 100 + keepalive: 44 + network: + - address: "6.6.6.0/24" + route_map: "netmap1" + - address: "10.1.0.0/16" + redistribute: + - protocol: "isis" + isis_level: "level-2" + + - ansible.builtin.assert: + that: + - result.commands|length == 22 + - result.changed == true + - result.commands|symmetric_difference(replaced.commands) == [] + - result.after == replaced.after + - result.before == populate.global + + - name: Idempotency check + become: true + register: result + arista.eos.eos_bgp_global: *overridden + + - ansible.builtin.assert: + that: + - result.commands|length == 0 + - result.changed == false + + - name: Configure address_family under vrf + become: true + arista.eos.eos_config: + src: populate_af.cfg + + - name: Override in presence of address_family + become: true + ignore_errors: true + register: result + arista.eos.eos_bgp_global: *overridden + + - ansible.builtin.assert: + that: + - result.msg == 'Use the _bgp_address_family module to delete the address_family under vrf, before replacing/deleting the vrf.' + + always: + - ansible.builtin.include_tasks: _remove_config.yaml diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_config/templates/basic/interface_config.j2 b/ansible_collections/arista/eos/tests/integration/targets/eos_config/templates/basic/interface_config.j2 new file mode 100644 index 000000000..cba0b3939 --- /dev/null +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_config/templates/basic/interface_config.j2 @@ -0,0 +1,3 @@ +interface Ethernet2 + description this is a test + shutdown diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/replace_block.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/replace_block.yaml new file mode 100644 index 000000000..009d377e6 --- /dev/null +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_config/tests/cli/replace_block.yaml @@ -0,0 +1,44 @@ +--- +- ansible.builtin.debug: msg="START cli/replace_block.yaml on connection={{ ansible_connection }}" + +- name: setup + become: true + arista.eos.eos_config: + commands: + - no description + - no shutdown + parents: + - interface Ethernet2 + match: none + +- name: configure device with config + become: true + register: result1 + arista.eos.eos_config: + lines: "{{ lookup('template', 'basic/interface_config.j2') }}" + replace: block + +- ansible.builtin.assert: + that: + - result1.changed == true + +- name: setup + become: true + arista.eos.eos_config: + commands: + - no description + - no shutdown + parents: + - interface Ethernet2 + match: none + +- name: "Populate acl configuration with replace block and src options" + become: true + register: result2 + arista.eos.eos_config: + src: basic/interface_config.j2 + +- ansible.builtin.assert: + that: + - result2.changed == true + - result1.commands == result2.commands diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/tests/common/update.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/tests/common/update.yaml new file mode 100644 index 000000000..84cc59d22 --- /dev/null +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/tests/common/update.yaml @@ -0,0 +1,72 @@ +--- +- ansible.builtin.debug: + msg: Start eos_ntp_global update integration tests ansible_connection={{ + ansible_connection }} + +- block: + - name: merge given ntp_global configuration + become: true + register: result + arista.eos.eos_ntp_global: &update + config: + authenticate: + enable: true + authentication_keys: + - algorithm: "sha1" + encryption: 7 + id: 2 + key: "123456" + - algorithm: "md5" + encryption: 7 + id: 23 + key: "123456" + local_interface: "Ethernet1" + qos_dscp: 10 + serve: + access_lists: + - acls: + - acl_name: "acl01" + direction: "in" + afi: "ip" + - acls: + - acl_name: "acl02" + direction: "in" + afi: "ipv6" + servers: + - burst: true + prefer: true + server: "10.1.1.1" + vrf: "vrf01" + - burst: true + minpoll: 13 + prefer: true + server: "11.21.1.1" + vrf: "vrf01" + - key_id: 2 + maxpoll: 15 + server: "25.1.1.1" + vrf: "vrf01" + - server: "1.1.1.1" + vrf: "vrf01" + local_interface: "Management1" + trusted_key: "23" + + - ansible.builtin.assert: + that: + - result.commands|length == 12 + - result.changed == true + - result.commands|symmetric_difference(updated.commands) == [] + - result.after == updated.after + - result.before == {} + + - name: Idempotency check + become: true + register: result + arista.eos.eos_ntp_global: *update + + - ansible.builtin.assert: + that: + - result.commands|length == 0 + - result.changed == false + always: + - ansible.builtin.include_tasks: _remove_config.yaml diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/vars/main.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/vars/main.yaml index 1ad174f74..d08d7e9cd 100644 --- a/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/vars/main.yaml +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_ntp_global/vars/main.yaml @@ -26,6 +26,63 @@ deleted: - "no ntp qos dscp 10" - "no ntp trusted-key 23" +updated: + commands: + - "ntp serve ip access-group acl01 in" + - "ntp serve ipv6 access-group acl02 in" + - "ntp authentication-key 2 sha1 7 ********" + - "ntp authentication-key 23 md5 7 ********" + - "ntp server vrf vrf01 10.1.1.1 burst prefer" + - "ntp server vrf vrf01 11.21.1.1 burst minpoll 13 prefer" + - "ntp server vrf vrf01 25.1.1.1 key 2 maxpoll 15" + - "ntp server vrf vrf01 1.1.1.1 local-interface Management1" + - "ntp authenticate" + - "ntp local-interface Ethernet1" + - "ntp qos dscp 10" + - "ntp trusted-key 23" + after: + authenticate: + enable: true + authentication_keys: + - algorithm: "sha1" + encryption: 7 + id: 2 + key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" + - algorithm: "md5" + encryption: 7 + id: 23 + key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" + local_interface: "Ethernet1" + qos_dscp: 10 + serve: + access_lists: + - acls: + - acl_name: "acl01" + direction: "in" + afi: "ip" + - acls: + - acl_name: "acl02" + direction: "in" + afi: "ipv6" + servers: + - local_interface: "Management1" + server: "1.1.1.1" + vrf: "vrf01" + - burst: true + prefer: true + server: "10.1.1.1" + vrf: "vrf01" + - burst: true + minpoll: 13 + prefer: true + server: "11.21.1.1" + vrf: "vrf01" + - key_id: 2 + maxpoll: 15 + server: "25.1.1.1" + vrf: "vrf01" + trusted_key: "23" + replaced: before: authenticate: diff --git a/ansible_collections/arista/eos/tests/integration/targets/eos_smoke/tasks/cli.yaml b/ansible_collections/arista/eos/tests/integration/targets/eos_smoke/tasks/cli.yaml index ed1277e4e..44f5b7ffd 100644 --- a/ansible_collections/arista/eos/tests/integration/targets/eos_smoke/tasks/cli.yaml +++ b/ansible_collections/arista/eos/tests/integration/targets/eos_smoke/tasks/cli.yaml @@ -23,4 +23,3 @@ vars: ansible_connection: ansible.netcommon.network_cli ansible_network_single_user_mode: true - connection: "{{ cli }}" |