3 Replies Latest reply on Apr 19, 2017 7:37 PM by benea

    NCM Config change template logical OR question

    Jenya

      Hello,

       

      I'm working on my first NCM config change template so sorry if this is a silly question.

       

      My script was working just fine until I decided to optimize it, make it pretty and combine multiple IF statements into one. What I'm trying to do is create a change template for allowing HTTP/ SSH access to our ASAs. Sometimes the commands need to be applied to the inside interface, sometimes to the outside and sometimes the interface was given a random name like wan. So I'm trying to hard-code the value of one variable based on the IP address of the device. I can't figure out if the IF statements support logical OR and what is the correct syntax.

       

      The CLI portion is really simple:

      // Enter configuration mode and generate commands

        CLI

        {

          configure terminal

          http @SourceIP 255.255.255.255 @InterfaceName

          ssh @SourceIP 255.255.255.255 @InterfaceName

          exit

        }

       

      So this works:

      if (@ContextNode.AgentIP == '10.50.100.2')

        {

          @InterfaceName = 'intranet'

        }

      if (@ContextNode.AgentIP == '10.50.100.4')

        {

          @InterfaceName = 'intranet'

        }

       

       

      But this doesn't:

      if ( (@ContextNode.AgentIP == '10.50.100.2')  or  (@ContextNode.AgentIP == '10.50.100.4') )

        {

          @InterfaceName = 'intranet'

        }

       

      What am I missing? What's the proper syntax?