#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

@@ -8,15 +8,15 @@ __PACKAGE__->load_components(qw/
+App::Netdisco::DB::ExplicitLocking
/);
my $order_by_time_last_and_join_oui = {
my $order_by_time_last_and_join_manufacturer = {
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'
};
=head1 with_times
@@ -38,7 +38,7 @@ sub with_times {
my ($rs, $cond, $attrs) = @_;
return $rs
->search_rs({}, $order_by_time_last_and_join_oui)
->search_rs({}, $order_by_time_last_and_join_manufacturer)
->search($cond, $attrs);
}
@@ -69,7 +69,7 @@ preformatted timestamps of the C<time_first> and C<time_last> fields.
=item *
A JOIN is performed on the OUI table and the OUI C<company> column prefetched.
A JOIN is performed on the Manufacturer table and the Manufacturer C<company> column prefetched.
=back
@@ -93,7 +93,7 @@ sub search_by_ip {
$cond->{ip} = { $op => $ip };
return $rs
->search_rs({}, $order_by_time_last_and_join_oui)
->search_rs({}, $order_by_time_last_and_join_manufacturer)
->search($cond, $attrs);
}
@@ -137,7 +137,7 @@ preformatted timestamps of the C<time_first> and C<time_last> fields.
=item *
A JOIN is performed on the OUI table and the OUI C<company> column prefetched.
A JOIN is performed on the Manufacturer table and the Manufacturer C<company> column prefetched.
=back
@@ -183,7 +183,7 @@ sub search_by_dns {
delete $cond->{suffix};
return $rs
->search_rs({}, $order_by_time_last_and_join_oui)
->search_rs({}, $order_by_time_last_and_join_manufacturer)
->search($cond, $attrs);
}
@@ -212,7 +212,7 @@ preformatted timestamps of the C<time_first> and C<time_last> fields.
=item *
A JOIN is performed on the OUI table and the OUI C<company> column prefetched.
A JOIN is performed on the Manufacturer table and the Manufacturer C<company> column prefetched.
=back
@@ -227,7 +227,7 @@ sub search_by_mac {
if ref {} ne ref $cond or !exists $cond->{mac};
return $rs
->search_rs({}, $order_by_time_last_and_join_oui)
->search_rs({}, $order_by_time_last_and_join_manufacturer)
->search($cond, $attrs);
}