Add net_mac column to DevicePort, NodeNbt, and NodeWirless Result classes to enable consistent MAC formatting
This commit is contained in:
		| @@ -7,6 +7,8 @@ package App::Netdisco::DB::Result::DevicePort; | ||||
| use strict; | ||||
| use warnings; | ||||
|  | ||||
| use Net::MAC; | ||||
|  | ||||
| use MIME::Base64 'encode_base64url'; | ||||
|  | ||||
| use base 'DBIx::Class::Core'; | ||||
| @@ -335,4 +337,12 @@ in a URL. | ||||
|  | ||||
| sub base64url_port { return encode_base64url((shift)->port) } | ||||
|  | ||||
| =head2 net_mac | ||||
|  | ||||
| Returns the C<mac> column instantiated into a L<Net::MAC> object. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub net_mac { return Net::MAC->new(mac => (shift)->mac) } | ||||
|  | ||||
| 1; | ||||
|   | ||||
| @@ -7,6 +7,8 @@ package App::Netdisco::DB::Result::NodeNbt; | ||||
| use strict; | ||||
| use warnings; | ||||
|  | ||||
| use Net::MAC; | ||||
|  | ||||
| use base 'DBIx::Class::Core'; | ||||
| __PACKAGE__->table("node_nbt"); | ||||
| __PACKAGE__->add_columns( | ||||
|   | ||||
| @@ -7,6 +7,8 @@ package App::Netdisco::DB::Result::NodeWireless; | ||||
| use strict; | ||||
| use warnings; | ||||
|  | ||||
| use Net::MAC; | ||||
|  | ||||
| use base 'DBIx::Class::Core'; | ||||
| __PACKAGE__->table("node_wireless"); | ||||
| __PACKAGE__->add_columns( | ||||
| @@ -60,4 +62,12 @@ __PACKAGE__->belongs_to( node => 'App::Netdisco::DB::Result::Node', | ||||
|                        { 'foreign.mac' => 'self.mac' }, | ||||
|                        { join_type => 'LEFT' } ); | ||||
|  | ||||
| =head2 net_mac | ||||
|  | ||||
| Returns the C<mac> column instantiated into a L<Net::MAC> object. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub net_mac { return Net::MAC->new(mac => (shift)->mac) } | ||||
|  | ||||
| 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user