예제 #1
0
    def set_args (self, **kwargs):
        """ Set attributes for tims
        
        Parameters
        ----------
        dnsname : str
            TIMS token id
        attributes : list
            TIMS global attributes
        post : dict
            Status of ATS TIMS importer (if invoked) including the number of tests that were successfully posted to TIMS
        bgPost : bool
            The attribute tracks is the posting to TIMS is done actively or is posted as an independent background task

        Returns
        -------
        """

        args_def = [
                ('dnsname', 0,  str),
                ('attributes', 0, list),
                ('post', 0,  dict),
                ('bgPost',0,bool),
                    ]
        ArgsValidator.validate(args_def, **kwargs)
        if 'bgPost' in kwargs:
            self.attrs['bgPost'] = kwargs['bgPost']
        if 'dnsname' in kwargs:
            self.dnsname = kwargs['dnsname']
        if 'post' in kwargs:
            self.post.set_args(**kwargs['post'])
        if 'attributes' in kwargs:
            for element in kwargs['attributes']:
                self.attributes.append(TimsAttribute())
                self.attributes[-1].set_args(**element)
예제 #2
0
    def set_args(self, **kwargs):
        """ Set log file attributes
        
        Parameters
        ----------
        md5 : str
            Md5Id is calculated based on testcase name, test 
            parameters, testbed name etc to ensure uniqueness
        variance : str
            Variance id is the same as TIMS config id. There cannot be
            a variance id at testcase level if it contains subtests.
            In such case the variance id will be part of subtest.
        tims : dict
            Tims id which is created and stored in TIMS
        testplan : str
            Test Plan id which should be an EDCS number
        """

        args_def = [('md5', 0, str), ('variance', 0, str), ('tims', 0, dict),
                    ('testplan', 0, str)]
        ArgsValidator.validate(args_def, **kwargs)

        if 'md5' in kwargs:
            self.attrs['md5'] = kwargs['md5']
        if 'variance' in kwargs:
            self.variance = kwargs['variance']
        if 'tims' in kwargs:
            self.tims = IdTims()
            self.tims.set_args(**kwargs['tims'])
        if 'testplan' in kwargs:
            self.testplan = kwargs['testplan']
        if 'name' in kwargs:
            self.attrs['name'] = self.idtypevalue = kwargs['name']
예제 #3
0
    def set_args(self, **kwargs):
        """ Set testsuite initinfo attributes
        
        Parameters
        ----------
        path : str
            The location of the ATS tree in which the test script is run.
        version : str
            The release version string found in the VERSION file of the root of the ATS tree
        packages : list    
            List of package names and corresponding version loaded

        Returns
        -------
        """
        args_def = [
            ('path', 0, str),
            ('version', 0, str),
            ('packages', 0, list),
        ]
        ArgsValidator.validate(args_def, **kwargs)
        if 'path' in kwargs:
            self.path = kwargs['path']
        if 'version' in kwargs:
            self.version = kwargs['version']
        if 'packages' in kwargs:
            for name, version in kwargs['packages']:
                self.packages.append(
                    ATSPackage(**{
                        'name': name,
                        'version': version
                    }))
예제 #4
0
    def add_testsection (self, **kwargs):
        """
        Create a testsection (TestSection) and append it to
        the sections list.

        Parameters
        ----------
        sectionid : str
            The id of the section to be created. This is set once
            and never overwritten
        logfilepath : str
            Path to the log file for the testcase
        name : str
            Name of the testsection

        Returns
        -------
            str or None
                Return the section if common<..> else return None

        """
        args_def = [
            ('sectionid', 1, str),
#            ('logfilepath', 1, str),
            ('name', 0, str),
            ('xref', 0, dict),
            ('id', 0, dict),
                    ]
        ArgsValidator.validate(args_def, **kwargs)

        if 'sectionid' in kwargs:
            section = TestSection(kwargs['sectionid'])
            section.set_args(**kwargs)
            if 'commonSetup' in kwargs['sectionid']:
                self.commonSetup.append(section)
                return section
            if 'commonVerify' in kwargs['sectionid']:
                self.commonVerify.append(section)
                return section
            if 'commonCleanup' in kwargs['sectionid']:
                self.commonCleanup.append(section)
                return section
            if 'commonModify' in kwargs['sectionid']:
                self.commonModify.append(section)
                return section
        return None
예제 #5
0
 def set_args(self, **kwargs):
     """ Set testsuite initinfo attributes
     
     Parameters
     ----------
     comment : str or int
         Comment for the run
     diag : str
         Diag for the run
     error : str
         Error for the run
     userdef: str
         User defined tag
     pause : str
         pause
     unpause: str
         Unpause
         
     """
     args_def = [('comment', 0, str), ('diag', 0, str), ('error', 0, dict),
                 ('userDef', 0, dict), ('pause', 0, dict),
                 ('unpause', 0, [int, str])]
     ArgsValidator.validate(args_def, **kwargs)
     if 'comment' in kwargs:
         self.comments.append(kwargs['comment'])
     if 'diag' in kwargs:
         self.diags.append(kwargs['diag'])
     if 'error' in kwargs:
         self.errors.append(XRef('error'))
         self.errors[-1].set_args(**kwargs['error'])
     if 'abort' in kwargs:
         self.abort = Abort()
         self.abort.set_args(**kwargs['abort'])
     if 'userDef' in kwargs:
         self.userDefs.append(UserDef())
         self.userDefs[-1].set_args(**kwargs['userDef'])
     if 'pause' in kwargs:
         if self.pauses == [] or self.pauses[-1].isstopped():
             self.pauses.append(Pause())
         self.pauses[-1].set_args(**kwargs['pause'])
     if 'unpause' in kwargs:
         if self.pauses[-1].isstarted():
             self.pauses[-1].stop()
         else:
             print('Warning : Unpausing without having a pause is not'
                   ' permitted')
예제 #6
0
    def add_testcase (self, **kwargs):
        """
        Create a testcase (TestResult) and append it to
        the testcases list.

        Parameters
        ----------
        tcid : str
            The id of the testcase to be created. This is set once
            and never overwritten
        variance : str
            Optional -  Variance id is the same as TIMS config id.
            There cannot be a variance id at testcase level if it
            contains subtests. In such case the variance id will
            be part of subtest.
        name : str
            Name of the testcase/subtest which is equivalent
            of the Title attribute in TIMS
        xref : dict
            xRef
        id : dict
            id of the testcase

        """
        args_def = [
            ('tcid', 1, str),
            ('logfilepath', 1, str),
            ('variance', 0, str),
            ('name', 0, str),
            ('xref', 0, dict),
            ('id', 0, dict),
                    ]
        ArgsValidator.validate(args_def, **kwargs)
        tc = TestResult(**kwargs)
        tc.set_args(**kwargs)
        self.testcases.append(tc)
        return tc
예제 #7
0
 def set_args (self, **kwargs):
     """ Set params and children attributes (Report, SEM, MaxLimit)
     
     Parameters
     ----------
     type : str
         one of autotest, ats_easy, easypy, detail, or  summary. In future we may add "html" type.
     sort : bool
         Enable/disable reporting of results in sorted order
     outofrange : bool
         Enable/disable reporting of out of range tasks
     uniquesuites : bool
         Enable/disable reporting of test suites as consolidated or
         as unique when same suite is run multiple times with different
         parameters
     sem : dict
         Sem
     """
     args_def = [
             # initinfo
             ('type', 0,  str),
             ('sort', 0, bool),
             ('outofrange', 0, bool),
             ('uniquesuites', 0, bool),
             ('sem', 0, dict),
                 ]
     ArgsValidator.validate(args_def, **kwargs)
     if 'type' in kwargs:
         self.type = kwargs['type']
     if 'sort' in kwargs:
         self.sort = kwargs['sort']
     if 'outofrange' in kwargs:
         self.outofrange = kwargs['outofrange']
     if 'uniquesuites' in kwargs:
         self.uniquesuites = kwargs['uniquesuites']
     if 'sem' in kwargs:
         self.sem.set_args(**kwargs['sem'])
예제 #8
0
 def set_args(self, **kwargs):
     """
     Set name, criteria and type of aehandler.
     
     Parameters
     ----------
     name : str
         Script name
     path : str
         Script Path
     scm : dict
         SCM info where the testscript is
         checked in
     version : str
         Script Version
         
     Returns
     -------
     
     """
     args_def = [
         ('name', 0, str),
         ('path', 0, str),
         ('scm', 0, dict),
         ('version', 0, str),
     ]
     ArgsValidator.validate(args_def, **kwargs)
     if 'name' in kwargs:
         self.name = kwargs['name']
     if 'path' in kwargs:
         self.path = kwargs['path']
     if 'scm' in kwargs:
         if not self.scm:
             self.scm = SCM()
         self.scm.set_args(**kwargs['scm'])
     if 'version' in kwargs:
         self.version = kwargs['version']
예제 #9
0
    def set_args (self, **kwargs):
        """ Set testscript set_args


        Parameters
        ----------
        # Initinfo
        script : dict
            CLI paramerters passed to test script
        pargs : str
            CLI paramerters passed to test script
        taskid : str
            TaskId is set for easypy runs only; for stand-alone mode, it
            would be null. This value is internally set by aetest::script_init
            API
        description : str
            Description for the testscript
        logfile : dict
            File in which the test script logs are saved
        swversion : str
            software version
        hwversion : str
            hardware version
        tstversion : str
            testscript version
        aehandlers : str
            aetest testcase or section handlers
        initinfo : dict
            Initinfo
        runinfo : dict
            runinfo

        Note
        ----
        Clean is not supported by aetest,  hence not supported by aereport.
        However, the clean API is working,  and can be easily enhanced to
        support clean in testscript. It is working right now for testsuite.

        """

        args_def = [
                # initinfo
                ('script',0,dict),
                ('pargs',0,str),
                ('taskid',0,str),
                ('description',0,str),
                ('logfile',0,dict),
                ('swversion',0,str),
                ('hwversion',0,str),
                ('aehandlers',0,dict),
                # runinfo
                ('abort', 0, dict),
                ('comment', 0, str),
                ('diag', 0, str),
                ('error', 0, dict),
                ('userDef', 0, dict),
                ('pause', 0, dict),
                ('unpause', 0, [int, str]),
                   ]

        ArgsValidator.validate(args_def, **kwargs)

        # SetInitInfo
        self.initinfo.set_args(**kwargs)

        # SetRunInfo
        self.runinfo.set_args(**kwargs)
예제 #10
0
 def set_args (self, **kwargs):
     """ Set testsuite initinfo attributes
     
     Parameters
     ----------
     name : str
         Name of the testsuite
     params : dict
         internally calculated "final" values of various parameters
         based on CLI, control and CONFIG files (_easySetKey / _easyGetKey)
     report : dict
         Report for easypy/ats_easy/autotest
     logfile : dict
         File in which the job logs are saved
     release : str
         What is the release
     image : str
         path to image
     submitter : str
         Who submitted the testsuite
     tbautoselect : str
         List of Testbed names selected
     testbed : str
         Testbed selected
     jobid : str
         JobId is set for easypy runs only
     CONFIG : str
         Full path of CONFIG file that has been sourced
     host : str
         This is the value of TestHost keyword in autoetest context
         and TRPhosts for easypy context. It is the host on which easypy is executed.
     owner : str
         Owner of easypy (unix) process
     topology : str
         See Topomap xml schema for details -- testbed and device info will be populated from CONFIG file
     ats : dict
         ATS tree info
         
     Returns
     -------
     """
     args_def = [
             # initinfo
             ('name', 0, str),
             ('params', 0,  dict),
             ('logfile', 0, dict),
             ('release', 0, str),
             ('image', 0, str),
             ('submitter', 0, str),
             ('tbautoselect', 0, str),
             ('testbed', 0, str),
             # Stuff not in aereport::initinfo
             ('jobid', 0, str),
             ('CONFIG', 0, str),
             ('host', 0, str),
             ('owner', 0, str),
             ('topology', 0, str),
             ('ats',0, dict),
                 ]
     ArgsValidator.validate(args_def, **kwargs)
     if 'name' in kwargs:
         self.name = kwargs['name']
     if 'params' in kwargs:
         self.params.set_args(**kwargs['params'])
     if 'logfile' in kwargs:
         self.logfile.set_args(**kwargs['logfile'])
     if 'release' in kwargs:
         self.release = kwargs['release']
     if 'image' in kwargs:
         self.image = kwargs['image']
     if 'submitter' in kwargs:
         self.submitter = kwargs['submitter']
     if 'tbautoselect' in kwargs:
         self.tbautoselect = kwargs['tbautoselect']
     if 'testbed' in kwargs:
         self.testbed = kwargs['testbed']
     if 'jobid' in kwargs:
         self.jobid = kwargs['jobid']
     if 'CONFIG' in kwargs:
         self.CONFIG = kwargs['CONFIG']
     if 'host' in kwargs:
         self.hosts.append(kwargs['host'])
     if 'owner' in kwargs:
         self.owner = kwargs['owner']
     if 'topology' in kwargs:
         self.topology = kwargs['topology']
     if 'ats' in kwargs:
         self.ats.set_args(**kwargs['ats'])
예제 #11
0
    def set_args (self, **kwargs):
        """ Set params and children attributes (Report, SEM, MaxLimit)
        
        Parameters
        ----------
        cli : str
            CLI paramerters passed to easypy
        mailto : str
            List of users and mailing lists for e-mail notification
        report : dict
            Report for testsuite
        rerun : bool 
            Enable/disable rerun mode
        cleantype : str
            Default value should be easyclean
        uniquetid : str
            Enable/disable use of md5id for tid uniqueness    
        max : dict
            Max errors and max jobs
        reason : str
            List of tasks or suite lines requested for run
        runchoice : str
            Choice between tidRange/runLines
        runchoicevalue : str
            Value of the above
        pause : str
            The trigger value for pause: pass/fail
        controlfile : str
            Path and file name of queue file or control file
        rerunfile : str
            Name of rerun file if it exists
        type : str
            one of autotest, ats_easy, easypy, detail, or  summary. In future we may add "html" type.
        sort : bool
            Enable/disable reporting of results in sorted order
        outofrange : bool
            Enable/disable reporting of out of range tasks
        uniquesuites : bool
            Enable/disable reporting of test suites as consolidated or
            as unique when same suite is run multiple times with different
            parameters
        sem : dict
            -
        alignment : bool
            Enable/disable reporting of SEM alignment errors
        traceback : bool
            Enable/disable reporting of SEM traceback errors
        errors : str
             max errors (default is 10)    
        jobs : str
            max jobs to fork per easypy harness (default is -1 no limit)

        Returns
        -------
        """
        args_def = [
                # initinfo
                ('cli', 0,  str),
                ('mailto', 0, str),
                ('report', 0, dict),
                ('rerun', 0, bool),
                ('cleantype', 0, str),
                ('uniquetid', 0, str),
                ('max', 0, dict),
                ('reason', 0, str),
                ('runchoice', 0, str),
                ('runchoicevalue', 0 ,str),
                ('pause', 0, str),
                ('controlfile', 0, str),
                ('rerunfile', 0, str),
                # To allow calling report from params
                # Without using a new dictionary
                ('type', 0,  str),
                ('sort', 0, bool),
                ('outofrange', 0, bool),
                ('uniquesuites', 0, bool),
                ('sem', 0, dict),
                # To allow sem being called 
                ('alignment',0,bool),
                ('traceback',0,bool),
                ('errors',0,str),
                ('jobs',0,str),
                    ]
        ArgsValidator.validate(args_def, **kwargs)

        if 'cli' in kwargs:
            self.cli = kwargs['cli']
        if 'mailto' in kwargs:
            self.mailto = kwargs['mailto']
        if 'report' in kwargs:
            self.report.set_args(**kwargs['report'])
        if 'rerun' in kwargs:
            self.rerun = kwargs['rerun']
        # TODO ??
        if 'cleantype' in kwargs:
            self.cleantype = kwargs['cleantype']
        if 'uniquetid' in kwargs:
            self.uniquetid = kwargs['uniquetid ']
        if 'max' in kwargs:
            self.max.set_args(**kwargs['max'])
        if 'reason' in kwargs:
            self.reason = kwargs['reason']
        # TODO : Choice here?
        if 'runchoice' in kwargs:
            self.runchoice = kwargs['runchoice']
        if 'runchoicevalue' in kwargs:
            self.runchoicevalue = kwargs['runchoicevalue']
        if 'pause' in kwargs:
            self.pause = kwargs['pause']
        if 'controlfile' in kwargs:
            self.controlfile = kwargs['controlfile']
        if 'rerunfile' in kwargs:
            self.rerunfile = kwargs['rerunfile']
        # To allow calling report from params
        # Without using a new dictionary
        if 'type' in kwargs:
            self.report.type = kwargs['type']
        if 'sort' in kwargs:
            self.report.sort = kwargs['sort']
        if 'outofrange' in kwargs:
            self.report.outofrange = kwargs['outofrange']
        if 'uniquesuites' in kwargs:
            self.report.uniquesuites = kwargs['uniquesuites']
        if 'sem' in kwargs:
            self.report.sem.set_args(**kwargs['sem'])
        # To allow calling sem from params
        # Without using a new dictionary
        if 'alignment' in kwargs:
            self.report.sem.alignment = kwargs['alignment']    
        if 'traceback' in kwargs:
            self.report.sem.traceback = kwargs['traceback']    
        # To allow calling maxlimit from params
        # Without using a new dictionary
        if 'errors' in kwargs:
            self.max.errors = kwargs['errors']    
        if 'jobs' in kwargs:
            self.max.jobs = kwargs['jobs']    
예제 #12
0
    def set_args(self, **kwargs):
        """ Set testsuite set_args

        Parameters
        ----------
        archivefile : str
            Pointer to the archive log file  (if one was requested) for the job run. It should be relative to root of ATS tree.
        abort : dict
            Reports abort from user, abnormal script termination, etc.
        ats : dict
            ATS tree info
        params : dict
            internally calculated "final" values of various parameters
            based on CLI, control and CONFIG files (_easySetKey / _easyGetKey)
        report : dict
            Report for easypy/ats_easy/autotest
        logfile : dict
            File in which the job logs are saved
        release : str
            What is the release
        image : str
            path to image
        submitter : str
            Who submitted the testsuite
        tbautoselect : str
            List of Testbed names selected
        testbed : str
            Testbed selected
        jobid : str
            JobId is set for easypy runs only
        CONFIG : str
            Full path of CONFIG file that has been sourced
        host : str
            This is the value of TestHost keyword in autoetest context
            and TRPhosts for easypy context. It is the host on which easypy is executed.
        owner : str
            Owner of easypy (unix) process
        topology : str
            See Topomap xml schema for details -- testbed and device info will be populated from CONFIG file
        mailattachment: list
            Pointer to the user generated  files for attaching to e-mail report.

        Returns
        -------
        """

        args_def = [
            ('archivefile', 0, str),
            # tsabort
            ('abort', 0, dict),
            # initinfo
            ('ats', 0, dict),
            ('CONFIG', 0, str),
            ('host', 0, str),
            ('image', 0, str),
            ('jobid', 0, str),
            ('logfile', 0, dict),
            ('name', 0, str),
            ('owner', 0, str),
            ('params', 0, dict),
            ('release', 0, str),
            ('submitter', 0, str),
            ('testbed', 0, str),
            ('tbautoselect', 0, str),
            ('topology', 0, str),
            # Mailattachment
            ('mailAttachments', 0, list),
            # runinfo
            ('abort', 0, dict),
            ('comment', 0, str),
            ('diag', 0, str),
            ('error', 0, dict),
            ('userDef', 0, dict),
            ('pause', 0, dict),
            ('unpause', 0, [int, str]),
        ]

        ArgsValidator.validate(args_def, **kwargs)

        # setTsAbort
        # If already exists, do nothing
        if 'abort' in kwargs:
            if not self.abort:
                self.abort = TSAbort()
                self.abort.set_args(**kwargs['abort'])

        if 'archivefile' in kwargs:
            self.archivefile = kwargs['archivefile']

        if 'mailAttachments' in kwargs:
            self.mailAttachments.extend(kwargs['mailAttachments'])

        # SetInitInfo
        self.initinfo.set_args(**kwargs)

        # SetRunInfo
        self.runinfo.set_args(**kwargs)
예제 #13
0
    def set_args(self, **kwargs):
        """ Set InitInfo attributes
        
        Parameters
        ----------
        name : str
            initinfo/name
        description : str
            initinfo/description
        pargs : str
            initinfo/pargs
        swversion : str
            initinfo/swversion
        hwversion : str
            initinfo/hwversion
        fwversion : str
            initinfo/fwversion
        tstversion : str
            initinfo/tstversion
        platform : str
            initinfo/platform
        interface : str
            initinfo/interface
        id : dict
        uut : str
        xref : dict
        logfile : dict
        
        Returns:
            None

        
        """
        args_def = [
            # initinfo
            ('description', 0, str),
            ('fwversion', 0, str),
            ('hwversion', 0, str),
            ('swversion', 0, str),
            ('tstversion', 0, str),
            ('id', 0, dict),  # tims, name, testplan, timsCase, timsConfig, md5
            ('interface', 0, str),
            ('logfile', 0, dict),
            ('name', 0, str),
            ('pargs', 0, str),
            ('platform', 0, str),
            ('uut', 0, str),
            ('xref', 0, dict),
        ]
        ArgsValidator.validate(args_def, **kwargs)
        if 'description' in kwargs:
            self.description = kwargs['description'] or ''
        if 'fwversion' in kwargs:
            self.fwversion = kwargs['fwversion']
        if 'hwversion' in kwargs:
            self.hwversion = kwargs['hwversion']
        if 'swversion' in kwargs:
            self.swversion = kwargs['swversion']
        if 'tstversion' in kwargs:
            self.tstversion = kwargs['tstversion']
        if 'interface' in kwargs:
            self.interfaces.append(kwargs['interface'])
        if 'name' in kwargs:
            self.name = kwargs['name']
        if 'pargs' in kwargs:
            self.pargs = kwargs['pargs']
        if 'platform' in kwargs:
            self.platforms.append(kwargs['platform'])
        if 'uut' in kwargs:
            self.uuts.append(kwargs['uut'])
        if 'id' in kwargs:
            self.id.set_args(**kwargs['id'])
        if 'logfile' in kwargs:
            self.logfile.set_args(**kwargs['logfile'])
        if 'xref' in kwargs:
            self.xref.set_args(**kwargs['xref'])
예제 #14
0
    def set_args (self, **kwargs):
        """ Set testscript set_args
        
        Parameters
        ----------
        # Initinfo 
        script : dict
            CLI paramerters passed to test script
        pargs : str
            CLI paramerters passed to test script
        taskid : str
            TaskId is set for easypy runs only; for stand-alone mode, it 
            would be null. This value is internally set by aetest::script_init
            API
        description : str
            Description for the testscript
        logfile : dict
            File in which the test script logs are saved
        swversion : str
            software version
        hwversion : str
            hardware version
        tstversion : str
            testscript version
        aehandlers : str
            aetest testcase or section handlers
        runinfo : dict
            Runinfo

        Returns
        -------
        """

        args_def = [
                ('script',0,dict),
                ('pargs',0,str),
                ('taskid',0,str),
                ('description',0,str),
                ('logfile',0,dict),
                ('swversion',0,str),
                ('hwversion',0,str),
                ('tstversion',0,str),
                ('aehandlers',0,list),
                   ]

        ArgsValidator.validate(args_def, **kwargs)

        if 'script' in kwargs:
            self.script.set_args(**kwargs['script'])
        if 'pargs' in kwargs:
            self.pargs = kwargs['pargs']
        if 'taskid' in kwargs:
            self.taskid= kwargs['taskid']
        if 'description' in kwargs:
            self.description= kwargs['description']
        if 'logfile' in kwargs:
            self.logfile.set_args(**kwargs['logfile'])
        if 'swversion' in kwargs:
            self.swversion=kwargs['swversion']
        if 'hwversion' in kwargs:
            self.hwversion=kwargs['hwversion']
        if 'tstversion' in kwargs:
            self.tstversion=kwargs['tstversion']
        if 'aehandlers' in kwargs:
            for aehandler in kwargs['aehandlers']:
                self.aehandlers.append(TestScriptAEHandler(**{'name':aehandler['name'],
                                                            'criteria':aehandler['criteria'],
                                                            'type':aehandler['type']}))