#925 implement ignore_deviceports and hide_deviceports
This commit is contained in:
@@ -6,6 +6,8 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'App::Netdisco::DB::Result';
|
||||
use Sub::Install;
|
||||
|
||||
__PACKAGE__->table("device_ip");
|
||||
__PACKAGE__->add_columns(
|
||||
"ip",
|
||||
@@ -47,9 +49,41 @@ routed port or virtual interface).
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->add_unique_constraint(['alias']);
|
||||
|
||||
__PACKAGE__->belongs_to( device_port => 'App::Netdisco::DB::Result::DevicePort',
|
||||
{ 'foreign.port' => 'self.port', 'foreign.ip' => 'self.ip' } );
|
||||
|
||||
=head2 device_port fields
|
||||
|
||||
All C<device_port> fields are mapped to accessors on this object.
|
||||
|
||||
=cut
|
||||
|
||||
foreach my $field (qw/
|
||||
descr
|
||||
up
|
||||
up_admin
|
||||
type
|
||||
duplex
|
||||
duplex_admin
|
||||
speed
|
||||
speed_admin
|
||||
name
|
||||
mac
|
||||
mtu
|
||||
stp
|
||||
remote_ip
|
||||
remote_port
|
||||
remote_type
|
||||
remote_id
|
||||
vlan
|
||||
pvid
|
||||
lastchange
|
||||
/) {
|
||||
|
||||
Sub::Install::install_sub({
|
||||
code => sub { return eval { (shift)->device_port->$field } },
|
||||
as => $field,
|
||||
});
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user