aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/public/distro-tree
blob: 5d93e1b90ebe21b7554b79751eab90d596d6633f (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
#! /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'} = "20";

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');

$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
	my $sysname = $ref->{'sysname'};
	my $phy = $ref->{'distro_phy_port'};
	my $distro = $ref->{'distro_name'};
	$nms::web::json{'distro-tree'}{$distro}{$phy} = $sysname;
}

finalize_output();