Improve generic Info::Layer3 serial number detection
Serial numbers weren't reported for stackable Layer3::H3C devices, even when not actually stacked. Report serial number not only if the entity has no parent, but also if it has a parent but is of type "chassis". This fixes #232.
This commit is contained in:
@@ -196,10 +196,13 @@ sub serial {
|
||||
|
||||
my $serial1 = $l3->serial1();
|
||||
my $e_parent = $l3->e_parent() || {};
|
||||
my $e_class = $l3->e_class() || {};
|
||||
|
||||
foreach my $iid ( keys %$e_parent ) {
|
||||
my $parent = $e_parent->{$iid};
|
||||
if ( $parent eq '0' ) {
|
||||
my $class = $e_class->{$iid} || '';
|
||||
# Only consider serial numbers for entries without a parent, or if they are of type "chassis"
|
||||
if ( $parent eq '0' or $class eq 'chassis') {
|
||||
my $serial = $l3->e_serial($iid);
|
||||
if ( $serial && $serial->{$iid} ) {
|
||||
return $serial->{$iid};
|
||||
|
||||
Reference in New Issue
Block a user