|
|
|
@ -73,13 +73,10 @@ import re
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
|
from ansible.module_utils.network.nxos.nxos import load_config, run_commands
|
|
|
|
|
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
|
|
|
|
|
from ansible.module_utils.network.nxos.nxos import check_args as nxos_check_args
|
|
|
|
|
from ansible.module_utils.network.nxos.nxos import get_capabilities, nxos_argument_spec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_args(module, warnings):
|
|
|
|
|
nxos_check_args(module, warnings)
|
|
|
|
|
|
|
|
|
|
for key in ('include_defaults', 'config', 'save'):
|
|
|
|
|
if module.params[key] is not None:
|
|
|
|
|
warnings.append('argument %s is no longer supported, ignoring value' % key)
|
|
|
|
@ -139,39 +136,73 @@ def validate_feature(module, mode='show'):
|
|
|
|
|
how they are configured'''
|
|
|
|
|
|
|
|
|
|
feature = module.params['feature']
|
|
|
|
|
|
|
|
|
|
feature_to_be_mapped = {
|
|
|
|
|
'show': {
|
|
|
|
|
'nv overlay': 'nve',
|
|
|
|
|
'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',
|
|
|
|
|
'ethernet-link-oam': 'elo',
|
|
|
|
|
'port-security': 'eth_port_sec'
|
|
|
|
|
},
|
|
|
|
|
'config': {
|
|
|
|
|
'nve': 'nv overlay',
|
|
|
|
|
'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',
|
|
|
|
|
'elo': 'ethernet-link-oam',
|
|
|
|
|
'eth_port_sec': 'port-security'
|
|
|
|
|
info = get_capabilities(module).get('device_info', {})
|
|
|
|
|
os_version = info.get('network_os_version', '')
|
|
|
|
|
|
|
|
|
|
if '8.1' in os_version:
|
|
|
|
|
feature_to_be_mapped = {
|
|
|
|
|
'show': {
|
|
|
|
|
'nv overlay': 'nve',
|
|
|
|
|
'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',
|
|
|
|
|
'ethernet-link-oam': 'elo'
|
|
|
|
|
},
|
|
|
|
|
'config': {
|
|
|
|
|
'nve': 'nv overlay',
|
|
|
|
|
'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',
|
|
|
|
|
'elo': 'ethernet-link-oam'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else:
|
|
|
|
|
feature_to_be_mapped = {
|
|
|
|
|
'show': {
|
|
|
|
|
'nv overlay': 'nve',
|
|
|
|
|
'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',
|
|
|
|
|
'ethernet-link-oam': 'elo',
|
|
|
|
|
'port-security': 'eth_port_sec'
|
|
|
|
|
},
|
|
|
|
|
'config': {
|
|
|
|
|
'nve': 'nv overlay',
|
|
|
|
|
'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',
|
|
|
|
|
'elo': 'ethernet-link-oam',
|
|
|
|
|
'eth_port_sec': 'port-security'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if feature in feature_to_be_mapped[mode]:
|
|
|
|
|
feature = feature_to_be_mapped[mode][feature]
|
|
|
|
|