summaryrefslogtreecommitdiff
path: root/test/integration/targets/eos_config/tests/cli/sublevel_strict_mul_parents.yaml
blob: 4db54724cf7d9962a21a5f1c536e83ef6ae80335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
- debug:
    msg: "START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}"

- name: setup
  eos_config:
    lines:
      - class-map type qos match-any c1
      - match ip access-group 10
      - policy-map type qos p1
      - class c1
    before: ['no policy-map type qos p1', 'no class-map type qos match-any c1']
    match: none
  become: yes

- block:
  - name: configure sub level command using strict match
    eos_config:
      lines:
        - set cos 1
        - set dscp 62
      parents: ['policy-map type qos p1', 'class c1']
      match: strict
      # session-config diffs does not produce a diff here for some reason.
      # check against running-config instead.
      diff_against: running
    register: result
    become: yes

  - assert:
      that:
        - "result.changed == true"
        - "'set cos 1' in result.updates"
        - "'set dscp 62' in result.updates"

  - name: change sub level command order and config with strict match
    eos_config:
      lines:
        - set dscp 62
        - set cos 1
      parents: ['policy-map type qos p1', 'class c1']
      match: strict
      diff_against: running
    register: result
    become: yes

  - assert:
      that:
        - "result.changed == true"
        - "'set cos 1' in result.updates"
        - "'set dscp 62' in result.updates"

  - name: Config sub level command with strict match (Idempotency)
    eos_config:
      lines:
        #EOS does not change order of class action if reconfigured
        #so we have to use old order for Idempotency
        - set cos 1
        - set dscp 62
      parents: ['policy-map type qos p1', 'class c1']
      match: strict
      diff_against: running
    register: result
    become: yes

  - assert:
      that:
        - "result.changed == false"

  always:
  - name: teardown
    eos_config:
      lines:
        - no policy-map type qos p1
        - no class-map type qos match-any c1
      match: none
    become: yes

- debug: msg="END cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}"