also store master neighbor port

This commit is contained in:
Oliver Gorwits
2014-01-13 08:56:13 +00:00
parent 67c9c783ec
commit 6620a03686
2 changed files with 18 additions and 0 deletions

View File

@@ -793,6 +793,8 @@ sub store_neighbors {
$master->update({ $master->update({
remote_ip => $remote_ip, remote_ip => $remote_ip,
remote_port =>
($portrow->neighbor_port ? $portrow->neighbor_port->slave_of : undef),
is_uplink => \"true", is_uplink => \"true",
manual_topo => \"false", manual_topo => \"false",
}); });

View File

@@ -199,6 +199,22 @@ __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