diff --git a/lib/App/Netdisco/DB.pm b/lib/App/Netdisco/DB.pm index 008b5369..5c589386 100644 --- a/lib/App/Netdisco/DB.pm +++ b/lib/App/Netdisco/DB.pm @@ -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'; diff --git a/lib/App/Netdisco/DB/Result/DevicePortProperties.pm b/lib/App/Netdisco/DB/Result/DevicePortProperties.pm index 81ea937b..b25fdaaf 100644 --- a/lib/App/Netdisco/DB/Result/DevicePortProperties.pm +++ b/lib/App/Netdisco/DB/Result/DevicePortProperties.pm @@ -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"); diff --git a/lib/App/Netdisco/Util/Device.pm b/lib/App/Netdisco/Util/Device.pm index a4b481fe..a6af95fa 100644 --- a/lib/App/Netdisco/Util/Device.pm +++ b/lib/App/Netdisco/Util/Device.pm @@ -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. diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/PortProperties.pm b/lib/App/Netdisco/Worker/Plugin/Discover/PortProperties.pm index 108d8046..8b492021 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/PortProperties.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/PortProperties.pm @@ -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; diff --git a/share/schema_versions/App-Netdisco-DB-53-54-PostgreSQL.sql b/share/schema_versions/App-Netdisco-DB-53-54-PostgreSQL.sql new file mode 100644 index 00000000..64454a87 --- /dev/null +++ b/share/schema_versions/App-Netdisco-DB-53-54-PostgreSQL.sql @@ -0,0 +1,5 @@ +BEGIN; + +ALTER TABLE device_port_properties ADD COLUMN "ifindex" bigint; + +COMMIT;