-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nxos_hsrp: fix 'sh_preempt': <unknown enum:> #52858
Conversation
Some older nxos images fail to set this attr value. This fix checks for unknown enum and issues a second (unstructured) call to the device to get the data.
The test
|
'sh_preempt' is currently the only attr affected. Add checks for other attrs as needed. | ||
''' | ||
if 'unknown enum:' in hsrp_table['sh_preempt']: | ||
cmd = {'output': 'text', 'command': command.split('|')[0]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does nxapi fail as well?
Does the command error out with structured json output? Or is it just for a specific key?
If the command fails for json request:
We actually have the logic already implemented in module_utils https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/nxos/nxos.py#L164.
When check_rc
is set to retry_json
, run_commands will send the command the request with non structured format if json fails.
You will just need to append the error string to if it is any different than Invalid Command
or Ambiguous Command
https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/network/nxos/nxos.py#L170
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this fails for nxapi as well.
The show command is successful with structured, it is only the sh_preempt
key that is faulty.
[{u'TABLE_grp_detail': {u'ROW_grp_detail': {u'sh_active_router_addr': u'0.0.0.0',
u'sh_group_num': u'100', u'sh_authentication_data': u'1234', u'sh_cur_hold_attr': u'sec',
u'sh_ip_redund_name_attr': u'Default', u'sh_prio': u'25', u'sh_standby_router_addr': u'0.0.0.0',
u'sh_vmac_attr': u'Default MAC', u'sh_cur_hello_attr': u'sec', u'sh_vip': u'192.0.2.2',
u'sh_cur_hello': u'3', u'sh_vip_attr': u'config', u'sh_keystring_attr': u'unencrypted',
u'sh_num_track_obj': u'0', u'sh_active_router_prio': u'0', u'sh_num_of_total_state_changes': u'0',
u'sh_cfg_prio': u'25', u'sh_if_index': u'Ethernet1/1', u'sh_can_forward': u'unknown enum:<411125249>',
u'sh_group_type': u'v4', u'sh_fwd_upper_threshold': u'25', u'sh_group_state': u'Initial',
u'sh_cur_hold': u'10', u'sh_standby_router_prio': u'0', u'sh_fwd_lower_threshold': u'0', u'sh_group_version': u'v2',
u'sh_preempt': u'unknown enum:<808728065>', <-------------<< *****
u'sh_vmac': u'0000.0c9f.f064', u'sh_ip_redund_name': u'hsrp-Eth1/1-100', 'sh_num_of_state_changes':
u'0', u'sh_authentication_type': u'md5', u'sh_state_reason': u'(Interface Down)'}}}]
* nxos_hsrp: fix 'sh_preempt': <unknown enum:> Some older nxos images fail to set this attr value. This fix checks for unknown enum and issues a second (unstructured) call to the device to get the data. * add whitespace for pep8 (cherry picked from commit 5dc65d0)
* nxos_hsrp: fix 'sh_preempt': <unknown enum:> Some older nxos images fail to set this attr value. This fix checks for unknown enum and issues a second (unstructured) call to the device to get the data. * add whitespace for pep8 (cherry picked from commit 5dc65d0)
SUMMARY
Some older nxos images fail to set this attr value. This fix checks for unknown enum and issues a second (unstructured) call to the device to get the data.
ISSUE TYPE
COMPONENT NAME
network/nxos/nxos_hsrp
ADDITIONAL INFORMATION
Issue seen with N9000 NXOS version 7.0(3)I7(4).
The
nxos_hsrp/tests/common/sanity.yaml
test will fail with idempotency issues.The output from the defective image will display
show hsrp group 100 all | json
as shown:sh_preempt
is the only affected attr but I've written the fix to allow for additional attrs as needed.nxos_hsrp
tests are now 100% pass rate with this fix.