implement port properties table and error disable gathering to it

This commit is contained in:
Oliver Gorwits
2018-02-20 22:45:53 +00:00
parent 3e7ffe8045
commit 7191a1cd00
7 changed files with 114 additions and 1 deletions

View File

@@ -171,6 +171,17 @@ __PACKAGE__->has_many(
'ip', { join_type => 'RIGHT' }
);
=head2 properties_ports
Returns the set of ports known to have recorded properties
=cut
__PACKAGE__->has_many(
properties_ports => 'App::Netdisco::DB::Result::DevicePortProperties',
'ip', { join_type => 'RIGHT' }
);
=head2 powered_ports
Returns the set of ports known to have PoE capability

View File

@@ -166,6 +166,17 @@ __PACKAGE__->might_have( power => 'App::Netdisco::DB::Result::DevicePortPower',
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
});
=head2 properties
Returns a row from the C<device_port_properties> table if one refers to this
device port.
=cut
__PACKAGE__->might_have( properties => 'App::Netdisco::DB::Result::DevicePortProperties', {
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
});
=head2 ssid
Returns a row from the C<device_port_ssid> table if one refers to this

View File

@@ -0,0 +1,32 @@
use utf8;
package App::Netdisco::DB::Result::DevicePortProperties;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table("device_port_properties");
__PACKAGE__->add_columns(
"ip",
{ data_type => "inet", is_nullable => 0 },
"port",
{ data_type => "text", is_nullable => 0 },
"error_disable_cause",
{ data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("port", "ip");
=head1 RELATIONSHIPS
=head2 port
Returns the entry from the C<port> table for which this Power entry applies.
=cut
__PACKAGE__->belongs_to( port => 'App::Netdisco::DB::Result::DevicePort', {
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
});
1;