mirror of https://github.com/ansible/ansible.git
New module: cnos_vlan and various utility files (#21107)
* First set of CNOS network modules Two modules: cnos_vlan and cnos_command. First 2 of 17 CNOS modules * Revert "First set of CNOS network modules" This reverts commit 63da68b2a857e622b449f514050eed25fbcf0a35. * cnos_vlan module First of 17 CNOS modules * Modify playbook for cnos_vlan module testing * fix issue found by shippable in cnos.py * cnos_backup module * Fix Python3.5 compilation error * remove cnos_backup module from this PR * add aliases file so that testing of the cnos_vlan module will be skipped. * Use empty aliases file * utility scripts under module_utils changed to BSD license. * clean up PEP8 issues, add cnos_vlan tests * remove blank lines from yml files * remove more blank lines * remove even more blank lines * Revert "remove even more blank lines" This reverts commit bb3998661ce387260340bca39d5f146f5ec54f44. * re-submit last commit * fix blank lines in this file under parsing * fix yamllint errors in doc section of cnos_vlan * Fix errors reported by Sanity check using validate-modules * change test playbook to include tasks for all modules * fix additional pep8 errors * more fixes, plus fix for python3 * fix for empty options section, removed unnecessary documentation * fix up documentation section * Correct options capitalization * fix example section, add options * Fix example section of the documentationpull/21517/head
parent
d77a6bda97
commit
dbb452100a
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,789 @@
|
|||||||
|
# This code is part of Ansible, but is an independent component.
|
||||||
|
# This particular file snippet, and this file snippet only, is BSD licensed.
|
||||||
|
# Modules you write using this snippet, which is embedded dynamically by
|
||||||
|
# Ansible still belong to the author of the module, and may assign their
|
||||||
|
# own license to the complete work.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Contains device rule and methods
|
||||||
|
# Lenovo Networking
|
||||||
|
|
||||||
|
|
||||||
|
def getRuleString(deviceType, variableId):
|
||||||
|
retVal = variableId + ":"
|
||||||
|
if(deviceType == 'g8272_cnos'):
|
||||||
|
if variableId in g8272_cnos:
|
||||||
|
retVal = retVal + g8272_cnos[variableId]
|
||||||
|
else:
|
||||||
|
retVal = "The variable " + variableId + " is not supported"
|
||||||
|
elif(deviceType == 'g8296_cnos'):
|
||||||
|
if variableId in g8296_cnos:
|
||||||
|
retVal = retVal + g8296_cnos[variableId]
|
||||||
|
else:
|
||||||
|
retVal = "The variable " + variableId + " is not supported"
|
||||||
|
elif(deviceType == 'g8332_cnos'):
|
||||||
|
if variableId in g8332_cnos:
|
||||||
|
retVal = retVal + g8332_cnos[variableId]
|
||||||
|
else:
|
||||||
|
retVal = "The variable " + variableId + " is not supported"
|
||||||
|
else:
|
||||||
|
if variableId in default_cnos:
|
||||||
|
retVal = retVal + default_cnos[variableId]
|
||||||
|
else:
|
||||||
|
retVal = "The variable " + variableId + " is not supported"
|
||||||
|
return retVal
|
||||||
|
# EOM
|
||||||
|
|
||||||
|
default_cnos = {'vlan_id': 'INTEGER_VALUE:1-3999',
|
||||||
|
'vlan_id_range': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'vlan_name': 'TEXT:',
|
||||||
|
'vlan_flood': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'vlan_state': 'TEXT_OPTIONS:active,suspend',
|
||||||
|
'vlan_last_member_query_interval': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_querier': 'IPV4Address:',
|
||||||
|
'vlan_querier_timeout': 'INTEGER_VALUE:1-65535',
|
||||||
|
'vlan_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_query_max_response_time': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_report_suppression': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_robustness_variable': 'INTEGER_VALUE:1-7',
|
||||||
|
'vlan_startup_query_count': 'INTEGER_VALUE:1-10',
|
||||||
|
'vlan_startup_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_snooping_version': 'INTEGER_VALUE:2-3',
|
||||||
|
'vlan_access_map_name': 'TEXT: ',
|
||||||
|
'vlan_ethernet_interface': 'TEXT:',
|
||||||
|
'vlan_portagg_number': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlan_accessmap_action': 'TEXT_OPTIONS:drop,forward,redirect',
|
||||||
|
'vlan_dot1q_tag': 'MATCH_TEXT_OR_EMPTY:egress-only',
|
||||||
|
'vlan_filter_name': 'TEXT:',
|
||||||
|
'vlag_auto_recovery': 'INTEGER_VALUE:240-3600',
|
||||||
|
'vlag_config_consistency': 'TEXT_OPTIONS:disable,strict',
|
||||||
|
'vlag_instance': 'INTEGER_VALUE:1-64',
|
||||||
|
'vlag_port_aggregation': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlag_priority': 'INTEGER_VALUE:0-65535',
|
||||||
|
'vlag_startup_delay': 'INTEGER_VALUE:0-3600',
|
||||||
|
'vlag_tier_id': 'INTEGER_VALUE:1-512',
|
||||||
|
'vlag_hlthchk_options': 'TEXT_OPTIONS:keepalive-attempts,\
|
||||||
|
keepalive-interval,peer-ip,retry-interval',
|
||||||
|
'vlag_keepalive_attempts': 'INTEGER_VALUE:1-24',
|
||||||
|
'vlag_keepalive_interval': 'INTEGER_VALUE:2-300',
|
||||||
|
'vlag_retry_interval': 'INTEGER_VALUE:1-300',
|
||||||
|
'vlag_peerip': 'IPV4Address:',
|
||||||
|
'vlag_peerip_vrf': 'TEXT_OPTIONS:default,management',
|
||||||
|
'bgp_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_bgp_local_count': 'INTEGER_VALUE:2-64',
|
||||||
|
'cluster_id_as_ip': 'IPV4Address:',
|
||||||
|
'cluster_id_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'confederation_identifier': 'INTEGER_VALUE:1-65535',
|
||||||
|
'condeferation_peers_as': 'INTEGER_VALUE:1-65535',
|
||||||
|
'stalepath_delay_value': 'INTEGER_VALUE:1-3600',
|
||||||
|
'maxas_limit_as': 'INTEGER_VALUE:1-2000',
|
||||||
|
'neighbor_ipaddress': 'IPV4Address:',
|
||||||
|
'neighbor_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'router_id': 'IPV4Address:',
|
||||||
|
'bgp_keepalive_interval': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_aggregate_prefix': 'IPV4AddressWithMask:',
|
||||||
|
'addrfamily_routemap_name': 'TEXT:',
|
||||||
|
'reachability_half_life': 'INTEGER_VALUE:1-45',
|
||||||
|
'start_reuse_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'start_suppress_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'max_duration_to_suppress_route': 'INTEGER_VALUE:1-255',
|
||||||
|
'unreachability_halftime_for_penalty': 'INTEGER_VALUE:1-45',
|
||||||
|
'distance_external_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_internal_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_local_routes': 'INTEGER_VALUE:1-255',
|
||||||
|
'maxpath_option': 'TEXT_OPTIONS:ebgp,ibgp',
|
||||||
|
'maxpath_numbers': 'INTEGER_VALUE:2-32',
|
||||||
|
'network_ip_prefix_with_mask': 'IPV4AddressWithMask:',
|
||||||
|
'network_ip_prefix_value': 'IPV4Address:',
|
||||||
|
'network_ip_prefix_mask': 'IPV4Address:',
|
||||||
|
'nexthop_crtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'nexthop_noncrtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'addrfamily_redistribute_option': 'TEXT_OPTIONS:direct,ospf,\
|
||||||
|
static',
|
||||||
|
'bgp_neighbor_af_occurances': 'INTEGER_VALUE:1-10',
|
||||||
|
'bgp_neighbor_af_filtername': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_maxprefix': 'INTEGER_VALUE:1-15870',
|
||||||
|
'bgp_neighbor_af_prefixname': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_routemap': 'TEXT:',
|
||||||
|
'bgp_neighbor_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_neighbor_connection_retrytime': 'INTEGER_VALUE:1-65535',
|
||||||
|
'bgp_neighbor_description': 'TEXT:',
|
||||||
|
'bgp_neighbor_maxhopcount': 'INTEGER_VALUE:1-255',
|
||||||
|
'bgp_neighbor_local_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_neighbor_maxpeers': 'INTEGER_VALUE:1-96',
|
||||||
|
'bgp_neighbor_password': 'TEXT:',
|
||||||
|
'bgp_neighbor_timers_Keepalive': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_timers_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_ttl_hops': 'INTEGER_VALUE:1-254',
|
||||||
|
'bgp_neighbor_update_options': 'TEXT_OPTIONS:ethernet,loopback,\
|
||||||
|
vlan',
|
||||||
|
'bgp_neighbor_update_ethernet': 'TEXT:',
|
||||||
|
'bgp_neighbor_update_loopback': 'INTEGER_VALUE:0-7',
|
||||||
|
'bgp_neighbor_update_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'bgp_neighbor_weight': 'INTEGER_VALUE:0-65535',
|
||||||
|
'ethernet_interface_value': 'INTEGER_VALUE:1-54',
|
||||||
|
'ethernet_interface_range': 'INTEGER_VALUE_RANGE:1-54',
|
||||||
|
'ethernet_interface_string': 'TEXT:',
|
||||||
|
'loopback_interface_value': 'INTEGER_VALUE:0-7',
|
||||||
|
'mgmt_interface_value': 'INTEGER_VALUE:0-0',
|
||||||
|
'vlan_interface_value': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_interface_value': 'INTEGER_VALUE:1-4096',
|
||||||
|
'portchannel_interface_range': 'INTEGER_VALUE_RANGE:1-4096',
|
||||||
|
'portchannel_interface_string': 'TEXT:',
|
||||||
|
'aggregation_group_no': 'INTEGER_VALUE:1-4096',
|
||||||
|
'aggregation_group_mode': 'TEXT_OPTIONS:active,on,passive',
|
||||||
|
'bfd_options': 'TEXT_OPTIONS:authentication,echo,interval,ipv4,\
|
||||||
|
ipv6,neighbor',
|
||||||
|
'bfd_interval': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_minrx': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_ multiplier': 'INTEGER_VALUE:3-50',
|
||||||
|
'bfd_ipv4_options': 'TEXT_OPTIONS:authentication,echo,\
|
||||||
|
interval',
|
||||||
|
'bfd_auth_options': 'TEXT_OPTIONS:keyed-md5,keyed-sha1,\
|
||||||
|
meticulous-keyed-md5,meticulous-keyed-sha1,simple',
|
||||||
|
'bfd_key_options': 'TEXT_OPTIONS:key-chain,key-id',
|
||||||
|
'bfd_key_chain': 'TEXT:',
|
||||||
|
'bfd_key_id': 'INTEGER_VALUE:0-255',
|
||||||
|
'bfd_key_name': 'TEXT:',
|
||||||
|
'bfd_neighbor_ip': 'TEXT:',
|
||||||
|
'bfd_neighbor_options': 'TEXT_OPTIONS:admin-down,multihop,\
|
||||||
|
non-persistent',
|
||||||
|
'bfd_access_vlan': 'INTEGER_VALUE:1-3999',
|
||||||
|
'bfd_bridgeport_mode': 'TEXT_OPTIONS:access,dot1q-tunnel,\
|
||||||
|
trunk',
|
||||||
|
'trunk_options': 'TEXT_OPTIONS:allowed,native',
|
||||||
|
'trunk_vlanid': 'INTEGER_VALUE:1-3999',
|
||||||
|
'portCh_description': 'TEXT:',
|
||||||
|
'duplex_option': 'TEXT_OPTIONS:auto,full,half',
|
||||||
|
'flowcontrol_options': 'TEXT_OPTIONS:receive,send',
|
||||||
|
'portchannel_ip_options': 'TEXT_OPTIONS:access-group,address,\
|
||||||
|
arp,dhcp,ospf,port,port-unreachable,redirects,router,\
|
||||||
|
unreachables',
|
||||||
|
'accessgroup_name': 'TEXT:',
|
||||||
|
'portchannel_ipv4': 'IPV4Address:',
|
||||||
|
'portchannel_ipv4_mask': 'TEXT:',
|
||||||
|
'arp_ipaddress': 'IPV4Address:',
|
||||||
|
'arp_macaddress': 'TEXT:',
|
||||||
|
'arp_timeout_value': 'INTEGER_VALUE:60-28800',
|
||||||
|
'relay_ipaddress': 'IPV4Address:',
|
||||||
|
'ip_ospf_options': 'TEXT_OPTIONS:authentication,\
|
||||||
|
authentication-key,bfd,cost,database-filter,dead-interval,\
|
||||||
|
hello-interval,message-digest-key,mtu,mtu-ignore,network,\
|
||||||
|
passive-interface,priority,retransmit-interval,shutdown,\
|
||||||
|
transmit-delay',
|
||||||
|
'ospf_id_decimal_value': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'ospf_id_ipaddres_value': 'IPV4Address:',
|
||||||
|
'lacp_options': 'TEXT_OPTIONS:port-priority,suspend-individual,\
|
||||||
|
timeout',
|
||||||
|
'port_priority': 'INTEGER_VALUE:1-65535',
|
||||||
|
'lldp_options': 'TEXT_OPTIONS:receive,tlv-select,transmit,\
|
||||||
|
trap-notification',
|
||||||
|
'lldp_tlv_options': 'TEXT_OPTIONS:link-aggregation,\
|
||||||
|
mac-phy-status,management-address,max-frame-size,\
|
||||||
|
port-description,port-protocol-vlan,port-vlan,power-mdi,\
|
||||||
|
protocol-identity,system-capabilities,system-description,\
|
||||||
|
system-name,vid-management,vlan-name',
|
||||||
|
'load_interval_delay': 'INTEGER_VALUE:30-300',
|
||||||
|
'load_interval_counter': 'INTEGER_VALUE:1-3',
|
||||||
|
'mac_accessgroup_name': 'TEXT:',
|
||||||
|
'mac_address': 'TEXT:',
|
||||||
|
'microburst_threshold': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'mtu_value': 'INTEGER_VALUE:64-9216',
|
||||||
|
'service_instance': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'service_policy_options': 'TEXT_OPTIONS:copp-system-policy,\
|
||||||
|
input,output,type',
|
||||||
|
'service_policy_name': 'TEXT:',
|
||||||
|
'spanning_tree_options': 'TEXT_OPTIONS:bpdufilter,bpduguard,\
|
||||||
|
cost,disable,enable,guard,link-type,mst,port,port-priority,\
|
||||||
|
vlan',
|
||||||
|
'spanning_tree_cost': 'NO_VALIDATION:1-200000000',
|
||||||
|
'spanning_tree_interfacerange': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'spanning_tree_portpriority': 'TEXT_OPTIONS:0,32,64,96,128,160,\
|
||||||
|
192,224',
|
||||||
|
'portchannel_ipv6_neighbor_mac': 'TEXT:',
|
||||||
|
'portchannel_ipv6_neighbor_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_linklocal': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_dhcp_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_ipv6_dhcp_ethernet': 'TEXT:',
|
||||||
|
'portchannel_ipv6_dhcp': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_options': 'TEXT_OPTIONS:address,dhcp,\
|
||||||
|
link-local,nd,neighbor',
|
||||||
|
'interface_speed': 'TEXT_OPTIONS:1000,10000,40000,auto',
|
||||||
|
'stormcontrol_options': 'TEXT_OPTIONS:broadcast,multicast,\
|
||||||
|
unicast',
|
||||||
|
'stormcontrol_level': 'FLOAT:',
|
||||||
|
'portchannel_dot1q_tag': 'TEXT_OPTIONS:disable,enable,\
|
||||||
|
egress-only',
|
||||||
|
'vrrp_id': 'INTEGER_VALUE:1-255',
|
||||||
|
}
|
||||||
|
|
||||||
|
g8272_cnos = {'vlan_id': 'INTEGER_VALUE:1-3999',
|
||||||
|
'vlan_id_range': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'vlan_name': 'TEXT:',
|
||||||
|
'vlan_flood': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'vlan_state': 'TEXT_OPTIONS:active,suspend',
|
||||||
|
'vlan_last_member_query_interval': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_querier': 'IPV4Address:',
|
||||||
|
'vlan_querier_timeout': 'INTEGER_VALUE:1-65535',
|
||||||
|
'vlan_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_query_max_response_time': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_report_suppression': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_robustness_variable': 'INTEGER_VALUE:1-7',
|
||||||
|
'vlan_startup_query_count': 'INTEGER_VALUE:1-10',
|
||||||
|
'vlan_startup_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_snooping_version': 'INTEGER_VALUE:2-3',
|
||||||
|
'vlan_access_map_name': 'TEXT: ',
|
||||||
|
'vlan_ethernet_interface': 'TEXT:',
|
||||||
|
'vlan_portagg_number': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlan_accessmap_action': 'TEXT_OPTIONS:drop,forward,redirect',
|
||||||
|
'vlan_dot1q_tag': 'MATCH_TEXT_OR_EMPTY:egress-only',
|
||||||
|
'vlan_filter_name': 'TEXT:',
|
||||||
|
'vlag_auto_recovery': 'INTEGER_VALUE:240-3600',
|
||||||
|
'vlag_config_consistency': 'TEXT_OPTIONS:disable,strict',
|
||||||
|
'vlag_instance': 'INTEGER_VALUE:1-64',
|
||||||
|
'vlag_port_aggregation': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlag_priority': 'INTEGER_VALUE:0-65535',
|
||||||
|
'vlag_startup_delay': 'INTEGER_VALUE:0-3600',
|
||||||
|
'vlag_tier_id': 'INTEGER_VALUE:1-512',
|
||||||
|
'vlag_hlthchk_options': 'TEXT_OPTIONS:keepalive-attempts,\
|
||||||
|
keepalive-interval,peer-ip,retry-interval',
|
||||||
|
'vlag_keepalive_attempts': 'INTEGER_VALUE:1-24',
|
||||||
|
'vlag_keepalive_interval': 'INTEGER_VALUE:2-300',
|
||||||
|
'vlag_retry_interval': 'INTEGER_VALUE:1-300',
|
||||||
|
'vlag_peerip': 'IPV4Address:',
|
||||||
|
'vlag_peerip_vrf': 'TEXT_OPTIONS:default,management',
|
||||||
|
'bgp_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_bgp_local_count': 'INTEGER_VALUE:2-64',
|
||||||
|
'cluster_id_as_ip': 'IPV4Address:',
|
||||||
|
'cluster_id_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'confederation_identifier': 'INTEGER_VALUE:1-65535',
|
||||||
|
'condeferation_peers_as': 'INTEGER_VALUE:1-65535',
|
||||||
|
'stalepath_delay_value': 'INTEGER_VALUE:1-3600',
|
||||||
|
'maxas_limit_as': 'INTEGER_VALUE:1-2000',
|
||||||
|
'neighbor_ipaddress': 'IPV4Address:',
|
||||||
|
'neighbor_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'router_id': 'IPV4Address:',
|
||||||
|
'bgp_keepalive_interval': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_aggregate_prefix': 'IPV4AddressWithMask:',
|
||||||
|
'addrfamily_routemap_name': 'TEXT:',
|
||||||
|
'reachability_half_life': 'INTEGER_VALUE:1-45',
|
||||||
|
'start_reuse_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'start_suppress_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'max_duration_to_suppress_route': 'INTEGER_VALUE:1-255',
|
||||||
|
'unreachability_halftime_for_penalty': 'INTEGER_VALUE:1-45',
|
||||||
|
'distance_external_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_internal_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_local_routes': 'INTEGER_VALUE:1-255',
|
||||||
|
'maxpath_option': 'TEXT_OPTIONS:ebgp,ibgp',
|
||||||
|
'maxpath_numbers': 'INTEGER_VALUE:2-32',
|
||||||
|
'network_ip_prefix_with_mask': 'IPV4AddressWithMask:',
|
||||||
|
'network_ip_prefix_value': 'IPV4Address:',
|
||||||
|
'network_ip_prefix_mask': 'IPV4Address:',
|
||||||
|
'nexthop_crtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'nexthop_noncrtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'addrfamily_redistribute_option': 'TEXT_OPTIONS:direct,ospf,\
|
||||||
|
static',
|
||||||
|
'bgp_neighbor_af_occurances': 'INTEGER_VALUE:1-10',
|
||||||
|
'bgp_neighbor_af_filtername': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_maxprefix': 'INTEGER_VALUE:1-15870',
|
||||||
|
'bgp_neighbor_af_prefixname': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_routemap': 'TEXT:',
|
||||||
|
'bgp_neighbor_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_neighbor_connection_retrytime': 'INTEGER_VALUE:1-65535',
|
||||||
|
'bgp_neighbor_description': 'TEXT:',
|
||||||
|
'bgp_neighbor_maxhopcount': 'INTEGER_VALUE:1-255',
|
||||||
|
'bgp_neighbor_local_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_neighbor_maxpeers': 'INTEGER_VALUE:1-96',
|
||||||
|
'bgp_neighbor_password': 'TEXT:',
|
||||||
|
'bgp_neighbor_timers_Keepalive': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_timers_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_ttl_hops': 'INTEGER_VALUE:1-254',
|
||||||
|
'bgp_neighbor_update_options': 'TEXT_OPTIONS:ethernet,loopback,\
|
||||||
|
vlan',
|
||||||
|
'bgp_neighbor_update_ethernet': 'TEXT:',
|
||||||
|
'bgp_neighbor_update_loopback': 'INTEGER_VALUE:0-7',
|
||||||
|
'bgp_neighbor_update_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'bgp_neighbor_weight': 'INTEGER_VALUE:0-65535',
|
||||||
|
'ethernet_interface_value': 'INTEGER_VALUE:1-54',
|
||||||
|
'ethernet_interface_range': 'INTEGER_VALUE_RANGE:1-54',
|
||||||
|
'ethernet_interface_string': 'TEXT:',
|
||||||
|
'loopback_interface_value': 'INTEGER_VALUE:0-7',
|
||||||
|
'mgmt_interface_value': 'INTEGER_VALUE:0-0',
|
||||||
|
'vlan_interface_value': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_interface_value': 'INTEGER_VALUE:1-4096',
|
||||||
|
'portchannel_interface_range': 'INTEGER_VALUE_RANGE:1-4096',
|
||||||
|
'portchannel_interface_string': 'TEXT:',
|
||||||
|
'aggregation_group_no': 'INTEGER_VALUE:1-4096',
|
||||||
|
'aggregation_group_mode': 'TEXT_OPTIONS:active,on,passive',
|
||||||
|
'bfd_options': 'TEXT_OPTIONS:authentication,echo,interval,ipv4,\
|
||||||
|
ipv6,neighbor',
|
||||||
|
'bfd_interval': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_minrx': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_ multiplier': 'INTEGER_VALUE:3-50',
|
||||||
|
'bfd_ipv4_options': 'TEXT_OPTIONS:authentication,echo,interval',
|
||||||
|
'bfd_auth_options': 'TEXT_OPTIONS:keyed-md5,keyed-sha1,\
|
||||||
|
meticulous-keyed-md5,meticulous-keyed-sha1,simple',
|
||||||
|
'bfd_key_options': 'TEXT_OPTIONS:key-chain,key-id',
|
||||||
|
'bfd_key_chain': 'TEXT:',
|
||||||
|
'bfd_key_id': 'INTEGER_VALUE:0-255',
|
||||||
|
'bfd_key_name': 'TEXT:',
|
||||||
|
'bfd_neighbor_ip': 'TEXT:',
|
||||||
|
'bfd_neighbor_options': 'TEXT_OPTIONS:admin-down,multihop,\
|
||||||
|
non-persistent',
|
||||||
|
'bfd_access_vlan': 'INTEGER_VALUE:1-3999',
|
||||||
|
'bfd_bridgeport_mode': 'TEXT_OPTIONS:access,dot1q-tunnel,trunk',
|
||||||
|
'trunk_options': 'TEXT_OPTIONS:allowed,native',
|
||||||
|
'trunk_vlanid': 'INTEGER_VALUE:1-3999',
|
||||||
|
'portCh_description': 'TEXT:',
|
||||||
|
'duplex_option': 'TEXT_OPTIONS:auto,full,half',
|
||||||
|
'flowcontrol_options': 'TEXT_OPTIONS:receive,send',
|
||||||
|
'portchannel_ip_options': 'TEXT_OPTIONS:access-group,address,\
|
||||||
|
arp,dhcp,ospf,port,port-unreachable,redirects,router,\
|
||||||
|
unreachables',
|
||||||
|
'accessgroup_name': 'TEXT:',
|
||||||
|
'portchannel_ipv4': 'IPV4Address:',
|
||||||
|
'portchannel_ipv4_mask': 'TEXT:',
|
||||||
|
'arp_ipaddress': 'IPV4Address:',
|
||||||
|
'arp_macaddress': 'TEXT:',
|
||||||
|
'arp_timeout_value': 'INTEGER_VALUE:60-28800',
|
||||||
|
'relay_ipaddress': 'IPV4Address:',
|
||||||
|
'ip_ospf_options': 'TEXT_OPTIONS:authentication,\
|
||||||
|
authentication-key,bfd,cost,database-filter,dead-interval,\
|
||||||
|
hello-interval,message-digest-key,mtu,mtu-ignore,network,\
|
||||||
|
passive-interface,priority,retransmit-interval,shutdown,\
|
||||||
|
transmit-delay',
|
||||||
|
'ospf_id_decimal_value': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'ospf_id_ipaddres_value': 'IPV4Address:',
|
||||||
|
'lacp_options': 'TEXT_OPTIONS:port-priority,suspend-individual,\
|
||||||
|
timeout',
|
||||||
|
'port_priority': 'INTEGER_VALUE:1-65535',
|
||||||
|
'lldp_options': 'TEXT_OPTIONS:receive,tlv-select,transmit,\
|
||||||
|
trap-notification',
|
||||||
|
'lldp_tlv_options': 'TEXT_OPTIONS:link-aggregation,\
|
||||||
|
mac-phy-status,management-address,max-frame-size,\
|
||||||
|
port-description,port-protocol-vlan,port-vlan,power-mdi,\
|
||||||
|
protocol-identity,system-capabilities,system-description,\
|
||||||
|
system-name,vid-management,vlan-name',
|
||||||
|
'load_interval_delay': 'INTEGER_VALUE:30-300',
|
||||||
|
'load_interval_counter': 'INTEGER_VALUE:1-3',
|
||||||
|
'mac_accessgroup_name': 'TEXT:',
|
||||||
|
'mac_address': 'TEXT:',
|
||||||
|
'microburst_threshold': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'mtu_value': 'INTEGER_VALUE:64-9216',
|
||||||
|
'service_instance': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'service_policy_options': 'TEXT_OPTIONS:copp-system-policy,input,\
|
||||||
|
output,type',
|
||||||
|
'service_policy_name': 'TEXT:',
|
||||||
|
'spanning_tree_options': 'TEXT_OPTIONS:bpdufilter,bpduguard,\
|
||||||
|
cost,disable,enable,guard,link-type,mst,port,port-priority,vlan',
|
||||||
|
'spanning_tree_cost': 'NO_VALIDATION:1-200000000',
|
||||||
|
'spanning_tree_interfacerange': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'spanning_tree_portpriority': 'TEXT_OPTIONS:0,32,64,96,128,160,\
|
||||||
|
192,224',
|
||||||
|
'portchannel_ipv6_neighbor_mac': 'TEXT:',
|
||||||
|
'portchannel_ipv6_neighbor_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_linklocal': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_dhcp_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_ipv6_dhcp_ethernet': 'TEXT:',
|
||||||
|
'portchannel_ipv6_dhcp': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_options': 'TEXT_OPTIONS:address,dhcp,\
|
||||||
|
link-local,nd,neighbor',
|
||||||
|
'interface_speed': 'TEXT_OPTIONS:1000,10000,40000,auto',
|
||||||
|
'stormcontrol_options': 'TEXT_OPTIONS:broadcast,multicast,\
|
||||||
|
unicast',
|
||||||
|
'stormcontrol_level': 'FLOAT:',
|
||||||
|
'portchannel_dot1q_tag': 'TEXT_OPTIONS:disable,enable,\
|
||||||
|
egress-only',
|
||||||
|
'vrrp_id': 'INTEGER_VALUE:1-255',
|
||||||
|
}
|
||||||
|
g8296_cnos = {'vlan_id': 'INTEGER_VALUE:1-3999',
|
||||||
|
'vlan_id_range': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'vlan_name': 'TEXT:',
|
||||||
|
'vlan_flood': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'vlan_state': 'TEXT_OPTIONS:active,suspend',
|
||||||
|
'vlan_last_member_query_interval': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_querier': 'IPV4Address:',
|
||||||
|
'vlan_querier_timeout': 'INTEGER_VALUE:1-65535',
|
||||||
|
'vlan_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_query_max_response_time': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_report_suppression': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_robustness_variable': 'INTEGER_VALUE:1-7',
|
||||||
|
'vlan_startup_query_count': 'INTEGER_VALUE:1-10',
|
||||||
|
'vlan_startup_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_snooping_version': 'INTEGER_VALUE:2-3',
|
||||||
|
'vlan_access_map_name': 'TEXT: ',
|
||||||
|
'vlan_ethernet_interface': 'TEXT:',
|
||||||
|
'vlan_portagg_number': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlan_accessmap_action': 'TEXT_OPTIONS:drop,forward,redirect',
|
||||||
|
'vlan_dot1q_tag': 'MATCH_TEXT_OR_EMPTY:egress-only',
|
||||||
|
'vlan_filter_name': 'TEXT:',
|
||||||
|
'vlag_auto_recovery': 'INTEGER_VALUE:240-3600',
|
||||||
|
'vlag_config_consistency': 'TEXT_OPTIONS:disable,strict',
|
||||||
|
'vlag_instance': 'INTEGER_VALUE:1-128',
|
||||||
|
'vlag_port_aggregation': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlag_priority': 'INTEGER_VALUE:0-65535',
|
||||||
|
'vlag_startup_delay': 'INTEGER_VALUE:0-3600',
|
||||||
|
'vlag_tier_id': 'INTEGER_VALUE:1-512',
|
||||||
|
'vlag_hlthchk_options': 'TEXT_OPTIONS:keepalive-attempts,\
|
||||||
|
keepalive-interval,peer-ip,retry-interval',
|
||||||
|
'vlag_keepalive_attempts': 'INTEGER_VALUE:1-24',
|
||||||
|
'vlag_keepalive_interval': 'INTEGER_VALUE:2-300',
|
||||||
|
'vlag_retry_interval': 'INTEGER_VALUE:1-300',
|
||||||
|
'vlag_peerip': 'IPV4Address:',
|
||||||
|
'vlag_peerip_vrf': 'TEXT_OPTIONS:default,management',
|
||||||
|
'bgp_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_bgp_local_count': 'INTEGER_VALUE:2-64',
|
||||||
|
'cluster_id_as_ip': 'IPV4Address:',
|
||||||
|
'cluster_id_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'confederation_identifier': 'INTEGER_VALUE:1-65535',
|
||||||
|
'condeferation_peers_as': 'INTEGER_VALUE:1-65535',
|
||||||
|
'stalepath_delay_value': 'INTEGER_VALUE:1-3600',
|
||||||
|
'maxas_limit_as': 'INTEGER_VALUE:1-2000',
|
||||||
|
'neighbor_ipaddress': 'IPV4Address:',
|
||||||
|
'neighbor_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'router_id': 'IPV4Address:',
|
||||||
|
'bgp_keepalive_interval': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_aggregate_prefix': 'IPV4AddressWithMask:',
|
||||||
|
'addrfamily_routemap_name': 'TEXT:',
|
||||||
|
'reachability_half_life': 'INTEGER_VALUE:1-45',
|
||||||
|
'start_reuse_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'start_suppress_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'max_duration_to_suppress_route': 'INTEGER_VALUE:1-255',
|
||||||
|
'unreachability_halftime_for_penalty': 'INTEGER_VALUE:1-45',
|
||||||
|
'distance_external_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_internal_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_local_routes': 'INTEGER_VALUE:1-255',
|
||||||
|
'maxpath_option': 'TEXT_OPTIONS:ebgp,ibgp',
|
||||||
|
'maxpath_numbers': 'INTEGER_VALUE:2-32',
|
||||||
|
'network_ip_prefix_with_mask': 'IPV4AddressWithMask:',
|
||||||
|
'network_ip_prefix_value': 'IPV4Address:',
|
||||||
|
'network_ip_prefix_mask': 'IPV4Address:',
|
||||||
|
'nexthop_crtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'nexthop_noncrtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'addrfamily_redistribute_option': 'TEXT_OPTIONS:direct,ospf,\
|
||||||
|
static',
|
||||||
|
'bgp_neighbor_af_occurances': 'INTEGER_VALUE:1-10',
|
||||||
|
'bgp_neighbor_af_filtername': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_maxprefix': 'INTEGER_VALUE:1-15870',
|
||||||
|
'bgp_neighbor_af_prefixname': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_routemap': 'TEXT:',
|
||||||
|
'bgp_neighbor_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_neighbor_connection_retrytime': 'INTEGER_VALUE:1-65535',
|
||||||
|
'bgp_neighbor_description': 'TEXT:',
|
||||||
|
'bgp_neighbor_maxhopcount': 'INTEGER_VALUE:1-255',
|
||||||
|
'bgp_neighbor_local_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_neighbor_maxpeers': 'INTEGER_VALUE:1-96',
|
||||||
|
'bgp_neighbor_password': 'TEXT:',
|
||||||
|
'bgp_neighbor_timers_Keepalive': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_timers_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_ttl_hops': 'INTEGER_VALUE:1-254',
|
||||||
|
'bgp_neighbor_update_options': 'TEXT_OPTIONS:ethernet,loopback,\
|
||||||
|
vlan',
|
||||||
|
'bgp_neighbor_update_ethernet': 'TEXT:',
|
||||||
|
'bgp_neighbor_update_loopback': 'INTEGER_VALUE:0-7',
|
||||||
|
'bgp_neighbor_update_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'bgp_neighbor_weight': 'INTEGER_VALUE:0-65535',
|
||||||
|
'ethernet_interface_value': 'INTEGER_VALUE:1-96',
|
||||||
|
'ethernet_interface_range': 'INTEGER_VALUE_RANGE:1-96',
|
||||||
|
'ethernet_interface_string': 'TEXT:',
|
||||||
|
'loopback_interface_value': 'INTEGER_VALUE:0-7',
|
||||||
|
'mgmt_interface_value': 'INTEGER_VALUE:0-0',
|
||||||
|
'vlan_interface_value': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_interface_value': 'INTEGER_VALUE:1-4096',
|
||||||
|
'portchannel_interface_range': 'INTEGER_VALUE_RANGE:1-4096',
|
||||||
|
'portchannel_interface_string': 'TEXT:',
|
||||||
|
'aggregation_group_no': 'INTEGER_VALUE:1-4096',
|
||||||
|
'aggregation_group_mode': 'TEXT_OPTIONS:active,on,passive',
|
||||||
|
'bfd_options': 'TEXT_OPTIONS:authentication,echo,interval,ipv4,\
|
||||||
|
ipv6,neighbor',
|
||||||
|
'bfd_interval': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_minrx': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_ multiplier': 'INTEGER_VALUE:3-50',
|
||||||
|
'bfd_ipv4_options': 'TEXT_OPTIONS:authentication,echo,interval',
|
||||||
|
'bfd_auth_options': 'TEXT_OPTIONS:keyed-md5,keyed-sha1,\
|
||||||
|
meticulous-keyed-md5,meticulous-keyed-sha1,simple',
|
||||||
|
'bfd_key_options': 'TEXT_OPTIONS:key-chain,key-id',
|
||||||
|
'bfd_key_chain': 'TEXT:',
|
||||||
|
'bfd_key_id': 'INTEGER_VALUE:0-255',
|
||||||
|
'bfd_key_name': 'TEXT:',
|
||||||
|
'bfd_neighbor_ip': 'TEXT:',
|
||||||
|
'bfd_neighbor_options': 'TEXT_OPTIONS:admin-down,multihop,\
|
||||||
|
non-persistent',
|
||||||
|
'bfd_access_vlan': 'INTEGER_VALUE:1-3999',
|
||||||
|
'bfd_bridgeport_mode': 'TEXT_OPTIONS:access,dot1q-tunnel,trunk',
|
||||||
|
'trunk_options': 'TEXT_OPTIONS:allowed,native',
|
||||||
|
'trunk_vlanid': 'INTEGER_VALUE:1-3999',
|
||||||
|
'portCh_description': 'TEXT:',
|
||||||
|
'duplex_option': 'TEXT_OPTIONS:auto,full,half',
|
||||||
|
'flowcontrol_options': 'TEXT_OPTIONS:receive,send',
|
||||||
|
'portchannel_ip_options': 'TEXT_OPTIONS:access-group,address,\
|
||||||
|
arp,dhcp,ospf,port,port-unreachable,redirects,router,\
|
||||||
|
unreachables',
|
||||||
|
'accessgroup_name': 'TEXT:',
|
||||||
|
'portchannel_ipv4': 'IPV4Address:',
|
||||||
|
'portchannel_ipv4_mask': 'TEXT:',
|
||||||
|
'arp_ipaddress': 'IPV4Address:',
|
||||||
|
'arp_macaddress': 'TEXT:',
|
||||||
|
'arp_timeout_value': 'INTEGER_VALUE:60-28800',
|
||||||
|
'relay_ipaddress': 'IPV4Address:',
|
||||||
|
'ip_ospf_options': 'TEXT_OPTIONS:authentication,\
|
||||||
|
authentication-key,bfd,cost,database-filter,dead-interval,\
|
||||||
|
hello-interval,message-digest-key,mtu,mtu-ignore,network,\
|
||||||
|
passive-interface,priority,retransmit-interval,shutdown,\
|
||||||
|
transmit-delay',
|
||||||
|
'ospf_id_decimal_value': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'ospf_id_ipaddres_value': 'IPV4Address:',
|
||||||
|
'lacp_options': 'TEXT_OPTIONS:port-priority,suspend-individual,\
|
||||||
|
timeout',
|
||||||
|
'port_priority': 'INTEGER_VALUE:1-65535',
|
||||||
|
'lldp_options': 'TEXT_OPTIONS:receive,tlv-select,transmit,\
|
||||||
|
trap-notification',
|
||||||
|
'lldp_tlv_options': 'TEXT_OPTIONS:link-aggregation,\
|
||||||
|
mac-phy-status,management-address,max-frame-size,\
|
||||||
|
port-description,port-protocol-vlan,port-vlan,power-mdi,\
|
||||||
|
protocol-identity,system-capabilities,system-description,\
|
||||||
|
system-name,vid-management,vlan-name',
|
||||||
|
'load_interval_delay': 'INTEGER_VALUE:30-300',
|
||||||
|
'load_interval_counter': 'INTEGER_VALUE:1-3',
|
||||||
|
'mac_accessgroup_name': 'TEXT:',
|
||||||
|
'mac_address': 'TEXT:',
|
||||||
|
'microburst_threshold': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'mtu_value': 'INTEGER_VALUE:64-9216',
|
||||||
|
'service_instance': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'service_policy_options': 'TEXT_OPTIONS:copp-system-policy,\
|
||||||
|
input,output,type',
|
||||||
|
'service_policy_name': 'TEXT:',
|
||||||
|
'spanning_tree_options': 'TEXT_OPTIONS:bpdufilter,bpduguard,\
|
||||||
|
cost,disable,enable,guard,link-type,mst,port,port-priority,vlan',
|
||||||
|
'spanning_tree_cost': 'NO_VALIDATION:1-200000000',
|
||||||
|
'spanning_tree_interfacerange': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'spanning_tree_portpriority': 'TEXT_OPTIONS:0,32,64,96,128,160,\
|
||||||
|
192,224',
|
||||||
|
'portchannel_ipv6_neighbor_mac': 'TEXT:',
|
||||||
|
'portchannel_ipv6_neighbor_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_linklocal': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_dhcp_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_ipv6_dhcp_ethernet': 'TEXT:',
|
||||||
|
'portchannel_ipv6_dhcp': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_options': 'TEXT_OPTIONS:address,dhcp,\
|
||||||
|
link-local,nd,neighbor',
|
||||||
|
'interface_speed': 'TEXT_OPTIONS:1000,10000,40000,auto',
|
||||||
|
'stormcontrol_options': 'TEXT_OPTIONS:broadcast,multicast,\
|
||||||
|
unicast',
|
||||||
|
'stormcontrol_level': 'FLOAT:',
|
||||||
|
'portchannel_dot1q_tag': 'TEXT_OPTIONS:disable,enable,\
|
||||||
|
egress-only',
|
||||||
|
'vrrp_id': 'INTEGER_VALUE:1-255',
|
||||||
|
}
|
||||||
|
g8332_cnos = {'vlan_id': 'INTEGER_VALUE:1-3999',
|
||||||
|
'vlan_id_range': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'vlan_name': 'TEXT:',
|
||||||
|
'vlan_flood': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'vlan_state': 'TEXT_OPTIONS:active,suspend',
|
||||||
|
'vlan_last_member_query_interval': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_querier': 'IPV4Address:',
|
||||||
|
'vlan_querier_timeout': 'INTEGER_VALUE:1-65535',
|
||||||
|
'vlan_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_query_max_response_time': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_report_suppression': 'INTEGER_VALUE:1-25',
|
||||||
|
'vlan_robustness_variable': 'INTEGER_VALUE:1-7',
|
||||||
|
'vlan_startup_query_count': 'INTEGER_VALUE:1-10',
|
||||||
|
'vlan_startup_query_interval': 'INTEGER_VALUE:1-18000',
|
||||||
|
'vlan_snooping_version': 'INTEGER_VALUE:2-3',
|
||||||
|
'vlan_access_map_name': 'TEXT: ',
|
||||||
|
'vlan_ethernet_interface': 'TEXT:',
|
||||||
|
'vlan_portagg_number': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlan_accessmap_action': 'TEXT_OPTIONS:drop,forward,redirect',
|
||||||
|
'vlan_dot1q_tag': 'MATCH_TEXT_OR_EMPTY:egress-only',
|
||||||
|
'vlan_filter_name': 'TEXT:',
|
||||||
|
'vlag_auto_recovery': 'INTEGER_VALUE:240-3600',
|
||||||
|
'vlag_config_consistency': 'TEXT_OPTIONS:disable,strict',
|
||||||
|
'vlag_instance': 'INTEGER_VALUE:1-128',
|
||||||
|
'vlag_port_aggregation': 'INTEGER_VALUE:1-4096',
|
||||||
|
'vlag_priority': 'INTEGER_VALUE:0-65535',
|
||||||
|
'vlag_startup_delay': 'INTEGER_VALUE:0-3600',
|
||||||
|
'vlag_tier_id': 'INTEGER_VALUE:1-512',
|
||||||
|
'vlag_hlthchk_options': 'TEXT_OPTIONS:keepalive-attempts,\
|
||||||
|
keepalive-interval,peer-ip,retry-interval',
|
||||||
|
'vlag_keepalive_attempts': 'INTEGER_VALUE:1-24',
|
||||||
|
'vlag_keepalive_interval': 'INTEGER_VALUE:2-300',
|
||||||
|
'vlag_retry_interval': 'INTEGER_VALUE:1-300',
|
||||||
|
'vlag_peerip': 'IPV4Address:',
|
||||||
|
'vlag_peerip_vrf': 'TEXT_OPTIONS:default,management',
|
||||||
|
'bgp_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_bgp_local_count': 'INTEGER_VALUE:2-64',
|
||||||
|
'cluster_id_as_ip': 'IPV4Address:',
|
||||||
|
'cluster_id_as_number': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'confederation_identifier': 'INTEGER_VALUE:1-65535',
|
||||||
|
'condeferation_peers_as': 'INTEGER_VALUE:1-65535',
|
||||||
|
'stalepath_delay_value': 'INTEGER_VALUE:1-3600',
|
||||||
|
'maxas_limit_as': 'INTEGER_VALUE:1-2000',
|
||||||
|
'neighbor_ipaddress': 'IPV4Address:',
|
||||||
|
'neighbor_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'router_id': 'IPV4Address:',
|
||||||
|
'bgp_keepalive_interval': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_aggregate_prefix': 'IPV4AddressWithMask:',
|
||||||
|
'addrfamily_routemap_name': 'TEXT:',
|
||||||
|
'reachability_half_life': 'INTEGER_VALUE:1-45',
|
||||||
|
'start_reuse_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'start_suppress_route_value': 'INTEGER_VALUE:1-20000',
|
||||||
|
'max_duration_to_suppress_route': 'INTEGER_VALUE:1-255',
|
||||||
|
'unreachability_halftime_for_penalty': 'INTEGER_VALUE:1-45',
|
||||||
|
'distance_external_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_internal_AS': 'INTEGER_VALUE:1-255',
|
||||||
|
'distance_local_routes': 'INTEGER_VALUE:1-255',
|
||||||
|
'maxpath_option': 'TEXT_OPTIONS:ebgp,ibgp',
|
||||||
|
'maxpath_numbers': 'INTEGER_VALUE:2-32',
|
||||||
|
'network_ip_prefix_with_mask': 'IPV4AddressWithMask:',
|
||||||
|
'network_ip_prefix_value': 'IPV4Address:',
|
||||||
|
'network_ip_prefix_mask': 'IPV4Address:',
|
||||||
|
'nexthop_crtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'nexthop_noncrtitical_delay': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'addrfamily_redistribute_option': 'TEXT_OPTIONS:direct,ospf,\
|
||||||
|
static',
|
||||||
|
'bgp_neighbor_af_occurances': 'INTEGER_VALUE:1-10',
|
||||||
|
'bgp_neighbor_af_filtername': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_maxprefix': 'INTEGER_VALUE:1-15870',
|
||||||
|
'bgp_neighbor_af_prefixname': 'TEXT:',
|
||||||
|
'bgp_neighbor_af_routemap': 'TEXT:',
|
||||||
|
'bgp_neighbor_address_family': 'TEXT_OPTIONS:ipv4,ipv6',
|
||||||
|
'bgp_neighbor_connection_retrytime': 'INTEGER_VALUE:1-65535',
|
||||||
|
'bgp_neighbor_description': 'TEXT:',
|
||||||
|
'bgp_neighbor_maxhopcount': 'INTEGER_VALUE:1-255',
|
||||||
|
'bgp_neighbor_local_as': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'bgp_neighbor_maxpeers': 'INTEGER_VALUE:1-96',
|
||||||
|
'bgp_neighbor_password': 'TEXT:',
|
||||||
|
'bgp_neighbor_timers_Keepalive': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_timers_holdtime': 'INTEGER_VALUE:0-3600',
|
||||||
|
'bgp_neighbor_ttl_hops': 'INTEGER_VALUE:1-254',
|
||||||
|
'bgp_neighbor_update_options': 'TEXT_OPTIONS:ethernet,loopback,\
|
||||||
|
vlan',
|
||||||
|
'bgp_neighbor_update_ethernet': 'TEXT:',
|
||||||
|
'bgp_neighbor_update_loopback': 'INTEGER_VALUE:0-7',
|
||||||
|
'bgp_neighbor_update_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'bgp_neighbor_weight': 'INTEGER_VALUE:0-65535',
|
||||||
|
'ethernet_interface_value': 'INTEGER_VALUE:1-32',
|
||||||
|
'ethernet_interface_range': 'INTEGER_VALUE_RANGE:1-32',
|
||||||
|
'ethernet_interface_string': 'TEXT:',
|
||||||
|
'loopback_interface_value': 'INTEGER_VALUE:0-7',
|
||||||
|
'mgmt_interface_value': 'INTEGER_VALUE:0-0',
|
||||||
|
'vlan_interface_value': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_interface_value': 'INTEGER_VALUE:1-4096',
|
||||||
|
'portchannel_interface_range': 'INTEGER_VALUE_RANGE:1-4096',
|
||||||
|
'portchannel_interface_string': 'TEXT:',
|
||||||
|
'aggregation_group_no': 'INTEGER_VALUE:1-4096',
|
||||||
|
'aggregation_group_mode': 'TEXT_OPTIONS:active,on,passive',
|
||||||
|
'bfd_options': 'TEXT_OPTIONS:authentication,echo,interval,ipv4,\
|
||||||
|
ipv6,neighbor',
|
||||||
|
'bfd_interval': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_minrx': 'INTEGER_VALUE:50-999',
|
||||||
|
'bfd_ multiplier': 'INTEGER_VALUE:3-50',
|
||||||
|
'bfd_ipv4_options': 'TEXT_OPTIONS:authentication,echo,interval',
|
||||||
|
'bfd_auth_options': 'TEXT_OPTIONS:keyed-md5,keyed-sha1,\
|
||||||
|
meticulous-keyed-md5,meticulous-keyed-sha1,simple',
|
||||||
|
'bfd_key_options': 'TEXT_OPTIONS:key-chain,key-id',
|
||||||
|
'bfd_key_chain': 'TEXT:',
|
||||||
|
'bfd_key_id': 'INTEGER_VALUE:0-255',
|
||||||
|
'bfd_key_name': 'TEXT:',
|
||||||
|
'bfd_neighbor_ip': 'TEXT:',
|
||||||
|
'bfd_neighbor_options': 'TEXT_OPTIONS:admin-down,multihop,\
|
||||||
|
non-persistent',
|
||||||
|
'bfd_access_vlan': 'INTEGER_VALUE:1-3999',
|
||||||
|
'bfd_bridgeport_mode': 'TEXT_OPTIONS:access,dot1q-tunnel,trunk',
|
||||||
|
'trunk_options': 'TEXT_OPTIONS:allowed,native',
|
||||||
|
'trunk_vlanid': 'INTEGER_VALUE:1-3999',
|
||||||
|
'portCh_description': 'TEXT:',
|
||||||
|
'duplex_option': 'TEXT_OPTIONS:auto,full,half',
|
||||||
|
'flowcontrol_options': 'TEXT_OPTIONS:receive,send',
|
||||||
|
'portchannel_ip_options': 'TEXT_OPTIONS:access-group,address,arp,\
|
||||||
|
dhcp,ospf,port,port-unreachable,redirects,router,unreachables',
|
||||||
|
'accessgroup_name': 'TEXT:',
|
||||||
|
'portchannel_ipv4': 'IPV4Address:',
|
||||||
|
'portchannel_ipv4_mask': 'TEXT:',
|
||||||
|
'arp_ipaddress': 'IPV4Address:',
|
||||||
|
'arp_macaddress': 'TEXT:',
|
||||||
|
'arp_timeout_value': 'INTEGER_VALUE:60-28800',
|
||||||
|
'relay_ipaddress': 'IPV4Address:',
|
||||||
|
'ip_ospf_options': 'TEXT_OPTIONS:authentication,\
|
||||||
|
authentication-key,bfd,cost,database-filter,dead-interval,\
|
||||||
|
hello-interval,message-digest-key,mtu,mtu-ignore,network,\
|
||||||
|
passive-interface,priority,retransmit-interval,shutdown,\
|
||||||
|
transmit-delay',
|
||||||
|
'ospf_id_decimal_value': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'ospf_id_ipaddres_value': 'IPV4Address:',
|
||||||
|
'lacp_options': 'TEXT_OPTIONS:port-priority,suspend-individual,\
|
||||||
|
timeout',
|
||||||
|
'port_priority': 'INTEGER_VALUE:1-65535',
|
||||||
|
'lldp_options': 'TEXT_OPTIONS:receive,tlv-select,transmit,\
|
||||||
|
trap-notification',
|
||||||
|
'lldp_tlv_options': 'TEXT_OPTIONS:link-aggregation,\
|
||||||
|
mac-phy-status,management-address,max-frame-size,\
|
||||||
|
port-description,port-protocol-vlan,port-vlan,power-mdi,\
|
||||||
|
protocol-identity,system-capabilities,system-description,\
|
||||||
|
system-name,vid-management,vlan-name',
|
||||||
|
'load_interval_delay': 'INTEGER_VALUE:30-300',
|
||||||
|
'load_interval_counter': 'INTEGER_VALUE:1-3',
|
||||||
|
'mac_accessgroup_name': 'TEXT:',
|
||||||
|
'mac_address': 'TEXT:',
|
||||||
|
'microburst_threshold': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'mtu_value': 'INTEGER_VALUE:64-9216',
|
||||||
|
'service_instance': 'NO_VALIDATION:1-4294967295',
|
||||||
|
'service_policy_options': 'TEXT_OPTIONS:copp-system-policy,\
|
||||||
|
input,output,type',
|
||||||
|
'service_policy_name': 'TEXT:',
|
||||||
|
'spanning_tree_options': 'TEXT_OPTIONS:bpdufilter,bpduguard,\
|
||||||
|
cost,disable,enable,guard,link-type,mst,port,port-priority,vlan',
|
||||||
|
'spanning_tree_cost': 'NO_VALIDATION:1-200000000',
|
||||||
|
'spanning_tree_interfacerange': 'INTEGER_VALUE_RANGE:1-3999',
|
||||||
|
'spanning_tree_portpriority': 'TEXT_OPTIONS:0,32,64,96,128,160,\
|
||||||
|
192,224',
|
||||||
|
'portchannel_ipv6_neighbor_mac': 'TEXT:',
|
||||||
|
'portchannel_ipv6_neighbor_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_linklocal': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_dhcp_vlan': 'INTEGER_VALUE:1-4094',
|
||||||
|
'portchannel_ipv6_dhcp_ethernet': 'TEXT:',
|
||||||
|
'portchannel_ipv6_dhcp': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_address': 'IPV6Address:',
|
||||||
|
'portchannel_ipv6_options': 'TEXT_OPTIONS:address,dhcp,\
|
||||||
|
link-local,nd,neighbor',
|
||||||
|
'interface_speed': 'TEXT_OPTIONS:1000,10000,40000,50000,auto',
|
||||||
|
'stormcontrol_options': 'TEXT_OPTIONS:broadcast,multicast,\
|
||||||
|
unicast',
|
||||||
|
'stormcontrol_level': 'FLOAT:',
|
||||||
|
'portchannel_dot1q_tag': 'TEXT_OPTIONS:disable,enable,\
|
||||||
|
egress-only',
|
||||||
|
'vrrp_id': 'INTEGER_VALUE:1-255',
|
||||||
|
}
|
@ -0,0 +1,256 @@
|
|||||||
|
# This code is part of Ansible, but is an independent component.
|
||||||
|
# This particular file snippet, and this file snippet only, is BSD licensed.
|
||||||
|
# Modules you write using this snippet, which is embedded dynamically by
|
||||||
|
# Ansible still belong to the author of the module, and may assign their own
|
||||||
|
# license to the complete work.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Contains error codes and methods
|
||||||
|
# Lenovo Networking
|
||||||
|
|
||||||
|
errorDict = {0: 'Success',
|
||||||
|
1: 'NOK',
|
||||||
|
101: 'Device Response Timed out',
|
||||||
|
102: 'Command Not supported - Use CLI command',
|
||||||
|
103: 'Invalid Context',
|
||||||
|
104: 'Command Value Not Supported as of Now. Use vlan Id only',
|
||||||
|
105: 'Invalid interface Range',
|
||||||
|
106: 'Please provide Enable Password.',
|
||||||
|
108: '',
|
||||||
|
109: '',
|
||||||
|
110: 'Invalid protocol option',
|
||||||
|
111: 'The Value is not Integer',
|
||||||
|
112: 'The Value is not Float',
|
||||||
|
113: 'Value is not in Range',
|
||||||
|
114: 'Range value is not Integer',
|
||||||
|
115: 'Value is not in Options',
|
||||||
|
116: 'The Value is not Long',
|
||||||
|
117: 'Range value is not Long',
|
||||||
|
118: 'The Value cannot be empty',
|
||||||
|
119: 'The Value is not String',
|
||||||
|
120: 'The Value is not Matching',
|
||||||
|
121: 'The Value is not IPV4 Address',
|
||||||
|
122: 'The Value is not IPV6 Address',
|
||||||
|
123: '',
|
||||||
|
124: '',
|
||||||
|
125: '',
|
||||||
|
126: '',
|
||||||
|
127: '',
|
||||||
|
128: '',
|
||||||
|
129: '',
|
||||||
|
130: 'Invalid Access Map Name',
|
||||||
|
131: 'Invalid Vlan Dot1q Tag',
|
||||||
|
132: 'Invalid Vlan filter value',
|
||||||
|
133: 'Invalid Vlan Range Value',
|
||||||
|
134: 'Invalid Vlan Id',
|
||||||
|
135: 'Invalid Vlan Access Map Action',
|
||||||
|
136: 'Invalid Vlan Access Map Name',
|
||||||
|
137: 'Invalid Access List',
|
||||||
|
138: 'Invalid Vlan Access Map parameter',
|
||||||
|
139: 'Invalid Vlan Name',
|
||||||
|
140: 'Invalid Vlan Flood value,',
|
||||||
|
141: 'Invalid Vlan State Value',
|
||||||
|
142: 'Invalid Vlan Last Member query Interval',
|
||||||
|
143: 'Invalid Querier IP address',
|
||||||
|
144: 'Invalid Querier Time out',
|
||||||
|
145: 'Invalid Query Interval',
|
||||||
|
146: 'Invalid Vlan query max response time',
|
||||||
|
147: 'Invalid vlan robustness variable',
|
||||||
|
148: 'Invalid Vlan Startup Query count',
|
||||||
|
149: 'Invalid vlan Startup Query Interval',
|
||||||
|
150: 'Invalid Vlan snooping version',
|
||||||
|
151: 'Invalid Vlan Ethernet Interface',
|
||||||
|
152: 'Invalid Vlan Port Tag Number',
|
||||||
|
153: 'Invalid mrouter option',
|
||||||
|
154: 'Invalid Vlan Option',
|
||||||
|
155: '',
|
||||||
|
156: '',
|
||||||
|
157: '',
|
||||||
|
158: '',
|
||||||
|
159: '',
|
||||||
|
160: 'Invalid Vlag Auto Recovery Value',
|
||||||
|
161: 'Invalid Vlag Config Consistency Value',
|
||||||
|
162: 'Invalid Vlag Port Aggregation Number',
|
||||||
|
163: 'Invalid Vlag Priority Value',
|
||||||
|
164: 'Invalid Vlag Startup delay value',
|
||||||
|
165: 'Invalid Vlag Trie Id',
|
||||||
|
166: 'Invalid Vlag Instance Option',
|
||||||
|
167: 'Invalid Vlag Keep Alive Attempts',
|
||||||
|
168: 'Invalid Vlag Keep Alive Interval',
|
||||||
|
169: 'Invalid Vlag Retry Interval',
|
||||||
|
170: 'Invalid Vlag Peer Ip VRF Value',
|
||||||
|
171: 'Invalid Vlag Health Check Options',
|
||||||
|
172: 'Invalid Vlag Option',
|
||||||
|
173: '',
|
||||||
|
174: '',
|
||||||
|
175: '',
|
||||||
|
176: 'Invalid BGP As Number',
|
||||||
|
177: 'Invalid Routing protocol option',
|
||||||
|
178: 'Invalid BGP Address Family',
|
||||||
|
179: 'Invalid AS Path options',
|
||||||
|
180: 'Invalid BGP med options',
|
||||||
|
181: 'Invalid Best Path option',
|
||||||
|
182: 'Invalid BGP Local count number',
|
||||||
|
183: 'Cluster Id has to either IP or AS Number',
|
||||||
|
184: 'Invalid confederation identifier',
|
||||||
|
185: 'Invalid Confederation Peer AS Value',
|
||||||
|
186: 'Invalid Confederation Option',
|
||||||
|
187: 'Invalid state path relay value',
|
||||||
|
188: 'Invalid Maxas Limit AS Value',
|
||||||
|
189: 'Invalid Neighbor IP Address or Neighbor AS Number',
|
||||||
|
190: 'Invalid Router Id',
|
||||||
|
191: 'Invalid BGP Keep Alive Interval',
|
||||||
|
192: 'Invalid BGP Hold time',
|
||||||
|
193: 'Invalid BGP Option',
|
||||||
|
194: 'Invalid BGP Address Family option',
|
||||||
|
195: 'Invalid BGP Address Family Redistribution option. ',
|
||||||
|
196: 'Invalid BGP Address Family Route Map Name',
|
||||||
|
197: 'Invalid Next Hop Critical Delay',
|
||||||
|
198: 'Invalid Next Hop Non Critical Delay',
|
||||||
|
199: 'Invalid Multipath Number Value',
|
||||||
|
200: 'Invalid Aggegation Group Mode',
|
||||||
|
201: 'Invalid Aggregation Group No',
|
||||||
|
202: 'Invalid BFD Access Vlan',
|
||||||
|
203: 'Invalid CFD Bridgeport Mode',
|
||||||
|
204: 'Invalid Trunk Option',
|
||||||
|
205: 'Invalid BFD Option',
|
||||||
|
206: 'Invalid Portchannel description',
|
||||||
|
207: 'Invalid Portchannel duplex option',
|
||||||
|
208: 'Invalid Flow control option state',
|
||||||
|
209: 'Invalid Flow control option',
|
||||||
|
210: 'Invalid LACP Port priority',
|
||||||
|
211: 'Invalid LACP Time out options',
|
||||||
|
212: 'Invalid LACP Command options',
|
||||||
|
213: 'Invalid LLDP TLV Option',
|
||||||
|
214: 'Invalid LLDP Option',
|
||||||
|
215: 'Invalid Load interval delay',
|
||||||
|
216: 'Invalid Load interval Counter Number',
|
||||||
|
217: 'Invalid Load Interval option',
|
||||||
|
218: 'Invalid Mac Access Group Name',
|
||||||
|
219: 'Invalid Mac Address',
|
||||||
|
220: 'Invalid Microburst threshold value',
|
||||||
|
221: 'Invalid MTU Value',
|
||||||
|
222: 'Invalid Service instance value',
|
||||||
|
223: 'Invalid service policy name',
|
||||||
|
224: 'Invalid service policy options',
|
||||||
|
225: 'Invalid Interface speed value',
|
||||||
|
226: 'Invalid Storm control level value',
|
||||||
|
227: 'Invalid Storm control option',
|
||||||
|
228: 'Invalid Portchannel dot1q tag',
|
||||||
|
229: 'Invalid VRRP Id Value',
|
||||||
|
230: 'Invalid VRRP Options',
|
||||||
|
231: 'Invalid portchannel source interface option',
|
||||||
|
232: 'Invalid portchannel load balance options',
|
||||||
|
233: 'Invalid Portchannel configuration attribute',
|
||||||
|
234: 'Invalid BFD Interval Value',
|
||||||
|
235: 'Invalid BFD minrx Value',
|
||||||
|
236: 'Invalid BFD multiplier Value',
|
||||||
|
237: 'Invalid Key Chain Value',
|
||||||
|
238: 'Invalid key name option',
|
||||||
|
239: 'Invalid key id value',
|
||||||
|
240: 'Invalid Key Option',
|
||||||
|
241: 'Invalid authentication option',
|
||||||
|
242: 'Invalid destination Ip',
|
||||||
|
243: 'Invalid source Ip',
|
||||||
|
244: 'Invalid IP Option',
|
||||||
|
245: 'Invalid Access group option',
|
||||||
|
246: 'Invalid Access group name',
|
||||||
|
247: 'Invalid ARP MacAddress Value',
|
||||||
|
248: 'Invalid ARP timeout value',
|
||||||
|
249: 'Invalid ARP Option',
|
||||||
|
250: 'Invalid dhcp request option',
|
||||||
|
251: 'Invalid dhcp Client option',
|
||||||
|
252: 'Invalid relay Ip Address',
|
||||||
|
253: 'Invalid dhcp Option',
|
||||||
|
254: 'Invalid OSPF Option',
|
||||||
|
255: 'Invalid OSPF Id IP Address Value',
|
||||||
|
256: 'Invalid Ip Router Option',
|
||||||
|
257: 'Invalid Spanning tree bpdufilter Options',
|
||||||
|
258: 'Invalid Spanning tree bpduguard Options',
|
||||||
|
259: 'Invalid Spanning tree cost Options',
|
||||||
|
260: 'Invalid Spanning tree guard Options',
|
||||||
|
261: 'Invalid Spanning tree link-type Options',
|
||||||
|
262: 'Invalid Spanning tree link-type Options',
|
||||||
|
263: 'Invalid Spanning tree options',
|
||||||
|
264: 'Port-priority in increments of 32 is required',
|
||||||
|
265: 'Invalid Spanning tree vlan options',
|
||||||
|
266: 'Invalid IPv6 option',
|
||||||
|
267: 'Invalid IPV6 neighbor IP Address',
|
||||||
|
268: 'Invalid IPV6 neighbor mac addres',
|
||||||
|
269: 'Invalid IPV6 dhcp option',
|
||||||
|
270: 'Invalid IPV6 relay address option',
|
||||||
|
271: 'Invalid IPV6 Ethernet option',
|
||||||
|
272: 'Invalid IPV6 Vlan option',
|
||||||
|
273: 'Invalid IPV6 Link Local option',
|
||||||
|
274: 'Invalid IPV6 dhcp option',
|
||||||
|
275: 'Invalid IPV6 Address',
|
||||||
|
276: 'Invalid IPV6 Address option',
|
||||||
|
277: 'Invalid BFD neighbor options',
|
||||||
|
278: 'Invalid Secondary option',
|
||||||
|
289: 'Invalid PortChannel IPV4 address',
|
||||||
|
290: 'Invalid Max Path Options',
|
||||||
|
291: 'Invalid Distance Local Route value',
|
||||||
|
292: 'Invalid Distance Internal AS value',
|
||||||
|
293: 'Invalid Distance External AS value',
|
||||||
|
294: 'Invalid BGP Reachability Half Life',
|
||||||
|
295: 'Invalid BGP Dampening parameter',
|
||||||
|
296: 'Invalid BGP Aggregate Prefix value',
|
||||||
|
297: 'Invalid BGP Aggregate Prefix Option',
|
||||||
|
298: 'Invalid BGP Address Family Route Map Name',
|
||||||
|
299: 'Invalid BGP Net IP Mask Value',
|
||||||
|
300: 'Invalid BGP Net IP Prefix Value',
|
||||||
|
301: 'Invalid BGP Neighbor configuration option',
|
||||||
|
302: 'Invalid BGP Neighbor Weight Value',
|
||||||
|
303: 'Invalid Neigbor update source option',
|
||||||
|
304: 'Invalid Ethernet slot/chassis number',
|
||||||
|
305: 'Invalid Loopback Interface number',
|
||||||
|
306: 'Invalid vlan id',
|
||||||
|
307: 'Invalid Number of hops',
|
||||||
|
308: 'Invalid Neighbor Keepalive interval',
|
||||||
|
309: 'Invalid Neighbor timer hold time',
|
||||||
|
310: 'Invalid neighbor password ',
|
||||||
|
311: 'Invalid Max peer limit',
|
||||||
|
312: 'Invalid Local AS Number',
|
||||||
|
313: 'Invalid maximum hop count',
|
||||||
|
314: 'Invalid neighbor description',
|
||||||
|
315: 'Invalid Neighbor connect timer value',
|
||||||
|
316: 'Invalid Neighbor address family option',
|
||||||
|
317: 'Invalid neighbor address family option',
|
||||||
|
318: 'Invalid route-map name',
|
||||||
|
319: 'Invalid route-map',
|
||||||
|
320: 'Invalid Name of a prefix list',
|
||||||
|
321: 'Invalid Filter incoming option',
|
||||||
|
322: 'Invalid AS path access-list name',
|
||||||
|
323: 'Invalid Filter route option',
|
||||||
|
324: 'Invalid route-map name',
|
||||||
|
325: 'Invalid Number of occurrences of AS number',
|
||||||
|
326: 'Invalid Prefix Limit'}
|
||||||
|
|
||||||
|
|
||||||
|
def getErrorString(errorCode):
|
||||||
|
retVal = errorDict[int(errorCode)]
|
||||||
|
return retVal
|
||||||
|
# EOM
|
@ -0,0 +1,288 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
|
#
|
||||||
|
# This file is part of Ansible
|
||||||
|
#
|
||||||
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Ansible is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Module to send VLAN commands to Lenovo Switches
|
||||||
|
# Overloading aspect of vlan creation in a range is pending
|
||||||
|
# Lenovo Networking
|
||||||
|
#
|
||||||
|
|
||||||
|
ANSIBLE_METADATA = {'status': ['preview'],
|
||||||
|
'supported_by': 'community',
|
||||||
|
'version': '1.0'}
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
---
|
||||||
|
module: cnos_vlan
|
||||||
|
short_description: Performs VLAN switch configuration and state management.
|
||||||
|
description:
|
||||||
|
- This module allows you to work with VLAN related configurations. The
|
||||||
|
operators used are overloaded to ensure control over switch VLAN
|
||||||
|
configurations. The first level of VLAN configuration allows to set up the
|
||||||
|
VLAN range, the VLAN tag persistence, a VLAN access map and access map
|
||||||
|
filter. After passing this level, there are five VLAN arguments that will
|
||||||
|
perform further configurations. They are vlanArg1, vlanArg2, vlanArg3,
|
||||||
|
vlanArg4, and vlanArg5. The value of vlanArg1 will determine the way
|
||||||
|
following arguments will be evaluated. For more details on how to use these
|
||||||
|
arguments, see [Overloaded Variables].
|
||||||
|
This module uses SSH to manage network device configuration.
|
||||||
|
The results of the operation will be placed in a directory named 'results'
|
||||||
|
that must be created by the user in their local directory to where the playbook is run.
|
||||||
|
For more information about this module from Lenovo and customizing it usage for your
|
||||||
|
use cases, please visit our [User Guide](http://systemx.lenovofiles.com/help/index.jsp?topic=%2Fcom.lenovo.switchmgt.ansible.doc%2Fcnos_vlan.html)
|
||||||
|
version_added: "2.3"
|
||||||
|
extends_documentation_fragment: cnos
|
||||||
|
options:
|
||||||
|
vlanArg1:
|
||||||
|
description:
|
||||||
|
- This is an overloaded vlan first argument. Usage of this argument can be found is the User Guide referenced above.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: [access-map, dot1q, filter, <1-3999> VLAN ID 1-3999 or range]
|
||||||
|
vlanArg2:
|
||||||
|
description:
|
||||||
|
- This is an overloaded vlan second argument. Usage of this argument can be found is the User Guide referenced above.
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
choices: [VLAN Access Map name,egress-only,name, flood,state, ip]
|
||||||
|
vlanArg3:
|
||||||
|
description:
|
||||||
|
- This is an overloaded vlan third argument. Usage of this argument can be found is the User Guide referenced above.
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
choices: [action, match, statistics, enter VLAN id or range of vlan, ascii name for the VLAN, ipv4 or ipv6, active or suspend, fast-leave,
|
||||||
|
last-member-query-interval, mrouter, querier, querier-timeout, query-interval, query-max-response-time, report-suppression,
|
||||||
|
robustness-variable, startup-query-count, startup-query-interval, static-group]
|
||||||
|
vlanArg4:
|
||||||
|
description:
|
||||||
|
- This is an overloaded vlan fourth argument. Usage of this argument can be found is the User Guide referenced above.
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
choices: [drop or forward or redirect, ip or mac,Interval in seconds,ethernet, port-aggregation, Querier IP address,
|
||||||
|
Querier Timeout in seconds, Query Interval in seconds, Query Max Response Time in seconds, Robustness Variable value,
|
||||||
|
Number of queries sent at startup, Query Interval at startup]
|
||||||
|
vlanArg5:
|
||||||
|
description:
|
||||||
|
- This is an overloaded vlan fifth argument. Usage of this argument can be found is the User Guide referenced above.
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
choices: [access-list name, Slot/chassis number, Port Aggregation Number]
|
||||||
|
|
||||||
|
'''
|
||||||
|
EXAMPLES = '''
|
||||||
|
|
||||||
|
Tasks: The following are examples of using the module cnos_vlan. These are written in the main.yml file of the tasks directory.
|
||||||
|
---
|
||||||
|
- name: Test Vlan - Create a vlan, name it
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: 13
|
||||||
|
vlanArg2: "name"
|
||||||
|
vlanArg3: "Anil"
|
||||||
|
|
||||||
|
- name: Test Vlan - Create a vlan, Flood configuration
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: 13
|
||||||
|
vlanArg2: "flood"
|
||||||
|
vlanArg3: "ipv4"
|
||||||
|
|
||||||
|
- name: Test Vlan - Create a vlan, State configuration
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: 13
|
||||||
|
vlanArg2: "state"
|
||||||
|
vlanArg3: "active"
|
||||||
|
|
||||||
|
- name: Test Vlan - VLAN Access map1
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: "access-map"
|
||||||
|
vlanArg2: "Anil"
|
||||||
|
vlanArg3: "statistics"
|
||||||
|
|
||||||
|
- name: Test Vlan - VLAN Accep Map2
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: "access-map"
|
||||||
|
vlanArg2: "Anil"
|
||||||
|
vlanArg3: "action"
|
||||||
|
vlanArg4: "forward"
|
||||||
|
|
||||||
|
- name: Test Vlan - ip igmp snooping query interval
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: 13
|
||||||
|
vlanArg2: "ip"
|
||||||
|
vlanArg3: "query-interval"
|
||||||
|
vlanArg4: 1313
|
||||||
|
|
||||||
|
- name: Test Vlan - ip igmp snooping mrouter interface port-aggregation 23
|
||||||
|
cnos_vlan:
|
||||||
|
host: "{{ inventory_hostname }}"
|
||||||
|
username: "{{ hostvars[inventory_hostname]['username'] }}"
|
||||||
|
password: "{{ hostvars[inventory_hostname]['password'] }}"
|
||||||
|
deviceType: "{{ hostvars[inventory_hostname]['deviceType'] }}"
|
||||||
|
enablePassword: "{{ hostvars[inventory_hostname]['enablePassword'] }}"
|
||||||
|
outputfile: "./results/test_vlan_{{ inventory_hostname }}_output.txt"
|
||||||
|
vlanArg1: 13
|
||||||
|
vlanArg2: "ip"
|
||||||
|
vlanArg3: "mrouter"
|
||||||
|
vlanArg4: "port-aggregation"
|
||||||
|
vlanArg5: 23
|
||||||
|
|
||||||
|
'''
|
||||||
|
RETURN = '''
|
||||||
|
return value: |
|
||||||
|
On successful execution, the method returns a message in JSON format
|
||||||
|
[VLAN configurations are successful]
|
||||||
|
Upon any failure, the method returns an error display string.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import paramiko
|
||||||
|
import time
|
||||||
|
import argparse
|
||||||
|
import socket
|
||||||
|
import array
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
import re
|
||||||
|
|
||||||
|
try:
|
||||||
|
import cnos
|
||||||
|
HAS_LIB = True
|
||||||
|
except:
|
||||||
|
HAS_LIB = False
|
||||||
|
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
|
def main():
|
||||||
|
#
|
||||||
|
# Define parameters for vlan creation entry
|
||||||
|
#
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
outputfile=dict(required=True),
|
||||||
|
host=dict(required=True),
|
||||||
|
username=dict(required=True),
|
||||||
|
password=dict(required=True, no_log=True),
|
||||||
|
enablePassword=dict(required=False, no_log=True),
|
||||||
|
deviceType=dict(required=True),
|
||||||
|
vlanArg1=dict(required=True),
|
||||||
|
vlanArg2=dict(required=False),
|
||||||
|
vlanArg3=dict(required=False),
|
||||||
|
vlanArg4=dict(required=False),
|
||||||
|
vlanArg5=dict(required=False),),
|
||||||
|
supports_check_mode=False)
|
||||||
|
|
||||||
|
username = module.params['username']
|
||||||
|
password = module.params['password']
|
||||||
|
enablePassword = module.params['enablePassword']
|
||||||
|
vlanArg1 = module.params['vlanArg1']
|
||||||
|
vlanArg2 = module.params['vlanArg2']
|
||||||
|
vlanArg3 = module.params['vlanArg3']
|
||||||
|
vlanArg4 = module.params['vlanArg4']
|
||||||
|
vlanArg5 = module.params['vlanArg5']
|
||||||
|
outputfile = module.params['outputfile']
|
||||||
|
hostIP = module.params['host']
|
||||||
|
deviceType = module.params['deviceType']
|
||||||
|
|
||||||
|
output = ""
|
||||||
|
|
||||||
|
# Create instance of SSHClient object
|
||||||
|
remote_conn_pre = paramiko.SSHClient()
|
||||||
|
|
||||||
|
# Automatically add untrusted hosts (make sure okay for security policy in
|
||||||
|
# your environment)
|
||||||
|
remote_conn_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
|
|
||||||
|
# initiate SSH connection with the switch
|
||||||
|
remote_conn_pre.connect(hostIP, username=username, password=password)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
# Use invoke_shell to establish an 'interactive session'
|
||||||
|
remote_conn = remote_conn_pre.invoke_shell()
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
# Enable and enter configure terminal then send command
|
||||||
|
output = output + cnos.waitForDeviceResponse("\n", ">", 2, remote_conn)
|
||||||
|
|
||||||
|
output = output + \
|
||||||
|
cnos.enterEnableModeForDevice(enablePassword, 3, remote_conn)
|
||||||
|
|
||||||
|
# Make terminal length = 0
|
||||||
|
output = output + \
|
||||||
|
cnos.waitForDeviceResponse("terminal length 0\n", "#", 2, remote_conn)
|
||||||
|
|
||||||
|
# Go to config mode
|
||||||
|
output = output + \
|
||||||
|
cnos.waitForDeviceResponse("conf d\n", "(config)#", 2, remote_conn)
|
||||||
|
|
||||||
|
# Send the CLi command
|
||||||
|
output = output + \
|
||||||
|
cnos.vlanConfig(
|
||||||
|
remote_conn, deviceType, "(config)#", 2, vlanArg1, vlanArg2,
|
||||||
|
vlanArg3, vlanArg4, vlanArg5)
|
||||||
|
|
||||||
|
# Save it into the file
|
||||||
|
file = open(outputfile, "a")
|
||||||
|
file.write(output)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
# need to add logic to check when changes occur or not
|
||||||
|
errorMsg = cnos.checkOutputForError(output)
|
||||||
|
if(errorMsg is None):
|
||||||
|
module.exit_json(changed=True, msg="VLAN configuration isaccomplished")
|
||||||
|
else:
|
||||||
|
module.fail_json(msg=errorMsg)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -0,0 +1,85 @@
|
|||||||
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
|
#
|
||||||
|
# This file is part of Ansible
|
||||||
|
#
|
||||||
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Ansible is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
class ModuleDocFragment(object):
|
||||||
|
# Standard CNOS documentation fragment
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
options:
|
||||||
|
outputfile:
|
||||||
|
description:
|
||||||
|
- This specifies the file path where the output of each command
|
||||||
|
execution is saved. Each command that is specified in the merged
|
||||||
|
template file and each response from the device are saved here.
|
||||||
|
Usually the location is the results folder, but you can
|
||||||
|
choose another location based on your write permission.
|
||||||
|
required: true
|
||||||
|
default: Null
|
||||||
|
version_added: 2.3
|
||||||
|
host:
|
||||||
|
description:
|
||||||
|
- This is the variable used to search the hosts file at
|
||||||
|
/etc/ansible/hosts and identify the IP address of the device on
|
||||||
|
which the template is going to be applied. Usually the Ansible
|
||||||
|
keyword {{ inventory_hostname }} is specified in the playbook as
|
||||||
|
an abstraction of the group of network elements that need to be
|
||||||
|
configured.
|
||||||
|
required: true
|
||||||
|
default: Null
|
||||||
|
version_added: 2.3
|
||||||
|
username:
|
||||||
|
description:
|
||||||
|
- Configures the username used to authenticate the connection to
|
||||||
|
the remote device. The value of the username parameter is used to
|
||||||
|
authenticate the SSH session. While generally the value should
|
||||||
|
come from the inventory file, you can also specify it as a
|
||||||
|
variable. This parameter is optional. If it is not specified, no
|
||||||
|
default value will be used.
|
||||||
|
required: true
|
||||||
|
default: Null
|
||||||
|
version_added: 2.3
|
||||||
|
password:
|
||||||
|
description:
|
||||||
|
- Configures the password used to authenticate the connection to
|
||||||
|
the remote device. The value of the password parameter is used to
|
||||||
|
authenticate the SSH session. While generally the value should
|
||||||
|
come from the inventory file, you can also specify it as a
|
||||||
|
variable. This parameter is optional. If it is not specified, no
|
||||||
|
default value will be used.
|
||||||
|
required: true
|
||||||
|
default: Null
|
||||||
|
version_added: 2.3
|
||||||
|
enablePassword:
|
||||||
|
description:
|
||||||
|
- Configures the password used to enter Global Configuration
|
||||||
|
command mode on the switch. If the switch does not request this
|
||||||
|
password, the parameter is ignored.While generally the value
|
||||||
|
should come from the inventory file, you can also specify it as a
|
||||||
|
variable. This parameter is optional. If it is not specified,
|
||||||
|
no default value will be used.
|
||||||
|
required: false
|
||||||
|
default: Null
|
||||||
|
version_added: 2.3
|
||||||
|
deviceType:
|
||||||
|
description:
|
||||||
|
- This specifies the type of device where the method is executed.
|
||||||
|
required: Yes
|
||||||
|
default: null
|
||||||
|
choices: [g8272_cnos,g8296_cnos,g8332_cnos]
|
||||||
|
version_added: 2.3
|
||||||
|
'''
|
@ -0,0 +1,24 @@
|
|||||||
|
- hosts: cnos
|
||||||
|
gather_facts: no
|
||||||
|
connection: local
|
||||||
|
|
||||||
|
vars:
|
||||||
|
limit_to: "*"
|
||||||
|
debug: false
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- { role: cnos_facts, when: "limit_to in ['*', 'cnos_facts']" }
|
||||||
|
- { role: cnos_vlan, when: "limit_to in ['*', 'cnos_vlan']" }
|
||||||
|
- { role: cnos_ethernet, when: "limit_to in ['*', 'cnos_ethernet']" }
|
||||||
|
- { role: cnos_image, when: "limit_to in ['*', 'cnos_image']" }
|
||||||
|
- { role: cnos_portchannel, when: "limit_to in ['*', 'cnos_portchannel']" }
|
||||||
|
- { role: cnos_rollback, when: "limit_to in ['*', 'cnos_rollback']" }
|
||||||
|
- { role: cnos_save, when: "limit_to in ['*', 'cnos_save']" }
|
||||||
|
- { role: cnos_template, when: "limit_to in ['*', 'cnos_template']" }
|
||||||
|
- { role: cnos_conditional_template, when: "limit_to in ['*', 'cnos_conditional_template']" }
|
||||||
|
- { role: cnos_conditional_command, when: "limit_to in ['*', 'cnos_conditional_command']" }
|
||||||
|
- { role: cnos_vlag, when: "limit_to in ['*', 'cnos_vlag']" }
|
||||||
|
- { role: cnos_command, when: "limit_to in ['*', 'cnos_command']" }
|
||||||
|
- { role: cnos_bgp, when: "limit_to in ['*', 'cnos_bgp']" }
|
||||||
|
- { role: cnos_backup, when: "limit_to in ['*', 'cnos_backup']" }
|
||||||
|
- { role: cnos_showrun, when: "limit_to in ['*', 'cnos_showrun']" }
|
@ -0,0 +1,114 @@
|
|||||||
|
# Ansible Role: cnos_vlan_sample - Switch VLAN configuration
|
||||||
|
---
|
||||||
|
<add role description below>
|
||||||
|
|
||||||
|
This role is an example of using the *cnos_vlan.py* Lenovo module in the context of CNOS switch configuration. This module allows you to work with VLAN related configurations. The operators used are overloaded to ensure control over switch VLAN configurations.
|
||||||
|
|
||||||
|
The first level of VLAN configuration allows to set up the VLAN range, the VLAN tag persistence, a VLAN access map and access map filter. After passing this level, there are five VLAN arguments that will perform further configurations. They are *vlanArg1*, *vlanArg2*, *vlanArg3*, *vlanArg4*, and *vlanArg5*. The value of *vlanArg1* will determine the way following arguments will be evaluated.
|
||||||
|
|
||||||
|
The results of the operation can be viewed in *results* directory.
|
||||||
|
|
||||||
|
For more details, see [Lenovo modules for Ansible: cnos_vlan](http://systemx.lenovofiles.com/help/index.jsp?topic=%2Fcom.lenovo.switchmgt.ansible.doc%2Fcnos_vlan.html&cp=0_3_1_0_4_14).
|
||||||
|
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
---
|
||||||
|
<add role requirements information below>
|
||||||
|
|
||||||
|
- Ansible version 2.2 or later ([Ansible installation documentation](http://docs.ansible.com/ansible/intro_installation.html))
|
||||||
|
- Lenovo switches running CNOS version 10.2.1.0 or later
|
||||||
|
- an SSH connection to the Lenovo switch (SSH must be enabled on the network device)
|
||||||
|
|
||||||
|
|
||||||
|
## Role Variables
|
||||||
|
---
|
||||||
|
<add role variables information below>
|
||||||
|
|
||||||
|
Available variables are listed below, along with description.
|
||||||
|
|
||||||
|
The following are mandatory inventory variables:
|
||||||
|
|
||||||
|
Variable | Description
|
||||||
|
--- | ---
|
||||||
|
`username` | Specifies the username used to log into the switch
|
||||||
|
`password` | Specifies the password used to log into the switch
|
||||||
|
`enablePassword` | Configures the password used to enter Global Configuration command mode on the switch (this is an optional parameter)
|
||||||
|
`hostname` | Searches the hosts file at */etc/ansible/hosts* and identifies the IP address of the switch on which the role is going to be applied
|
||||||
|
`deviceType` | Specifies the type of device from where the configuration will be backed up (**g8272_cnos** - G8272, **g8296_cnos** - G8296)
|
||||||
|
|
||||||
|
The values of the variables used need to be modified to fit the specific scenario in which you are deploying the solution. To change the values of the variables, you need to visits the *vars* directory of each role and edit the *main.yml* file located there. The values stored in this file will be used by Ansible when the template is executed.
|
||||||
|
|
||||||
|
The syntax of *main.yml* file for variables is the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
<template variable>:<value>
|
||||||
|
```
|
||||||
|
|
||||||
|
You will need to replace the `<value>` field with the value that suits your topology. The `<template variable>` fields are taken from the template and it is recommended that you leave them unchanged.
|
||||||
|
|
||||||
|
Variable | Description
|
||||||
|
--- | ---
|
||||||
|
`vlanArg1` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: **access-map**, **dot1q**, **filter**, specify VLAN.
|
||||||
|
`vlanArg2` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: VLAN access map name, **egress-only**, **name**, **flood**, **state**, **ip**.
|
||||||
|
`vlanArg3` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: **action**, **match**, **statistics**, specify VLAN, name of the VLAN, **ipv4**, **ipv6**, **active**, **suspend**, **fast-leave**, **last-member-query-interval**, **mrouter**, **querier**, **querier-timeout**, **query-interval**, **query-max-response-time**, **report-suppression**, **robustness-variable**, **startup-query-count**, **startup-query-interval**.
|
||||||
|
`vlanArg4` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: **drop**, **forward**, **redirect**, **ip**, **mac**, last member query interval, **ethernet**, **port-aggregation**, querier IP address, querier timeout interval, query interval, query maximum response interval, robustness variable value, numbers of queries sent at startup, startup query interval.
|
||||||
|
`vlanArg5` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: ACL name, specify ethernet port, LAG number.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
---
|
||||||
|
<add dependencies information below>
|
||||||
|
|
||||||
|
- username.iptables - Configures the firewall and blocks all ports except those needed for web server and SSH access.
|
||||||
|
- username.common - Performs common server configuration.
|
||||||
|
- cnos_vlan.py - This modules needs to be present in the *library* directory of the role.
|
||||||
|
- cnos.py - This module needs to be present in the PYTHONPATH environment variable set in the Ansible system.
|
||||||
|
- /etc/ansible/hosts - You must edit the */etc/ansible/hosts* file with the device information of the switches designated as leaf switches. You may refer to *cnos_vlan_sample_hosts* for a sample configuration.
|
||||||
|
|
||||||
|
Ansible keeps track of all network elements that it manages through a hosts file. Before the execution of a playbook, the hosts file must be set up.
|
||||||
|
|
||||||
|
Open the */etc/ansible/hosts* file with root privileges. Most of the file is commented out by using **#**. You can also comment out the entries you will be adding by using **#**. You need to copy the content of the hosts file for the role into the */etc/ansible/hosts* file. The hosts file for the role is located in the main directory of the multiple layer vLAG configuration solution.
|
||||||
|
|
||||||
|
```
|
||||||
|
[cnos_vlan_sample]
|
||||||
|
10.241.107.39 username=<username> password=<password> deviceType=g8272_cnos
|
||||||
|
10.241.107.40 username=<username> password=<password> deviceType=g8272_cnos
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** You need to change the IP addresses to fit your specific topology. You also need to change the `<username>` and `<password>` to the appropriate values used to log into the specific Lenovo network devices.
|
||||||
|
|
||||||
|
|
||||||
|
## Example Playbook
|
||||||
|
---
|
||||||
|
<add playbook samples below>
|
||||||
|
|
||||||
|
To execute an Ansible playbook, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
ansible-playbook cnos_vlan_sample.yml -vvv
|
||||||
|
```
|
||||||
|
|
||||||
|
`-vvv` is an optional verbos command that helps identify what is happening during playbook execution. The playbook for each role is located in the main directory of the solution.
|
||||||
|
|
||||||
|
```
|
||||||
|
- name: Module to do VLAN configurations
|
||||||
|
hosts: cnos_vlan_sample
|
||||||
|
gather_facts: no
|
||||||
|
connection: local
|
||||||
|
roles:
|
||||||
|
- cnos_vlan_sample
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
---
|
||||||
|
<add license information below>
|
||||||
|
Copyright (C) 2017 Lenovo, Inc.
|
||||||
|
|
||||||
|
This file is part of Ansible
|
||||||
|
|
||||||
|
Ansible is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
Ansible is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
@ -0,0 +1,15 @@
|
|||||||
|
# You have to paste this dummy information in /etc/ansible/hosts
|
||||||
|
# Notes:
|
||||||
|
# - Comments begin with the '#' character
|
||||||
|
# - Blank lines are ignored
|
||||||
|
# - Groups of hosts are delimited by [header] elements
|
||||||
|
# - You can enter hostnames or ip addresses
|
||||||
|
# - A hostname/ip can be a member of multiple groups
|
||||||
|
#
|
||||||
|
# In the /etc/ansible/hosts file u have to enter [cnos_vlan_sample] tag
|
||||||
|
# Following you should specify IP Adresses details
|
||||||
|
# Please change <username> and <password> with appropriate value for your switch.
|
||||||
|
|
||||||
|
[cnos_vlan_sample]
|
||||||
|
10.241.107.39 username=<username> password=<password> deviceType=g8272_cnos
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# This contain sample template execution task
|
||||||
|
---
|
||||||
|
- name: Test Vlan - Create a vlan, name it
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data1}}"
|
||||||
|
- name: Test Vlan - Create a vlan, Flood configuration
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data2}}"
|
||||||
|
- name: Test Vlan - Create a vlan, State configuration
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data3}}"
|
||||||
|
- name: Test Vlan - VLAN Access map1
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data4}}"
|
||||||
|
- name: Test Vlan - VLAN Accep Map2
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}'
|
||||||
|
with_items: "{{cnos_vlan_data5}}"
|
||||||
|
- name: Test Vlan - ip igmp snooping query interval
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}'
|
||||||
|
with_items: "{{cnos_vlan_data6}}"
|
||||||
|
- name: Test Vlan - ip igmp snooping last member query interval
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}'
|
||||||
|
with_items: "{{cnos_vlan_data7}}"
|
||||||
|
- name: Test Vlan - ip igmp snooping mrouter interface port-aggregation
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}' vlanArg5='{{item.vlanArg5}}'
|
||||||
|
with_items: "{{cnos_vlan_data8}}"
|
||||||
|
- name: Idempotent Command
|
||||||
|
cnos_command: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} clicommand='{{item.clicommand}}' outputfile=./results/cnos_command_{{ inventory_hostname }}_output.txt
|
||||||
|
with_items: "{{cnos_vlan_data9}}"
|
||||||
|
# Completed file
|
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
cnos_vlan_data1:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "name", vlanArg3: "anil"}
|
||||||
|
cnos_vlan_data2:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "flood", vlanArg3: "ipv4"}
|
||||||
|
cnos_vlan_data3:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "state", vlanArg3: "active"}
|
||||||
|
cnos_vlan_data4:
|
||||||
|
- {vlanArg1: "access-map", vlanArg2: "anil", vlanArg3: "statistics"}
|
||||||
|
cnos_vlan_data5:
|
||||||
|
- {vlanArg1: "access-map", vlanArg2: "anil", vlanArg3: "action", vlanArg4: "forward"}
|
||||||
|
cnos_vlan_data6:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "ip", vlanArg3: "query-interval", vlanArg4: 1313}
|
||||||
|
cnos_vlan_data7:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "ip", vlanArg3: "last-member-query-interval", vlanArg4: 23}
|
||||||
|
cnos_vlan_data8:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "ip", vlanArg3: "mrouter", vlanArg4: "port-aggregation", vlanArg5: 23}
|
||||||
|
cnos_vlan_data9:
|
||||||
|
- {clicommand: "no vlan 13"}
|
@ -0,0 +1,114 @@
|
|||||||
|
# Ansible Role: cnos_vlan_sample - Switch VLAN configuration
|
||||||
|
---
|
||||||
|
<add role description below>
|
||||||
|
|
||||||
|
This role is an example of using the *cnos_vlan.py* Lenovo module in the context of CNOS switch configuration. This module allows you to work with VLAN related configurations. The operators used are overloaded to ensure control over switch VLAN configurations.
|
||||||
|
|
||||||
|
The first level of VLAN configuration allows to set up the VLAN range, the VLAN tag persistence, a VLAN access map and access map filter. After passing this level, there are five VLAN arguments that will perform further configurations. They are *vlanArg1*, *vlanArg2*, *vlanArg3*, *vlanArg4*, and *vlanArg5*. The value of *vlanArg1* will determine the way following arguments will be evaluated.
|
||||||
|
|
||||||
|
The results of the operation can be viewed in *results* directory.
|
||||||
|
|
||||||
|
For more details, see [Lenovo modules for Ansible: cnos_vlan](http://systemx.lenovofiles.com/help/index.jsp?topic=%2Fcom.lenovo.switchmgt.ansible.doc%2Fcnos_vlan.html&cp=0_3_1_0_4_14).
|
||||||
|
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
---
|
||||||
|
<add role requirements information below>
|
||||||
|
|
||||||
|
- Ansible version 2.2 or later ([Ansible installation documentation](http://docs.ansible.com/ansible/intro_installation.html))
|
||||||
|
- Lenovo switches running CNOS version 10.2.1.0 or later
|
||||||
|
- an SSH connection to the Lenovo switch (SSH must be enabled on the network device)
|
||||||
|
|
||||||
|
|
||||||
|
## Role Variables
|
||||||
|
---
|
||||||
|
<add role variables information below>
|
||||||
|
|
||||||
|
Available variables are listed below, along with description.
|
||||||
|
|
||||||
|
The following are mandatory inventory variables:
|
||||||
|
|
||||||
|
Variable | Description
|
||||||
|
--- | ---
|
||||||
|
`username` | Specifies the username used to log into the switch
|
||||||
|
`password` | Specifies the password used to log into the switch
|
||||||
|
`enablePassword` | Configures the password used to enter Global Configuration command mode on the switch (this is an optional parameter)
|
||||||
|
`hostname` | Searches the hosts file at */etc/ansible/hosts* and identifies the IP address of the switch on which the role is going to be applied
|
||||||
|
`deviceType` | Specifies the type of device from where the configuration will be backed up (**g8272_cnos** - G8272, **g8296_cnos** - G8296)
|
||||||
|
|
||||||
|
The values of the variables used need to be modified to fit the specific scenario in which you are deploying the solution. To change the values of the variables, you need to visits the *vars* directory of each role and edit the *main.yml* file located there. The values stored in this file will be used by Ansible when the template is executed.
|
||||||
|
|
||||||
|
The syntax of *main.yml* file for variables is the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
<template variable>:<value>
|
||||||
|
```
|
||||||
|
|
||||||
|
You will need to replace the `<value>` field with the value that suits your topology. The `<template variable>` fields are taken from the template and it is recommended that you leave them unchanged.
|
||||||
|
|
||||||
|
Variable | Description
|
||||||
|
--- | ---
|
||||||
|
`vlanArg1` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: **access-map**, **dot1q**, **filter**, specify VLAN.
|
||||||
|
`vlanArg2` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: VLAN access map name, **egress-only**, **name**, **flood**, **state**, **ip**.
|
||||||
|
`vlanArg3` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: **action**, **match**, **statistics**, specify VLAN, name of the VLAN, **ipv4**, **ipv6**, **active**, **suspend**, **fast-leave**, **last-member-query-interval**, **mrouter**, **querier**, **querier-timeout**, **query-interval**, **query-max-response-time**, **report-suppression**, **robustness-variable**, **startup-query-count**, **startup-query-interval**.
|
||||||
|
`vlanArg4` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: **drop**, **forward**, **redirect**, **ip**, **mac**, last member query interval, **ethernet**, **port-aggregation**, querier IP address, querier timeout interval, query interval, query maximum response interval, robustness variable value, numbers of queries sent at startup, startup query interval.
|
||||||
|
`vlanArg5` | This is an overloaded BGP variable. Please refer to the [cnos_vlan module documentation](http://ralfss28.labs.lenovo.com:5555/help/topic/com.lenovo.switchmgt.ansible.doc/cnos_vlan.html?cp=0_3_1_0_2_16) for detailed information on usage. The values of these variables depend on the configuration context and the choices are the following: ACL name, specify ethernet port, LAG number.
|
||||||
|
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
---
|
||||||
|
<add dependencies information below>
|
||||||
|
|
||||||
|
- username.iptables - Configures the firewall and blocks all ports except those needed for web server and SSH access.
|
||||||
|
- username.common - Performs common server configuration.
|
||||||
|
- cnos_vlan.py - This modules needs to be present in the *library* directory of the role.
|
||||||
|
- cnos.py - This module needs to be present in the PYTHONPATH environment variable set in the Ansible system.
|
||||||
|
- /etc/ansible/hosts - You must edit the */etc/ansible/hosts* file with the device information of the switches designated as leaf switches. You may refer to *cnos_vlan_sample_hosts* for a sample configuration.
|
||||||
|
|
||||||
|
Ansible keeps track of all network elements that it manages through a hosts file. Before the execution of a playbook, the hosts file must be set up.
|
||||||
|
|
||||||
|
Open the */etc/ansible/hosts* file with root privileges. Most of the file is commented out by using **#**. You can also comment out the entries you will be adding by using **#**. You need to copy the content of the hosts file for the role into the */etc/ansible/hosts* file. The sample hosts file for the role is located in the main directory.
|
||||||
|
|
||||||
|
```
|
||||||
|
[cnos_vlan_sample]
|
||||||
|
10.241.107.39 username=<username> password=<password> deviceType=g8272_cnos
|
||||||
|
10.241.107.40 username=<username> password=<password> deviceType=g8272_cnos
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** You need to change the IP addresses to fit your specific topology. You also need to change the `<username>` and `<password>` to the appropriate values used to log into the specific Lenovo network devices.
|
||||||
|
|
||||||
|
|
||||||
|
## Example Playbook
|
||||||
|
---
|
||||||
|
<add playbook samples below>
|
||||||
|
|
||||||
|
To execute an Ansible playbook, use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
ansible-playbook cnos_vlan_sample.yml -vvv
|
||||||
|
```
|
||||||
|
|
||||||
|
`-vvv` is an optional verbos command that helps identify what is happening during playbook execution. The playbook for each role is located in the main directory of the solution.
|
||||||
|
|
||||||
|
```
|
||||||
|
- name: Module to do VLAN configurations
|
||||||
|
hosts: cnos_vlan_sample
|
||||||
|
gather_facts: no
|
||||||
|
connection: local
|
||||||
|
roles:
|
||||||
|
- cnos_vlan_sample
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
---
|
||||||
|
<add license information below>
|
||||||
|
Copyright (C) 2017 Lenovo, Inc.
|
||||||
|
|
||||||
|
This file is part of Ansible
|
||||||
|
|
||||||
|
Ansible is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
Ansible is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
@ -0,0 +1,15 @@
|
|||||||
|
# You have to paste this dummy information in /etc/ansible/hosts
|
||||||
|
# Notes:
|
||||||
|
# - Comments begin with the '#' character
|
||||||
|
# - Blank lines are ignored
|
||||||
|
# - Groups of hosts are delimited by [header] elements
|
||||||
|
# - You can enter hostnames or ip addresses
|
||||||
|
# - A hostname/ip can be a member of multiple groups
|
||||||
|
#
|
||||||
|
# In the /etc/ansible/hosts file u have to enter [cnos_vlan_sample] tag
|
||||||
|
# Following you should specify IP Adresses details
|
||||||
|
# Please change <username> and <password> with appropriate value for your switch.
|
||||||
|
|
||||||
|
[cnos_vlan_sample]
|
||||||
|
10.241.107.39 username=<username> password=<password> deviceType=g8272_cnos
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# This contain sample template execution task
|
||||||
|
---
|
||||||
|
- name: Test Vlan - Create a vlan, name it
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data1}}"
|
||||||
|
- name: Test Vlan - Create a vlan, Flood configuration
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data2}}"
|
||||||
|
- name: Test Vlan - Create a vlan, State configuration
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data3}}"
|
||||||
|
- name: Test Vlan - VLAN Access map1
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}'
|
||||||
|
with_items: "{{cnos_vlan_data4}}"
|
||||||
|
- name: Test Vlan - VLAN Accep Map2
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}'
|
||||||
|
with_items: "{{cnos_vlan_data5}}"
|
||||||
|
- name: Test Vlan - ip igmp snooping query interval
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}'
|
||||||
|
with_items: "{{cnos_vlan_data6}}"
|
||||||
|
- name: Test Vlan - ip igmp snooping last member query interval
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}'
|
||||||
|
with_items: "{{cnos_vlan_data7}}"
|
||||||
|
- name: Test Vlan - ip igmp snooping mrouter interface port-aggregation
|
||||||
|
cnos_vlan: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} outputfile=./results/cnos_vlan_{{ inventory_hostname }}_output.txt vlanArg1='{{item.vlanArg1}}' vlanArg2='{{item.vlanArg2}}' vlanArg3='{{item.vlanArg3}}' vlanArg4='{{item.vlanArg4}}' vlanArg5='{{item.vlanArg5}}'
|
||||||
|
with_items: "{{cnos_vlan_data8}}"
|
||||||
|
- name: Idempotent Command
|
||||||
|
cnos_command: host={{ inventory_hostname }} username={{ hostvars[inventory_hostname]['username']}} password={{ hostvars[inventory_hostname]['password']}} deviceType={{ hostvars[inventory_hostname]['deviceType']}} clicommand='{{item.clicommand}}' outputfile=./results/cnos_command_{{ inventory_hostname }}_output.txt
|
||||||
|
with_items: "{{cnos_vlan_data9}}"
|
||||||
|
# Completed file
|
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
cnos_vlan_data1:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "name", vlanArg3: "anil"}
|
||||||
|
cnos_vlan_data2:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "flood", vlanArg3: "ipv4"}
|
||||||
|
cnos_vlan_data3:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "state", vlanArg3: "active"}
|
||||||
|
cnos_vlan_data4:
|
||||||
|
- {vlanArg1: "access-map", vlanArg2: "anil", vlanArg3: "statistics"}
|
||||||
|
cnos_vlan_data5:
|
||||||
|
- {vlanArg1: "access-map", vlanArg2: "anil", vlanArg3: "action", vlanArg4: "forward"}
|
||||||
|
cnos_vlan_data6:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "ip", vlanArg3: "query-interval", vlanArg4: 1313}
|
||||||
|
cnos_vlan_data7:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "ip", vlanArg3: "last-member-query-interval", vlanArg4: 23}
|
||||||
|
cnos_vlan_data8:
|
||||||
|
- {vlanArg1: 13, vlanArg2: "ip", vlanArg3: "mrouter", vlanArg4: "port-aggregation", vlanArg5: 23}
|
||||||
|
cnos_vlan_data9:
|
||||||
|
- {clicommand: "no vlan 13"}
|
Loading…
Reference in New Issue