« blib/lib/App/Netdisco/DB/Result/DeviceVlan.pm
↑ Summary
blib/lib/App/Netdisco/DB/Result/Enterprise.pm »
| 1 | use utf8; | ||
| 2 | package App::Netdisco::DB::Result::DeviceVrf; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | use base 'App::Netdisco::DB::Result'; | ||
| 8 | __PACKAGE__->table("device_vrf"); | ||
| 9 | __PACKAGE__->add_columns( | ||
| 10 | "ip", | ||
| 11 | { data_type => "inet", is_nullable => 0 }, | ||
| 12 | "vrf", | ||
| 13 | { data_type => "text", is_nullable => 0 }, | ||
| 14 | "kind", | ||
| 15 | { data_type => "text", is_nullable => 1 }, | ||
| 16 | "rd", | ||
| 17 | { data_type => "text", is_nullable => 1 }, | ||
| 18 | "rt_import", | ||
| 19 | { data_type => "text[]", is_nullable => 0, default_value => \"'{}'" }, | ||
| 20 | "rt_export", | ||
| 21 | { data_type => "text[]", is_nullable => 0, default_value => \"'{}'" }, | ||
| 22 | "l3_isid", | ||
| 23 | { data_type => "integer", is_nullable => 1 }, | ||
| 24 | "listed_by", | ||
| 25 | { data_type => "text", is_nullable => 1 }, | ||
| 26 | "complete", | ||
| 27 | { data_type => "boolean", is_nullable => 0, default_value => \"false" }, | ||
| 28 | "last_discover", | ||
| 29 | { data_type => "timestamp", is_nullable => 1 }, | ||
| 30 | ); | ||
| 31 | __PACKAGE__->set_primary_key("ip", "vrf"); | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | App::Netdisco::DB::Result::DeviceVrf | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | Every VRF instance a device reports, the default table included as an | ||
| 40 | empty C<vrf>. A NULL C<rd> means unset. | ||
| 41 | |||
| 42 | =head1 RELATIONSHIPS | ||
| 43 | |||
| 44 | =head2 device | ||
| 45 | |||
| 46 | Returns the entry from the C<device> table which reported this instance. | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | __PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' ); | ||
| 51 | |||
| 52 | =head2 l3_member | ||
| 53 | |||
| 54 | Returns the C<l3_domain_member> row placing this VRF in an L3 domain, if the | ||
| 55 | recompute has placed it. | ||
| 56 | |||
| 57 | =cut | ||
| 58 | |||
| 59 | __PACKAGE__->might_have( l3_member => 'App::Netdisco::DB::Result::L3DomainMember', | ||
| 60 | { 'foreign.ip' => 'self.ip', 'foreign.vrf' => 'self.vrf' }, | ||
| 61 | { cascade_copy => 0, cascade_update => 0, cascade_delete => 0 } ); | ||
| 62 | |||
| 63 | 1; |