Dave Shield wrote:
> On Mon, 2005-08-22 at 16:19 +0200, Johannes Schmidt-Fischer wrote:
>
>
>>The snmpget command seems to have two problems (or errors):
>>
>>a) for SNMPv1 snmpget returns an error code 2 when the given OID doesn't
>>exist, but for SNMPv2c and SNMPv3 snmpget returns an exit code 0 whether
>>the given OID exists or not
>>
>>b) the output from snmpget differs between SNMPv1, SNMPv2c and SNMPv3 if
>>the given OID doesn't exist - for SNMPv1 it prints an appropriate error
>>message whereas for both other protocols the message looks more like a
>>normal output with the difference that the value has been replaced by an
>>error message
>
>
> That's because this is exactly what's happening :-)
>
> With SNMPv1, if a given OID isn't available, then the agent returns
> an error ("noSuchName") and the request fails.
>
> With SNMPv2 (i.e. SNMPv2c and SNMPv3), if a given OID isn't available,
> then the agent returns an *exception* ("noSuchObject"/"noSuchInstance"),
> but the overall request succeeds.
>
> The difference becomes clearer if you asked for two things in the same
> request:
>
> snmpget -Cf .... ipRoutingDiscards.0 sysLocation.0
>
> SNMPv1 would return an error (and not display either value).
> An SNMPv2 request would succeed, and tell you both that the
> ipRoutingDiscards value was not available, and where the system was
> located.
Thanks for the explanation - I should have checked with the docs first
(shame on me). I simply expected that snmpget should fail in the same
way reagrdless of the protocol used.
>>Since checking a test for its correctness first uses the command's exit
>>code, and if it is 0 (ok) it checks whether the given OID is part of the
>>command's output, the tests for SNMPV2c and SNMPv3 seem to pass the test
>>although they fail in reality (and should fail in those test I think).
>
>
> Yup.
> The code to check the validity of the output is not sufficiently
> rigourous. It needs to ensure that the output *does* include a value.
> I suspect that checking for the syntax token might be sufficient.
Due to what you wrote running the tests the way they're done at present
might be right or slightly wrong. They're right in that all OID's that
are expected to exist will be treated as failed in test 47 and that in
the tests 48 and 49 these OID's need not be handled as failed again.
But they're wrong in that even for tests 48 and 49 the snmp daemon
doesn't return the expected value since those OID's don't exist.
Which leads to another type of problem with those tests (47 ... 49). For
some platforms the one or other OID is known to fail since it isn't
supported for that particular platform. But as far as I know currently
only complete tests can be skipped (e.g. SUN-specific tests for all
other platforms), but not individual subtests - at least I don't know of
any way to do so for tests 47 ... 49.
> ...
>
> Dave
Johannes
--
Johannes Schmidt-Fischer
InterFace AG phone +49 (0)89 / 610 49 - 207
Leipziger Str. 16 fax +49 (0)89 / 610 49 - 85
D-82008 Unterhaching mobile +49 (0)171/ 787 76 01
http://www.InterFace-AG.com mailto:[EMAIL PROTECTED]
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders