#1111 Support for OUI28/MA-M and OUI36/MA-S

* new oui importer using IEEE csv for MA-L+M+S

* schema update for new vendor table

* change vendor to manufacturer because Device has a vendor field

* remove oui from manuf table, and update node oui after manuf update

* faster way to bulk update node oui

* switch from using oui table to manufacturer table for vendor lookup

* some other oui cleanup

* faster/scalable way to join a macaddr to manuf table

* remove device.oui support

* update node oui in bulk at end of macsuck run

* correct literal sql instead of bind

* more efficient to get oui base for each mac

* comment better the base lookup in macsuck
This commit is contained in:
Oliver Gorwits
2023-11-14 18:55:54 +00:00
committed by GitHub
parent 7766ce64d1
commit 534a9d9378
26 changed files with 427 additions and 193 deletions

View File

@@ -148,36 +148,36 @@ get '/ajax/content/search/node' => require_login sub {
->search({-and => [@where_mac, @active, @times]}, {
order_by => {'-desc' => 'time_last'},
'+columns' => [
'oui.company',
'oui.abbrev',
'manufacturer.company',
'manufacturer.abbrev',
{ time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" },
{ time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" },
],
join => 'oui'
join => 'manufacturer'
});
my $netbios = schema(vars->{'tenant'})->resultset('NodeNbt')
->search({-and => [@where_mac, @active, @times]}, {
order_by => {'-desc' => 'time_last'},
'+columns' => [
'oui.company',
'oui.abbrev',
'manufacturer.company',
'manufacturer.abbrev',
{ time_first_stamp => \"to_char(time_first, 'YYYY-MM-DD HH24:MI')" },
{ time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')" },
],
join => 'oui'
join => 'manufacturer'
});
my $wireless = schema(vars->{'tenant'})->resultset('NodeWireless')->search(
{ -and => [@where_mac, @wifitimes] },
{ order_by => { '-desc' => 'time_last' },
'+columns' => [
'oui.company',
'oui.abbrev',
'manufacturer.company',
'manufacturer.abbrev',
{
time_last_stamp => \"to_char(time_last, 'YYYY-MM-DD HH24:MI')"
}],
join => 'oui'
join => 'manufacturer'
}
);
@@ -245,14 +245,14 @@ get '/ajax/content/search/node' => require_login sub {
}
# if the user selects Vendor search opt, then
# we'll try the OUI company name as a fallback
# we'll try the manufacturer company name as a fallback
if (param('show_vendor') and not $have_rows) {
$set = schema(vars->{'tenant'})->resultset('NodeIp')
->with_times
->search(
{'oui.company' => { -ilike => ''.sql_match($node)}, @times},
{'prefetch' => 'oui'},
{'manufacturer.company' => { -ilike => ''.sql_match($node)}, @times},
{'prefetch' => 'manufacturer'},
);
++$have_rows if $set->has_rows;
}