aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly@.no>2016-03-23 10:53:45 +0100
committerKristian Lyngstol <kly@kly@.no>2016-03-23 10:53:45 +0100
commit50a9e3fcb3e8e6f3ec13eebe1da8df7bdf7af45c (patch)
tree091af4cb1a24f97bf60d5ff84acd15119fcb1e06
parent65c8e3fca802155828626898ede0d08beccfe579 (diff)
NMS: Bump location and placement
-rw-r--r--include/nms/util.pm9
-rwxr-xr-xweb/nms.gathering.org/api/public/location4
-rwxr-xr-xweb/nms.gathering.org/api/read/switches-management2
3 files changed, 7 insertions, 8 deletions
diff --git a/include/nms/util.pm b/include/nms/util.pm
index d063bf2..64637b8 100644
--- a/include/nms/util.pm
+++ b/include/nms/util.pm
@@ -15,10 +15,9 @@ sub parse_switch {
'sysname' => "$switch",
'subnet4' => "$subnet4",
'subnet6' => "$subnet6",
- 'mgtmt4' => "$mgtmt4",
- 'mgtmt6' => "$mgtmt6",
- 'lolid' => "$lolid",
- 'ip' => "$mgtmt4",
+ 'mgmt_v4_addr' => "$mgtmt4",
+ 'mgmt_v6_addr' => "$mgtmt6",
+ 'traffic_vlan' => "$lolid",
'distro' => "$distro"
);
%{$ret{'placement'}} = guess_placement($switch);
@@ -91,7 +90,7 @@ sub guess_placement {
$yy -= 20 if ($e >= 79 and $s == 1);
$yy -= 30 if ($e >= 81 and $s == 1);
- } elsif ($name =~ /^sw(\d+)-creativia$/) {
+ } elsif ($name =~ /^creativia(\d+)$/) {
my ($s) = ($1);
$src = "creativia";
$x = 1535;
diff --git a/web/nms.gathering.org/api/public/location b/web/nms.gathering.org/api/public/location
index 6c25ab9..b940007 100755
--- a/web/nms.gathering.org/api/public/location
+++ b/web/nms.gathering.org/api/public/location
@@ -8,7 +8,7 @@ use warnings;
use Data::Dumper;
#my $query = $nms::web::dbh->prepare("select * from switches where '185.110.150.7' << subnet4");
-my $query = $nms::web::dbh->prepare("select * from switches where ? << subnet4");
+my $query = $nms::web::dbh->prepare("select * from switches where ? << subnet4 or ? << subnet6");
print "Cache-Control: max-age=0";
print "Content-Type: text/html";
@@ -20,7 +20,7 @@ print "\n\n";
my @xff = split(",",$ENV{HTTP_X_FORWARDED_FOR});
my $addr = $xff[0] // $ENV{REMOTE_ADDR};
-$query->execute($addr);
+$query->execute($addr,$addr);
# add start html: header + body etc.
print "
diff --git a/web/nms.gathering.org/api/read/switches-management b/web/nms.gathering.org/api/read/switches-management
index 9e12337..4461a90 100755
--- a/web/nms.gathering.org/api/read/switches-management
+++ b/web/nms.gathering.org/api/read/switches-management
@@ -12,7 +12,7 @@ use Data::Dumper;
$nms::web::cc{'max-age'} = "60";
-my $q2 = $nms::web::dbh->prepare('select switch,sysname,mgmt_v4_addr,subnet4,subnet6,mgmt_v6_addr,mgmt_v4_gw,mgmt_v6_gw,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,last_updated from switches where placement is not null');
+my $q2 = $nms::web::dbh->prepare('select switch,sysname,mgmt_v4_addr,subnet4,subnet6,mgmt_v6_addr,mgmt_v4_gw,mgmt_v6_gw,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,last_updated,distro_phy_port from switches where placement is not null');
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {