Change location of ifindex to DevicePortProperties

* instead of DevicePort
* as requested by Oliver in PR #513 review
This commit is contained in:
ram
2019-02-23 15:13:44 +01:00
committed by Christian Ramseyer
parent 24a7e80470
commit c2600ac550
5 changed files with 14 additions and 4 deletions

View File

@@ -69,8 +69,6 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_nullable => 1 }, { data_type => "integer", is_nullable => 1 },
"lastchange", "lastchange",
{ data_type => "bigint", is_nullable => 1 }, { data_type => "bigint", is_nullable => 1 },
"ifindex",
{ data_type => "bigint", is_nullable => 1 },
); );
__PACKAGE__->set_primary_key("port", "ip"); __PACKAGE__->set_primary_key("port", "ip");

View File

@@ -29,6 +29,8 @@ __PACKAGE__->add_columns(
{ data_type => "bigint", is_nullable => 1 }, { data_type => "bigint", is_nullable => 1 },
"faststart", "faststart",
{ data_type => "boolean", is_nullable => 1 }, { data_type => "boolean", is_nullable => 1 },
"ifindex",
{ data_type => "bigint", is_nullable => 1 },
); );
__PACKAGE__->set_primary_key("port", "ip"); __PACKAGE__->set_primary_key("port", "ip");

View File

@@ -101,6 +101,17 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
$properties{ $port }->{remote_serial} = $rem_serial->{ $idx }; $properties{ $port }->{remote_serial} = $rem_serial->{ $idx };
} }
foreach my $idx (keys %$interfaces) {
my $port = $interfaces->{$idx} or next;
if (!defined $device_ports->{$port}) {
debug sprintf ' [%s] properties/ifindex - local port %s already skipped, ignoring',
$device->ip, $port;
next;
}
$properties{ $port }->{ifindex} = $idx;
}
return Status->info(" [$device] no port properties to record") return Status->info(" [$device] no port properties to record")
unless scalar keys %properties; unless scalar keys %properties;

View File

@@ -229,7 +229,6 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
type => $i_type->{$entry}, type => $i_type->{$entry},
vlan => $i_vlan->{$entry}, vlan => $i_vlan->{$entry},
pvid => $i_vlan->{$entry}, pvid => $i_vlan->{$entry},
ifindex => $entry,
is_master => 'false', is_master => 'false',
slave_of => undef, slave_of => undef,
lastchange => $lc, lastchange => $lc,

View File

@@ -1,5 +1,5 @@
BEGIN; BEGIN;
ALTER TABLE device_port ADD COLUMN "ifindex" bigint; ALTER TABLE device_port_properties ADD COLUMN "ifindex" bigint;
COMMIT; COMMIT;