Is it possible to do a script that outputs 2 looped variables with the below
i input 10,20 and data,voice and get
vlan 10
name data
vlan 20
name voice
The closest i have been able to come is the below
script ConfigureVLANCisco (
NCM.Nodes @ContextNode,
string [] @vlans,
string [] @vlansname )
{
CLI
configure terminal
}
foreach (@vlan in @vlans)
foreach (@name in @vlansname)
vlan @vlan
name @name
which outputs
any help is appreciated.
Hi
If your VLAN IDs and names are static, just do:
NCM.Nodes @ContextNode
name Data
name Voice
If you want to be able modify VLAN ID and name, do this:
.PARAMETER_LABEL @VLANidVLAN ID.PARAMETER_DESCRIPTION @VLANidWhat is the ID of the VLAN being created?.
.PARAMETER_LABEL @VLANnameVLAN Name.PARAMETER_DESCRIPTION @VLANnameWhat is the name of the VLAN being created?.
*/
script UpdateTimeZoneCiscoIOS (NCM.Nodes @ContextNode,int[] @VLANid,string @VLANname) {
CLI {
configure terminalvlan @VLANidname @VLANname
}}
neither variable is static, i need both variables to be whatever the user inputs. Also without a foreach loop in your script the variables just spit out
System.Collections.Generic.List`1[System.String]
so i updated the script to the below
/*
.PARAMETER_LABEL @VLANidVLAN IDPARAMETER_DESCRIPTION @VLANidWhat is the ID of the VLAN being created?
.PARAMETER_LABEL @VLANnameVLAN NamePARAMETER_DESCRIPTION @VLANnameWhat is the name of the VLAN being created?
script CiscoIOS (NCM.Nodes @ContextNode,int[] @VLANid,string[] @VLANname) {{CLI{configure terminal}}{
foreach (@vlan in @VLANid)foreach (@name in @VLANname)
configure terminalvlan @vlanname @name
}}}
and now the result is the below which is still not what i am looking for
again i want the user to input multiple items for 2 variables to output the below (input example is 10,20 and data,voice but these are not static can be any number and any string)