diff --git a/lib/ansible/modules/network/nxos/nxos_logging.py b/lib/ansible/modules/network/nxos/nxos_logging.py index 0ac3d812e1d..69533574f64 100644 --- a/lib/ansible/modules/network/nxos/nxos_logging.py +++ b/lib/ansible/modules/network/nxos/nxos_logging.py @@ -74,7 +74,7 @@ options: - Link/trunk enable/default interface configuration logging choices: ['link-enable', 'link-default', 'trunk-enable', 'trunk-default'] version_added: '2.8' - message: + interface_message: description: - Add interface description to interface syslogs. Does not work with version 6.0 images using nxapi as a transport. @@ -163,7 +163,7 @@ EXAMPLES = """ state: present - name: Configure logging message ethernet description nxos_logging: - message: add-interface-description + interface_message: add-interface-description state: present - name: Configure logging event link enable nxos_logging: @@ -679,7 +679,7 @@ def map_params_to_obj(module): 'state': module.params['state'], 'facility_link_status': module.params['facility_link_status'], 'event': module.params['event'], - 'message': module.params['message'], + 'message': module.params['interface_message'], 'file_size': file_size, 'timestamp': module.params['timestamp'] }) @@ -728,7 +728,7 @@ def main(): interface=dict(), facility_link_status=dict(choices=['link-down-notif', 'link-down-error', 'link-up-notif', 'link-up-error']), event=dict(choices=['link-enable', 'link-default', 'trunk-enable', 'trunk-default']), - message=dict(choices=['add-interface-description']), + interface_message=dict(choices=['add-interface-description']), file_size=dict(type='int'), timestamp=dict(choices=['microseconds', 'milliseconds', 'seconds']), state=dict(default='present', choices=['present', 'absent']), diff --git a/test/integration/targets/nxos_logging/tasks/main.yaml b/test/integration/targets/nxos_logging/tasks/main.yaml index 4b0f8c64d90..f6c7fec17e6 100644 --- a/test/integration/targets/nxos_logging/tasks/main.yaml +++ b/test/integration/targets/nxos_logging/tasks/main.yaml @@ -1,3 +1,13 @@ --- -- { include: cli.yaml, tags: ['cli'] } -- { include: nxapi.yaml, tags: ['nxapi'] } +# Use block to ensure that the baude rate gets set +# back to 9600 even if there are failures or errors. +- block: + - { include: cli.yaml, tags: ['cli'] } + - { include: nxapi.yaml, tags: ['nxapi'] } + always: + - name: Set Baud Rate Back to 9600 so our tests don't break + nxos_config: + lines: + - speed 9600 + parents: line console + connection: network_cli diff --git a/test/integration/targets/nxos_logging/tests/common/basic.yaml b/test/integration/targets/nxos_logging/tests/common/basic.yaml index 13f157a6ce5..d1eb548fc3e 100644 --- a/test/integration/targets/nxos_logging/tests/common/basic.yaml +++ b/test/integration/targets/nxos_logging/tests/common/basic.yaml @@ -3,6 +3,15 @@ - debug: msg="Using provider={{ connection.transport }}" when: ansible_connection == "local" +# This task is needed to clear out any previous logfile +# size settings. +- name: Workaround to clear logging logfile size + nxos_config: + lines: + - logging logfile test 1 size 4194304 + provider: "{{ connection }}" + ignore_errors: yes + - name: Purge logging configuration first nxos_logging: purge: true @@ -51,7 +60,7 @@ - name: Set Baud Rate to less than 38400 nxos_config: lines: - - speed 9600 + - speed 19200 parents: line console provider: "{{ connection }}" @@ -263,7 +272,7 @@ - block: - name: Configure Logging message nxos_logging: &logm - message: add-interface-description + interface_message: add-interface-description state: present provider: "{{ connection }}" register: result @@ -280,7 +289,7 @@ - name: Remove Logging message nxos_logging: - message: add-interface-description + interface_message: add-interface-description state: absent provider: "{{ connection }}" register: result