[Netpass-devel] NetPass/bin portinfo.pl,1.1,1.2
Brought to you by:
jeffmurphy
From: jeff m. <jef...@us...> - 2006-01-18 17:01:48
|
Update of /cvsroot/netpass/NetPass/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14183/bin Modified Files: portinfo.pl Log Message: bug #1409203 Index: portinfo.pl =================================================================== RCS file: /cvsroot/netpass/NetPass/bin/portinfo.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- portinfo.pl 5 Jan 2006 21:02:35 -0000 1.1 +++ portinfo.pl 18 Jan 2006 17:01:30 -0000 1.2 @@ -86,10 +86,17 @@ if (!defined($cn)) { print "Switch community name isn't configured in NetPass. Can't query switch.\n"; } else { + my ($uv, $qv) = $np->cfg->availableVlans(-switch => $s, -port => $p); my $snmp = new SNMP::Device('hostname' => $s, 'snmp_community' => $cn); my $vlans = $snmp->get_vlan_membership($p); - my $vlns = join(',', sort {$a <=> $b} @$vlans); + my $vlns; + foreach my $vl (sort {$a <=> $b} @$vlans) { + $vlns .= $vl; + $vlns .= "(U)" if $vl == $uv; + $vlns .= "(Q)" if $vl == $qv; + $vlns .= " "; + } my $defid = $snmp->get_default_vlan_id($p); my $h = $snmp->get_if_info($p); my ($mp, $pm) = $snmp->get_mac_port_table(); @@ -97,8 +104,11 @@ print "Desc : ", $h->{$p}->{if_descr}, "\n"; print "VLANS : $vlns\n"; - print "PVID : $defid\n"; - print "State : ", ("?", "Down", "Up")[$h->{$p}->{if_status}], "\n"; + print "PVID : $defid"; + print "(U)\n" if $defid == $uv; + print "(Q)\n" if $defid == $qv; + + print "State : ", ("?", "Up", "Down")[$h->{$p}->{if_status}], "\n"; print "Trunk ? ", ("?", "No", "Yes")[$h->{$p}->{vlan_port_type}], "\n"; print "Speed : ", ("?", "10", "100", "1000")[$h->{$p}->{speed}], " Mbps\n"; print "Duplex : ", ("?", "Half", "Full")[$h->{$p}->{duplex}], "\n"; |