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
|
|
|
|
- name: Remove host logging
|
|
|
|
iosxr_logging:
|
|
|
|
dest: hostnameprefix
|
|
|
|
name: 172.16.0.1
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
- name: Remove console logging
|
|
|
|
iosxr_logging:
|
|
|
|
dest: console
|
|
|
|
level: warning
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Remove buffer
|
|
|
|
iosxr_logging:
|
|
|
|
dest: buffered
|
|
|
|
size: 4800000
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
# Start tests
|
2017-07-17 13:50:22 +02:00
|
|
|
- name: Set up host logging
|
|
|
|
iosxr_logging:
|
|
|
|
dest: hostnameprefix
|
|
|
|
name: 172.16.0.1
|
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2017-07-28 16:37:34 +02:00
|
|
|
- 'result.changed == true'
|
2017-07-17 13:50:22 +02:00
|
|
|
- '"logging hostnameprefix 172.16.0.1" in result.commands'
|
|
|
|
- '"logging facility local7" in result.commands'
|
|
|
|
|
|
|
|
- name: Set up host logging again (idempotent)
|
|
|
|
iosxr_logging:
|
|
|
|
dest: hostnameprefix
|
|
|
|
name: 172.16.0.1
|
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Delete/disable host logging
|
|
|
|
iosxr_logging:
|
|
|
|
dest: hostnameprefix
|
|
|
|
name: 172.16.0.1
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"no logging hostnameprefix 172.16.0.1" in result.commands'
|
|
|
|
|
|
|
|
- name: Delete/disable host logging (idempotent)
|
|
|
|
iosxr_logging:
|
|
|
|
dest: hostnameprefix
|
|
|
|
name: 172.16.0.1
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
2017-07-28 16:37:34 +02:00
|
|
|
- name: Console logging with level warning
|
2017-07-17 13:50:22 +02:00
|
|
|
iosxr_logging:
|
|
|
|
dest: console
|
2017-07-28 16:37:34 +02:00
|
|
|
level: warning
|
2017-07-17 13:50:22 +02:00
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
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
|
|
|
|
|
|
|
- name: Configure Buffer size
|
|
|
|
iosxr_logging:
|
|
|
|
dest: buffered
|
|
|
|
size: 4800000
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging buffered 4800000" in result.commands'
|
|
|
|
|
2017-08-18 06:20:35 +02:00
|
|
|
- name: Change logging parameters using aggregate
|
|
|
|
iosxr_logging:
|
|
|
|
aggregate:
|
|
|
|
- { dest: console, level: notifications }
|
|
|
|
- { dest: buffered, size: 4700000 }
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"logging buffered 4700000" in result.commands'
|
|
|
|
- '"logging console notifications" in result.commands'
|
|
|
|
|
2017-07-17 13:50:22 +02:00
|
|
|
- name: remove logging as collection tearDown
|
|
|
|
iosxr_logging:
|
|
|
|
aggregate:
|
2017-08-18 06:20:35 +02:00
|
|
|
- { dest: console, level: notifications }
|
|
|
|
- { dest: buffered, size: 4700000 }
|
|
|
|
state: absent
|
2017-07-17 13:50:22 +02:00
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"no logging console" in result.commands'
|
|
|
|
- '"no logging buffered" in result.commands'
|