Changeset 35
- Timestamp:
- Feb 12, 2008, 1:54:43 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r34 r35 56 56 dotsw => \&cmd_exportsw_dot, 57 57 iplocation => \&cmd_iplocation, 58 'search-mac-on-switch' => \&cmd_search_mac_on_switch, 58 59 ); 59 60 … … 817 818 } 818 819 820 sub cmd_search_mac_on_switch { 821 my $switch_name = shift; 822 my $mac_address = shift; 823 824 my $research = "1.3.6.1.2.1.17.4.3.1.2".arp_hex_to_dec($mac_address); 825 print "Klask search OID $research on switch $switch_name\n"; 826 827 my ($session, $error) = Net::SNMP->session( -hostname => $switch_name ); 828 print "$error \n" if $error; 829 830 my $result = $session->get_request( 831 -varbindlist => [$research] 832 ); 833 834 if (not defined($result) or $result->{$research} eq 'noSuchInstance') { 835 print "Klask do not find MAC $mac_address on switch $switch_name\n"; 836 $session->close; 837 } 838 839 my $swport = $result->{$research}; 840 $session->close; 841 842 print "Klask find MAC $mac_address on switch $switch_name port $swport\n"; 843 } 819 844 820 845 sub cmd_updatesw {
Note: See TracChangeset
for help on using the changeset viewer.