feature: Support fdb table on generic devices (#6902)

* feature: support fdb table on generic devices
refactored code to use snmpwalk_group
refactored ajax table code to use joins and reduce extra queries
add indexes for device_id and port_id, drop primary index
Make all columns sortable
Fix a few other small issues

* Add index for vlan_id since that field can be searched by the user

* fix whitespace

* Rename 197.sql to 198.sql

* set row count for table
This commit is contained in:
Tony Murray
2017-06-29 15:03:56 -05:00
committed by Neil Lathwood
parent bda5a4343e
commit e8dd72e8db
12 changed files with 162 additions and 145 deletions

View File

@@ -67,7 +67,7 @@ foreach (dbFetchRows($sql, $param) as $entry) {
$entry = cleanPort($entry);
if (!$ignore) {
if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) {
$error_img = generate_port_link($entry, "<i class='fa fa-flag fa-lg' style='color:red' aria-hidden='true'></i>", port_errors);
$error_img = generate_port_link($entry, "<i class='fa fa-flag fa-lg' style='color:red' aria-hidden='true'></i>", 'port_errors');
} else {
$error_img = '';
}

View File

@@ -1,7 +1,7 @@
<?php
$param = array();
$sql .= ' FROM `ports_fdb` AS F, `ports` AS P, `devices` AS D, `vlans` as V ';
$sql = ' FROM `ports_fdb` AS `F`';
if (is_admin() === false && is_read() === false) {
$sql .= ' LEFT JOIN `devices_perms` AS `DP` ON `D`.`device_id` = `DP`.`device_id`';
@@ -9,15 +9,19 @@ if (is_admin() === false && is_read() === false) {
$param[] = $_SESSION['user_id'];
}
$sql .= " WHERE F.port_id = P.port_id AND P.device_id = D.device_id AND F.vlan_id = V.vlan_id $where ";
$sql .= " LEFT JOIN `ports` AS `P` ON `F`.`port_id`=`P`.`port_id`";
$sql .= " LEFT JOIN `devices` AS `D` ON `F`.`device_id`=`D`.`device_id`";
$sql .= " LEFT JOIN `vlans` AS `V` ON `F`.`vlan_id`=`V`.`vlan_id`";
$sql .= " LEFT JOIN `ipv4_mac` ON `F`.`mac_address`=`ipv4_mac`.`mac_address`";
$sql .= " WHERE 1";
if (is_numeric($_POST['device_id'])) {
$sql .= ' AND P.device_id = ?';
$sql .= ' AND `F`.`device_id`=?';
$param[] = $_POST['device_id'];
}
if (is_numeric($_POST['port_id'])) {
$sql .= ' AND P.port_id = ?';
$sql .= ' AND `F`.`port_id`=?';
$param[] = $_POST['port_id'];
}
@@ -26,13 +30,13 @@ if (isset($_POST['searchPhrase']) && !empty($_POST['searchPhrase'])) {
$mac_search = '%'.str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['searchPhrase'])).'%';
if (isset($_POST['searchby']) && $_POST['searchby'] == 'vlan') {
$sql .= ' AND `vlan_vlan` LIKE ?';
$sql .= ' AND `V`.`vlan_vlan` = ?';
$param[] = $vlan_search;
} elseif (isset($_POST['searchby']) && $_POST['searchby'] == 'mac') {
$sql .= ' AND `mac_address` LIKE ?';
$sql .= ' AND `F`.`mac_address` LIKE ?';
$param[] = $mac_search;
} else {
$sql .= ' AND (`vlan_vlan` LIKE ? OR `mac_address` LIKE ?)';
$sql .= ' AND (`V`.`vlan_vlan` = ? OR `F`.`mac_address` LIKE ?)';
$param[] = $vlan_search;
$param[] = $mac_search;
}
@@ -46,7 +50,7 @@ if (empty($total)) {
}
if (!isset($sort) || empty($sort)) {
$sort = '`hostname` ASC';
$sort = '`F`.`port_id` ASC';
}
$sql .= " ORDER BY $sort";
@@ -60,25 +64,23 @@ if ($rowCount != -1) {
$sql .= " LIMIT $limit_low,$limit_high";
}
$sql = "SELECT *,`P`.`ifDescr` AS `interface`,`V`.`vlan_vlan` $sql";
$sql = "SELECT `P`.*, `ifDescr` AS `interface`, `F`.`mac_address`, `ipv4_mac`.`ipv4_address`, `V`.`vlan_vlan` as `vlan`, `D`.`hostname` AS `device` $sql";
foreach (dbFetchRows($sql, $param) as $entry) {
$entry = cleanPort($entry);
if (!$ignore) {
if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) {
$error_img = generate_port_link($entry, "<i class='fa fa-flag fa-lg' style='color:red' aria-hidden='true'></i>", port_errors);
$error_img = generate_port_link($entry, "<i class='fa fa-flag fa-lg' style='color:red' aria-hidden='true'></i>", 'port_errors');
} else {
$error_img = '';
}
$fdb_host = dbFetchRow('SELECT * FROM ports_fdb AS F, ipv4_mac AS M WHERE F.mac_address = ? AND M.mac_address = F.mac_address', array($entry['mac_address']));
$response[] = array(
'os' => $entry['os'],
'device' => generate_device_link(device_by_id_cache($entry['device_id'])),
'mac_address' => formatMac($entry['mac_address']),
'ipv4_address' => $fdb_host['ipv4_address'],
'hostname' => generate_device_link($entry),
'ipv4_address' => $entry['ipv4_address'],
'interface' => generate_port_link($entry, makeshortif(fixifname(cleanPort($entry['label'])))).' '.$error_img,
'vlan' => $entry['vlan_vlan'],
'vlan' => $entry['vlan'],
);
}//end if

View File

@@ -6,8 +6,8 @@ $no_refresh = true;
<tr>
<th data-column-id="mac_address">MAC address</th>
<th data-column-id="ipv4_address">IPv4 Address</th>
<th data-column-id="interface" data-sortable="false">Port</th>
<th data-column-id="vlan" data-sortable="false">Vlan</th>
<th data-column-id="interface">Port</th>
<th data-column-id="vlan">Vlan</th>
</tr>
</thead>
</table>
@@ -20,7 +20,7 @@ var grid = $("#port-fdb").bootgrid({
{
return {
id: "fdb-search",
device_id: "<?php echo $device['device_id']; ?>"
port_id: "<?php echo $port['port_id']; ?>"
};
},
url: "ajax_table.php"

View File

@@ -7,7 +7,7 @@ $no_refresh = true;
<th data-column-id="mac_address">MAC address</th>
<th data-column-id="ipv4_address">IPv4 Address</th>
<th data-column-id="interface">Port</th>
<th data-column-id="vlan" data-sortable="false">Vlan</th>
<th data-column-id="vlan">Vlan</th>
</tr>
</thead>
</table>

View File

@@ -5,10 +5,9 @@
<table id="fdb-search" class="table table-hover table-condensed table-striped">
<thead>
<tr>
<th data-column-id="hostname" data-order="asc">Device</th>
<th data-column-id="os" data-width="15%">Device OS</th>
<th data-column-id="device" data-order="asc">Device</th>
<th data-column-id="mac_address">MAC Address</th>
<th data-column-id="ipv4_address" data-sortable="false">IPv4 Address</th>
<th data-column-id="ipv4_address">IPv4 Address</th>
<th data-column-id="interface">Port</th>
<th data-column-id="vlan">Vlan</th>
</tr>
@@ -20,6 +19,7 @@
var grid = $("#fdb-search").bootgrid({
ajax: true,
rowCount: [50, 100, 250, -1],
templates: {
header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
"<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\">"+
@@ -32,6 +32,7 @@ var grid = $("#fdb-search").bootgrid({
// Select the devices only with FDB tables
$sql = 'SELECT D.device_id AS device_id, `hostname` FROM `ports_fdb` AS F, `ports` AS P, `devices` AS D';
$param = array();
if (is_admin() === false && is_read() === false) {
$sql .= ' LEFT JOIN `devices_perms` AS `DP` ON `D`.`device_id` = `DP`.`device_id`';
$where .= ' AND `DP`.`user_id`=?';

View File

@@ -1,37 +1,28 @@
<?php
$os_filename = 'includes/discovery/fdb-table/' . $device['os'] . '.inc.php';
// Build a dictionary of vlans in database
$vlans_dict = array();
foreach (dbFetchRows("SELECT `vlan_id`, `vlan_vlan` from `vlans` WHERE `device_id` = ?", array($device['device_id'])) as $vlan_entry) {
$vlans_dict[$vlan_entry['vlan_vlan']] = $vlan_entry['vlan_id'];
}
$vlans_by_id = array_flip($vlans_dict);
if (is_file($os_filename)) {
// Build ifIndex to port_id dictionary
$ifIndex_dict = array();
foreach (dbFetchRows("SELECT `ifIndex`,`port_id` FROM `ports` WHERE `device_id` = ?", array($device['device_id'])) as $port_entry) {
$ifIndex_dict[$port_entry['ifIndex']] = $port_entry['port_id'];
}
// Build table of existing vlan/mac table
$existing_fdbs = array();
$sql_result = dbFetchRows("SELECT * FROM `ports_fdb` WHERE `device_id` = ?", array($device['device_id']));
foreach ($sql_result as $entry) {
$existing_fdbs[$entry['vlan_id']][$entry['mac_address']] = $entry;
}
// Build dot1dBasePort to port_id dictionary
$portid_dict = array();
// Build a dictionary of vlans in database
$vlans_dict = array();
foreach (dbFetchRows("SELECT `vlan_id`, `vlan_vlan` from `vlans` WHERE `device_id` = ?", array($device['device_id'])) as $vlan_entry) {
$vlans_dict[$vlan_entry['vlan_vlan']] = $vlan_entry['vlan_id'];
}
$vlans_by_id = array_flip($vlans_dict);
// Build table of existing vlan/mac table
$existing_fdbs = array();
$sql_result = dbFetchRows("SELECT * FROM `ports_fdb` WHERE `device_id` = ?", array($device['device_id']));
foreach ($sql_result as $entry) {
$existing_fdbs[$entry['vlan_id']][$entry['mac_address']] = $entry;
}
// Include all fdb-table discovery modules
$insert = array();
include $os_filename;
$valid_fdb = array();
$insert = array(); // populate $insert with database entries
if ($device['os'] == 'ios') {
include $config['install_dir'] . '/includes/discovery/fdb-table/ios.inc.php';
} else {
// Check generic Q-BRIDGE-MIB and BRIDGE-MIB
include $config['install_dir'] . '/includes/discovery/fdb-table/bridge.inc.php';
}
if (!empty($insert)) {
// synchronize with the database
foreach ($insert as $vlan_id => $mac_address_table) {
echo " {$vlans_by_id[$vlan_id]}: ";
@@ -42,13 +33,12 @@ if (is_file($os_filename)) {
if ($existing_fdbs[$vlan_id][$mac_address_entry]['port_id'] != $new_port) {
$port_fdb_id = $existing_fdbs[$vlan_id][$mac_address_entry]['ports_fdb_id'];
$valid_fdb[] = $port_fdb_id;
dbUpdate(
array('port_id' => $new_port),
'ports_fdb',
'`ports_fdb_id` = ?',
array($port_fdb_id)
'`device_id` = ? AND `vlan_id` = ? AND `mac_address` = ?',
array($device['device_id'], $vlan_id, $mac_address_entry)
);
echo 'U';
} else {
@@ -63,17 +53,21 @@ if (is_file($os_filename)) {
'device_id' => $device['device_id'],
);
$valid_fdb = dbInsert($new_entry, 'ports_fdb');
dbInsert($new_entry, 'ports_fdb');
echo '+';
}
}
// Delete old entries from the database
foreach ($existing_fdbs[$vlan_id] as $entry) {
dbDelete('ports_fdb', '`ports_fdb_id` = ?', array($entry['ports_fdb_id']));
echo '-';
dbDelete(
'ports_fdb',
'`port_id` = ? AND `mac_address` = ? AND `vlan_id` = ? and `device_id` = ?',
array($entry['port_id'], $entry['mac_address'], $entry['vlan_id'], $entry['device_id'])
);
echo '-';
}
echo PHP_EOL;
}
unset($existing_fdbs, $ifIndex_dict, $portid_dict, $vlans_dict);
}
unset($existing_fdbs, $portid_dict, $vlans_dict);

View File

@@ -0,0 +1,72 @@
<?php
/**
* bridge.inc.php
*
* Discover FDB data with Q-BRIDGE-MIB and BRIDGE-MIB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Tony Murray
* @copyright 2017 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
// Try Q-BRIDGE-MIB::dot1qTpFdbPort first
$fdbPort_table = snmpwalk_group($device, 'dot1qTpFdbPort', 'Q-BRIDGE-MIB');
if (!empty($fdbPort_table)) {
echo 'Q-BRIDGE-MIB:';
$data_oid = 'dot1qTpFdbPort';
} else {
// If we don't have Q-BRIDGE-MIB::dot1qTpFdbPort, try BRIDGE-MIB::dot1dTpFdbPort
$dot1d = snmpwalk_group($device, 'dot1dTpFdbPort', 'BRIDGE-MIB', 0);
$data_oid = 'dot1dTpFdbPort';
if (!empty($dot1d)) {
echo 'BRIDGE-MIB: ';
$fdbPort_table = array(0 => $dot1d); // dont' have VLAN, so use 0
}
}
if (!empty($fdbPort_table)) {
// Build dot1dBasePort to port_id dictionary
$portid_dict = array();
$dot1dBasePortIfIndex = snmpwalk_group($device, 'dot1dBasePortIfIndex', 'BRIDGE-MIB');
foreach ($dot1dBasePortIfIndex as $portLocal => $data) {
$port = get_port_by_index_cache($device['device_id'], $data['dot1dBasePortIfIndex']);
$portid_dict[$portLocal] = $port['port_id'];
}
// Collect data and populate $insert
foreach ($fdbPort_table as $vlan => $data) {
foreach ($data[$data_oid] as $mac => $dot1dBasePort) {
if ($dot1dBasePort == 0) {
d_echo("No port known for $mac\n");
continue;
}
$mac_address = implode(array_map('zeropad', explode(':', $mac)));
if (strlen($mac_address) != 12) {
d_echo("MAC address padding failed for $mac\n");
continue;
}
$port_id = $portid_dict[$dot1dBasePort];
$vlan_id = isset($vlans_dict[$vlan]) ? $vlans_dict[$vlan] : 0;
$insert[$vlan_id][$mac_address]['port_id'] = $port_id;
d_echo("vlan $vlan mac $mac_address port ($dot1dBasePort) $port_id\n");
}
}
}
echo PHP_EOL;

View File

@@ -1,46 +0,0 @@
<?php
echo 'Comware:';
// find fdb entries, output like
// dot1qTpFdbPort[507][0:24:c4:fd:a1:c7] 1
$fdbPort_table = snmp_walk($device, 'dot1qTpFdbEntry', '-OqsX', 'Q-BRIDGE-MIB');
// find port ids, output like
// dot1dBasePortIfIndex[1] 1
$dot1dBasePortIfIndex = snmp_walk($device, 'dot1dBasePortIfIndex', '-OqsX', 'BRIDGE-MIB');
foreach (explode("\n", $dot1dBasePortIfIndex) as $dot1dBasePortIfIndex_entry) {
if (!empty($dot1dBasePortIfIndex_entry)) {
$port = explode(' ', $dot1dBasePortIfIndex_entry);
$strTemp = explode('[', $port[0]);
$portLocal = rtrim($strTemp[1], ']');
$portid_dict[$portLocal] = $ifIndex_dict[$port[1]];
}
}
foreach (explode("\n", $fdbPort_table) as $fdbPort_entry) {
preg_match('~(?P<oid>\w+)\[(?P<vlan>\d+)]\[(?P<mac>[\w:-]+)]\s(?P<port>\d+)~', $fdbPort_entry, $matches);
if (!empty($matches)) {
$port = $matches['port'];
$mac = $matches['mac'];
$vlan = $matches['vlan'];
$vlan_id = $vlans_dict[$vlan];
echo " $vlan";
if (!empty($mac)) {
list($oct_1, $oct_2, $oct_3, $oct_4, $oct_5, $oct_6) = explode(':', $mac);
$mac_address = zeropad($oct_1) . zeropad($oct_2) . zeropad($oct_3) . zeropad($oct_4) . zeropad($oct_5) . zeropad($oct_6);
if (strlen($mac_address) != 12) {
echo 'Mac Address padding failed';
continue;
} else {
$dot1dBasePort = $port;
$insert[$vlan_id][$mac_address]['port_id'] = $portid_dict[$dot1dBasePort];
d_echo("vlan $vlan mac $mac_address port ($port) " . $portid_dict[$dot1dBasePort] . PHP_EOL);
}
} // end if on empty mac
} // end if on matches
} // end loop on fdbPort_entry
echo PHP_EOL;

View File

@@ -1,7 +1,7 @@
<?php
$vtpdomains = snmpwalk_cache_oid($device, 'vlanManagementDomains', array(), 'CISCO-VTP-MIB');
$vlans = snmpwalk_cache_twopart_oid($device, 'vtpVlanEntry', array(), 'CISCO-VTP-MIB');
$vtpdomains = snmpwalk_group($device, 'managementDomainName', 'CISCO-VTP-MIB');
$vlans = snmpwalk_group($device, 'vtpVlanEntry', 'CISCO-VTP-MIB', 2);
foreach ($vtpdomains as $vtpdomain_id => $vtpdomain) {
echo "VTP Domain $vtpdomain_id {$vtpdomain['managementDomainName']}> ";
@@ -18,40 +18,28 @@ foreach ($vtpdomains as $vtpdomain_id => $vtpdomain) {
$vlans_dict[$vlan_raw] = $newvlan_id;
}
if ($vlan['vtpVlanState'] == 'operational') {
if ($vlan['vtpVlanState'] === '1') {
$device_vlan = array_merge($device, array('community' => $device['community'] . '@' . $vlan_raw, 'context_name' => "vlan-$vlan_raw"));
$FdbPort_table = snmp_walk($device_vlan, 'dot1dTpFdbPort', '-OqsX', 'BRIDGE-MIB');
if (empty($FdbPort_table)) {
// If there are no entries for the vlan, continue
unset($device_vlan);
continue;
$fdbPort_table = snmpwalk_group($device_vlan, 'dot1dTpFdbPort', 'BRIDGE-MIB', 0);
$portid_dict = array();
$dot1dBasePortIfIndex = snmpwalk_group($device_vlan, 'dot1dBasePortIfIndex', 'BRIDGE-MIB');
foreach ($dot1dBasePortIfIndex as $portLocal => $data) {
$port = get_port_by_index_cache($device['device_id'], $data['dot1dBasePortIfIndex']);
$portid_dict[$portLocal] = $port['port_id'];
}
$dot1dBasePortIfIndex = snmp_walk($device_vlan, 'dot1dBasePortIfIndex', '-OqsX', 'BRIDGE-MIB');
foreach (explode("\n", $dot1dBasePortIfIndex) as $dot1dBasePortIfIndex_entry) {
if (!empty($dot1dBasePortIfIndex_entry)) {
preg_match('~dot1dBasePortIfIndex\[(\d+)]\s(\d+)~', $dot1dBasePortIfIndex_entry, $matches);
$portid_dict[$matches[1]] = $ifIndex_dict[$matches[2]];
}
}
foreach (explode("\n", $FdbPort_table) as $FdbPort_entry) {
preg_match('~(?P<oid>\w+)\[(?P<mac>[\w:-]+)]\s(?P<result>\w.*)~', $FdbPort_entry, $matches);
if (! empty($matches)) {
list($oct_1, $oct_2, $oct_3, $oct_4, $oct_5, $oct_6) = explode(':', $matches['mac']);
$mac_address = zeropad($oct_1) . zeropad($oct_2) . zeropad($oct_3) . zeropad($oct_4) . zeropad($oct_5) . zeropad($oct_6);
if (strlen($mac_address) != 12) {
echo 'Mac Address padding failed';
continue;
} else {
$vlan_id = $vlans_dict[$vlan_raw];
$dot1dBasePort = $matches['result'];
$insert[$vlan_id][$mac_address]['port_id'] = $portid_dict[$dot1dBasePort];
d_echo("vlan $vlan_raw - mac $mac_address - port ($port) ".$portid_dict[$dot1dBasePort]."\n");
}
foreach ($fdbPort_table['dot1dTpFdbPort'] as $mac => $dot1dBasePort) {
$mac_address = implode(array_map('zeropad', explode(':', $mac)));
if (strlen($mac_address) != 12) {
d_echo("MAC address padding failed for $mac\n");
continue;
}
$port_id = $portid_dict[$dot1dBasePort];
$vlan_id = isset($vlans_dict[$vlan_raw]) ? $vlans_dict[$vlan_raw] : 0;
$insert[$vlan_id][$mac_address]['port_id'] = $port_id;
d_echo("vlan $vlan mac $mac_address port ($dot1dBasePort) $port_id\n");
}
unset($device_vlan);

View File

@@ -71,7 +71,7 @@ function get_mib_dir($device)
}
}
}
return $extra;
}
@@ -537,7 +537,7 @@ function snmpwalk_cache_triple_oid($device, $oid, $array, $mib = null, $mibdir =
*/
function snmpwalk_group($device, $oid, $mib = '', $depth = 1, $array = array())
{
$cmd = gen_snmpwalk_cmd($device, $oid, '-OQUsbet', $mib);
$cmd = gen_snmpwalk_cmd($device, $oid, '-OQUsetX', $mib);
$data = rtrim(external_exec($cmd));
$line = strtok($data, "\n");
@@ -547,8 +547,9 @@ function snmpwalk_group($device, $oid, $mib = '', $depth = 1, $array = array())
continue;
}
list($oid, $value) = explode(' = ', $line, 2);
$parts = explode('.', $oid, $depth + 2); // + oid and extra data
list($address, $value) = explode(' =', $line, 2);
preg_match_all('/([^[\]]+)/', $address, $parts);
$parts = $parts[1];
array_splice($parts, $depth, 0, array_shift($parts)); // move the oid name to the correct depth
$line = strtok("\n"); // get the next line and concatenate multi-line values
@@ -675,12 +676,12 @@ function snmp_gen_auth(&$device)
if ($device['snmpver'] === 'v3') {
$cmd = " -v3 -n '' -l '".$device['authlevel']."'";
//add context if exist context
if (key_exists('context_name', $device)) {
$cmd = " -v3 -n '".$device['context_name']."' -l '".$device['authlevel']."'";
}
if ($device['authlevel'] === 'noAuthNoPriv') {
// We have to provide a username anyway (see Net-SNMP doc)
$username = !empty($device['authname']) ? $device['authname'] : 'root';

View File

@@ -1130,12 +1130,13 @@ ports_fdb:
Columns:
device_id: { Field: device_id, Type: 'int(11) unsigned', 'Null': false, Default: null, Extra: '' }
mac_address: { Field: mac_address, Type: varchar(32), 'Null': false, Default: null, Extra: '' }
ports_fdb_id: { Field: ports_fdb_id, Type: bigint(20), 'Null': false, Default: null, Extra: auto_increment }
port_id: { Field: port_id, Type: 'int(11) unsigned', 'Null': false, Default: null, Extra: '' }
vlan_id: { Field: vlan_id, Type: 'int(11) unsigned', 'Null': false, Default: null, Extra: '' }
Indexes:
PRIMARY: { Name: PRIMARY, Columns: [ports_fdb_id], Unique: true, Type: BTREE }
mac_address: { Name: mac_address, Columns: [mac_address], Unique: false, Type: BTREE }
ports_fdb_port_id_index: { Name: ports_fdb_port_id_index, Columns: [port_id], Unique: false, Type: BTREE }
ports_fdb_device_id_index: { Name: ports_fdb_device_id_index, Columns: [device_id], Unique: false, Type: BTREE }
ports_fdb_vlan_id_index: { Name: ports_fdb_vlan_id_index, Columns: [vlan_id], Unique: false, Type: BTREE }
ports_perms:
Columns:
access_level: { Field: access_level, Type: int(11), 'Null': false, Default: null, Extra: '' }

4
sql-schema/198.sql Normal file
View File

@@ -0,0 +1,4 @@
ALTER TABLE `ports_fdb` DROP `ports_fdb_id`;
CREATE INDEX `ports_fdb_port_id_index` ON `ports_fdb` (`port_id`);
CREATE INDEX `ports_fdb_device_id_index` ON `ports_fdb` (`device_id`);
CREATE INDEX `ports_fdb_vlan_id_index` ON `ports_fdb` (`vlan_id`);