1use utf8;
2package App::Netdisco::DB::Result::DevicePortWireless;
3
4
5use strict;
6use warnings;
7
8use 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
28Returns 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
36Returns the entry from the C<port> table which corresponds to this wireless
37interface.
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
47Returns the set of Nodes whose MAC addresses are associated with this Device
48Port 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
611;
62