#!/usr/bin/perl use warnings; use strict; use Getopt::Long; use Acme::Tools qw(between); # Declare Command Line Option's Variables my $Gi_number; my $ref_number; my $get_what; # Declare regular variables my $bundle; my $target_lines; #my $target_name = "target_name"; my @number; my $GInum; my $userGraph; # Process Command-Line Options with the GetOptions::Long Module if ( @ARGV > 0 ) { GetOptions('Gi_number=s' => \$Gi_number, 'ref_number=s' => \$ref_number); } ### Extract the 'Gi' Number (i.e. Gi4 --> '4') and set it to $GInum @number = ($Gi_number =~ /(\d)/); $GInum = $number[0]; &get_bundle(); ### Build the the UserDefined Graph Name for the routers.cgi*Graph[] Line $userGraph = "Bundle-$Gi_number$bundle"; if ($bundle) { $target_lines .= "routers.cgi*Graph[\$target_name]: $userGraph total average active\n"; } else { print "WARNING: No Bundle Letter has been assigned to \$bundle... Try again.\n"; exit 2; } #################################################################################### # SUB - get_bundle() --- This sub will take the interface reference number Gi3/"7" # # which is the '7' and get the corresponding Bundle letters.# #################################################################################### sub get_bundle() { if (between($ref_number, 1, 8)) { $bundle = "A"; } if (between($ref_number, 9, 16)) { $bundle = "B"; } if (between($ref_number, 17, 24)) { $bundle = "C"; } if (between($ref_number, 25, 32)) { $bundle = "D"; } if (between($ref_number, 33, 40)) { $bundle = "E"; } if (between($ref_number, 41, 48)) { $bundle = "F"; } } ################################################################################# ### END: get_bundle() print "$target_lines";