App-Netdisco
view release on metacpan or search on metacpan
lib/App/Netdisco/DB/ResultSet/DevicePort.pm view on Meta::CPAN
{ '!~*' => '^(53|ieee8023adLag|propVirtual|l2vlan|l3ipvlan|135|136|137)$' },
],
-or => [
-and => [
\["age(LOCALTIMESTAMP, to_timestamp(extract(epoch from device.last_discover) - (device.uptime/100))::timestamp) < ?::interval",
[{} => $interval]],
-or => [
'last_node.time_last' => undef,
\["age(LOCALTIMESTAMP, last_node.time_last) > ?::interval", [{} => $interval]],
]
],
\["age(LOCALTIMESTAMP, to_timestamp(extract(epoch from device.last_discover) - (device.uptime - me.lastchange)/100)::timestamp) > ?::interval",
[{} => $interval]],
],
},{ join => [qw/device last_node/] },
);
}
=head2 with_properties
This is a modifier for any C<search()> which
will add the following additional synthesized columns to the result set:
=over 4
=item error_disable_cause
=item remote_is_discoverable (boolean)
=item remote_is_wap (boolean)
=item remote_is_phone (boolean)
=item remote_dns
=item ifindex
=back
=cut
sub with_properties {
my ($rs, $cond, $attrs) = @_;
return $rs
->search_rs($cond, $attrs)
->search({},
{
'+select' => [qw/
properties.error_disable_cause
properties.remote_is_discoverable
properties.remote_is_wap
properties.remote_is_phone
properties.remote_dns
properties.ifindex
properties.pae_authconfig_port_control
properties.pae_authconfig_state
properties.pae_authconfig_port_status
properties.pae_authsess_user
properties.pae_authsess_mab
properties.pae_last_eapol_frame_source
/],
'+as' => [qw/
error_disable_cause
remote_is_discoverable remote_is_wap remote_is_phone remote_dns
ifindex
pae_authconfig_port_control
pae_authconfig_state
pae_authconfig_port_status
pae_authsess_user
pae_authsess_mab
pae_last_eapol_frame_source
/],
join => 'properties',
});
}
=head2 with_remote_inventory
This is a modifier for any C<search()> which
will add the following additional synthesized columns to the result set:
=over 4
=item remote_vendor
=item remote_model
=item remote_os_ver
=item remote_serial
=back
=cut
sub with_remote_inventory {
my ($rs, $cond, $attrs) = @_;
return $rs
->search_rs($cond, $attrs)
->search({},
{
'+select' => [qw/
properties.remote_vendor
properties.remote_model
properties.remote_os_ver
properties.remote_serial
/],
'+as' => [qw/
remote_vendor remote_model remote_os_ver remote_serial
/],
join => 'properties',
});
}
=head2 with_vlan_count
This is a modifier for any C<search()> (including the helpers below) which
will add the following additional synthesized columns to the result set:
=over 4
=item vlan_count
=back
=cut
sub with_vlan_count {
my ($rs, $cond, $attrs) = @_;
( run in 0.816 second using v1.01-cache-2.11-cpan-e1769b4cff6 )