Hi,
I use the temp from an other post here in this Forum for a repeat command in Loop form.
Here you are the script:
/*
.CHANGE_TEMPLATE_DESCRIPTION
This NCM Configuration Change Template will set a boot variable command to all applicable devices.
.CHANGE_TEMPLATE_TAGS
Cisco, IOS, 3750
.PLATFORM_DESCRIPTION
This runs on IOS devices.
.PARAMETER_LABEL @ipaddress
Device IP address
.PARAMETER_DESCRIPTION @ipaddress
Cisco IOS Image angeben das als Bootvariable gesetzt werden soll. Bsp: c2960s-universalk9-mz.150-2.SE6.bin
.PARAMETER_LABEL @indexes
IP address (Muster) Bsp: 10.10.10.1
.PARAMETER_DESCRIPTION @indexes
IP Range angeben der eingefuegt werden soll (Bsp: 1,2,3,4)
*/
script RELOAD_IOS (
NCM.Nodes @ContextNode,
string @ipaddress, int[] @indexes
)
{
string @ipnew
foreach(@id in @indexes)
{
@ipnew = setoctet(@ipaddress,3,@id)
CLI
{
Allow @ipnew out
Allow @ipnew UDP 2055 OUT
}
}
}
_______________________________________________________________
The Output of this Looks like this:
Allow 10.10.1.1 out
Allow 10.10.1.1 UDP 2055 OUT
Allow 10.10.2.1 out
Allow 10.10.2.1 UDP 2055 OUT
Allow 10.10.32.1 out
Allow 10.10.32.1 UDP 2055 OUT
Allow 10.10.4.1 out
Allow 10.10.4.1 UDP 2055 OUT
________________________________________________________________
This is ok for now. But I often have a Situation to repeat this for 70-90 devices. I dont want to enter the form like "1,2,3,4,...,70" in this used integer variable. I better would use 1-50 for example.
If I enter in this form I get an error that I have to give it in 1,2,3... form.
I know, theres no Chance to use a normal programmer language for this scripts, but how can I fill the integer arrow?
I think about a for while Loop like foreach (for @id <= @STARTIP; id<=@ENDIP; @id++) (this is just my Impression, not the complete code)
Sure I read the doku, but I only found the foreach variable for me.
Thanks for Response.
Otto