[SNMP4J] snmp getrequest on snmpset for MOSubTreeProxy

Pim Moerenhout pim.moerenhout at gmail.com
Sat Apr 9 18:37:17 CEST 2016


Hi Frank,

This test case test the GregorianCalendar with all possible timezones which
fails with the 2.4.2 DateAndTime.makeCalendar

public void testDateAndTime() throws Exception {
  // 1st april 2016 UTC 00:00:00
  long testMillis = 1459468800000L;
  for (String timeZoneId : TimeZone.getAvailableIDs()) {
    GregorianCalendar gc = new
GregorianCalendar(TimeZone.getTimeZone(timeZoneId));
    gc.setTimeInMillis(testMillis);
    OctetString dateAndTime = DateAndTime.makeDateAndTime(gc);
    int error = DateAndTime.validateDateAndTime(dateAndTime);
    if (error != 0) {
      System.out.println("SNMP error: " + error);
    }

    // check the makeCalendar from the generated DateAndTime
    GregorianCalendar parsedGc = DateAndTime.makeCalendar(dateAndTime);
    long parsedGcMillis = parsedGc.getTimeInMillis();
    System.out.println(String.format("[%32s] The parsed millis %s: %5.1f
hours (" + gc
            .getTime() + " " + parsedGc.getTime() + ")", timeZoneId,
        (parsedGcMillis != testMillis ? "differs" : "equals "),
        (parsedGcMillis - testMillis) / 3600000.0));
  }
}

Most timezones fail, except when using the default timezone (or equivalent).

Regards, Pim

2016-04-07 23:19 GMT+02:00 Frank Fock <fock at agentpp.com>:

> Hi Rushik,
>
> You can avoid the GET operation before the SET by setting the property
> setUndoEnabled method available in the latest SNMP4J-Agent 2.5.0-SNAPSHOT.
> In the 2.4.x and eartlier release the property was called "enableUndo" but
> did not
> had any getter/setter accessor methods (unfortunately).
>
> Best regards,
> Frank
>
>
> Am 07.04.2016 um 17:31 schrieb ru_44 at hotmail.com:
>
>> Hi,
>>   I am using the MOSubTreeProxy to forward requests for my own private
>> enterprise MIB sub tree to a device.
>>   Everything works great for most part when I do get, getnext, getbulk,
>> walk.
>> My question is on set requests.
>> Here is the sequence for a set for MOSubTree proxy:
>> 1) set request from Client
>> 2) snmp4j receives set request
>> 3) snmp4j sends a get request to device
>> 4) snmp4j receives get response from device
>> 5) snmp4j then forwards set request to device
>> 6) snmp4j receives the response from device and forwards that to back
>> client
>>   My question is on steps 3 & 4.  Is that done for validation?  usually
>> in a set request its just sent to the device and response is sent back from
>> device.
>>   I am running into an issue with my device because I have to run a set
>> request to logout of the device from my client.  The mib element for that
>> device always returns "no such instance" if you do a get request.
>> My issue is that since I am using the MOSubTreeProxy its doing steps 3 &
>> 4 when I send the logout command from my client.  Since step 4 returns no
>> such instance snmp4j doesn't forward the set request to the device in step
>> 5 and just returns no such instance back to the client.
>>   If I just do a set request directly to my device in snmp4j or from
>> command line (using net-snmp for instance) it works fine since its a
>> standard set-request but if I do through the MOSubTreeProxy the additional
>> get request is causing my logout set command to not be forwarded to the
>> device.
>> Is there a way to disable the additional get request using MOSubTreeProxy
>> or any other way to work around this issue.
>> Thanks
>> Rushik
>>
>> _______________________________________________
>> SNMP4J mailing list
>> SNMP4J at agentpp.org
>> https://oosnmp.net/mailman/listinfo/snmp4j
>>
>
> --
> ---
> AGENT++
> Maximilian-Kolbe-Str. 10
> 73257 Koengen, Germany
> https://agentpp.com
> Phone: +49 7024 8688230
> Fax:   +49 7024 8688231
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://oosnmp.net/mailman/listinfo/snmp4j
>



More information about the SNMP4J mailing list