From f6b854f99f8f1787223530fec888f4c1ebabe855 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 25 Aug 2014 14:54:15 +0100 Subject: [PATCH] Revert "Search device by CDP/LLDP advertised ID or Type" This reverts commit 7411cf6cdd1880af1c0d60aa7ad364f461f4b556. --- Netdisco/Changes | 1 - Netdisco/lib/App/Netdisco/DB/Result/Device.pm | 11 ----------- .../lib/App/Netdisco/DB/ResultSet/Device.pm | 17 ++--------------- .../App/Netdisco/Web/Plugin/Search/Device.pm | 3 +-- Netdisco/share/views/sidebar/search/device.tt | 16 ---------------- 5 files changed, 3 insertions(+), 45 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index dcde77f2..36004b67 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -3,7 +3,6 @@ [NEW FEATURES] * netdisco-sshcollector script to get ARP data on devices without SNMP (C. Ramseyer) - * Search device by CDP/LLDP advertised ID or Type 2.029005 - 2014-08-13 diff --git a/Netdisco/lib/App/Netdisco/DB/Result/Device.pm b/Netdisco/lib/App/Netdisco/DB/Result/Device.pm index cb602726..19aefbc2 100644 --- a/Netdisco/lib/App/Netdisco/DB/Result/Device.pm +++ b/Netdisco/lib/App/Netdisco/DB/Result/Device.pm @@ -177,17 +177,6 @@ __PACKAGE__->has_many( 'ip', { join_type => 'RIGHT' } ); -=head2 neighbor_ports - -Returns the set of ports on other devices which connect to this device - -=cut - -__PACKAGE__->has_many( - neighbor_ports => 'App::Netdisco::DB::Result::DevicePort', - { 'foreign.remote_ip' => 'self.ip' }, -); - =head2 community Returns the row from the community string table, if one exists. diff --git a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm index 9feb1768..79050cff 100644 --- a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm +++ b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm @@ -176,14 +176,6 @@ Will match exactly the C field, which is the operating sytem software ve Will match exactly the C (manufacturer). -=item neighbor_id - -Will match the device if it has advertised this ID to a CDP/LLDP neighbor. - -=item neighbor_type - -Will match the device if it has advertised this Type to a CDP/LLDP neighbor. - =item dns Can match any of the Device IP address aliases as a substring. @@ -242,11 +234,6 @@ sub search_by_field { ($p->{layers} ? ('me.layers' => { '-ilike' => "\%$layer_string" }) : ()), - ($p->{neighbor_id} ? ('neighbor_ports.remote_id' => - { '-ilike' => "\%$p->{neighbor_id}\%" }) : ()), - ($p->{neighbor_type} ? ('neighbor_ports.remote_type' => - { '-ilike' => "\%$p->{neighbor_type}\%" }) : ()), - ($p->{model} ? ('me.model' => { '-in' => $p->{model} }) : ()), ($p->{os_ver} ? ('me.os_ver' => @@ -269,8 +256,8 @@ sub search_by_field { }, { order_by => [qw/ me.dns me.ip /], - (($p->{dns} or $p->{ip} or $p->{neighbor_id} or $p->{neighbor_type}) ? ( - join => [qw/device_ips neighbor_ports/], + (($p->{dns} or $p->{ip}) ? ( + join => 'device_ips', distinct => 1, ) : ()), } diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm index 8aaae657..ec78f7ea 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm @@ -14,8 +14,7 @@ register_search_tab( # device with various properties or a default match-all get '/ajax/content/search/device' => require_login sub { my $has_opt = List::MoreUtils::any { param($_) } - qw/name location dns ip description model os_ver vendor layers - neighbor_id neighbor_type/; + qw/name location dns ip description model os_ver vendor layers/; my $rs; if ($has_opt) { diff --git a/Netdisco/share/views/sidebar/search/device.tt b/Netdisco/share/views/sidebar/search/device.tt index a65b7f48..97722f72 100644 --- a/Netdisco/share/views/sidebar/search/device.tt +++ b/Netdisco/share/views/sidebar/search/device.tt @@ -41,22 +41,6 @@ type="text" name="description" value="[% params.description | html_entity %]" rel="tooltip" data-placement="left" data-offset="5" data-title="Description"/> -
- - - -
-
- - - -