Hi,
I use a script (config change template) that changes description of a port based on CDP. It's working great but my domaine name is very long so my description is way to big. It looks like this :
Connected to SWITCHNAME.verylongdomainname.blabla.com on Gigabitethernet4/8
I would like to remove the domain name from the config to something like this :
Connected to SWITCHNAME on Gigabitethernet4/8
How can I remove it with this scritpt ?
Thanks
/*
.CHANGE_TEMPLATE_DESCRIPTION
This template sets an interface description based off of cdp neighbors.
.CHANGE_TEMPLATE_TAGS
Cisco, interface, description, properties
.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.
*/
script ChangeInterfacesBasedOnDescription (
NCM.Nodes @ContextNode
)
{
// Enter configuration mode
CLI
{
configure terminal
}
int @MatchFound
@MatchFound = 0
// Loop through selected interfaces
foreach (@CDPEntry in @ContextNode.CiscoCdp)
{
foreach (@Interface in @ContextNode.Interfaces)
{
if (@Interface.InterfaceIndex == @CDPEntry.ifIndex)
{
// Set command
CLI
{
interface @Interface.InterfaceDescription
}
CLI
{
description @CDPEntry.RemoteDevice on @CDPEntry.RemotePort
}
CLI
{
exit
}
@MatchFound = 1
}
}
}
if (@MatchFound != 1)
{
CLI
{
NO MATCHES FOUND
}
}
// Exit configuration mode
CLI
{
exit
}
}