Note: this is a development view and is for debug purposes only. If has been incorporated into device.html already.
% print Dumper(\%modules);<%args> $ip => '' # Can be IP or hostname %args> <%shared> my %modules = {}; my %printed = {}; my $device; %shared> <%init> #XXX use Data::Dumper; if ($ip) { # Save Search Term my $match = $ip; # Resolve input my $hostname = &hostname($ip); my $ip = &getip($ip); # Check if we're an alias of another device my $devip = &root_device($ip); # redirect to search if no match $m->redirect("device_search.html?text=$match") unless $devip; # Grab Device INFO $device = sql_hash('device', ['ip','extract(epoch from creation) as creation','dns', 'description','uptime','contact','name','location','layers', 'ports','mac','serial','model','ps1_type','ps2_type','ps1_status', 'ps2_status','fan','slots','vendor','log','os_ver','os','vtp_domain', 'extract(epoch from last_discover) as last_discover', 'extract(epoch from last_macsuck) as last_macsuck', 'extract(epoch from last_arpnip) as last_arpnip' ], {'ip'=>$devip}); my $modules = sql_rows('device_module',['*'],{'ip'=>$devip},0,'order by parent,pos,index') || []; foreach my $module (@$modules) { $modules{$module->{index}}{module} = $module; if ($module->{parent}) { # this is wrong. a given parent can # have multiple items at a single pos value. # (HP may have gotten this wrong, but that's # reality...) # # Next wrong: some things have weird pos' # index | description | type | parent | class | pos #-------+----------------------------------------+---------------------+--------+---------+----- # 1 | Cisco Aironet 1200 Series Access Point | cevChassisAIRAP1210 | 0 | chassis | -1 # 3 | PowerPC405GP Ethernet | cevPortFEIP | 1 | port | -1 # 2 | 802.11G Radio | cevPortUnknown | 1 | port | 0 $module->{pos} = 0 if ($module->{pos} < 0); #$m->out(%$module."