2N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
2N/A ! The contents of this file are subject to the terms of the 2N/A ! Common Development and Distribution License, Version 1.0 only 2N/A ! (the "License"). You may not use this file except in compliance 2N/A ! You can obtain a copy of the license at 2N/A ! See the License for the specific language governing permissions 2N/A ! and limitations under the License. 2N/A ! When distributing Covered Code, include this CDDL HEADER in each 2N/A ! file and include the License file at 2N/A ! add the following below this CDDL HEADER, with the fields enclosed 2N/A ! by brackets "[]" replaced with your own identifying information: 2N/A ! Portions Copyright [yyyy] [name of copyright owner] 2N/A ! Copyright 2007-2008 Sun Microsystems, Inc. 2N/A <
function name="copyFile">
2N/A This function copies a source file to destination file to host
2N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2N/A <
function-
arg-
description>
2N/A Location of target host
2N/A </
function-
arg-
description>
2N/A <
function-
arg-
property name="type" value="hostname"/>
2N/A <
function-
arg-
def name="remotehost" type="optional" default="STAXServiceMachine">
2N/A <
function-
arg-
description>
2N/A The name of remote host (default localhost)
2N/A </
function-
arg-
description>
2N/A <
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="srcfile" type="required">
<
function-
arg-
description>
The name of the source fule
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="destfile" type="required">
<
function-
arg-
description>
The name of the destination fule
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
stafcmd name="'STAF Command: Copy File'">
<
location>'%s' % location</
location>
<
request>'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcfile,destfile,remotehost) </
request>
<
call function="'checkRC'">
<
return>[cmdRC,cmdResult]</
return>
<
function name="CopyFolderByExtension">
Copies files by extension from a source to destination folder on host
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="remotehost" type="optional" default="location">
<
function-
arg-
description>
The name of remote host (default same as location)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="srcfolder" type="required">
<
function-
arg-
description>
The name of the source folder
</
function-
arg-
description>
<
function-
arg-
property name="type" value="foldername"/>
<
function-
arg-
def name="destfolder" type="required">
<
function-
arg-
description>
The name of the destination file
</
function-
arg-
description>
<
function-
arg-
property name="type" value="foldername"/>
<
function-
arg-
def name="extension" type="optional" default="'txt'">
<
function-
arg-
description>
The name of the file extension (default txt)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="file extension"/>
<
stafcmd name="'STAF Command: Copy all %s Files.' % (extension)">
<
location>'%s' % location</
location>
<
request>'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s EXT %s RECURSE' % (srcfolder,destfolder,remotehost,extension) </
request>
<
call function="'checkRC'">
<
function name="zipUpFile">
This function zips up a folder
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="zipfile" type="required">
<
function-
arg-
description>
Name of the file to place zip file contents
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="folder" type="required">
<
function-
arg-
description>
Name of destination folder to place zip file contents
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="relativeto" type="required">
<
function-
arg-
description>
Folder that the zip archive is relative to
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
stafcmd name="'STAF Command: Zip Up Folder'">
<
location>'%s' % location</
location>
'ADD ZIPFILE %s DIRECTORY %s RECURSE RELATIVETO %s' % (zipfile,folder,relativeto)
<
call function="'checkRC'">
<
function name="unZipFile">
This function unzips a compressed zip archive
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="zipfile" type="required">
<
function-
arg-
description>
Name of the file to place zip file contents
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="unzipdir" type="required">
<
function-
arg-
description>
Name of destination folder to place zip file contents
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
stafcmd name="'STAF Command: Unzip File'">
<
location>'%s' % location</
location>
'UNZIP ZIPFILE %s TODIRECTORY %s RESTOREPERMISSION REPLACE' % (zipfile,unzipdir)
<
call function="'checkRC'">
<
function name="deleteFile">
This function deletes a file
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="filename" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
stafcmd name="'STAF Command: Delete Existing File'">
<
location>'%s' % location</
location>
'GET ENTRY %s TYPE' % (filename)
'Success: File does not exist, dont delete it.'
'Success: File does exists, will delete it'
<
stafcmd name="'STAF Command: Delete Existing File'">
<
location>'%s' % location</
location>
'DELETE ENTRY %s CONFIRM' % filename
<
call function="'checkRC'">
<
function name="deleteFolder">
This function recursively deletes a folder
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="foldername" type="required">
<
function-
arg-
description>
Name of folder to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
stafcmd name="'STAF Command: Get Folder Attributes'">
<
location>'%s' % location</
location>
<
request>'GET ENTRY %s TYPE' % foldername</
request>
'Folder does not exist, do not delete it.'
'Folder exists, will delete it'
<
stafcmd name="'STAF Command: Recursively Delete Folder'">
<
location>'%s' % location</
location>
'DELETE ENTRY %s RECURSE IGNOREERRORS CONFIRM' % (foldername)
<
call function="'checkRC'">
<
function name="createFolder">
This function creates a folder
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="foldername" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
stafcmd name="'STAF Command: Create Folder'">
<
location>'%s' % location</
location>
'CREATE DIRECTORY %s FULLPATH' % foldername
<
call function="'checkRC'">
<
function name="queryLogs">
Queries the staf logs from startfrom point
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="logname" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="startfrom" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="timestamp"/>
<
function-
arg-
def name="endat" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="timestamp"/>
<
block name="'Query Logs'">
<
stafcmd name="'STAF Command: Log Query for Test Case Log.'">
<
location>'%s' % location</
location>
<
request>'QUERY ALL MACHINE %s LOGNAME %s FROM %s TO %s' % (location,logname,startfrom,endat)</
request>
Sets a variable in the staf var service
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="type" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="variable"/>
<
function-
arg-
def name="variable" type="required">
<
function-
arg-
description>
Name of file to be deleted
</
function-
arg-
description>
<
function-
arg-
property name="type" value="variable"/>
<
message>'Set %s Variable %s' % (type,variable)</
message>
<
stafcmd name="'STAF Command: Set Var.'">
<
location>'%s' % location</
location>
<
request>'SET %s VAR %s' % (type,variable)</
request>
Gets a variable in the staf var service
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="type" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="variable"/>
<
function-
arg-
def name="variable" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="variable"/>
<
message>'Get %s Variable %s' % (type,variable)</
message>
<
stafcmd name="'STAF Command: Get Var.'">
<
location>'%s' % location</
location>
<
request>'GET %s VAR %s' % (type,variable)</
request>
<
function name="ResolveVar">
Resolve a variable in the staf var service
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="type" type="required">
<
function-
arg-
description>
Type of string to be resolved
</
function-
arg-
description>
<
function-
arg-
property name="type" value="variable"/>
<
function-
arg-
def name="name" type="required">
<
function-
arg-
description>
Name of string to be resolved
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
message>'Resolve %s Variable %s' % (type, name)</
message>
<
stafcmd name="'STAF Command: Resolve Var.'">
<
location>'%s' % location</
location>
<
request>'RESOLVE %s {%s}' % (type, name)</
request>
<
function name="GetEntry">
Retrieves an attribute of a file system entry
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="entry" type="required">
<
function-
arg-
description>
Name of entry to retrieve attributes
</
function-
arg-
description>
<
function-
arg-
property name="type" value="variable"/>
<
function-
arg-
def name="attribute" type="required">
<
function-
arg-
description>
Type of attributes to be retrieved
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
message>'Retrieve attribute %s for %s.' % (attribute,entry)</
message>
<
stafcmd name="'STAF Command: Get Entries Attributes'">
<
location>'%s' % location</
location>
<
request>'GET ENTRY %s %s' % (entry,attribute)</
request>
<
return>[cmdRC,cmdResult]</
return>
<
function name="listFolder">
This function lists a folder
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="foldername" type="required">
<
function-
arg-
description>
Name of folder to be list
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="filename" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
stafcmd name="'STAF Command: list Folder Attributes'">
<
location>'%s' % location</
location>
<
request>' LIST DIRECTORY %s NAME %s LONG ' % (foldername,filename)</
request>
<
call function="'checkRC'">
<!-- List a folder by extension --> <
function name="listFolderByExtension" scope="local">
This function lists a folder by extension
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="foldername" type="required">
<
function-
arg-
description>
Name of folder to be list
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filepath"/>
<
function-
arg-
def name="extension" type="required">
<
function-
arg-
description>
he name of the file extension (default txt)
</
function-
arg-
description>
<
function-
arg-
property name="type" value="file extension"/>
<
stafcmd name="'STAF Command: list folder by extension'">
<
location>'%s' % location</
location>
<
request>' LIST DIRECTORY %s EXT %s ' % (foldername,extension)</
request>
cmdResult = 'Folder does not exist.'
<
call function="'checkRC'">
<
return>cmdResult</
return>
<
function name="getFile">
This function get the contents of a file
<
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="filename" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="filename"/>
<
function-
arg-
def name="type" type="optional" default="'text'">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
function-
arg-
def name="format" type="optional" default="'native'">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
stafcmd name="'STAF Command: Get File'">
<
location>'%s' % location</
location>
'GET FILE %s %s FORMAT %s' % (filename,type,format)
<
return>[cmdRC,cmdResult]</
return>
<
function name="SendEvent" scope="local">
<
function-
arg-
def name="location" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="name" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
message>'Send Event %s on %s' % (name, location)</
message>
<
stafcmd name="'STAF Command: Send Event.'">
<
location>'%s' % location</
location>
<
request>'PULSE EVENT %s' % name</
request>
<
function name="WaitEvent" scope="local">
<
function-
arg-
def name="location" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="name" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
message>'Wait Event %s on %s' % (name, location)</
message>
<
stafcmd name="'STAF Command: Wait Event.'">
<
location>'%s' % location</
location>
<
request>'WAIT EVENT %s' % name</
request>
<
function name="DeleteEvent" scope="local">
<
function-
arg-
def name="location" default="STAXServiceMachine">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="hostname"/>
<
function-
arg-
def name="name" type="required">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="string"/>
<
message>'Delete Event %s on %s' % (name, location)</
message>
<
stafcmd name="'STAF Command: Delete Event.'">
<
location>'%s' % location</
location>
<
request>'DELETE EVENT %s' % name</
request>