Quantcast
Channel: THWACK: All Content - Network Configuration Manager
Viewing all articles
Browse latest Browse all 6057

Configuration Template Problem

$
0
0

Hello, I'm trying to create a simple template for changing interface descriptions based on the input of the user. Everything seems to be working except after generating a script when I look to see the commands it properly enters the interface(s) that were selected but the actual description which is in a variable gives an error instead. I'm sure I am making a simplet mistake but wanted to post my example to see where I am going wrong.

 

Script:

 

/*
.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 @TargetPorts
        Select Port(s)
.PARAMETER_DESCRIPTION @TargetPorts
        Select the port(s) for which you would like to change Interface descriptions.

.PARAMETER_LABEL @ItfCommands
        Interface description
.PARAMETER_DESCRIPTION @ItfCommands
        Enter the description for the interfaces selected.
*/

script ChangeInterfaceDescription (   
                                          NCM.Nodes @ContextNode,
                                          NCM.Interfaces[] @TargetPorts,
                                          string[] @ItfCommands         )
{
  // Enter configuration mode
  CLI
  {
    configure terminal
  }

  foreach (@portItem in @TargetPorts)
  {

          CLI
          {
             interface @TargetPorts.InterfaceDescription
          }

          CLI
          {
            description @ItfCommands
          }
          CLI
          {
             exit
          }
  }
}


Viewing all articles
Browse latest Browse all 6057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>