I am trying to create a template that our corporate help desk can use to clear port security on ports of our user switches. The script validates fine but when I test it nothing seems to happen on the switch port I am testing against. I have also created a script that performs a no shut on selected interfaces and have the same problem. Has anybody already created these scripts? If anybody would care to troubleshoot the script I created I have listed it below.
/*
.CHANGE_TEMPLATE_DESCRIPTION
This change template clears switch port security on selected ports for switches running Cisco IOS.
.CHANGE_TEMPLATE_TAGS
Cisco, IOS, switch port security
.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 @TartgetPorts
Select port(s)
.PARAMETER_DESCRIPTION @TargetPorts
Select the port(s) for which you would like to clear port security.
*/
script BaseChangeTemplate(
NCM.Nodes @ContextNode,
NCM.Interfaces[] @TargetPorts )
{
// Enter configuration mode
CLI
{
configure terminal
}
// Loop through selected ports
foreach (@interfaceItem in @ContextNode.Interfaces)
{
// clear port security
{
//Send these CLI commands
CLI
{
clear port-security dynamic interface @PortItem.InterfaceDescription
}
}
CLI
{
exit
}
}
// Exit configuration mode
CLI
{
exit
}