cisco.nxos icon indicating copy to clipboard operation
cisco.nxos copied to clipboard

nxos_logging_global: Ethernet-port-channel facility for state 'replaced' and 'deleted' fails on MDS

Open srbharadwaj opened this issue 2 years ago • 4 comments

SUMMARY

On MDS switches when we pass facility: ethernet-port-channel and state as replaced or deleted, it is sending the wrong cmd to the switch, it sends "logging level eth_port_channel 0" when it should actually send "logging level ethernet-port-channel 0"

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nxos_logging_global

ANSIBLE VERSION

latest

COLLECTION VERSION

latest

STEPS TO REPRODUCE
  tasks:
        
             - name: facility checking
               cisco.nxos.nxos_logging_global:
                 config:
                    facilities:
                        - facility: ethernet-port-channel
                          severity: emergency
                 state: deleted

srbharadwaj avatar Apr 26 '22 08:04 srbharadwaj

@srbharadwaj This is not reproducible for me with any of the states. In fact, strangely enough there's no logic in the code that converts "-" to "_" for the facilities (https://github.com/ansible-collections/cisco.nxos/blob/main/plugins/module_utils/network/nxos/rm_templates/logging_global.py#L262).

The other thing is, as the example states, granular deletion is not supported for this module with state: deleted. Since resource modules revolve around a source-of-truth approach, the ideal way to remove a single config line is to remove the corresponding entry from the task input (or SoT) and run the task with states replaced or overridden. The state deleted would always remove all the existing config line (or reset to default) from the target.

Could you please share the ansible-core version and the python version you're running? The existing on-box config (output of show running-config | include logging) would also be helpful. Is it only happening with state: replaced and state: deleted? Does state: rendered work fine with the same task input?

NilashishC avatar Apr 26 '22 11:04 NilashishC

Yes issue is seen only during deletion and replace, its not seen when using rendered This could be because show running-config | include logging has the o/p as "eth_port_channel" and the same thing is used during deletion/replace etc..

sw108-Alishan(config)# sh running-config | i logg
logging level eth_port_channel 0
sw108-Alishan(config)# 
ansible_cisco.nxos.nxos_logging_global_payload_swt2wpn7/ansible_cisco.nxos.nxos_logging_global_payload.zip/ansible/module_utils/connection.py\", line 200, in __rpc__\nansible.module_utils.connection.ConnectionError: no logging level eth_port_channel 0\r\r\n                                           ^\r\n% Invalid command at '^' marker.\r\n\rsw108-Alishan(config)# \n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

so i guess you need to do a mapping b/n show/config like we had for other modules before

srbharadwaj avatar Apr 26 '22 12:04 srbharadwaj

@srbharadwaj Oh I see, so the command to configure and remove is (no) logging level ethernet-port-channel 0 but it appears as logging level eth_port_channel 0 in running-config? Are there other facilities with the same behaviour?

This facility doesn't seem to be valid for N9Kv and so this was missed.

NilashishC avatar Apr 26 '22 14:04 NilashishC

okay, i have not come across any other facility like that. Check with Mike on which platform ether port-channel is supported, on those platforms this facility might be enabled.

srbharadwaj avatar Apr 26 '22 17:04 srbharadwaj