From: Robert K. <r....@cr...> - 2006-05-24 09:36:30
|
On Tue, 2006-05-23 at 09:26 -0700, Max Baker wrote: > Hi Robert, > > On Mon, May 22, 2006 at 02:50:35PM +0100, Robert Kerr wrote: > > I have a device that doesn't seem to answer for sysService: > > > > SNMP::Info::_global layers : sysServices.0 > > SNMP::Info::_global(layers) NOSUCHINSTANCE at /usr/local/netdisco/netdisco line 1019 > > > > But a full walk reveals it does seem to answer requests for sysDecr, > > sysName, and all of IF-MIB and RFC1213-MIB. I'd really like to write a > > module for this device so I can arpnip it, but I'm not sure how to go > > about it when it doesn't answer for sysServices. Is there some way I > > could get netdisco to assume sysServices based on the value of sysDescr? > > I'm sure this can't be the only broken device out there that doesn't > > answer for sysServices? > I think there are already some devices that fall into this category in > SNMP::Info. Look in device_type() in Info.pm towards the bottom for > example. Well there are, but right at the top of device_type() is: my $layers = $info->layers(); # if we dont have sysServices, we dont have anything else either probably. return undef unless (defined $layers and length($layers)); So the code at the bottom is never reached if sysServices isn't returned. I'm not sure whether those devices at the bottom actually return no such instance for sysServices or whether they just return a value of 0 indicating no layers instead? > Your new device class should probably have a " sub layers {} " > that checks for the value and if it doesn't exist, fakes the value. I tried borrowing this from the Zyxel_DSLAM code: sub layers { my $zyxel = shift; my $layers = $zyxel->layers(); return $layers if defined $layers; # If these don't claim to have any layers, so we'll give them 1+2 return '00000011'; } However that just gives a perl deep recursion error - it appears to be calling itself repeatedly? I guess it needs to just call layers() in the parent class instead, but I don't know the OO mecahnisms in perl well enough to work out how to do that. -- Robert Kerr |