blob: 49ce607da163bef4ffd5f4726937672e806e8b05 (
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
|
#! /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;
$nms::web::cc{'max-age'} = "5";
$nms::web::cc{'stale-while-revalidate'} = "30";
my $q2 = $nms::web::dbh->prepare('select sysname,distro_phy_port,distro_name 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'};
my $phy = $ref->{'distro_phy_port'};
$nms::web::json{'distro-tree-phy'}{$distro}{$phy} = $sysname;
$nms::web::json{'distro-tree-sys'}{$distro}{$sysname} = $phy;
}
finalize_output();
|