NAME

RackMan::Device - Class for representing a RackObject

SYNOPSIS

use RackMan::Device;

my $obj = RackMan::Device->new({ name => $name, racktables => $rtschema });

DESCRIPTION

This module is a Moose-based class for representing a RackObject.

METHODS

new

Create and return a new object.

Arguments

Arguments are expected as a hashref with the following keys:

  • id - ID of the object to retrieve from the database

  • name - name of the object to retrieve from the database

  • racktables - (mandatory) a RackTables::Schema instance

  • rackman - an optional parent RackMan object

One of name of id must be specified.

get_network

Find and return network information about the given IP address. Result is given as a hashref.

Arguments

1. IP address, as given by ipv4addrs or ipv6addrs

Result

  • id - integer, network id (in IPv4Network)

  • addr - string, IP address

  • mask - integer, network mask length

  • name - string, network name

  • comment - string, comment or description, if any

ATTRIBUTES

attributes

Hashref, contains the attributes for this RackObject

default_ipv4_gateway

Hashref, contains information about the default IPv4 gateway:

  • addr - string, IPv4 address in dot-quad form

  • iface - string, interface name

  • masklen - integer, network mask length

  • network - string, network address

  • netname - string, network name

  • object_id - integer, ID of the peer RackObject

  • type - string, type of the address (regular, shared, virtual, router)

explicit_tags

Arrayref, contains the list of explicit tags for this RackObject

implicit_tags

Arrayref, contains the list of implicit tags for this RackObject

ipv4addrs

Arrayref, contains the list of IPv4 addresses for this RackObject, each address being a hashref with the following keys:

  • type - string, type of the address (regular, shared, virtual, router)

  • iface - string, interface name

  • addr - string, IP address

ipv6addrs

Arrayref, contains the list of IPv6 addresses for this RackObject, each address being a hashref with the following keys:

  • type - string, type of the address (regular, shared, virtual, router)

  • iface - string, interface name

  • addr - string, IP address

object_id

Integer, RackObject's ID

object_name

String, RackObject's name

object_asset_no

String, RackObject's asset tag

object_has_problem

Boolean

object_comment

String, RackObject's comment

object_type

String, RackObject's type

ports

Arrayref, contains the list of ports associated to this RackObject, each port being a hashref with the following keys:

  • name - string, port name

  • l2address - string, port L2 address

  • l2address_text - string, port L2 address in colon-separated format

  • iif_id - integer, inner interface ID

  • iif_name - string, inner interface name

  • oif_id - integer, outter interface ID

  • oif_name - string, outter interface name

  • peer_port_id - integer, peer port ID

  • peer_port_name - string, peer port name

  • peer_object_id - integer, peer object ID

  • peer_object_name - string, peer object name

parents

Arrayref, contains the object ID of the parents

physical_interfaces

List of the IPv4 addresses of the device which are not associated with a virtual interface, as given by the [general]/virtual_interfaces config parameter. See "CONFIGURATION" in rack for more details.

rack

Hashref, information about the rack containing the device

  • id - integer, rack ID

  • name - string, rack name

  • comment - text, rack comment

  • row_id - integer, rack row ID

  • row_name - string, rack row name

rackman

An optional parent RackMan object, as given when this object was created

rackobject

The underlying RackObject corresponding to the device

regular_mac_addrs

List of the regular MAC addresses of the device

regular_ipv4addrs

List of the regular IPv4 addresses of the device

regular_ipv6addrs

List of the regular IPv6 addresses of the device

tag_tree

Hashref, contains the tree of tags, with the explicit tags at first level

SEE ALSO

RackTables::Schema

AUTHOR

Sebastien Aperghis-Tramoni (sebastien@aperghis.net)