diff --git a/lib/ansible/modules/network/nxos/nxos_bgp_af.py b/lib/ansible/modules/network/nxos/nxos_bgp_af.py index c92c4607f6..8b82653546 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp_af.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp_af.py @@ -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\w+)\s(?P\w+)\s(?P\w+)'