#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:
@@ -235,6 +235,13 @@ sub store_node {
|
||||
$now ||= 'LOCALTIMESTAMP';
|
||||
$vlan ||= 0;
|
||||
|
||||
# ideally we just store the first 36 bits of the mac in the oui field
|
||||
# and then no need for this query. haven't yet worked out the SQL for that.
|
||||
my $oui = schema('netdisco')->resultset('Manufacturer')
|
||||
->search({ range => { '@>' =>
|
||||
\[q{('x' || lpad( translate( ? ::text, ':', ''), 16, '0')) ::bit(64) ::bigint}, $mac]} },
|
||||
{ rows => 1, columns => 'base' })->first;
|
||||
|
||||
schema('netdisco')->txn_do(sub {
|
||||
my $nodes = schema('netdisco')->resultset('Node');
|
||||
|
||||
@@ -257,7 +264,7 @@ sub store_node {
|
||||
vlan => $vlan,
|
||||
mac => $mac,
|
||||
active => \'true',
|
||||
oui => substr($mac,0,8),
|
||||
oui => ($oui ? $oui->base : undef),
|
||||
time_last => \$now,
|
||||
(($old != 0) ? (time_recent => \$now) : ()),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user