#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:
21
share/schema_versions/App-Netdisco-DB-84-85-PostgreSQL.sql
Normal file
21
share/schema_versions/App-Netdisco-DB-84-85-PostgreSQL.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
BEGIN;
|
||||
|
||||
UPDATE node SET oui = NULL;
|
||||
|
||||
ALTER TABLE node ALTER COLUMN oui TYPE varchar(9);
|
||||
|
||||
CREATE TABLE manufacturer (
|
||||
"company" text NOT NULL,
|
||||
"abbrev" text NOT NULL,
|
||||
"base" text NOT NULL,
|
||||
"bits" integer NOT NULL,
|
||||
"first" macaddr NOT NULL,
|
||||
"last" macaddr NOT NULL,
|
||||
"range" int8range NOT NULL,
|
||||
PRIMARY KEY ("base"),
|
||||
EXCLUDE USING GIST (range WITH &&)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_manufacturer_first_last ON manufacturer ("first", "last" DESC);
|
||||
|
||||
COMMIT;
|
||||
@@ -406,10 +406,10 @@
|
||||
[% END %]
|
||||
)
|
||||
[% END %]
|
||||
[% IF params.n_vendor AND node.oui.defined %]
|
||||
[% IF params.n_vendor AND node.manufacturer.defined %]
|
||||
(Vendor:
|
||||
[% FOREACH oui IN node.oui %]
|
||||
<a href="[%+ uri_for('/report/nodevendor') %]?vendor=[% oui.abbrev | uri %]">[% oui.abbrev | html_entity %]</a>
|
||||
[% FOREACH manufacturer IN node.manufacturer %]
|
||||
<a href="[%+ uri_for('/report/nodevendor') %]?vendor=[% manufacturer.abbrev | uri %]">[% manufacturer.abbrev | html_entity %]</a>
|
||||
[% END %]
|
||||
)
|
||||
[% END %]
|
||||
|
||||
@@ -40,9 +40,9 @@ $(document).ready(function() {
|
||||
return '<a href="[% search_node | none %]&q=' + encodeURIComponent(data) + '">' + he.encode(data.toUpperCase()) + icon + '</a>';
|
||||
}
|
||||
}, {
|
||||
"data": 'oui.abbrev',
|
||||
"data": 'manufacturer.abbrev',
|
||||
"render": function(data, type, row, meta) {
|
||||
return '<a href="[% uri_for('/report/nodevendor') | none %]?vendor=' + encodeURIComponent(row.oui.abbrev || 'blank') + '">' + he.encode(row.oui.company ||'(Unknown Vendor)') + '</a>';
|
||||
return '<a href="[% uri_for('/report/nodevendor') | none %]?vendor=' + encodeURIComponent(row.manufacturer.abbrev || 'blank') + '">' + he.encode(row.manufacturer.company ||'(Unknown Vendor)') + '</a>';
|
||||
}
|
||||
}, {
|
||||
"data": 'switch',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[% FOREACH row IN results %]
|
||||
[% mylist = [] %]
|
||||
[% device = row.device.dns || row.device.name || row.switch %]
|
||||
[% FOREACH col IN [ row.mac.upper row.oui.company device row.port ] %]
|
||||
[% FOREACH col IN [ row.mac.upper row.manufacturer.company device row.port ] %]
|
||||
[% mylist.push(col) %]
|
||||
[% END %]
|
||||
[% CSV.dump(mylist) %]
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% row.net_mac.$mac_format_call | uri %]">
|
||||
[% row.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% row.oui.abbrev | uri %]">
|
||||
[% row.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% row.manufacturer.abbrev | uri %]">
|
||||
[% row.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = row %]
|
||||
@@ -40,8 +40,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% row.net_mac.$mac_format_call | uri %]">
|
||||
[% row.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% row.oui.abbrev | uri %]">
|
||||
[% row.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% row.manufacturer.abbrev | uri %]">
|
||||
[% row.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = row %]
|
||||
@@ -63,8 +63,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% nbt.net_mac.$mac_format_call | uri %]">
|
||||
[% nbt.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% nbt.oui.abbrev | uri %]">
|
||||
[% nbt.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% nbt.manufacturer.abbrev | uri %]">
|
||||
[% nbt.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = nbt %]
|
||||
@@ -84,8 +84,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% ni.net_mac.$mac_format_call | uri %]">
|
||||
[% ni.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% ni.oui.abbrev | uri %]">
|
||||
[% ni.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% ni.manufacturer.abbrev | uri %]">
|
||||
[% ni.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = ni %]
|
||||
@@ -107,8 +107,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% node.net_mac.$mac_format_call | uri %]">
|
||||
[% node.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% node.oui.abbrev | uri %]">
|
||||
[% node.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% node.manufacturer.abbrev | uri %]">
|
||||
[% node.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = node %]
|
||||
@@ -131,8 +131,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% wlan.net_mac.$mac_format_call | uri %]">
|
||||
[% wlan.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% wlan.oui.abbrev | uri %]">
|
||||
[% wlan.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% wlan.manufacturer.abbrev | uri %]">
|
||||
[% wlan.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = wlan %]
|
||||
@@ -156,8 +156,8 @@
|
||||
<td>MAC <a href="[% search_node | none %]&q=[% nodeip.net_mac.$mac_format_call | uri %]">
|
||||
[% nodeip.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% nodeip.oui.abbrev | uri %]">
|
||||
[% nodeip.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% nodeip.manufacturer.abbrev | uri %]">
|
||||
[% nodeip.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = nodeip %]
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
MAC <a href="[% search_node | none %]&q=[% row.net_mac.$mac_format_call | uri %]">
|
||||
[% row.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% row.oui.abbrev | uri %]">
|
||||
[% row.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% row.manufacturer.abbrev | uri %]">
|
||||
[% row.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = row %]
|
||||
@@ -45,8 +45,8 @@
|
||||
MAC <a href="[% search_node | none %]&q=[% node.net_mac.$mac_format_call | uri %]">
|
||||
[% node.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% node.oui.abbrev | uri %]">
|
||||
[% node.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% node.manufacturer.abbrev | uri %]">
|
||||
[% node.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = node %]
|
||||
@@ -72,8 +72,8 @@
|
||||
<td>
|
||||
MAC <a href="[% search_node | none %]&q=[% port.net_mac.$mac_format_call | uri %]">[% port.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% port.oui.abbrev | uri %]">
|
||||
[% port.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% port.manufacturer.abbrev | uri %]">
|
||||
[% port.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = port %]
|
||||
@@ -95,8 +95,8 @@
|
||||
<td>
|
||||
MAC <a href="[% search_node | none %]&q=[% nbt.net_mac.$mac_format_call | uri %]">[% nbt.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% nbt.oui.abbrev | uri %]">
|
||||
[% nbt.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% nbt.manufacturer.abbrev | uri %]">
|
||||
[% nbt.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = nbt %]
|
||||
@@ -116,8 +116,8 @@
|
||||
<td>
|
||||
MAC <a href="[% search_node | none %]&q=[% wlan.net_mac.$mac_format_call | uri %]">[% wlan.net_mac.$mac_format_call | html_entity %]</a>
|
||||
[% IF params.show_vendor %]
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% wlan.oui.abbrev | uri %]">
|
||||
[% wlan.oui.company | html_entity %]</a> )
|
||||
( <a href="[% uri_for('/report/nodevendor') | none %]?vendor=[% wlan.manufacturer.abbrev | uri %]">
|
||||
[% wlan.manufacturer.company | html_entity %]</a> )
|
||||
[% END %]
|
||||
seen as:
|
||||
[% INCLUDE external_mac_links item = wlan %]
|
||||
|
||||
Reference in New Issue
Block a user