summaryrefslogtreecommitdiff
path: root/test/integration/targets/vyos_lldp_interface/tests/cli/basic.yaml
blob: e91091b4171f54bcd15ea115e1539751d0b9f0d9 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"

- name: Make sure LLDP is not running before tests
  vyos.vyos.vyos_config:
    lines: delete service lldp

- name: Create LLDP configuration
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: present
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"set service lldp interface eth1" in result.commands'

- name: Create LLDP configuration again (idempotent)
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: present
  register: result

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

- name: Disable LLDP configuration
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: disabled
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"set service lldp interface eth1 disable" in result.commands'

- name: Disable LLDP configuration again (idempotent)
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: disabled
  register: result

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

- name: Enable LLDP configuration
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: enabled
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"delete service lldp interface eth1 disable" in result.commands'

- name: Enable LLDP configuration again (idempotent)
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: enabled
  register: result

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

- name: Delete LLDP configuration
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: absent
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"delete service lldp interface eth1" in result.commands'

- name: Delete LLDP configuration again (idempotent)
  vyos.vyos.vyos_lldp_interface:
    name: eth1
    state: absent
  register: result

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

- name: Create aggregate of LLDP interface configurations
  vyos.vyos.vyos_lldp_interface:
    aggregate:
    - name: eth1
    - name: eth2
    state: present
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"set service lldp interface eth1" in result.commands'
      - '"set service lldp interface eth2" in result.commands'

- name: Create aggregate of LLDP interface configurations again (idempotent)
  vyos.vyos.vyos_lldp_interface:
    aggregate:
    - name: eth1
    - name: eth2
    state: present
  register: result

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

- name: Override LLDP interface configuration on aggregate
  vyos.vyos.vyos_lldp_interface:
    aggregate:
    - name: eth1
    - { name: eth2, state: disabled }
    state: present
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"set service lldp interface eth2 disable" in result.commands'

- name: Override LLDP interface configuration on aggregate again (idempotent)
  vyos.vyos.vyos_lldp_interface:
    aggregate:
    - name: eth1
    - { name: eth2, state: disabled }
    state: present
  register: result

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

- name: Delete aggregate of LLDP interface configurations
  vyos.vyos.vyos_lldp_interface:
    aggregate:
    - name: eth1
    - name: eth2
    state: absent
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"delete service lldp interface eth1" in result.commands'
      - '"delete service lldp interface eth2" in result.commands'

- name: Delete aggregate of LLDP interface configurations (idempotent)
  vyos.vyos.vyos_lldp_interface:
    aggregate:
    - name: eth1
    - name: eth2
    state: absent
  register: result

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