mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-01 19:02:49 +00:00
eos_config: Fix test issues (#56180)
* Alter tests to pass * Change diff_against to make changed work again * Add another diff_against * Expose supports_sessions across all EOS connection types * Change session warning to failure * supports_sessions needs to be a method to survive the rpc boundary * Alter tests to match
This commit is contained in:
committed by
Sumit Jaiswal
parent
a7bf728555
commit
0bead3672f
@@ -1,5 +1,6 @@
|
||||
---
|
||||
- debug: msg="START cli/check_mode.yaml on connection={{ ansible_connection }}"
|
||||
- debug:
|
||||
msg: "START cli/check_mode.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: invalid configuration in check mode
|
||||
eos_config:
|
||||
@@ -39,11 +40,28 @@
|
||||
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:
|
||||
@@ -60,6 +78,7 @@
|
||||
lines:
|
||||
- ip address 119.31.1.1 255.255.255.255
|
||||
parents: interface Loopback911
|
||||
diff_against: running
|
||||
become: yes
|
||||
check_mode: yes
|
||||
register: result
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
- debug: msg="START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}"
|
||||
- debug:
|
||||
msg: "START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
- name: setup
|
||||
eos_config:
|
||||
@@ -12,60 +13,67 @@
|
||||
match: none
|
||||
become: yes
|
||||
|
||||
- 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
|
||||
register: result
|
||||
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"
|
||||
- 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
|
||||
register: result
|
||||
become: yes
|
||||
- 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"
|
||||
- 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
|
||||
register: result
|
||||
become: yes
|
||||
- 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"
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown
|
||||
eos_config:
|
||||
lines:
|
||||
- no policy-map type qos p1
|
||||
- no class-map type qos match-any c1
|
||||
match: none
|
||||
become: yes
|
||||
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 }}"
|
||||
|
||||
Reference in New Issue
Block a user