snmp_basic_tests.xml revision 21d225782e5e4cc8e40d1fdd364430570ac2dd09
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! 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
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
! 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
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2012 ForgeRock AS
! -->
<stax>
<!--- Test Case information
#@TestMarker SNMP Connection Handler default properties
#@TestName snmp_defaultproperties: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_001" scope="local">
<testcase name="getTestCaseName('SNMP Default Properties')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'Test Name = %s' % STAXCurrentTestcase
</message>
<call function="'testStep'">
{ 'stepMessage' : 'Check the default properties.' }
</call>
<script>
result = compare_property_table(EXPECTED_PROPERTIES,
DEFAULT_PROPERTIES)
</script>
<message>
'%s' % result
</message>
<call function="'checktestStringNotPresent'">
{
'returnString' : result ,
'testString' : 'ERROR'
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_002" scope="local">
<testcase name="getTestCaseName('Check the connection handlers')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values.' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check the connection handlers.' }
</call>
<script>
nbHandler = get_handler_count(DEFAULT_VALUES)
indexSNMP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
% SNMP_PORT)
indexLDAP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
% DIRECTORY_INSTANCE_PORT)
global_indexLDAP.set(indexLDAP)
</script>
<if expr="nbHandler == 2 and indexSNMP != 0 and indexLDAP != 0">
<sequence>
<script>
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)
</script>
<message>
'%s' % msg
</message>
<tcstatus result="'pass'"></tcstatus>
</sequence>
<else>
<sequence>
<script>
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)
</script>
<message>
'%s' % msg
</message>
<tcstatus result="'fail'"></tcstatus>
</sequence>
</else>
</if>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_003" scope="local">
<testcase name="getTestCaseName('Check value of dsServerType entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsServerType entry.' }
</call>
<!-- Get the information about the server -->
<call function="'GetVar'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'type' : 'shared',
'variable' : 'Job%s_ServerInfo' % STAXParentID
}
</call>
<if expr="RC != 0">
<script>
STAFResult='{}'
</script>
</if>
<script>
jobInfo=eval(STAFResult)
# In IPS mode, DIRECTORY_INSTANCE_BIN is used
# for installation path
if IPS_PKG == True:
instPath = DIRECTORY_INSTANCE_BIN
else:
instPath = DIRECTORY_INSTANCE_DIR
if jobInfo.has_key('%s/%s' % (instPath,OPENDSNAME)):
serverInformation=jobInfo['%s/%s' % (instPath,OPENDSNAME)]
dsVersion=serverInformation['server version']
dsBuild=serverInformation['server buildid']
else:
dsVersion='unknown'
dsBuild='unknown'
dsServer = '%s %s - %s' \
% (PRODUCTNAME, dsVersion.rstrip(), dsBuild)
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
dsServerType = DEFAULT_VALUES['dsServerType.1']
</script>
<if expr="dsServerType == dsServer">
<sequence>
<script>
msg1 = 'Value for dsServerType entry is correct.\n'
msg2 = 'Current value: %s' % dsServerType
msg = '%s%s' % (msg1, msg2)
</script>
<message>
'%s' % msg
</message>
<tcstatus result="'pass'"></tcstatus>
</sequence>
<else>
<sequence>
<script>
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)
</script>
<message>
'%s' % msg
</message>
<tcstatus result="'fail'"></tcstatus>
</sequence>
</else>
</if>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_004" scope="local">
<testcase name="getTestCaseName('Check value of dsServerDescription entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsServerDescription entry.' }
</call>
<script>
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
dsServerDescription = DEFAULT_VALUES['dsServerDescription.1']
dsPath = '%s/%s' % (DIRECTORY_INSTANCE_BIN, OPENDSNAME)
if is_windows_platform(DIRECTORY_INSTANCE_HOST):
dsPath = dsPath.replace('/', '\\')
</script>
<if expr="dsServerDescription == dsPath">
<sequence>
<script>
msg1 = 'Value for dsServerDescription entry is correct.\n'
msg2 = 'Current value: %s' % dsServerDescription
msg = '%s%s' % (msg1, msg2)
</script>
<message>
'%s' % msg
</message>
<tcstatus result="'pass'"></tcstatus>
</sequence>
<else>
<sequence>
<script>
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)
</script>
<message>
'%s' % msg
</message>
<tcstatus result="'fail'"></tcstatus>
</sequence>
</else>
</if>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue 3862
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_005" scope="local">
<testcase name="getTestCaseName('Check value of dsApplIfSearchOps entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Perform %s search operation' % nbLoop }
</call>
<loop var="loop" from="1" to="nbLoop">
<sequence>
<script>
id = 700 + loop
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
</script>
<message>
'LOOP %s: %s' % (loop, userDn)
</message>
<call function="'ldapSearchWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsTypesOnly' : 'True' ,
'dsBaseDN' : 'dc=com' ,
'dsFilter' : userDn
}
</call>
</sequence>
</loop>
<call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
</call>
<script>
indexLDAP = global_indexLDAP.get()
key = 'dsApplIfReadOps.%s' % indexLDAP
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfSearchOps.%s' % indexLDAP
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfSearchOps entry' }
</call>
<call function="'compareSNMPValues'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'index' : indexLDAP ,
'knownIssue' : '3862'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Save the snmp values' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = {}
global_DEFAULT_VALUES.set({})
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
</script>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue 3862
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_006" scope="local">
<testcase name="getTestCaseName('Check value of dsApplIfAddEntryOps entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Perform %s add operations' % nbLoop }
</call>
<loop var="loop" from="1" to="nbLoop">
<sequence>
<script>
id = 1000 + loop
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:Izen.0')
listAttr.append('sn:Abizen.0')
listAttr.append('cn:Izen Abizen.0')
listAttr.append('l:ICNC')
</script>
<message>
'LOOP %s: %s' % (loop, userDn)
</message>
<call function="'addAnEntry'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : userDn,
'listAttributes' : listAttr
}
</call>
</sequence>
</loop>
<call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
</call>
<script>
indexLDAP = global_indexLDAP.get()
key = 'dsApplIfReadOps.%s' % indexLDAP
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfAddEntryOps.%s' % indexLDAP
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
DEFAULT_VALUES['dsMasterEntries.1'] = \
str(int(DEFAULT_VALUES['dsMasterEntries.1']) + nbLoop)
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfAddEntryOps entry' }
</call>
<call function="'compareSNMPValues'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'index' : indexLDAP ,
'knownIssue' : '3862'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = {}
global_DEFAULT_VALUES.set({})
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
</script>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue 3862
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_007" scope="local">
<testcase name="getTestCaseName('Check value of dsApplIfRemoveEntryOps entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Perform %s remove operations' % nbLoop }
</call>
<loop var="loop" from="1" to="nbLoop">
<sequence>
<script>
id = 1000 + loop
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
</script>
<message>
'LOOP %s: %s' % (loop, userDn)
</message>
<call function="'ldapDeleteWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsDn' : ['%s' % userDn]
}
</call>
</sequence>
</loop>
<call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
</call>
<script>
indexLDAP = global_indexLDAP.get()
key = 'dsApplIfReadOps.%s' % indexLDAP
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfRemoveEntryOps.%s' % indexLDAP
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
DEFAULT_VALUES['dsMasterEntries.1'] = \
str(int(DEFAULT_VALUES['dsMasterEntries.1']) - nbLoop)
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfRemoveEntryOps entry' }
</call>
<call function="'compareSNMPValues'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'index' : indexLDAP ,
'knownIssue' : '3862'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = {}
global_DEFAULT_VALUES.set({})
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
</script>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue 3862
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_008" scope="local">
<testcase name="getTestCaseName('Check value of dsApplIfCompareOps entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Perform %s compare operations' % nbLoop }
</call>
<loop var="loop" from="1" to="nbLoop">
<sequence>
<script>
id = 0 + loop
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
</script>
<message>
'LOOP %s: %s' % (loop, userDn)
</message>
<call function="'ldapCompareWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsDn' : ['postalCode:64447', '%s' % userDn] ,
'expectedRC' : 'noCheck'
}
</call>
</sequence>
</loop>
<call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
</call>
<script>
indexLDAP = global_indexLDAP.get()
key = 'dsApplIfReadOps.%s' % indexLDAP
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfCompareOps.%s' % indexLDAP
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfCompareOps entry' }
</call>
<call function="'compareSNMPValues'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'index' : indexLDAP ,
'knownIssue' : '3862'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = {}
global_DEFAULT_VALUES.set({})
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
</script>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue 3862
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_009" scope="local">
<testcase name="getTestCaseName('Check value of dsApplIfModifyEntryOps entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Perform %s modify operations' % nbLoop }
</call>
<loop var="loop" from="1" to="nbLoop">
<sequence>
<script>
id = 400 + loop
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
</script>
<message>
'LOOP %s: %s' % (loop, userDn)
</message>
<call function="'modifyAnAttribute'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToModify' : userDn ,
'attributeName' : 'postalCode' ,
'newAttributeValue' : '%s' % id ,
'changetype' : 'replace'
}
</call>
</sequence>
</loop>
<call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
</call>
<script>
indexLDAP = global_indexLDAP.get()
key = 'dsApplIfReadOps.%s' % indexLDAP
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfModifyEntryOps.%s' % indexLDAP
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfModifyEntryOps entry' }
</call>
<call function="'compareSNMPValues'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'index' : indexLDAP ,
'knownIssue' : '3862'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = {}
global_DEFAULT_VALUES.set({})
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
</script>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP MIB values
#@TestName snmp_mibvalues: TODO
#@TestIssue 3862
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_010" scope="local">
<testcase name="getTestCaseName('Check value of dsApplIfModifyRDNOps entry')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Perform %s modify RDN operations' % nbLoop }
</call>
<loop var="loop" from="1" to="nbLoop">
<sequence>
<!--- Create a ldif file for moddn -->
<script>
id = 800 + loop
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
newid = 2000 + loop
newDn = 'uid=user.%s' % newid
templateFile = 'template-%s.ldif' % loop
templatePath = '%s/%s' % (remote.temp, templateFile)
ldifFile = 'moddn-%s.ldif' % loop
ldifPath = '%s/%s' % (DIRECTORY_INSTANCE_DIR, ldifFile)
ldifLines = []
ldifLines.append('dn: %s' % userDn)
ldifLines.append('changetype: moddn')
ldifLines.append('newRDN: %s' % newDn)
ldifLines.append('deleteOldRDN: 1')
outFile = open(templatePath, "w")
for line in ldifLines:
outFile.write("%s\n" % line)
outFile.close()
</script>
<message>
'LOOP %s: %s => %s' % (loop, userDn, newDn)
</message>
<!--- Copy file to remote host -->
<message>
'Copy %s to %s on %s' \
% (templateFile,DIRECTORY_INSTANCE_DIR,STAF_REMOTE_HOSTNAME)
</message>
<call function="'copyFile'">
{
'srcfile' : templatePath ,
'destfile' : ldifPath ,
'remotehost' : STAF_REMOTE_HOSTNAME
}
</call>
<call function="'ldapModifyWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsFilename' : ldifPath
}
</call>
<!--- Delete the ldif file used for moddn on remote host -->
<message>
'Delete %s on %s' % (ldifPath, STAF_REMOTE_HOSTNAME)
</message>
<call function="'deleteFile'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : ldifPath
}
</call>
<!--- Delete locally the ldif file used for moddn -->
<message>
'Delete locally %s' % templatePath
</message>
<call function="'deleteFile'">
{
'location' : STAXServiceMachine ,
'filename' : templatePath
}
</call>
</sequence>
</loop>
<call function="'testStep'">
{ 'stepMessage' : 'Increment the SNMP values' }
</call>
<script>
indexLDAP = global_indexLDAP.get()
key = 'dsApplIfReadOps.%s' % indexLDAP
DEFAULT_VALUES = global_DEFAULT_VALUES.get()
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
key = 'dsApplIfModifyRDNOps.%s' % indexLDAP
DEFAULT_VALUES[key] = \
str(int(DEFAULT_VALUES[key]) + nbLoop)
</script>
<call function="'testStep'">
{ 'stepMessage' : 'Check value of dsApplIfModifyRDNOps entry' }
</call>
<call function="'compareSNMPValues'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'index' : indexLDAP ,
'knownIssue' : '3862'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Save the SNMP values' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : '' ,
'snmpStatus' : 'noError' ,
'snmpWalk' : 'True'
}
</call>
<script>
DEFAULT_VALUES = {}
global_DEFAULT_VALUES.set({})
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
global_DEFAULT_VALUES.set(DEFAULT_VALUES)
</script>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP Connection Handler register mbean
#@TestName registermbean: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_011" scope="local">
<testcase name="getTestCaseName('Check that there is no error at startup')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Set the register-mbean property to true' }
</call>
<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'
}
</call>
<message>
'status: restart DS running on port %s' \
% (DIRECTORY_INSTANCE_PORT)
</message>
<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>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<script>
returnString = STAXResult[0][1]
</script>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'checktestStringNotPresent'">
{
'returnString' : returnString ,
'testString' : 'category=PROTOCOL severity=SEVERE_ERROR'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Get to check the SNMPConnection Handler' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : defCommunity ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restore the register-mbean property' }
</call>
<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' \
% refRegisteredMbeanProp
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
</call>
<call function="'restartSNMPConnectionHandler'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP Connection Handler register mbean
#@TestName registermbean: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_basic_012" scope="local">
<testcase name="getTestCaseName('Set the register-mbean property to a wrong value')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Set register-mbean property to a wrong value' }
</call>
<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' ,
'expectedRC' : 1
}
</call>
<script>
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)
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP Connection Handler status
#@TestName status: check status when the server is
stopped/started
#@TestIssue none
#@TestPurpose Check status when the server is
stopped/started.
#@TestPreamble none
#@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
connection handler
#@TestPostamble none
#@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')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is stopped' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT) }
</call>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP Connection Handler status
#@TestName status: check status when the connection
handler is disabled/enabled
#@TestIssue none
#@TestPurpose Check status when the SNMP connection handler
is disabled/enabled.
#@TestPreamble none
#@TestStep disable the SNMP connection handler
#@TestStep check status using status command
#@TestStep enable the SNMP connection handler
#@TestStep check status using status command
#@TestPostamble none
#@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')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Disable the SNMP Connection Handler' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the SNMP connection handler is disabled' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Disabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Enable the SNMP Connection Handler' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the SNMP connection handler is enabled' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- Test Case information
#@TestMarker SNMP Connection Handler status
#@TestName status: check error message and status when
the opendmk-jarfile property is set to a
wrong value
#@TestIssue 3943
#@TestPurpose Check error message and status when
the opendmk-jarfile property is set to a
wrong value.
#@TestPreamble none
#@TestStep set opendmk-jarfile property to a wrong value
#@TestStep restart the server
#@TestStep check that an error message is displayed at
startup
#@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
#@TestPostamble none
#@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')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Set opendmk-jarfile property to a wrong value' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
</call>
<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>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<script>
opendmkJarFile = '%s/%s/wrong_file' \
% (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
if is_windows_platform(DIRECTORY_INSTANCE_HOST):
opendmkJarFile = opendmkJarFile.replace('/', '\\')
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)
</script>
<call function="'grep'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
'testString': msg
}
</call>
<call function="'setKnownIssue'">
{ 'issueId' : '3943' }
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restore value for opendmk-jarfile property' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
</call>
<call function="'restartSNMPConnectionHandler'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!--- 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
wrong value
#@TestIssue none
#@TestPurpose Check error message and status when
the security-agent-file property is set to a
wrong value.
#@TestPreamble none
#@TestStep set security-agent-file property to a wrong
value
#@TestStep restart the server
#@TestStep check that an error message is displayed at
startup
#@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
#@TestPostamble none
#@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')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'testStep'">
{ 'stepMessage' : 'Set the security-agent-file to a wrong value' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
</call>
<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>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<script>
msg1 = 'Cannot initialize the SNMP Connection Handler.'
msg2 = 'Please check the configuration attributes'
msg = '%s %s' % (msg1, msg2)
</script>
<call function="'grep'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
'testString': msg
}
</call>
<script>
msg1 = 'You do not have the appropriated OpenDMK jar files to'
msg2 = 'enable the SNMP Connection Handler. Please go under'
msg3 = 'http:\/\/opendmk.dev.java.net and set the'
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)
</script>
<call function="'grep'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
'testString' : msg ,
'expectedRC' : 1
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restore value for security-agent-file property' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
</call>
<call function="'restartSNMPConnectionHandler'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
<!-- 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
value
#@TestIssue none
#@TestPurpose Check error message and status when
the listen-port property is set to a wrong
value.
#@TestPreamble none
#@TestStep set listen-port property to a wrong value
#@TestStep restart the server
#@TestStep check that an error message is displayed at
startup
#@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
#@TestPostamble none
#@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')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<script>
if is_windows_platform(STAF_REMOTE_HOSTNAME) or IPS_PKG:
skip=1
else:
skip=0
</script>
<if expr="skip == 0">
<sequence>
<call function="'testStep'">
{ 'stepMessage' : 'Set the listen-port to a wrong value' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
</call>
<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>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<script>
msg1 = 'Cannot initialize the SNMP Connection Handler.'
msg2 = 'Please check the configuration attributes'
msg = '%s %s' % (msg1, msg2)
</script>
<call function="'grep'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
'testString': msg
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Get status when the server is started' }
</call>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% DEFAULT_PROPERTIES['listen-port'] ,
'returnString' : returnString ,
'expectedRC' : 0
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Send SNMP Get request' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<call function="'testStep'">
{ 'stepMessage' : 'Restore value for listen-port property' }
</call>
<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>
<call function="'testStep'">
{ 'stepMessage' : 'Restart the SNMP Connection Handler' }
</call>
<call function="'restartSNMPConnectionHandler'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
</sequence>
<else>
<sequence>
<message>'This testcase is not relevant on Windows'</message>
<tcstatus result="'pass'"/>
</sequence>
</else>
</if>
</sequence>
<catch exception="'STAXException'" typevar="eType" var="eInfo">
<message log="1" level="'fatal'">
'%s: Test failed. eInfo(%s)' % (eType,eInfo)
</message>
</catch>
<finally>
<sequence>
<call function="'testCase_Postamble'"/>
</sequence>
</finally>
</try>
</sequence>
</testcase>
</function>
</stax>