mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Christophe Sovant
31.40.2008 4d87ca40c579ec1ad32723c30086bc3f284bec93
Add new testsuites for SNMP feature
8 files added
1 files modified
4754 ■■■■■ changed files
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp.xml 10 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_defaultproperties.xml 127 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_mibvalues.xml 637 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_registermbean.xml 250 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_status.xml 720 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml 946 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_v1_customconf.xml 546 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_v2c_customconf.xml 546 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_v3_customconf.xml 972 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp.xml
@@ -39,7 +39,7 @@
          <!--- Test Group information
            #@TestGroupName          SNMP tests
            #@TestGroupPurpose       Test the tools commands.
            #@TestGroupPurpose       Test the SNMP Connection Handler.
          -->
          <script>
            CurrentTestPath['group'] = 'snmp'
@@ -58,10 +58,18 @@
            
            testList = []
            testList.append(['.','snmp_setup'])
            testList.append(['.','snmp_defaultproperties'])
            testList.append(['.','snmp_v1_defaultconf'])
            testList.append(['.','snmp_v2c_defaultconf'])
            testList.append(['.','snmp_v3_defaultconf'])
            testList.append(['.','snmp_trap_defaultconf'])
            #testList.append(['.','snmp_mibvalues'])
            testList.append(['.','snmp_v1_customconf'])
            testList.append(['.','snmp_v2c_customconf'])
            testList.append(['.','snmp_v3_customconf'])
            testList.append(['.','snmp_trap_customconf'])
            testList.append(['.','snmp_registermbean'])
            testList.append(['.','snmp_status'])
            testList.append(['.','snmp_cleanup'])
          </script>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_defaultproperties.xml
New file
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_defaultproperties"/>
  <function name="snmp_defaultproperties">
    <sequence>
      <block name="'snmp_defaultproperties'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName    SNMP Connection Handler default properties
            #@TestSuitePurpose Check SNMP Connection Handler default properties.
            #@TestSuiteGroup   SNMP Connection Handler default properties
            #@TestScript       snmp_defaultproperties.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Construct a table containing the expected properties -->
          <script>
            EXPECTED_PROPERTIES = {}
            EXPECTED_PROPERTIES['allowed-client'] = ''
            EXPECTED_PROPERTIES['allowed-manager'] = '*'
            EXPECTED_PROPERTIES['allowed-user'] = '*'
            EXPECTED_PROPERTIES['community'] = 'OpenDS'
            EXPECTED_PROPERTIES['denied-client'] = ''
            EXPECTED_PROPERTIES['enabled'] = 'false'
            EXPECTED_PROPERTIES['listen-port'] = '161'
            EXPECTED_PROPERTIES['opendmk-jarfile'] = ''
            EXPECTED_PROPERTIES['registered-mbean'] = 'false'
            file = 'config/snmp/security/opends-snmp.security'
            EXPECTED_PROPERTIES['security-agent-file'] = '%s' % file
            EXPECTED_PROPERTIES['security-level'] = 'authnopriv'
            EXPECTED_PROPERTIES['trap-port'] = '162'
            EXPECTED_PROPERTIES['traps-community'] = 'OpenDS'
            EXPECTED_PROPERTIES['traps-destination'] = ''
          </script>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('snmp_defaultproperties: check the default properties')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_defaultproperties: check the default properties'
              </message>
              <script>
                result = compare_property_table(EXPECTED_PROPERTIES,
                                                DEFAULT_PROPERTIES)
              </script>
              <message>
                'result: %s' % result
              </message>
              <call function="'checktestStringNotPresent'">
                {
                'returnString' : result ,
                'testString'   : 'ERROR'
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_mibvalues.xml
New file
@@ -0,0 +1,637 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_mibvalues"/>
  <function name="snmp_mibvalues">
    <sequence>
      <block name="'snmp_mibvalues'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP MIB values
            #@TestSuitePurpose    Check SNMP MIB values.
            #@TestSuiteGroup      SNMP MIB values
            #@TestScript          snmp_mibvalues.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Desactivate the verbose mode -->
          <script>
            VERBOSE_MODE = 'False'
          </script>
          <!-- Default values -->
          <script>
            community = '%s@%s' \
            % (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
          </script>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check the number of connection handler')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check the number of connection handler'
              </message>
              <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])
                nbHandler = get_handler_count(DEFAULT_VALUES)
                indexLDAP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
                                         % DIRECTORY_INSTANCE_PORT)
              </script>
              <if expr="nbHandler == 3">
                <sequence>
                  <script>
                    msg1 = 'The number of connection handler is correct.\n'
                    msg2 = 'Current value: %s' % nbHandler
                    msg = '%s%s' % (msg1, msg2)
                  </script>
                  <message>
                    '%s' % msg
                  </message>
                  <tcstatus result="'pass'"></tcstatus>
                </sequence>
                <else>
                  <sequence>
                    <script>
                      msg1 = 'The number of connection handler is wrong.\n'
                      msg2 = 'Expected value: 3\n'
                      msg3 = 'Current value: %s' % nbHandler
                      msg = '%s%s%s' % (msg1, msg2, msg3)
                    </script>
                    <message>
                      '%s' % msg
                    </message>
                    <tcstatus result="'fail'"></tcstatus>
                  </sequence>
                </else>
              </if>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsServerType entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsServerType entry'
              </message>
              <script>
                dsServerType = DEFAULT_VALUES['dsServerType.1']
                dsVersion = DSInfo.getServerVersion(DSInfo.ServerDict['server version'])
                dsBuild = DSInfo.getServerBuildId(DSInfo.ServerDict['server buildid'])
                dsServer = 'OpenDS Directory Server %s - %s' \
                           % (dsVersion, dsBuild)
              </script>
              <if expr="dsServerType == dsServer">
                <sequence>
                  <script>
                    msg1 = 'Value for dsServerType entry is correct.\n'
                    msg2 = 'Current value: %s' % dsServer
                    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' % dsServerType
                      msg3 = 'Current value: %s' % dsServer
                      msg = '%s%s%s' % (msg1, msg2, msg3)
                    </script>
                    <message>
                      '%s' % msg
                    </message>
                    <tcstatus result="'fail'"></tcstatus>
                  </sequence>
                </else>
              </if>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsServerDescription entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsServerDescription entry'
              </message>
              <script>
                dsServerDescription = DEFAULT_VALUES['dsServerDescription.1']
                dsPath = '%s/%s/bin' % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
              </script>
              <if expr="dsServerDescription == dsPath">
                <sequence>
                  <script>
                    msg1 = 'Value for dsServerDescription entry is correct.\n'
                    msg2 = 'Current value: %s' % dsPath
                    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' % dsServerDescription
                      msg3 = 'Current value: %s' % dsPath
                      msg = '%s%s%s' % (msg1, msg2, msg3)
                    </script>
                    <message>
                      '%s' % msg
                    </message>
                    <tcstatus result="'fail'"></tcstatus>
                  </sequence>
                </else>
              </if>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsApplIfSearchOps entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsApplIfSearchOps entry'
              </message>
              <script>
                dn = 'uid=user.2,o=snmp tests,dc=example,dc=com'
              </script>
              <call function="'ldapCompareWithScript'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode:64447' ,
                                      '%s' % dn] ,
                'expectedRC'       : 'noCheck'
                }
              </call>
              <!--- Increment default values -->
              <script>
                key = 'dsApplIfReadOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
                key = 'dsApplIfSearchOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
              </script>
              <call function="'compareSNMPValues'">
                {
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsApplIfAddEntryOps entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsApplIfAddEntryOps entry'
              </message>
              <script>
                dn = 'uid=user.2,o=snmp tests,dc=example,dc=com'
              </script>
              <call function="'ldapCompareWithScript'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode:64447' ,
                                      '%s' % dn] ,
                'expectedRC'       : 'noCheck'
                }
              </call>
              <!--- Increment default values -->
              <script>
                key = 'dsApplIfReadOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
                key = 'dsApplIfAddEntryOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
              </script>
              <call function="'compareSNMPValues'">
                {
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
           <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsApplIfRemoveEntryOps entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsApplIfRemoveEntryOps entry'
              </message>
              <script>
                dn = 'uid=user.2,o=snmp tests,dc=example,dc=com'
              </script>
              <call function="'ldapCompareWithScript'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode:64447' ,
                                      '%s' % dn] ,
                'expectedRC'       : 'noCheck'
                }
              </call>
              <!--- Increment default values -->
              <script>
                key = 'dsApplIfReadOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
                key = 'dsApplIfRemoveEntryOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
              </script>
              <call function="'compareSNMPValues'">
                {
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsApplIfCompareOps entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsApplIfCompareOps entry'
              </message>
              <script>
                dn = 'uid=user.2,o=snmp tests,dc=example,dc=com'
              </script>
              <call function="'ldapCompareWithScript'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode:64447' ,
                                      '%s' % dn] ,
                'expectedRC'       : 'noCheck'
                }
              </call>
              <!--- Increment default values -->
              <script>
                key = 'dsApplIfReadOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
                key = 'dsApplIfCompareOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
              </script>
              <call function="'compareSNMPValues'">
                {
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsApplIfModifyEntryOps entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsApplIfModifyEntryOps entry'
              </message>
              <script>
                dn = 'uid=user.2,o=snmp tests,dc=example,dc=com'
              </script>
              <call function="'ldapCompareWithScript'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode:64447' ,
                                      '%s' % dn] ,
                'expectedRC'       : 'noCheck'
                }
              </call>
              <!--- Increment default values -->
              <script>
                key = 'dsApplIfReadOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
                key = 'dsApplIfModifyEntryOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
              </script>
              <call function="'compareSNMPValues'">
                {
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP MIB values
            #@TestName            snmp_mibvalues: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('snmp_mibvalues: check value of dsApplIfModifyRDNOps entry')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'snmp_mibvalues: check value of dsApplIfModifyRDNOps entry'
              </message>
              <script>
                dn = 'uid=user.2,o=snmp tests,dc=example,dc=com'
              </script>
              <call function="'ldapCompareWithScript'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsDn'             : ['postalCode:64447' ,
                                      '%s' % dn] ,
                'expectedRC'       : 'noCheck'
                }
              </call>
              <!--- Increment default values -->
              <script>
                key = 'dsApplIfReadOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
                key = 'dsApplIfModifyRDNOps.%s' % indexLDAP
                DEFAULT_VALUES[key] = \
                  str(int(DEFAULT_VALUES[key]) + 1)
              </script>
              <call function="'compareSNMPValues'">
                {
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Activate the verbose mode -->
          <script>
            VERBOSE_MODE = 'True'
          </script>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_registermbean.xml
New file
@@ -0,0 +1,250 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_registermbean"/>
  <function name="snmp_registermbean">
    <sequence>
      <block name="'snmp_registermbean'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP Connection Handler register mbean
            #@TestSuitePurpose    Check SNMP Connection Handler register mbean.
            #@TestSuiteGroup      SNMP Connection Handler register mbean.
            #@TestScript          snmp_registermbean.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Define default values -->
          <script>
            refRegisteredMbeanProp = SNMP_PROPERTIES['registered-mbean']
            defCommunityProp = SNMP_PROPERTIES['community']
            defCommunity = '%s@%s' %(defCommunityProp, defCommunityProp)
            oid = 'dsServerType.1'
          </script>
          <!--- Test Case information
            #@TestMarker          SNMP Connection Handler register mbean
            #@TestName            registermbean: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('registermbean: check that there is no error at startup')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'registermbean: set the register-mbean property to true'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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 ,
                'dsPort'    : DIRECTORY_INSTANCE_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'        : 5 ,
                'noOfMilliSeconds' : 2000
                }
              </call>
              <call function="'checktestStringNotPresent'">
                {
                'returnString' : returnString ,
                'testString'   : 'category=PROTOCOL severity=SEVERE_ERROR'
                }
              </call>
              <message>
                'registermbean: get to check the SNMPConnection Handler'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'registermbean: restore the register-mbean property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'registermbean: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP Connection Handler register mbean
            #@TestName            registermbean: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('registermbean: set the register-mbean property to a wrong value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'registermbean: set register-mbean property to a wrong value'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_status.xml
New file
@@ -0,0 +1,720 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_status"/>
  <function name="snmp_status">
    <sequence>
      <block name="'snmp_status'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP Connection Handler status
            #@TestSuitePurpose    Check SNMP Connection Handler status.
            #@TestSuiteGroup      SNMP Connection Handler status
            #@TestScript          snmp_status.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Define default values -->
          <script>
            community = '%s@%s' \
              % (SNMP_PROPERTIES['community'], SNMP_PROPERTIES['community'])
            oid = 'dsServerType.1'
          </script>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('status: status when the server is stopped/started')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'status: stop DS running on port %s' \
                % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StopDsWithScript'">
                {
                'location'  : STAF_REMOTE_HOSTNAME ,
                'dsHost'    : DIRECTORY_INSTANCE_HOST ,
                'dsPort'    : DIRECTORY_INSTANCE_PORT ,
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'status: status when the server is stopped'
              </message>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
                                   % SNMP_PORT
                }
              </call>
              <message>
                'status: start DS to run on port %s' \
                % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StartDsWithScript'">
                { 'location' : STAF_REMOTE_HOSTNAME }
              </call>
              <!--- Check that DS started -->
              <call function="'isAlive'">
                {
                'noOfLoops'        : 5 ,
                'noOfMilliSeconds' : 2000
                }
              </call>
              <message>
                'status: status when the server is started'
              </message>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
                                   % SNMP_PORT
                }
              </call>
              <message>
                'status: get request'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP Connection Handler status
            #@TestName            status: check status when the connection
                                  handler is disabled/enabled
            #@TestIssue           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.
          -->
          <testcase name="getTestCaseName
          ('status: status when SNMP Connection Handler is disabled/enabled')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'status: disable the SNMP Connection Handler'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set enabled:false'
                }
              </call>
              <message>
                'status: status when the SNMP connection handler is disabled'
              </message>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s : SNMP     : Disabled' \
                                   % SNMP_PORT
                }
              </call>
              <message>
                'status: get request'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'reqTimeout'
                }
              </call>
              <message>
                'status: enable the SNMP Connection Handler'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set enabled:true'
                }
              </call>
              <message>
                'status: status when the SNMP connection handler is enabled'
              </message>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
                                   % SNMP_PORT
                }
              </call>
              <message>
                'status: get request'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP Connection Handler status
            #@TestName            status: check error message and status when
                                  the opendmk-jarfile property is set to a
                                  wrong value
            #@TestIssue           none
            #@TestPurpose         Check error message and status when
                                  the opendmk-jarfile property is set to a
                                  wrong value.
            #@TestPreamble        none
            #@TestStep            set opendmk-jarfile property to a wrong value
            #@TestStep            restart the server
            #@TestStep            check that an error message is displayed at
                                  startup
            #@TestStep            check status using status command
            #@TestStep            restore value for opendmk-jarfile property
            #@TestStep            disable the SNMP connection handler
            #@TestStep            enable the SNMP connection handler
            #@TestPostamble       none
            #@TestResult          Success if an error message is displayed and
                                  if the output of status is correct.
          -->
          <testcase name="getTestCaseName
          ('status: status with a wrong opendmk-jarfile value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'status: set opendmk-jarfile property to a wrong value'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set opendmk-jarfile:wrong_file'
                }
              </call>
              <message>
                'status: restart DS running on port %s' \
                % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StopDsWithScript'">
                {
                'location'  : STAF_REMOTE_HOSTNAME ,
                'dsHost'    : DIRECTORY_INSTANCE_HOST ,
                'dsPort'    : DIRECTORY_INSTANCE_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'        : 5 ,
                'noOfMilliSeconds' : 2000
                }
              </call>
              <script>
                msg1 = 'You do not have the appropriated OpenDMK jar files to'
                msg2 = 'enable the SNMP Connection Handler. Please go under'
                msg3 = 'http:\/\/opendmk.dev.java.net and set the'
                msg4 = 'ds-cfg-opendmk-jarfile configuration parameter to set'
                msg5 = 'the full path of the required jdmkrt.jar file.'
                msg6 = 'The SNMP connection Handler didn\'t started'
                msg = '%s %s %s %s %s %s' % (msg1, msg2, msg3, msg4, msg5, msg6)
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
              <message>
                'status: status when the server is started'
              </message>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
                                   % SNMP_PORT
                }
              </call>
              <message>
                'status: get request'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'reqTimeout'
                }
              </call>
              <message>
                'status: restore value for opendmk-jarfile property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set opendmk-jarfile:%s' \
                                     % SNMP_PROPERTIES['opendmk-jarfile']
                }
              </call>
              <message>
                'status: disable the SNMP Connection Handler'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set enabled:true'
                }
              </call>
              <message>
                'status: enable the SNMP Connection Handler'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP Connection Handler status
            #@TestName            status: check error message and status when
                                  the security-agent-file property is set to a
                                  wrong value
            #@TestIssue           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.
          -->
          <testcase name="getTestCaseName
          ('status: status with a wrong security-agent-file value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'status: set the security-agent-file to a wrong value'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set security-agent-file:wrong_file'
                }
              </call>
              <message>
                'status: restart DS running on port %s' \
                % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StopDsWithScript'">
                {
                'location'  : STAF_REMOTE_HOSTNAME ,
                'dsHost'    : DIRECTORY_INSTANCE_HOST ,
                'dsPort'    : DIRECTORY_INSTANCE_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'        : 5 ,
                'noOfMilliSeconds' : 2000
                }
              </call>
              <script>
                msg1 = 'An unexpected error occurred while trying to initialize'
                msg2 = 'the SNMP Connection Hanlder. Please check the'
                msg3 = 'configuration attributes'
                msg = '%s %s %s' % (msg1, msg2, msg3)
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : 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="'checktestStringNotPresent'">
                {
                'returnString' : returnString ,
                'testString'   : msg
                }
              </call>
              <message>
                'status: status when the server is started'
              </message>
              <call function="'StatusWithScript'">
                {
                'dsBindDN'  : DIRECTORY_INSTANCE_DN ,
                'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : '0.0.0.0:%s : SNMP     : Enabled' \
                                   % SNMP_PORT
                }
              </call>
              <message>
                'status: get request'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : community ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'reqTimeout'
                }
              </call>
              <message>
                'status: restore value for security-agent-file property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set security-agent-file:%s' \
                                     % SNMP_PROPERTIES['security-agent-file']
                }
              </call>
              <message>
                'status: disable the SNMP Connection Handler'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--set enabled:true'
                }
              </call>
              <message>
                'status: enable the SNMP Connection Handler'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml
New file
@@ -0,0 +1,946 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_trap_customconf"/>
  <function name="snmp_trap_customconf">
    <sequence>
      <block name="'snmp_trap_customconf'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP trap with custom configuration
            #@TestSuitePurpose    Check SNMP trap with custom configuration.
            #@TestSuiteGroup      SNMP trap with custom configuration
            #@TestScript          snmp_trap_customconf.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Define default values -->
          <script>
            defTrapsCommunityProp = '%s' % SNMP_PROPERTIES['traps-community']
            newTrapsCommunityProp = 'myCommunity'
            newTrapsDestProp = DIRECTORY_INSTANCE_HOST
            wrongTrapsDestProp = 'wrongtrapdestination'
            timerDuration = '5m'
          </script>
          <!--- Test Case information
            #@TestMarker          SNMP trap with custom configuration
            #@TestName            trap_customconf: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('trap_customconf: trap on stop-ds')">
            <sequence>
              <message>
                'trap_customconf: change the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <timer duration="timerDuration">
                <sequence>
                  <parallel>
                    <sequence>
                      <message>
                        'trap_customconf: run the trap listener'
                      </message>
                      <call function="'SNMPTrapListener'">
                        {
                        'location'          : STAF_REMOTE_HOSTNAME ,
                        'snmpHost'          : DIRECTORY_INSTANCE_HOST ,
                        'snmpTrapPort'      : SNMP_TRAP_PORT ,
                        'snmpTrapCommunity' : defTrapsCommunityProp ,
                        'snmpTrapNumber'    : '0,2,0,0,0,0'
                        }
                      </call>
                    </sequence>
                    <sequence>
                      <message>
                        'trap_customconf: wait event from the trap listener'
                      </message>
                      <call function="'WaitEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_customconf: delete event from the trap listener'
                      </message>
                      <call function="'DeleteEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_defaultconf: restart the server'
                      </message>
                      <call function="'StopDsWithScript'">
                        {
                        'location'  : STAF_REMOTE_HOSTNAME ,
                        'dsRestart' : 'True'
                        }
                      </call>
                      <message>
                        'trap_customconf: send event to the trap listener'
                      </message>
                      <call function="'SendEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SendTrap/Complete'
                        }
                      </call>
                    </sequence>
                  </parallel>
                </sequence>
              </timer>
              <script>timerRC = RC</script>
              <if expr="timerRC == 1">
                <sequence>
                  <tcstatus result="'fail'"></tcstatus>
                  <message>
                    'trap_customconf: timeout occurred'
                  </message>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SNMPTrapLister/Ready'
                    }
                  </call>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SendTrap/Complete'
                    }
                  </call>
                </sequence>
              </if>
              <timer duration="timerDuration">
                <sequence>
                  <parallel>
                    <sequence>
                      <message>
                        'trap_customconf: run the trap listener'
                      </message>
                      <call function="'SNMPTrapListener'">
                        {
                        'location'          : STAF_REMOTE_HOSTNAME ,
                        'snmpHost'          : DIRECTORY_INSTANCE_HOST ,
                        'snmpTrapPort'      : SNMP_TRAP_PORT ,
                        'snmpTrapCommunity' : newTrapsCommunityProp ,
                        'snmpTrapNumber'    : '2,0,0,0,0,0'
                        }
                      </call>
                    </sequence>
                    <sequence>
                      <message>
                        'trap_customconf: wait event from the trap listener'
                      </message>
                      <call function="'WaitEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_customconf: delete event from the trap listener'
                      </message>
                      <call function="'DeleteEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_defaultconf: restart the server'
                      </message>
                      <call function="'StopDsWithScript'">
                        {
                        'location'  : STAF_REMOTE_HOSTNAME ,
                        'dsRestart' : 'True'
                        }
                      </call>
                      <message>
                        'trap_customconf: send event to the trap listener'
                      </message>
                      <call function="'SendEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SendTrap/Complete'
                        }
                      </call>
                    </sequence>
                  </parallel>
                </sequence>
              </timer>
              <script>timerRC = RC</script>
              <if expr="timerRC == 1">
                <sequence>
                  <tcstatus result="'fail'"></tcstatus>
                  <message>
                    'trap_customconf: timeout occurred'
                  </message>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SNMPTrapLister/Ready'
                    }
                  </call>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SendTrap/Complete'
                    }
                  </call>
                </sequence>
              </if>
              <message>
                'trap_customconf: restore the traps-community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP trap with custom configuration
            #@TestName            trap_customconf: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('trap_customconf: set traps-destination property to a correct value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'trap_customconf: change the traps-destination property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <timer duration="timerDuration">
                <sequence>
                  <parallel>
                    <sequence>
                      <message>
                        'trap_customconf: run the trap listener'
                      </message>
                      <call function="'SNMPTrapListener'">
                        {
                        'location'          : STAF_REMOTE_HOSTNAME ,
                        'snmpHost'          : DIRECTORY_INSTANCE_HOST ,
                        'snmpTrapPort'      : SNMP_TRAP_PORT ,
                        'snmpTrapCommunity' : defTrapsCommunityProp ,
                        'snmpTrapNumber'    : '2,0,0,0,0,0'
                        }
                      </call>
                    </sequence>
                    <sequence>
                      <message>
                        'trap_customconf: wait event from the trap listener'
                      </message>
                      <call function="'WaitEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_customconf: delete event from the trap listener'
                      </message>
                      <call function="'DeleteEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_defaultconf: restart the server'
                      </message>
                      <call function="'StopDsWithScript'">
                        {
                        'location'  : STAF_REMOTE_HOSTNAME ,
                        'dsRestart' : 'True'
                        }
                      </call>
                      <message>
                        'trap_customconf: send event to the trap listener'
                      </message>
                      <call function="'SendEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SendTrap/Complete'
                        }
                      </call>
                    </sequence>
                  </parallel>
                </sequence>
              </timer>
              <script>timerRC = RC</script>
              <if expr="timerRC == 1">
                <sequence>
                  <tcstatus result="'fail'"></tcstatus>
                  <message>
                    'trap_customconf: timeout occurred'
                  </message>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SNMPTrapLister/Ready'
                    }
                  </call>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SendTrap/Complete'
                    }
                  </call>
                </sequence>
              </if>
              <message>
                'trap_customconf: restore the traps-destination property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP trap with custom configuration
            #@TestName            trap_customconf: TODO
            #@TestIssue           3304
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('trap_customconf: set traps-destination property to a wrong value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'trap_customconf: change the traps-destination property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <timer duration="timerDuration">
                <sequence>
                  <parallel>
                    <sequence>
                      <message>
                        'trap_customconf: run the trap listener'
                      </message>
                      <call function="'SNMPTrapListener'">
                        {
                        'location'          : STAF_REMOTE_HOSTNAME ,
                        'snmpHost'          : DIRECTORY_INSTANCE_HOST ,
                        'snmpTrapPort'      : SNMP_TRAP_PORT ,
                        'snmpTrapCommunity' : defTrapsCommunityProp ,
                        'snmpTrapNumber'    : '0,0,0,0,0,0'
                        }
                      </call>
                    </sequence>
                    <sequence>
                      <message>
                        'trap_customconf: wait event from the trap listener'
                      </message>
                      <call function="'WaitEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_customconf: delete event from the trap listener'
                      </message>
                      <call function="'DeleteEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_defaultconf: restart the server'
                      </message>
                      <call function="'StopDsWithScript'">
                        {
                        'location'  : STAF_REMOTE_HOSTNAME ,
                        'dsRestart' : 'True'
                        }
                      </call>
                      <message>
                        'trap_customconf: send event to the trap listener'
                      </message>
                      <call function="'SendEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SendTrap/Complete'
                        }
                      </call>
                    </sequence>
                  </parallel>
                </sequence>
              </timer>
              <script>timerRC = RC</script>
              <if expr="timerRC == 1">
                <sequence>
                  <tcstatus result="'fail'"></tcstatus>
                  <message>
                    'trap_customconf: timeout occurred'
                  </message>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SNMPTrapLister/Ready'
                    }
                  </call>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SendTrap/Complete'
                    }
                  </call>
                </sequence>
              </if>
              <message>
                'trap_customconf: restore the traps-destination property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                knownIssue(3304)
              </script>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP trap with custom configuration
            #@TestName            trap_customconf: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('trap_customconf: set traps-destination property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'trap_customconf: set traps-destination property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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 \
                                      --add traps-destination:%s' \
                          % (wrongTrapsDestProp, newTrapsDestProp)
                }
              </call>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <timer duration="timerDuration">
                <sequence>
                  <parallel>
                    <sequence>
                      <message>
                        'trap_customconf: run the trap listener'
                      </message>
                      <call function="'SNMPTrapListener'">
                        {
                        'location'          : STAF_REMOTE_HOSTNAME ,
                        'snmpHost'          : DIRECTORY_INSTANCE_HOST ,
                        'snmpTrapPort'      : SNMP_TRAP_PORT ,
                        'snmpTrapCommunity' : defTrapsCommunityProp ,
                        'snmpTrapNumber'    : '2,0,0,0,0,0'
                        }
                      </call>
                    </sequence>
                    <sequence>
                      <message>
                        'trap_customconf: wait event from the trap listener'
                      </message>
                      <call function="'WaitEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_customconf: delete event from the trap listener'
                      </message>
                      <call function="'DeleteEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SNMPTrapLister/Ready'
                        }
                      </call>
                      <message>
                        'trap_defaultconf: restart the server'
                      </message>
                      <call function="'StopDsWithScript'">
                        {
                        'location'  : STAF_REMOTE_HOSTNAME ,
                        'dsRestart' : 'True'
                        }
                      </call>
                      <message>
                        'trap_customconf: send event to the trap listener'
                      </message>
                      <call function="'SendEvent'">
                        {
                        'location' : STAF_REMOTE_HOSTNAME ,
                        'name'     : 'SendTrap/Complete'
                        }
                      </call>
                    </sequence>
                  </parallel>
                </sequence>
              </timer>
              <script>timerRC = RC</script>
              <if expr="timerRC == 1">
                <sequence>
                  <tcstatus result="'fail'"></tcstatus>
                  <message>
                    'trap_customconf: timeout occurred'
                  </message>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SNMPTrapLister/Ready'
                    }
                  </call>
                  <message>
                    'trap_customconf: delete event from the trap listener'
                  </message>
                  <call function="'DeleteEvent'">
                    {
                    'location' : STAF_REMOTE_HOSTNAME ,
                    'name'     : 'SendTrap/Complete'
                    }
                  </call>
                </sequence>
              </if>
              <message>
                'trap_customconf: restore the traps-destination property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'trap_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP trap with custom configuration
            #@TestName            trap_customconf: TODO
            #@TestIssue           none
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('trap_customconf: set the traps-community property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'trap_customconf: set the traps-community property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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  \
                                      --add traps-community:%s' \
                              % (newTrapsCommunityProp, defTrapsCommunityProp) ,
                'expectedRC'       : 1
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
                msg1 = 'It is not possible to specify multiple values for the'
                msg2 = 'SNMP Connection Handler\nproperty "traps-community"'
                msg3 = 'as it is single-valued'
                msg = '%s %s %s' % (msg1, msg2, msg3)
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_v1_customconf.xml
New file
@@ -0,0 +1,546 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_v1_customconf"/>
  <function name="snmp_v1_customconf">
    <sequence>
      <block name="'snmp_v1_customconf'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP v1 with custom configuration
            #@TestSuitePurpose    Check SNMP v1 with custom configuration.
            #@TestSuiteGroup      SNMP v1 with custom configuration
            #@TestScript          snmp_v1_customconf.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Define default values -->
          <script>
            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>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v1_customconf: change the community property')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v1_customconf: change the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v1_customconf: get with the old community'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'reqTimeout'
                }
              </call>
              <message>
                'v1_customconf: get with the new community'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : newCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'v1_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v1_customconf: set allowed-manager property to a correct value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v1_customconf: change the allowed-manager property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v1_customconf: get with the new community'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'v1_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v1_customconf: set allowed-manager property to a wrong value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v1_customconf: change the allowed-manager property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v1_customconf: get with the old community'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noSuchName'
                }
              </call>
              <message>
                'v1_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v1_customconf: set allowed-manager property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v1_customconf: set allowed-manager property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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 \
                                      --add allowed-manager:%s' \
                                     % (wrongManagerProp, newManagerProp)
                }
              </call>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v1_customconf: get from a not allowed manager'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '1',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'v1_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v1_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v1_customconf: set the community property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v1_customconf: set the community property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--add community:%s  \
                                      --add community:%s' \
                                     % (newCommunityProp, defCommunityProp) ,
                'expectedRC'       : 1
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
                msg1 = 'It is not possible to specify multiple values for the'
                msg2 = 'SNMP Connection Handler\nproperty "community" as it'
                msg3 = 'is single-valued'
                msg = '%s %s %s' % (msg1, msg2, msg3)
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_v2c_customconf.xml
New file
@@ -0,0 +1,546 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_v2c_customconf"/>
  <function name="snmp_v2c_customconf">
    <sequence>
      <block name="'snmp_v2c_customconf'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP v2c with custom configuration
            #@TestSuitePurpose    Check SNMP v2c with custom configuration.
            #@TestSuiteGroup      SNMP v2c with custom configuration
            #@TestScript          snmp_v2c_customconf.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Define default values -->
          <script>
            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>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v2c_customconf: change the community property')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v2c_customconf: change the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v2c_customconf: get with the old community'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '2',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'reqTimeout'
                }
              </call>
              <message>
                'v2c_customconf: get with the new community'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '2',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : newCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'v2c_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v2c_customconf: set allowed-manager property to a correct value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v2c_customconf: change the allowed-manager property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v2c_customconf: get form a allowed manager'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '2',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'v2c_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v2c_customconf: set allowed-manager property to a wrong value')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v2c_customconf: set allowed-manager property to a wrong value'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v2c_customconf: get from a not allowed manager'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '2',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'authorizationError'
                }
              </call>
              <message>
                'v2c_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v2c_customconf: set allowed-manager property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v2c_customconf: set allowed-manager property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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 \
                                      --add allowed-manager:%s' \
                                     % (wrongManagerProp, newManagerProp)
                }
              </call>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v2c_customconf: get from a not allowed manager'
              </message>
              <call function="'SNMPGet'">
                {
                'snmpVersion'   : '2',
                'snmpHost'      : DIRECTORY_INSTANCE_HOST ,
                'snmpPort'      : SNMP_PORT ,
                'snmpCommunity' : defCommunity ,
                'snmpOIDs'      : oid ,
                'snmpStatus'    : 'noError'
                }
              </call>
              <message>
                'v2c_customconf: restore the community property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v2c_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v2c_customconf: set the community property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v2c_customconf: set the community property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'subcommand'       : 'set-connection-handler-prop' ,
                'objectType'       : 'handler-name' ,
                'objectName'       : 'SNMP Connection Handler' ,
                'optionsString'    : '--add community:%s  \
                                      --add community:%s' \
                                     % (newCommunityProp, defCommunityProp) ,
                'expectedRC'       : 1
                }
              </call>
              <script>
                returnString = STAXResult[0][1]
                msg1 = 'It is not possible to specify multiple values for the'
                msg2 = 'SNMP Connection Handler\nproperty "community" as it'
                msg3 = 'is single-valued'
                msg = '%s %s %s' % (msg1, msg2, msg3)
              </script>
              <call function="'checktestString'">
                {
                'returnString'   : returnString ,
                'expectedString' : msg
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>
opendj-sdk/opends/tests/functional-tests/testcases/snmp/snmp_v3_customconf.xml
New file
@@ -0,0 +1,972 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! CDDL HEADER START
 !
 ! The contents of this file are subject to the terms of the
 ! Common Development and Distribution License, Version 1.0 only
 ! (the "License").  You may not use this file except in compliance
 ! with the License.
 !
 ! You can obtain a copy of the license at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! See the License for the specific language governing permissions
 ! and limitations under the License.
 !
 ! When distributing Covered Code, include this CDDL HEADER in each
 ! file and include the License file at
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 ! add the following below this CDDL HEADER, with the fields enclosed
 ! by brackets "[]" replaced with your own identifying information:
 !      Portions Copyright [yyyy] [name of copyright owner]
 !
 ! CDDL HEADER END
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="snmp_v3_customconf"/>
  <function name="snmp_v3_customconf">
    <sequence>
      <block name="'snmp_v3_customconf'">
        <sequence>
          <!--- Test Suite information
            #@TestSuiteName       SNMP v3 with custom configuration
            #@TestSuitePurpose    Check SNMP v3 with custom configuration.
            #@TestSuiteGroup      SNMP v3 with custom configuration
            #@TestScript          snmp_v3_customconf.xml
          -->
          <script>
            if not CurrentTestPath.has_key('group'):
              CurrentTestPath['group'] = 'snmp'
            CurrentTestPath['suite'] = STAXCurrentBlock
          </script>
          <call function="'testSuite_Preamble'"/>
          <!--- Define default values -->
          <script>
            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' % logsRemoteDataDir
            lowUser = 'myUser1'
            defUser = 'myUser2'
            highUser = 'myUser3'
            otherUser = 'myUser4'
            lowSecurityLevelProp = 'noauthnopriv'
            highSecurityLevelProp = 'authpriv'
            wrongSecurityLevelProp = 'mySecurityLevel'
            mySecurityFile = '%s/snmp/manager.security' % logsRemoteDataDir
            oid = 'dsServerType.1'
          </script>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: change the security-agent-file property')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: change the security-agent-file property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP v3 with custom configuration
            #@TestName            v3_customconf: TODO
            #@TestIssue           3301
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: check the current security level (def)')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: get with the lowUser and low security level'
              </message>
              <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>
              <message>
                'v3_customconf: get with the defUser and def security level'
              </message>
              <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>
              <message>
                'v3_customconf: get with the highUser and high security level'
              </message>
              <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>
              <script>
                knownIssue(3301)
              </script>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: change the context property')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: change the context property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v3_customconf: get with the old context'
              </message>
              <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>
              <message>
                'v3_customconf: get with the context'
              </message>
              <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>
              <message>
                'v3_customconf: restore the context property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: set the allowed-user property to a list')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: set the allowed-user property to a list'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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 \
                                      --add allowed-user:%s' \
                                      % (defUser, otherUser)
                }
              </call>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v3_customconf: get with the myUser community'
              </message>
              <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>
              <message>
                'v3_customconf: get with the myUser2 community'
              </message>
              <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>
              <message>
                'v3_customconf: restore the allowed-user property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: set the allowed-user property to otherUser')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: set the allowed-user property to otherUser'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v3_customconf: get with the defUser'
              </message>
              <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>
              <message>
                'v3_customconf: get with the otherUser'
              </message>
              <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>
              <message>
                'v3_customconf: restore the security-agent-file property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: set the security-level property to low')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: set the security-level property to low'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v3_customconf: get with the myUser1 and low security level'
              </message>
              <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>
              <message>
                'v3_customconf: get with the myUser2 and med security level'
              </message>
              <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>
              <message>
                'v3_customconf: get with the myUser3 and high security level'
              </message>
              <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>
              <message>
                'v3_customconf: restore the security-level property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- Test Case information
            #@TestMarker          SNMP v3 with custom configuration
            #@TestName            v3_customconf: TODO
            #@TestIssue           3301
            #@TestPurpose         TODO.
            #@TestPreamble        none
            #@TestStep            TODO.
            #@TestPostamble       none
            #@TestResult          TODO.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: set the security-level property to high')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: set the security-level property to high'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <message>
                'v3_customconf: get with the myUser1 and low security level'
              </message>
              <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>
              <message>
                'v3_customconf: get with the myUser2 and med security level'
              </message>
              <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>
              <message>
                'v3_customconf: get with the myUser3 and high security level'
              </message>
              <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>
              <message>
                'v3_customconf: restore the security-level property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <script>
                knownIssue(3301)
              </script>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: set the security-level property to wrong')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: set the security-level property to wrong'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <!--- 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.
          -->
          <testcase name="getTestCaseName
          ('v3_customconf: restore the security-agent-file property')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <message>
                'v3_customconf: restore the security-agent-file property'
              </message>
              <call function="'dsconfig'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                '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>
              <message>
                'v3_customconf: restart the SNMP Connection Handler'
              </message>
              <call function="'restartSNMPConnectionHandler'">
                {
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD
                }
              </call>
              <call function="'testCase_Postamble'"/>
            </sequence>
          </testcase>
          <call function="'testSuite_Postamble'"/>
        </sequence>
      </block>
    </sequence>
  </function>
</stax>