<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<!DOCTYPE stax SYSTEM "../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>
|
<!-- SNMP Get -->
|
<function name="SNMPGet" scope="local">
|
<function-prolog>
|
This function performs a SNMP get request
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Location of target host
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="snmpVersion" type="required">
|
<function-arg-description>
|
SNMP request version
|
</function-arg-description>
|
<function-arg-property name="type" value="version" />
|
</function-arg-def>
|
<function-arg-def name="snmpHost"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Directory server SNMP hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname" />
|
</function-arg-def>
|
<function-arg-def name="snmpPort" type="required">
|
<function-arg-description>
|
Directory server SNMP port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="snmpOIDs" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="snmpCommunity" type="required">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpUser" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpSecurityLevel" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpSecurityFile" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="snmpStatus" type="required">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="snmpValidOIDs" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<!-- Build the command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if snmpVersion:
|
STAFCmdParamsList.append('-v %s' % snmpVersion)
|
|
if snmpHost:
|
STAFCmdParamsList.append('-h %s' % snmpHost)
|
|
if snmpPort:
|
STAFCmdParamsList.append('-p %s' % snmpPort)
|
|
if snmpOIDs:
|
STAFCmdParamsList.append('-o %s' % snmpOIDs)
|
|
if snmpCommunity:
|
STAFCmdParamsList.append('-c %s' % snmpCommunity)
|
|
if snmpUser:
|
STAFCmdParamsList.append('-u %s' % snmpUser)
|
|
if snmpSecurityLevel:
|
STAFCmdParamsList.append('-l %s' % snmpSecurityLevel)
|
|
if snmpSecurityFile:
|
STAFCmdParamsList.append('-f %s' % snmpSecurityFile)
|
|
if snmpStatus:
|
STAFCmdParamsList.append('-s %s' % snmpStatus)
|
|
if snmpValidOIDs:
|
STAFCmdParamsList.append('-n %s' % snmpValidOIDs)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
STAFCmd='SNMPGet'
|
|
snmpPath = '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir)
|
cp = 'CLASSPATH=%s:%s/jdmkrt.jar:.' % (SNMP_OPENDS_JARFILE, snmpPath)
|
|
if isWindows:
|
cp = cp.replace(':', ';')
|
|
env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'" >
|
{
|
'name' : 'SNMP Get' ,
|
'command' : '%s/bin/java' % JAVA_HOME ,
|
'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
|
'location' : location ,
|
'path' : '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir),
|
'env' : env ,
|
'expectedRC' : expectedRC
|
}
|
</call>
|
|
<return>
|
STAXResult
|
</return>
|
|
</sequence>
|
</function>
|
|
<!-- SNMP Set -->
|
<function name="SNMPSet" scope="local">
|
<function-prolog>
|
This function performs a SNMP Set request
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Location of target host
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="snmpVersion" type="required">
|
<function-arg-description>
|
SNMP request version
|
</function-arg-description>
|
<function-arg-property name="type" value="version" />
|
</function-arg-def>
|
<function-arg-def name="snmpHost"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Directory server SNMP hostname or IP address
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname" />
|
</function-arg-def>
|
<function-arg-def name="snmpPort" type="required">
|
<function-arg-description>
|
Directory server SNMP port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="snmpOIDs" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="snmpCommunity" type="required">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpUser" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpSecurityLevel" type="optional">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpSecurityFile" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="snmpStatus" type="required">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="snmpValidOIDs" type="optional">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<!-- Build the command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if snmpVersion:
|
STAFCmdParamsList.append('-v %s' % snmpVersion)
|
|
if snmpHost:
|
STAFCmdParamsList.append('-h %s' % snmpHost)
|
|
if snmpPort:
|
STAFCmdParamsList.append('-p %s' % snmpPort)
|
|
if snmpOIDs:
|
STAFCmdParamsList.append('-o %s' % snmpOIDs)
|
|
if snmpCommunity:
|
STAFCmdParamsList.append('-c %s' % snmpCommunity)
|
|
if snmpUser:
|
STAFCmdParamsList.append('-u %s' % snmpUser)
|
|
if snmpSecurityLevel:
|
STAFCmdParamsList.append('-l %s' % snmpSecurityLevel)
|
|
if snmpSecurityFile:
|
STAFCmdParamsList.append('-f %s' % snmpSecurityFile)
|
|
if snmpStatus:
|
STAFCmdParamsList.append('-s %s' % snmpStatus)
|
|
if snmpValidOIDs:
|
STAFCmdParamsList.append('-n %s' % snmpValidOIDs)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
STAFCmd='SNMPSet'
|
|
snmpPath = '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir)
|
cp = 'CLASSPATH=%s:%s/jdmkrt.jar:.' % (SNMP_OPENDS_JARFILE, snmpPath)
|
|
if isWindows:
|
cp = cp.replace(':', ';')
|
|
env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'" >
|
{
|
'name' : 'SNMP Set' ,
|
'command' : '%s/bin/java' % JAVA_HOME ,
|
'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
|
'location' : location ,
|
'path' : '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir),
|
'env' : env ,
|
'expectedRC' : expectedRC
|
}
|
</call>
|
|
<return>
|
STAXResult
|
</return>
|
|
</sequence>
|
</function>
|
|
<!-- SNMP Trap listener -->
|
<function name="SNMPTrapListener" scope="local">
|
<function-prolog>
|
This function performs a SNMP Set request
|
</function-prolog>
|
<function-map-args>
|
<function-arg-def name="location"
|
type="optional"
|
default="STAF_REMOTE_HOSTNAME">
|
<function-arg-description>
|
Location of target host
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="snmpHost" type="required">
|
<function-arg-description>
|
Directory server SNMP port number
|
</function-arg-description>
|
<function-arg-property name="type" value="hostname"/>
|
</function-arg-def>
|
<function-arg-def name="snmpTrapPort" type="required">
|
<function-arg-description>
|
Directory server SNMP port number
|
</function-arg-description>
|
<function-arg-property name="type" value="Port number"/>
|
</function-arg-def>
|
<function-arg-def name="snmpTrapCommunity" type="required">
|
<function-arg-description>
|
Bind DN
|
</function-arg-description>
|
<function-arg-property name="type" value="DN"/>
|
</function-arg-def>
|
<function-arg-def name="snmpTrapNumber" type="required">
|
<function-arg-description>
|
Bind password
|
</function-arg-description>
|
<function-arg-property name="type" value="string"/>
|
</function-arg-def>
|
<function-arg-def name="expectedRC" type="optional" default="0">
|
<function-arg-description>
|
Expected return code value. Default value is 0
|
Wildcard 'noCheck' to not check the RC
|
</function-arg-description>
|
<function-arg-property name="type" value="integer"/>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<call function="'ResolveVar'" >
|
{
|
'location' : location ,
|
'type' : 'STRING',
|
'name' : 'STAF/Env/LD_LIBRARY_PATH'
|
}
|
</call>
|
<script>jstaf_jarfile = '%s/JSTAF.jar' % STAFResult</script>
|
|
<!-- Build the command -->
|
<script>
|
STAFCmdParamsList=[]
|
STAFCmdParams=''
|
|
if snmpHost:
|
STAFCmdParamsList.append('-h %s' % snmpHost)
|
|
if snmpTrapPort:
|
STAFCmdParamsList.append('-p %s' % snmpTrapPort)
|
|
if snmpTrapCommunity:
|
STAFCmdParamsList.append('-c %s' % snmpTrapCommunity)
|
|
if snmpTrapNumber:
|
STAFCmdParamsList.append('-t %s' % snmpTrapNumber)
|
|
STAFCmdParams=' '.join(STAFCmdParamsList)
|
|
STAFCmd='SNMPTrapListener'
|
|
snmpPath = '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir)
|
cp = 'CLASSPATH=%s:%s/jdmkrt.jar:%s:.' \
|
% (SNMP_OPENDS_JARFILE, snmpPath, jstaf_jarfile)
|
|
if isWindows:
|
cp = cp.replace(':', ';')
|
|
env = ['JAVA_HOME=%s' % JAVA_HOME, '%s' % cp]
|
</script>
|
|
<message>
|
'%s %s' % (STAFCmd, STAFCmdParams)
|
</message>
|
|
<call function="'runCommand'" >
|
{
|
'name' : 'SNMP Trap Listener' ,
|
'command' : '%s/bin/java' % JAVA_HOME ,
|
'arguments' : '%s %s' % (STAFCmd, STAFCmdParams) ,
|
'location' : location ,
|
'path' : '%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir),
|
'env' : env ,
|
'expectedRC' : expectedRC
|
}
|
</call>
|
|
<return>
|
STAXResult
|
</return>
|
|
</sequence>
|
</function>
|
</stax>
|