Return first port neighbor match, if multiple devices claim the IP (closes #42)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* Set canonical IP failed on synthesized cols (and was wrong anyway) (closes #35)
|
||||
* Remove dupe restriction on job queue, try for smarter *all queuing (closes #41)
|
||||
* Remove scary message from Auth::Extensible (closes #38)
|
||||
* Return first port neighbor match, if multiple devices claim the IP (closes #42)
|
||||
|
||||
2.018000 - 2013-10-08
|
||||
|
||||
|
||||
@@ -141,6 +141,17 @@ __PACKAGE__->has_many( active_nodes_with_age => 'App::Netdisco::DB::Result::Virt
|
||||
cascade_copy => 0, cascade_update => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 power
|
||||
|
||||
Returns a row from the C<device_port_power> table if one refers to this
|
||||
device port.
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->might_have( power => 'App::Netdisco::DB::Result::DevicePortPower', {
|
||||
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
|
||||
});
|
||||
|
||||
=head2 neighbor_alias
|
||||
|
||||
When a device port has an attached neighbor device, this relationship will
|
||||
@@ -153,22 +164,11 @@ database.
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to( neighbor_alias => 'App::Netdisco::DB::Result::DeviceIp',
|
||||
__PACKAGE__->has_many( neighbor_alias => 'App::Netdisco::DB::Result::DeviceIp',
|
||||
{ 'foreign.alias' => 'self.remote_ip' },
|
||||
{ join_type => 'LEFT' },
|
||||
);
|
||||
|
||||
=head2 power
|
||||
|
||||
Returns a row from the C<device_port_power> table if one refers to this
|
||||
device port.
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->might_have( power => 'App::Netdisco::DB::Result::DevicePortPower', {
|
||||
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
|
||||
});
|
||||
|
||||
=head2 port_vlans_tagged
|
||||
|
||||
Returns a set of rows from the C<device_port_vlan> table relating to this
|
||||
@@ -232,7 +232,7 @@ the database.
|
||||
|
||||
sub neighbor {
|
||||
my $row = shift;
|
||||
return eval { $row->neighbor_alias->device || undef };
|
||||
return eval { $row->neighbor_alias->first->device || undef };
|
||||
}
|
||||
|
||||
=head1 ADDITIONAL COLUMNS
|
||||
|
||||
Reference in New Issue
Block a user