| | |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpOIDs" type="optional"> |
| | | <function-arg-description> |
| | | Bind password |
| | | SNMP OID to query |
| | | </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 |
| | | SNMP community/context |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpUser" type="optional"> |
| | | <function-arg-description> |
| | | Bind DN |
| | | SNMP user used for v3 requests |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpSecurityLevel" type="optional"> |
| | | <function-arg-description> |
| | | Bind DN |
| | | SNMP security level used for v3 requests |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpSecurityFile" type="optional"> |
| | | <function-arg-description> |
| | | Bind password |
| | | Path to the SNMP security file |
| | | </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 |
| | | Expected status of the SNMP request |
| | | </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 |
| | | Check if the values returned for the OIDs are correct |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpWalk" type="optional"> |
| | | <function-arg-description> |
| | | Perform a walk request |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | |
| | | if snmpValidOIDs: |
| | | STAFCmdParamsList.append('-n %s' % snmpValidOIDs) |
| | | |
| | | if snmpWalk: |
| | | STAFCmdParamsList.append('-w %s' % snmpWalk) |
| | | |
| | | STAFCmdParams=' '.join(STAFCmdParamsList) |
| | | |
| | | STAFCmd='SNMPGet' |
| | |
| | | opends_jarfile='%s/%s' % (DIRECTORY_INSTANCE_DIR,SNMP_OPENDS_JARFILE) |
| | | snmpPath='%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir) |
| | | jdmk_jarfile='%s/jdmkrt.jar' % snmpPath |
| | | |
| | | emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) |
| | | if os.path.exists(emma_jarfile): |
| | | cp = 'CLASSPATH=%s%s%s%s%s%s.' \ |
| | | % (opends_jarfile,separator,jdmk_jarfile,separator,emma_jarfile,separator) |
| | | else: |
| | | cp = 'CLASSPATH=%s%s%s%s.' \ |
| | | % (opends_jarfile,separator,jdmk_jarfile,separator) |
| | | |
| | |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpOIDs" type="optional"> |
| | | <function-arg-description> |
| | | Bind password |
| | | SNMP OID to query |
| | | </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 |
| | | SNMP community/context |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpUser" type="optional"> |
| | | <function-arg-description> |
| | | Bind DN |
| | | SNMP user used for v3 requests |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpSecurityLevel" type="optional"> |
| | | <function-arg-description> |
| | | Bind DN |
| | | SNMP security level used for v3 requests |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpSecurityFile" type="optional"> |
| | | <function-arg-description> |
| | | Bind password |
| | | Path to the SNMP security file |
| | | </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 |
| | | Expected status of the SNMP request |
| | | </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 |
| | | Check if the values returned for the OIDs are correct |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | |
| | | opends_jarfile='%s/%s' % (DIRECTORY_INSTANCE_DIR,SNMP_OPENDS_JARFILE) |
| | | snmpPath='%s/%s/snmp' % (DIRECTORY_INSTANCE_DIR, relativeJavaDir) |
| | | jdmk_jarfile='%s/jdmkrt.jar' % snmpPath |
| | | |
| | | emma_jarfile='%s/%s/lib/emma.jar' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) |
| | | if os.path.exists(emma_jarfile): |
| | | cp = 'CLASSPATH=%s%s%s%s%s%s.' \ |
| | | % (opends_jarfile,separator,jdmk_jarfile,separator,emma_jarfile,separator) |
| | | else: |
| | | cp = 'CLASSPATH=%s%s%s%s.' \ |
| | | % (opends_jarfile,separator,jdmk_jarfile,separator) |
| | | |
| | |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpTrapCommunity" type="required"> |
| | | <function-arg-description> |
| | | Bind DN |
| | | SNMP trap community |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN"/> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="snmpTrapNumber" type="required"> |
| | | <function-arg-description> |
| | | Bind password |
| | | Number of expected traps |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | |
| | | |
| | | </sequence> |
| | | </function> |
| | | |
| | | <!-- Restart SNMP Connection Handler --> |
| | | <function name="restartSNMPConnectionHandler" scope="local"> |
| | | <function-prolog> |
| | | This function restart the SNMP Connection Handler using dsconfig |
| | | </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="dsPath" |
| | | type="optional" |
| | | default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)"> |
| | | <function-arg-description> |
| | | Pathname to installation root |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="filepath" /> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsInstanceHost" |
| | | type="optional" |
| | | default="STAF_REMOTE_HOSTNAME"> |
| | | <function-arg-description> |
| | | Directory server hostname or IP address |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="hostname" /> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsInstancePort" type="required"> |
| | | <function-arg-description> |
| | | Directory server port number |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="Port number" /> |
| | | </function-arg-def> |
| | | |
| | | <function-arg-def name="dsInstanceDn" type="required"> |
| | | <function-arg-description> |
| | | Bind DN |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="DN" /> |
| | | </function-arg-def> |
| | | <function-arg-def name="dsInstancePswd" 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="string" /> |
| | | </function-arg-def> |
| | | </function-map-args> |
| | | |
| | | <sequence> |
| | | <!-- Build the command --> |
| | | <script> |
| | | STAFCmdParamsList=[] |
| | | STAFCmdParams='' |
| | | |
| | | if dsPath: |
| | | dsBinPath='%s/%s' % (dsPath,fileFolder) |
| | | |
| | | if dsInstanceHost: |
| | | STAFCmdParamsList.append('-h %s' % dsInstanceHost) |
| | | |
| | | if dsInstancePort: |
| | | STAFCmdParamsList.append('-p %s' % dsInstancePort) |
| | | |
| | | if dsInstanceDn: |
| | | STAFCmdParamsList.append('-D "%s"' % dsInstanceDn) |
| | | |
| | | if dsInstancePswd: |
| | | STAFCmdParamsList.append('-w "%s"' % dsInstancePswd) |
| | | |
| | | STAFCmdParamsList.append('-n') |
| | | |
| | | STAFCmdParamsList.append('set-connection-handler-prop') |
| | | STAFCmdParamsList.append('--handler-name "SNMP Connection Handler"') |
| | | |
| | | STAFCmdParams=' '.join(STAFCmdParamsList) |
| | | |
| | | STAFCmd='%s/%s%s' % (dsBinPath,DSCONFIG,fileExt) |
| | | </script> |
| | | |
| | | <call function="'runCommand'"> |
| | | { |
| | | 'name' : 'Disable the SNMP Connection Handler' , |
| | | 'location' : location , |
| | | 'command' : STAFCmd , |
| | | 'arguments' : '%s --set enabled:false' % STAFCmdParams , |
| | | 'expectedRC': expectedRC |
| | | } |
| | | </call> |
| | | |
| | | <call function="'runCommand'"> |
| | | { |
| | | 'name' : 'Enable the SNMP Connection Handler' , |
| | | 'location' : location , |
| | | 'command' : STAFCmd , |
| | | 'arguments' : '%s --set enabled:true' % STAFCmdParams , |
| | | 'expectedRC': expectedRC |
| | | } |
| | | </call> |
| | | |
| | | <return> |
| | | STAXResult |
| | | </return> |
| | | |
| | | </sequence> |
| | | </function> |
| | | |
| | | <!-- Compare SNMP values --> |
| | | <function name="compareSNMPValues" scope="local"> |
| | | <function-prolog> |
| | | This function compare SNMP Values |
| | | </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="optional" |
| | | default="STAF_REMOTE_HOSTNAME"> |
| | | <function-arg-description> |
| | | Directory server 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="snmpCommunity" type="required"> |
| | | <function-arg-description> |
| | | SNMP community/context |
| | | </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> |
| | | <message> |
| | | 'get the current mib values' |
| | | </message> |
| | | |
| | | <call function="'SNMPGet'"> |
| | | { |
| | | 'location' : location , |
| | | 'snmpVersion' : '1', |
| | | 'snmpHost' : snmpHost , |
| | | 'snmpPort' : snmpPort , |
| | | 'snmpCommunity' : snmpCommunity , |
| | | 'snmpOIDs' : '' , |
| | | 'snmpStatus' : 'noError' , |
| | | 'snmpWalk' : 'True' , |
| | | 'expectedRC' : expectedRC |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | CURRENT_VALUES = {} |
| | | CURRENT_VALUES = create_table_fromoutput(STAXResult[0][1]) |
| | | |
| | | result = compare_snmp_values(DEFAULT_VALUES, CURRENT_VALUES) |
| | | </script> |
| | | |
| | | <message> |
| | | 'result: %s' % result |
| | | </message> |
| | | |
| | | <call function="'checktestStringNotPresent'"> |
| | | { |
| | | 'returnString' : result , |
| | | 'testString' : 'ERROR' |
| | | } |
| | | </call> |
| | | |
| | | <return> |
| | | STAXResult |
| | | </return> |
| | | |
| | | </sequence> |
| | | </function> |
| | | |
| | | </stax> |