« blib/lib/App/Netdisco/DB/Result/DevicePortProperties.pm
↑ Summary
blib/lib/App/Netdisco/DB/Result/DevicePortVlan.pm »
| 1 | use utf8; | ||
| 2 | package App::Netdisco::DB::Result::DevicePortSsid; | ||
| 3 | |||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use 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 | |||
| 30 | Returns 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 | |||
| 38 | Returns 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 | |||
| 48 | Returns the set of Nodes whose MAC addresses are associated with this Device | ||
| 49 | Port 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 | |||
| 62 | 1; |