add i_subinterfaces to Layer3
This commit is contained in:
@@ -201,7 +201,7 @@ sub i_vlan {
|
|||||||
|
|
||||||
sub i_subinterfaces {
|
sub i_subinterfaces {
|
||||||
my $vtp = shift;
|
my $vtp = shift;
|
||||||
my %i_subs = ();
|
my %i_subs = %{ $vtp->SUPER::i_subinterfaces() || {} };
|
||||||
|
|
||||||
# CISCO-VLAN-IFTABLE-RELATION-MIB
|
# CISCO-VLAN-IFTABLE-RELATION-MIB
|
||||||
# Used for traditional Cisco Routers and Aironet
|
# Used for traditional Cisco Routers and Aironet
|
||||||
|
|||||||
@@ -277,6 +277,30 @@ sub model {
|
|||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub i_subinterfaces {
|
||||||
|
my $dev = shift;
|
||||||
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $ifstack = $dev->i_stack_status() || {};
|
||||||
|
# TODO: if we want to do partial, we need to use inverse status
|
||||||
|
my $iftype = $dev->i_type() || {};
|
||||||
|
|
||||||
|
my $ret = $dev->SUPER::i_subinterfaces() || {};
|
||||||
|
|
||||||
|
foreach my $idx ( keys %$ifstack ) {
|
||||||
|
next unless $ifstack->{$idx} eq 'active';
|
||||||
|
|
||||||
|
my ( $higher, $lower ) = split /\./, $idx;
|
||||||
|
next if ( $higher == 0 or $lower == 0 );
|
||||||
|
|
||||||
|
if ( $iftype->{ $higher } eq 'l2vlan' or $iftype->{ $higher } eq 'l3ipvlan') {
|
||||||
|
push @{ $ret->{ $lower } }, $higher;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
sub i_name {
|
sub i_name {
|
||||||
my $l3 = shift;
|
my $l3 = shift;
|
||||||
my $partial = shift;
|
my $partial = shift;
|
||||||
@@ -611,6 +635,22 @@ name.
|
|||||||
|
|
||||||
Only returns those iids that have a description listed in $l3->i_description()
|
Only returns those iids that have a description listed in $l3->i_description()
|
||||||
|
|
||||||
|
=item $l3->i_subinterfaces()
|
||||||
|
|
||||||
|
Returns reference to hash of arrays: key = C<ifIndex>, value = array of
|
||||||
|
C<ifIndex>. These are the VLAN subinterfaces (C<l2vlan> type) for the parent
|
||||||
|
(C<ethernetCsmacd> type) interface.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
my $interfaces = $l3->interfaces();
|
||||||
|
my $i_subs = $l3->i_subinterfaces();
|
||||||
|
|
||||||
|
foreach my $iid (sort keys %$interfaces) {
|
||||||
|
my $port = $interfaces->{$iid};
|
||||||
|
my $subs = join(',', sort(map {$interfaces->{$_}} @{$i_subs->{$iid}}));
|
||||||
|
print "Port: $port has subinterfaces: $subs\n";
|
||||||
|
}
|
||||||
|
|
||||||
=item $l3->i_name()
|
=item $l3->i_name()
|
||||||
|
|
||||||
Returns reference to hash of iid to human set name.
|
Returns reference to hash of iid to human set name.
|
||||||
|
|||||||
Reference in New Issue
Block a user