Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have an interface in a router, where i need to add multiple services. Ex. ge-3/1/0 can have sub-interfaces from ge-3/1/0.1 to ge-3/1/0.5000. I have 3 services, say x, y z, . X should get values from 1 to $max_x, y should get from $max_x+1 to $max_y and z should be from $max_y+1 to $maxz. Values of X, Y, Z will be specified by the user , which is in a different file . I have used the following logic
if (defined (x) || defined(y) || defined(z) { for ($i = 1; $i<=$max_x ; $i++) { $router cmd ( set interface ge-3/1/0.$i ) if ($i == $max_x) { break; } if (defined(y) { for ($i = $max_x+1; $i<=$max_y ; $i++) { $router cmd ( set interface ge-3/1/0.$i ) if ($i == $max_y) { break; } }}
Code is not assigning correct values . anything missing here
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Identify values from variables
by kroach (Pilgrim) on Dec 26, 2015 at 18:22 UTC | |
|
Re: Identify values from variables
by Athanasius (Archbishop) on Dec 27, 2015 at 03:34 UTC |