1use utf8;
2package App::Netdisco::DB::Result::DevicePortVlan;
3
4
5use strict;
6use warnings;
7
8use base 'App::Netdisco::DB::Result';
9__PACKAGE__->table("device_port_vlan");
10__PACKAGE__->add_columns(
11  "ip",
12  { data_type => "inet", is_nullable => 0 },
13  "port",
14  { data_type => "text", is_nullable => 0 },
15  "vlan",
16  { data_type => "integer", is_nullable => 0 },
17  "native",
18  { data_type => "boolean", default_value => \"false", is_nullable => 0 },
19  "egress_tag",
20  { data_type => "boolean", default_value => \"true",  is_nullable => 0 },
21  "creation",
22  {
23    data_type     => "timestamp",
24    default_value => \"current_timestamp",
25    is_nullable   => 1,
26    original      => { default_value => \"now()" },
27  },
28  "last_discover",
29  {
30    data_type     => "timestamp",
31    default_value => \"current_timestamp",
32    is_nullable   => 1,
33    original      => { default_value => \"now()" },
34  },
35  "vlantype",
36  { data_type => "text", is_nullable => 1 },
37);
38__PACKAGE__->set_primary_key("ip", "port", "vlan", "native");
39
40
41
42=head1 RELATIONSHIPS
43
44=head2 device
45
46Returns the entry from the C<device> table which hosts the Port on which this
47VLAN is configured.
48
49=cut
50
51__PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' );
52
53=head2 port
54
55Returns the entry from the C<port> table on which this VLAN is configured.
56
57=cut
58
59__PACKAGE__->belongs_to( port => 'App::Netdisco::DB::Result::DevicePort', {
60    'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
61});
62
63=head2 vlan
64
65Returns the entry from the C<device_vlan> table describing this VLAN in
66detail, typically in order that the C<name> can be retrieved.
67
68=cut
69
70__PACKAGE__->belongs_to( vlan => 'App::Netdisco::DB::Result::DeviceVlan', {
71    'foreign.ip' => 'self.ip', 'foreign.vlan' => 'self.vlan',
72});
73
741;
75