* initial work * initial work * initial work * some fixes for time and Layer3 weird spec * store again the snapshot after update for specific * resolve the enums * monkeypatch SNMP::translateObj to avoid hardware exception on macOS * only save cache to db in the late phase worker * no need to check for cache on transport, can just go ahead and try * use database only for oidmap instead of netdisco-mibs * rewrite device snapshot to gather loaded mib leafs only * remove old walker code from snapshot worker * allow snmp browser to work without snapshot * only store snapshot leafs which the device responded on * refactor to separate snapshot work from snmp transport work * refactor to separate snapshot work from snmp transport work * allow typeahead on MIB qualified leafs * fixes for snmpwalk input after previous refactor * add the extra stuff SNMP::Info device class uses into snapshot * better width for snmp search box * fix css for snmp options * add spinner while snmp loading * add spinner while snmp loading * add spinner while snmp loading * support SNMP::Info device class or named MIBs as extra on snapshot * add final tidy and bug fix
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
use utf8;
 | 
						|
package App::Netdisco::DB::Result::DeviceBrowser;
 | 
						|
 | 
						|
use strict;
 | 
						|
use warnings;
 | 
						|
 | 
						|
use base 'App::Netdisco::DB::Result';
 | 
						|
__PACKAGE__->table("device_browser");
 | 
						|
__PACKAGE__->add_columns(
 | 
						|
  "ip",
 | 
						|
  { data_type => "inet", is_nullable => 0 },
 | 
						|
  "oid",
 | 
						|
  { data_type => "text", is_nullable => 0 },
 | 
						|
  "oid_parts",
 | 
						|
  { data_type => "integer[]", is_nullable => 0 },
 | 
						|
  "leaf",
 | 
						|
  { data_type => "text", is_nullable => 0 },
 | 
						|
  "munge",
 | 
						|
  { data_type => "text", is_nullable => 1 },
 | 
						|
  "value",
 | 
						|
  { data_type => "text", is_nullable => 1 },
 | 
						|
);
 | 
						|
__PACKAGE__->set_primary_key("ip", "oid");
 | 
						|
 | 
						|
=head1 RELATIONSHIPS
 | 
						|
 | 
						|
=head2 snmp_object
 | 
						|
 | 
						|
Returns the SNMP Object table entry to which the given row is related. The
 | 
						|
idea is that you always get the SNMP Object row data even if the Device
 | 
						|
Browser table doesn't have any walked data.
 | 
						|
 | 
						|
However you probably want to use the C<snmp_object> method in the
 | 
						|
C<DeviceBrowser> ResultSet instead, so you can pass the IP address.
 | 
						|
 | 
						|
=cut
 | 
						|
 | 
						|
__PACKAGE__->belongs_to(
 | 
						|
  snmp_object => 'App::Netdisco::DB::Result::SNMPObject',
 | 
						|
  sub {
 | 
						|
    my $args = shift;
 | 
						|
    return {
 | 
						|
        "$args->{self_alias}.oid" => { -ident => "$args->{foreign_alias}.oid" },
 | 
						|
        "$args->{self_alias}.ip" => { '=' => \'?' },
 | 
						|
    };
 | 
						|
  },
 | 
						|
  { join_type => 'RIGHT' }
 | 
						|
);
 | 
						|
 | 
						|
__PACKAGE__->belongs_to( oid_fields => 'App::Netdisco::DB::Result::SNMPObject', 'oid' );
 | 
						|
 | 
						|
1;
 |