This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Creating a config template that may (or may not) have multiple IP addresses in it

Greetings SolarWinds Guru's,

I have been looking for and trying to create a template for our OPS team that would allow them to add IP addresses to an object group on the Firewall. This is easy enough if there is only one IP address to add, but sometimes there are two and others possibly three. If I add multiple parameters/Variables NCM will not allow me to move forward if any are left blank. I know that I could write a simple Script and have the OPS team simply fill in the script under Configuration Management, but I was hoping to create something more elegant.

Is what I want to do even possible?

This is what my template looks like now:

/*

.CHANGE_TEMPLATE_DESCRIPTION

        This template is for the addition of hosts to the AllowedIPs object group.

.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 @ObjectGroupName

        This is the name of the object group. network CRS_Report-<TPA Code>

.PARAMETER_DESCRIPTION @ipaddress1

        IP address of the first network-object host

.PARAMETER_LABEL @ipaddress2

        IP address of the second network-object host

.PARAMETER_DESCRIPTION @ipaddress3

        IP address of the third network-object host

*/

script BaseChangeTemplate(  

                             NCM.Nodes @ContextNode,

                             string @ObjectGroupName,

                             string @ipaddress1,

                             string @ipaddress2,

                             string @ipaddress3

                    )

{

  CLI

  {

     configure terminal

     

     object-group network @ObjectGroupName

     network-object host @ipaddress1

     network-object host @ipaddress2

     network-object host @ipaddress2

     object-group network AllowedIPs

     group-object @ObjectGroupName

}

}

Any help would be greatly appreciated.

  • I would imagine this could be possible with a while loop, but I don't believe NCM supports while loops?  I could be wrong. I think perhaps rschroederecklerwr1​ or CourtesyIT​ might have a decent answer for you or may be able to direct you on a way forward.

    Bryan

  • I have not seen it used before quite like that, cnorborg​ may have some thoughts on it.  Might need to use some script management vs config templates. 

  • Ack...I was afraid that the answer would resemble something Similar to that. I have seen it done in Cisco Prime (which was really one of it's only good points), and I was hoping that something similar could be done in SW.  With how I have the script now, We can have the Ops team just fill in 0.0.0.0 (or conversely ! the line out), but that too makes my OCD act up. I really wanted to make this as fool proof as possible, with as little human interaction as possible.

    Here's to hoping one of the other great SW Scripting minds has some further insight.

    thank you both for your thoughts.