Hi! Im working on this piece of a pussle... We are going to change the configuration on 200+ switches to have the same standard conf, and one part of this is to rename all the interfaces accordingly.
The menu alternatives 1 to 3 works fine. Alternative 4 (change interface description) Im having abit of trouble with. At the moment "access port" and "client port" are the choices to see if it works on a lab switch.
The idea is that the switch makes the changes it self depending on whats previously configured /or not configured. Without me having to add labels for manual input the description on the interfaces.
This is what I have so far:
/*
.CHANGE_TEMPLATE_DESCRIPTION
This change template configures some stuff.
.CHANGE_TEMPLATE_TAGS
Cisco, IOS, QoS, Service Policy, storm-control, error recovery
.PLATFORM_DESCRIPTION
Cisco IOS
.PARAMETER_LABEL @ContextNode
NCM Node
.PARAMETER_DESCRIPTION @ContextNode
The node the template will operate on. All templates require this by default.
The target node is selected during the first part of the wizard so it will not be available for selection when defining values of variables.
.PARAMETER_LABEL @TargetPorts
Select port(s)
.PARAMETER_DESCRIPTION @TargetPorts
Select the port(s) for which you would like to configure port-security.
.PARAMETER_LABEL @MenuAlternative
.PARAMETER_DESCRIPTION @MenuAlternative
Select the alternatives to Apply to these devices interfaces
.PARAMETER_DISPLAY_TYPE @MenuAlternative
Listbox:1=Remove QoS|2=Set __________ NTP servers, timezone and summer-time|3=Error recovery|4=Switch port-Secuirty, Max 9 mac-addresses and Storm-control
*/
script ConfigureCiscoIOS (
NCM.Nodes @ContextNode,
string @MenuAlternative )
{
CLI
{
configure terminal
}
if ( @MenuAlternative == 'Remove QoS' )
{
CLI
{
no mls qos
}
}
if ( @MenuAlternative == 'Set __________ NTP servers, timezone and summer-time' )
{
CLI
{
clock timezone CET 1
ntp server x.x.x.x
}
}
if ( @MenuAlternative == 'Error recovery' )
{
CLI
{
errdisable recovery cause udld
errdisable recovery cause bpduguard
errdisable recovery cause security-violation
errdisable recovery cause channel-misconfig (STP)
errdisable recovery cause pagp-flap
errdisable recovery cause dtp-flap
errdisable recovery cause link-flap
errdisable recovery cause sfp-config-mismatch
errdisable recovery cause gbic-invalid
errdisable recovery cause l2ptguard
errdisable recovery cause psecure-violation
errdisable recovery cause port-mode-failure
errdisable recovery cause dhcp-rate-limit
errdisable recovery cause pppoe-ia-rate-limit
errdisable recovery cause mac-limitv
errdisable recovery cause vmps
errdisable recovery cause storm-control
errdisable recovery cause inline-power
errdisable recovery cause arp-inspection
errdisable recovery cause loopback
errdisable recovery cause small-frame
errdisable recovery interval 10
}
}
if ( @MenuAlternative == 'Switch port-Secuirty, Max 9 mac-addresses and Storm-control' )
{
foreach (@interfaceItem in @ContextNode.Interfaces)
{
if (@interfaceItem.InterfaceDescription contains 'Client port')
{
CLI
{
description Client Port
switch port-security
switch port-security maximum 9
storm-control broadcast level 10.00 5.00
storm-control multicast level 10.00 5.00
storm-control action shutdown
storm-control action trap
}
{
if (@interfaceItem.InterfaceDescription contains 'Access port')
{
CLI
{
description Client Port
switch port-security
switch port-security maximum 9
storm-control broadcast level 10.00 5.00
storm-control multicast level 10.00 5.00
storm-control action shutdown
storm-control action trap
}
}
}
// Exit configuration mode
CLI
{
exit
}
}
Not sure if this is possible or not, so would like to hear your thoughts