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.

Question – Can NCM replace an octet from an IP address when applying scripts to multiple routers?

Router1 - new config "ip route 192.168.10.10 255.255.255.255 10.1.10.1

I've got a mass deployment of configs to add additional static routes to existing routers and the next hop will be different for each site. Is there a way for NCM to do this?

For example

3 routers

Router1 - new config "ip route 192.168.10.10 255.255.255.255 10.1.10.1

Router2 - new config "ip route 192.168.10.10 255.255.255.255 10.1.20.1

Router3 - new config "ip route 192.168.10.10 255.255.255.255 10.1.30.1

Rather than logging on to a large amount of routers (100+) and making this change manually or creating a job in NCM for each router, which would take about as long as logging on to each of them, I'd like NCM to be able to change the 3rd octet for me.

Any ideas would be appreciated

Cheers

Steve

  • Steve,

    I think you have two possibilities here.

    1. Address for next hop can be somehow derived from e.g. IP of the router.
    2. Address for next hop can't be derived from router information (IP, hostname etc.)

    In both cases, you will need to create a Config Change Template. The general skeleton will look like this (example taken from ):

    script ChangeAccessList (NCM.Nodes @ContextNode)
    {
      string @myip = '10.10.'
      @myip = @myip + @ContextNode.AssetTag        
    here we make the asset tag part of the IP address
      @myip = @myip + '.32'                        
    finish building IP
      CLI                                          
    commands within a CLI block are sent to the device
      {
        configure terminal
        no access-list 112
        access-list 112 remark This is a test
        access-list 112 permit tcp @myip 0.0.0.31 host 123.234.123.234 eq 445      
    include the IP with asset tag info in the access list
      }
    }


    For option 1, second line of the script could look like

    @myip = @myip + @ContextNode.AgentIP

    (See Orion Network Configuration Manager Administrator Guide for full list of variables that you can use.)


    For option 2, you'll have to define a custom property (AssetTag in the example), define the for each device and then use it in the same way as above. I strongly suggest reading the blog mentioned above.


    Regards,

    Jiri

  • Steve,

    Looking back at my answer, there is a obvious nonsense:

    @myip = @myip + @ContextNode.AgentIP

    Of course you need only a certain octet from that IP address.

    This is possible with the upcoming NCM 7.1 -- you can even download the release candidate now, if you have active maintenance for NCM.

    The Config Change Templates have been extended with a few string manipulation functions and

    string SetOctet(string ipAddr, int octetPosition, string octet)

    is one of them.

    Example:

    Input parameters:

         string @ipaddress       ---> ‘10.10.10.10’

         int[] @indexes          ---> 1,22,222

    CCT script:

    script Test(string @ipaddress, int[] @indexes)

    {

    string @ipnew

    foreach(@id in @indexes)

        {

          @ipnew = setoctet(@ipaddress,3,@id)

          CLI

            {

               Allow @ipnew out

               Allow @ipnew UDP 2055 OUT

            }

        }

    }

    Output:

    Allow 10.10.1.10 out

    Allow 10.10.1.10 UDP 2055 OUT

    Allow 10.10.22.10 out

    Allow 10.10.22.10 UDP 2055 OUT

    Allow 10.10.222.10 out

    Allow 10.10.222.10 UDP 2055 OUT

    If you need further assistance, please provide more details about your use case.

    Regards,

    Jiri