snmp_setup.xml revision d25372dc8e65a9ed019a88fdf659ca61313f1b31
<?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.
! -->
<stax>
<defaultcall function="snmp_setup" />
<function name="snmp_setup">
<sequence>
<block name="'snmp_setup'">
<sequence>
<!--- Test Suite information
#@TestSuiteName setup
#@TestSuitePurpose Setup for the snmp test suite.
#@TestSuiteGroup setup
#@TestScript snmp_setup.xml
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'snmp'
CurrentTestPath['suite'] = STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Define default value for manager -->
<script>
snmpPath = '%s/snmp' % remote.java,
opendmkPath = '%s/jdmkrt.jar' % snmpPath
</script>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: create DS topology
#@TestIssue none
#@TestPurpose Create the topology necessary to the
test suite.
#@TestPreamble none
#@TestStep Create DS topology as described in config.py.
#@TestPostamble none
#@TestResult Success if createTopology returns 0.
-->
<testcase name="getTestCaseName('setup: create DS tpology')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: create DS topology as described in config.py'
</message>
<call function="'createTopology'">
{ 'initialiseInstance' : False }
</call>
<call function="'checktestRC'">
{
'returncode' : RC ,
'result' : STAXResult
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!-- Check if 'opendmkPath' exists -->
<call function="'GetEntry'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'entry' : opendmkPath ,
'attribute' : 'TYPE'
}
</call>
<!-- 'opendmkPath' exists so we can continue -->
<if expr="RC != 48">
<sequence>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: add initial entries
#@TestIssue none
#@TestPurpose Load the data needed by the test suite.
#@TestPreamble none
#@TestStep Load the data needed by the test suite.
#@TestPostamble none
#@TestResult Success if importLdif returns 0.
-->
<testcase name="getTestCaseName('setup: add initial entries')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: add initial entries'
</message>
<call function="'importLdif'">
{
'ldifFile' : '%s/snmp/snmp_start.ldif' % remote.data
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: start DS
#@TestIssue none
#@TestPurpose Start DS.
#@TestPreamble none
#@TestStep Start the server.
#@TestStep Check that the server is alive.
#@TestPostamble none
#@TestResult Success if StartDsWithScript returns 0.
-->
<testcase name="getTestCaseName('setup: start DS')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: start DS to run on port %s' \
% (DIRECTORY_INSTANCE_PORT)
</message>
<!--- Start DS -->
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 5 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: get default SNMP connection handler
properties
#@TestIssue none
#@TestPurpose Get default SNMP connection handler
properties.
#@TestPreamble none
#@TestStep get default SNMP connection handler
properties using dsconfig.
#@TestPostamble none
#@TestResult Success if GetDSConfigProperties returns 0
-->
<testcase name="getTestCaseName
('setup: get default SNMP Connection Handler properties')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: get default SNMP Connection Handler properties'
</message>
<script>
options = '--handler-name "SNMP Connection Handler"'
</script>
<call function="'GetDSConfigProperties'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'optionsString' : options ,
'myVariableName' : 'DEFAULT_PROPERTIES'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: check SNMP Connection Handler is
disabled
#@TestIssue none
#@TestPurpose Check SNMP Connection Handler is disabled.
#@TestPreamble none
#@TestStep check SNMP Connection Handler is
disabled using status command
#@TestPostamble none
#@TestResult Success if output of status is correct.
-->
<testcase name="getTestCaseName
('setup: check SNMP Connection Handler is disabled')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: check SNMP Connection Handler is disabled'
</message>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : ': SNMP : Disabled'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: enable SNMP Connection Handler
#@TestIssue none
#@TestPurpose Enable SNMP Connection Handler.
#@TestPreamble none
#@TestStep enable SNMP Connection Handler using
dsconfig.
#@TestPostamble none
#@TestResult Success if dsconfig returns 0.
-->
<testcase name="getTestCaseName
('setup: enable SNMP Connection Handler')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: enable SNMP Connection Handler'
</message>
<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 \
--set listen-port:%s \
--set trap-port:%s \
--set opendmk-jarfile:%s' \
% (SNMP_PORT, SNMP_TRAP_PORT, opendmkPath)
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: check SNMP Connection Handler is
enabled
#@TestIssue none
#@TestPurpose Check SNMP Connection Handler is enabled.
#@TestPreamble none
#@TestStep check SNMP Connection Handler is
enabled using status command
#@TestPostamble none
#@TestResult Success if output of status is correct.
-->
<testcase name="getTestCaseName
('setup: check SNMP Connection Handler is enabled')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: check SNMP Connection Handler is enabled'
</message>
<call function="'StatusWithScript'">
{
'dsBindDN' : DIRECTORY_INSTANCE_DN ,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : ': SNMP : Enabled'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: get SNMP connection handler
properties
#@TestIssue none
#@TestPurpose Get SNMP connection handler properties.
#@TestPreamble none
#@TestStep get SNMP connection handler properties
using dsconfig.
#@TestPostamble none
#@TestResult Success if GetDSConfigProperties returns 0
-->
<testcase name="getTestCaseName
('setup: get SNMP Connection Handler properties')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'setup: get SNMP Connection Handler properties'
</message>
<script>
options = '--handler-name "SNMP Connection Handler"'
</script>
<call function="'GetDSConfigProperties'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-connection-handler-prop' ,
'optionsString' : options ,
'myVariableName' : 'SNMP_PROPERTIES'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<else>
<sequence>
<!--- Test Case information
#@TestMarker setup
#@TestName setup: warning
#@TestIssue none
#@TestPurpose Warning
#@TestPreamble none
#@TestStep Print a warning message to indicate that
the SNMP_OPENDMK_LIBDIR is not set.
#@TestPostamble none
#@TestResult Always fails.
-->
<testcase name="getTestCaseName('setup: Warning')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
STOP_RUN = 'True'
</script>
<message log="1" level="'Error'">
'WARNING: Check if SNMP_OPENDMK_LIBDIR is set \
in the config.py.stubs file.'
</message>
<tcstatus result="'fail'"></tcstatus>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
</else>
</if>
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>