2017-07-17 13:50:22 +02:00
|
|
|
---
|
2017-07-28 16:37:34 +02:00
|
|
|
# Remove old logging entries so that they don't conflict with tests
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: remove host logging
|
2017-07-28 16:37:34 +02:00
|
|
|
iosxr_logging:
|
2018-01-11 05:38:11 +01:00
|
|
|
dest: host
|
2017-07-28 16:37:34 +02:00
|
|
|
name: 172.16.0.1
|
|
|
|
state: absent
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-28 16:37:34 +02:00
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: remove console logging
|
2017-07-28 16:37:34 +02:00
|
|
|
iosxr_logging:
|
|
|
|
dest: console
|
|
|
|
state: absent
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-28 16:37:34 +02:00
|
|
|
register: result
|
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: remove buffered logging
|
2017-07-28 16:37:34 +02:00
|
|
|
iosxr_logging:
|
|
|
|
dest: buffered
|
2018-01-11 05:38:11 +01:00
|
|
|
size: 2097155
|
2017-07-28 16:37:34 +02:00
|
|
|
state: absent
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-28 16:37:34 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
# Start tests
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: set up syslog host logging
|
|
|
|
iosxr_logging: &addhostlog
|
|
|
|
dest: host
|
2017-07-17 13:50:22 +02:00
|
|
|
name: 172.16.0.1
|
2018-01-11 05:38:11 +01:00
|
|
|
level: errors
|
2017-07-17 13:50:22 +02:00
|
|
|
state: present
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2017-07-28 16:37:34 +02:00
|
|
|
- 'result.changed == true'
|
2018-01-11 05:38:11 +01:00
|
|
|
- '"logging 172.16.0.1 vrf default severity error" in result.commands'
|
2017-07-17 13:50:22 +02:00
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: set up syslog host logging (idempotent)
|
|
|
|
iosxr_logging: *addhostlog
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- assert: &false
|
2017-07-17 13:50:22 +02:00
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: delete/disable syslog host logging
|
|
|
|
iosxr_logging: &delhostlog
|
|
|
|
dest: host
|
2017-07-17 13:50:22 +02:00
|
|
|
name: 172.16.0.1
|
|
|
|
state: absent
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2018-01-11 05:38:11 +01:00
|
|
|
- '"no logging 172.16.0.1 vrf default" in result.commands'
|
2017-07-17 13:50:22 +02:00
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: delete/disable syslog host logging (idempotent)
|
|
|
|
iosxr_logging: *delhostlog
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- assert: *false
|
2017-07-17 13:50:22 +02:00
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: add console logging with level warning
|
|
|
|
iosxr_logging: &consolelog
|
2017-07-17 13:50:22 +02:00
|
|
|
dest: console
|
2017-07-28 16:37:34 +02:00
|
|
|
level: warning
|
2017-07-17 13:50:22 +02:00
|
|
|
state: present
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-07-28 16:37:34 +02:00
|
|
|
- '"logging console warning" in result.commands'
|
2017-07-17 13:50:22 +02:00
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: console logging with level warning (idempotent)
|
|
|
|
iosxr_logging: *consolelog
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: remove console logging with level warning
|
|
|
|
iosxr_logging:
|
|
|
|
dest: console
|
|
|
|
level: warning
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
|
|
|
|
- name: configure buffered logging size
|
|
|
|
iosxr_logging: &bufferlog
|
2017-07-17 13:50:22 +02:00
|
|
|
dest: buffered
|
|
|
|
size: 4800000
|
2018-01-11 05:38:11 +01:00
|
|
|
state: present
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging buffered 4800000" in result.commands'
|
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: configure buffered logging size (idempotence)
|
|
|
|
iosxr_logging: *bufferlog
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: remove buffered logging size
|
|
|
|
iosxr_logging:
|
|
|
|
dest: buffered
|
|
|
|
size: 4800000
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: change logging parameters using aggregate
|
2017-08-18 06:20:35 +02:00
|
|
|
iosxr_logging:
|
|
|
|
aggregate:
|
|
|
|
- { dest: console, level: notifications }
|
|
|
|
- { dest: buffered, size: 4700000 }
|
2018-01-11 05:38:11 +01:00
|
|
|
state: present
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-08-18 06:20:35 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging buffered 4700000" in result.commands'
|
|
|
|
- '"logging console notifications" in result.commands'
|
|
|
|
|
2018-01-11 05:38:11 +01:00
|
|
|
- name: remove logging parameters using aggregate
|
2017-07-17 13:50:22 +02:00
|
|
|
iosxr_logging:
|
|
|
|
aggregate:
|
2017-08-18 06:20:35 +02:00
|
|
|
- { dest: console, level: notifications }
|
|
|
|
- { dest: buffered, size: 4700000 }
|
|
|
|
state: absent
|
2017-12-06 18:07:31 +01:00
|
|
|
provider: "{{ cli }}"
|
2017-07-17 13:50:22 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"no logging console" in result.commands'
|
|
|
|
- '"no logging buffered" in result.commands'
|