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 * 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 6982N/A * If applicable, add the following below this CDDL HEADER, with the 6982N/A * fields enclosed by brackets "[]" replaced with your own identifying 3600N/A * Portions Copyright [yyyy] [name of copyright owner] 3600N/A * Copyright 2008 Sun Microsystems, Inc. 3600N/A * This class perform a SNMP set operation. 3600N/A * Gets the calling arguments. 3600N/A * @param args SNMP agent version + SNMP agent host + SNMP agent port 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 // 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 3600N/A // Discover timeliness of creation and boot 3600N/A "connect() of SNMPSet catched as expected a " +
3600N/A "connect() of SNMPSet should not catch a " +
3600N/A "connect() of SNMPSet catched an unexpected exception: " +
3600N/A // Set the default peer (agent) to a SnmpSession 3600N/A "connect() of SNMPSet: Unknown SNMP version: " 3600N/A "connect() of SNMPSet catched an unexpected exception: " +
3600N/A * Perform an SNMP set request on SNMP agent. 3600N/A * @return 0 if the setRequest succeeded or 1 if the setRequest failed 3600N/A // Build the list of variables you want to query 3600N/A // Make the SNMP set request 3600N/A // Check for a timeout of the request 3600N/A "setRequest() of SNMPSet: Request timed out, " +
3600N/A "check reachability of agent.");
3600N/A "setRequest() of SNMPSet: Request= " +
3600N/A "getRequest() of SNMPGet: Finish SNMP V" +
3600N/A // Now we have a response. Check if the response contains an error 3600N/A "getRequest() of SNMPGet: Error status= " +
3600N/A "getRequest() of SNMPGet: Error index= " +
3600N/A "getRequest() of SNMPGet: Get request failed as " +
3600N/A "getRequest() of SNMPGet: Get request should " +
3600N/A // Now we shall display the content of the result 3600N/A "getRequest() of SNMPGet: Get request should " +
3600N/A // Check that we obtain correct values for the OIDs 3600N/A "getRequest() of SNMPGet: Returned values for" +
3600N/A "getRequest() of SNMPGet: Returned values for" +
3600N/A // Check that we obtain incorrect values for the OIDs 3600N/A "getRequest() of SNMPGet: Returned values for" +
3600N/A " OIDs should not be correct.");
3600N/A "getRequest() of SNMPGet: Returned values for" +
3600N/A " OIDs are not correct as expected.");
3600N/A "setRequest() of SNMPSet 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 set request