<?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 legal-notices/CDDLv1_0.txt
! or http://forgerock.org/license/CDDLv1.0.html.
! 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-2009 Sun Microsystems, Inc.
! Portions Copyright 2012-2013 ForgeRock AS
! -->
<stax>
<!--- Test Case information
#@TestMarker SNMP v2c with custom configuration
#@TestName v2c_customconf: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_v2c_custom_001" scope="local">
<testcase name="getTestCaseName('v2c change the community property')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<!-- @Step1: Display default SNMP Connection Handler -->
<call function="'testStep'">
{ 'stepMessage' : 'Display default SNMP Connection Handler.' }
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step2: Change the community property -->
<call function="'testStep'">
{ 'stepMessage' : 'Change the community 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 community:%s' % newCommunityProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step3: Restart the SNMP Connection Handler -->
<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>
<!-- @Step4: SNMPGet with the old community -->
<call function="'testStep'">
{ 'stepMessage' : 'SNMPGet with the old community.' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '2',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : defCommunity ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<!-- @Step5: SNMPGet with the new community -->
<call function="'testStep'">
{ 'stepMessage' : 'SNMPGet with the new community.' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '2',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : newCommunity ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
<!-- @Step6: Restore the community property -->
<call function="'testStep'">
{ 'stepMessage' : 'Restore the community 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 community:%s' % defCommunityProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step7: Restart the SNMP Connection Handler -->
<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 v2c with custom configuration
#@TestName v2c_customconf: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_v2c_custom_002" scope="local">
<testcase name="getTestCaseName('v2c set allowed-manager property to a correct value')">
<sequence>
<try>
<sequence>
<!-- @Step1: Change the allowed-manager property -->
<call function="'testStep'">
{ 'stepMessage' : 'Change the allowed-manager 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 allowed-manager:%s' % newManagerProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step2: Restart the SNMP Connection Handler -->
<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>
<!-- @Step3: SNMPGet from an allowed manager -->
<call function="'testStep'">
{ 'stepMessage' : 'SNMPGet from an allowed manager.' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '2',
'snmpHost' : newManagerProp ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : defCommunity ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
<!-- @Step4: Restore the allowed-manager property -->
<call function="'testStep'">
{ 'stepMessage' : 'Restore the allowed-manager 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 allowed-manager:%s' % defManagerProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step5: Restart the SNMP Connection Handler -->
<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 v2c with custom configuration
#@TestName v2c_customconf: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_v2c_custom_003" scope="local">
<testcase name="getTestCaseName('v2c set allowed-manager property to a wrong value')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<!-- @Step1: Change the allowed-manager property -->
<call function="'testStep'">
{ 'stepMessage' : 'Change the allowed-manager 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 allowed-manager:%s' \
% wrongManagerProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step2: Restart the SNMP Connection Handler -->
<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>
<!-- @Step3: SNMPGet from a not allowed manager -->
<call function="'testStep'">
{ 'stepMessage' : 'SNMPGet from a not allowed manager.' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '2',
'snmpHost' : newManagerProp ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : defCommunity ,
'snmpOIDs' : oid ,
'snmpStatus' : 'authorizationError'
}
</call>
<!-- @Step4: Restore the allowed-manager property -->
<call function="'testStep'">
{ 'stepMessage' : 'Restore the allowed-manager 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 allowed-manager:%s' \
% defManagerProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step5: Restart the SNMP Connection Handler -->
<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 v2c with custom configuration
#@TestName v2c_customconf: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_v2c_custom_004" scope="local">
<testcase name="getTestCaseName('v2c set allowed-manager property to a list')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<!-- @Step1: Set allowed-manager property to a list -->
<call function="'testStep'">
{ 'stepMessage' : 'Set allowed-manager property to a list.' }
</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 allowed-manager:%s' \
% wrongManagerProp
}
</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' : '--add allowed-manager:%s' \
% newManagerProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step2: Restart the SNMP Connection Handler -->
<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>
<!-- @Step3: SNMPGet from an allowed manager -->
<call function="'testStep'">
{ 'stepMessage' : 'SNMPGet from an allowed manager.' }
</call>
<call function="'SNMPGet'">
{
'snmpVersion' : '2',
'snmpHost' : newManagerProp ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : defCommunity ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
<!-- @Step4: Restore the allowed-manager property -->
<call function="'testStep'">
{ 'stepMessage' : 'Restore the allowed-manager 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 allowed-manager:%s' \
% defManagerProp
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</call>
<!-- @Step5: Restart the SNMP Connection Handler -->
<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 v2c with custom configuration
#@TestName v2c_customconf: TODO
#@TestIssue none
#@TestPurpose TODO.
#@TestPreamble none
#@TestStep TODO.
#@TestPostamble none
#@TestResult TODO.
-->
<function name="snmp_v2c_custom_005" scope="local">
<testcase name="getTestCaseName('v2c set the community property to a list')">
<sequence>
<try>
<sequence>
<call function="'testCase_Preamble'"/>
<!-- @Step1: Set the community property to a list -->
<call function="'testStep'">
{ 'stepMessage' : 'Set the community property to a list.' }
</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' : '--add community:%s' % newCommunityProp ,
'expectedRC' : 1
}
</call>
<script>
returnString = STAXResult[0][1]
msg1 = 'It is not possible to specify multiple values for the'
msg2 = 'SNMP Connection Handler%sproperty "community" as it' \
% newLine
msg3 = 'is single-valued'
msg = '%s %s %s' % (msg1, msg2, msg3)
</script>
<!-- @Step2: Check that the return string is correct -->
<call function="'testStep'">
{ 'stepMessage' : 'Check that the return string is correct.' }
</call>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'dsconfig'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'objectType' : 'handler-name' ,
'objectName' : 'SNMP Connection Handler'
}
</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>
</stax>