Fix nxos_bgp_af networks parameter (#28169)

* Split 'networks' and 'redistribute' in get_value

* Add missing `'` in docs
This commit is contained in:
Nathaniel Case 2017-08-14 15:18:10 -04:00 committed by GitHub
parent 59f704c766
commit 19a6000d97

View file

@ -198,7 +198,7 @@ options:
prefixes to advertise. The list must be in the form of an array.
Each entry in the array must include a prefix address and an
optional route-map. For example [['10.0.0.0/16', 'routemap_LA'],
['192.168.1.1', 'Chicago'], ['192.168.2.0/24],
['192.168.1.1', 'Chicago'], ['192.168.2.0/24'],
['192.168.3.0/24', 'routemap_NYC']].
required: false
default: null
@ -359,7 +359,12 @@ def get_value(arg, config, module):
if inject_re.search(config):
value.append('copy_attributes')
elif arg in ['networks', 'redistribute']:
elif arg == 'networks':
value = []
for network in command_val_re.findall(config):
value.append(network.split())
elif arg == 'redistribute':
value = []
if has_command_val:
value = has_command_val.group('value').split()
@ -367,9 +372,8 @@ def get_value(arg, config, module):
if value:
if len(value) == 3:
value.pop(1)
elif arg == 'redistribute' and len(value) == 4:
value = ['{0} {1}'.format(
value[0], value[1]), value[3]]
elif len(value) == 4:
value = ['{0} {1}'.format(value[0], value[1]), value[3]]
elif command == 'distance':
distance_re = r'.*distance\s(?P<d_ebgp>\w+)\s(?P<d_ibgp>\w+)\s(?P<d_local>\w+)'