<?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'])
|
nbLoop = 10
|
</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 connection handlers')">
|
|
<sequence>
|
|
<call function="'testCase_Preamble'"/>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</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])
|
</script>
|
|
<message>
|
'snmp_mibvalues: check the connection handlers'
|
</message>
|
|
<script>
|
nbHandler = get_handler_count(DEFAULT_VALUES)
|
indexSNMP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
|
% SNMP_PORT)
|
indexLDAP = get_handler_index(DEFAULT_VALUES, '1.3.6.1.27.3.%s'\
|
% DIRECTORY_INSTANCE_PORT)
|
indexLDIF = get_handler_index(DEFAULT_VALUES, '1.3.6.1.4.1.42')
|
</script>
|
|
<if expr="nbHandler == 3 and indexSNMP != 0 and indexLDAP != 0 and indexLDIF != 0">
|
<sequence>
|
<script>
|
msg1 = 'The connection handlers info are correct.\n'
|
msg2 = 'number of hanlder: %s\n' % nbHandler
|
msg3 = 'index SNMP hanlder: %s\n' % indexSNMP
|
msg4 = 'index LDAP hanlder: %s\n' % indexLDAP
|
msg5 = 'index LDIF hanlder: %s\n' % indexLDIF
|
msg = '%s%s%s%s%s' % (msg1, msg2, msg3, msg4, msg5)
|
</script>
|
<message>
|
'%s' % msg
|
</message>
|
<tcstatus result="'pass'"></tcstatus>
|
</sequence>
|
<else>
|
<sequence>
|
<script>
|
msg1 = 'The connection handlers info are wrong.\n'
|
msg2 = 'number of hanlder: %s/3\n' % nbHandler
|
msg3 = 'index SNMP hanlder: %s\n' % indexSNMP
|
msg4 = 'index LDAP hanlder: %s\n' % indexLDAP
|
msg5 = 'index LDIF hanlder: %s' % indexLDIF
|
msg = '%s%s%s%s%s' % (msg1, msg2, msg3, msg4, msg5)
|
</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']
|
version = DSInfo.ServerDict['server version']
|
dsVersion = DSInfo.getServerVersion(version)
|
build = DSInfo.ServerDict['server buildid']
|
dsBuild = DSInfo.getServerBuildId(build)
|
dsServer = 'OpenDS Directory Server %s - %s' \
|
% (dsVersion.rstrip(), dsBuild)
|
</script>
|
|
<if expr="dsServerType == dsServer">
|
<sequence>
|
<script>
|
msg1 = 'Value for dsServerType entry is correct.\n'
|
msg2 = 'Current value: %s' % dsServerType
|
msg = '%s%s' % (msg1, msg2)
|
</script>
|
<message>
|
'%s' % msg
|
</message>
|
<tcstatus result="'pass'"></tcstatus>
|
</sequence>
|
<else>
|
<sequence>
|
<script>
|
msg1 = 'Value for dsServerType entry is wrong.\n'
|
msg2 = 'Expected value: %s\n' % dsServer
|
msg3 = 'Current value: %s' % dsServerType
|
msg = '%s%s%s' % (msg1, msg2, msg3)
|
</script>
|
<message>
|
'%s' % msg
|
</message>
|
<tcstatus result="'fail'"></tcstatus>
|
</sequence>
|
</else>
|
</if>
|
|
<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']
|
if is_windows_platform(DIRECTORY_INSTANCE_HOST):
|
dsPath = '%s/%s/bat' % (DIRECTORY_INSTANCE_DIR, OPENDSNAME)
|
dsPath = dsPath.replace('/', '\\')
|
else:
|
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' % dsServerDescription
|
msg = '%s%s' % (msg1, msg2)
|
</script>
|
<message>
|
'%s' % msg
|
</message>
|
<tcstatus result="'pass'"></tcstatus>
|
</sequence>
|
<else>
|
<sequence>
|
<script>
|
msg1 = 'Value for dsServerDescription entry is wrong.\n'
|
msg2 = 'Expected value: %s\n' % dsPath
|
msg3 = 'Current value: %s' % dsServerDescription
|
msg = '%s%s%s' % (msg1, msg2, msg3)
|
</script>
|
<message>
|
'%s' % msg
|
</message>
|
<tcstatus result="'fail'"></tcstatus>
|
</sequence>
|
</else>
|
</if>
|
|
<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: do %s search operation' % nbLoop
|
</message>
|
|
<loop var="loop" from="1" to="nbLoop">
|
<sequence>
|
|
<script>
|
id = 700 + loop
|
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
|
</script>
|
|
<message>
|
'LOOP %s: %s' % (loop, userDn)
|
</message>
|
|
<call function="'ldapSearchWithScript'">
|
{
|
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
|
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
|
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
|
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
|
'dsTypesOnly' : 'True' ,
|
'dsBaseDN' : 'dc=com' ,
|
'dsFilter' : userDn
|
}
|
</call>
|
|
</sequence>
|
</loop>
|
|
<message>
|
'snmp_mibvalues: increment the snmp values'
|
</message>
|
|
<script>
|
key = 'dsApplIfReadOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
key = 'dsApplIfSearchOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
</script>
|
|
<message>
|
'snmp_mibvalues: check value of dsApplIfSearchOps entry'
|
</message>
|
|
<call function="'compareSNMPValues'">
|
{
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'index' : indexLDAP
|
}
|
</call>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</message>
|
|
<call function="'SNMPGet'">
|
{
|
'snmpVersion' : '1',
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'snmpOIDs' : '' ,
|
'snmpStatus' : 'noError' ,
|
'snmpWalk' : 'True'
|
}
|
</call>
|
|
<script>
|
DEFAULT_VALUES = {}
|
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
|
</script>
|
|
<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: do %s add operations' % nbLoop
|
</message>
|
|
<loop var="loop" from="1" to="nbLoop">
|
<sequence>
|
|
<script>
|
id = 1000 + loop
|
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
|
|
listAttr = []
|
listAttr.append('objectclass:top')
|
listAttr.append('objectclass:organizationalperson')
|
listAttr.append('objectclass:inetorgperson')
|
listAttr.append('objectclass:person')
|
listAttr.append('givenname:Izen.0')
|
listAttr.append('sn:Abizen.0')
|
listAttr.append('cn:Izen Abizen.0')
|
listAttr.append('l:ICNC')
|
</script>
|
|
<message>
|
'LOOP %s: %s' % (loop, userDn)
|
</message>
|
|
<call function="'addAnEntry'">
|
{
|
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
|
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
|
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
|
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
|
'DNToAdd' : userDn,
|
'listAttributes' : listAttr
|
}
|
</call>
|
|
</sequence>
|
</loop>
|
|
<message>
|
'snmp_mibvalues: increment the snmp values'
|
</message>
|
|
<script>
|
key = 'dsApplIfReadOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
key = 'dsApplIfAddEntryOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
DEFAULT_VALUES['dsMasterEntries.1'] = \
|
str(int(DEFAULT_VALUES['dsMasterEntries.1']) + nbLoop)
|
</script>
|
|
<message>
|
'snmp_mibvalues: check value of dsApplIfAddEntryOps entry'
|
</message>
|
|
<call function="'compareSNMPValues'">
|
{
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'index' : indexLDAP
|
}
|
</call>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</message>
|
|
<call function="'SNMPGet'">
|
{
|
'snmpVersion' : '1',
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'snmpOIDs' : '' ,
|
'snmpStatus' : 'noError' ,
|
'snmpWalk' : 'True'
|
}
|
</call>
|
|
<script>
|
DEFAULT_VALUES = {}
|
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
|
</script>
|
|
<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: do %s remove operations' % nbLoop
|
</message>
|
|
<loop var="loop" from="1" to="nbLoop">
|
<sequence>
|
|
<script>
|
id = 1000 + loop
|
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
|
</script>
|
|
<message>
|
'LOOP %s: %s' % (loop, userDn)
|
</message>
|
|
<call function="'ldapDeleteWithScript'">
|
{
|
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
|
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
|
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
|
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
|
'dsDn' : ['%s' % userDn]
|
}
|
</call>
|
|
</sequence>
|
</loop>
|
|
<message>
|
'snmp_mibvalues: increment the snmp values'
|
</message>
|
|
<script>
|
key = 'dsApplIfReadOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
key = 'dsApplIfRemoveEntryOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
DEFAULT_VALUES['dsMasterEntries.1'] = \
|
str(int(DEFAULT_VALUES['dsMasterEntries.1']) - nbLoop)
|
</script>
|
|
<message>
|
'snmp_mibvalues: check value of dsApplIfRemoveEntryOps entry'
|
</message>
|
|
<call function="'compareSNMPValues'">
|
{
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'index' : indexLDAP
|
}
|
</call>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</message>
|
|
<call function="'SNMPGet'">
|
{
|
'snmpVersion' : '1',
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'snmpOIDs' : '' ,
|
'snmpStatus' : 'noError' ,
|
'snmpWalk' : 'True'
|
}
|
</call>
|
|
<script>
|
DEFAULT_VALUES = {}
|
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
|
</script>
|
|
<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: do %s compare operations' % nbLoop
|
</message>
|
|
<loop var="loop" from="1" to="nbLoop">
|
<sequence>
|
|
<script>
|
id = 0 + loop
|
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
|
</script>
|
|
<message>
|
'LOOP %s: %s' % (loop, userDn)
|
</message>
|
|
<call function="'ldapCompareWithScript'">
|
{
|
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
|
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
|
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
|
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
|
'dsDn' : ['postalCode:64447', '%s' % userDn] ,
|
'expectedRC' : 'noCheck'
|
}
|
</call>
|
|
</sequence>
|
</loop>
|
|
<message>
|
'snmp_mibvalues: increment the snmp values'
|
</message>
|
|
<script>
|
key = 'dsApplIfReadOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
key = 'dsApplIfCompareOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
</script>
|
|
<message>
|
'snmp_mibvalues: check value of dsApplIfCompareOps entry'
|
</message>
|
|
<call function="'compareSNMPValues'">
|
{
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'index' : indexLDAP
|
}
|
</call>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</message>
|
|
<call function="'SNMPGet'">
|
{
|
'snmpVersion' : '1',
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'snmpOIDs' : '' ,
|
'snmpStatus' : 'noError' ,
|
'snmpWalk' : 'True'
|
}
|
</call>
|
|
<script>
|
DEFAULT_VALUES = {}
|
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
|
</script>
|
|
<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: do %s modify operations' % nbLoop
|
</message>
|
|
<loop var="loop" from="1" to="nbLoop">
|
<sequence>
|
|
<script>
|
id = 400 + loop
|
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
|
</script>
|
|
<message>
|
'LOOP %s: %s' % (loop, userDn)
|
</message>
|
|
<call function="'modifyAnAttribute'">
|
{
|
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
|
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
|
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
|
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
|
'DNToModify' : userDn ,
|
'attributeName' : 'postalCode' ,
|
'newAttributeValue' : '%s' % id ,
|
'changetype' : 'replace'
|
}
|
</call>
|
|
</sequence>
|
</loop>
|
|
<message>
|
'snmp_mibvalues: increment the snmp values'
|
</message>
|
|
<script>
|
key = 'dsApplIfReadOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
key = 'dsApplIfModifyEntryOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
</script>
|
|
<message>
|
'snmp_mibvalues: check value of dsApplIfModifyEntryOps entry'
|
</message>
|
|
<call function="'compareSNMPValues'">
|
{
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'index' : indexLDAP
|
}
|
</call>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</message>
|
|
<call function="'SNMPGet'">
|
{
|
'snmpVersion' : '1',
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'snmpOIDs' : '' ,
|
'snmpStatus' : 'noError' ,
|
'snmpWalk' : 'True'
|
}
|
</call>
|
|
<script>
|
DEFAULT_VALUES = {}
|
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
|
</script>
|
|
<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: do %s modify RDN operations' % nbLoop
|
</message>
|
|
<loop var="loop" from="1" to="nbLoop">
|
<sequence>
|
|
<!--- Create a ldif file for moddn -->
|
<script>
|
id = 800 + loop
|
userDn = 'uid=user.%s,o=snmp tests,dc=example,dc=com' % id
|
newid = 2000 + loop
|
newDn = 'uid=user.%s' % newid
|
|
templateFile = 'template-%s.ldif' % loop
|
templatePath = '%s/%s' % (TMPDIR, templateFile)
|
ldifFile = 'moddn-%s.ldif' % loop
|
ldifPath = '%s/%s' % (DIRECTORY_INSTANCE_DIR, ldifFile)
|
ldifLines = []
|
ldifLines.append('dn: %s' % userDn)
|
ldifLines.append('changetype: moddn')
|
ldifLines.append('newRDN: %s' % newDn)
|
ldifLines.append('deleteOldRDN: 1')
|
outFile = open(templatePath, "w")
|
for line in ldifLines:
|
outFile.write("%s\n" % line)
|
outFile.close()
|
</script>
|
|
<message>
|
'LOOP %s: %s => %s' % (loop, userDn, newDn)
|
</message>
|
|
<!--- Copy file to remote host -->
|
<message>
|
'Copy %s to %s on %s' \
|
% (templateFile,DIRECTORY_INSTANCE_DIR,STAF_REMOTE_HOSTNAME)
|
</message>
|
<call function="'copyFile'">
|
{
|
'srcfile' : templatePath ,
|
'destfile' : ldifPath ,
|
'remotehost' : STAF_REMOTE_HOSTNAME
|
}
|
</call>
|
|
<call function="'ldapModifyWithScript'">
|
{
|
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
|
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
|
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
|
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
|
'dsFilename' : ldifPath
|
}
|
</call>
|
|
<!--- Delete the ldif file used for moddn on remote host -->
|
<message>
|
'Delete %s on %s' % (ldifPath, STAF_REMOTE_HOSTNAME)
|
</message>
|
<call function="'deleteFile'">
|
{
|
'location' : STAF_REMOTE_HOSTNAME ,
|
'filename' : ldifPath
|
}
|
</call>
|
|
<!--- Delete locally the ldif file used for moddn -->
|
<message>
|
'Delete locally %s' % templatePath
|
</message>
|
<call function="'deleteFile'">
|
{
|
'location' : STAXServiceMachine ,
|
'filename' : templatePath
|
}
|
</call>
|
</sequence>
|
</loop>
|
|
<message>
|
'snmp_mibvalues: increment the snmp values'
|
</message>
|
|
<script>
|
key = 'dsApplIfReadOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
key = 'dsApplIfModifyRDNOps.%s' % indexLDAP
|
DEFAULT_VALUES[key] = \
|
str(int(DEFAULT_VALUES[key]) + nbLoop)
|
</script>
|
|
<message>
|
'snmp_mibvalues: check value of dsApplIfModifyRDNOps entry'
|
</message>
|
|
<call function="'compareSNMPValues'">
|
{
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'index' : indexLDAP
|
}
|
</call>
|
|
<message>
|
'snmp_mibvalues: save the snmp values'
|
</message>
|
|
<call function="'SNMPGet'">
|
{
|
'snmpVersion' : '1',
|
'snmpHost' : DIRECTORY_INSTANCE_HOST ,
|
'snmpPort' : SNMP_PORT ,
|
'snmpCommunity' : community ,
|
'snmpOIDs' : '' ,
|
'snmpStatus' : 'noError' ,
|
'snmpWalk' : 'True'
|
}
|
</call>
|
|
<script>
|
DEFAULT_VALUES = {}
|
DEFAULT_VALUES = create_table_fromoutput(STAXResult[0][1])
|
</script>
|
|
<call function="'testCase_Postamble'"/>
|
|
</sequence>
|
|
</testcase>
|
|
<!--- Activate the verbose mode -->
|
<script>
|
VERBOSE_MODE = 'True'
|
</script>
|
|
<call function="'testSuite_Postamble'"/>
|
|
</sequence>
|
|
</block>
|
|
</sequence>
|
|
</function>
|
|
</stax>
|