Add feature mappings

This commit is contained in:
GGabriele 2016-09-19 18:50:05 +02:00 committed by Matt Clay
parent 25375f1057
commit c47fd4b3e9

View file

@ -774,6 +774,15 @@ def execute_config_command(commands, module):
clie = get_exception()
module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands)
except AttributeError:
try:
commands.insert(0, 'configure')
module.cli.add_commands(commands, output='config')
module.cli.run_commands()
except ShellError:
clie = get_exception()
module.fail_json(msg='Error sending CLI commands',
error=str(clie), commands=commands)
def get_cli_body_ssh(command, response, module):
@ -890,11 +899,30 @@ def validate_feature(module, mode='show'):
feature_to_be_mapped = {
'show': {
'nv overlay': 'nve',
'vn-segment-vlan-based': 'vnseg_vlan'},
'vn-segment-vlan-based': 'vnseg_vlan',
'hsrp': 'hsrp_engine',
'fabric multicast': 'fabric_mcast',
'scp-server': 'scpServer',
'sftp-server': 'sftpServer',
'sla responder': 'sla_responder',
'sla sender': 'sla_sender',
'ssh': 'sshServer',
'tacacs+': 'tacacs',
'telnet': 'telnetServer'},
'config':
{
'nve': 'nv overlay',
'vnseg_vlan': 'vn-segment-vlan-based'}
'vnseg_vlan': 'vn-segment-vlan-based',
'hsrp_engine': 'hsrp',
'fabric_mcast': 'fabric multicast',
'scpServer': 'scp-server',
'sftpServer': 'sftp-server',
'sla_sender': 'sla sender',
'sla_responder': 'sla responder',
'sshServer': 'ssh',
'tacacs': 'tacacs+',
'telnetServer': 'telnet',
}
}
if feature in feature_to_be_mapped[mode]:
@ -941,6 +969,8 @@ def main():
updated_features = get_available_features(feature, module)
existstate = updated_features[feature]
end_state = dict(state=existstate)
if 'configure' in cmds:
cmds.pop(0)
results = {}
results['proposed'] = proposed