« blib/lib/App/Netdisco/DB/Result/DevicePortSsid.pm
↑ Summary
blib/lib/App/Netdisco/DB/Result/DevicePortWireless.pm »
| 1 | use utf8; | ||
| 2 | package App::Netdisco::DB::Result::DevicePortVlan; | ||
| 3 | |||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use 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 => \"LOCALTIMESTAMP", | ||
| 25 | is_nullable => 1, | ||
| 26 | original => { default_value => \"LOCALTIMESTAMP" }, | ||
| 27 | }, | ||
| 28 | "last_discover", | ||
| 29 | { | ||
| 30 | data_type => "timestamp", | ||
| 31 | default_value => \"LOCALTIMESTAMP", | ||
| 32 | is_nullable => 1, | ||
| 33 | original => { default_value => \"LOCALTIMESTAMP" }, | ||
| 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 | |||
| 46 | Returns the entry from the C<device> table which hosts the Port on which this | ||
| 47 | VLAN is configured. | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | __PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' ); | ||
| 52 | |||
| 53 | =head2 port | ||
| 54 | |||
| 55 | Returns 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_entry | ||
| 64 | |||
| 65 | Returns the entry from the C<device_vlan> table describing this VLAN in | ||
| 66 | detail, typically in order that the C<name> can be retrieved. | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | __PACKAGE__->belongs_to( vlan_entry => 'App::Netdisco::DB::Result::DeviceVlan', { | ||
| 71 | 'foreign.ip' => 'self.ip', 'foreign.vlan' => 'self.vlan', | ||
| 72 | }); | ||
| 73 | |||
| 74 | 1; |