Merge branch 'og-agg' of ssh://git.code.sf.net/p/netdisco/netdisco-ng into og-agg
This commit is contained in:
		| @@ -708,18 +708,19 @@ sub store_neighbors { | |||||||
|  |  | ||||||
|       # IP Phone and WAP detection type fixup |       # IP Phone and WAP detection type fixup | ||||||
|       if (defined $remote_type) { |       if (defined $remote_type) { | ||||||
|         my $phone_flag = grep {/phone/i} @$remote_cap; |           my $phone_flag = grep {/phone/i} @$remote_cap; | ||||||
|         my $ap_flag = grep {/wlanAccessPoint/} @$remote_cap; |           my $ap_flag    = grep {/wlanAccessPoint/} @$remote_cap; | ||||||
|         if ($phone_flag or $remote_type =~ m/(mitel.5\d{3})/i) { |  | ||||||
|           $remote_type = 'IP Phone: '. $remote_type |           if ($phone_flag or $remote_type =~ m/(mitel.5\d{3})/i) { | ||||||
|             if $remote_type !~ /ip phone/i; |               $remote_type = 'IP Phone: '. $remote_type | ||||||
|         } |               if $remote_type !~ /ip phone/i; | ||||||
|         elsif ($ap_flag) { |           } | ||||||
|           $remote_type = 'AP: '. $remote_type;           |           elsif ($ap_flag) { | ||||||
|         } |               $remote_type = 'AP: '. $remote_type; | ||||||
|         else { |           } | ||||||
|           $remote_type ||= ''; |           else { | ||||||
|         } |               $remote_type ||= ''; | ||||||
|  |           } | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       # hack for devices seeing multiple neighbors on the port |       # hack for devices seeing multiple neighbors on the port | ||||||
| @@ -791,13 +792,20 @@ sub store_neighbors { | |||||||
|           my $master = schema('netdisco')->resultset('DevicePort') |           my $master = schema('netdisco')->resultset('DevicePort') | ||||||
|               ->single({ip => $device->ip, port => $portrow->slave_of})) { |               ->single({ip => $device->ip, port => $portrow->slave_of})) { | ||||||
|  |  | ||||||
|           $master->update({ |           if (not ($portrow->is_master or defined $master->slave_of)) { | ||||||
|             remote_ip => $remote_ip, |               # TODO needs refactoring - this is quite expensive | ||||||
|             remote_port => |               my $peer = schema('netdisco')->resultset('DevicePort')->find({ | ||||||
|                 ($portrow->neighbor_port ? $portrow->neighbor_port->slave_of : undef), |                   ip   => $portrow->neighbor->ip, | ||||||
|             is_uplink => \"true", |                   port => $portrow->remote_port, | ||||||
|             manual_topo => \"false", |               }) if $portrow->neighbor; | ||||||
|           }); |  | ||||||
|  |               $master->update({ | ||||||
|  |                   remote_ip => ($peer ? $peer->ip : $remote_ip), | ||||||
|  |                   remote_port => ($peer ? $peer->slave_of : undef ), | ||||||
|  |                   is_uplink => \"true", | ||||||
|  |                   manual_topo => \"false", | ||||||
|  |               }); | ||||||
|  |           } | ||||||
|       } |       } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -199,22 +199,6 @@ __PACKAGE__->belongs_to( | |||||||
|     } |     } | ||||||
| ); | ); | ||||||
|  |  | ||||||
| =head2 neighbor_port |  | ||||||
|  |  | ||||||
| Returns another row from the C<device_port> table if this port has valid |  | ||||||
| C<remote_ip> and C<remote_port>. |  | ||||||
|  |  | ||||||
| =cut |  | ||||||
|  |  | ||||||
| __PACKAGE__->belongs_to( |  | ||||||
|     neighbor_port => 'App::Netdisco::DB::Result::DevicePort', { |  | ||||||
|       'foreign.ip'   => 'self.remote_ip', |  | ||||||
|       'foreign.port' => 'self.remote_port', |  | ||||||
|     }, { |  | ||||||
|       join_type => 'LEFT', |  | ||||||
|     } |  | ||||||
| ); |  | ||||||
|  |  | ||||||
| =head2 neighbor_alias | =head2 neighbor_alias | ||||||
|  |  | ||||||
| When a device port has an attached neighbor device, this relationship will | When a device port has an attached neighbor device, this relationship will | ||||||
| @@ -267,7 +251,7 @@ __PACKAGE__->belongs_to( oui => 'App::Netdisco::DB::Result::Oui', | |||||||
|  |  | ||||||
| =head1 ADDITIONAL METHODS | =head1 ADDITIONAL METHODS | ||||||
|  |  | ||||||
| =head2 | =head2 neighbor | ||||||
|  |  | ||||||
| Returns the Device entry for the neighbour Device on the given port. | Returns the Device entry for the neighbour Device on the given port. | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user