<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
! 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 ! You can obtain a copy of the license at ! 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 ! 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] ! Copyright 2008 Sun Microsystems, Inc. ! Portions Copyright 2012-2013 ForgeRock AS <!--- Test Case information #@TestMarker SNMP Connection Handler default properties #@TestName snmp_defaultproperties: TODO <
function name="snmp_basic_001" scope="local">
<
testcase name="getTestCaseName('SNMP Default Properties')">
<
call function="'testCase_Preamble'"/>
'Test Name = %s' % STAXCurrentTestcase
<
call function="'testStep'">
{ 'stepMessage' : 'Check the default properties.' }
result = compare_property_table(EXPECTED_PROPERTIES,
<
call function="'checktestStringNotPresent'">
'returnString' : result ,
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_002" scope="local">
<
testcase name="getTestCaseName('Check the connection handlers')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values.' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
call function="'testStep'">
{ 'stepMessage' : 'Check the connection handlers.' }
nbHandler = get_handler_count(DEFAULT_VALUES)
indexSNMP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
indexLDAP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
% DIRECTORY_INSTANCE_PORT)
<
if expr="nbHandler == 2 and indexSNMP != 0 and indexLDAP != 0">
msg1 = 'The connection handlers info are correct.\n'
msg2 = 'number of handler: %s\n' % nbHandler
msg3 = 'index SNMP handler: %s\n' % indexSNMP
msg4 = 'index LDAP handler: %s\n' % indexLDAP
msg = '%s%s%s%s' % (msg1, msg2, msg3, msg4)
<
tcstatus result="'pass'"></
tcstatus>
msg1 = 'The connection handlers info are wrong.\n'
msg2 = 'number of handler: %s/3\n' % nbHandler
msg3 = 'index SNMP handler: %s\n' % indexSNMP
msg4 = 'index LDAP handler: %s\n' % indexLDAP
msg = '%s%s%s%s' % (msg1, msg2, msg3, msg4)
<
tcstatus result="'fail'"></
tcstatus>
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_003" scope="local">
<
testcase name="getTestCaseName('Check value of dsServerType entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsServerType entry.' }
<!-- Get the information about the server --> <
call function="'GetVar'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'variable' : 'Job%s_ServerInfo' % STAXParentID
# In IPS mode, DIRECTORY_INSTANCE_BIN is used
instPath = DIRECTORY_INSTANCE_BIN
instPath = DIRECTORY_INSTANCE_DIR
serverInformation=jobInfo['%s/%s' % (instPath,OPENDSNAME)]
dsVersion=serverInformation['server version']
dsBuild=serverInformation['server buildid']
dsServer = '%s %s - %s' \
dsServerType = DEFAULT_VALUES['dsServerType.1']
<
if expr="dsServerType == dsServer">
msg1 = 'Value for dsServerType entry is correct.\n'
msg2 = 'Current value: %s' % dsServerType
msg = '%s%s' % (msg1, msg2)
<
tcstatus result="'pass'"></
tcstatus>
msg1 = 'Value for dsServerType entry is wrong.\n'
msg2 = 'Expected value: %s\n' % dsServer
msg3 = 'Current value: %s' % dsServerType
msg = '%s%s%s' % (msg1, msg2, msg3)
<
tcstatus result="'fail'"></
tcstatus>
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_004" scope="local">
<
testcase name="getTestCaseName('Check value of dsServerDescription entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsServerDescription entry.' }
dsServerDescription = DEFAULT_VALUES['dsServerDescription.1']
dsPath = '%s/%s' % (DIRECTORY_INSTANCE_BIN, OPENDSNAME)
if is_windows_platform(DIRECTORY_INSTANCE_HOST):
<
if expr="dsServerDescription == dsPath">
msg1 = 'Value for dsServerDescription entry is correct.\n'
msg2 = 'Current value: %s' % dsServerDescription
msg = '%s%s' % (msg1, msg2)
<
tcstatus result="'pass'"></
tcstatus>
msg1 = 'Value for dsServerDescription entry is wrong.\n'
msg2 = 'Expected value: %s\n' % dsPath
msg3 = 'Current value: %s' % dsServerDescription
msg = '%s%s%s' % (msg1, msg2, msg3)
<
tcstatus result="'fail'"></
tcstatus>
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_005" scope="local">
<
testcase name="getTestCaseName('Check value of dsApplIfSearchOps entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Perform %s search operation' % nbLoop }
<
loop var="loop" from="1" to="nbLoop">
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
'LOOP %s: %s' % (loop, userDn)
<
call function="'ldapSearchWithScript'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
<
call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
key = 'dsApplIfReadOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfSearchOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfWholeSubtreeSearchOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfSearchOps entry' }
<
call function="'compareSNMPValues'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
call function="'testStep'">
{ 'stepMessage' : 'Save the snmp values' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_006" scope="local">
<
testcase name="getTestCaseName('Check value of dsApplIfAddEntryOps entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Perform %s add operations' % nbLoop }
<
loop var="loop" from="1" to="nbLoop">
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
'LOOP %s: %s' % (loop, userDn)
<
call function="'addAnEntry'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'listAttributes' : listAttr
<
call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
key = 'dsApplIfReadOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfAddEntryOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
DEFAULT_VALUES['dsMasterEntries.1'] = \
str(int(DEFAULT_VALUES['dsMasterEntries.1']) + nbLoop)
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfAddEntryOps entry' }
<
call function="'compareSNMPValues'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_007" scope="local">
<
testcase name="getTestCaseName('Check value of dsApplIfRemoveEntryOps entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Perform %s remove operations' % nbLoop }
<
loop var="loop" from="1" to="nbLoop">
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
'LOOP %s: %s' % (loop, userDn)
<
call function="'ldapDeleteWithScript'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
<
call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
key = 'dsApplIfReadOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfRemoveEntryOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
DEFAULT_VALUES['dsMasterEntries.1'] = \
str(int(DEFAULT_VALUES['dsMasterEntries.1']) - nbLoop)
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfRemoveEntryOps entry' }
<
call function="'compareSNMPValues'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_008" scope="local">
<
testcase name="getTestCaseName('Check value of dsApplIfCompareOps entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Perform %s compare operations' % nbLoop }
<
loop var="loop" from="1" to="nbLoop">
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
'LOOP %s: %s' % (loop, userDn)
<
call function="'ldapCompareWithScript'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsDn' : ['postalCode:64447', '%s' % userDn] ,
<
call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
key = 'dsApplIfReadOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfCompareOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfCompareOps entry' }
<
call function="'compareSNMPValues'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_009" scope="local">
<
testcase name="getTestCaseName('Check value of dsApplIfModifyEntryOps entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Perform %s modify operations' % nbLoop }
<
loop var="loop" from="1" to="nbLoop">
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
'LOOP %s: %s' % (loop, userDn)
<
call function="'modifyAnAttribute'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'attributeName' : 'postalCode' ,
'newAttributeValue' : '%s' % id ,
<
call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
key = 'dsApplIfReadOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfModifyEntryOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfModifyEntryOps entry' }
<
call function="'compareSNMPValues'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP MIB values #@TestName snmp_mibvalues: TODO <
function name="snmp_basic_010" scope="local">
<
testcase name="getTestCaseName('Check value of dsApplIfModifyRDNOps entry')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Perform %s modify RDN operations' % nbLoop }
<
loop var="loop" from="1" to="nbLoop">
<!--- Create a ldif file for moddn --> userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
newDn = 'uid=user.%s' % newid
templateFile = 'template-%
s.ldif' % loop
ldifFile = 'moddn-%
s.ldif' % loop
ldifPath = '%s/%s' % (DIRECTORY_INSTANCE_DIR, ldifFile)
outFile = open(templatePath, "w")
'LOOP %s: %s => %s' % (loop, userDn, newDn)
<!--- Copy file to remote host --> % (templateFile,DIRECTORY_INSTANCE_DIR,STAF_REMOTE_HOSTNAME)
<
call function="'copyFile'">
'srcfile' : templatePath ,
'remotehost' : STAF_REMOTE_HOSTNAME
<
call function="'ldapModifyWithScript'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
<!--- Delete the ldif file used for moddn on remote host --> 'Delete %s on %s' % (ldifPath, STAF_REMOTE_HOSTNAME)
<
call function="'deleteFile'">
'location' : STAF_REMOTE_HOSTNAME ,
<!--- Delete locally the ldif file used for moddn --> 'Delete locally %s' % templatePath
<
call function="'deleteFile'">
'location' : STAXServiceMachine ,
'filename' : templatePath
<
call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
key = 'dsApplIfReadOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfModifyRDNOps.%s' % indexLDAP
str(int(DEFAULT_VALUES[key]) + nbLoop)
<
call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfModifyRDNOps entry' }
<
call function="'compareSNMPValues'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'noError' ,
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP Connection Handler register mbean #@TestName registermbean: TODO <
function name="snmp_basic_011" scope="local">
<
testcase name="getTestCaseName('Check that there is no error at startup')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Set the register-mbean property to true' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set registered-mbean:true'
'status: restart DS running on port %s' \
% (DIRECTORY_INSTANCE_PORT)
<
call function="'StopDsWithScript'">
'location' : STAF_REMOTE_HOSTNAME ,
'dsHost' : DIRECTORY_INSTANCE_HOST ,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
<
call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
returnString = STAXResult[0][1]
<!--- Check that DS started --> <
call function="'isAlive'">
'noOfMilliSeconds' : 2000
<
call function="'checktestStringNotPresent'">
'returnString' : returnString ,
'testString' : 'category=PROTOCOL severity=SEVERE_ERROR'
<
call function="'testStep'">
{ 'stepMessage' : 'Get to check the SNMPConnection Handler' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : defCommunity ,
<
call function="'testStep'">
{ 'stepMessage' : 'Restore the register-mbean property' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set registered-mbean:%s' \
<
call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
<
call function="'restartSNMPConnectionHandler'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP Connection Handler register mbean #@TestName registermbean: TODO <
function name="snmp_basic_012" scope="local">
<
testcase name="getTestCaseName('Set the register-mbean property to a wrong value')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Set register-mbean property to a wrong value' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set registered-mbean:myValue' ,
returnString = STAXResult[0][1]
msg1 = 'The value "myValue" is not a valid value for the'
msg2 = 'SNMP Connection Handler\nproperty "registered-mbean"'
msg3 = 'which has the following syntax: false | true'
msg = '%s %s %s' % (msg1, msg2, msg3)
<
call function="'checktestString'">
'returnString' : returnString ,
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP Connection Handler status #@TestName status: check status when the server is #@TestPurpose Check status when the server is #@TestStep stop the server #@TestStep check status using status command #@TestStep start the server #@TestStep check status using status command #@TestStep do a SNMP get request to check that the #@TestResult Success if output of status is correct. <
function name="snmp_basic_013" scope="local">
<
testcase name="getTestCaseName('Status when the server is stopped/started')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
<
call function="'StopDsWithScript'">
'location' : STAF_REMOTE_HOSTNAME ,
'dsHost' : DIRECTORY_INSTANCE_HOST ,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is stopped' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT) }
<
call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
<!--- Check that DS started --> <
call function="'isAlive'">
'noOfMilliSeconds' : 2000
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP Connection Handler status #@TestName status: check status when the connection #@TestPurpose Check status when the SNMP connection handler #@TestStep disable the SNMP connection handler #@TestStep check status using status command #@TestStep enable the SNMP connection handler #@TestStep check status using status command #@TestResult Success if output of status is correct. <
function name="snmp_basic_014" scope="local">
<
testcase name="getTestCaseName('Status when SNMP Connection Handler is disabled/enabled')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Disable the SNMP Connection Handler' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set enabled:false'
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the SNMP connection handler is disabled' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Disabled' \
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'reqTimeout'
<
call function="'testStep'">
{ 'stepMessage' : 'Enable the SNMP Connection Handler' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set enabled:true'
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the SNMP connection handler is enabled' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP Connection Handler status #@TestName status: check error message and status when the opendmk-jarfile property is set to a #@TestPurpose Check error message and status when the opendmk-jarfile property is set to a #@TestStep set opendmk-jarfile property to a wrong value #@TestStep restart the server #@TestStep check that an error message is displayed at #@TestStep check status using status command #@TestStep restore value for opendmk-jarfile property #@TestStep disable the SNMP connection handler #@TestStep enable the SNMP connection handler #@TestResult Success if an error message is displayed and if the output of status is correct. <
function name="snmp_basic_015" scope="local">
<
testcase name="getTestCaseName('Status with a wrong opendmk-jarfile value')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Set opendmk-jarfile property to a wrong value' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set opendmk-jarfile:wrong_file'
<
call function="'testStep'">
{ 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
<
call function="'StopDsWithScript'">
'location' : STAF_REMOTE_HOSTNAME ,
'dsHost' : DIRECTORY_INSTANCE_HOST ,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
<
call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
<!--- Check that DS started --> <
call function="'isAlive'">
'noOfMilliSeconds' : 2000
% (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
if is_windows_platform(DIRECTORY_INSTANCE_HOST):
msg1 = 'The specified OpenDMK jar file'
msg2 = '\'%s\' could not be found.' % opendmkJarFile
msg3 = 'Verify that the value set in the opendmk-jarfile'
msg4 = 'configuration parameter of the SNMP connection handler'
msg5 = 'is the valid path to the
jdmkrt.jar file and that the'
msg6 = 'file is accessible'
msg = '%s %s %s %s %s %s' % (msg1, msg2, msg3, msg4, msg5, msg6)
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'reqTimeout'
<
call function="'testStep'">
{ 'stepMessage' : 'Restore value for opendmk-jarfile property' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set opendmk-jarfile:%s' \
% SNMP_PROPERTIES['opendmk-jarfile']
<
call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
<
call function="'restartSNMPConnectionHandler'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker SNMP Connection Handler status #@TestName status: check error message and status when the security-agent-file property is set to a #@TestPurpose Check error message and status when the security-agent-file property is set to a #@TestStep set security-agent-file property to a wrong #@TestStep restart the server #@TestStep check that an error message is displayed at #@TestStep check status using status command #@TestStep restore value for security-agent-file property #@TestStep disable the SNMP connection handler #@TestStep enable the SNMP connection handler #@TestResult Success if an error message is displayed and if the output of status is correct. <
function name="snmp_basic_016" scope="local">
<
testcase name="getTestCaseName('Status with a wrong security-agent-file value')">
<
call function="'testCase_Preamble'"/>
<
call function="'testStep'">
{ 'stepMessage' : 'Set the security-agent-file to a wrong value' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set security-agent-file:wrong_file'
<
call function="'testStep'">
{ 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
<
call function="'StopDsWithScript'">
'location' : STAF_REMOTE_HOSTNAME ,
'dsHost' : DIRECTORY_INSTANCE_HOST ,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
<
call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
<!--- Check that DS started --> <
call function="'isAlive'">
'noOfMilliSeconds' : 2000
msg1 = 'Cannot initialize the SNMP Connection Handler.'
msg2 = 'Please check the configuration attributes'
msg = '%s %s' % (msg1, msg2)
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
msg1 = 'You do not have the appropriated OpenDMK jar files to'
msg2 = 'enable the SNMP Connection Handler. Please go under'
msg4 = 'ds-cfg-opendmk-jarfile configuration parameter to set'
msg5 = 'the full path of the required
jdmkrt.jar file.'
msg6 = 'The SNMP connection Handler didn\'t started'
msg = '%s %s %s %s %s %s' % (msg1, msg2, msg3, msg4, msg5, msg6)
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'reqTimeout'
<
call function="'testStep'">
{ 'stepMessage' : 'Restore value for security-agent-file property' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set security-agent-file:%s' \
% SNMP_PROPERTIES['security-agent-file']
<
call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
<
call function="'restartSNMPConnectionHandler'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>
<!-- Test Case information #@TestMarker SNMP Connection Handler status #@TestName status: check error message and status when the listen-port property is set to a wrong #@TestPurpose Check error message and status when the listen-port property is set to a wrong #@TestStep set listen-port property to a wrong value #@TestStep restart the server #@TestStep check that an error message is displayed at #@TestStep check status using status command #@TestStep restore value for listen-port property #@TestStep disable the SNMP connection handler #@TestStep enable the SNMP connection handler #@TestResult Success if an error message is displayed and if the output of status is correct. <
function name="snmp_basic_017" scope="local">
<
testcase name="getTestCaseName('Status with a wrong listen-port value')">
<
call function="'testCase_Preamble'"/>
if is_windows_platform(STAF_REMOTE_HOSTNAME) or IPS_PKG:
<
call function="'testStep'">
{ 'stepMessage' : 'Set the listen-port to a wrong value' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set listen-port:%s' \
% DEFAULT_PROPERTIES['listen-port']
<
call function="'testStep'">
{ 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
<
call function="'StopDsWithScript'">
'location' : STAF_REMOTE_HOSTNAME ,
'dsHost' : DIRECTORY_INSTANCE_HOST ,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
<
call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
<
call function="'isAlive'">
'noOfMilliSeconds' : 2000
msg1 = 'Cannot initialize the SNMP Connection Handler.'
msg2 = 'Please check the configuration attributes'
msg = '%s %s' % (msg1, msg2)
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
<
call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
<
call function="'StatusWithScript'">
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
returnString = STAXResult[0][1]
<
call function="'searchString'">
'expectedString' : '0.0.0.0:%s\\s+:\\s+SNMP\\s+:\\s+Enabled' \
% DEFAULT_PROPERTIES['listen-port'] ,
'returnString' : returnString ,
<
call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
<
call function="'SNMPGet'">
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpCommunity' : community ,
'snmpStatus' : 'reqTimeout'
<
call function="'testStep'">
{ 'stepMessage' : 'Restore value for listen-port property' }
<
call function="'dsconfig'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--set listen-port:%s' \
% SNMP_PROPERTIES['listen-port']
<
call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
<
call function="'restartSNMPConnectionHandler'">
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
<
message>'This testcase is not relevant on Windows'</
message>
<
tcstatus result="'pass'"/>
<
catch exception="'STAXException'" typevar="eType" var="eInfo">
<
message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
<
call function="'testCase_Postamble'"/>