nxos_bgp_neighbor fixes (#27348)
* Fix `timers` idempotency * `shutdown` is not documented as having a `default` option * dynamic_capability is the inverse of BOOL_PARAMS
This commit is contained in:
parent
27a015f0ad
commit
123b5e222f
1 changed files with 12 additions and 11 deletions
|
@ -198,7 +198,6 @@ EXAMPLES = '''
|
||||||
remote_as: 30
|
remote_as: 30
|
||||||
description: "just a description"
|
description: "just a description"
|
||||||
update_source: Ethernet1/3
|
update_source: Ethernet1/3
|
||||||
shutdown: default
|
|
||||||
state: present
|
state: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -266,13 +265,15 @@ def get_value(arg, config):
|
||||||
has_command = re.search(r'\s+{0}\s*$'.format(command), config, re.M)
|
has_command = re.search(r'\s+{0}\s*$'.format(command), config, re.M)
|
||||||
has_command_value = re.search(r'(?:{0}\s)(?P<value>.*)$'.format(command), config, re.M)
|
has_command_value = re.search(r'(?:{0}\s)(?P<value>.*)$'.format(command), config, re.M)
|
||||||
|
|
||||||
if arg in BOOL_PARAMS:
|
if arg == 'dynamic_capability':
|
||||||
|
has_no_command = re.search(r'\s+no\s{0}\s*$'.format(command), config, re.M)
|
||||||
|
value = True
|
||||||
|
if has_no_command:
|
||||||
|
value = False
|
||||||
|
elif arg in BOOL_PARAMS:
|
||||||
value = False
|
value = False
|
||||||
try:
|
|
||||||
if has_command:
|
if has_command:
|
||||||
value = True
|
value = True
|
||||||
except TypeError:
|
|
||||||
value = False
|
|
||||||
elif arg == 'log_neighbor_changes':
|
elif arg == 'log_neighbor_changes':
|
||||||
value = ''
|
value = ''
|
||||||
if has_command:
|
if has_command:
|
||||||
|
@ -389,10 +390,10 @@ def state_present(module, existing, proposed, candidate):
|
||||||
else:
|
else:
|
||||||
command = '{0} {1}'.format(key, value)
|
command = '{0} {1}'.format(key, value)
|
||||||
commands.append(command)
|
commands.append(command)
|
||||||
elif key.startswith('timers'):
|
elif key == 'timers':
|
||||||
command = 'timers {0} {1}'.format(
|
command = 'timers {0} {1}'.format(
|
||||||
proposed_commands['timers-keepalive'],
|
proposed['timers_keepalive'],
|
||||||
proposed_commands['timers-holdtime'])
|
proposed['timers_holdtime'])
|
||||||
if command not in commands:
|
if command not in commands:
|
||||||
commands.append(command)
|
commands.append(command)
|
||||||
else:
|
else:
|
||||||
|
@ -442,7 +443,7 @@ def main():
|
||||||
pwd_type=dict(required=False, type='str', choices=['cleartext', '3des', 'cisco_type_7', 'default']),
|
pwd_type=dict(required=False, type='str', choices=['cleartext', '3des', 'cisco_type_7', 'default']),
|
||||||
remote_as=dict(required=False, type='str'),
|
remote_as=dict(required=False, type='str'),
|
||||||
remove_private_as=dict(required=False, type='str', choices=['enable', 'disable', 'all', 'replace-as']),
|
remove_private_as=dict(required=False, type='str', choices=['enable', 'disable', 'all', 'replace-as']),
|
||||||
shutdown=dict(required=False, type='str'),
|
shutdown=dict(required=False, type='bool'),
|
||||||
suppress_4_byte_as=dict(required=False, type='bool'),
|
suppress_4_byte_as=dict(required=False, type='bool'),
|
||||||
timers_keepalive=dict(required=False, type='str'),
|
timers_keepalive=dict(required=False, type='str'),
|
||||||
timers_holdtime=dict(required=False, type='str'),
|
timers_holdtime=dict(required=False, type='str'),
|
||||||
|
|
Loading…
Reference in a new issue