ADDITIONAL METHODS

search_by_mac( \%cond, \%attrs? )

my $set = $rs->search_by_mac({mac => '00:11:22:33:44:55', active => 1});

Like search(), this returns a ResultSet of matching rows from the Node table.

  • The cond parameter must be a hashref containing a key mac with the value to search for.

  • Results are ordered by time last seen.

  • Additional columns time_first_stamp and time_last_stamp provide preformatted timestamps of the time_first and time_last fields.

  • A JOIN is performed on the Device table and the Device dns column prefetched.

To limit results only to active nodes, set {active => 1} in cond.

with_port_context

my $set = $rs->search(...)->with_port_context;

Adds columns describing the switch port of each Node, so that API clients can tell access ports from transit ports (uplinks, LAGs) without fetching the ports of every switch:

  • port_is_uplink, port_remote_ip, port_is_master, port_slave_of from device_port, and port_remote_is_wap, port_remote_is_phone from device_port_properties.

  • lag_remote_ip is a member's remote_ip for a LAG master, or the master's for a LAG member.

  • neighbor_is_device is true when the port's remote IP, or one of its LAG members', is a known device address.

  • port_mac_count is the number of distinct active MACs on the port, across all VLANs.

The columns use correlated subqueries per row, so callers should make this opt-in for searches that can return many rows.

SPECIAL METHODS

delete( \%options? )

Overrides the built-in DBIx::Class delete method to more efficiently handle the removal or archiving of nodes.