use i_subinterfaces to group vlan subinterfaces like link aggregates in device ports view
This commit is contained in:
@@ -197,6 +197,7 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
|
||||
my $i_vlan = $snmp->i_vlan;
|
||||
my $i_lastchange = $snmp->i_lastchange;
|
||||
my $agg_ports = $snmp->agg_ports;
|
||||
my $i_subs = $snmp->i_subinterfaces;
|
||||
|
||||
# clear the cached uptime and get a new one
|
||||
my $dev_uptime = ($device->is_pseudo ? $snmp->uptime : $snmp->load_uptime);
|
||||
@@ -300,9 +301,10 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
|
||||
type => $i_type->{$entry},
|
||||
vlan => $i_vlan->{$entry},
|
||||
pvid => $i_vlan->{$entry},
|
||||
is_master => 'false',
|
||||
slave_of => undef,
|
||||
lastchange => $lc,
|
||||
has_subinterfaces => 'false',
|
||||
is_master => 'false',
|
||||
slave_of => undef,
|
||||
lastchange => $lc,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -317,6 +319,21 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
|
||||
$interfaces{$master}->{is_master} = 'true';
|
||||
}
|
||||
|
||||
# also for VLAN subinterfaces
|
||||
foreach my $pidx (keys %$i_subs) {
|
||||
my $parent = $interfaces->{$pidx} or next;
|
||||
# parent without subinterfaces?
|
||||
next unless defined $i_subs->{$pidx}
|
||||
and ref [] eq ref $i_subs->{$pidx}
|
||||
and scalar @{ $i_subs->{$pidx} };
|
||||
|
||||
$interfaces{$parent}->{has_subinterfaces} = 'true';
|
||||
foreach my $sidx (@{ $i_subs->{$pidx} }) {
|
||||
my $sub = $interfaces->{$sidx} or next;
|
||||
$interfaces{$sub}->{slave_of} = $parent;
|
||||
}
|
||||
}
|
||||
|
||||
# support for Hooks
|
||||
vars->{'hook_data'}->{'ports'} = [values %interfaces];
|
||||
|
||||
|
||||
@@ -443,8 +443,12 @@ sub walk_fwtable {
|
||||
# possibly move node to lag master
|
||||
if (defined $device_port->slave_of
|
||||
and exists $device_ports->{$device_port->slave_of}) {
|
||||
$port = $device_port->slave_of;
|
||||
$device_ports->{$port}->update({is_uplink => \'true'});
|
||||
$parent = $device_port->slave_of;
|
||||
$device_ports->{$parent}->update({is_uplink => \'true'});
|
||||
|
||||
# VLAN subinterfaces can be set uplink,
|
||||
# but we don't want to move nodes there (so check is_master).
|
||||
$port = $parent if $device_ports->{$parent}->is_master;
|
||||
}
|
||||
|
||||
++$cache->{$vlan}->{$port}->{$mac};
|
||||
|
||||
Reference in New Issue
Block a user