blib/lib/App/Netdisco/DB/Result/Virtual/DevicePortSpeed.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 19 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package App::Netdisco::DB::Result::Virtual::DevicePortSpeed;
2  
3 use strict;
4 use warnings;
5  
6 use base 'DBIx::Class::Core';
7  
8 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
9  
10 __PACKAGE__->table('device_port_speed');
11 __PACKAGE__->result_source_instance->is_virtual(1);
12 __PACKAGE__->result_source_instance->view_definition(<<ENDSQL
13 SELECT ip,
14 GREATEST(1, sum( COALESCE(dpp.raw_speed,1) )) as total
15 FROM device_port
16 LEFT OUTER JOIN device_port_properties dpp USING (ip, port)
17 WHERE port !~* 'vlan'
18 AND (descr IS NULL OR descr !~* 'vlan')
19 AND (type IS NULL OR type !~* '^(53|ieee8023adLag|propVirtual|l2vlan|l3ipvlan|135|136|137)\$')
20 AND (is_master = 'false' OR slave_of IS NOT NULL)
21 GROUP BY ip
22 ORDER BY total DESC, ip ASC
23 ENDSQL
24 );
25  
26 __PACKAGE__->add_columns(
27 'total' => {
28 data_type => 'integer',
29 },
30 );
31  
32 __PACKAGE__->belongs_to('device', 'App::Netdisco::DB::Result::Device',
33 { 'foreign.ip' => 'self.ip' });
34  
35 1;