X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=web%2Fsmanagement.pl;h=de7e1b8d134d4df33b69b99bfae02d59e7c810fd;hb=1e7869f8141084245dcd34fb065f38a418517e7b;hp=ed783b2fa915b245f821f92c9d19675416df061c;hpb=b672cfbe4808f8bea17c32311ab2442bb22407e5;p=nms
diff --git a/web/smanagement.pl b/web/smanagement.pl
index ed783b2..de7e1b8 100755
--- a/web/smanagement.pl
+++ b/web/smanagement.pl
@@ -4,6 +4,7 @@ use strict;
use CGI;
use DBI;
use Data::Dumper;
+use Switch;
use lib '../include';
use nms;
@@ -28,15 +29,15 @@ sub parse_range($) {
my @rangecomma = split(/\s*,\s*/, $switches);
foreach (@rangecomma) {
- my ($first, $drop1, $last, $drop2) = $_ =~ /(e\d+\-[123456])(sw)?\s*\-\s*(e\d+\-[123456])?(sw)?/;
- if (!defined($first) && $_ =~ /e\d+\-[123456]/) {
+ my ($first, $last) = $_ =~ /(e\d+\-(?:sw)?[123456])\s*\-\s*(e\d+\-(?:sw)?[123456])?/;
+ if (!defined($first) && $_ =~ /e\d+\-(sw)?[123456]/) {
$first = $_;
}
if (!defined($first)) {
print "Parse error in: $_
\n";
next;
}
- my ($rowstart, $placestart) = $first =~ /e(\d+)\-([123456])/;
+ my ($rowstart, $placestart) = $first =~ /e(\d+)\-(?:sw)?([123456])/;
if (!defined($rowstart) || !defined($placestart)) {
print "Parse error in: $_
\n";
next;
@@ -47,7 +48,7 @@ sub parse_range($) {
$placeend = $placestart;
}
else {
- ($rowend, $placeend) = $last =~ /e(\d+)\-([123456])/;
+ ($rowend, $placeend) = $last =~ /e(\d+)\-(?:sw)?([123456])/;
}
if (!defined($rowend) || !defined($placeend)) {
print "Parse error in: $_
\n";
@@ -64,7 +65,7 @@ sub parse_range($) {
}
for (my $j = $dostart; $j <= 6; $j++) {
last if ($i == $rowend && $j > $placeend);
- push(@range, "e$i-$j");
+ push(@range, "e$i-sw$j");
}
}
}
@@ -77,9 +78,9 @@ sub parse_range($) {
sub get_addr_from_switchnum($) {
my ($sysname) = @_;
- $sgetip->execute($sysname."sw");
+ $sgetip->execute($sysname);
if ($sgetip->rows() < 1) {
- print "Could not get the ip for: ".$sysname."sw";
+ print "Could not get the ip for: ".$sysname;
return undef;
}
my $row = $sgetip->fetchrow_hashref();