/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* SNMP tests.
*/
super.setUp();
}
super.shutdownServer();
}
return new Object[][]{
{"dsServerType"},
{"dsServerDescription"},
{"dsMasterEntries"},
{"dsCopyEntries"},
{"dsCacheEntries"},
{"dsCacheHits"},
{"dsSlaveHits"}};
}
// get the SNMP peer agent
// Create parameters to associate to the entity to communicate
// with.
// When creating the parameter object, you can specify the read
// and write community to be used when querying the agent.
final SnmpParameters params =
new SnmpParameters();
// Set to the allowed the community string
// The newly created parameter must be associated to the agent.
//
// Build the session. A session creates, controls and
// manages one or more requests.
//
try {
final SnmpSession session =
new SnmpSession("SyncManager session");
// A default peer (agent) can be associated to a SnmpSession.
// When invoking a service provided by the SnmpSession, if the
// agent is not specified, the session will perform the service
// using the default peer as the target of the service.
//
// Build the list of variables you want to query.
// For debug purposes, you can associate a name to your list.
//
final SnmpVarBindList list =
new SnmpVarBindList("SyncManager varbind list");
// We want to read the "dsServerDescription" variable.
//
// We will thus query "dsServerDescription"
//
// Make the SNMP get request and wait for the result.
//
// Check for a timeout of the request.
//
if (completed == false) {
fail("SyncManager::main: Request timed out." +
" Check reachability of agent");
return;
}
// Now we have a response. Check if the response contains
// an error.
//
fail("Error status = " +
return;
}
// Now we shall display the content of the result.
//
// Nicely stop the session
//
fail("CheckAttribute");
}
//
// That's all !
//
return;
}
/**
* Build some data for the simpleGet test.
*/
return new Object[][]{
{"public", false},
{"private", false},
{"OpenDS@OpenDS", true},
{"dummy", false},
{"", false}};
}
try {
// Initialize the SNMP Manager API.
// Specify the OidTable containing all the MIB II knowledge.
// Use the OidTable generated by mibgen when compiling MIB II.
//
final SnmpOidTableSupport oidTable = new
// At any time, it is possible to add knowledge in the OidTable
// using the SnmpOidDatabaseSupport.
// For instance, we could start the Manager API like that:
// SnmpOidDatabaseSupport oidDB =
// new SnmpOidDatabaseSupport();
// SnmpOid.setSnmpOidTable(oidDB);
// Then over time, MIB knowledge can be added as follows:
// oidDB.add(oidTable);
//
// Create a SnmpPeer object for representing the entity to
// communicate with.
//
// Create parameters to associate to the entity to communicate
// with.
// When creating the parameter object, you can specify the read
// and write community to be used when querying the agent.
//
final SnmpParameters params =
new SnmpParameters();
// The newly created parameter must be associated to the agent.
//
// Build the session. A session creates, controls and
// manages one or more requests.
//
final SnmpSession session =
new SnmpSession("SyncManager session");
// A default peer (agent) can be associated to a SnmpSession.
// When invoking a service provided by the SnmpSession, if the
// agent is not specified, the session will perform the service
// using the default peer as the target of the service.
//
// Build the list of variables you want to query.
// For debug purposes, you can associate a name to your list.
//
final SnmpVarBindList list =
new SnmpVarBindList("SyncManager varbind list");
// We want to read the "dsServerDescription" variable.
//
// We will thus query "dsServerDescription"
//
// Make the SNMP get request and wait for the result.
//
// Check for a timeout of the request.
//
if (completed == false) {
fail("SyncManager::main: Request timed out." +
" Check reachability of agent");
return;
}
// Now we have a response. Check if the response contains
// an error.
//
fail("Error status = " +
return;
}
// Now we shall display the content of the result.
//
// Nicely stop the session
//
//
// That's all !
//
return;
} catch (Exception e) {
}
}
}