Submit a ticketCall us

Announcing NCM 7.7
With NCM 7.7, you can examine the rules that make up an access control list for a Cisco ASA device. Then you can apply filters to display only rules that meet the specified criteria, order the rules by line number or by the hit count, and much more.
See new features and improvements.

Home > Success Center > Network Configuration Manager (NCM) > NCM 7.7 Administrator Guide > Config change template details

Config change template details

Created by Caroline Juszczak, last modified by Anthony.Rinaldi_ret on Oct 03, 2016

Views: 53 Votes: 0 Revisions: 5

A config change template named Change VLAN Membership on Ports Cisco IOS installs with SolarWinds NCM. Its purpose is to change VLAN membership on Cisco IOS device ports.

The following sections explain the specific components of a config change template by demonstrating how to use the Change VLAN Membership on Ports Cisco IOS template to make VLAN membership config changes on hypothetical Cisco device interfaces.

Viewed as parsable code, a config change template consists of two parts: parameters and commands. For more information, see Parts of a Config Change Template.

Example

This section assumes that you know how to make VLAN membership changes to device interfaces from the Cisco IOS command line. This section also assumes that you are familiar with using variables, data arrays, foreach loops, if/else conditional statements, and logical operators in creating system administration scripts.

The following sections show the reference template broken up into parameter, command, and output sections.

Parameters

These are the parameters for the Change VLAN Membership on Ports Cisco IOS template. Notice that the parameters already have values associated with them, which are either a string or a variable.

/*
.CHANGE_TEMPLATE_DESCRIPTION
	This change template configures VLAN membership on
	Cisco IOS devices.  The template was verified on
	Cisco 2950 Catalyst Switch running IOS software
	version 12.1(12c).
.CHANGE_TEMPLATE_TAGS
	Cisco, IOS, VLAN Membership
.PLATFORM_DESCRIPTION
	Cisco IOS

.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 VLAN membership.

.PARAMETER_LABEL @VlansToRemove
	VLAN(s) to remove
.PARAMETER_DESCRIPTION @VlansToRemove
	Select the VLAN(s) to remove. Selecting VLANs
	irrelevant to interfaces results in no actions
	taken for those interfaces.

.PARAMETER_LABEL @VlanToAssign
	VLAN to assign
.PARAMETER_DESCRIPTION @VlanToAssign
	Select the VLAN you would like to assign.
*/

Commands

There is one instance of the script command and multiple instances of the CLI{ } command, and all variables have declarations.

script ConfigureVLANmembershipCiscoIOS (    
 NCM.Nodes @ContextNode, 
 NCM.Interfaces[] @TargetPorts, 
 NCM.VLANs[] @VlansToRemove,
 NCM.VLANs @VlanToAssign )
{
 // Enter configuration mode
 CLI 
 { configure terminal }
 
 // Loop through selected ports
 foreach (@portItem in @TargetPorts)
 {
  CLI
  { interface @portItem.InterfaceDescription } 
    
 // Loop through list of vlans to remove
 foreach (@vlanRemove in @VlansToRemove)
 {
  CLI 
   { no switchport access vlan @vlanRemove.VLANID }
 }
  CLI 
   { switchport access vlan @VlanToAssign.VLANID }
  CLI 
   { exit }
 }

 // Exit configuration mode
 CLI
  { exit }
}

Output Commands

These are the commands that NCM executes after logging on to the NCM device(s) selected as the target for this config change template. We are changing VLAN membership on one interface of two different Cisco switches.

NCM Node bgp-2651-03configure terminalinterface FastEthernet0/0no switchport access vlan 1004

switchport access vlan 1002

exitendNCM Node cur-3725Configure terminalinterface FastEthernet0/1no switchport access vlan 1004

switchport access vlan

1002exitend

 

Last modified
14:07, 3 Oct 2016

Tags

Classifications

Public