I am trying to create a change template that will look at each interface on a node and capture the IP. I then want to take that IP and apply it to a logging source-interface command only if the interface type is a Loopback. I have the following script to try and do this, but i don't have the scripting experience to know what I am missing.
/*
.CHANGE_TEMPLATE_DESCRIPTION
This change template is used to set the logging source-interface to the loopback interface if there is one.
.CHANGE_TEMPLATE_TAGGS
Logging
.PLATFORM_DESCRIPTION
Cisco IOS
.PARAMETER_LABEL @ContextNode
NCM Node
.PARAMETER_DESCRIPTION @ContextNode
The node the template will operate on.
*/
script LoggingSourceTemplate(NCM.Nodes @ContextNode)
//Loop through selected nodes
{
foreach (@interfaceItem in @ContextNode.Interfaces)
{
foreach(@ip in @interfaceItem.IpAddresses)
{
if (@interfaceItem.InterfaceType == 'Loopback')
{
CLI
{
logging source-interface @ip
}
}
}
}
}
{
↧
NCM config change template for logging source-interface
↧