This commit is contained in:
Christian Ramseyer
2019-02-28 09:26:29 +01:00
5 changed files with 21 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces(
);
our # try to hide from kwalitee
$VERSION = 53; # schema version used for upgrades, keep as integer
$VERSION = 54; # schema version used for upgrades, keep as integer
use Path::Class;
use File::ShareDir 'dist_dir';

View File

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

View File

@@ -100,8 +100,8 @@ sub delete_device {
=head2 renumber_device( $current_ip, $new_ip )
Will update all records in Netdisco referring to the device with
C<$current_ip> to use C<$new_ip> instead, followed by renumbering the device
iteself.
C<$current_ip> to use C<$new_ip> instead, followed by renumbering the
device itself.
Returns true if the transaction completes, else returns false.

View File

@@ -101,6 +101,17 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
$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")
unless scalar keys %properties;

View File

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