additional debug and logic fixes in handling of remote_is_discoverable

This commit is contained in:
Oliver Gorwits
2022-06-03 21:43:24 +01:00
parent aa4ca704de
commit 46c535e873
3 changed files with 34 additions and 18 deletions

View File

@@ -85,16 +85,32 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
my $remote_cap = $c_cap->{$idx} || [];
my $remote_type = Encode::decode('UTF-8', $c_platform->{$idx} || '');
$properties{ $port }->{remote_is_wap} = 'true'
if scalar grep {match_to_setting($_, 'wap_capabilities')} @$remote_cap
or match_to_setting($remote_type, 'wap_platforms');
$properties{ $port }->{remote_is_wap} = 'false';
$properties{ $port }->{remote_is_phone} = 'false';
$properties{ $port }->{remote_is_discoverable} = 'true';
$properties{ $port }->{remote_is_phone} = 'true'
if scalar grep {match_to_setting($_, 'phone_capabilities')} @$remote_cap
or match_to_setting($remote_type, 'phone_platforms');
if (scalar grep {match_to_setting($_, 'wap_capabilities')} @$remote_cap
or match_to_setting($remote_type, 'wap_platforms')) {
$properties{ $port }->{remote_is_discoverable} = 'false'
unless is_discoverable($device_ports->{$port}->remote_ip, $remote_type, $remote_cap);
$properties{ $port }->{remote_is_wap} = 'true';
debug sprintf ' [%s] properties/lldpcap - remote on port %s is a WAP',
$device->ip, $port;
}
if (scalar grep {match_to_setting($_, 'phone_capabilities')} @$remote_cap
or match_to_setting($remote_type, 'phone_platforms')) {
$properties{ $port }->{remote_is_phone} = 'true';
debug sprintf ' [%s] properties/lldpcap - remote on port %s is a Phone',
$device->ip, $port;
}
if (! is_discoverable($device_ports->{$port}->remote_ip, $remote_type, $remote_cap)) {
$properties{ $port }->{remote_is_discoverable} = 'false';
debug sprintf ' [%s] properties/lldpcap - remote on port %s is denied discovery',
$device->ip, $port;
}
next unless scalar grep {defined && m/^inventory$/} @{ $rem_media_cap->{$idx} };