Sounds good.  I can do that.  Where in the API is this REPORT represented?  Is 
there an example somewhere in the Javadoc?

Regards,
James

-----Original Message-----
From: snmp4j-boun...@agentpp.org [mailto:snmp4j-boun...@agentpp.org] On Behalf 
Of Frank Fock
Sent: Wednesday, August 25, 2010 4:12 PM
To: snmp4j@agentpp.org
Subject: Re: [SNMP4J] No Errors but no results either?

James,

You get an REPORT which indicates the error.
See the SNMPv3 standard for more details.

Best regards,
Frank

On 25.08.2010 22:08, James Prickett wrote:
> When I run my code below, this is what I get in the response.getResponse() 
> string:
>
> <snip>
>       REPORT[reqestID=1745013846, errorStatus=0, errorIndex=0, 
> VBS[1.3.6.1.6.3.15.1.1.3.0 = 23]]
> </snip>
>
> Note that the number 23 is incremented and requested changes with each 
> subsequent execution of the code
>
> So my problem is this:  I don't get an error back in the response, yet I 
> don't see anything happening on my switch either (it should be turning off 
> port Gi0/8))
>
> I would be most grateful to whomever can take a look at my code and tell me 
> what I'm doing wrong!  :)
>
> Regards,
> James
>
>
>
>
>
> CODE
> ----------------
> package example;
>
> import java.io.IOException;
>
> import org.snmp4j.PDU;
> import org.snmp4j.ScopedPDU;
> import org.snmp4j.Snmp;
> import org.snmp4j.TransportMapping;
> import org.snmp4j.UserTarget;
> import org.snmp4j.event.ResponseEvent;
> import org.snmp4j.mp.MPv3;
> import org.snmp4j.mp.MessageProcessingModel;
> import org.snmp4j.mp.SnmpConstants;
> import org.snmp4j.security.AuthMD5;
> import org.snmp4j.security.PrivDES;
> import org.snmp4j.security.SecurityLevel;
> import org.snmp4j.security.SecurityModel;
> import org.snmp4j.security.SecurityModels;
> import org.snmp4j.security.SecurityProtocols;
> import org.snmp4j.security.USM;
> import org.snmp4j.security.UsmUser;
> import org.snmp4j.smi.Address;
> import org.snmp4j.smi.GenericAddress;
> import org.snmp4j.smi.OID;
> import org.snmp4j.smi.OctetString;
> import org.snmp4j.smi.UdpAddress;
> import org.snmp4j.smi.VariableBinding;
> import org.snmp4j.transport.DefaultUdpTransportMapping;
>
> /**
>   * @author James Prickett
>   *
>   */
> public class SnmpExample {
>
>       // private static final OctetString UP = new OctetString("1");
>       private static final OctetString DOWN = new OctetString("2");
>
>       /**
>        * @param args
>        *          The command-line arguments
>        */
>       public static void main(String[] args) {
>
>               PDU pdu = new ScopedPDU();
>               pdu.setType(PDU.SET);
>               pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.2.2.1.7"), new 
> OctetString("Gi0/8")));
>               pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.2.2.1.7"), 
> DOWN));
>
>               UserTarget target = new UserTarget();
>               target.setAddress(new UdpAddress("10.10.0.2/16"));
>               target.setVersion(SnmpConstants.version3);
>               target.setRetries(1);
>               target.setTimeout(500);
>               target.setSecurityLevel(SecurityLevel.AUTH_NOPRIV);
>               target.setSecurityName(new OctetString("MD5DES"));
>               target.setSecurityModel(SecurityModel.SECURITY_MODEL_USM);
>
>               try {
>                       Snmp snmp = new Snmp(new DefaultUdpTransportMapping());
>                       snmp.listen();
>                  TransportMapping transport = new 
> DefaultUdpTransportMapping();
>                  snmp = new Snmp(transport);
>                  USM usm = new USM(SecurityProtocols.getInstance(),
>                                    new 
> OctetString(MPv3.createLocalEngineID()), 0);
>                  SecurityModels.getInstance().addSecurityModel(usm);
>                  transport.listen();
>                       
>                       snmp.getUSM().addUser(new OctetString("MD5DES"),
>            new UsmUser(new OctetString("MD5DES"),
>                        AuthMD5.ID,
>                        new OctetString("MD5DESUserAuthPassword"),
>                        PrivDES.ID,
>                        new OctetString("MD5DESUserPrivPassword")));
>                       
>                       ResponseEvent response = snmp.send(pdu, target);
>                       if (response.getResponse() != null) {
>                               
> System.out.println(response.getResponse().toString());
>                       } else {
>                               
> System.out.println(response.getError().getMessage());
>                       }
>               } catch (IOException e) {
>                       e.printStackTrace();
>                       System.exit(99);
>               }
>
>       }
>
> }
>
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J@agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com

_______________________________________________
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j
_______________________________________________
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j

Reply via email to