pyats.aereport.testsuite package

testsuite – TestSuite

This module contains TestSuite and some of its child elements.

class pyats.aereport.testsuite.TestSuite

Bases: AEReportElement

This is xml schema for test suite results corresponding to easypy job or suite invocation

Class based on the following schema definition

<xs:element name="starttime" type="xs:dateTime"></xs:element>
<xs:element name="initinfo"></xs:element>
<xs:element name="iou" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="setupHandler" type="InfraHandlerSectionType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="clean" type="cleanType" minOccurs="0"></xs:element>
<xs:element name="prerunHandler" type="InfraHandlerSectionType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="jobexecution"></xs:element>
<xs:element name="postrunHandler" type="InfraHandlerSectionType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="tims"></xs:element>
<xs:element name="mailAttachment" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="reportHandler" type="InfraHandlerSectionType" minOccurs="0"/>
<xs:element name="archivefile"></xs:element>
<xs:element name="stoptime" type="xs:dateTime"></xs:element>
<xs:element name="runtime"></xs:element>
<xs:element name="summary" type="summaryType"/>
<xs:element name="abort" minOccurs="0"></xs:element>
tag

Constant value = ‘testsuite’ to be used as xml tag.

Type:

str

starttime

Time at which the job is invoked just before it locks testbed/image and does initialization. It should be the same as the timestamp used for creating the runinfo directory name: “job-timestamp”

Type:

datetime

initinfo
Type:

TSInitInfo

ious

ious - list of IOU objects. Iou server info started on local or remote hosts

Type:

list

setuphandlers

setuphandlers - list of InfraHandlerSection objects

Type:

list

clean

clean routine prior to job execution

Type:

Clean

prerunhandlers

prerunhandlers - list of InfraHandlerSection objects

Type:

list

jobexecution

Job file execution information stored here

Type:

JobExecution

postrunhandlers

postrunhandlers - list of InfraHandlerSection objects

Type:

list

tims

If tims posting is enabled, this will contain result status of tims importer

Type:

Tims

mailAttachments

mailAttachments - list of MailAttachment objects. Pointer to the user generated files for attaching to e-mail report.

Type:

list

reporthandler

reporthandler

Type:

InfraHandlerSection

archivefile

Pointer to the archive log file (if one was requested) for the job run. It should be relative to root of ATS tree.

Type:

str

stoptime

Time at which the job completes, right after the report is generated and just befored it archives the results

Type:

datetime

runtime
Type:

timedelta

summary
Type:

Summary

abort

abort - Reports abort from user, abnormal script termination, etc.

Type:

Abort

get_infrahandler(tag, name)

Searches within infrahandlers lists whether an infrahandler of a given name already exists. It uses the tag to determine which list to search e.g. prerunhandlers list, etc. If the tag is reportHandler, the assigned value is returned regardless of name matching.

Parameters:
  • tag (str) – Used to determine which list to search. Possible values are: reportHandler, setupHandler, prerunHandler, and postrunHandler

  • name (str) – The name of the handler to be found

Returns:

ret – InfraHandler if found; otherwise None

Return type:

InfraHandlerSection

set_args(**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

  • user (str) – userid of the current process/person launching pyats run job

  • 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.

Submodules

clean – Clean

This module implement Clean section used by TestSuite.

class pyats.aereport.testsuite.clean.Clean

Bases: AEReportElement

Clean routine prior to job execution

Class based on the following schema definition

<xs:complexType name="cleanType">
    <xs:sequence>
        <xs:element name="starttime" type="xs:dateTime"/>
        <xs:element name="device" maxOccurs="unbounded">...</xs:element>
        <xs:element name="stoptime" type="xs:dateTime"/>
        <xs:element name="runtime">...</xs:element>
    </xs:sequence>
</xs:complexType>
tag

Default value = ‘notag’. This is to ensure that all elements contain a tag attribute.

Type:

str

starttime

Start time of clean

Type:

datetime()

device

CleanDevice object

Type:

CleanDevice()

stoptime

Stop time of clean

Type:

datetime()

runtime

stop time - start time

Type:

str

class pyats.aereport.testsuite.clean.CleanDevice

Bases: AEReportElement

Clean device used in Clean Class based on the following schema definition

<xs:element name="device" maxOccurs="unbounded">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="name"/>
            <xs:element name="logfile"></xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>
tag

Default value = ‘notag’. This is to ensure that all elements contain a tag attribute.

Type:

str

name

Name of the device

Type:

str

logfile

File in which the job logs are saved LogFile object

Type:

LogFile()

jobexecution – Job Execution Elements

This module contains jobexecution and its related child elements.

class pyats.aereport.testsuite.jobexecution.JobExecution

Bases: AEReportElement

Class based on the following schema definition

<xs:element name="jobexecution">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="starttime" type="xs:dateTime">...</xs:element>
            <xs:element name="runinfo" type="runinfoType"/>
            <xs:element name="testscript" minOccurs="0" maxOccurs="unbounded">...</xs:element>
            <xs:element ref="result"/>
            <xs:element name="stoptime" type="xs:dateTime">...</xs:element>
            <xs:element name="runtime">...</xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>
tag

Default value = ‘jobexecution’

Type:

str

starttime
Type:

datetime

stoptime
Type:

datetime

runtime
Type:

timedelta

runinfo
Type:

RunInfo

result
Type:

Result

add_testscript(ts, taskid='')

Create a testscript

Parameters:

taskid (str) – taskid of the testscript

children = ['starttime', 'runinfo', 'testscripts', 'result', 'stoptime', 'runtime']
is_last_testscript_closed()

Return if the last testscript is closed

Returns:

Return 1 if last testscript was closed, else False

Return type:

Bool

mailattachment – MailAttachment

This module implements MailAttachment class.

class pyats.aereport.testsuite.mailattachment.MailAttachment

Bases: AEReportElement

Pointer to the user generated files for attaching to e-mail report. Class based on the following schema definition

<xs:element name="mailAttachment" minOccurs="0" maxOccurs="unbounded">
    <xs:annotation>
        <xs:documentation>
          Pointer to the user generated files for attaching to e-mail report.
        </xs:documentation>
    </xs:annotation>
</xs:element>
tag

Default value = ‘mailAttachment’. This is to ensure that all elements contain a tag attribute.

Type:

str

generate_dom(parent)

Override the default behavior of AEReportElement.generate_dom

Parameters:

parent (AEReportElement) – The xml element that should be used as a parent for this userdef

tsabort – Tsabort

This module implements MailAttachment class.

class pyats.aereport.testsuite.tsabort.TSAbort

Bases: AEReportElement

Reports abort from user, abnormal script termination, etc.

Class based on the following schema definition

<xs:element name="abort" minOccurs="0">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="time"></xs:element>
            <xs:element name="type"></xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>
tag

Default value = ‘notag’. This is to ensure that all elements contain a tag attribute.

Type:

str

time

Time/date of script abort

Type:

str

type

Signal number received by signal handler

Type:

str

set_args(**kwargs)

Set attributes for tsabort

Parameters:
  • time (str) – Time/date of script abort

  • type (str) – Signal number received by signal handler