3600N/A * The contents of this file are subject to the terms of the 3600N/A * Common Development and Distribution License, Version 1.0 only 3600N/A * (the "License"). You may not use this file except in compliance 3600N/A * You can obtain a copy of the license at 3600N/A * See the License for the specific language governing permissions 3600N/A * and limitations under the License. 3600N/A * When distributing Covered Code, include this CDDL HEADER in each 3600N/A * file and include the License file at 3600N/A * add the following below this CDDL HEADER, with the fields enclosed 3600N/A * by brackets "[]" replaced with your own identifying information: 3600N/A * Portions Copyright [yyyy] [name of copyright owner] 3600N/A * Copyright 2008 Sun Microsystems, Inc. 3600N/A * This class perform a SNMP get operation. 3600N/A * Gets the calling arguments. 3600N/A * @param args SNMP version + SNMP agent host + SNMP agent port + community 3600N/A * @return 0 if the init succeeded or 1 if the init failed 3600N/A * Open SNMP connection with SNMP agent. 3600N/A * @return 0 if the connect succeeded or 1 if the connect failed 3600N/A // The OidTable generated by mibgen when compiling DIRECTORY_SERVER_MIB 3600N/A // Specify the OidTable containing all the DIRECTORY_SERVER_MIB knowledge 3600N/A // Disable PduFixedOnError option 3600N/A // Create an SnmpPeer object for representing the entity 3600N/A // Specify the read and write community to be used 3600N/A // Specify the protocol version 3600N/A // Associate the parameters with the agent 3600N/A // Set the default peer (agent) to a SnmpSession 3600N/A // Custom engine parameters 3600N/A // SNMP V3 introduces the notion of SnmpEngine. An engine is 3600N/A // associated to the session. Other objects might need 3600N/A // the engine. You can access it using getEngine method. 3600N/A // Create an SnmpUsmPeer object for representing the entity 3600N/A // Create USM parameters for the principal defaultuser (user used when 3600N/A // requests are sent: the defaultUser is a template and for this 3600N/A // reason we cannot find it under the user mib (not created as a user) 3600N/A // Set the security level authentication but without privacy 3600N/A // Set the contextEngineId discovered by the peer upon 3600N/A // Associate the parameters with the agent 3667N/A // Discover timeliness of creation and boot 3667N/A "connect() of SNMPGet catched as expected a " +
3667N/A "connect() of SNMPGet should not catch a " +
3667N/A "connect() of SNMPGet catched an unexpected exception: " +
3600N/A // Set the default peer (agent) to a SnmpSession 3600N/A "connect() of SNMPGet: Unknown SNMP version: " +
3600N/A "connect() of SNMPGet catched an unexpected exception: " +
3600N/A * Perform an SNMP get request on SNMP agent. 3600N/A * @return 0 if the getRequest succeeded or 1 if the getRequest failed 3600N/A // Build the list of variables you want to query 3600N/A // Make the SNMP get request 3667N/A // Check for a timeout of the request 3667N/A "getRequest() of SNMPGet: Request timed out, " +
3667N/A "check reachability of agent.");
3667N/A "getRequest() of SNMPGet: Request= " +
3667N/A "getRequest() of SNMPGet: Request timed out as expected.");
3667N/A "getRequest() of SNMPGet: Finish SNMP V" +
3667N/A // Now we have a response. Check if the response contains an error 3667N/A "getRequest() of SNMPGet: Error status= " +
3667N/A "getRequest() of SNMPGet: Error index= " +
3667N/A "getRequest() of SNMPGet: Get request failed as " +
3667N/A "getRequest() of SNMPGet: Get request failed as " +
3667N/A "getRequest() of SNMPGet: Get request should " +
3667N/A // Now we shall display the content of the result 3667N/A "getRequest() of SNMPGet: Get request should " +
3667N/A // Check that we obtain correct values for the OIDs 3667N/A "getRequest() of SNMPGet: Returned values for" +
3667N/A "getRequest() of SNMPGet: Returned values for" +
3667N/A // Check that we obtain incorrect values for the OIDs 3667N/A "getRequest() of SNMPGet: Returned values for" +
3667N/A " OIDs should not be correct.");
3667N/A "getRequest() of SNMPGet: Returned values for" +
3667N/A " OIDs are not correct as expected.");
3600N/A "connect() of SNMPGet catched an unexpected exception: " +
3600N/A * Close SNMP connection with SNMP agent. 3600N/A // Stop and destroy the SnmpSession if still there 3600N/A // possible session already ended 3600N/A // If init() succeeded then open connection 3600N/A // If connect() succeeded then perform get request