« blib/lib/RackTables/Schema/Result/VLANValidID.pm
↑ Summary
blib/lib/RackTables/Schema/Result/viewIPv4AddressNetwork.pm »
| 1 | package RackTables::Schema::Result::viewAssociatedPorts; | ||
| 2 | |||
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use MooseX::NonMoose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use RackTables::Types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | extends 'DBIx::Class::Core'; | |
| 8 | |||
| 9 | |||
| 10 | 1 | __PACKAGE__->table_class("DBIx::Class::ResultSource::View"); | |
| 11 | 1 | __PACKAGE__->table("associated_ports"); | |
| 12 | 1 | __PACKAGE__->result_source_instance->is_virtual(1); | |
| 13 | 1 | __PACKAGE__->result_source_instance->view_definition(q{ | |
| 14 | SELECT | ||
| 15 | id, | ||
| 16 | name, | ||
| 17 | label, | ||
| 18 | l2address, | ||
| 19 | iif_id, | ||
| 20 | (SELECT iif_name FROM PortInnerInterface WHERE id = iif_id) AS iif_name, | ||
| 21 | type AS oif_id, | ||
| 22 | (SELECT dict_value FROM Dictionary WHERE dict_key = type) AS oif_name, | ||
| 23 | ( | ||
| 24 | SELECT porta FROM Link WHERE portb = id | ||
| 25 | UNION | ||
| 26 | SELECT portb FROM Link WHERE porta = id | ||
| 27 | ) AS peer_port_id, | ||
| 28 | (SELECT peer.name FROM Port peer WHERE peer.id = peer_port_id) AS peer_port_name, | ||
| 29 | (SELECT peer.object_id FROM Port peer WHERE peer.id = peer_port_id) AS peer_object_id, | ||
| 30 | (SELECT peer.name FROM RackObject peer WHERE peer.id = peer_object_id) AS peer_object_name, | ||
| 31 | reservation_comment | ||
| 32 | |||
| 33 | FROM Port | ||
| 34 | WHERE object_id = ? | ||
| 35 | }); | ||
| 36 | |||
| 37 | |||
| 38 | 1 | __PACKAGE__->add_columns( | |
| 39 | id => { RT_UNSIGNED }, | ||
| 40 | name => { RT_STRING, is_nullable => 0 }, | ||
| 41 | label => { RT_STRING }, | ||
| 42 | l2address => { RT_STRING, size => 64 }, | ||
| 43 | iif_id => { RT_UNSIGNED }, | ||
| 44 | iif_name => { RT_STRING }, | ||
| 45 | oif_id => { RT_UNSIGNED }, | ||
| 46 | oif_name => { RT_STRING }, | ||
| 47 | peer_port_id => { RT_UNSIGNED }, | ||
| 48 | peer_port_name => { RT_STRING }, | ||
| 49 | peer_object_id => { RT_UNSIGNED }, | ||
| 50 | peer_object_name => { RT_STRING }, | ||
| 51 | reservation_comment => { RT_STRING }, | ||
| 52 | ); | ||
| 53 | |||
| 54 | |||
| 55 | 1 | __PACKAGE__->meta->make_immutable; | |
| 56 | |||
| 57 | __END__ | ||