snmp_status.xml revision e87741a8de12457c67fcdaead4ccedece71449bc
1653N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1653N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
1653N/A<!--
1653N/A ! CDDL HEADER START
1653N/A !
1653N/A ! The contents of this file are subject to the terms of the
1653N/A ! Common Development and Distribution License, Version 1.0 only
1653N/A ! (the "License"). You may not use this file except in compliance
1653N/A ! with the License.
6983N/A !
6983N/A ! You can obtain a copy of the license at
1653N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
1653N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1653N/A ! See the License for the specific language governing permissions
1653N/A ! and limitations under the License.
6983N/A !
6983N/A ! When distributing Covered Code, include this CDDL HEADER in each
6983N/A ! file and include the License file at
6983N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1653N/A ! add the following below this CDDL HEADER, with the fields enclosed
1653N/A ! by brackets "[]" replaced with your own identifying information:
1653N/A ! Portions Copyright [yyyy] [name of copyright owner]
1653N/A !
1653N/A ! CDDL HEADER END
3233N/A !
5636N/A ! Copyright 2008 Sun Microsystems, Inc.
1653N/A ! -->
1653N/A<stax>
1653N/A
5636N/A <defaultcall function="snmp_status"/>
5636N/A
1653N/A <function name="snmp_status">
2976N/A
2976N/A <sequence>
1653N/A
1653N/A <block name="'snmp_status'">
1653N/A
<sequence>
<!--- Test Suite information
#@TestSuiteName SNMP Connection Handler status
#@TestSuitePurpose Check SNMP Connection Handler status.
#@TestSuiteGroup SNMP Connection Handler status
#@TestScript snmp_status.xml
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'snmp'
CurrentTestPath['suite'] = STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Define default values -->
<script>
community = '%s@%s' \
% (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
oid = 'dsServerType.1'
serverLogFile = '%s/%s/logs/server.out' \
% (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
</script>
<!--- Test Case information
#@TestMarker SNMP Connection Handler status
#@TestName status: check status when the server is
stopped/started
#@TestIssue 3865
#@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.
-->
<testcase name="getTestCaseName
('status: status when the server is stopped/started')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'status: stop 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>
<message>
'status: status when the server is stopped'
</message>
<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 ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: start DS to run on port %s' \
% (DIRECTORY_INSTANCE_PORT)
</message>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<message>
'status: status when the server is started'
</message>
<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 ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: get request'
</message>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker SNMP Connection Handler status
#@TestName status: check status when the connection
handler is disabled/enabled
#@TestIssue 3865
#@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.
-->
<testcase name="getTestCaseName
('status: status when SNMP Connection Handler is disabled/enabled')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'status: disable the 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:false'
}
</call>
<message>
'status: status when the 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="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Disabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: get request'
</message>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<message>
'status: enable the 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'
}
</call>
<message>
'status: status when the 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="'searchString'">
{
'expectedString' : '0.0.0.0:%s : SNMP : Enabled' \
% SNMP_PORT ,
'returnString' : returnString ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: get request'
</message>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'noError'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- 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 3865
#@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.
-->
<testcase name="getTestCaseName
('status: status with a wrong opendmk-jarfile value')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'status: set opendmk-jarfile property to a wrong value'
</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 opendmk-jarfile:wrong_file'
}
</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>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</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
}
</call>
<message>
'status: status when the server is started'
</message>
<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 ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: get request'
</message>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<message>
'status: restore value for opendmk-jarfile property'
</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 opendmk-jarfile:%s' \
% SNMP_PROPERTIES['opendmk-jarfile']
}
</call>
<message>
'status: restart the SNMP Connection Handler'
</message>
<call function="'restartSNMPConnectionHandler'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- 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 3865
#@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.
-->
<testcase name="getTestCaseName
('status: status with a wrong security-agent-file value')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'status: set the security-agent-file to a wrong value'
</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 security-agent-file:wrong_file'
}
</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>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<script>
msg1 = 'An unexpected error occurred while trying to initialize'
msg2 = 'the SNMP Connection Handler. Please check the'
msg3 = 'configuration attributes'
msg = '%s %s %s' % (msg1, msg2, msg3)
</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>
<message>
'status: status when the server is started'
</message>
<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 ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: get request'
</message>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<message>
'status: restore value for security-agent-file property'
</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 security-agent-file:%s' \
% SNMP_PROPERTIES['security-agent-file']
}
</call>
<message>
'status: restart the SNMP Connection Handler'
</message>
<call function="'restartSNMPConnectionHandler'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- 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 3865
#@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.
-->
<testcase name="getTestCaseName
('status: status with a wrong listen-port value')">
<sequence>
<call function="'testCase_Preamble'"/>
<!-- This testcase is not relevant on Windows -->
<script>
if is_windows_platform(STAF_REMOTE_HOSTNAME):
skip=1
else:
skip=0
</script>
<if expr="skip == 0">
<sequence>
<message>
'status: set the listen-port to a wrong value'
</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 listen-port:%s' \
% DEFAULT_PROPERTIES['listen-port']
}
</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>
<!--- Check that DS started -->
<call function="'isAlive'">
{
'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<script>
msg1 = 'An unexpected error occurred while trying to'
msg2 = 'initialize the SNMP Connection Handler. Please'
msg3 = 'check the configuration attributes'
msg = '%s %s %s' % (msg1, msg2, msg3)
</script>
<call function="'grep'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'filename' : serverLogFile ,
'testString': msg
}
</call>
<message>
'status: status when the server is started'
</message>
<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 ,
'knownIssue' : '3865' ,
'expectedRC' : expectedRC
}
</call>
<message>
'status: get request'
</message>
<call function="'SNMPGet'">
{
'snmpVersion' : '1',
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpPort' : SNMP_PORT ,
'snmpCommunity' : community ,
'snmpOIDs' : oid ,
'snmpStatus' : 'reqTimeout'
}
</call>
<message>
'status: restore value for listen-port property'
</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 listen-port:%s' \
% SNMP_PROPERTIES['listen-port']
}
</call>
<message>
'status: restart the SNMP Connection Handler'
</message>
<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>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>