示例#1
0
    def __init__(self,host,name='HTTP'):
      from com.ibm.staf import STAFHandle
      from com.ibm.staf import STAFResult

      if hasattr(staf_service, '__init__'):
        staf_service.__init__(self,host,name)

      __handle = STAFHandle("varHandle")
      __res = __handle.submit2(host, "HTTP", "Version")
      self.version=__res.result
示例#2
0
    def __init__(self,host,name='EVENTMANAGER'):
      from com.ibm.staf import STAFHandle
      from com.ibm.staf import STAFResult

      if hasattr(staf_service, '__init__'):
        staf_service.__init__(self,host,name)

      __handle = STAFHandle("varHandle")
      __cmd = 'Version'
      __res = __handle.submit2(host, "EVENTMANAGER", __cmd)      
      self.version=__res.result
示例#3
0
        def __init__(self, host):
            from com.ibm.staf import STAFHandle
            from com.ibm.staf import STAFResult

            __handle = STAFHandle("varHandle")
            __cmd = 'Version'
            __res = __handle.submit2(host, "MISC", __cmd)
            self.version = __res.result

            self.name = 'STAF'

            __cmd = 'GET SYSTEM VAR STAF/Config/STAFRoot'
            __res = __handle.submit2(host, "VAR", __cmd)
            self.root = __res.result
示例#4
0
def is_windows_platform(host):
    from java.lang import Boolean
    from com.ibm.staf import STAFHandle
    from com.ibm.staf import STAFResult

    handle = STAFHandle("varHandle")
    res = handle.submit2(host, "VAR", "GET SYSTEM VAR STAF/Config/OS/Name")

    winLower = res.result.lower()
    winNdx = winLower.find("win")
    if winNdx != -1:
        return res.result[winNdx:]
    else:
        return Boolean.FALSE
示例#5
0
    def __init__(self,host):
      from com.ibm.staf import STAFHandle
      from com.ibm.staf import STAFResult

      __handle = STAFHandle("varHandle")
      __cmd = 'Version'
      __res = __handle.submit2(host, "MISC", __cmd)      
      self.version=__res.result

      self.name='STAF'

      __cmd = 'GET SYSTEM VAR STAF/Config/STAFRoot'
      __res = __handle.submit2(host, "VAR", __cmd)
      self.root=__res.result
示例#6
0
def is_windows_platform(host):
    from java.lang import Boolean
    from com.ibm.staf import STAFHandle
    from com.ibm.staf import STAFResult

    handle = STAFHandle("varHandle") 
    res = handle.submit2(host, "VAR", "GET SYSTEM VAR STAF/Config/OS/Name")

    winLower = res.result.lower()
    winNdx = winLower.find("win")
    if winNdx != -1:
      return res.result[winNdx:]
    else:
      return Boolean.FALSE
示例#7
0
    def launch(self, remoteHost, scriptPath, port=None):

        # Launch arguments
        args = ''
        if os.environ.get('LOGLEVEL'):
            args += '--logLevel %s ' % os.environ['LOGLEVEL']

        if os.environ.get('LOGLEVEL_SCREENSHOTS'):
            args += '--screenshotLogLevel %s' % os.environ[
                'LOGLEVEL_SCREENSHOTS']

        port = self.port if not port else port

        cwd = os.getcwd()
        result = STAFHandle('prepareHost').submit2(
            'local', 'stax',
            "EXECUTE FILE %s/staxScripts/launch.xml FUNCTION Main ARGS \"{'remoteHost':'%s','scriptPath':'%s','port':'%s','args':'%s','remotePlatformPath':'%s'}\" WAIT 10m RETURNRESULT DETAILS LOGTCELAPSEDTIME Enabled LOGTCNUMSTARTS Enabled LOGTCSTARTSTOP Enabled"
            %
            (cwd, remoteHost, scriptPath, port, args, self.remotePlatformPath))

        # Get the RC code depending on failure type
        if result.rc != 0:  # STAF Failure
            rc = result.rc
            self.logResultData(
                result.resultObj,
                "STAF")  # Log the result for the executed command
        else:
            rc = int(result.resultObj.get('result'))
            self.logResultData(
                result.resultObj)  # Log the result for the executed command

        if rc != 0:
            raise Exception("Error occurred while launching script. RC=%d" %
                            rc)
示例#8
0
    def prepareHostUsingArtifacts(self, remoteHost):

        cwd = os.getcwd()
        artifactsPath = cwd + '/artifacts'
        artifacts = ','.join(os.listdir(artifactsPath))

        result = STAFHandle('prepareHost').submit2(
            'local', 'stax',
            "EXECUTE FILE %s/staxScripts/prepareHostUsingArtifacts.xml FUNCTION Main ARGS \"{'remoteHost':'%s','artifacts':'%s','artifactPath':'%s','remotePlatformPath':'%s','remoteArtifactPath':'%s'}\" WAIT 20m RETURNRESULT DETAILS LOGTCELAPSEDTIME Enabled LOGTCNUMSTARTS Enabled LOGTCSTARTSTOP Enabled"
            % (cwd, remoteHost, artifacts, artifactsPath,
               self.remotePlatformPath, self.remoteArtifactPath))

        # Get the RC code depending on failure type
        if result.rc != 0:  # STAF Failure
            self.logResultData(
                result.resultObj,
                "STAF")  # Log the result for the executed command
            rc = result.rc
        else:
            self.logResultData(
                result.resultObj)  # Log the result for the executed command
            rc = int(result.resultObj.get('result'))

        if rc != 0:
            raise Exception("Error occurred while preparing Host. RC=%d" % rc)
示例#9
0
    def collectResults(self,
                       remoteHost,
                       localPlatformPath=None,
                       testPlatformPath=None,
                       tempPath=None,
                       resultsTarballFilename=None):

        # Use member variables if the method doesn't supply them
        tempPath = self.tempPath if not tempPath else tempPath
        resultsTarballFilename = self.resultsTarballFilename if not resultsTarballFilename else resultsTarballFilename
        localPlatformPath = self.backupPath if not testPlatformPath else testPlatformPath

        cwd = os.getcwd()
        result = STAFHandle('collectResults').submit2(
            'local', 'stax',
            "EXECUTE FILE %s/staxScripts/collectResults.xml FUNCTION Main ARGS \"{'remoteHost':'%s','localPlatformPath':'%s','tempPath':'%s','tarballFilename':'%s','remotePlatformPath':'%s'}\" WAIT 5m RETURNRESULT DETAILS LOGTCELAPSEDTIME Enabled LOGTCNUMSTARTS Enabled LOGTCSTARTSTOP Enabled"
            % (cwd, remoteHost, localPlatformPath, tempPath,
               resultsTarballFilename, self.remotePlatformPath))

        # Get the RC code depending on failure type
        if result.rc != 0:  # STAF Failure
            rc = result.rc
            self.logResultData(
                result.resultObj,
                "STAF")  # Log the result for the executed command
        else:
            rc = int(result.resultObj.get('result'))
            self.logResultData(
                result.resultObj)  # Log the result for the executed command

        if rc != 0:
            raise Exception("Error occurred while creating tarball. RC=%d" %
                            rc)
示例#10
0
        def __init__(self, host, name='DSML'):
            from com.ibm.staf import STAFHandle
            from com.ibm.staf import STAFResult

            if hasattr(staf_service, '__init__'):
                staf_service.__init__(self, host, name)

            __handle = STAFHandle("varHandle")

            self.version = 'Unknown'
示例#11
0
    def pingHost(self, hostname):
        cwd = os.getcwd()
        result = STAFHandle('pingHost').submit2(hostname, 'ping', 'ping')

        if result.rc != 0:
            raise Exception("Error pinging target [%s]. RC=%d MSG=%s" %
                            (hostname, result.rc, str(result.result)))
        else:
            self.log.info(
                result.result)  # Log the result for the executed command
示例#12
0
        def __init__(self, host, name='EMAIL'):
            from com.ibm.staf import STAFHandle
            from com.ibm.staf import STAFResult
            from com.ibm.staf import STAFMarshallingContext

            if hasattr(staf_service, '__init__'):
                staf_service.__init__(self, host, name)

            __handle = STAFHandle("varHandle")
            __cmd = 'Version'
            __res = __handle.submit2(host, "EMAIL", __cmd)
            self.version = __res.result
            self.recipients = 'TODO: get from config.py'

            __res = __handle.submit2(host, "EMAIL", "LIST SETTINGS")
            __context = STAFMarshallingContext.unmarshall(__res.result)
            __entryMap = __context.getRootObject()

            self.server = __entryMap['mailServer']
            self.port = __entryMap['port']
示例#13
0
    def __init__(self,host,name='EMAIL'):
      from com.ibm.staf import STAFHandle
      from com.ibm.staf import STAFResult
      from com.ibm.staf import STAFMarshallingContext

      if hasattr(staf_service, '__init__'):
        staf_service.__init__(self,host,name)

      __handle = STAFHandle("varHandle")
      __cmd = 'Version'
      __res = __handle.submit2(host, "EMAIL", __cmd)      
      self.version=__res.result
      self.recipients= 'TODO: get from config.py'

      __res = __handle.submit2(host, "EMAIL", "LIST SETTINGS")
      __context = STAFMarshallingContext.unmarshall(__res.result)
      __entryMap = __context.getRootObject()

      self.server=__entryMap['mailServer']
      self.port=__entryMap['port']
示例#14
0
    def __init__(self, host, name):
        from com.ibm.staf import STAFHandle
        from com.ibm.staf import STAFResult
        from com.ibm.staf import STAFMarshallingContext

        self.name = name
        self.library = 'Unknown'
        self.executable = 'Unknown'
        self.options = 'Unknown'
        self.params = 'Unknown'

        try:
            __handle = STAFHandle("varHandle")
        except STAFException, e:
            pass