Capture base MAC in L3::Huawei
Capture fan and power supply status in L3::Huawei when description is not available
This commit is contained in:
9
Changes
9
Changes
@@ -4,6 +4,15 @@ Version 3.59
|
||||
|
||||
* #214 SNMP::Info Device models Genua, ATMedia, Liebert
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Capture base MAC in L3::Huawei
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
* Capture fan ans power supply status in L3::Huawei when description is
|
||||
not available
|
||||
|
||||
Version 3.58 (2018-04-29)
|
||||
|
||||
[NEW FEATURES]
|
||||
|
||||
@@ -152,6 +152,12 @@ sub os_ver {
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub mac {
|
||||
my $huawei = shift;
|
||||
|
||||
return $huawei->b_mac();
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $huawei = shift;
|
||||
my $partial = shift;
|
||||
@@ -379,15 +385,19 @@ sub fan {
|
||||
my $fan = $huawei->hw_fan_descr() || {};
|
||||
my $state = $huawei->hw_fan_state() || {};
|
||||
|
||||
if ( scalar keys %$fan ) {
|
||||
if ( scalar keys %$state ) {
|
||||
my @messages = ();
|
||||
|
||||
foreach my $k ( keys %$fan ) {
|
||||
foreach my $k ( keys %$state ) {
|
||||
next if $state->{$k} and $state->{$k} eq 'normal';
|
||||
push @messages, "$fan->{$k}: $state->{$k}";
|
||||
my ($slot, $num) = split(/\./, $k);
|
||||
my $descr = "Slot $slot,Fan $num";
|
||||
$descr = $fan->{$k} if ($fan->{$k});
|
||||
|
||||
push @messages, "$descr: $state->{$k}";
|
||||
}
|
||||
|
||||
push @messages, ( ( scalar keys %$fan ) . " fans OK" )
|
||||
push @messages, ( ( scalar keys %$state ) . " fans OK" )
|
||||
if scalar @messages == 0;
|
||||
|
||||
return ( join ", ", @messages );
|
||||
@@ -406,7 +416,10 @@ sub ps1_status {
|
||||
foreach my $i ( sort keys %$pwr_state ) {
|
||||
my ( $slot, $num ) = split( /\./, $i );
|
||||
next unless $num == 1;
|
||||
$ret .= $s . $pwr_descr->{$i} . ": " . $pwr_state->{$i};
|
||||
my $descr = "Slot $slot,PS $num";
|
||||
$descr = $pwr_descr->{$i} if ($pwr_descr->{$i});
|
||||
|
||||
$ret .= $s . $descr . ": " . $pwr_state->{$i};
|
||||
$s = ", ";
|
||||
}
|
||||
return if ( $s eq "" );
|
||||
@@ -424,7 +437,10 @@ sub ps2_status {
|
||||
foreach my $i ( sort keys %$pwr_state ) {
|
||||
my ( $slot, $num ) = split( /\./, $i );
|
||||
next unless $num == 2;
|
||||
$ret .= $s . $pwr_descr->{$i} . ": " . $pwr_state->{$i};
|
||||
my $descr = "Slot $slot,PS $num";
|
||||
$descr = $pwr_descr->{$i} if ($pwr_descr->{$i});
|
||||
|
||||
$ret .= $s . $descr . ": " . $pwr_state->{$i};
|
||||
$s = ", ";
|
||||
}
|
||||
return if ( $s eq "" );
|
||||
|
||||
@@ -48,6 +48,7 @@ sub setup : Tests(setup) {
|
||||
|
||||
# HUAWEI-MIB::ce6810-48S4Q-EI
|
||||
'_id' => '.1.3.6.1.4.1.2011.2.239.12',
|
||||
'_b_mac' => pack("H*", '0123456789AB'),
|
||||
'_i_index' => 1,
|
||||
'_i_description' => 1,
|
||||
'_i_mtu' => 1,
|
||||
@@ -179,6 +180,17 @@ sub model : Tests(2) {
|
||||
is($test->{info}->model(), 'ce6810-48S4Q-EI', q(Model translates id));
|
||||
}
|
||||
|
||||
sub mac : Tests(3) {
|
||||
my $test = shift;
|
||||
|
||||
can_ok($test->{info}, 'mac');
|
||||
is($test->{info}->mac(), '01:23:45:67:89:ab',
|
||||
q(Base MAC has expected value ));
|
||||
|
||||
$test->{info}->clear_cache();
|
||||
is($test->{info}->mac(), undef, q(No data returns undef));
|
||||
}
|
||||
|
||||
sub i_ignore : Tests(3) {
|
||||
my $test = shift;
|
||||
|
||||
@@ -367,7 +379,7 @@ sub peth_port_neg_power : Tests(3) {
|
||||
{}, q(No data returns empty hash));
|
||||
}
|
||||
|
||||
sub fan : Tests(4) {
|
||||
sub fan : Tests(5) {
|
||||
my $test = shift;
|
||||
|
||||
can_ok($test->{info}, 'fan');
|
||||
@@ -376,6 +388,13 @@ sub fan : Tests(4) {
|
||||
|
||||
is($test->{info}->fan(), $expected, q(Fan returns expected value));
|
||||
|
||||
# Test missing fan description
|
||||
delete $test->{info}{_hw_fan_descr};
|
||||
$expected = 'Slot 1,Fan 2: abnormal';
|
||||
|
||||
is($test->{info}->fan(),
|
||||
$expected, q(Fan returns expected value without descr));
|
||||
|
||||
# Change abnormal fan state to normal to test alternate message
|
||||
$test->{info}{store}{hw_fan_state}{'1.2'} = 'normal';
|
||||
$expected = '3 fans OK';
|
||||
@@ -386,7 +405,7 @@ sub fan : Tests(4) {
|
||||
is($test->{info}->fan(), undef, q(No data returns undef));
|
||||
}
|
||||
|
||||
sub ps1_status : Tests(3) {
|
||||
sub ps1_status : Tests(4) {
|
||||
my $test = shift;
|
||||
|
||||
can_ok($test->{info}, 'ps1_status');
|
||||
@@ -395,11 +414,18 @@ sub ps1_status : Tests(3) {
|
||||
|
||||
is($test->{info}->ps1_status(), $expected, q(PS1 returns expected value));
|
||||
|
||||
# Test missing fan description
|
||||
delete $test->{info}{_hw_pwr_descr};
|
||||
$expected = 'Slot 1,PS 1: supply, Slot 2,PS 1: unknown';
|
||||
|
||||
is($test->{info}->ps1_status(),
|
||||
$expected, q(PS1 returns expected value without descr));
|
||||
|
||||
$test->{info}->clear_cache();
|
||||
is($test->{info}->ps1_status(), undef, q(No data returns undef));
|
||||
}
|
||||
|
||||
sub ps2_status : Tests(3) {
|
||||
sub ps2_status : Tests(4) {
|
||||
my $test = shift;
|
||||
|
||||
can_ok($test->{info}, 'ps2_status');
|
||||
@@ -408,6 +434,13 @@ sub ps2_status : Tests(3) {
|
||||
|
||||
is($test->{info}->ps2_status(), $expected, q(PS2 returns expected value));
|
||||
|
||||
# Test missing fan description
|
||||
delete $test->{info}{_hw_pwr_descr};
|
||||
$expected = 'Slot 1,PS 2: notSupply';
|
||||
|
||||
is($test->{info}->ps2_status(),
|
||||
$expected, q(PS2 returns expected value without descr));
|
||||
|
||||
$test->{info}->clear_cache();
|
||||
is($test->{info}->ps2_status(), undef, q(No data returns undef));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user