blob: 7fbebef9df9918551c52e23e139fde3a6f6af881 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#! /usr/bin/perl
# vim:ts=8:sw=8
use CGI qw(fatalsToBrowser);
use DBI;
use lib '/opt/gondul/include';
use nms;
use nms::web;
use strict;
use warnings;
use Data::Dumper;
my $target = $ENV{REQUEST_URI};
$target =~ s/$ENV{SCRIPT_NAME}//;
$target =~ s/^\///;
my ($switch, $port) = split(/\//,$target,2);
my $q2;
$nms::web::cc{'max-age'} = "5";
$nms::web::cc{'stale-while-revalidate'} = "30";
$q2 = $nms::web::dbh->prepare('SELECT distro_name,sysname,subnet4,subnet6,traffic_vlan,distro_phy_port FROM switches WHERE placement is not null AND distro_name is not null AND distro_phy_port is not null and deleted = false');
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
my $sysname = $ref->{'sysname'};
my $distro = $ref->{'distro_name'};
$nms::web::json{'distros'}{$distro}{$sysname} = $ref;
}
finalize_output();
|