diff --git a/Info/CiscoStack.pm b/Info/CiscoStack.pm index 74e2ee22..76b370e6 100644 --- a/Info/CiscoStack.pm +++ b/Info/CiscoStack.pm @@ -214,7 +214,7 @@ sub i_speed_admin { my $partial = shift; my %i_speed_admin; - my $p_port = $stack->p_port(); + my $p_port = $stack->p_port() || {}; my %mapping = reverse %$p_port; my $p_speed = $stack->p_speed( $mapping{$partial} ); diff --git a/Info/Layer1/Bayhub.pm b/Info/Layer1/Bayhub.pm index 16ff1856..e7a1267e 100644 --- a/Info/Layer1/Bayhub.pm +++ b/Info/Layer1/Bayhub.pm @@ -284,7 +284,7 @@ sub set_i_up_admin { my $bayhub = shift; my ( $setting, $iid ) = @_; - my $i_index = $bayhub->i_index(); + my $i_index = $bayhub->i_index() || {}; my %reverse_i_index = reverse %$i_index; $setting = lc($setting); diff --git a/Info/Layer2/C2900.pm b/Info/Layer2/C2900.pm index 8bb2cffc..e309d3e6 100644 --- a/Info/Layer2/C2900.pm +++ b/Info/Layer2/C2900.pm @@ -95,7 +95,7 @@ sub i_duplex { my $partial = shift; my $interfaces = $c2900->interfaces($partial); - my $c2900_p_index = $c2900->c2900_p_index(); + my $c2900_p_index = $c2900->c2900_p_index() || {}; my $c2900_p_duplex = $c2900->c2900_p_duplex(); my %reverse_2900 = reverse %$c2900_p_index; @@ -119,7 +119,7 @@ sub i_duplex_admin { my $partial = shift; my $interfaces = $c2900->interfaces($partial); - my $c2900_p_index = $c2900->c2900_p_index(); + my $c2900_p_index = $c2900->c2900_p_index() || {}; my $c2900_p_admin = $c2900->c2900_p_duplex_admin(); my %reverse_2900 = reverse %$c2900_p_index; @@ -146,8 +146,8 @@ sub set_i_speed_admin { # map speeds to those the switch will understand my %speeds = qw/auto 1 10 10000000 100 100000000/; - my $c2900_p_index = $c2900->c2900_p_index(); - my %reverse_2900 = reverse %$c2900_p_index; + my $c2900_p_index = $c2900->c2900_p_index() || {}; + my %reverse_2900 = reverse %$c2900_p_index; $speed = lc($speed); @@ -166,8 +166,8 @@ sub set_i_duplex_admin { # map a textual duplex to an integer one the switch understands my %duplexes = qw/full 1 half 2 auto 3/; - my $c2900_p_index = $c2900->c2900_p_index(); - my %reverse_2900 = reverse %$c2900_p_index; + my $c2900_p_index = $c2900->c2900_p_index() || {}; + my %reverse_2900 = reverse %$c2900_p_index; $duplex = lc($duplex); diff --git a/Info/Layer3/Passport.pm b/Info/Layer3/Passport.pm index c808ae03..8c6075b2 100644 --- a/Info/Layer3/Passport.pm +++ b/Info/Layer3/Passport.pm @@ -188,7 +188,7 @@ sub interfaces { ) ) { - $vlan_index = $passport->rc_vlan_if(); + $vlan_index = $passport->rc_vlan_if() || {}; %reverse_vlan = reverse %$vlan_index; $vlan_id = $passport->rc_vlan_id(); } diff --git a/Info/MAU.pm b/Info/MAU.pm index 580b88ed..5be2ac92 100644 --- a/Info/MAU.pm +++ b/Info/MAU.pm @@ -170,16 +170,15 @@ sub mau_i_duplex_admin { my $mau = shift; my $partial = shift; - my $mau_index = $mau->mau_index(); - my %rev_mau_index = reverse %$mau_index; - my $mau_autostat - = defined $partial - ? $mau->mau_autostat( $rev_mau_index{$partial} ) - : $mau->mau_autostat(); - my $mau_type_admin - = defined $partial - ? $mau->mau_type_admin( $rev_mau_index{$partial} ) - : $mau->mau_type_admin(); + my $mau_index = $mau->mau_index() || {}; + + if ($partial) { + my %rev_mau_index = reverse %$mau_index; + $partial = $rev_mau_index{$partial}; + } + + my $mau_autostat = $mau->mau_autostat($partial) || {}; + my $mau_type_admin = $mau->mau_type_admin($partial) || {}; # Older HP4000's don't implement ifMauDefaultType, but we can # figure out from ifMauAutoNegCapAdvertised what we'd like.