Fix Port Channels take 2 (#16246)

* Resubmit of #16227

* Add missing new files
This commit is contained in:
Tony Murray 2024-07-26 08:45:34 -05:00 committed by GitHub
parent e45dd59f77
commit b41d1b7ffb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 749 additions and 148 deletions

View File

@ -0,0 +1,123 @@
<?php
/**
* PortsStack.php
*
* -Description-
*
* 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 <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2024 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\Modules;
use App\Models\Device;
use App\Models\PortStack;
use App\Observers\ModuleModelObserver;
use LibreNMS\DB\SyncsModels;
use LibreNMS\Interfaces\Data\DataStorageInterface;
use LibreNMS\Interfaces\Module;
use LibreNMS\OS;
use LibreNMS\Polling\ModuleStatus;
class PortsStack implements Module
{
use SyncsModels;
/**
* @inheritDoc
*/
public function dependencies(): array
{
return ['ports'];
}
/**
* @inheritDoc
*/
public function shouldDiscover(OS $os, ModuleStatus $status): bool
{
return $status->isEnabledAndDeviceUp($os->getDevice());
}
/**
* @inheritDoc
*/
public function shouldPoll(OS $os, ModuleStatus $status): bool
{
return false;
}
/**
* @inheritDoc
*/
public function discover(OS $os): void
{
$data = \SnmpQuery::enumStrings()->walk('IF-MIB::ifStackStatus');
if (! $data->isValid()) {
return;
}
$ifIndexToPortIdMap = $os->getDevice()->ports()->pluck('port_id', 'ifIndex')->toArray();
$portStacks = $data->mapTable(function ($data, $lowIfIndex, $highIfIndex) use ($ifIndexToPortIdMap) {
if ($lowIfIndex == '0' || $highIfIndex == '0') {
return null; // we don't care about the default entries for ports that have stacking enabled
}
return new PortStack([
'high_ifIndex' => $highIfIndex,
'high_port_id' => $ifIndexToPortIdMap[$highIfIndex] ?? null,
'low_ifIndex' => $lowIfIndex,
'low_port_id' => $ifIndexToPortIdMap[$lowIfIndex] ?? null,
'ifStackStatus' => $data['IF-MIB::ifStackStatus'],
]);
});
ModuleModelObserver::observe(PortStack::class);
$this->syncModels($os->getDevice(), 'portsStack', $portStacks->filter());
}
/**
* @inheritDoc
*/
public function poll(OS $os, DataStorageInterface $datastore): void
{
// no polling
}
/**
* @inheritDoc
*/
public function cleanup(Device $device): void
{
$device->portsStack()->delete();
}
/**
* @inheritDoc
*/
public function dump(Device $device)
{
return [
'ports_stack' => $device->portsStack()
->orderBy('high_ifIndex')->orderBy('low_ifIndex')
->get(['high_ifIndex', 'low_ifIndex', 'ifStackStatus']),
];
}
}

View File

@ -41,7 +41,7 @@ use LibreNMS\Interfaces\UI\DeviceTab;
class PortsController implements DeviceTab
{
private bool $detail = false;
private bool $detail = true;
private array $settings = [];
private array $defaults = [
'perPage' => 32,
@ -121,6 +121,8 @@ class PortsController implements DeviceTab
$relationships[] = 'pseudowires.endpoints';
$relationships[] = 'ipv4Networks.ipv4';
$relationships[] = 'ipv6Networks.ipv6';
$relationships['stackParent'] = fn ($q) => $q->select('port_id');
$relationships['stackChildren'] = fn ($q) => $q->select('port_id');
}
/** @var Collection<Port>|LengthAwarePaginator<Port> $ports */
@ -205,17 +207,13 @@ class PortsController implements DeviceTab
}
// port stack
// fa-expand portlink: local is low port
// fa-compress portlink: local is high portPort
$stacks = \DB::table('ports_stack')->where('device_id', $port->device_id)
->where(fn ($q) => $q->where('port_id_high', $port->port_id)->orWhere('port_id_low', $port->port_id))->get();
foreach ($stacks as $stack) {
if ($stack->port_id_low) {
$this->addPortNeighbor($neighbors, 'stack_low', $stack->port_id_low);
}
if ($stack->port_id_high) {
$this->addPortNeighbor($neighbors, 'stack_high', $stack->port_id_high);
}
// fa-expand stack_parent: local is a child port
// fa-compress stack_child: local is a parent port
foreach ($port->stackParent as $stackParent) {
$this->addPortNeighbor($neighbors, 'stack_parent', $stackParent->port_id);
}
foreach ($port->stackChildren as $stackChild) {
$this->addPortNeighbor($neighbors, 'stack_child', $stackChild->port_id);
}
// PAGP members/parent

View File

@ -871,6 +871,11 @@ class Device extends BaseModel
return $this->hasMany(\App\Models\PortsNac::class, 'device_id', 'device_id');
}
public function portsStack(): HasMany
{
return $this->hasMany(\App\Models\PortStack::class, 'device_id', 'device_id');
}
public function portsStp(): HasMany
{
return $this->hasMany(\App\Models\PortStp::class, 'device_id', 'device_id');

View File

@ -50,7 +50,7 @@ class Port extends DeviceRelatedModel
// dont have relationships yet
DB::table('juniAtmVp')->where('port_id', $port->port_id)->delete();
DB::table('ports_perms')->where('port_id', $port->port_id)->delete();
DB::table('ports_stack')->where('port_id_low', $port->port_id)->orWhere('port_id_high', $port->port_id)->delete();
DB::table('ports_stack')->where('low_port_id', $port->port_id)->orWhere('high_port_id', $port->port_id)->delete();
\Rrd::purge($port->device?->hostname, \Rrd::portName($port->port_id)); // purge all port rrd files
});
@ -373,6 +373,16 @@ class Port extends DeviceRelatedModel
return $this->hasMany(Pseudowire::class, 'port_id');
}
public function stackChildren(): HasManyThrough
{
return $this->hasManyThrough(Port::class, PortStack::class, 'low_port_id', 'port_id', 'port_id', 'high_port_id');
}
public function stackParent(): HasManyThrough
{
return $this->hasManyThrough(Port::class, PortStack::class, 'high_port_id', 'port_id', 'port_id', 'low_port_id');
}
public function statistics(): HasMany
{
return $this->hasMany(PortStatistic::class, 'port_id');

25
app/Models/PortStack.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use LibreNMS\Interfaces\Models\Keyable;
class PortStack extends DeviceRelatedModel implements Keyable
{
use HasFactory;
protected $table = 'ports_stack';
public $timestamps = false;
protected $fillable = [
'high_ifIndex',
'high_port_id',
'low_ifIndex',
'low_port_id',
'ifStackStatus',
];
public function getCompositeKey()
{
return $this->high_ifIndex . '-' . $this->low_ifIndex;
}
}

View File

@ -13,11 +13,14 @@ return new class extends Migration
public function up(): void
{
Schema::create('ports_stack', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('device_id');
$table->unsignedInteger('port_id_high');
$table->unsignedInteger('port_id_low');
$table->unsignedInteger('high_ifIndex');
$table->unsignedBigInteger('high_port_id')->nullable();
$table->unsignedInteger('low_ifIndex');
$table->unsignedBigInteger('low_port_id')->nullable();
$table->string('ifStackStatus', 32);
$table->unique(['device_id', 'port_id_high', 'port_id_low']);
$table->unique(['device_id', 'high_ifIndex', 'low_ifIndex']);
});
}

View File

@ -114,7 +114,9 @@ return new class extends Migration
$this->renameIndex('ports', 'if_2', 'ports_ifdescr_index', ['ifDescr']);
$this->renameIndex('ports_adsl', 'interface_id', 'ports_adsl_port_id_unique', ['port_id'], true);
$this->renameIndex('ports_fdb', 'mac_address', 'ports_fdb_mac_address_index', ['mac_address']);
$this->renameIndex('ports_stack', 'device_id', 'ports_stack_device_id_port_id_high_port_id_low_unique', ['device_id', 'port_id_high', 'port_id_low'], true);
if (Schema::hasColumn('ports_stack', 'port_id_high')) {
$this->renameIndex('ports_stack', 'device_id', 'ports_stack_device_id_port_id_high_port_id_low_unique', ['device_id', 'port_id_high', 'port_id_low'], true);
}
$this->renameIndex('ports_stp', 'device_id', 'ports_stp_device_id_port_id_unique', ['device_id', 'port_id'], true);
$this->renameIndex('ports_vlans', '`unique`', 'ports_vlans_device_id_port_id_vlan_unique', ['device_id', 'port_id', 'vlan'], true);
$this->renameIndex('processes', 'device_id', 'processes_device_id_index', ['device_id']);

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
if (! Schema::hasColumn('ports_stack', 'id')) {
Schema::table('ports_stack', function (Blueprint $table) {
$table->id()->first();
$table->unsignedBigInteger('high_port_id')->nullable()->after('port_id_high');
$table->unsignedBigInteger('low_port_id')->nullable()->after('port_id_low');
$table->renameColumn('port_id_high', 'high_ifIndex');
$table->renameColumn('port_id_low', 'low_ifIndex');
});
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ports_stack', function (Blueprint $table) {
$table->renameColumn('high_ifIndex', 'port_id_high');
$table->renameColumn('low_ifIndex', 'port_id_low');
$table->dropColumn(['id', 'high_port_id', 'low_port_id']);
});
}
};

View File

@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS "alert_log" ("id" integer primary key autoincrement n
CREATE INDEX "alert_log_rule_id_index" on "alert_log" ("rule_id");
CREATE INDEX "alert_log_device_id_index" on "alert_log" ("device_id");
CREATE INDEX "alert_log_time_logged_index" on "alert_log" ("time_logged");
CREATE TABLE IF NOT EXISTS "alert_rules" ("id" integer primary key autoincrement not null, "rule" text not null, "severity" varchar check ("severity" in ('ok', 'warning', 'critical')) not null, "extra" varchar not null, "disabled" tinyint(1) not null, "name" varchar not null, "query" text not null, "builder" text not null, "proc" varchar, "invert_map" tinyint(1) not null default '0');
CREATE TABLE IF NOT EXISTS "alert_rules" ("id" integer primary key autoincrement not null, "rule" text not null, "severity" varchar check ("severity" in ('ok', 'warning', 'critical')) not null, "extra" varchar not null, "disabled" tinyint(1) not null, "name" varchar not null, "query" text not null, "builder" text not null, "proc" varchar, "invert_map" tinyint(1) not null default '0', "notes" text);
CREATE UNIQUE INDEX "alert_rules_name_unique" on "alert_rules" ("name");
CREATE TABLE IF NOT EXISTS "alert_schedulables" ("item_id" integer primary key autoincrement not null, "schedule_id" integer not null, "alert_schedulable_id" integer not null, "alert_schedulable_type" varchar not null);
CREATE INDEX "schedulable_morph_index" on "alert_schedulables" ("alert_schedulable_type", "alert_schedulable_id");
@ -28,11 +28,6 @@ CREATE INDEX "alerts_rule_id_index" on "alerts" ("rule_id");
CREATE TABLE IF NOT EXISTS "api_tokens" ("id" integer primary key autoincrement not null, "user_id" integer not null, "token_hash" varchar, "description" varchar not null, "disabled" tinyint(1) not null default '0');
CREATE UNIQUE INDEX "api_tokens_token_hash_unique" on "api_tokens" ("token_hash");
CREATE TABLE IF NOT EXISTS "authlog" ("id" integer primary key autoincrement not null, "datetime" datetime not null default CURRENT_TIMESTAMP, "user" text not null, "address" text not null, "result" text not null);
CREATE TABLE IF NOT EXISTS "bgpPeers_cbgp" ("device_id" integer not null, "bgpPeerIdentifier" varchar not null, "afi" varchar not null, "safi" varchar not null, "AcceptedPrefixes" integer not null, "DeniedPrefixes" integer not null, "PrefixAdminLimit" integer not null, "PrefixThreshold" integer not null, "PrefixClearThreshold" integer not null, "AdvertisedPrefixes" integer not null, "SuppressedPrefixes" integer not null, "WithdrawnPrefixes" integer not null, "AcceptedPrefixes_delta" integer not null, "AcceptedPrefixes_prev" integer not null, "DeniedPrefixes_delta" integer not null, "DeniedPrefixes_prev" integer not null, "AdvertisedPrefixes_delta" integer not null, "AdvertisedPrefixes_prev" integer not null, "SuppressedPrefixes_delta" integer not null, "SuppressedPrefixes_prev" integer not null, "WithdrawnPrefixes_delta" integer not null, "WithdrawnPrefixes_prev" integer not null, "context_name" varchar);
CREATE UNIQUE INDEX "bgppeers_cbgp_device_id_bgppeeridentifier_afi_safi_unique" on "bgpPeers_cbgp" ("device_id", "bgpPeerIdentifier", "afi", "safi");
CREATE INDEX "bgppeers_cbgp_device_id_bgppeeridentifier_context_name_index" on "bgpPeers_cbgp" ("device_id", "bgpPeerIdentifier", "context_name");
CREATE TABLE IF NOT EXISTS "bgpPeers" ("bgpPeer_id" integer primary key autoincrement not null, "device_id" integer not null, "astext" varchar not null, "bgpPeerIdentifier" text not null, "bgpPeerRemoteAs" integer not null, "bgpPeerState" text not null, "bgpPeerAdminStatus" text not null, "bgpLocalAddr" text not null, "bgpPeerRemoteAddr" text not null, "bgpPeerDescr" varchar not null default '', "bgpPeerInUpdates" integer not null, "bgpPeerOutUpdates" integer not null, "bgpPeerInTotalMessages" integer not null, "bgpPeerOutTotalMessages" integer not null, "bgpPeerFsmEstablishedTime" integer not null, "bgpPeerInUpdateElapsedTime" integer not null, "context_name" varchar, "vrf_id" integer, "bgpPeerLastErrorCode" integer, "bgpPeerLastErrorSubCode" integer, "bgpPeerLastErrorText" varchar, "bgpPeerIface" integer);
CREATE INDEX "bgppeers_device_id_context_name_index" on "bgpPeers" ("device_id", "context_name");
CREATE TABLE IF NOT EXISTS "bill_data" ("id" integer primary key autoincrement not null, "bill_id" integer not null, "timestamp" datetime not null, "period" integer not null, "delta" integer not null, "in_delta" integer not null, "out_delta" integer not null);
CREATE INDEX "bill_data_bill_id_index" on "bill_data" ("bill_id");
CREATE TABLE IF NOT EXISTS "bill_history" ("bill_hist_id" integer primary key autoincrement not null, "bill_id" integer not null, "updated" datetime not null default CURRENT_TIMESTAMP, "bill_datefrom" datetime not null, "bill_dateto" datetime not null, "bill_type" text not null, "bill_allowed" integer not null, "bill_used" integer not null, "bill_overuse" integer not null, "bill_percent" numeric not null, "rate_95th_in" integer not null, "rate_95th_out" integer not null, "rate_95th" integer not null, "dir_95th" varchar not null, "rate_average" integer not null, "rate_average_in" integer not null, "rate_average_out" integer not null, "traf_in" integer not null, "traf_out" integer not null, "traf_total" integer not null, "pdf" blob, "bill_peak_out" integer, "bill_peak_in" integer);
@ -45,8 +40,6 @@ CREATE TABLE IF NOT EXISTS "bills" ("bill_id" integer primary key autoincrement
CREATE TABLE IF NOT EXISTS "callback" ("callback_id" integer primary key autoincrement not null, "name" varchar not null, "value" varchar not null);
CREATE TABLE IF NOT EXISTS "cef_switching" ("cef_switching_id" integer primary key autoincrement not null, "device_id" integer not null, "entPhysicalIndex" integer not null, "afi" varchar not null, "cef_index" integer not null, "cef_path" varchar not null, "drop" integer not null, "punt" integer not null, "punt2host" integer not null, "drop_prev" integer not null, "punt_prev" integer not null, "punt2host_prev" integer not null, "updated" integer not null, "updated_prev" integer not null);
CREATE UNIQUE INDEX "cef_switching_device_id_entphysicalindex_afi_cef_index_unique" on "cef_switching" ("device_id", "entPhysicalIndex", "afi", "cef_index");
CREATE TABLE IF NOT EXISTS "ciscoASA" ("ciscoASA_id" integer primary key autoincrement not null, "device_id" integer not null, "oid" varchar not null, "data" integer not null, "high_alert" integer not null, "low_alert" integer not null, "disabled" integer not null default '0');
CREATE INDEX "ciscoasa_device_id_index" on "ciscoASA" ("device_id");
CREATE TABLE IF NOT EXISTS "component_prefs" ("id" integer primary key autoincrement not null, "component" integer not null, "attribute" varchar not null, "value" text not null);
CREATE INDEX "component_prefs_component_index" on "component_prefs" ("component");
CREATE TABLE IF NOT EXISTS "component_statuslog" ("id" integer primary key autoincrement not null, "component_id" integer not null, "status" tinyint(1) not null default '0', "message" text, "timestamp" datetime not null default CURRENT_TIMESTAMP);
@ -62,16 +55,12 @@ CREATE INDEX "device_graphs_device_id_index" on "device_graphs" ("device_id");
CREATE TABLE IF NOT EXISTS "device_group_device" ("device_group_id" integer not null, "device_id" integer not null, primary key ("device_group_id", "device_id"));
CREATE INDEX "device_group_device_device_group_id_index" on "device_group_device" ("device_group_id");
CREATE INDEX "device_group_device_device_id_index" on "device_group_device" ("device_id");
CREATE TABLE IF NOT EXISTS "device_perf" ("id" integer primary key autoincrement not null, "device_id" integer not null, "timestamp" datetime not null, "xmt" integer not null, "rcv" integer not null, "loss" integer not null, "min" float not null, "max" float not null, "avg" float not null, "debug" text);
CREATE INDEX "device_perf_device_id_index" on "device_perf" ("device_id");
CREATE TABLE IF NOT EXISTS "device_relationships" ("parent_device_id" integer not null default '0', "child_device_id" integer not null, primary key ("parent_device_id", "child_device_id"));
CREATE INDEX "device_relationships_child_device_id_index" on "device_relationships" ("child_device_id");
CREATE TABLE IF NOT EXISTS "devices_perms" ("id" integer primary key autoincrement not null, "user_id" integer not null, "device_id" integer not null);
CREATE INDEX "devices_perms_user_id_index" on "devices_perms" ("user_id");
CREATE TABLE IF NOT EXISTS "entPhysical_state" ("id" integer primary key autoincrement not null, "device_id" integer not null, "entPhysicalIndex" varchar not null, "subindex" varchar, "group" varchar not null, "key" varchar not null, "value" varchar not null);
CREATE INDEX "device_id_index" on "entPhysical_state" ("device_id", "entPhysicalIndex");
CREATE TABLE IF NOT EXISTS "entPhysical" ("entPhysical_id" integer primary key autoincrement not null, "device_id" integer not null, "entPhysicalIndex" integer not null, "entPhysicalDescr" text not null, "entPhysicalClass" text not null, "entPhysicalName" text not null, "entPhysicalHardwareRev" varchar, "entPhysicalFirmwareRev" varchar, "entPhysicalSoftwareRev" varchar, "entPhysicalAlias" varchar, "entPhysicalAssetID" varchar, "entPhysicalIsFRU" varchar, "entPhysicalModelName" text not null, "entPhysicalVendorType" text, "entPhysicalSerialNum" text not null, "entPhysicalContainedIn" integer not null, "entPhysicalParentRelPos" integer not null, "entPhysicalMfgName" text not null, "ifIndex" integer);
CREATE INDEX "entphysical_device_id_index" on "entPhysical" ("device_id");
CREATE TABLE IF NOT EXISTS "entityState" ("entity_state_id" integer primary key autoincrement not null, "device_id" integer, "entPhysical_id" integer, "entStateLastChanged" datetime, "entStateAdmin" integer, "entStateOper" integer, "entStateUsage" integer, "entStateAlarm" text, "entStateStandby" integer);
CREATE INDEX "entitystate_device_id_index" on "entityState" ("device_id");
CREATE TABLE IF NOT EXISTS "eventlog" ("event_id" integer primary key autoincrement not null, "device_id" integer, "datetime" datetime not null default '1970-01-02 00:00:01', "message" text, "type" varchar, "reference" varchar, "username" varchar, "severity" integer not null default '2');
@ -120,15 +109,6 @@ CREATE TABLE IF NOT EXISTS "notifications_attribs" ("attrib_id" integer primary
CREATE TABLE IF NOT EXISTS "notifications" ("notifications_id" integer primary key autoincrement not null, "title" varchar not null default '', "body" text not null, "severity" integer default '0', "source" varchar not null default '', "checksum" varchar not null, "datetime" datetime not null default '1970-01-02 00:00:00');
CREATE INDEX "notifications_severity_index" on "notifications" ("severity");
CREATE UNIQUE INDEX "notifications_checksum_unique" on "notifications" ("checksum");
CREATE TABLE IF NOT EXISTS "ospf_instances" ("id" integer primary key autoincrement not null, "device_id" integer not null, "ospf_instance_id" integer not null, "ospfRouterId" varchar not null, "ospfAdminStat" varchar not null, "ospfVersionNumber" varchar not null, "ospfAreaBdrRtrStatus" varchar not null, "ospfASBdrRtrStatus" varchar not null, "ospfExternLsaCount" integer not null, "ospfExternLsaCksumSum" integer not null, "ospfTOSSupport" varchar not null, "ospfOriginateNewLsas" integer not null, "ospfRxNewLsas" integer not null, "ospfExtLsdbLimit" integer, "ospfMulticastExtensions" integer, "ospfExitOverflowInterval" integer, "ospfDemandExtensions" varchar, "context_name" varchar);
CREATE UNIQUE INDEX "ospf_instances_device_id_ospf_instance_id_context_name_unique" on "ospf_instances" ("device_id", "ospf_instance_id", "context_name");
CREATE TABLE IF NOT EXISTS "ospf_nbrs" ("id" integer primary key autoincrement not null, "device_id" integer not null, "port_id" integer, "ospf_nbr_id" varchar not null, "ospfNbrIpAddr" varchar not null, "ospfNbrAddressLessIndex" integer not null, "ospfNbrRtrId" varchar not null, "ospfNbrOptions" integer not null, "ospfNbrPriority" integer not null, "ospfNbrState" varchar not null, "ospfNbrEvents" integer not null, "ospfNbrLsRetransQLen" integer not null, "ospfNbmaNbrStatus" varchar not null, "ospfNbmaNbrPermanence" varchar not null, "ospfNbrHelloSuppressed" varchar not null, "context_name" varchar);
CREATE UNIQUE INDEX "ospf_nbrs_device_id_ospf_nbr_id_context_name_unique" on "ospf_nbrs" ("device_id", "ospf_nbr_id", "context_name");
CREATE TABLE IF NOT EXISTS "ospf_ports" ("id" integer primary key autoincrement not null, "device_id" integer not null, "port_id" integer not null, "ospf_port_id" varchar not null, "ospfIfIpAddress" varchar not null, "ospfAddressLessIf" integer not null, "ospfIfAreaId" varchar not null, "ospfIfType" varchar, "ospfIfAdminStat" varchar, "ospfIfRtrPriority" integer, "ospfIfTransitDelay" integer, "ospfIfRetransInterval" integer, "ospfIfHelloInterval" integer, "ospfIfRtrDeadInterval" integer, "ospfIfPollInterval" integer, "ospfIfState" varchar, "ospfIfDesignatedRouter" varchar, "ospfIfBackupDesignatedRouter" varchar, "ospfIfEvents" integer, "ospfIfAuthKey" varchar, "ospfIfStatus" varchar, "ospfIfMulticastForwarding" varchar, "ospfIfDemand" varchar, "ospfIfAuthType" varchar, "context_name" varchar, "ospfIfMetricIpAddress" varchar, "ospfIfMetricAddressLessIf" integer, "ospfIfMetricTOS" integer, "ospfIfMetricValue" integer, "ospfIfMetricStatus" varchar);
CREATE UNIQUE INDEX "ospf_ports_device_id_ospf_port_id_context_name_unique" on "ospf_ports" ("device_id", "ospf_port_id", "context_name");
CREATE TABLE IF NOT EXISTS "packages" ("pkg_id" integer primary key autoincrement not null, "device_id" integer not null, "name" varchar not null, "manager" varchar not null default '1', "status" tinyint(1) not null, "version" varchar not null, "build" varchar not null, "arch" varchar not null, "size" integer);
CREATE UNIQUE INDEX "packages_device_id_name_manager_arch_version_build_unique" on "packages" ("device_id", "name", "manager", "arch", "version", "build");
CREATE INDEX "packages_device_id_index" on "packages" ("device_id");
CREATE TABLE IF NOT EXISTS "pdb_ix_peers" ("pdb_ix_peers_id" integer primary key autoincrement not null, "ix_id" integer not null, "peer_id" integer not null, "remote_asn" integer not null, "remote_ipaddr4" varchar, "remote_ipaddr6" varchar, "name" varchar, "timestamp" integer);
CREATE TABLE IF NOT EXISTS "pdb_ix" ("pdb_ix_id" integer primary key autoincrement not null, "ix_id" integer not null, "name" varchar not null, "asn" integer not null, "timestamp" integer not null);
CREATE TABLE IF NOT EXISTS "plugins" ("plugin_id" integer primary key autoincrement not null, "plugin_name" varchar not null, "plugin_active" integer not null, "version" integer not null default '1', "settings" text);
@ -145,9 +125,8 @@ CREATE INDEX "ports_fdb_mac_address_index" on "ports_fdb" ("mac_address");
CREATE INDEX "ports_fdb_vlan_id_index" on "ports_fdb" ("vlan_id");
CREATE INDEX "ports_fdb_device_id_index" on "ports_fdb" ("device_id");
CREATE TABLE IF NOT EXISTS "ports_perms" ("id" integer primary key autoincrement not null, "user_id" integer not null, "port_id" integer not null);
CREATE TABLE IF NOT EXISTS "ports_stack" ("device_id" integer not null, "port_id_high" integer not null, "port_id_low" integer not null, "ifStackStatus" varchar not null);
CREATE UNIQUE INDEX "ports_stack_device_id_port_id_high_port_id_low_unique" on "ports_stack" ("device_id", "port_id_high", "port_id_low");
CREATE TABLE IF NOT EXISTS "ports_statistics" ("port_id" integer not null, "ifInNUcastPkts" integer, "ifInNUcastPkts_prev" integer, "ifInNUcastPkts_delta" integer, "ifInNUcastPkts_rate" integer, "ifOutNUcastPkts" integer, "ifOutNUcastPkts_prev" integer, "ifOutNUcastPkts_delta" integer, "ifOutNUcastPkts_rate" integer, "ifInDiscards" integer, "ifInDiscards_prev" integer, "ifInDiscards_delta" integer, "ifInDiscards_rate" integer, "ifOutDiscards" integer, "ifOutDiscards_prev" integer, "ifOutDiscards_delta" integer, "ifOutDiscards_rate" integer, "ifInUnknownProtos" integer, "ifInUnknownProtos_prev" integer, "ifInUnknownProtos_delta" integer, "ifInUnknownProtos_rate" integer, "ifInBroadcastPkts" integer, "ifInBroadcastPkts_prev" integer, "ifInBroadcastPkts_delta" integer, "ifInBroadcastPkts_rate" integer, "ifOutBroadcastPkts" integer, "ifOutBroadcastPkts_prev" integer, "ifOutBroadcastPkts_delta" integer, "ifOutBroadcastPkts_rate" integer, "ifInMulticastPkts" integer, "ifInMulticastPkts_prev" integer, "ifInMulticastPkts_delta" integer, "ifInMulticastPkts_rate" integer, "ifOutMulticastPkts" integer, "ifOutMulticastPkts_prev" integer, "ifOutMulticastPkts_delta" integer, "ifOutMulticastPkts_rate" integer, primary key ("port_id"));
CREATE TABLE IF NOT EXISTS "ports_stack" ("id" integer primary key autoincrement not null, "device_id" integer not null, "high_ifIndex" integer not null, "high_port_id" integer, "low_ifIndex" integer not null, "low_port_id" integer, "ifStackStatus" varchar not null);
CREATE UNIQUE INDEX "ports_stack_device_id_high_ifindex_low_ifindex_unique" on "ports_stack" ("device_id", "high_ifIndex", "low_ifIndex");
CREATE TABLE IF NOT EXISTS "ports_vlans" ("port_vlan_id" integer primary key autoincrement not null, "device_id" integer not null, "port_id" integer not null, "vlan" integer not null, "baseport" integer not null, "priority" integer not null, "state" varchar not null, "cost" integer not null, "untagged" tinyint(1) not null default '0');
CREATE UNIQUE INDEX "ports_vlans_device_id_port_id_vlan_unique" on "ports_vlans" ("device_id", "port_id", "vlan");
CREATE TABLE IF NOT EXISTS "processors" ("processor_id" integer primary key autoincrement not null, "entPhysicalIndex" integer not null default '0', "hrDeviceIndex" integer, "device_id" integer not null, "processor_oid" varchar not null, "processor_index" varchar not null, "processor_type" varchar not null, "processor_usage" integer not null, "processor_descr" varchar not null, "processor_precision" integer not null default '1', "processor_perc_warn" integer default '75');
@ -201,7 +180,7 @@ CREATE TABLE IF NOT EXISTS "wireless_sensors" ("sensor_id" integer primary key a
CREATE INDEX "wireless_sensors_sensor_class_index" on "wireless_sensors" ("sensor_class");
CREATE INDEX "wireless_sensors_device_id_index" on "wireless_sensors" ("device_id");
CREATE INDEX "wireless_sensors_sensor_type_index" on "wireless_sensors" ("sensor_type");
CREATE TABLE ports_nac (ports_nac_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, auth_id VARCHAR(255) NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER NOT NULL, domain VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, mac_address VARCHAR(255) NOT NULL, ip_address VARCHAR(255) NOT NULL, host_mode VARCHAR(255) NOT NULL, authz_status VARCHAR(255) NOT NULL, authz_by VARCHAR(255) NOT NULL, authc_status VARCHAR(255) NOT NULL, method VARCHAR(255) NOT NULL, timeout VARCHAR(255) NOT NULL, time_left VARCHAR(50) DEFAULT NULL, "vlan" integer, "time_elapsed" varchar);
CREATE TABLE ports_nac (ports_nac_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, auth_id VARCHAR(255) NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER NOT NULL, domain VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, mac_address VARCHAR(255) NOT NULL, ip_address VARCHAR(255) NOT NULL, host_mode VARCHAR(255) NOT NULL, authz_status VARCHAR(255) NOT NULL, authz_by VARCHAR(255) NOT NULL, authc_status VARCHAR(255) NOT NULL, method VARCHAR(255) NOT NULL, timeout VARCHAR(255) NOT NULL, time_left VARCHAR(50) DEFAULT NULL, "vlan" integer, "time_elapsed" varchar, "created_at" datetime, "updated_at" datetime, "historical" tinyint(1) not null default '0');
CREATE INDEX ports_nac_device_id_index ON ports_nac (device_id);
CREATE INDEX ports_nac_port_id_mac_address_index ON ports_nac (port_id, mac_address);
CREATE TABLE IF NOT EXISTS "route" ("route_id" integer primary key autoincrement not null, "created_at" datetime, "updated_at" datetime, "device_id" integer not null, "port_id" integer not null, "context_name" varchar, "inetCidrRouteIfIndex" integer not null, "inetCidrRouteType" integer not null, "inetCidrRouteProto" integer not null, "inetCidrRouteNextHopAS" integer not null, "inetCidrRouteMetric1" integer not null, "inetCidrRouteDestType" varchar not null, "inetCidrRouteDest" varchar not null, "inetCidrRouteNextHopType" varchar not null, "inetCidrRouteNextHop" varchar not null, "inetCidrRoutePolicy" varchar not null, "inetCidrRoutePfxLen" integer not null);
@ -209,8 +188,6 @@ CREATE TABLE IF NOT EXISTS "mpls_lsps" ("lsp_id" integer primary key autoincreme
CREATE INDEX "mpls_lsps_device_id_index" on "mpls_lsps" ("device_id");
CREATE TABLE device_groups (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) DEFAULT '' NOT NULL COLLATE "BINARY", "desc" VARCHAR(255) DEFAULT '' NOT NULL COLLATE "BINARY", pattern CLOB DEFAULT NULL COLLATE "BINARY");
CREATE UNIQUE INDEX device_groups_name_unique ON device_groups (name);
CREATE TABLE IF NOT EXISTS "mpls_sdps" ("sdp_id" integer primary key autoincrement not null, "sdp_oid" integer not null, "device_id" integer not null, "sdpRowStatus" varchar check ("sdpRowStatus" in ('active', 'notInService', 'notReady', 'createAndGo', 'createAndWait', 'destroy')), "sdpDelivery" varchar check ("sdpDelivery" in ('gre', 'mpls', 'l2tpv3', 'greethbridged')), "sdpDescription" varchar, "sdpAdminStatus" varchar check ("sdpAdminStatus" in ('up', 'down')), "sdpOperStatus" varchar check ("sdpOperStatus" in ('up', 'notAlive', 'notReady', 'invalidEgressInterface', 'transportTunnelDown', 'down')), "sdpAdminPathMtu" integer, "sdpOperPathMtu" integer, "sdpLastMgmtChange" integer, "sdpLastStatusChange" integer, "sdpActiveLspType" varchar check ("sdpActiveLspType" in ('not-applicable', 'rsvp', 'ldp', 'bgp', 'none', 'mplsTp', 'srIsis', 'srOspf', 'srTeLsp', 'fpe')), "sdpFarEndInetAddressType" varchar check ("sdpFarEndInetAddressType" in ('ipv4', 'ipv6')), "sdpFarEndInetAddress" varchar);
CREATE INDEX "mpls_sdps_device_id_index" on "mpls_sdps" ("device_id");
CREATE TABLE IF NOT EXISTS "mpls_sdp_binds" ("bind_id" integer primary key autoincrement not null, "sdp_id" integer not null, "svc_id" integer not null, "sdp_oid" integer not null, "svc_oid" integer not null, "device_id" integer not null, "sdpBindRowStatus" varchar check ("sdpBindRowStatus" in ('active', 'notInService', 'notReady', 'createAndGo', 'createAndWait', 'destroy')), "sdpBindAdminStatus" varchar check ("sdpBindAdminStatus" in ('up', 'down')), "sdpBindOperStatus" varchar check ("sdpBindOperStatus" in ('up', 'down')), "sdpBindLastMgmtChange" integer, "sdpBindLastStatusChange" integer, "sdpBindType" varchar check ("sdpBindType" in ('spoke', 'mesh')), "sdpBindVcType" varchar check ("sdpBindVcType" in ('undef', 'ether', 'vlan', 'mirrior', 'atmSduatmCell', 'atmVcc', 'atmVpc', 'frDlci', 'ipipe', 'satopE1', 'satopT1', 'satopE3', 'satopT3', 'cesopsn', 'cesopsnCas')), "sdpBindBaseStatsIngFwdPackets" integer, "sdpBindBaseStatsIngFwdOctets" integer, "sdpBindBaseStatsEgrFwdPackets" integer, "sdpBindBaseStatsEgrFwdOctets" integer);
CREATE INDEX "mpls_sdp_binds_device_id_index" on "mpls_sdp_binds" ("device_id");
CREATE TABLE IF NOT EXISTS "mpls_services" ("svc_id" integer primary key autoincrement not null, "svc_oid" integer not null, "device_id" integer not null, "svcRowStatus" varchar check ("svcRowStatus" in ('active', 'notInService', 'notReady', 'createAndGo', 'createAndWait', 'destroy')), "svcType" varchar check ("svcType" in ('unknown', 'epipe', 'tls', 'vprn', 'ies', 'mirror', 'apipe', 'fpipe', 'ipipe', 'cpipe', 'intTls', 'evpnIsaTls')), "svcCustId" integer, "svcAdminStatus" varchar check ("svcAdminStatus" in ('up', 'down')), "svcOperStatus" varchar check ("svcOperStatus" in ('up', 'down')), "svcDescription" varchar, "svcMtu" integer, "svcNumSaps" integer, "svcNumSdps" integer, "svcLastMgmtChange" integer, "svcLastStatusChange" integer, "svcVRouterId" integer, "svcTlsMacLearning" varchar check ("svcTlsMacLearning" in ('enabled', 'disabled')), "svcTlsStpAdminStatus" varchar check ("svcTlsStpAdminStatus" in ('enabled', 'disabled')), "svcTlsStpOperStatus" varchar check ("svcTlsStpOperStatus" in ('up', 'down')), "svcTlsFdbTableSize" integer, "svcTlsFdbNumEntries" integer);
@ -236,13 +213,12 @@ CREATE UNIQUE INDEX application_metrics_app_id_metric_unique ON application_metr
CREATE TABLE availability (availability_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, duration INTEGER NOT NULL, availability_perc NUMERIC(9, 6) DEFAULT '0' NOT NULL);
CREATE INDEX availability_device_id_index ON availability (device_id);
CREATE UNIQUE INDEX availability_device_id_duration_unique ON availability (device_id, duration);
CREATE TABLE devices (device_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, hostname VARCHAR(255) NOT NULL, sysName VARCHAR(255) DEFAULT NULL, ip BLOB DEFAULT NULL, community VARCHAR(255) DEFAULT NULL, authlevel VARCHAR(255) DEFAULT NULL, authname VARCHAR(255) DEFAULT NULL, authpass VARCHAR(255) DEFAULT NULL, authalgo VARCHAR(10) DEFAULT NULL, cryptopass VARCHAR(255) DEFAULT NULL, cryptoalgo VARCHAR(10) DEFAULT NULL, snmpver VARCHAR(255) DEFAULT 'v2c' NOT NULL, port INTEGER DEFAULT 161 NOT NULL, transport VARCHAR(255) DEFAULT 'udp' NOT NULL, timeout INTEGER DEFAULT NULL, retries INTEGER DEFAULT NULL, snmp_disable BOOLEAN DEFAULT 0 NOT NULL, bgpLocalAs INTEGER DEFAULT NULL, sysObjectID VARCHAR(255) DEFAULT NULL, sysDescr CLOB DEFAULT NULL, sysContact CLOB DEFAULT NULL, version CLOB DEFAULT NULL, hardware CLOB DEFAULT NULL, features CLOB DEFAULT NULL, location_id INTEGER DEFAULT NULL, os VARCHAR(255) DEFAULT NULL, status BOOLEAN DEFAULT 0 NOT NULL, status_reason VARCHAR(255) NOT NULL, "ignore" BOOLEAN DEFAULT 0 NOT NULL, disabled BOOLEAN DEFAULT 0 NOT NULL, uptime INTEGER DEFAULT NULL, agent_uptime INTEGER DEFAULT 0 NOT NULL, last_polled DATETIME DEFAULT NULL, last_poll_attempted DATETIME DEFAULT NULL, last_polled_timetaken DOUBLE PRECISION DEFAULT NULL, last_discovered_timetaken DOUBLE PRECISION DEFAULT NULL, last_discovered DATETIME DEFAULT NULL, last_ping DATETIME DEFAULT NULL, last_ping_timetaken DOUBLE PRECISION DEFAULT NULL, purpose CLOB DEFAULT NULL, type VARCHAR(255) DEFAULT '' NOT NULL, serial CLOB DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL, poller_group INTEGER DEFAULT 0 NOT NULL, override_sysLocation BOOLEAN DEFAULT 0, notes CLOB DEFAULT NULL, port_association_mode INTEGER DEFAULT 1 NOT NULL, max_depth INTEGER DEFAULT 0 NOT NULL, overwrite_ip VARCHAR(255) DEFAULT NULL, disable_notify BOOLEAN DEFAULT 0 NOT NULL, inserted DATETIME DEFAULT NULL, "display" varchar);
CREATE TABLE devices (device_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, hostname VARCHAR(255) NOT NULL, sysName VARCHAR(255) DEFAULT NULL, ip BLOB DEFAULT NULL, community VARCHAR(255) DEFAULT NULL, authlevel VARCHAR(255) DEFAULT NULL, authname VARCHAR(255) DEFAULT NULL, authpass VARCHAR(255) DEFAULT NULL, authalgo VARCHAR(10) DEFAULT NULL, cryptopass VARCHAR(255) DEFAULT NULL, cryptoalgo VARCHAR(10) DEFAULT NULL, snmpver VARCHAR(255) DEFAULT 'v2c' NOT NULL, port INTEGER DEFAULT 161 NOT NULL, transport VARCHAR(255) DEFAULT 'udp' NOT NULL, timeout INTEGER DEFAULT NULL, retries INTEGER DEFAULT NULL, snmp_disable BOOLEAN DEFAULT 0 NOT NULL, bgpLocalAs INTEGER DEFAULT NULL, sysObjectID VARCHAR(255) DEFAULT NULL, sysDescr CLOB DEFAULT NULL, sysContact CLOB DEFAULT NULL, version CLOB DEFAULT NULL, hardware CLOB DEFAULT NULL, features CLOB DEFAULT NULL, location_id INTEGER DEFAULT NULL, os VARCHAR(255) DEFAULT NULL, status BOOLEAN DEFAULT 0 NOT NULL, status_reason VARCHAR(255) NOT NULL, "ignore" BOOLEAN DEFAULT 0 NOT NULL, disabled BOOLEAN DEFAULT 0 NOT NULL, uptime INTEGER DEFAULT NULL, agent_uptime INTEGER DEFAULT 0 NOT NULL, last_polled DATETIME DEFAULT NULL, last_poll_attempted DATETIME DEFAULT NULL, last_polled_timetaken DOUBLE PRECISION DEFAULT NULL, last_discovered_timetaken DOUBLE PRECISION DEFAULT NULL, last_discovered DATETIME DEFAULT NULL, last_ping DATETIME DEFAULT NULL, last_ping_timetaken DOUBLE PRECISION DEFAULT NULL, purpose CLOB DEFAULT NULL, type VARCHAR(255) DEFAULT '' NOT NULL, serial CLOB DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL, poller_group INTEGER DEFAULT 0 NOT NULL, override_sysLocation BOOLEAN DEFAULT 0, notes CLOB DEFAULT NULL, port_association_mode INTEGER DEFAULT 1 NOT NULL, max_depth INTEGER DEFAULT 0 NOT NULL, overwrite_ip VARCHAR(255) DEFAULT NULL, disable_notify BOOLEAN DEFAULT 0 NOT NULL, inserted DATETIME DEFAULT NULL, "display" varchar, "ignore_status" tinyint(1) not null default '0');
CREATE INDEX devices_last_poll_attempted_index ON devices (last_poll_attempted);
CREATE INDEX devices_last_polled_index ON devices (last_polled);
CREATE INDEX devices_status_index ON devices (status);
CREATE INDEX devices_os_index ON devices (os);
CREATE INDEX devices_sysname_index ON devices (sysName);
CREATE INDEX "device_perf_device_id_timestamp_index" on "device_perf" ("device_id", "timestamp");
CREATE TABLE device_outages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, going_down INTEGER NOT NULL, up_again INTEGER DEFAULT NULL);
CREATE INDEX device_outages_device_id_index ON device_outages (device_id);
CREATE UNIQUE INDEX device_outages_device_id_going_down_unique ON device_outages (device_id, going_down);
@ -261,8 +237,6 @@ CREATE INDEX "alert_log_rule_id_device_id_state_index" on "alert_log" ("rule_id"
CREATE TABLE IF NOT EXISTS "cache_locks" ("key" varchar not null, "owner" varchar not null, "expiration" integer not null, primary key ("key"));
CREATE TABLE mempools (mempool_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mempool_index VARCHAR(255) NOT NULL COLLATE "BINARY", entPhysicalIndex INTEGER DEFAULT NULL, mempool_type VARCHAR(255) NOT NULL COLLATE "BINARY", mempool_precision INTEGER DEFAULT 1 NOT NULL, mempool_descr VARCHAR(255) NOT NULL COLLATE "BINARY", device_id INTEGER NOT NULL, mempool_perc INTEGER NOT NULL, mempool_used INTEGER NOT NULL, mempool_free INTEGER NOT NULL, mempool_total INTEGER NOT NULL, mempool_largestfree INTEGER DEFAULT NULL, mempool_lowestfree INTEGER DEFAULT NULL, mempool_deleted BOOLEAN DEFAULT 0 NOT NULL, mempool_perc_warn INTEGER DEFAULT NULL);
CREATE INDEX mempools_device_id_index ON mempools (device_id);
CREATE TABLE ospf_areas (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, ospfAreaId VARCHAR(255) NOT NULL, ospfAuthType VARCHAR(64) DEFAULT NULL, ospfImportAsExtern VARCHAR(255) NOT NULL, ospfSpfRuns INTEGER NOT NULL, ospfAreaBdrRtrCount INTEGER NOT NULL, ospfAsBdrRtrCount INTEGER NOT NULL, ospfAreaLsaCount INTEGER NOT NULL, ospfAreaLsaCksumSum INTEGER NOT NULL, ospfAreaSummary VARCHAR(255) NOT NULL, ospfAreaStatus VARCHAR(255) NOT NULL, context_name VARCHAR(255) DEFAULT NULL);
CREATE UNIQUE INDEX ospf_areas_device_id_ospfareaid_context_name_unique ON ospf_areas (device_id, ospfAreaId, context_name);
CREATE TABLE IF NOT EXISTS "port_group_port" ("port_group_id" integer not null, "port_id" integer not null, primary key ("port_group_id", "port_id"));
CREATE INDEX "port_group_port_port_group_id_index" on "port_group_port" ("port_group_id");
CREATE INDEX "port_group_port_port_id_index" on "port_group_port" ("port_id");
@ -303,9 +277,6 @@ CREATE TABLE ports (port_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_i
CREATE INDEX ports_ifdescr_ifname_index ON ports (ifDescr, ifName);
CREATE INDEX ports_ifalias_port_descr_descr_portname_index ON ports (ifAlias, port_descr_descr, portName);
CREATE UNIQUE INDEX ports_device_id_ifindex_unique ON ports (device_id, ifIndex);
CREATE TABLE vminfo (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, vm_type VARCHAR(255) DEFAULT 'vmware' NOT NULL, vmwVmVMID INTEGER NOT NULL, vmwVmDisplayName VARCHAR(255) NOT NULL, vmwVmGuestOS VARCHAR(128) DEFAULT NULL, vmwVmMemSize INTEGER NOT NULL, vmwVmCpus INTEGER NOT NULL, vmwVmState SMALLINT UNSIGNED NOT NULL);
CREATE INDEX vminfo_device_id_index ON vminfo (device_id);
CREATE INDEX vminfo_vmwvmvmid_index ON vminfo (vmwVmVMID);
CREATE TABLE slas (sla_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, sla_nr INTEGER UNSIGNED NOT NULL, owner VARCHAR(255) NOT NULL COLLATE "BINARY", tag VARCHAR(255) NOT NULL COLLATE "BINARY", rtt_type VARCHAR(255) NOT NULL COLLATE "BINARY", status BOOLEAN NOT NULL, deleted BOOLEAN DEFAULT 0 NOT NULL, rtt DOUBLE PRECISION DEFAULT NULL, opstatus INTEGER DEFAULT 0 NOT NULL);
CREATE INDEX slas_device_id_index ON slas (device_id);
CREATE UNIQUE INDEX slas_device_id_sla_nr_unique ON slas (device_id, sla_nr);
@ -330,6 +301,45 @@ CREATE TABLE applications (app_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, de
CREATE UNIQUE INDEX applications_device_id_app_type_unique ON applications (device_id, app_type);
CREATE TABLE processes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, pid INTEGER NOT NULL, vsz INTEGER NOT NULL, rss INTEGER NOT NULL, cputime VARCHAR(14) NOT NULL, user VARCHAR(255) NOT NULL, command CLOB NOT NULL);
CREATE INDEX processes_device_id_index ON processes (device_id);
CREATE TABLE bgpPeers_cbgp (device_id INTEGER NOT NULL, bgpPeerIdentifier VARCHAR(255) NOT NULL, afi VARCHAR(255) NOT NULL, safi VARCHAR(255) NOT NULL, AcceptedPrefixes INTEGER UNSIGNED NOT NULL, DeniedPrefixes INTEGER UNSIGNED NOT NULL, PrefixAdminLimit INTEGER UNSIGNED NOT NULL, PrefixThreshold INTEGER UNSIGNED NOT NULL, PrefixClearThreshold INTEGER UNSIGNED NOT NULL, AdvertisedPrefixes INTEGER UNSIGNED NOT NULL, SuppressedPrefixes INTEGER UNSIGNED NOT NULL, WithdrawnPrefixes INTEGER UNSIGNED NOT NULL, AcceptedPrefixes_delta INTEGER NOT NULL, AcceptedPrefixes_prev INTEGER UNSIGNED NOT NULL, DeniedPrefixes_delta INTEGER NOT NULL, DeniedPrefixes_prev INTEGER UNSIGNED NOT NULL, AdvertisedPrefixes_delta INTEGER NOT NULL, AdvertisedPrefixes_prev INTEGER UNSIGNED NOT NULL, SuppressedPrefixes_delta INTEGER NOT NULL, SuppressedPrefixes_prev INTEGER UNSIGNED NOT NULL, WithdrawnPrefixes_delta INTEGER NOT NULL, WithdrawnPrefixes_prev INTEGER UNSIGNED NOT NULL, context_name VARCHAR(255) DEFAULT NULL);
CREATE INDEX bgppeers_cbgp_device_id_bgppeeridentifier_context_name_index ON bgpPeers_cbgp (device_id, bgpPeerIdentifier, context_name);
CREATE UNIQUE INDEX bgppeers_cbgp_device_id_bgppeeridentifier_afi_safi_unique ON bgpPeers_cbgp (device_id, bgpPeerIdentifier, afi, safi);
CREATE TABLE bgpPeers (bgpPeer_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, astext VARCHAR(255) NOT NULL, bgpPeerIdentifier CLOB NOT NULL, bgpPeerRemoteAs INTEGER NOT NULL, bgpPeerState CLOB NOT NULL, bgpPeerAdminStatus CLOB NOT NULL, bgpLocalAddr CLOB NOT NULL, bgpPeerRemoteAddr CLOB NOT NULL, bgpPeerDescr VARCHAR(255) DEFAULT '' NOT NULL, bgpPeerInUpdates INTEGER UNSIGNED NOT NULL, bgpPeerOutUpdates INTEGER UNSIGNED NOT NULL, bgpPeerInTotalMessages INTEGER UNSIGNED NOT NULL, bgpPeerOutTotalMessages INTEGER UNSIGNED NOT NULL, bgpPeerFsmEstablishedTime INTEGER UNSIGNED NOT NULL, bgpPeerInUpdateElapsedTime INTEGER UNSIGNED NOT NULL, context_name VARCHAR(255) DEFAULT NULL, vrf_id INTEGER DEFAULT NULL, bgpPeerLastErrorCode INTEGER DEFAULT NULL, bgpPeerLastErrorSubCode INTEGER DEFAULT NULL, bgpPeerLastErrorText VARCHAR(255) DEFAULT NULL, bgpPeerIface INTEGER DEFAULT NULL);
CREATE INDEX bgppeers_device_id_context_name_index ON bgpPeers (device_id, context_name);
CREATE TABLE ports_statistics (port_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ifInNUcastPkts BIGINT UNSIGNED DEFAULT NULL, ifInNUcastPkts_prev BIGINT UNSIGNED DEFAULT NULL, ifInNUcastPkts_delta BIGINT DEFAULT NULL, ifInNUcastPkts_rate INTEGER DEFAULT NULL, ifOutNUcastPkts BIGINT UNSIGNED DEFAULT NULL, ifOutNUcastPkts_prev BIGINT UNSIGNED DEFAULT NULL, ifOutNUcastPkts_delta BIGINT DEFAULT NULL, ifOutNUcastPkts_rate INTEGER DEFAULT NULL, ifInDiscards BIGINT UNSIGNED DEFAULT NULL, ifInDiscards_prev BIGINT UNSIGNED DEFAULT NULL, ifInDiscards_delta BIGINT DEFAULT NULL, ifInDiscards_rate INTEGER DEFAULT NULL, ifOutDiscards BIGINT UNSIGNED DEFAULT NULL, ifOutDiscards_prev BIGINT UNSIGNED DEFAULT NULL, ifOutDiscards_delta BIGINT DEFAULT NULL, ifOutDiscards_rate INTEGER DEFAULT NULL, ifInUnknownProtos BIGINT UNSIGNED DEFAULT NULL, ifInUnknownProtos_prev BIGINT UNSIGNED DEFAULT NULL, ifInUnknownProtos_delta BIGINT DEFAULT NULL, ifInUnknownProtos_rate INTEGER DEFAULT NULL, ifInBroadcastPkts BIGINT UNSIGNED DEFAULT NULL, ifInBroadcastPkts_prev BIGINT UNSIGNED DEFAULT NULL, ifInBroadcastPkts_delta BIGINT DEFAULT NULL, ifInBroadcastPkts_rate INTEGER DEFAULT NULL, ifOutBroadcastPkts BIGINT UNSIGNED DEFAULT NULL, ifOutBroadcastPkts_prev BIGINT UNSIGNED DEFAULT NULL, ifOutBroadcastPkts_delta BIGINT DEFAULT NULL, ifOutBroadcastPkts_rate INTEGER DEFAULT NULL, ifInMulticastPkts BIGINT UNSIGNED DEFAULT NULL, ifInMulticastPkts_prev BIGINT UNSIGNED DEFAULT NULL, ifInMulticastPkts_delta BIGINT DEFAULT NULL, ifInMulticastPkts_rate INTEGER DEFAULT NULL, ifOutMulticastPkts BIGINT UNSIGNED DEFAULT NULL, ifOutMulticastPkts_prev BIGINT UNSIGNED DEFAULT NULL, ifOutMulticastPkts_delta BIGINT DEFAULT NULL, ifOutMulticastPkts_rate INTEGER DEFAULT NULL);
CREATE TABLE ciscoASA (ciscoASA_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, oid VARCHAR(255) NOT NULL, data INTEGER NOT NULL, high_alert BIGINT DEFAULT -1 NOT NULL, low_alert BIGINT DEFAULT 0 NOT NULL, disabled INTEGER DEFAULT 0 NOT NULL);
CREATE INDEX ciscoasa_device_id_index ON ciscoASA (device_id);
CREATE TABLE ospf_areas (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, ospfAreaId VARCHAR(255) NOT NULL, ospfAuthType VARCHAR(64) DEFAULT NULL, ospfImportAsExtern VARCHAR(255) NOT NULL, ospfSpfRuns INTEGER UNSIGNED NOT NULL, ospfAreaBdrRtrCount INTEGER UNSIGNED NOT NULL, ospfAsBdrRtrCount INTEGER UNSIGNED NOT NULL, ospfAreaLsaCount INTEGER UNSIGNED NOT NULL, ospfAreaLsaCksumSum INTEGER NOT NULL, ospfAreaSummary VARCHAR(255) NOT NULL, ospfAreaStatus VARCHAR(255) NOT NULL, context_name VARCHAR(255) DEFAULT NULL);
CREATE UNIQUE INDEX ospf_areas_device_id_ospfareaid_context_name_unique ON ospf_areas (device_id, ospfAreaId, context_name);
CREATE TABLE ospf_instances (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, ospf_instance_id INTEGER NOT NULL, ospfRouterId VARCHAR(255) NOT NULL, ospfAdminStat VARCHAR(255) NOT NULL, ospfVersionNumber VARCHAR(255) NOT NULL, ospfAreaBdrRtrStatus VARCHAR(255) NOT NULL, ospfASBdrRtrStatus VARCHAR(255) NOT NULL, ospfExternLsaCount INTEGER UNSIGNED NOT NULL, ospfExternLsaCksumSum INTEGER NOT NULL, ospfTOSSupport VARCHAR(255) NOT NULL, ospfOriginateNewLsas INTEGER UNSIGNED NOT NULL, ospfRxNewLsas INTEGER UNSIGNED NOT NULL, ospfExtLsdbLimit INTEGER DEFAULT NULL, ospfMulticastExtensions INTEGER DEFAULT NULL, ospfExitOverflowInterval INTEGER DEFAULT NULL, ospfDemandExtensions VARCHAR(255) DEFAULT NULL, context_name VARCHAR(255) DEFAULT NULL);
CREATE UNIQUE INDEX ospf_instances_device_id_ospf_instance_id_context_name_unique ON ospf_instances (device_id, ospf_instance_id, context_name);
CREATE TABLE ospf_nbrs (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER DEFAULT NULL, ospf_nbr_id VARCHAR(255) NOT NULL, ospfNbrIpAddr VARCHAR(255) NOT NULL, ospfNbrAddressLessIndex INTEGER NOT NULL, ospfNbrRtrId VARCHAR(255) NOT NULL, ospfNbrOptions INTEGER NOT NULL, ospfNbrPriority INTEGER NOT NULL, ospfNbrState VARCHAR(255) NOT NULL, ospfNbrEvents INTEGER UNSIGNED NOT NULL, ospfNbrLsRetransQLen INTEGER UNSIGNED NOT NULL, ospfNbmaNbrStatus VARCHAR(255) NOT NULL, ospfNbmaNbrPermanence VARCHAR(255) NOT NULL, ospfNbrHelloSuppressed VARCHAR(255) NOT NULL, context_name VARCHAR(255) DEFAULT NULL);
CREATE UNIQUE INDEX ospf_nbrs_device_id_ospf_nbr_id_context_name_unique ON ospf_nbrs (device_id, ospf_nbr_id, context_name);
CREATE TABLE ospf_ports (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, port_id INTEGER NOT NULL, ospf_port_id VARCHAR(255) NOT NULL, ospfIfIpAddress VARCHAR(255) NOT NULL, ospfAddressLessIf INTEGER NOT NULL, ospfIfAreaId VARCHAR(255) NOT NULL, ospfIfType VARCHAR(255) DEFAULT NULL, ospfIfAdminStat VARCHAR(255) DEFAULT NULL, ospfIfRtrPriority INTEGER DEFAULT NULL, ospfIfTransitDelay INTEGER DEFAULT NULL, ospfIfRetransInterval INTEGER DEFAULT NULL, ospfIfHelloInterval INTEGER DEFAULT NULL, ospfIfRtrDeadInterval INTEGER DEFAULT NULL, ospfIfPollInterval INTEGER DEFAULT NULL, ospfIfState VARCHAR(255) DEFAULT NULL, ospfIfDesignatedRouter VARCHAR(255) DEFAULT NULL, ospfIfBackupDesignatedRouter VARCHAR(255) DEFAULT NULL, ospfIfEvents INTEGER UNSIGNED DEFAULT NULL, ospfIfAuthKey VARCHAR(255) DEFAULT NULL, ospfIfStatus VARCHAR(255) DEFAULT NULL, ospfIfMulticastForwarding VARCHAR(255) DEFAULT NULL, ospfIfDemand VARCHAR(255) DEFAULT NULL, ospfIfAuthType VARCHAR(255) DEFAULT NULL, context_name VARCHAR(255) DEFAULT NULL, ospfIfMetricIpAddress VARCHAR(255) DEFAULT NULL, ospfIfMetricAddressLessIf INTEGER DEFAULT NULL, ospfIfMetricTOS INTEGER DEFAULT NULL, ospfIfMetricValue INTEGER DEFAULT NULL, ospfIfMetricStatus VARCHAR(255) DEFAULT NULL);
CREATE UNIQUE INDEX ospf_ports_device_id_ospf_port_id_context_name_unique ON ospf_ports (device_id, ospf_port_id, context_name);
CREATE TABLE packages (pkg_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, name VARCHAR(128) NOT NULL, manager VARCHAR(255) DEFAULT '1' NOT NULL, status BOOLEAN NOT NULL, version VARCHAR(255) NOT NULL, build VARCHAR(255) NOT NULL, arch VARCHAR(255) NOT NULL, size INTEGER DEFAULT NULL);
CREATE INDEX packages_device_id_index ON packages (device_id);
CREATE UNIQUE INDEX packages_device_id_name_manager_arch_version_build_unique ON packages (device_id, name, manager, arch, version, build);
CREATE TABLE vminfo (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, vm_type VARCHAR(255) DEFAULT 'vmware' NOT NULL, vmwVmVMID INTEGER NOT NULL, vmwVmDisplayName VARCHAR(255) NOT NULL, vmwVmGuestOS VARCHAR(256) DEFAULT NULL, vmwVmMemSize INTEGER NOT NULL, vmwVmCpus INTEGER NOT NULL, vmwVmState SMALLINT UNSIGNED NOT NULL);
CREATE INDEX vminfo_vmwvmvmid_index ON vminfo (vmwVmVMID);
CREATE INDEX vminfo_device_id_index ON vminfo (device_id);
CREATE TABLE IF NOT EXISTS "custom_map_nodes" ("custom_map_node_id" integer primary key autoincrement not null, "custom_map_id" integer not null, "device_id" integer, "label" varchar not null, "style" varchar not null, "icon" varchar, "size" integer not null, "border_width" integer not null, "text_face" varchar not null, "text_size" integer not null, "text_colour" varchar not null, "colour_bg" varchar, "colour_bdr" varchar, "x_pos" integer not null, "y_pos" integer not null, "created_at" datetime, "updated_at" datetime, "image" varchar not null default '', "linked_custom_map_id" integer, foreign key("device_id") references "devices"("device_id") on delete set null, foreign key("custom_map_id") references "custom_maps"("custom_map_id") on delete cascade);
CREATE INDEX "custom_map_nodes_custom_map_id_index" on "custom_map_nodes" ("custom_map_id");
CREATE INDEX "custom_map_nodes_device_id_index" on "custom_map_nodes" ("device_id");
CREATE TABLE IF NOT EXISTS "custom_map_edges" ("custom_map_edge_id" integer primary key autoincrement not null, "custom_map_id" integer not null, "custom_map_node1_id" integer not null, "custom_map_node2_id" integer not null, "port_id" integer, "reverse" tinyint(1) not null, "style" varchar not null, "showpct" tinyint(1) not null, "text_face" varchar not null, "text_size" integer not null, "text_colour" varchar not null, "mid_x" integer not null, "mid_y" integer not null, "created_at" datetime, "updated_at" datetime, "showbps" tinyint(1) not null default '0', "label" varchar not null default '', foreign key("custom_map_id") references "custom_maps"("custom_map_id") on delete cascade, foreign key("port_id") references "ports"("port_id") on delete set null, foreign key("custom_map_node1_id") references "custom_map_nodes"("custom_map_node_id") on delete cascade, foreign key("custom_map_node2_id") references "custom_map_nodes"("custom_map_node_id") on delete cascade);
CREATE INDEX "custom_map_edges_custom_map_id_index" on "custom_map_edges" ("custom_map_id");
CREATE INDEX "custom_map_edges_custom_map_node1_id_index" on "custom_map_edges" ("custom_map_node1_id");
CREATE INDEX "custom_map_edges_custom_map_node2_id_index" on "custom_map_edges" ("custom_map_node2_id");
CREATE INDEX "custom_map_edges_port_id_index" on "custom_map_edges" ("port_id");
CREATE TABLE IF NOT EXISTS "custom_map_backgrounds" ("custom_map_background_id" integer primary key autoincrement not null, "created_at" datetime, "updated_at" datetime, "custom_map_id" integer not null, "background_image" blob not null, foreign key("custom_map_id") references "custom_maps"("custom_map_id") on delete cascade);
CREATE UNIQUE INDEX "custom_map_backgrounds_custom_map_id_unique" on "custom_map_backgrounds" ("custom_map_id");
CREATE TABLE mpls_sdps (sdp_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, sdp_oid INTEGER NOT NULL, device_id INTEGER NOT NULL, sdpRowStatus VARCHAR(255) DEFAULT NULL COLLATE "BINARY", sdpDelivery VARCHAR(255) DEFAULT NULL COLLATE "BINARY", sdpDescription VARCHAR(255) DEFAULT NULL COLLATE "BINARY", sdpAdminStatus VARCHAR(255) DEFAULT NULL COLLATE "BINARY", sdpOperStatus VARCHAR(255) DEFAULT NULL COLLATE "BINARY", sdpAdminPathMtu INTEGER DEFAULT NULL, sdpOperPathMtu INTEGER DEFAULT NULL, sdpLastMgmtChange INTEGER DEFAULT NULL, sdpLastStatusChange INTEGER DEFAULT NULL, sdpActiveLspType VARCHAR(255) DEFAULT NULL COLLATE "BINARY", sdpFarEndInetAddress VARCHAR(255) DEFAULT NULL COLLATE "BINARY", "sdpFarEndInetAddressType" varchar check ("sdpFarEndInetAddressType" in ('unknown', 'ipv4', 'ipv6', 'ipv4z', 'ipv6z', 'dns')));
CREATE INDEX mpls_sdps_device_id_index ON mpls_sdps (device_id);
CREATE INDEX "custom_map_nodes_linked_custom_map_id_index" on "custom_map_nodes" ("linked_custom_map_id");
CREATE INDEX "bill_data_bill_id_timestamp_index" on "bill_data" ("bill_id", "timestamp");
CREATE TABLE custom_maps (custom_map_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL COLLATE "BINARY", width VARCHAR(255) NOT NULL COLLATE "BINARY", height VARCHAR(255) NOT NULL COLLATE "BINARY", options CLOB DEFAULT NULL COLLATE "BINARY", newnodeconfig CLOB NOT NULL COLLATE "BINARY", newedgeconfig CLOB NOT NULL COLLATE "BINARY", created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, node_align INTEGER DEFAULT 0 NOT NULL, reverse_arrows BOOLEAN DEFAULT 0 NOT NULL, edge_separation INTEGER DEFAULT 10 NOT NULL, legend_x INTEGER DEFAULT -1 NOT NULL, legend_y INTEGER DEFAULT -1 NOT NULL, legend_steps INTEGER DEFAULT 7 NOT NULL, legend_font_size INTEGER DEFAULT 14 NOT NULL, legend_hide_invalid BOOLEAN DEFAULT 0 NOT NULL, legend_hide_overspeed BOOLEAN DEFAULT 0 NOT NULL, menu_group VARCHAR(255) DEFAULT NULL COLLATE "BINARY", background_type VARCHAR(255) DEFAULT 'none' NOT NULL COLLATE "BINARY", background_data CLOB DEFAULT NULL COLLATE "BINARY");
CREATE TABLE entPhysical (entPhysical_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, device_id INTEGER NOT NULL, entPhysicalIndex INTEGER NOT NULL, entPhysicalDescr CLOB DEFAULT NULL, entPhysicalClass CLOB DEFAULT NULL, entPhysicalName CLOB DEFAULT NULL, entPhysicalHardwareRev VARCHAR(255) DEFAULT NULL, entPhysicalFirmwareRev VARCHAR(255) DEFAULT NULL, entPhysicalSoftwareRev VARCHAR(255) DEFAULT NULL, entPhysicalAlias VARCHAR(255) DEFAULT NULL, entPhysicalAssetID VARCHAR(255) DEFAULT NULL, entPhysicalIsFRU VARCHAR(255) DEFAULT NULL, entPhysicalModelName CLOB DEFAULT NULL, entPhysicalVendorType CLOB DEFAULT NULL, entPhysicalSerialNum CLOB DEFAULT NULL, entPhysicalContainedIn INTEGER DEFAULT 0 NOT NULL, entPhysicalParentRelPos INTEGER DEFAULT -1 NOT NULL, entPhysicalMfgName CLOB DEFAULT NULL, ifIndex INTEGER DEFAULT NULL);
CREATE INDEX entphysical_device_id_index ON entPhysical (device_id);
INSERT INTO migrations VALUES(1,'2018_07_03_091314_create_access_points_table',1);
INSERT INTO migrations VALUES(2,'2018_07_03_091314_create_alert_device_map_table',1);
INSERT INTO migrations VALUES(3,'2018_07_03_091314_create_alert_group_map_table',1);
@ -592,3 +602,37 @@ INSERT INTO migrations VALUES(259,'2023_08_30_105156_add_applications_soft_delet
INSERT INTO migrations VALUES(260,'2023_09_01_084057_application_new_defaults',1);
INSERT INTO migrations VALUES(261,'2023_10_07_170735_increase_processes_cputime_length',1);
INSERT INTO migrations VALUES(262,'2023_10_07_231037_application_metrics_add_primary_key',1);
INSERT INTO migrations VALUES(263,'2023_10_12_183306_ports_statistics_table_unsigned_stats',1);
INSERT INTO migrations VALUES(264,'2023_10_12_184311_bgp_peers_cbgp_table_unsigned_stats',1);
INSERT INTO migrations VALUES(265,'2023_10_12_184652_bgp_peers_table_unsigned_stats',1);
INSERT INTO migrations VALUES(266,'2023_10_14_162039_restore_ports_delta_fields',1);
INSERT INTO migrations VALUES(267,'2023_10_14_162234_restore_bgp_peers_cbgp_delta_fields',1);
INSERT INTO migrations VALUES(268,'2023_10_20_075853_cisco_asa_add_default_limits',1);
INSERT INTO migrations VALUES(269,'2023_10_31_074547_ospf_areas_unsigned',1);
INSERT INTO migrations VALUES(270,'2023_10_31_074901_ospf_instances_unsigned',1);
INSERT INTO migrations VALUES(271,'2023_10_31_075239_ospf_nbrs_unsigned',1);
INSERT INTO migrations VALUES(272,'2023_10_31_080052_ospf_ports_unsigned',1);
INSERT INTO migrations VALUES(273,'2023_11_04_125846_packages_increase_name_column_length',1);
INSERT INTO migrations VALUES(274,'2023_11_21_172239_increase_vminfo.vmwvmguestos_column_length',1);
INSERT INTO migrations VALUES(275,'2023_12_08_080319_create_custom_map_table',1);
INSERT INTO migrations VALUES(276,'2023_12_08_081420_create_custom_map_node_table',1);
INSERT INTO migrations VALUES(277,'2023_12_08_082518_create_custom_map_edge_table',1);
INSERT INTO migrations VALUES(278,'2023_12_08_083319_create_custom_map_background_table',1);
INSERT INTO migrations VALUES(279,'2023_12_08_184652_mpls_addrtype_fix',1);
INSERT INTO migrations VALUES(280,'2023_12_10_130000_historical_data_to_ports_nac',1);
INSERT INTO migrations VALUES(281,'2023_12_12_171400_alert_rule_note',1);
INSERT INTO migrations VALUES(282,'2023_12_15_105529_access_points_nummonbssid_integer',1);
INSERT INTO migrations VALUES(283,'2023_12_19_082112_custom_map_grid_snap',1);
INSERT INTO migrations VALUES(284,'2024_01_04_195618_add_ignore_status_to_devices_tables',1);
INSERT INTO migrations VALUES(285,'2024_01_08_223812_custom_map_node_image',1);
INSERT INTO migrations VALUES(286,'2024_01_09_211518_custom_map_node_maplink',1);
INSERT INTO migrations VALUES(287,'2024_01_09_223917_bill_data_new_primary',1);
INSERT INTO migrations VALUES(288,'2024_01_09_223927_bill_data_updated_indexes',1);
INSERT INTO migrations VALUES(289,'2024_02_03_201014_custom_map_edge_additions',1);
INSERT INTO migrations VALUES(290,'2024_02_07_151845_custom_map_additions',1);
INSERT INTO migrations VALUES(291,'2024_04_10_093513_remove_device_perf',1);
INSERT INTO migrations VALUES(292,'2024_04_22_161711_custom_maps_add_group',1);
INSERT INTO migrations VALUES(293,'2024_04_29_180911_custom_maps_add_background_type_and_background_data',1);
INSERT INTO migrations VALUES(294,'2024_04_29_183605_custom_maps_drop_background_suffix_and_background_version',1);
INSERT INTO migrations VALUES(295,'2024_07_13_133839_modify_ent_physical_defaults',1);
INSERT INTO migrations VALUES(296,'2024_07_19_120719_update_ports_stack_table',1);

View File

@ -793,7 +793,7 @@ p.vspace { padding-top: 3px; padding-bottom: 3px; }
}
.graphcell, .ifcell, .devicecell, .datacell { margin: 0px 0px 7px 0px; padding: 7px; border: 0px; background: #e8e8e8; float: left; }
.iftable td { padding: 0 15px; }
.iftable td { padding: 0 15px; line-height: 1.42857143; }
.datacell { clear: both; }
.devicecell { margin: 2px auto; }

View File

@ -1,54 +1,8 @@
<?php
$sql = "SELECT * FROM `ports_stack` WHERE `device_id` = '" . $device['device_id'] . "'";
use LibreNMS\OS;
$stack_db_array = [];
foreach (dbFetchRows($sql) as $entry) {
$stack_db_array[$entry['port_id_high']][$entry['port_id_low']]['ifStackStatus'] = $entry['ifStackStatus'];
if (! $os instanceof OS) {
$os = OS::make($device);
}
unset(
$sql,
$entry
);
$stack_poll_array = snmpwalk_cache_twopart_oid($device, 'ifStackStatus', [], 'IF-MIB');
foreach ($stack_poll_array as $port_id_high => $entry_high) {
foreach ($entry_high as $port_id_low => $entry_low) {
$ifStackStatus = $entry_low['ifStackStatus'];
if (isset($stack_db_array[$port_id_high][$port_id_low])) {
if ($stack_db_array[$port_id_high][$port_id_low]['ifStackStatus'] == $ifStackStatus) {
echo '.';
} else {
dbUpdate(['ifStackStatus' => $ifStackStatus], 'ports_stack', 'device_id=? AND port_id_high=? AND `port_id_low`=?', [$device['device_id'], $port_id_high, $port_id_low]);
echo 'U';
}
unset($stack_db_array[$port_id_high][$port_id_low]);
} else {
dbInsert(['device_id' => $device['device_id'], 'port_id_high' => $port_id_high, 'port_id_low' => $port_id_low, 'ifStackStatus' => $ifStackStatus], 'ports_stack');
echo '+';
}
}//end foreach
unset(
$port_id_low,
$entry_low
);
}//end foreach
unset($stack_poll_array);
foreach ($stack_db_array as $port_id_high => $array) {
foreach ($array as $port_id_low => $blah) {
echo $device['device_id'] . ' ' . $port_id_low . ' ' . $port_id_high . "\n";
dbDelete('ports_stack', '`device_id` = ? AND port_id_high = ? AND port_id_low = ?', [$device['device_id'], $port_id_high, $port_id_low]);
echo '-';
}
}
echo "\n";
unset(
$stack_db_array,
$array,
$port_id_high,
$entry_high
);
(new \LibreNMS\Modules\PortsStack())->discover($os);

View File

@ -1244,17 +1244,10 @@ function get_all_ports(Illuminate\Http\Request $request): JsonResponse
function get_port_stack(Illuminate\Http\Request $request)
{
$hostname = $request->route('hostname');
// use hostname as device_id if it's all digits
$device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
$device = DeviceCache::get($hostname);
return check_device_permission($device_id, function ($device_id) use ($request) {
if ($request->get('valid_mappings')) {
$mappings = dbFetchRows("SELECT * FROM `ports_stack` WHERE (`device_id` = ? AND `ifStackStatus` = 'active' AND (`port_id_high` != '0' AND `port_id_low` != '0')) ORDER BY `port_id_high`", [$device_id]);
} else {
$mappings = dbFetchRows("SELECT * FROM `ports_stack` WHERE `device_id` = ? AND `ifStackStatus` = 'active' ORDER BY `port_id_high`", [$device_id]);
}
return api_success($mappings, 'mappings');
return check_device_permission($device->device_id, function () use ($device) {
return api_success($device->portsStack, 'mappings');
});
}

View File

@ -45,9 +45,20 @@ $bg = '#ffffff';
$show_all = 1;
echo "<div style='margin: 0px; width: 100%'><table class='iftable' cellpadding=10 cellspacing=0A>";
echo "<div style='margin: 0px; width: 100%'><table class='iftable'>";
echo view('device.tabs.ports.includes.port_row', ['port' => $port, 'collapsing' => false]);
echo view('device.tabs.ports.includes.port_row', [
'port' => $port,
'data' => [
'neighbors' => [$port->port_id => (new \App\Http\Controllers\Device\Tabs\PortsController())->findPortNeighbors($port)],
'graphs' => [
'bits' => [['type' => 'port_bits', 'title' => trans('Traffic'), 'vars' => [['from' => '-1d'], ['from' => '-7d'], ['from' => '-30d'], ['from' => '-1y']]]],
'upkts' => [['type' => 'port_upkts', 'title' => trans('Packets (Unicast)'), 'vars' => [['from' => '-1d'], ['from' => '-7d'], ['from' => '-30d'], ['from' => '-1y']]]],
'errors' => [['type' => 'port_errors', 'title' => trans('Errors'), 'vars' => [['from' => '-1d'], ['from' => '-7d'], ['from' => '-30d'], ['from' => '-1y']]]],
],
],
'collapsing' => false,
]);
echo '</table></div>';

View File

@ -1698,12 +1698,16 @@ ports_perms:
PRIMARY: { Name: PRIMARY, Columns: [id], Unique: true, Type: BTREE }
ports_stack:
Columns:
- { Field: id, Type: 'bigint unsigned', 'Null': false, Extra: auto_increment }
- { Field: device_id, Type: 'int unsigned', 'Null': false, Extra: '' }
- { Field: port_id_high, Type: 'int unsigned', 'Null': false, Extra: '' }
- { Field: port_id_low, Type: 'int unsigned', 'Null': false, Extra: '' }
- { Field: high_ifIndex, Type: 'int unsigned', 'Null': false, Extra: '' }
- { Field: high_port_id, Type: 'bigint unsigned', 'Null': true, Extra: '' }
- { Field: low_ifIndex, Type: 'int unsigned', 'Null': false, Extra: '' }
- { Field: low_port_id, Type: 'bigint unsigned', 'Null': true, Extra: '' }
- { Field: ifStackStatus, Type: varchar(32), 'Null': false, Extra: '' }
Indexes:
ports_stack_device_id_port_id_high_port_id_low_unique: { Name: ports_stack_device_id_port_id_high_port_id_low_unique, Columns: [device_id, port_id_high, port_id_low], Unique: true, Type: BTREE }
PRIMARY: { Name: PRIMARY, Columns: [id], Unique: true, Type: BTREE }
ports_stack_device_id_port_id_high_port_id_low_unique: { Name: ports_stack_device_id_port_id_high_port_id_low_unique, Columns: [device_id, high_ifIndex, low_ifIndex], Unique: true, Type: BTREE }
ports_statistics:
Columns:
- { Field: port_id, Type: 'int unsigned', 'Null': false, Extra: '' }

View File

@ -102,25 +102,25 @@
<div>{{ $port->ifMtu ? __('port.mtu_label', ['mtu' => $port->ifMtu]) : '' }}</div>
</td>
<td @if($collapsing)class="tw-hidden md:tw-table-cell"@endif>
<x-expandable height="4em">
<x-expandable height="5.8em">
@foreach($data['neighbors'][$port->port_id] as $port_id => $neighbor)
<div>
@php
$np = $data['neighbor_ports']->get($neighbor['port_id']);
$np = $data['neighbor_ports']?->get($neighbor['port_id']) ?? \App\Models\Port::find($neighbor['port_id']);
@endphp
@if($np)
@if(isset($neighbor['link']))
<i class="fa fa-link fa-lg" aria-hidden="true"></i>
<i class="fa fa-link" aria-hidden="true"></i>
@elseif(isset($neighbor['pseudowire']))
<i class="fa fa-arrows-left-right fa-lg" aria-hidden="true"></i>
@elseif(isset($neighbor['stack_low']))
<i class="fa fa-expand fa-lg" aria-hidden="true"></i>
@elseif(isset($neighbor['stack_high']))
<i class="fa fa-compress fa-lg" aria-hidden="true"></i>
<i class="fa fa-arrows-left-right" aria-hidden="true"></i>
@elseif(isset($neighbor['stack_parent']))
<i class="fa fa-expand" aria-hidden="true"></i>
@elseif(isset($neighbor['stack_child']))
<i class="fa fa-compress" aria-hidden="true"></i>
@elseif(isset($neighbor['pagp']))
<i class="fa fa-cube fa-lg tw-text-green-600" aria-hidden="true"></i>
<i class="fa fa-cube tw-text-green-600" aria-hidden="true"></i>
@else
<i class="fa fa-arrow-right fa-lg" aria-hidden="true"></i>
<i class="fa fa-arrow-right" aria-hidden="true"></i>
@endif
<x-port-link :port="$np"></x-port-link>

View File

@ -57,6 +57,10 @@ class SVGTest extends TestCase
continue;
}
if (str_starts_with($file, 'html/images/custommap/background/')) {
continue;
}
$svg = file_get_contents($file);
$this->assertEquals(
@ -79,7 +83,7 @@ class SVGTest extends TestCase
}
}
private function getSvgFiles()
private function getSvgFiles(): RegexIterator
{
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('html/images'));

View File

@ -1999,5 +1999,36 @@
]
},
"poller": "matches discovery"
},
"ports-stack": {
"discovery": {
"ports_stack": [
{
"high_ifIndex": 4,
"low_ifIndex": 7,
"ifStackStatus": "active"
},
{
"high_ifIndex": 5,
"low_ifIndex": 7,
"ifStackStatus": "active"
},
{
"high_ifIndex": 6,
"low_ifIndex": 7,
"ifStackStatus": "active"
},
{
"high_ifIndex": 8,
"low_ifIndex": 7,
"ifStackStatus": "active"
},
{
"high_ifIndex": 9,
"low_ifIndex": 7,
"ifStackStatus": "active"
}
]
}
}
}

View File

@ -2437,8 +2437,8 @@
"ifName": "Console41",
"portName": null,
"ifIndex": 41,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -2537,8 +2537,8 @@
"ifName": "Loopback0",
"portName": null,
"ifIndex": 1000,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -2637,8 +2637,8 @@
"ifName": "VLAN1",
"portName": null,
"ifIndex": 1001,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -2737,8 +2737,8 @@
"ifName": "VLAN3",
"portName": null,
"ifIndex": 1003,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "true",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -3460,5 +3460,111 @@
]
},
"poller": "matches discovery"
},
"ports-stack": {
"discovery": {
"ports_stack": [
{
"high_ifIndex": 1,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 1,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 3,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 3,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 4,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 4,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 5,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 5,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 6,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 6,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 7,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 7,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 8,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 8,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 9,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 9,
"low_ifIndex": 1003,
"ifStackStatus": "active"
},
{
"high_ifIndex": 10,
"low_ifIndex": 1001,
"ifStackStatus": "active"
},
{
"high_ifIndex": 10,
"low_ifIndex": 1003,
"ifStackStatus": "active"
}
]
}
}
}

View File

@ -8578,5 +8578,81 @@
]
},
"poller": "matches discovery"
},
"ports-stack": {
"discovery": {
"ports_stack": [
{
"high_ifIndex": 2113143041,
"low_ifIndex": 2113151233,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2113151233,
"low_ifIndex": 2096390401,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2129920257,
"low_ifIndex": 2129928449,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2129928449,
"low_ifIndex": 2096390401,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2132254951,
"low_ifIndex": 2134647015,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146697473,
"low_ifIndex": 2146705665,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146697601,
"low_ifIndex": 2146705793,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146705665,
"low_ifIndex": 2146722049,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146705793,
"low_ifIndex": 2146722049,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146722049,
"low_ifIndex": 2132254951,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146722049,
"low_ifIndex": 2147410305,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2146722049,
"low_ifIndex": 2147410306,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2147410305,
"low_ifIndex": 2073833473,
"ifStackStatus": "active"
},
{
"high_ifIndex": 2147410305,
"low_ifIndex": 2147426433,
"ifStackStatus": "active"
}
]
}
}
}

View File

@ -4437,8 +4437,8 @@
"ifName": "Logical-int 1",
"portName": null,
"ifIndex": 20000,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -4537,8 +4537,8 @@
"ifName": "1",
"portName": null,
"ifIndex": 100000,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -4637,8 +4637,8 @@
"ifName": "5",
"portName": null,
"ifIndex": 100004,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -4737,8 +4737,8 @@
"ifName": "11",
"portName": null,
"ifIndex": 100010,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -4837,8 +4837,8 @@
"ifName": "20",
"portName": null,
"ifIndex": 100019,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -4937,8 +4937,8 @@
"ifName": "1",
"portName": null,
"ifIndex": 300000,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifConnectorPresent": "false",
"ifOperStatus": "up",
"ifOperStatus_prev": "up",
@ -5931,5 +5931,181 @@
]
},
"poller": "matches discovery"
},
"ports-stack": {
"discovery": {
"ports_stack": [
{
"high_ifIndex": 49,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 49,
"low_ifIndex": 100004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 50,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 51,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 52,
"low_ifIndex": 100004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 53,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 54,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 55,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 56,
"low_ifIndex": 100019,
"ifStackStatus": "active"
},
{
"high_ifIndex": 57,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 58,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 59,
"low_ifIndex": 100004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 60,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 61,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 62,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 62,
"low_ifIndex": 100010,
"ifStackStatus": "active"
},
{
"high_ifIndex": 62,
"low_ifIndex": 100019,
"ifStackStatus": "active"
},
{
"high_ifIndex": 63,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 63,
"low_ifIndex": 100010,
"ifStackStatus": "active"
},
{
"high_ifIndex": 63,
"low_ifIndex": 100019,
"ifStackStatus": "active"
},
{
"high_ifIndex": 64,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 64,
"low_ifIndex": 100004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 64,
"low_ifIndex": 100010,
"ifStackStatus": "active"
},
{
"high_ifIndex": 64,
"low_ifIndex": 100019,
"ifStackStatus": "active"
},
{
"high_ifIndex": 65,
"low_ifIndex": 100004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 65,
"low_ifIndex": 100010,
"ifStackStatus": "active"
},
{
"high_ifIndex": 66,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 66,
"low_ifIndex": 100010,
"ifStackStatus": "active"
},
{
"high_ifIndex": 66,
"low_ifIndex": 100019,
"ifStackStatus": "active"
},
{
"high_ifIndex": 1000,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 1001,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 1001,
"low_ifIndex": 100004,
"ifStackStatus": "active"
},
{
"high_ifIndex": 1002,
"low_ifIndex": 100000,
"ifStackStatus": "active"
},
{
"high_ifIndex": 1003,
"low_ifIndex": 100000,
"ifStackStatus": "active"
}
]
}
}
}