I am working on a config change template on a Juniper SRX device where rather than needing the devices WAN IP, I need the network address IP which is -1 digit in the 4th Octet, i.e. the WAN IP is 209.41.64.14 but the IP address I need in the command is 208.41.64.13. I have created a script where I can get the WAN IP (209.41.64.14), but cannot think of a way to the get to the -1 IP for the network address (209.41.64.13). Is there any way to accomplish this in SW?
Current script:
/*
.CHANGE_TEMPLATE_DESCRIPTION
.CHANGE_TEMPLATE_TAGS
JUNIPER, SRX, JUNOS
.PLATFORM_DESCRIPTION
JUNIPER, SRX, JUNOS
.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 UpdateNTP (
NCM.Nodes @ContextNode )
{
// Only select Juniper devices
foreach ( @node in @ContextNode )
{
if ( @node.MachineType Contains 'SRX100H2' )
//ONLY SELECT SRX100 DEVICES
{
// Set NTP Server and Static Route
CLI
{
configure
set system ntp server 164.92.5.6
set routing-options static route 164.92.5.6/32 next-hop @node.AgentIP
}
CLI
{
commit
exit
}
}
}
}
RETURN:
configure
set system ntp server 164.92.5.6
set routing-options static route 164.92.5.6/32 next-hop 209.41.64.14 (NEED THIS TO BE 209.41.64.13)
commit
exit
Thank you,
Justin M.