Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@aetest.setup
def verify_prerequisite(self, uut, abstract, steps, timeout):
'''Learn Ops object and verify the requirements.
If the requirements are not satisfied, then skip to the next
testcase.
Args:
uut (`obj`): Device object.
abstract (`obj`): Abstract object.
steps (`step obj`): aetest step object
timeout (`timeout obj`): Timeout Object
Returns:
None
Raises:
@aetest.test
def restore_configuration(self, uut, method, abstract, steps):
'''Rollback the configuration
Can be either done via TFTP or checkpoint feature (If exists for OS)
Args:
uut (`obj`): Device object.
method (`str`): Save method from trigger datafile.
Only accpet "local" and "checkpoint"
Returns:
None
Raises:
pyATS Results
'''
@aetest.test
def connect(section, device, timeout=200, **kwargs):
'''
Clean yaml file schema:
-----------------------
devices:
:
connect:
Example:
--------
devices:
N95_1:
connect:
timeout: 60
Flow:
-----
@aetest.test
def restore_configuration(self, uut, method, abstract, steps):
'''Rollback the configuration
Can be either done via TFTP or checkpoint feature (If exists for OS)
Args:
uut (`obj`): Device object.
method (`str`): Save method from trigger datafile.
Only accpet "local" and "checkpoint"
Returns:
None
Raises:
pyATS Results
'''
@aetest.subsection
def a_simple_subsection(self):
'''A Simple Subsection
Use this docstring section to describe what is being done in this
subsection.
Note:
this subsection is empty and doing just about nothing. probably not
a good idea to submit to code reviews, sanity/regression.
'''
#******************************
#* Results
#*
#* if sections are not provided any results directly, the following
#* behavior takes place:
self.failed('variable b did not contains the expected value',
data = {'b': self.b})
@aetest.cleanup
def cleanup(self):
'''cleanup section
create a cleanup section by defining a method a decorating it with
@aetest.cleanup decorator. This method should be named 'cleanup' as good
convention.
cleanup sections are optional within a testcase, and is always run last.
'''
log.info("%s testcase cleanup/teardown" % self.uid)
class common_cleanup(aetest.CommonCleanup):
'''Common Cleanup Section
Each script may only have a single common cleanup section.
Common cleanup section is always run as the last section in a test script,
and serves to perform all the "common" cleanups required for your script.
In addition, common-cleanup section should act as the safety net: in case
of dramatic testcase failures, common cleanup section should be able to
cleanup the lingering mess left behind in the testbed/devices under test.
Define a common cleanup section by subclassing aetest.CommonCleanup class.
It's a good convention to name it 'common_cleanup', as this section's
reporting ID is always 'common_cleanup'.
Similar to its counterpart, common cleanup may have 1+ subsections.
Consider a subsection as a cleanup 'milestone/step'. A subsection is defined
@aetest.setup
def verify_prerequisite(self):
raise NotImplementedError
@aetest.test
def verify_initial_state(self):
raise NotImplementedError
@aetest.test
def verify_restart(self, uut, abstract, steps, timeout, repeat_restart=1):
'''Verify if the shut command shut the feature correctly and
as expected
Args:
uut (`obj`): Device object.
abstract (`obj`): Abstract object.
steps (`step obj`): aetest step object
Returns:
None
Raises:
pyATS Results
'''
try: