nxos_bgp_neighbor_af fix problem with advertise-map properties (#28413)

* Fix problem with advertise-map properties

* Change limit_to back to run all tests

* Fix unit tests

* Move advertise_map out of get_custom_value
This commit is contained in:
Mike Wiebe 2017-08-21 15:28:02 -04:00 committed by Nathaniel Case
commit ec11cd2696
11 changed files with 283 additions and 23 deletions

View file

@ -304,8 +304,8 @@ PARAM_TO_COMMAND_KEYMAP = {
'neighbor': 'neighbor',
'additional_paths_receive': 'capability additional-paths receive',
'additional_paths_send': 'capability additional-paths send',
'advertise_map_exist': 'advertise-map exist',
'advertise_map_non_exist': 'advertise-map non-exist',
'advertise_map_exist': 'advertise-map exist-map',
'advertise_map_non_exist': 'advertise-map non-exist-map',
'allowas_in': 'allowas-in',
'allowas_in_max': 'allowas-in',
'as_override': 'as-override',
@ -339,8 +339,6 @@ def get_value(arg, config, module):
custom = [
'additional_paths_send',
'additional_paths_receive',
'advertise_map_exist',
'advertise_map_non_exist',
'max_prefix_limit',
'max_prefix_interval',
'max_prefix_threshold',
@ -366,6 +364,12 @@ def get_value(arg, config, module):
if has_command:
value = True
elif command.startswith('advertise-map'):
value = []
has_adv_map = re.search(r'{0}\s(?P<value1>.*)\s{1}\s(?P<value2>.*)$'.format(*command.split()), config, re.M)
if has_adv_map:
value = list(has_adv_map.groups())
elif command.split()[0] in ['filter-list', 'prefix-list', 'route-map']:
has_cmd_direction_val = re.search(r'{0}\s(?P<value>.*)\s{1}$'.format(*command.split()), config, re.M)
if has_cmd_direction_val:
@ -401,22 +405,6 @@ def get_custom_value(arg, config, module):
value = 'disable'
else:
value = 'enable'
elif arg == 'advertise_map_exist':
value = []
for line in splitted_config:
if 'advertise-map' in line and 'exist-map' in line:
splitted_line = line.split()
value = [splitted_line[1], splitted_line[3]]
elif command == 'advertise-map':
value = []
exclude = 'non_exist' in arg
for line in splitted_config:
if 'advertise-map' in line and (
(exclude and 'non-exist-map' in line) or
(not exclude and 'exist-map' in line)
):
splitted_line = line.split()
value = [splitted_line[1], splitted_line[3]]
elif arg.startswith('max_prefix'):
for line in splitted_config:
if 'maximum-prefix' in line: