ansible/test/integration/targets/iosxr_logging/tests/cli/basic.yaml

120 lines
2.5 KiB
YAML
Raw Normal View History

---
# 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
- name: Remove console logging
iosxr_logging:
dest: console
level: warning
state: absent
register: result
- name: Remove buffer
iosxr_logging:
dest: buffered
size: 4800000
state: absent
register: result
# Start tests
- name: Set up host logging
iosxr_logging:
dest: hostnameprefix
name: 172.16.0.1
state: present
register: result
- assert:
that:
- 'result.changed == true'
- '"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
register: result
- assert:
that:
- 'result.changed == false'
- name: Delete/disable host logging
iosxr_logging:
dest: hostnameprefix
name: 172.16.0.1
state: absent
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
register: result
- assert:
that:
- 'result.changed == false'
- name: Console logging with level warning
iosxr_logging:
dest: console
level: warning
state: present
register: result
- assert:
that:
- 'result.changed == true'
- '"logging console warning" in result.commands'
- name: Configure Buffer size
iosxr_logging:
dest: buffered
size: 4800000
register: result
- assert:
that:
- 'result.changed == true'
- '"logging buffered 4800000" in result.commands'
- name: Change logging parameters using aggregate
iosxr_logging:
aggregate:
- { dest: console, level: notifications }
- { dest: buffered, size: 4700000 }
register: result
- assert:
that:
- 'result.changed == true'
- '"logging buffered 4700000" in result.commands'
- '"logging console notifications" in result.commands'
- name: remove logging as collection tearDown
iosxr_logging:
aggregate:
- { dest: console, level: notifications }
- { dest: buffered, size: 4700000 }
state: absent
register: result
- assert:
that:
- 'result.changed == true'
- '"no logging console" in result.commands'
- '"no logging buffered" in result.commands'