From d19a8b638025ad9811e77c58c88bd183cecb0ecf Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Mon, 05 Mar 2012 10:46:11 +0000
Subject: [PATCH] Add new snmp functional test suite
---
opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c.xml | 149 +
opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps.xml | 148 +
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp.xml | 123
opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml | 2198 +++++++++++++++
opends/tests/staf-tests/shared/functions/utils.xml | 7
opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic.xml | 182 +
opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_defaultconf_tests.xml | 403 ++
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_cleanup.xml | 79
opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_customconf_tests.xml | 1004 ++++++
opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_defaultconf_tests.xml | 703 ++++
opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_customconf_tests.xml | 695 ++++
opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml | 167 +
opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1.xml | 149 +
opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_customconf_tests.xml | 695 ++++
opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_defaultconf_tests.xml | 235 +
opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml | 596 ++++
opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_customconf_tests.xml | 974 ++++++
opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_defaultconf_tests.xml | 236 +
18 files changed, 8,740 insertions(+), 3 deletions(-)
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic.xml
new file mode 100644
index 0000000..95a3c58
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic.xml
@@ -0,0 +1,182 @@
+<?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/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
+ ! trunk/opends/resource/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 2012 ForgeRock AS.
+ ! -->
+<stax>
+ <defaultcall function="main_snmp_basic"/>
+ <function name="main_snmp_basic" scope="local">
+ <sequence>
+ <block name="'main_snmp_basic'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group']='snmp'
+ CurrentTestPath['suite']='basic'
+
+ __group=CurrentTestPath['group']
+ __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+ </script>
+
+ <!--- Test Suite information
+ #@TestSuiteName SNMP default properties test suite
+ #@TestSuitePurpose Verify SNMP default properties
+ #@TestSuiteID basic
+ #@TestSuiteGroup snmp
+ #@TestGroup snmp
+ #@TestScript snmp.xml
+ #@TestHTMLLink http://www.forgerock.org/
+ -->
+ <call function="'testSuite_Preamble'"/>
+
+ <try>
+ <sequence>
+
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('basic/snmp_basic_tests')
+ </script>
+
+ <!-- Import the files for this test suite -->
+ <iterate var="__import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (__groupdir,__import)"/>
+ </iterate>
+
+ <!-- Specific to basic SNMP tests -->
+ <script>
+ # Globals
+ global_DEFAULT_VALUES = STAXGlobal([])
+ global_indexLDAP = STAXGlobal([])
+
+ # Default Properties
+ EXPECTED_PROPERTIES = {}
+ EXPECTED_PROPERTIES['allowed-client'] = ''
+ EXPECTED_PROPERTIES['allowed-manager'] = '*'
+ EXPECTED_PROPERTIES['allowed-user'] = '*'
+ EXPECTED_PROPERTIES['community'] = 'OpenDJ'
+ EXPECTED_PROPERTIES['denied-client'] = ''
+ EXPECTED_PROPERTIES['enabled'] = 'false'
+ EXPECTED_PROPERTIES['listen-address'] = '0.0.0.0'
+ EXPECTED_PROPERTIES['listen-port'] = '161'
+ EXPECTED_PROPERTIES['opendmk-jarfile'] = ''
+ EXPECTED_PROPERTIES['registered-mbean'] = 'false'
+ file = 'config/snmp/security/opendj-snmp.security'
+ EXPECTED_PROPERTIES['security-agent-file'] = '%s' % file
+ EXPECTED_PROPERTIES['security-level'] = 'authnopriv'
+ EXPECTED_PROPERTIES['trap-port'] = '162'
+ EXPECTED_PROPERTIES['traps-community'] = 'OpenDJ'
+ EXPECTED_PROPERTIES['traps-destination'] = ''
+
+ # MIB
+ community = '%s@%s' \
+ % (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
+ nbLoop = 10
+
+ # Register Mbeans
+ refRegisteredMbeanProp = SNMP_PROPERTIES['registered-mbean']
+ defCommunityProp = SNMP_PROPERTIES['community']
+ defCommunity = '%s@%s' %(defCommunityProp, defCommunityProp)
+ oid = 'dsServerType.1'
+
+ # Status
+ community = '%s@%s' \
+ % (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
+ oid = 'dsServerType.1'
+ serverLogFile = '%s/%s/logs/server.out' \
+ % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('snmp_basic_001')
+ testsList.append('snmp_basic_002')
+ testsList.append('snmp_basic_003')
+ testsList.append('snmp_basic_004')
+ testsList.append('snmp_basic_005')
+ testsList.append('snmp_basic_006')
+ testsList.append('snmp_basic_007')
+ testsList.append('snmp_basic_008')
+ testsList.append('snmp_basic_009')
+ testsList.append('snmp_basic_010')
+ testsList.append('snmp_basic_011')
+ testsList.append('snmp_basic_012')
+ testsList.append('snmp_basic_013')
+ testsList.append('snmp_basic_014')
+ testsList.append('snmp_basic_015')
+ testsList.append('snmp_basic_016')
+ testsList.append('snmp_basic_017')
+ </script>
+
+ <!-- Execute the Tests -->
+ <iterate var="__test" in="testsList">
+ <sequence>
+ <call function="'%s' % (__test)" />
+ </sequence>
+ </iterate>
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">
+ 'Setup of test suite failed.'
+ </message>
+ <rethrow/>
+ </sequence>
+ </catch>
+
+ <finally>
+ <message>'Test Cases Completed.'</message>
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ <finally>
+ <sequence>
+ <!-- Test Suite Cleanup -->
+ <message>'Finally: Global Schema Cleanup.'</message>
+ <try>
+ <message>'No Test Suite Cleanup'</message>
+ <catch exception="'STAFException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
+ </sequence>
+ </catch>
+ <finally>
+ <call function="'testSuite_Postamble'"/>
+ </finally>
+ </try>
+ </sequence>
+ </finally>
+
+ </try>
+ </block>
+ </sequence>
+ </function>
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
new file mode 100644
index 0000000..313637b
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
@@ -0,0 +1,2198 @@
+<?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.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP Connection Handler default properties
+ #@TestName snmp_defaultproperties: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_001" scope="local">
+ <testcase name="getTestCaseName('SNMP Default Properties')">
+ <sequence>
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Test Name = %s' % STAXCurrentTestcase
+ </message>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check the default properties.' }
+ </call>
+
+ <script>
+ result = compare_property_table(EXPECTED_PROPERTIES,
+ DEFAULT_PROPERTIES)
+ </script>
+
+ <message>
+ '%s' % result
+ </message>
+
+ <call function="'checktestStringNotPresent'">
+ {
+ 'returnString' : result ,
+ 'testString' : 'ERROR'
+ }
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_002" scope="local">
+ <testcase name="getTestCaseName('Check the connection handlers')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the SNMP values.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check the connection handlers.' }
+ </call>
+
+ <script>
+ nbHandler = get_handler_count(DEFAULT_VALUES)
+ indexSNMP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
+ % SNMP_PORT)
+ indexLDAP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
+ % DIRECTORY_INSTANCE_PORT)
+ global_indexLDAP.set(indexLDAP)
+ </script>
+
+ <if expr="nbHandler == 2 and indexSNMP != 0 and indexLDAP != 0">
+ <sequence>
+ <script>
+ msg1 = 'The connection handlers info are correct.\n'
+ msg2 = 'number of handler: %s\n' % nbHandler
+ msg3 = 'index SNMP handler: %s\n' % indexSNMP
+ msg4 = 'index LDAP handler: %s\n' % indexLDAP
+ msg = '%s%s%s%s' % (msg1, msg2, msg3, msg4)
+ </script>
+ <message>
+ '%s' % msg
+ </message>
+ <tcstatus result="'pass'"></tcstatus>
+ </sequence>
+ <else>
+ <sequence>
+ <script>
+ msg1 = 'The connection handlers info are wrong.\n'
+ msg2 = 'number of handler: %s/3\n' % nbHandler
+ msg3 = 'index SNMP handler: %s\n' % indexSNMP
+ msg4 = 'index LDAP handler: %s\n' % indexLDAP
+ msg = '%s%s%s%s' % (msg1, msg2, msg3, msg4)
+ </script>
+ <message>
+ '%s' % msg
+ </message>
+ <tcstatus result="'fail'"></tcstatus>
+ </sequence>
+ </else>
+ </if>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_003" scope="local">
+ <testcase name="getTestCaseName('Check value of dsServerType entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsServerType entry.' }
+ </call>
+
+ <!-- Get the information about the server -->
+ <call function="'GetVar'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'type' : 'shared',
+ 'variable' : 'Job%s_ServerInfo' % STAXParentID
+ }
+ </call>
+
+ <if expr="RC != 0">
+ <script>
+ STAFResult='{}'
+ </script>
+ </if>
+
+ <script>
+ jobInfo=eval(STAFResult)
+
+ # In IPS mode, DIRECTORY_INSTANCE_BIN is used
+ # for installation path
+ if IPS_PKG == True:
+ instPath = DIRECTORY_INSTANCE_BIN
+ else:
+ instPath = DIRECTORY_INSTANCE_DIR
+
+ if jobInfo.has_key('%s/%s' % (instPath,OPENDSNAME)):
+ serverInformation=jobInfo['%s/%s' % (instPath,OPENDSNAME)]
+ dsVersion=serverInformation['server version']
+ dsBuild=serverInformation['server buildid']
+ else:
+ dsVersion='unknown'
+ dsBuild='unknown'
+
+ dsServer = '%s %s - %s' \
+ % (PRODUCTNAME, dsVersion.rstrip(), dsBuild)
+
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ dsServerType = DEFAULT_VALUES['dsServerType.1']
+ </script>
+
+ <if expr="dsServerType == dsServer">
+ <sequence>
+ <script>
+ msg1 = 'Value for dsServerType entry is correct.\n'
+ msg2 = 'Current value: %s' % dsServerType
+ msg = '%s%s' % (msg1, msg2)
+ </script>
+ <message>
+ '%s' % msg
+ </message>
+ <tcstatus result="'pass'"></tcstatus>
+ </sequence>
+ <else>
+ <sequence>
+ <script>
+ msg1 = 'Value for dsServerType entry is wrong.\n'
+ msg2 = 'Expected value: %s\n' % dsServer
+ msg3 = 'Current value: %s' % dsServerType
+ msg = '%s%s%s' % (msg1, msg2, msg3)
+ </script>
+ <message>
+ '%s' % msg
+ </message>
+ <tcstatus result="'fail'"></tcstatus>
+ </sequence>
+ </else>
+ </if>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_004" scope="local">
+ <testcase name="getTestCaseName('Check value of dsServerDescription entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsServerDescription entry.' }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ dsServerDescription = DEFAULT_VALUES['dsServerDescription.1']
+ dsPath = '%s/%s' % (DIRECTORY_INSTANCE_BIN, OPENDSNAME)
+ if is_windows_platform(DIRECTORY_INSTANCE_HOST):
+ dsPath = dsPath.replace('/', '\\')
+ </script>
+
+ <if expr="dsServerDescription == dsPath">
+ <sequence>
+ <script>
+ msg1 = 'Value for dsServerDescription entry is correct.\n'
+ msg2 = 'Current value: %s' % dsServerDescription
+ msg = '%s%s' % (msg1, msg2)
+ </script>
+ <message>
+ '%s' % msg
+ </message>
+ <tcstatus result="'pass'"></tcstatus>
+ </sequence>
+ <else>
+ <sequence>
+ <script>
+ msg1 = 'Value for dsServerDescription entry is wrong.\n'
+ msg2 = 'Expected value: %s\n' % dsPath
+ msg3 = 'Current value: %s' % dsServerDescription
+ msg = '%s%s%s' % (msg1, msg2, msg3)
+ </script>
+ <message>
+ '%s' % msg
+ </message>
+ <tcstatus result="'fail'"></tcstatus>
+ </sequence>
+ </else>
+ </if>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue 3862
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_005" scope="local">
+ <testcase name="getTestCaseName('Check value of dsApplIfSearchOps entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Perform %s search operation' % nbLoop }
+ </call>
+
+ <loop var="loop" from="1" to="nbLoop">
+ <sequence>
+
+ <script>
+ id = 700 + loop
+ userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
+ </script>
+
+ <message>
+ 'LOOP %s: %s' % (loop, userDn)
+ </message>
+
+ <call function="'ldapSearchWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsTypesOnly' : 'True' ,
+ 'dsBaseDN' : 'dc=com' ,
+ 'dsFilter' : userDn
+ }
+ </call>
+
+ </sequence>
+ </loop>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Increment the SNMP values' }
+ </call>
+
+ <script>
+ indexLDAP = global_indexLDAP.get()
+ key = 'dsApplIfReadOps.%s' % indexLDAP
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ key = 'dsApplIfSearchOps.%s' % indexLDAP
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsApplIfSearchOps entry' }
+ </call>
+
+ <call function="'compareSNMPValues'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'index' : indexLDAP ,
+ 'knownIssue' : '3862'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the snmp values' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = {}
+ global_DEFAULT_VALUES.set({})
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ </script>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue 3862
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_006" scope="local">
+ <testcase name="getTestCaseName('Check value of dsApplIfAddEntryOps entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Perform %s add operations' % nbLoop }
+ </call>
+
+ <loop var="loop" from="1" to="nbLoop">
+ <sequence>
+
+ <script>
+ id = 1000 + loop
+ userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
+
+ listAttr = []
+ listAttr.append('objectclass:top')
+ listAttr.append('objectclass:organizationalperson')
+ listAttr.append('objectclass:inetorgperson')
+ listAttr.append('objectclass:person')
+ listAttr.append('givenname:Izen.0')
+ listAttr.append('sn:Abizen.0')
+ listAttr.append('cn:Izen Abizen.0')
+ listAttr.append('l:ICNC')
+ </script>
+
+ <message>
+ 'LOOP %s: %s' % (loop, userDn)
+ </message>
+
+ <call function="'addAnEntry'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'DNToAdd' : userDn,
+ 'listAttributes' : listAttr
+ }
+ </call>
+
+ </sequence>
+ </loop>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Increment the SNMP values' }
+ </call>
+
+ <script>
+ indexLDAP = global_indexLDAP.get()
+ key = 'dsApplIfReadOps.%s' % indexLDAP
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ key = 'dsApplIfAddEntryOps.%s' % indexLDAP
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ DEFAULT_VALUES['dsMasterEntries.1'] = \
+ str(int(DEFAULT_VALUES['dsMasterEntries.1']) + nbLoop)
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsApplIfAddEntryOps entry' }
+ </call>
+
+ <call function="'compareSNMPValues'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'index' : indexLDAP ,
+ 'knownIssue' : '3862'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the SNMP values' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = {}
+ global_DEFAULT_VALUES.set({})
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ </script>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue 3862
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_007" scope="local">
+ <testcase name="getTestCaseName('Check value of dsApplIfRemoveEntryOps entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Perform %s remove operations' % nbLoop }
+ </call>
+
+ <loop var="loop" from="1" to="nbLoop">
+ <sequence>
+
+ <script>
+ id = 1000 + loop
+ userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
+ </script>
+
+ <message>
+ 'LOOP %s: %s' % (loop, userDn)
+ </message>
+
+ <call function="'ldapDeleteWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsDn' : ['%s' % userDn]
+ }
+ </call>
+
+ </sequence>
+ </loop>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Increment the SNMP values' }
+ </call>
+
+ <script>
+ indexLDAP = global_indexLDAP.get()
+ key = 'dsApplIfReadOps.%s' % indexLDAP
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ key = 'dsApplIfRemoveEntryOps.%s' % indexLDAP
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ DEFAULT_VALUES['dsMasterEntries.1'] = \
+ str(int(DEFAULT_VALUES['dsMasterEntries.1']) - nbLoop)
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsApplIfRemoveEntryOps entry' }
+ </call>
+
+ <call function="'compareSNMPValues'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'index' : indexLDAP ,
+ 'knownIssue' : '3862'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the SNMP values' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = {}
+ global_DEFAULT_VALUES.set({})
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ </script>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue 3862
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_008" scope="local">
+ <testcase name="getTestCaseName('Check value of dsApplIfCompareOps entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Perform %s compare operations' % nbLoop }
+ </call>
+
+ <loop var="loop" from="1" to="nbLoop">
+ <sequence>
+
+ <script>
+ id = 0 + loop
+ userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
+ </script>
+
+ <message>
+ 'LOOP %s: %s' % (loop, userDn)
+ </message>
+
+ <call function="'ldapCompareWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsDn' : ['postalCode:64447', '%s' % userDn] ,
+ 'expectedRC' : 'noCheck'
+ }
+ </call>
+
+ </sequence>
+ </loop>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Increment the SNMP values' }
+ </call>
+
+ <script>
+ indexLDAP = global_indexLDAP.get()
+ key = 'dsApplIfReadOps.%s' % indexLDAP
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ key = 'dsApplIfCompareOps.%s' % indexLDAP
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsApplIfCompareOps entry' }
+ </call>
+
+ <call function="'compareSNMPValues'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'index' : indexLDAP ,
+ 'knownIssue' : '3862'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the SNMP values' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = {}
+ global_DEFAULT_VALUES.set({})
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ </script>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue 3862
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_009" scope="local">
+ <testcase name="getTestCaseName('Check value of dsApplIfModifyEntryOps entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Perform %s modify operations' % nbLoop }
+ </call>
+
+ <loop var="loop" from="1" to="nbLoop">
+ <sequence>
+
+ <script>
+ id = 400 + loop
+ userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
+ </script>
+
+ <message>
+ 'LOOP %s: %s' % (loop, userDn)
+ </message>
+
+ <call function="'modifyAnAttribute'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'DNToModify' : userDn ,
+ 'attributeName' : 'postalCode' ,
+ 'newAttributeValue' : '%s' % id ,
+ 'changetype' : 'replace'
+ }
+ </call>
+
+ </sequence>
+ </loop>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Increment the SNMP values' }
+ </call>
+
+ <script>
+ indexLDAP = global_indexLDAP.get()
+ key = 'dsApplIfReadOps.%s' % indexLDAP
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ key = 'dsApplIfModifyEntryOps.%s' % indexLDAP
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsApplIfModifyEntryOps entry' }
+ </call>
+
+ <call function="'compareSNMPValues'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'index' : indexLDAP ,
+ 'knownIssue' : '3862'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the SNMP values' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = {}
+ global_DEFAULT_VALUES.set({})
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ </script>
+
+ </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 MIB values
+ #@TestName snmp_mibvalues: TODO
+ #@TestIssue 3862
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_010" scope="local">
+ <testcase name="getTestCaseName('Check value of dsApplIfModifyRDNOps entry')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Perform %s modify RDN operations' % nbLoop }
+ </call>
+
+ <loop var="loop" from="1" to="nbLoop">
+ <sequence>
+
+ <!--- Create a ldif file for moddn -->
+ <script>
+ id = 800 + loop
+ userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
+ newid = 2000 + loop
+ newDn = 'uid=user.%s' % newid
+
+ templateFile = 'template-%s.ldif' % loop
+ templatePath = '%s/%s' % (remote.temp, templateFile)
+ ldifFile = 'moddn-%s.ldif' % loop
+ ldifPath = '%s/%s' % (DIRECTORY_INSTANCE_DIR, ldifFile)
+ ldifLines = []
+ ldifLines.append('dn: %s' % userDn)
+ ldifLines.append('changetype: moddn')
+ ldifLines.append('newRDN: %s' % newDn)
+ ldifLines.append('deleteOldRDN: 1')
+ outFile = open(templatePath, "w")
+ for line in ldifLines:
+ outFile.write("%s\n" % line)
+ outFile.close()
+ </script>
+
+ <message>
+ 'LOOP %s: %s => %s' % (loop, userDn, newDn)
+ </message>
+
+ <!--- Copy file to remote host -->
+ <message>
+ 'Copy %s to %s on %s' \
+ % (templateFile,DIRECTORY_INSTANCE_DIR,STAF_REMOTE_HOSTNAME)
+ </message>
+ <call function="'copyFile'">
+ {
+ 'srcfile' : templatePath ,
+ 'destfile' : ldifPath ,
+ 'remotehost' : STAF_REMOTE_HOSTNAME
+ }
+ </call>
+
+ <call function="'ldapModifyWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsFilename' : ldifPath
+ }
+ </call>
+
+ <!--- Delete the ldif file used for moddn on remote host -->
+ <message>
+ 'Delete %s on %s' % (ldifPath, STAF_REMOTE_HOSTNAME)
+ </message>
+ <call function="'deleteFile'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'filename' : ldifPath
+ }
+ </call>
+
+ <!--- Delete locally the ldif file used for moddn -->
+ <message>
+ 'Delete locally %s' % templatePath
+ </message>
+ <call function="'deleteFile'">
+ {
+ 'location' : STAXServiceMachine ,
+ 'filename' : templatePath
+ }
+ </call>
+ </sequence>
+ </loop>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Increment the SNMP values' }
+ </call>
+
+ <script>
+ indexLDAP = global_indexLDAP.get()
+ key = 'dsApplIfReadOps.%s' % indexLDAP
+ DEFAULT_VALUES = global_DEFAULT_VALUES.get()
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ key = 'dsApplIfModifyRDNOps.%s' % indexLDAP
+ DEFAULT_VALUES[key] = \
+ str(int(DEFAULT_VALUES[key]) + nbLoop)
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check value of dsApplIfModifyRDNOps entry' }
+ </call>
+
+ <call function="'compareSNMPValues'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'index' : indexLDAP ,
+ 'knownIssue' : '3862'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Save the SNMP values' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : '' ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpWalk' : 'True'
+ }
+ </call>
+
+ <script>
+ DEFAULT_VALUES = {}
+ global_DEFAULT_VALUES.set({})
+ DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
+ global_DEFAULT_VALUES.set(DEFAULT_VALUES)
+ </script>
+
+ </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 Connection Handler register mbean
+ #@TestName registermbean: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_011" scope="local">
+ <testcase name="getTestCaseName('Check that there is no error at startup')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the register-mbean property to true' }
+ </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 registered-mbean:true'
+ }
+ </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>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'checktestStringNotPresent'">
+ {
+ 'returnString' : returnString ,
+ 'testString' : 'category=PROTOCOL severity=SEVERE_ERROR'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get to check the SNMPConnection Handler' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : defCommunity ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the register-mbean 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 registered-mbean:%s' \
+ % refRegisteredMbeanProp
+ }
+ </call>
+
+ <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 Connection Handler register mbean
+ #@TestName registermbean: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_basic_012" scope="local">
+ <testcase name="getTestCaseName('Set the register-mbean property to a wrong value')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set register-mbean property to a wrong value' }
+ </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 registered-mbean:myValue' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg1 = 'The value "myValue" is not a valid value for the'
+ msg2 = 'SNMP Connection Handler\nproperty "registered-mbean"'
+ msg3 = 'which has the following syntax: false | true'
+ msg = '%s %s %s' % (msg1, msg2, msg3)
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </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 Connection Handler status
+ #@TestName status: check status when the server is
+ stopped/started
+ #@TestIssue none
+ #@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.
+ -->
+ <function name="snmp_basic_013" scope="local">
+ <testcase name="getTestCaseName('Status when the server is stopped/started')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
+ </call>
+
+ <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="'testStep'">
+ { 'stepMessage' : 'Get status when the server is stopped' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT) }
+ </call>
+
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get status when the server is started' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send SNMP Get request' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </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 Connection Handler status
+ #@TestName status: check status when the connection
+ handler is disabled/enabled
+ #@TestIssue none
+ #@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.
+ -->
+ <function name="snmp_basic_014" scope="local">
+ <testcase name="getTestCaseName('Status when SNMP Connection Handler is disabled/enabled')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Disable the SNMP Connection Handler' }
+ </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 enabled:false'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get status when the SNMP connection handler is disabled' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send SNMP Get request' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'reqTimeout'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Enable the SNMP Connection Handler' }
+ </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 enabled:true'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get status when the SNMP connection handler is enabled' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send SNMP Get request' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </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 Connection Handler status
+ #@TestName status: check error message and status when
+ the opendmk-jarfile property is set to a
+ wrong value
+ #@TestIssue 3943
+ #@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.
+ -->
+ <function name="snmp_basic_015" scope="local">
+ <testcase name="getTestCaseName('Status with a wrong opendmk-jarfile value')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set opendmk-jarfile property to a wrong value' }
+ </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 opendmk-jarfile:wrong_file'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
+ </call>
+
+ <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>
+ opendmkJarFile = '%s/%s/wrong_file' \
+ % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
+ if is_windows_platform(DIRECTORY_INSTANCE_HOST):
+ opendmkJarFile = opendmkJarFile.replace('/', '\\')
+
+ msg1 = 'The specified OpenDMK jar file'
+ msg2 = '\'%s\' could not be found.' % opendmkJarFile
+ msg3 = 'Verify that the value set in the opendmk-jarfile'
+ msg4 = 'configuration parameter of the SNMP connection handler'
+ msg5 = 'is the valid path to the jdmkrt.jar file and that the'
+ msg6 = 'file is accessible'
+ 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>
+
+ <call function="'setKnownIssue'">
+ { 'issueId' : '3943' }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get status when the server is started' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send SNMP Get request' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'reqTimeout'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore value for opendmk-jarfile 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 opendmk-jarfile:%s' \
+ % SNMP_PROPERTIES['opendmk-jarfile']
+ }
+ </call>
+
+ <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 Connection Handler status
+ #@TestName status: check error message and status when
+ the security-agent-file property is set to a
+ wrong value
+ #@TestIssue none
+ #@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.
+ -->
+ <function name="snmp_basic_016" scope="local">
+ <testcase name="getTestCaseName('Status with a wrong security-agent-file value')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the security-agent-file to a wrong value' }
+ </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 security-agent-file:wrong_file'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
+ </call>
+
+ <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 = 'Cannot initialize the SNMP Connection Handler.'
+ msg2 = 'Please check the configuration attributes'
+ msg = '%s %s' % (msg1, msg2)
+ </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>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get status when the server is started' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send SNMP Get request' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'reqTimeout'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore value for security-agent-file 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 security-agent-file:%s' \
+ % SNMP_PROPERTIES['security-agent-file']
+ }
+ </call>
+
+ <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 Connection Handler status
+ #@TestName status: check error message and status when
+ the listen-port property is set to a wrong
+ value
+ #@TestIssue none
+ #@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.
+ -->
+ <function name="snmp_basic_017" scope="local">
+ <testcase name="getTestCaseName('Status with a wrong listen-port value')">
+ <sequence>
+ <try>
+
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <script>
+ if is_windows_platform(STAF_REMOTE_HOSTNAME) or IPS_PKG:
+ skip=1
+ else:
+ skip=0
+ </script>
+
+ <if expr="skip == 0">
+ <sequence>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the listen-port to a wrong value' }
+ </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 listen-port:%s' \
+ % DEFAULT_PROPERTIES['listen-port']
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart DS running on port %s' % (DIRECTORY_INSTANCE_PORT) }
+ </call>
+
+ <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>
+
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <script>
+ msg1 = 'Cannot initialize the SNMP Connection Handler.'
+ msg2 = 'Please check the configuration attributes'
+ msg = '%s %s' % (msg1, msg2)
+ </script>
+
+ <call function="'grep'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'filename' : serverLogFile ,
+ 'testString': msg
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get status when the server is started' }
+ </call>
+
+ <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 ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send SNMP Get request' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'reqTimeout'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore value for listen-port 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 listen-port:%s' \
+ % SNMP_PROPERTIES['listen-port']
+ }
+ </call>
+
+ <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>
+ <else>
+ <sequence>
+ <message>'This testcase is not relevant on Windows'</message>
+ <tcstatus result="'pass'"/>
+ </sequence>
+ </else>
+ </if>
+
+ </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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp.xml
new file mode 100644
index 0000000..3de2e4d
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp.xml
@@ -0,0 +1,123 @@
+<?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/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
+ ! trunk/opends/resource/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 2012 ForgeRock AS.
+ ! -->
+<stax>
+ <defaultcall function="main_snmp" />
+ <function name="main_snmp">
+ <function-list-args>
+ <function-required-arg name="STAXParentID"/>
+ </function-list-args>
+
+ <sequence>
+ <try>
+ <block name="'snmp'">
+ <sequence>
+ <!--- Load the job environment for the test group execution -->
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
+ <call function="'loadJobEnvironment'">
+ { 'parent' : STAXParentID }
+ </call>
+ <script>
+ CurrentTestPath['group']='snmp'
+ _group=CurrentTestPath['group']
+
+ </script>
+ <call function="'testGroup_Preamble'" />
+
+ <script>
+ STOP_RUN = 'False'
+ SNMP_PROPERTIES = {}
+
+ suiteList = []
+ suiteList.append('basic')
+ suiteList.append('traps')
+ suiteList.append('v1')
+ suiteList.append('v2c')
+ suiteList.append('v3')
+
+ </script>
+
+ <!-- SNMP Setup -->
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/testcases/%s/snmp_setup.xml' % (TESTS_DIR,_group)"/>
+ <call function="'main_snmp_setup'" />
+
+ <!-- Run the test suites -->
+ <iterate var="_suite" in="suiteList">
+ <sequence>
+ <try>
+ <sequence>
+
+ <!-- SNMP Test Suites -->
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/testcases/%s/%s/%s_%s.xml' % (TESTS_DIR,_group,_suite,_group,_suite)"/>
+ <call function="'main_%s_%s' % (_group,_suite)" />
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Setup of test suite %s failed.' % _suite</message>
+ </sequence>
+ </catch>
+ <catch exception="'STAFException.TestSuite.MainException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Main part of test suite %s failed.' % _suite</message>
+ </sequence>
+ </catch>
+ <catch exception="'STAFException.TestSuite.CleanupException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Cleanup of test suite %s failed.' % _suite</message>
+ </sequence>
+ </catch>
+ </try>
+ </sequence>
+ </iterate>
+
+ </sequence>
+ </block>
+ <catch exception="'STAXException.TestGroupException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Execution of Test Group Failed'</message>
+ </sequence>
+ </catch>
+ <finally>
+ <sequence>
+ <!-- SNMP Cleanup -->
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/testcases/%s/snmp_cleanup.xml' % (TESTS_DIR,_group)"/>
+ <call function="'main_snmp_cleanup'" />
+
+ <!-- Test Group Postamble -->
+ <call function="'testGroup_Postamble'"/>
+ </sequence>
+ </finally>
+ </try>
+ </sequence>
+ </function>
+</stax>
+
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_cleanup.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_cleanup.xml
new file mode 100644
index 0000000..056966b
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_cleanup.xml
@@ -0,0 +1,79 @@
+<?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.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <defaultcall function="main_snmp_cleanup"/>
+
+ <function name="main_snmp_cleanup">
+
+ <sequence>
+
+ <block name="'snmp_cleanup'">
+
+ <sequence>
+
+ <!--- Test Suite information
+ #@TestSuiteName cleanup
+ #@TestSuitePurpose Cleanup for the snmp test suite.
+ #@TestSuiteGroup cleanup
+ #@TestScript snmp_cleanup.xml
+ -->
+ <script>
+ if not CurrentTestPath.has_key('group'):
+ CurrentTestPath['group'] = 'snmp'
+ CurrentTestPath['suite'] = 'cleanup'
+ </script>
+
+ <try>
+
+ <sequence>
+
+ <call function="'testSuite_Preamble'"/>
+
+ <call function="'common_cleanup'"/>
+
+ </sequence>
+
+ <finally>
+
+ <call function="'testSuite_Postamble'"/>
+
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ </block>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
new file mode 100644
index 0000000..14e6136
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
@@ -0,0 +1,596 @@
+<?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-2010 Sun Microsystems, Inc.
+ ! Portions Copyright 2012 ForgeRock AS
+! -->
+<stax>
+
+ <function name="main_snmp_setup">
+
+ <sequence>
+
+ <block name="'snmp_setup'">
+
+ <try>
+
+ <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'] = 'setup'
+ </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 topology')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'create DS topology as described in config.py.' }
+ </call>
+
+ <call function="'createTopology'">
+ { 'initialiseInstance' : False }
+ </call>
+
+ <call function="'checktestRC'">
+ {
+ 'returncode' : RC ,
+ 'result' : STAXResult
+ }
+ </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>
+
+ <!-- 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 or not PRODUCTNAME.startswith('OpenDJ')">
+ <sequence>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'start DS to run on port %s.' % (DIRECTORY_INSTANCE_PORT) }
+ </call>
+
+ <!--- Start DS -->
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </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>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Add initial entries' }
+ </call>
+
+ <call function="'dsconfigSet'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'objectName' : 'password-policy',
+ 'propertyType' : 'policy',
+ 'propertyName' : 'Default Password Policy',
+ 'attributeName' : 'allow-pre-encoded-passwords',
+ 'attributeValue' : 'true'
+ }
+ </call>
+
+ <call function="'addEntry'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'entryToBeAdded' : '%s/snmp/snmp_start.ldif'
+ % remote.data,
+ 'verbose' : False
+ }
+ </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>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get default SNMP Connection Handler properties' }
+ </call>
+
+ <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>
+
+ </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>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check SNMP Connection Handler is disabled' }
+ </call>
+
+ <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>
+
+ </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>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Enable SNMP Connection Handler' }
+ </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 enabled:true \
+ --set listen-port:%s \
+ --set trap-port:%s \
+ --set opendmk-jarfile:%s' \
+ % (SNMP_PORT, SNMP_TRAP_PORT, opendmkPath)
+ }
+ </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>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Check SNMP Connection Handler is enabled' }
+ </call>
+
+ <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>
+
+ </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>
+
+ <!--- 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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get SNMP Connection Handler properties' }
+ </call>
+
+ <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>
+
+ </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>
+
+ </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>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <script>
+ STOP_RUN = 'True'
+ </script>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Print a warning message' }
+ </call>
+
+ <message log="1" level="'Error'">
+ 'WARNING: Check if SNMP_OPENDMK_LIBDIR is set \
+ in the config.py.stubs file.'
+ </message>
+
+ <tcstatus result="'fail'"></tcstatus>
+
+ </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>
+
+ </sequence>
+ </else>
+ </if>
+
+ </sequence>
+
+ <finally>
+ <call function="'testSuite_Postamble'"/>
+ </finally>
+ </try>
+
+ </block>
+
+ </sequence>
+
+ </function>
+
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps.xml
new file mode 100644
index 0000000..da7e92a
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps.xml
@@ -0,0 +1,148 @@
+<?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/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
+ ! trunk/opends/resource/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 2012 ForgeRock AS.
+ ! -->
+<stax>
+ <defaultcall function="main_snmp_traps"/>
+ <function name="main_snmp_traps" scope="local">
+ <sequence>
+ <block name="'main_snmp_traps'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group']='snmp'
+ CurrentTestPath['suite']='traps'
+
+ __group=CurrentTestPath['group']
+ __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+ </script>
+
+ <!--- Test Suite information
+ #@TestSuiteName SNMP default properties test suite
+ #@TestSuitePurpose Verify SNMP default properties
+ #@TestSuiteID traps
+ #@TestSuiteGroup snmp
+ #@TestGroup snmp
+ #@TestScript snmp.xml
+ #@TestHTMLLink http://www.forgerock.org/
+ -->
+ <call function="'testSuite_Preamble'"/>
+
+ <try>
+ <sequence>
+
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('traps/snmp_traps_defaultconf_tests')
+ importList.append('traps/snmp_traps_customconf_tests')
+ </script>
+
+ <!-- Import the files for this test suite -->
+ <iterate var="__import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (__groupdir,__import)"/>
+ </iterate>
+
+ <!-- Specific to traps SNMP tests -->
+ <script>
+ # Default
+ trapsCommunity = '%s' % SNMP_PROPERTIES['traps-community']
+ outputFile = '%s/timer.out' % DIRECTORY_INSTANCE_DIR
+ timerDuration = '5m'
+
+ # Custom
+ defTrapsCommunityProp = '%s' % SNMP_PROPERTIES['traps-community']
+ newTrapsCommunityProp = 'myCommunity'
+ newTrapsDestProp = DIRECTORY_INSTANCE_HOST
+ wrongTrapsDestProp = 'wrongtrapdestination'
+ outputFile2 = '%s/timer.out' % DIRECTORY_INSTANCE_DIR
+ timerDuration2 = '5m'
+ serverLogFile = '%s/%s/logs/server.out' \
+ % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('snmp_traps_default_001')
+ testsList.append('snmp_traps_default_002')
+ testsList.append('snmp_traps_default_003')
+ testsList.append('snmp_traps_custom_001')
+ testsList.append('snmp_traps_custom_002')
+ testsList.append('snmp_traps_custom_003')
+ testsList.append('snmp_traps_custom_004')
+ testsList.append('snmp_traps_custom_005')
+ </script>
+
+ <!-- Execute the Tests -->
+ <iterate var="__test" in="testsList">
+ <sequence>
+ <call function="'%s' % (__test)" />
+ </sequence>
+ </iterate>
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">
+ 'Setup of test suite failed.'
+ </message>
+ <rethrow/>
+ </sequence>
+ </catch>
+
+ <finally>
+ <message>'Test Cases Completed.'</message>
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ <finally>
+ <sequence>
+ <!-- Test Suite Cleanup -->
+ <message>'Finally: Global Schema Cleanup.'</message>
+ <try>
+ <message>'No Test Suite Cleanup'</message>
+ <catch exception="'STAFException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
+ </sequence>
+ </catch>
+ <finally>
+ <call function="'testSuite_Postamble'"/>
+ </finally>
+ </try>
+ </sequence>
+ </finally>
+
+ </try>
+ </block>
+ </sequence>
+ </function>
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_customconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_customconf_tests.xml
new file mode 100644
index 0000000..a01c4f6
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_customconf_tests.xml
@@ -0,0 +1,974 @@
+<?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-2010 Sun Microsystems, Inc.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP traps with custom configuration
+ #@TestName traps_customconf: TODO
+ #@TestIssue 3435
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_traps_custom_001" scope="local">
+ <testcase name="getTestCaseName('Change the community property')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <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 traps-community:%s' \
+ % newTrapsCommunityProp
+ }
+ </call>
+
+ <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>
+
+ <timer duration="timerDuration2">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : defTrapsCommunityProp ,
+ 'snmpTrapNumber' : '0,2,0,0,0,0' ,
+ 'outputFile' : outputFile2 ,
+ 'knownIssue' : '3435'
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart the server' }
+ </call>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC2 = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
+
+ <timer duration="timerDuration2">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : newTrapsCommunityProp ,
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile2 ,
+ 'knownIssue' : '3435'
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart the server' }
+ </call>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC2 = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the traps-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 traps-community:%s' \
+ % defTrapsCommunityProp
+ }
+ </call>
+
+ <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 traps with custom configuration
+ #@TestName traps_customconf: TODO
+ #@TestIssue 3435
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_traps_custom_002" scope="local">
+ <testcase name="getTestCaseName('Set traps-destination property to correct value')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Change the traps-destination 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 traps-destination:%s' \
+ % newTrapsDestProp
+ }
+ </call>
+
+ <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>
+
+ <timer duration="timerDuration2">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : defTrapsCommunityProp ,
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile2 ,
+ 'knownIssue' : '3435'
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart the server' }
+ </call>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC2 = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the traps-destination 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' : '--reset traps-destination'
+ }
+ </call>
+
+ <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 traps with custom configuration
+ #@TestName traps_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_traps_custom_003" scope="local">
+ <testcase name="getTestCaseName('Set traps-destination property to a wrong value')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Change the traps-destination 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 traps-destination:%s' \
+ % wrongTrapsDestProp
+ }
+ </call>
+
+ <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>
+
+ <timer duration="timerDuration2">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : defTrapsCommunityProp ,
+ 'snmpTrapNumber' : '0,0,0,0,0,0' ,
+ 'outputFile' : outputFile2
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart the server' }
+ </call>
+
+ <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 = 'Traps Destination %s is an unknown host.' \
+ % wrongTrapsDestProp
+ msg2 = 'Traps will not be sent to this destination'
+ msg = '%s %s' % (msg1, msg2)
+ </script>
+
+ <call function="'grep'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'filename' : serverLogFile ,
+ 'testString': msg
+ }
+ </call>
+
+ <script>
+ msg1 = 'No valid trap destinations has been found.'
+ msg2 = 'No trap will be sent'
+ msg = '%s %s' % (msg1, msg2)
+ </script>
+
+ <call function="'grep'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'filename' : serverLogFile ,
+ 'testString': msg
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC2 = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the traps-destination 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' : '--reset traps-destination'
+ }
+ </call>
+
+ <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 traps with custom configuration
+ #@TestName traps_customconf: TODO
+ #@TestIssue 3435
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_traps_custom_004" scope="local">
+ <testcase name="getTestCaseName('Set traps-destination property to a list')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set traps-destination 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 traps-destination:%s' \
+ % wrongTrapsDestProp
+ }
+ </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 traps-destination:%s' \
+ % newTrapsDestProp
+ }
+ </call>
+
+ <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>
+
+ <timer duration="timerDuration2">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : defTrapsCommunityProp ,
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile2 ,
+ 'knownIssue' : '3435'
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart the server' }
+ </call>
+
+ <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 = 'Traps Destination %s is an unknown host.' \
+ % wrongTrapsDestProp
+ msg2 = 'Traps will not be sent to this destination'
+ msg = '%s %s' % (msg1, msg2)
+ </script>
+
+ <call function="'grep'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'filename' : serverLogFile ,
+ 'testString': msg
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC2 = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile2 ,
+ 'timerDuration' : timerDuration2 ,
+ 'timerRC' : timerRC2
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the traps-destination 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' : '--reset traps-destination'
+ }
+ </call>
+
+ <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 traps with custom configuration
+ #@TestName traps_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_traps_custom_005" scope="local">
+ <testcase name="getTestCaseName('Set the traps-community property to a list')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the traps-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 traps-community:%s' \
+ % newTrapsCommunityProp ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+
+ returnString = STAXResult[0][1]
+ msg1 = 'It is not possible to specify multiple values for the'
+ msg2 = 'SNMP Connection Handler%sproperty "traps-community"' \
+ % newLine
+ msg3 = 'as it is single-valued'
+ msg = '%s %s %s' % (msg1, msg2, msg3)
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_defaultconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_defaultconf_tests.xml
new file mode 100644
index 0000000..5da877a
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/traps/snmp_traps_defaultconf_tests.xml
@@ -0,0 +1,403 @@
+<?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-2010 Sun Microsystems, Inc.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP traps with default configuration
+ #@TestName traps_defaultconf: traps on stop-ds
+ #@TestIssue 3435
+ #@TestPurpose Check that a trap is sent on default trap
+ community after stop-ds command.
+ #@TestPreamble none
+ #@TestStep Run the trap listener, it send an event to
+ notify that it is ready.
+ #@TestStep When this event is received, stop-ds command
+ is executed and a another event is sent to
+ notify that the command is completed.
+ #@TestStep The trap listener catches this event and send
+ a result.
+ #@TestPostamble none
+ #@TestResult Success if SNMPTrapListener returns 0.
+ -->
+ <function name="snmp_traps_default_001" scope="local">
+ <testcase name="getTestCaseName('Trap on stop-ds')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <timer duration="timerDuration">
+ <sequence>
+ <parallel>
+ <sequence>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : trapsCommunity ,
+ 'snmpTrapNumber' : '1,0,0,0,0,0' ,
+ 'outputFile' : outputFile ,
+ 'knownIssue' : '3435'
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Stop the server' }
+ </call>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile ,
+ 'timerDuration' : timerDuration ,
+ 'timerRC' : timerRC
+ }
+ </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 traps with default configuration
+ #@TestName traps_defaultconf: trap on start-ds
+ #@TestIssue none
+ #@TestPurpose Check that a trap is sent on default trap
+ community after start-ds command.
+ #@TestPreamble none
+ #@TestStep Run the trap listener, it send an event to
+ notify that it is ready.
+ #@TestStep When this event is received, start-ds command
+ is executed and a another event is sent to
+ notify that the command is completed.
+ #@TestStep The trap listener catches this event and send
+ a result.
+ #@TestPostamble none
+ #@TestResult Success if SNMPTrapListener returns 0.
+ -->
+ <function name="snmp_traps_default_002" scope="local">
+ <testcase name="getTestCaseName('Trap on start-ds')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <timer duration="timerDuration">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : trapsCommunity ,
+ 'snmpTrapNumber' : '1,0,0,0,0,0' ,
+ 'outputFile' : outputFile
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Start the server' }
+ </call>
+
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile ,
+ 'timerDuration' : timerDuration ,
+ 'timerRC' : timerRC
+ }
+ </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 traps with default configuration
+ #@TestName traps_defaultconf: trap on stop-ds -R
+ #@TestIssue 3435
+ #@TestPurpose Check that 2 traps are sent on default trap
+ community after stop-ds -R command.
+ #@TestPreamble none
+ #@TestStep Run the trap listener, it send an event to
+ notify that it is ready.
+ #@TestStep When this event is received, stop-ds -R
+ command is executed and a another event is
+ sent to notify that the command is completed.
+ #@TestStep The trap listener catches this event and send
+ a result.
+ #@TestPostamble none
+ #@TestResult Success if SNMPTrapListener returns 0.
+ -->
+ <function name="snmp_traps_default_003" scope="local">
+ <testcase name="getTestCaseName('Trap on stop-ds -R')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <timer duration="timerDuration">
+ <sequence>
+ <parallel>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Run the trap listener' }
+ </call>
+
+ <call function="'SNMPTrapListener'">
+ {
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpTrapPort' : SNMP_TRAP_PORT ,
+ 'snmpTrapCommunity' : trapsCommunity ,
+ 'snmpTrapNumber' : '2,0,0,0,0,0' ,
+ 'outputFile' : outputFile ,
+ 'knownIssue' : '3435'
+ }
+ </call>
+ </sequence>
+ <sequence>
+ <call function="'testStep'">
+ { 'stepMessage' : 'Wait event from the trap listener' }
+ </call>
+
+ <call function="'WaitEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Delete event from the trap listener' }
+ </call>
+ <call function="'DeleteEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SNMPTrapListener/Ready'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restart the server' }
+ </call>
+
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ {
+ 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Send event to the trap listener' }
+ </call>
+
+ <call function="'SendEvent'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'name' : 'SendTrap/Complete'
+ }
+ </call>
+ </sequence>
+ </parallel>
+ </sequence>
+ </timer>
+
+ <script>timerRC = RC</script>
+
+ <call function="'checkTimerResult'">
+ {
+ 'location' : STAF_REMOTE_HOSTNAME ,
+ 'outputFile' : outputFile ,
+ 'timerDuration' : timerDuration ,
+ 'timerRC' : timerRC
+ }
+ </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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1.xml
new file mode 100644
index 0000000..9fa824a
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1.xml
@@ -0,0 +1,149 @@
+<?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/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
+ ! trunk/opends/resource/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 2012 ForgeRock AS.
+ ! -->
+<stax>
+ <defaultcall function="main_snmp_v1"/>
+ <function name="main_snmp_v1" scope="local">
+ <sequence>
+ <block name="'main_snmp_v1'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group']='snmp'
+ CurrentTestPath['suite']='v1'
+
+ __group=CurrentTestPath['group']
+ __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+ </script>
+
+ <!--- Test Suite information
+ #@TestSuiteName SNMP default properties test suite
+ #@TestSuitePurpose Verify SNMP default properties
+ #@TestSuiteID v1
+ #@TestSuiteGroup snmp
+ #@TestGroup snmp
+ #@TestScript snmp.xml
+ #@TestHTMLLink http://www.forgerock.org/
+ -->
+ <call function="'testSuite_Preamble'"/>
+
+ <try>
+ <sequence>
+
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('v1/snmp_v1_defaultconf_tests')
+ importList.append('v1/snmp_v1_customconf_tests')
+ </script>
+
+ <!-- Import the files for this test suite -->
+ <iterate var="__import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (__groupdir,__import)"/>
+ </iterate>
+
+ <!-- Specific to v1 SNMP tests -->
+ <script>
+ # Default
+ community = '%s@%s' \
+ % (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
+ oid = 'dsServerType.1'
+
+ # Custom
+ defCommunityProp = SNMP_PROPERTIES['community']
+ defCommunity = '%s@%s' %(defCommunityProp, defCommunityProp)
+ defManagerProp = SNMP_PROPERTIES['allowed-manager']
+ newCommunityProp = 'myCommunity'
+ newCommunity = '%s@%s' %(newCommunityProp, newCommunityProp)
+ newManagerProp = DIRECTORY_INSTANCE_HOST
+ wrongManagerProp = 'myManager'
+ oid = 'dsServerType.1'
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('snmp_v1_default_001')
+ testsList.append('snmp_v1_default_002')
+ testsList.append('snmp_v1_default_003')
+ testsList.append('snmp_v1_default_004')
+ testsList.append('snmp_v1_custom_001')
+ testsList.append('snmp_v1_custom_002')
+ testsList.append('snmp_v1_custom_003')
+ testsList.append('snmp_v1_custom_004')
+ testsList.append('snmp_v1_custom_005')
+ </script>
+
+ <!-- Execute the Tests -->
+ <iterate var="__test" in="testsList">
+ <sequence>
+ <call function="'%s' % (__test)" />
+ </sequence>
+ </iterate>
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">
+ 'Setup of test suite failed.'
+ </message>
+ <rethrow/>
+ </sequence>
+ </catch>
+
+ <finally>
+ <message>'Test Cases Completed.'</message>
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ <finally>
+ <sequence>
+ <!-- Test Suite Cleanup -->
+ <message>'Finally: Global Schema Cleanup.'</message>
+ <try>
+ <message>'No Test Suite Cleanup'</message>
+ <catch exception="'STAFException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
+ </sequence>
+ </catch>
+ <finally>
+ <call function="'testSuite_Postamble'"/>
+ </finally>
+ </try>
+ </sequence>
+ </finally>
+
+ </try>
+ </block>
+ </sequence>
+ </function>
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_customconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_customconf_tests.xml
new file mode 100644
index 0000000..cf015e8
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_customconf_tests.xml
@@ -0,0 +1,695 @@
+<?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-2009 Sun Microsystems, Inc.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP v1 with custom configuration
+ #@TestName v1_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v1_custom_001" scope="local">
+ <testcase name="getTestCaseName('v1 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' : '1',
+ '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' : '1',
+ '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 v1 with custom configuration
+ #@TestName v1_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v1_custom_002" scope="local">
+ <testcase name="getTestCaseName('v1 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 with the new community -->
+ <call function="'testStep'">
+ { 'stepMessage' : 'SNMPGet with the new community.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : defCommunity ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <!-- @Step4: 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 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 v1 with custom configuration
+ #@TestName v1_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v1_custom_003" scope="local">
+ <testcase name="getTestCaseName('v1 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 with the old community -->
+ <call function="'testStep'">
+ { 'stepMessage' : 'SNMPGet with the old community.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : defCommunity ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noSuchName'
+ }
+ </call>
+
+ <!-- @Step4: 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 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 v1 with custom configuration
+ #@TestName v1_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v1_custom_004" scope="local">
+ <testcase name="getTestCaseName('v1 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 a not allowed manager -->
+ <call function="'testStep'">
+ { 'stepMessage' : 'SNMPGet from a not allowed manager.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : defCommunity ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <!-- @Step4: 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 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 v1 with custom configuration
+ #@TestName v1_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v1_custom_005" scope="local">
+ <testcase name="getTestCaseName('v1 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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_defaultconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_defaultconf_tests.xml
new file mode 100644
index 0000000..3c61e90
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v1/snmp_v1_defaultconf_tests.xml
@@ -0,0 +1,235 @@
+<?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.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP v1 with default configuration
+ #@TestName v1_defaultconf: get with default community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with default
+ community succeeds.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v1_default_001" scope="local">
+ <testcase name="getTestCaseName('v1 get with default commnunity')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with default community.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </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 v1 with default configuration
+ #@TestName v1_defaultconf: get with wrong community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with wrong
+ community fails with noSuchName.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v1_default_002" scope="local">
+ <testcase name="getTestCaseName('v1 get with wrong community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with wrong community.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : 'OpenDS' ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noSuchName'
+ }
+ </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 v1 with default configuration
+ #@TestName v1_defaultconf: set with default community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with default
+ community fails with noSuchName.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v1_default_003" scope="local">
+ <testcase name="getTestCaseName('v1 set with default community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with default community.' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noSuchName'
+ }
+ </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 v1 with default configuration
+ #@TestName v1_defaultconf: set with wrong community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with wrong
+ community fails with noSuchName.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v1_default_004" scope="local">
+ <testcase name="getTestCaseName('v1 set with wrong community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with wrong community.' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '1',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : 'OpenDS' ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noSuchName'
+ }
+ </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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c.xml
new file mode 100644
index 0000000..7435d47
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c.xml
@@ -0,0 +1,149 @@
+<?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/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
+ ! trunk/opends/resource/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 2012 ForgeRock AS.
+ ! -->
+<stax>
+ <defaultcall function="main_snmp_v2c"/>
+ <function name="main_snmp_v2c" scope="local">
+ <sequence>
+ <block name="'main_snmp_v2c'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group']='snmp'
+ CurrentTestPath['suite']='v2c'
+
+ __group=CurrentTestPath['group']
+ __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+ </script>
+
+ <!--- Test Suite information
+ #@TestSuiteName SNMP default properties test suite
+ #@TestSuitePurpose Verify SNMP default properties
+ #@TestSuiteID v2c
+ #@TestSuiteGroup snmp
+ #@TestGroup snmp
+ #@TestScript snmp.xml
+ #@TestHTMLLink http://www.forgerock.org/
+ -->
+ <call function="'testSuite_Preamble'"/>
+
+ <try>
+ <sequence>
+
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('v2c/snmp_v2c_defaultconf_tests')
+ importList.append('v2c/snmp_v2c_customconf_tests')
+ </script>
+
+ <!-- Import the files for this test suite -->
+ <iterate var="__import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (__groupdir,__import)"/>
+ </iterate>
+
+ <!-- Specific to v2c SNMP tests -->
+ <script>
+ # Default
+ community = '%s@%s' \
+ % (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
+ oid = 'dsServerType.1'
+
+ # Custom
+ defCommunityProp = SNMP_PROPERTIES['community']
+ defCommunity = '%s@%s' %(defCommunityProp, defCommunityProp)
+ defManagerProp = SNMP_PROPERTIES['allowed-manager']
+ newCommunityProp = 'myCommunity'
+ newCommunity = '%s@%s' %(newCommunityProp, newCommunityProp)
+ newManagerProp = DIRECTORY_INSTANCE_HOST
+ wrongManagerProp = 'myManager'
+ oid = 'dsServerType.1'
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('snmp_v2c_default_001')
+ testsList.append('snmp_v2c_default_002')
+ testsList.append('snmp_v2c_default_003')
+ testsList.append('snmp_v2c_default_004')
+ testsList.append('snmp_v2c_custom_001')
+ testsList.append('snmp_v2c_custom_002')
+ testsList.append('snmp_v2c_custom_003')
+ testsList.append('snmp_v2c_custom_004')
+ testsList.append('snmp_v2c_custom_005')
+ </script>
+
+ <!-- Execute the Tests -->
+ <iterate var="__test" in="testsList">
+ <sequence>
+ <call function="'%s' % (__test)" />
+ </sequence>
+ </iterate>
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">
+ 'Setup of test suite failed.'
+ </message>
+ <rethrow/>
+ </sequence>
+ </catch>
+
+ <finally>
+ <message>'Test Cases Completed.'</message>
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ <finally>
+ <sequence>
+ <!-- Test Suite Cleanup -->
+ <message>'Finally: Global Schema Cleanup.'</message>
+ <try>
+ <message>'No Test Suite Cleanup'</message>
+ <catch exception="'STAFException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
+ </sequence>
+ </catch>
+ <finally>
+ <call function="'testSuite_Postamble'"/>
+ </finally>
+ </try>
+ </sequence>
+ </finally>
+
+ </try>
+ </block>
+ </sequence>
+ </function>
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_customconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_customconf_tests.xml
new file mode 100644
index 0000000..2f2b053
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_customconf_tests.xml
@@ -0,0 +1,695 @@
+<?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-2009 Sun Microsystems, Inc.
+ ! Portions Copyright 2012 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 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' : defCommunity ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <!-- @Step4: 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 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 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' : 'authorizationError'
+ }
+ </call>
+
+ <!-- @Step4: 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 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 a not allowed manager -->
+ <call function="'testStep'">
+ { 'stepMessage' : 'SNMPGet from a not allowed manager.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '2',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : defCommunity ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <!-- @Step4: 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 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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_defaultconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_defaultconf_tests.xml
new file mode 100644
index 0000000..9d8550d
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v2c/snmp_v2c_defaultconf_tests.xml
@@ -0,0 +1,236 @@
+<?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.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP v2c with default configuration
+ #@TestName v2c_defaultconf: get with default community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with default
+ community succeeds.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v2c_default_001" scope="local">
+ <testcase name="getTestCaseName('v2c get with default community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with default community.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '2',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </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 default configuration
+ #@TestName v2c_defaultconf: get with wrong community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with wrong
+ community fails with noSuchName.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v2c_default_002" scope="local">
+ <testcase name="getTestCaseName('v2c get with wrong community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with wrong community.' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '2',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : 'OpenDS' ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpValidOIDs' : 'False'
+ }
+ </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 default configuration
+ #@TestName v2c_defaultconf: set with default community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with default
+ community fails with noSuchName.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v2c_default_003" scope="local">
+ <testcase name="getTestCaseName('v2c set with default community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with default community.' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '2',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : community ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </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 default configuration
+ #@TestName v2c_defaultconf: set with wrong community
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with wrong
+ community fails with noSuchName.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v2c_default_004" scope="local">
+ <testcase name="getTestCaseName('v2c set with wrong community')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with wrong community.' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '2',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpCommunity' : 'OpenDS' ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noAccess'
+ }
+ </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>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml
new file mode 100644
index 0000000..edcd002
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml
@@ -0,0 +1,167 @@
+<?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/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
+ ! trunk/opends/resource/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 2012 ForgeRock AS.
+ ! -->
+<stax>
+ <defaultcall function="main_snmp_v3"/>
+ <function name="main_snmp_v3" scope="local">
+ <sequence>
+ <block name="'main_snmp_v3'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group']='snmp'
+ CurrentTestPath['suite']='v3'
+
+ __group=CurrentTestPath['group']
+ __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+ </script>
+
+ <!--- Test Suite information
+ #@TestSuiteName SNMP v3 with default configuration
+ #@TestSuitePurpose Check SNMP v3 with default configuration.
+ #@TestSuiteGroup SNMP v3 with default configuration
+ #@TestScript snmp_v3.xml
+ #@TestHTMLLink http://www.forgerock.org/
+ -->
+ <call function="'testSuite_Preamble'"/>
+
+ <try>
+ <sequence>
+
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('v3/snmp_v3_defaultconf_tests')
+ importList.append('v3/snmp_v3_customconf_tests')
+ </script>
+
+ <!-- Import the files for this test suite -->
+ <iterate var="__import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (__groupdir,__import)"/>
+ </iterate>
+
+ <!-- Specific to v3 SNMP tests -->
+ <script>
+ # Default
+ securityFile = '%s/snmp/manager.security' % remote.data
+ securityLevel = SNMP_PROPERTIES['security-level']
+ context = SNMP_PROPERTIES['community']
+ oid = 'dsServerType.1'
+
+ # Custom
+ defContextProp = SNMP_PROPERTIES['community']
+ defUserProp = SNMP_PROPERTIES['allowed-user']
+ defSecurityFileProp = SNMP_PROPERTIES['security-agent-file']
+ defSecurityLevelProp = SNMP_PROPERTIES['security-level']
+ newContextProp = 'myContext'
+ newSecurityFileProp = '%s/snmp/agent.security' % remote.data
+ lowUser = 'myUser1'
+ defUser = 'myUser2'
+ highUser = 'myUser3'
+ otherUser = 'myUser4'
+ lowSecurityLevelProp = 'noauthnopriv'
+ highSecurityLevelProp = 'authpriv'
+ wrongSecurityLevelProp = 'mySecurityLevel'
+ mySecurityFile = '%s/snmp/manager.security' % remote.data
+ oid = 'dsServerType.1'
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('snmp_v3_default_001')
+ testsList.append('snmp_v3_default_002')
+ testsList.append('snmp_v3_default_003')
+ testsList.append('snmp_v3_default_004')
+ testsList.append('snmp_v3_default_005')
+ testsList.append('snmp_v3_default_006')
+ testsList.append('snmp_v3_default_007')
+ testsList.append('snmp_v3_default_008')
+ testsList.append('snmp_v3_default_009')
+ testsList.append('snmp_v3_default_010')
+ testsList.append('snmp_v3_default_011')
+ testsList.append('snmp_v3_default_012')
+ testsList.append('snmp_v3_custom_001')
+ testsList.append('snmp_v3_custom_002')
+ testsList.append('snmp_v3_custom_003')
+ testsList.append('snmp_v3_custom_004')
+ testsList.append('snmp_v3_custom_005')
+ testsList.append('snmp_v3_custom_006')
+ testsList.append('snmp_v3_custom_007')
+ testsList.append('snmp_v3_custom_008')
+ testsList.append('snmp_v3_custom_009')
+ </script>
+
+ <!-- Execute the Tests -->
+ <iterate var="__test" in="testsList">
+ <sequence>
+ <call function="'%s' % (__test)" />
+ </sequence>
+ </iterate>
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">
+ 'Setup of test suite failed.'
+ </message>
+ <rethrow/>
+ </sequence>
+ </catch>
+
+ <finally>
+ <message>'Test Cases Completed.'</message>
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ <finally>
+ <sequence>
+ <!-- Test Suite Cleanup -->
+ <message>'Finally: Global SNMP Cleanup.'</message>
+ <try>
+ <message>'No Test Suite Cleanup'</message>
+ <catch exception="'STAFException'">
+ <sequence>
+ <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
+ </sequence>
+ </catch>
+ <finally>
+ <call function="'testSuite_Postamble'"/>
+ </finally>
+ </try>
+ </sequence>
+ </finally>
+
+ </try>
+ </block>
+ </sequence>
+ </function>
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_customconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_customconf_tests.xml
new file mode 100644
index 0000000..01deb8e
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_customconf_tests.xml
@@ -0,0 +1,1004 @@
+<?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.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_001" scope="local">
+ <testcase name="getTestCaseName('v3 change the security-agent-file property')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Change the security-agent-file 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 security-agent-file:%s' \
+ % newSecurityFileProp
+ }
+ </call>
+
+ <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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_002" scope="local">
+ <testcase name="getTestCaseName('v3 check the current security level (def)')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the lowUser and low security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : lowUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : lowSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the defUser and def security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : defUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the highUser and high security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : highUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : highSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_003" scope="local">
+ <testcase name="getTestCaseName('v3 change the context property')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Change the context 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' % newContextProp
+ }
+ </call>
+
+ <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>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the old context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : defUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'reqTimeout'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : otherUser ,
+ 'snmpCommunity' : newContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the context 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' % defContextProp
+ }
+ </call>
+
+ <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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_004" scope="local">
+ <testcase name="getTestCaseName('v3 set the allowed-user property to a list')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the allowed-user 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-user:%s' % defUser
+ }
+ </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-user:%s' % otherUser
+ }
+ </call>
+
+ <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>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser community' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : defUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser2 community' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : otherUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the allowed-user 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-user:%s' % defUserProp
+ }
+ </call>
+
+ <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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_005" scope="local">
+ <testcase name="getTestCaseName('v3 set the allowed-user property to otherUser')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the allowed-user property to otherUser' }
+ </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-user:%s' % otherUser
+ }
+ </call>
+
+ <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>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the defUser' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : defUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the otherUser' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : otherUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the security-agent-file 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-user:%s' % defUserProp
+ }
+ </call>
+
+ <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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_006" scope="local">
+ <testcase name="getTestCaseName('v3 set the security-level property to low')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the security-level property to low' }
+ </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 security-level:%s' \
+ % lowSecurityLevelProp
+ }
+ </call>
+
+ <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>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser1 and low security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : lowUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : lowSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser2 and med security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : defUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser3 and high security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : highUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : highSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the security-level 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 security-level:%s' \
+ % defSecurityLevelProp
+ }
+ </call>
+
+ <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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_007" scope="local">
+ <testcase name="getTestCaseName('v3 set the security-level property to high')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the security-level property to high' }
+ </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 security-level:%s' \
+ % highSecurityLevelProp
+ }
+ </call>
+
+ <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>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser1 and low security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : lowUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : lowSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser2 and med security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : defUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : defSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with the myUser3 and high security level' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : highUser ,
+ 'snmpCommunity' : defContextProp ,
+ 'snmpSecurityLevel' : highSecurityLevelProp ,
+ 'snmpSecurityFile' : mySecurityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError'
+ }
+ </call>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the security-level 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 security-level:%s' \
+ % defSecurityLevelProp
+ }
+ </call>
+
+ <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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_008" scope="local">
+ <testcase name="getTestCaseName('v3 set the security-level property to wrong')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set the security-level property to wrong' }
+ </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 security-level:%s' \
+ % wrongSecurityLevelProp ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ msg1 = 'The value "%s" is not a valid value for the' \
+ % wrongSecurityLevelProp
+ msg2 = 'SNMP Connection Handler property "security-level"'
+ msg3 = 'which has the following syntax:'
+ msg4 = 'authnopriv | authpriv | noauthnopriv'
+ msg = '%s %s %s %s' % (msg1, msg2, msg3, msg4)
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : msg
+ }
+ </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 v3 with custom configuration
+ #@TestName v3_customconf: TODO
+ #@TestIssue none
+ #@TestPurpose TODO.
+ #@TestPreamble none
+ #@TestStep TODO.
+ #@TestPostamble none
+ #@TestResult TODO.
+ -->
+ <function name="snmp_v3_custom_009" scope="local">
+ <testcase name="getTestCaseName('v3 restore the security-agent-file property')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Restore the security-agent-file 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 security-agent-file:%s' \
+ % defSecurityFileProp
+ }
+ </call>
+
+ <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>
+
+</stax>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_defaultconf_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_defaultconf_tests.xml
new file mode 100644
index 0000000..7f1156f
--- /dev/null
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3_defaultconf_tests.xml
@@ -0,0 +1,703 @@
+<?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.
+ ! Portions Copyright 2012 ForgeRock AS
+ ! -->
+<stax>
+
+ <!--- Test Case information
+ #@TestMarker SNMP v3 with default configuration
+ #@TestName v3_defaultconf: get with snmpAdmin user
+ and default context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with snmpAdmin
+ user and default context fails with
+ authorizationError.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v3_default_001" scope="local">
+ <testcase name="getTestCaseName('v3 get with snmpAdmin and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with snmpAdmin and default context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'snmpAdmin' ,
+ 'snmpCommunity' : context ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: get with snmpAdmin user
+ and null context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with snmpAdmin
+ user and null context succeeds but the OIDs
+ values are not correct.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v3_default_002" scope="local">
+ <testcase name="getTestCaseName('v3 get with snmpAdmin and null context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with snmpAdmin and null context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'snmpAdmin' ,
+ 'snmpCommunity' : 'null' ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpValidOIDs' : 'False'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: det with snmpAdmin user
+ and OpenDS context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with snmpAdmin
+ user and default context fails with
+ authorizationError.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v3_default_003" scope="local">
+ <testcase name="getTestCaseName('v3 set with snmpAdmin and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with snmpAdmin and default context' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'snmpAdmin' ,
+ 'snmpCommunity' : context ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: set with snmpAdmin user
+ and null context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with snmpAdmin
+ user and null context fails with noAccess.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v3_default_004" scope="local">
+ <testcase name="getTestCaseName('v3 set with snmpAdmin and null context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with snmpAdmin and null context' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'snmpAdmin' ,
+ 'snmpCommunity' : 'null' ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noAccess'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: get with defaultUser user
+ and default context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with defaultUser
+ user and default context fails with
+ authorizationError.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v3_default_005" scope="local">
+ <testcase name="getTestCaseName('v3 get with defaultUser and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with defaultUser and default context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'defaultUser' ,
+ 'snmpCommunity' : context ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: get with defaultUser user
+ and null context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with defaultUser
+ user and null context succeeds but the OIDs
+ values are not correct.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v3_default_006" scope="local">
+ <testcase name="getTestCaseName('v3 get with defaultUser and null context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with defaultUser and null context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'defaultUser' ,
+ 'snmpCommunity' : 'null' ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noError' ,
+ 'snmpValidOIDs' : 'False'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: set with defaultUser user
+ and default context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with defaultUser
+ user and default context fails with
+ authorizationError.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v3_default_007" scope="local">
+ <testcase name="getTestCaseName('v3 set with defaultUser and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with defaultUser and default context' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'defaultUser' ,
+ 'snmpCommunity' : context ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'authorizationError'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: set with defaultUser user
+ and null context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with defaultUser
+ user and null context fails with noAccess.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v3_default_008" scope="local">
+ <testcase name="getTestCaseName('v3 set with defaultUser and null context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with defaultUser and null context' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'defaultUser' ,
+ 'snmpCommunity' : 'null' ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'noAccess'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: get with unknown user
+ and default context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with unknown
+ user and default context fails with
+ SnmpStatusException.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v3_default_009" scope="local">
+ <testcase name="getTestCaseName('v3 get with unknown user and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with unknown user and default context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'myUser' ,
+ 'snmpCommunity' : context ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'SnmpStatusException'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: get with unknown user
+ and null context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Get request with unknown
+ user and null context fails with
+ SnmpStatusException.
+ #@TestPreamble none
+ #@TestStep SNMP Get request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPGet returns 0.
+ -->
+ <function name="snmp_v3_default_010" scope="local">
+ <testcase name="getTestCaseName('v3 get with unknown user and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Get with unknown user and default context' }
+ </call>
+
+ <call function="'SNMPGet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'myUser' ,
+ 'snmpCommunity' : 'null' ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'SnmpStatusException'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: set with unknown user
+ and default context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with unknown
+ user and default context fails with
+ SnmpStatusException.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v3_default_011" scope="local">
+ <testcase name="getTestCaseName('v3 set with unknown user and default context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with unknown user and OpenDS context' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'myUser' ,
+ 'snmpCommunity' : context ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'SnmpStatusException'
+ }
+ </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 v3 with default configuration
+ #@TestName v3_defaultconf: set with unknown user
+ and null context
+ #@TestIssue none
+ #@TestPurpose Check that a SNMP Set request with unknown
+ user and default context fails with
+ SnmpStatusException.
+ #@TestPreamble none
+ #@TestStep SNMP Set request.
+ #@TestPostamble none
+ #@TestResult Success if SNMPSet returns 0.
+ -->
+ <function name="snmp_v3_default_012" scope="local">
+ <testcase name="getTestCaseName('v3 set with unknown user and null context')">
+ <sequence>
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <call function="'testStep'">
+ { 'stepMessage' : 'Set with unknown user and null context' }
+ </call>
+
+ <call function="'SNMPSet'">
+ {
+ 'snmpVersion' : '3',
+ 'snmpHost' : DIRECTORY_INSTANCE_HOST ,
+ 'snmpPort' : SNMP_PORT ,
+ 'snmpUser' : 'myUser' ,
+ 'snmpCommunity' : 'null' ,
+ 'snmpSecurityLevel' : securityLevel ,
+ 'snmpSecurityFile' : securityFile ,
+ 'snmpOIDs' : oid ,
+ 'snmpStatus' : 'SnmpStatusException'
+ }
+ </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>
diff --git a/opends/tests/staf-tests/shared/functions/utils.xml b/opends/tests/staf-tests/shared/functions/utils.xml
index 402fb48..633cc93 100755
--- a/opends/tests/staf-tests/shared/functions/utils.xml
+++ b/opends/tests/staf-tests/shared/functions/utils.xml
@@ -190,15 +190,16 @@
<script>
try:
- if issueId.__class__ is org.python.core.PyList:
+ from org.python.core import PyList
+ if issueId.__class__ is PyList:
for issue in issueId:
if issue not in issuesList:
issuesList.append(issue)
else:
if issueId not in issuesList:
issuesList.append(issueId)
- except:
- print 'Issues list undefined. Unable to add issue %s' % issueId
+ except Exception,e:
+ print 'Issues list undefined. Unable to add issue %s. Reason=%s' % (issueId,e)
</script>
<message log="1" level="'Error'">
'ERROR: HIT **** Known Issue (%s) ****' % issueId
--
Gitblit v1.10.0