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