From 3c32a0eccad66d15b577f6cd44901405f67f9c6b Mon Sep 17 00:00:00 2001 From: hadeshyp Date: Tue, 4 Dec 2012 16:40:31 +0000 Subject: [PATCH] *** empty log message *** --- cts/htdocs/commands/nettrace.pl | 56 +++++++++++++++++++ cts/htdocs/{index.htm => index.html} | 1 + cts/htdocs/layout/styles.css | 32 +++++++++-- cts/htdocs/network/map.htm | 81 ++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 4 deletions(-) create mode 100755 cts/htdocs/commands/nettrace.pl rename cts/htdocs/{index.htm => index.html} (95%) create mode 100644 cts/htdocs/network/map.htm diff --git a/cts/htdocs/commands/nettrace.pl b/cts/htdocs/commands/nettrace.pl new file mode 100755 index 0000000..24472d7 --- /dev/null +++ b/cts/htdocs/commands/nettrace.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl -w +&htsponse(200, "OK"); +print "Content-type: text/html\r\n\r\n"; + + +use Date::Format; +use HADES::TrbNet; +use Data::Dumper; + + if (!defined &trb_init_ports()) { + die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}"); + } + + +my $boards = trb_read_uid(0xffff); +my $types = trb_register_read(0xffff,0x42); +my $ctime = trb_register_read(0xffff,0x40); +my @store; + +foreach my $id (sort keys %{$boards}) { + foreach my $f (sort keys %{$boards->{$id}}) { + my $addr = $boards->{$id}->{$f}; + my @path = trb_nettrace($addr); +# print Dumper @path; + my $o; + if(scalar @path == 0) { + $o->{parent} = 0; + } + else { + $o->{parent} = $path[-1][-1]->{address}; + $o->{port} = $path[-1][-1]->{port}; + } + $o->{ctime} = $ctime->{$addr}; + $o->{type} = $types->{$addr}; + $o->{addr} = $addr; + push (@store,$o); + } + } + + +print printlist(0,1); + +sub printlist { + my ($parent,$layer) = @_; + if($layer > 16) {die "More than 16 layers of network devices found. Aborting."} + my @o; + foreach my $b (@store) { + if ($b->{parent} == $parent) { + push(@o,sprintf("%04x#%d#%d#%04x#%d#%s&",$b->{parent},$b->{port},$layer,$b->{addr},$b->{type},time2str('%Y-%m-%d %H:%M',$b->{ctime}))); $o[-1] .= printlist($b->{addr},$layer+1); + } + } + return join("",sort @o); + } +sprintf("%4s\t%s\t%8s",$a, time2str('%Y-%m-%d %H:%M',hex($t)),$t); + +# parent port layer board type compiletime diff --git a/cts/htdocs/index.htm b/cts/htdocs/index.html similarity index 95% rename from cts/htdocs/index.htm rename to cts/htdocs/index.html index c414c8b..551937d 100644 --- a/cts/htdocs/index.htm +++ b/cts/htdocs/index.html @@ -30,6 +30,7 @@ The main documentation of the network can be found in these two documents:
  • Padiwa
  • Threshold settings
  • GbE status +
  • Network Map diff --git a/cts/htdocs/layout/styles.css b/cts/htdocs/layout/styles.css index 082b64e..2678db7 100644 --- a/cts/htdocs/layout/styles.css +++ b/cts/htdocs/layout/styles.css @@ -179,15 +179,39 @@ width: 89px; #content .checkbox { - - display: block; float:left; margin:0px -15px 2px 0px; - padding:0px -15px 0px 0px; + padding:0px 0px 0px 0px; } .onoffbutton { width:22px; -} \ No newline at end of file +} + +table#content.map td {border-bottom:none; margin-left:10px; text-align:right} +table#content.map td:first-child {text-align:left;padding-left:15px; } +table#content.map td + td + td + td {width:120px;} + +#content .level1 {background:#f5f5f5;} +#content .level2 {background:#eaeaea;} +#content .level3 {background:#dedede;} +#content .level4 {background:#d0d0d0;} +#content .level5 {background:#f5f5f5;} +#content .level6 {background:#eaeaea;} +#content .level7 {background:#dedede;} +#content .level8 {background:#d0d0d0;} +#content .level9 {background:#d0d0d0;} + +#content .level1 > td:first-child { border-left:10px solid #333;} +#content .level2 > td:first-child { border-left:30px solid #333;} +#content .level3 > td:first-child { border-left:50px solid #333;} +#content .level4 > td:first-child { } +#content .level5 > td:first-child { } +#content .level6 > td:first-child { } +#content .level7 > td:first-child { } +#content .level8 > td:first-child { } +#content .level9 > td:first-child { } +#content .newlevel td {border-top:1px solid #aaa;} +/* #content .oldlevel td {border-top-style:hidden;} */ diff --git a/cts/htdocs/network/map.htm b/cts/htdocs/network/map.htm new file mode 100644 index 0000000..d718f87 --- /dev/null +++ b/cts/htdocs/network/map.htm @@ -0,0 +1,81 @@ + + + + + + +Network Map + + + + +

    Network Map

    +
    +
    Configuration +
    +
    +
    + +
    RegisterValues
    + + + + + -- 2.43.0