2017-07-17 11:50:22 +00:00
|
|
|
---
|
2017-07-28 14:37:34 +00: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 11:50:22 +00: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 14:37:34 +00:00
|
|
|
- 'result.changed == true'
|
2017-07-17 11:50:22 +00: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 14:37:34 +00:00
|
|
|
- name: Console logging with level warning
|
2017-07-17 11:50:22 +00:00
|
|
|
iosxr_logging:
|
|
|
|
dest: console
|
2017-07-28 14:37:34 +00:00
|
|
|
level: warning
|
2017-07-17 11:50:22 +00:00
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-07-28 14:37:34 +00:00
|
|
|
- '"logging console warning" in result.commands'
|
2017-07-17 11:50:22 +00: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'
|
|
|
|
|
|
|
|
- name: remove logging as collection tearDown
|
|
|
|
iosxr_logging:
|
|
|
|
aggregate:
|
2017-07-28 14:37:34 +00:00
|
|
|
- { dest: console, level: warning, state: absent }
|
2017-07-17 11:50:22 +00:00
|
|
|
- { dest: buffered, size: 4800000, state: absent }
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"no logging console" in result.commands'
|
|
|
|
- '"no logging buffered" in result.commands'
|