Merge pull request #4822 from GGabriele/fix_feature

Fixing nxos_feature
reviewable/pr18780/r1
Peter Sprygada 8 years ago committed by GitHub
commit a7dee0d08d

@ -326,18 +326,23 @@ def apply_key_map(key_map, table):
def get_available_features(feature, module): def get_available_features(feature, module):
available_features = {} available_features = {}
feature_regex = '(?P<feature>\S+)\s+\d+\s+(?P<state>.*)'
command = 'show feature' command = 'show feature'
body = execute_show_command(command, module)
try: body = execute_show_command(command, module, command_type='cli_show_ascii')
body = body[0]['TABLE_cfcFeatureCtrlTable']['ROW_cfcFeatureCtrlTable'] split_body = body[0].splitlines()
except (TypeError, IndexError):
return available_features
for each_feature in body: for line in split_body:
feature = each_feature['cfcFeatureCtrlName2'] try:
state = each_feature['cfcFeatureCtrlOpStatus2'] match_feature = re.match(feature_regex, line, re.DOTALL)
feature_group = match_feature.groupdict()
feature = feature_group['feature']
state = feature_group['state']
except AttributeError:
feature = ''
state = ''
if feature and state:
if 'enabled' in state: if 'enabled' in state:
state = 'enabled' state = 'enabled'
@ -351,9 +356,9 @@ def get_available_features(feature, module):
return available_features return available_features
def get_commands(proposed, existing, state, module): def get_commands(proposed, existing, state, module):
feature = validate_feature(module, mode='config') feature = validate_feature(module, mode='config')
commands = [] commands = []
feature_check = proposed == existing feature_check = proposed == existing
if not feature_check: if not feature_check:

Loading…
Cancel
Save