snmp.xml revision 3951
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<?xml version="1.0" encoding="UTF-8" standalone="no"?>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! CDDL HEADER START
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! The contents of this file are subject to the terms of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! Common Development and Distribution License, Version 1.0 only
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! (the "License"). You may not use this file except in compliance
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! You can obtain a copy of the license at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! See the License for the specific language governing permissions
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! When distributing Covered Code, include this CDDL HEADER in each
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! file and include the License file at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! add the following below this CDDL HEADER, with the fields enclosed
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! by brackets "[]" replaced with your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! Portions Copyright [yyyy] [name of copyright owner]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! CDDL HEADER END
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ! Copyright 2008 Sun Microsystems, Inc.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- SNMP Get -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster This function performs a SNMP get request
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Location of target host
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpVersion" type="required">
669362f1b4a40a59cfe461728c8765dbdf63159fPhill Cunnington SNMP request version
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="version" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP hostname or IP address
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpPort" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP port number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="Port number"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpOIDs" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP OID to query
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpCommunity" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpUser" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP user used for v3 requests
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpSecurityLevel" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP security level used for v3 requests
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpSecurityFile" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Path to the SNMP security file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpStatus" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected status of the SNMP request
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpValidOIDs" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Check if the values returned for the OIDs are correct
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpWalk" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Perform a walk request
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="expectedRC" type="optional" default="0">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected return code value. Default value is 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Wildcard 'noCheck' to not check the RC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="integer"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Build the command -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList=[]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=''
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpVersion:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-v %s' % snmpVersion)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpHost:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-h %s' % snmpHost)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpPort:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-p %s' % snmpPort)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpOIDs:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-o %s' % snmpOIDs)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpCommunity:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-c %s' % snmpCommunity)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpUser:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-u %s' % snmpUser)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpSecurityLevel:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-l %s' % snmpSecurityLevel)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpSecurityFile:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-f %s' % snmpSecurityFile)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpStatus:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-s %s' % snmpStatus)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpValidOIDs:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-n %s' % snmpValidOIDs)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpWalk:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-w %s' % snmpWalk)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=' '.join(STAFCmdParamsList)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmd='SNMPGet'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if is_windows_platform(location):
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster separator=';'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster separator=':'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opends_jarfile='%s/%s' % (DIRECTORY_INSTANCE_DIR,SNMP_OPENDS_JARFILE)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if os.path.exists(emma_jarfile):
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cp = 'CLASSPATH=%s%s%s%s%s%s.' \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster % (opends_jarfile,separator,jdmk_jarfile,separator,emma_jarfile,separator)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cp = 'CLASSPATH=%s%s%s%s.' \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster % (opends_jarfile,separator,jdmk_jarfile,separator)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster '%s %s' % (STAFCmd, STAFCmdParams)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'name' : 'SNMP Get' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'envCmd' : env ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'expectedRC' : expectedRC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- SNMP Set -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster This function performs a SNMP Set request
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Location of target host
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname"/>
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts <function-arg-def name="snmpVersion" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP request version
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="version" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP hostname or IP address
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpPort" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP port number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="Port number"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpOIDs" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP OID to query
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts <function-arg-def name="snmpCommunity" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpUser" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP user used for v3 requests
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts <function-arg-def name="snmpSecurityLevel" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP security level used for v3 requests
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpSecurityFile" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Path to the SNMP security file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpStatus" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected status of the SNMP request
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpValidOIDs" type="optional">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Check if the values returned for the OIDs are correct
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="expectedRC" type="optional" default="0">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected return code value. Default value is 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Wildcard 'noCheck' to not check the RC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="integer"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Build the command -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList=[]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=''
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpVersion:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-v %s' % snmpVersion)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpHost:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-h %s' % snmpHost)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpPort:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-p %s' % snmpPort)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpOIDs:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-o %s' % snmpOIDs)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpCommunity:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-c %s' % snmpCommunity)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpUser:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-u %s' % snmpUser)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpSecurityLevel:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-l %s' % snmpSecurityLevel)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpSecurityFile:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-f %s' % snmpSecurityFile)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpStatus:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-s %s' % snmpStatus)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpValidOIDs:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-n %s' % snmpValidOIDs)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=' '.join(STAFCmdParamsList)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmd='SNMPSet'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if is_windows_platform(location):
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster separator=';'
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts separator=':'
f6d3e8d6653f14cfd38ebbbeac75a12a8536f0c7James Phillpotts opends_jarfile='%s/%s' % (DIRECTORY_INSTANCE_DIR,SNMP_OPENDS_JARFILE)
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts if os.path.exists(emma_jarfile):
a2b64c9e3378d4d0127e550f5d19286f37d42011James Phillpotts cp = 'CLASSPATH=%s%s%s%s%s%s.' \
a2b64c9e3378d4d0127e550f5d19286f37d42011James Phillpotts % (opends_jarfile,separator,jdmk_jarfile,separator,emma_jarfile,separator)
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts cp = 'CLASSPATH=%s%s%s%s.' \
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts % (opends_jarfile,separator,jdmk_jarfile,separator)
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts '%s %s' % (STAFCmd, STAFCmdParams)
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts 'name' : 'SNMP Set' ,
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts 'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts 'location' : location ,
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts 'envCmd' : env ,
d135fba117a27e6d0de2f5518a274bba4c0a38efJames Phillpotts 'expectedRC' : expectedRC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- SNMP Trap listener -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function name="SNMPTrapListener" scope="local">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster This function performs a SNMP Set request
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Location of target host
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpHost" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP port number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpTrapPort" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP port number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="Port number"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpTrapCommunity" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SNMP trap community
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpTrapNumber" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Number of expected traps
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="outputFile" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster File to which the output should be written
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="filename"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="expectedRC" type="optional" default="0">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected return code value. Default value is 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Wildcard 'noCheck' to not check the RC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="integer"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'type' : 'STRING',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if is_windows_platform(location):
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster jstaf_jarfile='%s\bin\JSTAF.jar' % STAFResult
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Build the command -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList=[]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=''
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpHost:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-h %s' % snmpHost)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpTrapPort:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-p %s' % snmpTrapPort)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpTrapCommunity:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-c %s' % snmpTrapCommunity)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if snmpTrapNumber:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-t %s' % snmpTrapNumber)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=' '.join(STAFCmdParamsList)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmd='SNMPTrapListener'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if is_windows_platform(location):
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster separator=';'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster separator=':'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opends_jarfile='%s/%s' % (DIRECTORY_INSTANCE_DIR,SNMP_OPENDS_JARFILE)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cp = 'CLASSPATH=%s%s%s%s%s%s.' \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster % (opends_jarfile,separator,jdmk_jarfile,separator,jstaf_jarfile,separator)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster '%s %s' % (STAFCmd, STAFCmdParams)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'name' : 'SNMP Trap Listener' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'path' : snmpPath ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'envCmd' : env ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'outputFile' : outputFile ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'expectedRC' : expectedRC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Restart SNMP Connection Handler -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function name="restartSNMPConnectionHandler" scope="local">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster This function restart the SNMP Connection Handler using dsconfig
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Location of target host
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Pathname to installation root
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="filepath" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server hostname or IP address
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="DIRECTORY_INSTANCE_ADMIN_PORT">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server admin port number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="Port number" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="dsInstanceDn" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="DN" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="dsInstancePswd" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Bind password
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="expectedRC" type="optional" default="0">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected return code value. Default value is 0.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Wildcard 'noCheck' to not check the RC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="knownIssue" type="optional" default="None">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Known issue. Corresponds to an issue number.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Build the command -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList=[]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=''
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster dsBinPath='%s/%s' % (dsPath,fileFolder)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if dsInstanceHost:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-h %s' % dsInstanceHost)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if dsInstanceAdminPort:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-p %s' % dsInstanceAdminPort)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if dsInstanceDn:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-D "%s"' % dsInstanceDn)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if dsInstancePswd:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('-w "%s"' % dsInstancePswd)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('set-connection-handler-prop')
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParamsList.append('--handler-name "SNMP Connection Handler"')
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmdParams=' '.join(STAFCmdParamsList)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster STAFCmd='%s/%s%s' % (dsBinPath,DSCONFIG,fileExt)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'name' : 'Disable the SNMP Connection Handler' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'command' : STAFCmd ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'arguments' : '%s --set enabled:false' % STAFCmdParams ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'expectedRC': expectedRC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'name' : 'Enable the SNMP Connection Handler' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'command' : STAFCmd ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'arguments' : '%s --set enabled:true' % STAFCmdParams ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'expectedRC': expectedRC ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'knownIssue': knownIssue
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Compare SNMP values -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function name="compareSNMPValues" scope="local">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster This function compare SNMP Values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Location of target host
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server hostname or IP address
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpPort" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Directory server SNMP port number
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="Port number"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="snmpCommunity" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="index" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="expectedRC" type="optional" default="0">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Expected return code value. Default value is 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Wildcard 'noCheck' to not check the RC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="integer"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'get the current mib values'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpVersion' : '1',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpHost' : snmpHost ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpPort' : snmpPort ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpCommunity' : snmpCommunity ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpOIDs' : '' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpStatus' : 'noError' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'snmpWalk' : 'True' ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'expectedRC' : expectedRC
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster CURRENT_VALUES = {}
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster CURRENT_VALUES = create_table_fromoutput(STAXResult[0][1])
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster result = compare_snmp_values(DEFAULT_VALUES, CURRENT_VALUES, index)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'result: %s' % result
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'returnString' : result ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'testString' : 'ERROR'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <!-- Check timer result -->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function name="checkTimerResult" scope="local">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster This function compare SNMP Values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster type="optional"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster default="STAF_REMOTE_HOSTNAME">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Location of target host
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="hostname" />
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="outputFile" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster File containing output
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="timerDuration" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Timer duration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="timerRC" type="required">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Return code value of the timer
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="integer"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-def name="issue" type="optional" default="None">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Issue id. Corresponds to an issue number.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <function-arg-property name="type" value="string"/>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'Process TrapListener ended before timer duration: %s' \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster % timerDuration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <request>'DELETE ENTRY %s CONFIRM' % outputFile</request>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'Process TrapListener still running after timer duration: %s' \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster % timerDuration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <stafcmd name="'Get output from TrapListener'">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <log message="1">'Output:%s' % STAFResult</log>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <request>'DELETE ENTRY %s CONFIRM' % outputFile</request>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'STAF %s FS GET FILE %s failed with RC=%s Result=%s' % \
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster (location, outputFile, RC, STAFResult)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'Delete event from the trap listener'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'Delete event from the trap listener'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'location' : location ,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster { 'issueId' : issue }