From d29d5291e8da579b4e3c04bea7aaee5dbcbc035e Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Sun, 01 Jun 2008 10:21:02 +0000
Subject: [PATCH] Display the output of TrapListener if a timeout occurs during the trap tests
---
opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml | 245 +++++++----------------
opends/tests/shared/functions/snmp.xml | 135 +++++++++++++
opends/tests/functional-tests/testcases/snmp/snmp_trap_defaultconf.xml | 181 ++++++-----------
opends/tests/shared/java/snmp/SNMPTrapListener.java | 6
4 files changed, 277 insertions(+), 290 deletions(-)
diff --git a/opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml b/opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml
index 1b96c0e..1d35d6c 100644
--- a/opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml
+++ b/opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml
@@ -57,7 +57,8 @@
newTrapsCommunityProp = 'myCommunity'
newTrapsDestProp = DIRECTORY_INSTANCE_HOST
wrongTrapsDestProp = 'wrongtrapdestination'
- timerDuration = '5m'
+ outputFile2 = '%s/timer.out' % DIRECTORY_INSTANCE_DIR
+ timerDuration2 = '5m'
</script>
<!--- Test Case information
@@ -71,7 +72,7 @@
#@TestResult TODO.
-->
<testcase name="getTestCaseName
- ('trap_customconf: trap on stop-ds')">
+ ('trap_customconf: change the community property')">
<sequence>
@@ -106,7 +107,7 @@
}
</call>
- <timer duration="timerDuration">
+ <timer duration="timerDuration2">
<sequence>
<parallel>
<sequence>
@@ -120,7 +121,8 @@
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : defTrapsCommunityProp ,
- 'snmpTrapNumber' : '0,2,0,0,0,0'
+ 'snmpTrapNumber' : '0,2,0,0,0,0' ,
+ 'outputFile' : outputFile2
}
</call>
</sequence>
@@ -132,7 +134,7 @@
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -142,7 +144,7 @@
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -171,37 +173,18 @@
</sequence>
</timer>
- <script>timerRC = RC</script>
+ <script>timerRC2 = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
- <message>
- 'trap_customconf: timeout occurred'
- </message>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
-
- <timer duration="timerDuration">
+ <timer duration="timerDuration2">
<sequence>
<parallel>
<sequence>
@@ -215,7 +198,8 @@
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : newTrapsCommunityProp ,
- 'snmpTrapNumber' : '2,0,0,0,0,0'
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile2
}
</call>
</sequence>
@@ -227,7 +211,7 @@
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -237,7 +221,7 @@
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -266,35 +250,16 @@
</sequence>
</timer>
- <script>timerRC = RC</script>
+ <script>timerRC2 = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_customconf: timeout occurred'
- </message>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
<message>
'trap_customconf: restore the traps-community property'
@@ -344,7 +309,7 @@
#@TestResult TODO.
-->
<testcase name="getTestCaseName
- ('trap_customconf: set traps-destination property to a correct value')">
+ ('trap_customconf: set traps-destination property to correct value')">
<sequence>
@@ -381,7 +346,7 @@
}
</call>
- <timer duration="timerDuration">
+ <timer duration="timerDuration2">
<sequence>
<parallel>
<sequence>
@@ -395,7 +360,8 @@
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : defTrapsCommunityProp ,
- 'snmpTrapNumber' : '2,0,0,0,0,0'
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile2
}
</call>
</sequence>
@@ -407,7 +373,7 @@
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -417,7 +383,7 @@
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -446,35 +412,16 @@
</sequence>
</timer>
- <script>timerRC = RC</script>
+ <script>timerRC2 = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_customconf: timeout occurred'
- </message>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
<message>
'trap_customconf: restore the traps-destination property'
@@ -560,7 +507,7 @@
}
</call>
- <timer duration="timerDuration">
+ <timer duration="timerDuration2">
<sequence>
<parallel>
<sequence>
@@ -574,7 +521,8 @@
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : defTrapsCommunityProp ,
- 'snmpTrapNumber' : '0,0,0,0,0,0'
+ 'snmpTrapNumber' : '0,0,0,0,0,0' ,
+ 'outputFile' : outputFile2
}
</call>
</sequence>
@@ -586,7 +534,7 @@
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -596,7 +544,7 @@
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -625,35 +573,16 @@
</sequence>
</timer>
- <script>timerRC = RC</script>
+ <script>timerRC2 = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_customconf: timeout occurred'
- </message>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
<message>
'trap_customconf: restore the traps-destination property'
@@ -684,11 +613,11 @@
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD
}
</call>
-
+
<script>
knownIssue(3304)
</script>
-
+
<call function="'testCase_Postamble'"/>
</sequence>
@@ -727,7 +656,7 @@
'objectName' : 'SNMP Connection Handler' ,
'optionsString' : '--add traps-destination:%s \
--add traps-destination:%s' \
- % (wrongTrapsDestProp, newTrapsDestProp)
+ % (wrongTrapsDestProp, newTrapsDestProp)
}
</call>
@@ -744,7 +673,7 @@
}
</call>
- <timer duration="timerDuration">
+ <timer duration="timerDuration2">
<sequence>
<parallel>
<sequence>
@@ -758,7 +687,8 @@
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : defTrapsCommunityProp ,
- 'snmpTrapNumber' : '2,0,0,0,0,0'
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile2
}
</call>
</sequence>
@@ -770,7 +700,7 @@
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -780,7 +710,7 @@
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
@@ -809,35 +739,16 @@
</sequence>
</timer>
- <script>timerRC = RC</script>
+ <script>timerRC2 = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_customconf: timeout occurred'
- </message>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_customconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
<message>
'trap_customconf: restore the traps-destination property'
@@ -932,7 +843,7 @@
</sequence>
</testcase>
-
+
<call function="'testSuite_Postamble'"/>
</sequence>
diff --git a/opends/tests/functional-tests/testcases/snmp/snmp_trap_defaultconf.xml b/opends/tests/functional-tests/testcases/snmp/snmp_trap_defaultconf.xml
index ba74dc3..f2cab3c 100644
--- a/opends/tests/functional-tests/testcases/snmp/snmp_trap_defaultconf.xml
+++ b/opends/tests/functional-tests/testcases/snmp/snmp_trap_defaultconf.xml
@@ -50,13 +50,14 @@
</script>
<call function="'testSuite_Preamble'"/>
-
- <!--- Define default value for community -->
+
+ <!--- Define default value for community -->
<script>
trapsCommunity = '%s' % SNMP_PROPERTIES['traps-community']
+ outputFile = '%s/timer.out' % DIRECTORY_INSTANCE_DIR
timerDuration = '5m'
</script>
-
+
<!--- Test Case information
#@TestMarker SNMP trap with default configuration
#@TestName trap_defaultconf: trap on stop-ds
@@ -77,7 +78,7 @@
<testcase name="getTestCaseName('trap_defaultconf: trap on stop-ds')">
<sequence>
-
+
<timer duration="timerDuration">
<sequence>
<parallel>
@@ -85,14 +86,15 @@
<message>
'trap_defaultconf: run the trap listener'
</message>
-
+
<call function="'SNMPTrapListener'">
{
'location' : STAF_REMOTE_HOSTNAME ,
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : trapsCommunity ,
- 'snmpTrapNumber' : '1,0,0,0,0,0'
+ 'snmpTrapNumber' : '1,0,0,0,0,0' ,
+ 'outputFile' : outputFile
}
</call>
</sequence>
@@ -100,35 +102,35 @@
<message>
'trap_defaultconf: wait event from the trap listener'
</message>
-
+
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
-
+
<message>
'trap_defaultconf: delete event from the trap listener'
</message>
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
-
+
<message>
'trap_defaultconf: stop the server'
</message>
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
-
+
<message>
'trap_defaultconf: send event to the trap listener'
</message>
-
+
<call function="'SendEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
@@ -139,36 +141,17 @@
</parallel>
</sequence>
</timer>
-
+
<script>timerRC = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_defaultconf: timeout occurred'
- </message>
- <message>
- 'trap_defaultconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_defaultconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile ,
+ 'timerDuration' : timerDuration ,
+ 'timerRC' : timerRC
+ }
+ </call>
<call function="'testCase_Postamble'"/>
@@ -197,7 +180,7 @@
('trap_defaultconf: trap on start-ds')">
<sequence>
-
+
<timer duration="timerDuration">
<sequence>
<parallel>
@@ -205,13 +188,14 @@
<message>
'trap_defaultconf: run the trap listener'
</message>
-
+
<call function="'SNMPTrapListener'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : trapsCommunity ,
- 'snmpTrapNumber' : '1,0,0,0,0,0'
+ 'snmpTrapNumber' : '1,0,0,0,0,0' ,
+ 'outputFile' : outputFile
}
</call>
</sequence>
@@ -219,35 +203,35 @@
<message>
'trap_defaultconf: wait event from the trap listener'
</message>
-
+
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
-
+
<message>
'trap_defaultconf: delete event from the trap listener'
</message>
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
-
+
<message>
'trap_defaultconf: start the server'
</message>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
-
+
<message>
'trap_defaultconf: send event to the trap listener'
</message>
-
+
<call function="'SendEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
@@ -258,36 +242,17 @@
</parallel>
</sequence>
</timer>
-
+
<script>timerRC = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_defaultconf: timeout occurred'
- </message>
- <message>
- 'trap_defaultconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_defaultconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile ,
+ 'timerDuration' : timerDuration ,
+ 'timerRC' : timerRC
+ }
+ </call>
<call function="'testCase_Postamble'"/>
@@ -316,7 +281,7 @@
('trap_defaultconf: trap on stop-ds -R')">
<sequence>
-
+
<timer duration="timerDuration">
<sequence>
<parallel>
@@ -324,13 +289,14 @@
<message>
'trap_defaultconf: run the trap listener'
</message>
-
+
<call function="'SNMPTrapListener'">
{
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
'snmpTrapPort' : SNMP_TRAP_PORT ,
'snmpTrapCommunity' : trapsCommunity ,
- 'snmpTrapNumber' : '2,0,0,0,0,0'
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile
}
</call>
</sequence>
@@ -338,24 +304,24 @@
<message>
'trap_defaultconf: wait event from the trap listener'
</message>
-
+
<call function="'WaitEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
-
+
<message>
'trap_defaultconf: delete event from the trap listener'
</message>
<call function="'DeleteEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
+ 'name' : 'SNMPTrapListener/Ready'
}
</call>
-
+
<message>
'trap_defaultconf: restart the server'
</message>
@@ -365,11 +331,11 @@
'dsRestart' : 'True'
}
</call>
-
+
<message>
'trap_defaultconf: send event to the trap listener'
</message>
-
+
<call function="'SendEvent'">
{
'location' : STAF_REMOTE_HOSTNAME ,
@@ -380,36 +346,17 @@
</parallel>
</sequence>
</timer>
-
+
<script>timerRC = RC</script>
- <if expr="timerRC == 1">
- <sequence>
- <tcstatus result="'fail'"></tcstatus>
-
- <message>
- 'trap_defaultconf: timeout occurred'
- </message>
- <message>
- 'trap_defaultconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SNMPTrapLister/Ready'
- }
- </call>
- <message>
- 'trap_defaultconf: delete event from the trap listener'
- </message>
- <call function="'DeleteEvent'">
- {
- 'location' : STAF_REMOTE_HOSTNAME ,
- 'name' : 'SendTrap/Complete'
- }
- </call>
- </sequence>
- </if>
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile ,
+ 'timerDuration' : timerDuration ,
+ 'timerRC' : timerRC
+ }
+ </call>
<call function="'testCase_Postamble'"/>
diff --git a/opends/tests/shared/functions/snmp.xml b/opends/tests/shared/functions/snmp.xml
index d044dba..9e5d234 100755
--- a/opends/tests/shared/functions/snmp.xml
+++ b/opends/tests/shared/functions/snmp.xml
@@ -409,6 +409,12 @@
</function-arg-description>
<function-arg-property name="type" value="string"/>
</function-arg-def>
+ <function-arg-def name="outputFile" type="required">
+ <function-arg-description>
+ File to which the output should be written
+ </function-arg-description>
+ <function-arg-property name="type" value="filename"/>
+ </function-arg-def>
<function-arg-def name="expectedRC" type="optional" default="0">
<function-arg-description>
Expected return code value. Default value is 0
@@ -466,15 +472,18 @@
<message>
'%s %s' % (STAFCmd, STAFCmdParams)
</message>
-
+ <message>
+ 'TOFTOF: %s' % outputFile
+ </message>
<call function="'runCommand'" >
{
'name' : 'SNMP Trap Listener' ,
'command' : '%s/bin/java' % JAVA_HOME ,
'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
'location' : location ,
- 'path' : '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir),
+ 'path' : snmpPath ,
'env' : env ,
+ 'outputFile' : outputFile ,
'expectedRC' : expectedRC
}
</call>
@@ -644,7 +653,7 @@
<function-arg-property name="type" value="integer"/>
</function-arg-def>
</function-map-args>
-
+
<sequence>
<message>
'get the current mib values'
@@ -689,4 +698,124 @@
</sequence>
</function>
+ <!-- Check timer result -->
+ <function name="checkTimerResult" scope="local">
+ <function-prolog>
+ This function compare SNMP Values
+ </function-prolog>
+ <function-map-args>
+ <function-arg-def name="location"
+ type="optional"
+ default="STAF_REMOTE_HOSTNAME">
+ <function-arg-description>
+ Location of target host
+ </function-arg-description>
+ <function-arg-property name="type" value="hostname" />
+ </function-arg-def>
+ <function-arg-def name="outputFile" type="required">
+ <function-arg-description>
+ File containing output
+ </function-arg-description>
+ <function-arg-property name="type" value="string"/>
+ </function-arg-def>
+ <function-arg-def name="timerDuration" type="required">
+ <function-arg-description>
+ Timer duration
+ </function-arg-description>
+ <function-arg-property name="type" value="string"/>
+ </function-arg-def>
+ <function-arg-def name="timerRC" type="required">
+ <function-arg-description>
+ Return code value of the timer
+ </function-arg-description>
+ <function-arg-property name="type" value="integer"/>
+ </function-arg-def>
+ </function-map-args>
+
+ <sequence>
+
+ <if expr="timerRC == 1 or timerRC == 0">
+ <sequence>
+
+ <if expr="timerRC == 0">
+ <sequence>
+ <tcstatus result="'pass'"></tcstatus>
+
+ <message>
+ 'Process TrapListener ended before timer duration: %s' \
+ % timerDuration
+ </message>
+
+ <stafcmd name="'Delete file %s' % outputFile">
+ <location>location</location>
+ <service>'FS'</service>
+ <request>'DELETE ENTRY %s CONFIRM' % outputFile</request>
+ </stafcmd>
+ </sequence>
+ <else>
+ <sequence>
+ <tcstatus result="'fail'"></tcstatus>
+
+ <message>
+ 'Process TrapListener still running after timer duration: %s' \
+ % timerDuration
+ </message>
+
+ <stafcmd name="'Get output from TrapListener'">
+ <location>location</location>
+ <service>'FS'</service>
+ <request>'GET FILE %s' % outputFile</request>
+ </stafcmd>
+
+ <if expr="RC == 0">
+ <sequence>
+ <log message="1">'Output:%s' % STAFResult</log>
+
+ <stafcmd name="'Delete file %s' % outputFile">
+ <location>location</location>
+ <service>'FS'</service>
+ <request>'DELETE ENTRY %s CONFIRM' % outputFile</request>
+ </stafcmd>
+ </sequence>
+ <else>
+ <log message="1">
+ 'STAF %s FS GET FILE %s failed with RC=%s Result=%s' % \
+ (location, outputFile, RC, STAFResult)
+ </log>
+ </else>
+ </if>
+
+ <message>
+ 'Delete event from the trap listener'
+ </message>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : location ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <message>
+ 'Delete event from the trap listener'
+ </message>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : location ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </else>
+ </if>
+ </sequence>
+ <else>
+ <tcstatus result="'fail'">'Timer failed to begin.'</tcstatus>
+ </else>
+ </if>
+
+ </sequence>
+ </function>
+
</stax>
diff --git a/opends/tests/shared/java/snmp/SNMPTrapListener.java b/opends/tests/shared/java/snmp/SNMPTrapListener.java
index 5812392..124542e 100644
--- a/opends/tests/shared/java/snmp/SNMPTrapListener.java
+++ b/opends/tests/shared/java/snmp/SNMPTrapListener.java
@@ -170,9 +170,9 @@
// Post event to notice that the trap listener is ready
System.out.println(
- "run() of SNMPTrapListener: Send \"SNMPTrapLister/Ready\" event" +
- " to " + remoteHost + ".");
- handle.submit2(remoteHost, "SEM", "PULSE EVENT SNMPTrapLister/Ready");
+ "run() of SNMPTrapListener: Send \"SNMPTrapListener/Ready\"" +
+ " event to " + remoteHost + ".");
+ handle.submit2(remoteHost, "SEM", "PULSE EVENT SNMPTrapListener/Ready");
// Wait event which notices that all the traps have been sent
System.out.println(
--
Gitblit v1.10.0