1use utf8; 2package App::Netdisco::DB::Result::DevicePortSsid; 3 4 5use strict; 6use warnings; 7 8use base 'App::Netdisco::DB::Result'; 9__PACKAGE__->table("device_port_ssid"); 10__PACKAGE__->add_columns( 11 "ip", 12 { data_type => "inet", is_nullable => 0 }, 13 "port", 14 { data_type => "text", is_nullable => 0 }, 15 "ssid", 16 { data_type => "text", is_nullable => 1 }, 17 "broadcast", 18 { data_type => "boolean", is_nullable => 1 }, 19 "bssid", 20 { data_type => "macaddr", is_nullable => 0 }, 21); 22 23__PACKAGE__->set_primary_key("ip", "bssid", "port"); 24 25 26=head1 RELATIONSHIPS 27 28=head2 device 29 30Returns the entry from the C<device> table which hosts this SSID. 31 32=cut 33 34__PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' ); 35 36=head2 port 37 38Returns the entry from the C<port> table which corresponds to this SSID. 39 40=cut 41 42__PACKAGE__->belongs_to( port => 'App::Netdisco::DB::Result::DevicePort', { 43 'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port', 44}); 45 46=head2 nodes 47 48Returns the set of Nodes whose MAC addresses are associated with this Device 49Port SSID. 50 51=cut 52 53__PACKAGE__->has_many( nodes => 'App::Netdisco::DB::Result::Node', 54 { 55 'foreign.switch' => 'self.ip', 56 'foreign.port' => 'self.port', 57 }, 58 { join_type => 'LEFT', 59 cascade_copy => 0, cascade_update => 0, cascade_delete => 0 }, 60); 61 621; 63