ansible/test/integration/targets/iosxr_logging/tests/cli/basic.yaml
David Newswanger 3b1f2aeb16 Iosxr attribute error #27122 (#27425)
* WIP fixing iosxr_logging idempotency

* remove debug stuff from module, add teardown section to start of test
2017-07-28 20:07:34 +05:30

115 lines
2.4 KiB
YAML

---
# 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
- name: Set up host logging
iosxr_logging:
dest: hostnameprefix
name: 172.16.0.1
state: present
provider: "{{ cli }}"
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
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'
- name: Console logging with level warning
iosxr_logging:
dest: console
level: warning
state: present
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"logging console warning" in result.commands'
- 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:
- { dest: console, level: warning, state: absent }
- { 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'