5767N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5767N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
5767N/A<!--
5767N/A ! CDDL HEADER START
5767N/A !
5767N/A ! The contents of this file are subject to the terms of the
5767N/A ! Common Development and Distribution License, Version 1.0 only
5767N/A ! (the "License"). You may not use this file except in compliance
5767N/A ! with the License.
5767N/A !
5767N/A ! You can obtain a copy of the license at
5767N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
5767N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
5767N/A ! See the License for the specific language governing permissions
5767N/A ! and limitations under the License.
5767N/A !
5767N/A ! When distributing Covered Code, include this CDDL HEADER in each
5767N/A ! file and include the License file at
5767N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
5767N/A ! add the following below this CDDL HEADER, with the fields enclosed
5767N/A ! by brackets "[]" replaced with your own identifying information:
5767N/A ! Portions Copyright [yyyy] [name of copyright owner]
5767N/A !
5767N/A ! CDDL HEADER END
5767N/A !
5767N/A ! Copyright 2008-2010 Sun Microsystems, Inc.
6211N/A ! Portions Copyright 2012-2013 ForgeRock AS
5767N/A ! -->
5767N/A<stax>
5767N/A
5767N/A <!--- Test Case information
5767N/A #@TestMarker SNMP traps with custom configuration
5767N/A #@TestName traps_customconf: TODO
6211N/A #@TestIssue OPENDJ-870
5767N/A #@TestPurpose TODO.
5767N/A #@TestPreamble none
5767N/A #@TestStep TODO.
5767N/A #@TestPostamble none
5767N/A #@TestResult TODO.
5767N/A -->
5767N/A <function name="snmp_traps_custom_001" scope="local">
5767N/A <testcase name="getTestCaseName('Change the community property')">
5767N/A <sequence>
5767N/A <try>
5767N/A <sequence>
5767N/A
5767N/A <call function="'testCase_Preamble'"/>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Change the community property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--set traps-community:%s' \
5767N/A % newTrapsCommunityProp
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A <timer duration="timerDuration2">
5767N/A <sequence>
5767N/A <parallel>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Run the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SNMPTrapListener'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'snmpTrapPort' : SNMP_TRAP_PORT ,
5767N/A 'snmpTrapCommunity' : defTrapsCommunityProp ,
5767N/A 'snmpTrapNumber' : '0,2,0,0,0,0' ,
5767N/A 'outputFile' : outputFile2 ,
6211N/A 'knownIssue' : 'OPENDJ-870'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Wait event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'WaitEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Delete event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'DeleteEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the server' }
5767N/A </call>
5767N/A
5767N/A <call function="'StopDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A
5767N/A <call function="'StartDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A
5767N/A <!--- Check that DS started -->
5767N/A <call function="'isAlive'">
5767N/A {
5767N/A 'noOfLoops' : 10 ,
5767N/A 'noOfMilliSeconds' : 2000
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Send event to the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SendEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SendTrap/Complete'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A </parallel>
5767N/A </sequence>
5767N/A </timer>
5767N/A
5767N/A <script>timerRC2 = RC</script>
5767N/A
5767N/A <call function="'checkTimerResult'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'outputFile' : outputFile2 ,
5767N/A 'timerDuration' : timerDuration2 ,
5767N/A 'timerRC' : timerRC2
5767N/A }
5767N/A </call>
5767N/A
5767N/A <timer duration="timerDuration2">
5767N/A <sequence>
5767N/A <parallel>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Run the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SNMPTrapListener'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'snmpTrapPort' : SNMP_TRAP_PORT ,
5767N/A 'snmpTrapCommunity' : newTrapsCommunityProp ,
5767N/A 'snmpTrapNumber' : '2,0,0,0,0,0' ,
5767N/A 'outputFile' : outputFile2 ,
6211N/A 'knownIssue' : 'OPENDJ-870'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Wait event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'WaitEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Delete event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'DeleteEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the server' }
5767N/A </call>
5767N/A
5767N/A <call function="'StopDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A <call function="'StartDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A <!--- Check that DS started -->
5767N/A <call function="'isAlive'">
5767N/A {
5767N/A 'noOfLoops' : 10 ,
5767N/A 'noOfMilliSeconds' : 2000
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Send event to the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SendEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SendTrap/Complete'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A </parallel>
5767N/A </sequence>
5767N/A </timer>
5767N/A
5767N/A <script>timerRC2 = RC</script>
5767N/A
5767N/A <call function="'checkTimerResult'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'outputFile' : outputFile2 ,
5767N/A 'timerDuration' : timerDuration2 ,
5767N/A 'timerRC' : timerRC2
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restore the traps-community property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--set traps-community:%s' \
5767N/A % defTrapsCommunityProp
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A </sequence>
5767N/A
5767N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A </message>
5767N/A </catch>
5767N/A <finally>
5767N/A <sequence>
5767N/A <call function="'testCase_Postamble'"/>
5767N/A </sequence>
5767N/A </finally>
5767N/A </try>
5767N/A </sequence>
5767N/A </testcase>
5767N/A </function>
5767N/A
5767N/A <!--- Test Case information
5767N/A #@TestMarker SNMP traps with custom configuration
5767N/A #@TestName traps_customconf: TODO
6211N/A #@TestIssue OPENDJ-870
5767N/A #@TestPurpose TODO.
5767N/A #@TestPreamble none
5767N/A #@TestStep TODO.
5767N/A #@TestPostamble none
5767N/A #@TestResult TODO.
5767N/A -->
5767N/A <function name="snmp_traps_custom_002" scope="local">
5767N/A <testcase name="getTestCaseName('Set traps-destination property to correct value')">
5767N/A <sequence>
5767N/A <try>
5767N/A <sequence>
5767N/A
5767N/A <call function="'testCase_Preamble'"/>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Change the traps-destination property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--set traps-destination:%s' \
5767N/A % newTrapsDestProp
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A <timer duration="timerDuration2">
5767N/A <sequence>
5767N/A <parallel>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Run the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SNMPTrapListener'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'snmpTrapPort' : SNMP_TRAP_PORT ,
5767N/A 'snmpTrapCommunity' : defTrapsCommunityProp ,
5767N/A 'snmpTrapNumber' : '2,0,0,0,0,0' ,
5767N/A 'outputFile' : outputFile2 ,
6211N/A 'knownIssue' : 'OPENDJ-870'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Wait event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'WaitEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Delete event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'DeleteEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the server' }
5767N/A </call>
5767N/A
5767N/A <call function="'StopDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A <call function="'StartDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A <!--- Check that DS started -->
5767N/A <call function="'isAlive'">
5767N/A {
5767N/A 'noOfLoops' : 10 ,
5767N/A 'noOfMilliSeconds' : 2000
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Send event to the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SendEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SendTrap/Complete'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A </parallel>
5767N/A </sequence>
5767N/A </timer>
5767N/A
5767N/A <script>timerRC2 = RC</script>
5767N/A
5767N/A <call function="'checkTimerResult'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'outputFile' : outputFile2 ,
5767N/A 'timerDuration' : timerDuration2 ,
5767N/A 'timerRC' : timerRC2
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restore the traps-destination property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--reset traps-destination'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A
5767N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A </message>
5767N/A </catch>
5767N/A <finally>
5767N/A <sequence>
5767N/A <call function="'testCase_Postamble'"/>
5767N/A </sequence>
5767N/A </finally>
5767N/A </try>
5767N/A </sequence>
5767N/A </testcase>
5767N/A </function>
5767N/A
5767N/A <!--- Test Case information
5767N/A #@TestMarker SNMP traps with custom configuration
5767N/A #@TestName traps_customconf: TODO
5767N/A #@TestIssue none
5767N/A #@TestPurpose TODO.
5767N/A #@TestPreamble none
5767N/A #@TestStep TODO.
5767N/A #@TestPostamble none
5767N/A #@TestResult TODO.
5767N/A -->
5767N/A <function name="snmp_traps_custom_003" scope="local">
5767N/A <testcase name="getTestCaseName('Set traps-destination property to a wrong value')">
5767N/A <sequence>
5767N/A <try>
5767N/A <sequence>
5767N/A
5767N/A <call function="'testCase_Preamble'"/>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Change the traps-destination property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--set traps-destination:%s' \
5767N/A % wrongTrapsDestProp
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A <timer duration="timerDuration2">
5767N/A <sequence>
5767N/A <parallel>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Run the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SNMPTrapListener'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'snmpTrapPort' : SNMP_TRAP_PORT ,
5767N/A 'snmpTrapCommunity' : defTrapsCommunityProp ,
5767N/A 'snmpTrapNumber' : '0,0,0,0,0,0' ,
5767N/A 'outputFile' : outputFile2
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Wait event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'WaitEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Delete event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'DeleteEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the server' }
5767N/A </call>
5767N/A
5767N/A <call function="'StopDsWithScript'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'dsHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
5767N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A <call function="'StartDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A <!--- Check that DS started -->
5767N/A <call function="'isAlive'">
5767N/A {
5767N/A 'noOfLoops' : 10 ,
5767N/A 'noOfMilliSeconds' : 2000
5767N/A }
5767N/A </call>
5767N/A
5767N/A <script>
5767N/A msg1 = 'Traps Destination %s is an unknown host.' \
5767N/A % wrongTrapsDestProp
5767N/A msg2 = 'Traps will not be sent to this destination'
5767N/A msg = '%s %s' % (msg1, msg2)
5767N/A </script>
5767N/A
5767N/A <call function="'grep'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'filename' : serverLogFile ,
5767N/A 'testString': msg
5767N/A }
5767N/A </call>
5767N/A
5767N/A <script>
5767N/A msg1 = 'No valid trap destinations has been found.'
5767N/A msg2 = 'No trap will be sent'
5767N/A msg = '%s %s' % (msg1, msg2)
5767N/A </script>
5767N/A
5767N/A <call function="'grep'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'filename' : serverLogFile ,
5767N/A 'testString': msg
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Send event to the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SendEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SendTrap/Complete'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A </parallel>
5767N/A </sequence>
5767N/A </timer>
5767N/A
5767N/A <script>timerRC2 = RC</script>
5767N/A
5767N/A <call function="'checkTimerResult'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'outputFile' : outputFile2 ,
5767N/A 'timerDuration' : timerDuration2 ,
5767N/A 'timerRC' : timerRC2
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restore the traps-destination property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--reset traps-destination'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A </sequence>
5767N/A
5767N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A </message>
5767N/A </catch>
5767N/A <finally>
5767N/A <sequence>
5767N/A <call function="'testCase_Postamble'"/>
5767N/A </sequence>
5767N/A </finally>
5767N/A </try>
5767N/A </sequence>
5767N/A </testcase>
5767N/A </function>
5767N/A
5767N/A <!--- Test Case information
5767N/A #@TestMarker SNMP traps with custom configuration
5767N/A #@TestName traps_customconf: TODO
6211N/A #@TestIssue OPENDJ-870
5767N/A #@TestPurpose TODO.
5767N/A #@TestPreamble none
5767N/A #@TestStep TODO.
5767N/A #@TestPostamble none
5767N/A #@TestResult TODO.
5767N/A -->
5767N/A <function name="snmp_traps_custom_004" scope="local">
5767N/A <testcase name="getTestCaseName('Set traps-destination property to a list')">
5767N/A <sequence>
5767N/A <try>
5767N/A <sequence>
5767N/A
5767N/A <call function="'testCase_Preamble'"/>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Set traps-destination property to a list' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--set traps-destination:%s' \
5767N/A % wrongTrapsDestProp
5767N/A }
5767N/A </call>
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--add traps-destination:%s' \
5767N/A % newTrapsDestProp
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A <timer duration="timerDuration2">
5767N/A <sequence>
5767N/A <parallel>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Run the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SNMPTrapListener'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'snmpTrapPort' : SNMP_TRAP_PORT ,
5767N/A 'snmpTrapCommunity' : defTrapsCommunityProp ,
5767N/A 'snmpTrapNumber' : '2,0,0,0,0,0' ,
5767N/A 'outputFile' : outputFile2 ,
6211N/A 'knownIssue' : 'OPENDJ-870'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A <sequence>
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Wait event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'WaitEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Delete event from the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'DeleteEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SNMPTrapListener/Ready'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the server' }
5767N/A </call>
5767N/A
5767N/A <call function="'StopDsWithScript'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'dsHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
5767N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A <call function="'StartDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A </call>
5767N/A <!--- Check that DS started -->
5767N/A <call function="'isAlive'">
5767N/A {
5767N/A 'noOfLoops' : 10 ,
5767N/A 'noOfMilliSeconds' : 2000
5767N/A }
5767N/A </call>
5767N/A
5767N/A <script>
5767N/A msg1 = 'Traps Destination %s is an unknown host.' \
5767N/A % wrongTrapsDestProp
5767N/A msg2 = 'Traps will not be sent to this destination'
5767N/A msg = '%s %s' % (msg1, msg2)
5767N/A </script>
5767N/A
5767N/A <call function="'grep'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'filename' : serverLogFile ,
5767N/A 'testString': msg
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Send event to the trap listener' }
5767N/A </call>
5767N/A
5767N/A <call function="'SendEvent'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'name' : 'SendTrap/Complete'
5767N/A }
5767N/A </call>
5767N/A </sequence>
5767N/A </parallel>
5767N/A </sequence>
5767N/A </timer>
5767N/A
5767N/A <script>timerRC2 = RC</script>
5767N/A
5767N/A <call function="'checkTimerResult'">
5767N/A {
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A 'outputFile' : outputFile2 ,
5767N/A 'timerDuration' : timerDuration2 ,
5767N/A 'timerRC' : timerRC2
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restore the traps-destination property' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--reset traps-destination'
5767N/A }
5767N/A </call>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Restart the SNMP Connection Handler' }
5767N/A </call>
5767N/A
5767N/A <call function="'restartSNMPConnectionHandler'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
5767N/A }
5767N/A </call>
5767N/A
5767N/A </sequence>
5767N/A
5767N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A </message>
5767N/A </catch>
5767N/A <finally>
5767N/A <sequence>
5767N/A <call function="'testCase_Postamble'"/>
5767N/A </sequence>
5767N/A </finally>
5767N/A </try>
5767N/A </sequence>
5767N/A </testcase>
5767N/A </function>
5767N/A
5767N/A <!--- Test Case information
5767N/A #@TestMarker SNMP traps with custom configuration
5767N/A #@TestName traps_customconf: TODO
5767N/A #@TestIssue none
5767N/A #@TestPurpose TODO.
5767N/A #@TestPreamble none
5767N/A #@TestStep TODO.
5767N/A #@TestPostamble none
5767N/A #@TestResult TODO.
5767N/A -->
5767N/A <function name="snmp_traps_custom_005" scope="local">
5767N/A <testcase name="getTestCaseName('Set the traps-community property to a list')">
5767N/A <sequence>
5767N/A <try>
5767N/A <sequence>
5767N/A
5767N/A <call function="'testCase_Preamble'"/>
5767N/A
5767N/A <call function="'testStep'">
5767N/A { 'stepMessage' : 'Set the traps-community property to a list' }
5767N/A </call>
5767N/A
5767N/A <call function="'dsconfig'">
5767N/A {
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--add traps-community:%s' \
5767N/A % newTrapsCommunityProp ,
5767N/A 'expectedRC' : 1
5767N/A }
5767N/A </call>
5767N/A
5767N/A <script>
5767N/A returnString = STAXResult[0][1]
5767N/A
5767N/A returnString = STAXResult[0][1]
5767N/A msg1 = 'It is not possible to specify multiple values for the'
5767N/A msg2 = 'SNMP Connection Handler%sproperty "traps-community"' \
5767N/A % newLine
5767N/A msg3 = 'as it is single-valued'
5767N/A msg = '%s %s %s' % (msg1, msg2, msg3)
5767N/A </script>
5767N/A
5767N/A <call function="'checktestString'">
5767N/A {
5767N/A 'returnString' : returnString ,
5767N/A 'expectedString' : msg
5767N/A }
5767N/A </call>
5767N/A
5767N/A </sequence>
5767N/A
5767N/A <catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A </message>
5767N/A </catch>
5767N/A <finally>
5767N/A <sequence>
5767N/A <call function="'testCase_Postamble'"/>
5767N/A </sequence>
5767N/A </finally>
5767N/A </try>
5767N/A </sequence>
5767N/A </testcase>
5767N/A </function>
5767N/A
5767N/A</stax>