Пример #1
0
 def __init__(self):
     self.tag = 'initinfo'
     self.script = Script()
     self.pargs = ''
     self.taskid = ''
     self.description = ''
     self.logfile = LogFile()
     self.swversion = None # optional string
     self.hwversion = None # optional string
     self.fwversion = None # optional string
     self.tstversion = None # optional string
     self.aehandlers = [] # optional list of aehandlers
Пример #2
0
 def __init__(self):
     self.tag = 'initinfo'
     self.name = ''
     self.params = Params()
     self.jobid = ''
     self.ats = ATSTree()
     self.CONFIG = ''
     self.hosts = SimpleList('host')
     self.owner = ''
     self.submitter = ''
     self.topology = ''
     self.logfile = LogFile()
     self.tbautoselect = ''
     self.release = ''
     self.image = ''
     self.testbed = ''
Пример #3
0
 def __init__(self):
     self.tag = 'initinfo'
     self.id = Id()  # TODO: Ask if 1 or many ids
     self.name = ''  # equivalent to title attribute in TIMS
     self.xref = XRef()
     self.pargs = None  # optional. TODO: Check if this is just a string
     self.description = ''
     self.uuts = []  #optional list of uuts [0:]
     self.swversion = None  # optional string
     self.hwversion = None  # optional string
     self.fwversion = None  # optional string
     self.tstversion = None  # optional string
     self.logfile = LogFile()
     self.uuts = SimpleList('uut')
     self.interfaces = SimpleList('interface')
     self.platforms = SimpleList('platform')
Пример #4
0
class TSInitInfo(AEReportElement):
    '''
        Class based on this schema definition

    ::
        
        <xs:element name="initinfo">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="name" type="xs:string"></xs:element>
                    <xs:element name="params"></xs:element>
                    <xs:element name="jobid"></xs:element>
                    <xs:element name="ats"></xs:element>
                    <xs:element name="CONFIG"></xs:element>
                    <xs:element name="host" maxOccurs="unbounded"></xs:element>
                    <xs:element name="owner"></xs:element>
                    <xs:element name="submitter"></xs:element>
                    <xs:element name="topology"></xs:element>
                    <xs:element name="logfile"></xs:element>
                    <xs:element name="tbautoselect"></xs:element>
                    <xs:element name="release" />
                    <xs:element name="image" />
                    <xs:element name="testbed" />
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        
    Attributes
    ----------    
    tag : str
        Constant value = 'ats' to be used as xml tag.
    name : str
        Name of testsuite
    params : Params
        internally calculated "final" values of various parameters based 
        on CLI, control and CONFIG files (_easySetKey / _easyGetKey)
    jobid : str
        JobId is a set of easypy runs only
    ats : ATSTree
        ATS tree info
    CONFIG : str
        Full path of CONFIG file that has been sourced
    hosts : SimpleList
        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
    submitter : str
        Test submitter on whose behalf the job is run
    topology : str
        See Topomap xml schema for details -- testbed and device 
        info will be populated from CONFIG file
    logfile : LogFile
        File in which the job logs are saved
    tbautoselect : str
        List of Testbed names selected
    release : str
        Image Release
    image : str
        Image
    testbed : str
        Name of the tb
    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
    '''
    def __init__(self):
        self.tag = 'initinfo'
        self.name = ''
        self.params = Params()
        self.jobid = ''
        self.ats = ATSTree()
        self.CONFIG = ''
        self.hosts = SimpleList('host')
        self.owner = ''
        self.submitter = ''
        self.topology = ''
        self.logfile = LogFile()
        self.tbautoselect = ''
        self.release = ''
        self.image = ''
        self.testbed = ''

    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'])
Пример #5
0
    rep.type = 'easypy'
    rep.sort = True
    rep.outofrange = False
    rep.uniquesuites = True
    rep.sem = SEM(**{'alignment': True, 'traceback': False})
    my_params.report = rep
    my_params.rerun = False
    my_params.cleantype = 'easyclean'
    my_params.uniqueid = False
    my_params.max = MaxLimit(**{'errors': 20, 'jobs': 30})
    my_params.reason = 'some_reason'
    my_params.runchoice = 'tidRange'
    my_params.runchoicevalue = 'tidRangleValue'
#    print my_params.xml()
    
    lf = LogFile()
    lf.filepath = '/some/path/to/a/file/'
    lf.attrs['begin'] = 10
    lf.attrs['size'] = 512
    
    tsinit = TSInitInfo()
    tsinit.params = my_params
    tsinit.ats = atstree
    tsinit.CONFIG = 'CONFIG_FILE'
    tsinit.hosts.append('host1')
    tsinit.hosts.append('host2')
    tsinit.owner = 'abarghou'
    tsinit.submitter = 'jeaubin'
    tsinit.topology = 'topo1'
    tsinit.logfile = lf
    tsinit.tbautoselect = ''
Пример #6
0
class InitInfo(AEReportElement):
    '''
    Class based on this schema definition
    ::
        
        <xs:complexType name="initInfoType">
            <xs:sequence>
                <xs:element name="id">
                <xs:element name="name" type="xs:string">
                <xs:element name="xref" type="xrefType"/>
                <xs:element name="pargs" minOccurs="0"/>
                <xs:element name="description" type="xs:string">
                <xs:element name="uut" type="xs:string" minOccurs="0" maxOccurs="unbounded">
                <xs:element name="swversion" minOccurs="0"/>
                <xs:element name="hwversion" minOccurs="0"/>
                <xs:element name="fwversion" minOccurs="0"/>
                <xs:element name="tstversion" minOccurs="0"/>
                <xs:element name="logfile" type="LogFileType">
                <xs:element name="interface" minOccurs="0" maxOccurs="unbounded">
                <xs:element name="platform" minOccurs="0" maxOccurs="unbounded"> 
            </xs:sequence>
        </xs:complexType>
        
    Attributes
    ----------
    tag : str
        value = 'initinfo'
    id : `Id`
        Various ids related to testcase
    name : str
        Name of the testcase/subtest which is equivalent 
        of the Title attribute in TIMS
    xref : `XRef`
    pargs : str
    description : str
        Description for the testcase or subtest
    uuts : list(str)
        The logical name of the Unit Under Test
    swversion : str
        swversion 
    hwversion : str
        hwversion 
    fwversion : str
        fwversion 
    tstversion : str
        tstversion 
    logfile : `LogFile`
        File in which the testcase or subtest logs are saved.
        It could be same as test script log file
    interfaces : list(`Interface`)
    platform : list('platform')
        Platform element as provided by ats_resutls
    '''
    def __init__(self):
        self.tag = 'initinfo'
        self.id = Id()  # TODO: Ask if 1 or many ids
        self.name = ''  # equivalent to title attribute in TIMS
        self.xref = XRef()
        self.pargs = None  # optional. TODO: Check if this is just a string
        self.description = ''
        self.uuts = []  #optional list of uuts [0:]
        self.swversion = None  # optional string
        self.hwversion = None  # optional string
        self.fwversion = None  # optional string
        self.tstversion = None  # optional string
        self.logfile = LogFile()
        self.uuts = SimpleList('uut')
        self.interfaces = SimpleList('interface')
        self.platforms = SimpleList('platform')

    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'])
Пример #7
0
class TestScriptInitInfo(AEReportElement):
    '''
        Class based on this schema definition

    ::
    
        <xs:element name="initinfo">
        	<xs:complexType>
        		<xs:sequence>
        			<xs:element name="script"></xs:element>
        			<xs:element name="pargs" type="xs:string"></xs:element>
        			<xs:element name="taskid"></xs:element>
        			<xs:element name="description"></xs:element>
        			<xs:element name="logfile" type="LogFileType"></xs:element>
        			<xs:element name="swversion" minOccurs="0"/>
        			<xs:element name="hwversion" minOccurs="0"/>
        			<xs:element name="fwversion" minOccurs="0"/>
        			<xs:element name="tstversion" minOccurs="0"/>
        			<xs:element name="aehandler" minOccurs="0" maxOccurs="unbounded"></xs:element>
        		</xs:sequence>
        	</xs:complexType>
        </xs:element>
    
    Attributes
    ----------
    tag : str
        Default value = 'initinfo'
    script : Script
    pargs : str
    taskid : str
    description : str
    logfile : LogFile
    version : str
    swversion : str
        swversion 
    hwversion : str
        hwversion 
    fwversion : str
        fwversion 
    tstversion : str
        tstversion 
    aehandlers : list
        aehandlers - list of AEHandler
    '''
    def __init__(self):
        self.tag = 'initinfo'
        self.script = Script()
        self.pargs = ''
        self.taskid = ''
        self.description = ''
        self.logfile = LogFile()
        self.swversion = None # optional string
        self.hwversion = None # optional string
        self.fwversion = None # optional string
        self.tstversion = None # optional string
        self.aehandlers = [] # optional list of aehandlers

    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']}))
Пример #8
0
        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']}))

if __name__ == '__main__': # pragma: no cover
    tsii = TestScriptInitInfo()
    tsii.name = 'some name'
    tsii.taskid = 'task-1'
    tsii.version = 'v15.2'
    tsii.params = 'some params'
    tsii.logfile = LogFile(attrs={'begin': 10, 'size': 20})
    tsii.swversion = 'v1'
    tsii.hwversion = 'v2'
    tsii.fwversion = 'v3'
    tsii.tstversion = 'v4'
    tsii.aehandlers = [TestScriptAEHandler({'name': 'handler1', 'type': 'testcase'}),
                       TestScriptAEHandler({'name': 'handler2', 'type': 'section'})]
    print(tsii.xml())