From 169b722d73068dbc53aa8c585706ac8ad8b62f25 Mon Sep 17 00:00:00 2001 From: GGabriele Date: Mon, 19 Sep 2016 18:50:05 +0200 Subject: [PATCH] Add feature mappings --- network/nxos/nxos_feature.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/network/nxos/nxos_feature.py b/network/nxos/nxos_feature.py index b487f6cae37..8b9b831deb1 100644 --- a/network/nxos/nxos_feature.py +++ b/network/nxos/nxos_feature.py @@ -247,6 +247,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): @@ -381,11 +390,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]: @@ -434,6 +462,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