5767N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
5767N/A ! The contents of this file are subject to the terms of the 5767N/A ! Common Development and Distribution License, Version 1.0 only 5767N/A ! (the "License"). You may not use this file except in compliance 5767N/A ! You can obtain a copy of the license at 5767N/A ! See the License for the specific language governing permissions 5767N/A ! and limitations under the License. 5767N/A ! When distributing Covered Code, include this CDDL HEADER in each 5767N/A ! file and include the License file at 5767N/A ! add the following below this CDDL HEADER, with the fields enclosed 5767N/A ! by brackets "[]" replaced with your own identifying information: 5767N/A ! Portions Copyright [yyyy] [name of copyright owner] 5767N/A ! Copyright 2008-2010 Sun Microsystems, Inc. 6101N/A ! Portions Copyright 2012-2013 ForgeRock AS 5767N/A <
function name="main_snmp_setup">
5767N/A <
block name="'snmp_setup'">
5767N/A <!--- Test Suite information 5767N/A #@TestSuitePurpose Setup for the snmp test suite. 5767N/A CurrentTestPath['group'] = 'snmp'
5767N/A CurrentTestPath['suite'] = 'setup'
5767N/A <
call function="'testSuite_Preamble'"/>
5767N/A <!--- Define default value for manager --> 5767N/A <!--- Test Case information 5767N/A #@TestName setup: create DS topology 5767N/A #@TestPurpose Create the topology necessary to the 5767N/A #@TestResult Success if createTopology returns 0. 5767N/A <
testcase name="getTestCaseName('setup: create DS topology')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A <
call function="'createTopology'">
5767N/A { 'initialiseInstance' : False }
5767N/A <
call function="'checktestRC'">
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!-- Check if 'opendmkPath' exists --> 5767N/A <
call function="'GetEntry'">
5767N/A 'location' : STAF_REMOTE_HOSTNAME ,
5767N/A <!-- 'opendmkPath' exists so we can continue --> 5767N/A <!--- Test Case information 5767N/A #@TestStep Start the server. 5767N/A #@TestStep Check that the server is alive. 5767N/A #@TestResult Success if StartDsWithScript returns 0. 5767N/A <
testcase name="getTestCaseName('setup: start DS')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'start DS to run on port %s.' % (DIRECTORY_INSTANCE_PORT) }
5767N/A <
call function="'StartDsWithScript'">
5767N/A { 'location' : STAF_REMOTE_HOSTNAME }
5767N/A <!--- Check that DS started --> 5767N/A <
call function="'isAlive'">
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestName setup: add initial entries 5767N/A #@TestPurpose Load the data needed by the test suite. 5767N/A #@TestStep Load the data needed by the test suite. 5767N/A #@TestResult Success if importLdif returns 0. 5767N/A <
testcase name="getTestCaseName('setup: add initial entries')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Add initial entries' }
5767N/A <
call function="'dsconfigSet'">
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5767N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
5767N/A 'objectName' : 'password-policy',
5767N/A 'propertyName' : 'Default Password Policy',
5767N/A 'attributeName' : 'allow-pre-encoded-passwords',
5767N/A <
call function="'addEntry'">
5767N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
5767N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestName setup: get default SNMP connection handler 5767N/A #@TestPurpose Get default SNMP connection handler 5767N/A #@TestStep get default SNMP connection handler 5767N/A #@TestResult Success if GetDSConfigProperties returns 0 5767N/A <
testcase name="getTestCaseName 5767N/A ('setup: get default SNMP Connection Handler properties')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Get default SNMP Connection Handler properties' }
5767N/A options = '--handler-name "SNMP Connection Handler"'
5767N/A <
call function="'GetDSConfigProperties'">
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'get-connection-handler-prop' ,
5767N/A 'optionsString' : options ,
5767N/A 'myVariableName' : 'DEFAULT_PROPERTIES'
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestName setup: check SNMP Connection Handler is 5767N/A #@TestPurpose Check SNMP Connection Handler is disabled. 5767N/A #@TestStep check SNMP Connection Handler is 5767N/A disabled using status command 5767N/A #@TestResult Success if output of status is correct. 5767N/A <
testcase name="getTestCaseName 5767N/A ('setup: check SNMP Connection Handler is disabled')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Check SNMP Connection Handler is disabled' }
5767N/A <
call function="'StatusWithScript'">
5767N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
5767N/A returnString = STAXResult[0][1]
5767N/A <
call function="'checktestString'">
5767N/A 'returnString' : returnString ,
6142N/A 'expectedString' : ':\\s+SNMP\\s+:\\s+Disabled'
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestName setup: enable SNMP Connection Handler 5767N/A #@TestPurpose Enable SNMP Connection Handler. 5767N/A #@TestStep enable SNMP Connection Handler using 5767N/A #@TestResult Success if dsconfig returns 0. 5767N/A <
testcase name="getTestCaseName 5767N/A ('setup: enable SNMP Connection Handler')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Enable SNMP Connection Handler' }
5767N/A <
call function="'dsconfig'">
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'set-connection-handler-prop' ,
5767N/A 'objectType' : 'handler-name' ,
5767N/A 'objectName' : 'SNMP Connection Handler' ,
5767N/A 'optionsString' : '--set enabled:true \
5767N/A --set opendmk-jarfile:%s' \
5767N/A % (SNMP_PORT, SNMP_TRAP_PORT, opendmkPath)
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestName setup: check SNMP Connection Handler is 5767N/A #@TestPurpose Check SNMP Connection Handler is enabled. 5767N/A #@TestStep check SNMP Connection Handler is 5767N/A enabled using status command 5767N/A #@TestResult Success if output of status is correct. 5767N/A <
testcase name="getTestCaseName 5767N/A ('setup: check SNMP Connection Handler is enabled')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Check SNMP Connection Handler is enabled' }
5767N/A <
call function="'StatusWithScript'">
5767N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
5767N/A returnString = STAXResult[0][1]
5767N/A <
call function="'checktestString'">
5767N/A 'returnString' : returnString ,
6142N/A 'expectedString' : ':\\s+SNMP\\s+:\\s+Enabled'
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestName setup: get SNMP connection handler 5767N/A #@TestPurpose Get SNMP connection handler properties. 5767N/A #@TestStep get SNMP connection handler properties 5767N/A #@TestResult Success if GetDSConfigProperties returns 0 5767N/A <
testcase name="getTestCaseName 5767N/A ('setup: get SNMP Connection Handler properties')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
6076N/A { 'stepMessage' : 'Copy snmp files to the remote host' }
6076N/A <
call function="'copyFile'">
6076N/A 'location' : STAXServiceMachine ,
6076N/A 'remotehost' : STAF_REMOTE_HOSTNAME
6076N/A <
call function="'copyFile'">
6076N/A 'location' : STAXServiceMachine ,
6076N/A 'remotehost' : STAF_REMOTE_HOSTNAME
6076N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Get SNMP Connection Handler properties' }
5767N/A options = '--handler-name "SNMP Connection Handler"'
5767N/A <
call function="'GetDSConfigProperties'">
5767N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
5767N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
5767N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
5767N/A 'subcommand' : 'get-connection-handler-prop' ,
5767N/A 'optionsString' : options ,
5767N/A 'myVariableName' : 'SNMP_PROPERTIES'
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <!--- Test Case information 5767N/A #@TestStep Print a warning message to indicate that 5767N/A the SNMP_OPENDMK_LIBDIR is not set. 5767N/A <
testcase name="getTestCaseName('setup: Warning')">
5767N/A <
call function="'testCase_Preamble'"/>
5767N/A <
call function="'testStep'">
5767N/A { 'stepMessage' : 'Print a warning message' }
5767N/A <
message log="1" level="'Error'">
5767N/A 'WARNING: Check if SNMP_OPENDMK_LIBDIR is set \
5767N/A <
tcstatus result="'fail'"></
tcstatus>
5767N/A <
catch exception="'STAXException'" typevar="eType" var="eInfo">
5767N/A <
message log="1" level="'fatal'">
5767N/A '%s: Test failed. eInfo(%s)' % (eType,eInfo)
5767N/A <
call function="'testCase_Postamble'"/>
5767N/A <
call function="'testSuite_Postamble'"/>