Skip to content

Commit 842beb5

Browse files
authored
Merge pull request #2 from mjbear/aetest-loop-doc-improv
Update Testcase/TestScript words in loop.rst
2 parents 76bffeb + 2048ac1 commit 842beb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2910
-527
lines changed

docs/aetest/debugging.rst

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ want to pause the testscript execution somewhere & check the current state
227227
and/or configuration of your environment, logs, and testbed devices?
228228

229229
The **pause on phrase** feature allows you to pause on **any** log messages
230-
generated by the current script run, without requiring any modifications to the
231-
scripts and/or its libraries. When enabled, it actively filters all log messages
230+
generated by the current script run, including CLI output from devices,
231+
without requiring any modifications to the scripts and/or its libraries.
232+
When enabled, it actively filters all log messages
232233
propagated to the ``logging.root`` logger, and pauses when a match is found.
233234

234235
Three distinct types of pause actions are supported:
@@ -486,3 +487,46 @@ Below are some examples of the pause on phrase feature in action:
486487
# -> /path/to/my/example/testscript.py[20] test()
487488
# (press Ctrl-D to resume execution)
488489
# >>>
490+
491+
The pause will also dump the connection information, including which devices are currently connected.
492+
493+
.. code-block:: python
494+
495+
# --------------------------------------------------------------------------------
496+
# Pause On Phrase: Connection Information
497+
#
498+
# +-------------------+--------------------------------+
499+
# | Device Property | Value |
500+
# +-------------------+--------------------------------+
501+
# | Name | device.name |
502+
# | Alias | device.alias |
503+
# | Active Connection | alias of active connection |
504+
# | Status | Connected|Disconnected |
505+
# | Spawn Command | command for active connection |
506+
# | -------- | -------- |
507+
# | Connection Alias | connection alias e.g. cli |
508+
# | Class | Unicon, Gnmi, Netconf, etc |
509+
# | IP | IPV4|IPV6 address |
510+
# | Protocol | ssh, telnet, etc |
511+
# | -------- | -------- |
512+
# | URL | <protocol>://<ip>:<port> |
513+
# +-------------------+--------------------------------+
514+
515+
516+
.. note::
517+
518+
If it is required to connect to the device directly while the test is paused, the device connection must be disconnected
519+
from before it can be accessed directly.
520+
521+
.. code-block:: python
522+
523+
>>> import pyats.easypy as ep
524+
>>> dev = ep.runtime.testbed.devices['<device>']
525+
>>> dev.disconnect()
526+
527+
# the device can now be connected to in a separate terminal. Once ready to resume the test,
528+
# break the connection and reattach with
529+
530+
>>> dev.connect()
531+
532+

docs/aetest/loop.rst

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ it with different parameters during each loop iteration.
2828
The following describes each section and their loop capability and behaviors:
2929

3030
``CommonSetup``/``CommonCleanup``
31-
Common setup and cleanup sections are unique within each test script. They
32-
are run only once per test script execution, and are not loopable.
31+
Common setup and cleanup sections are unique within each TestScript. They
32+
are run only once per TestScript execution, and are not loopable.
3333

3434
``subsection``
3535
Subsections within ``CommonSetup`` and ``CommonCleanup`` are loopable.
@@ -38,12 +38,12 @@ The following describes each section and their loop capability and behaviors:
3838

3939
``Testcase``
4040
Testcases are loopable. Each iteration of a looping ``Testcase`` is reported
41-
individually as new test case instances with a different ``uid``. When a
41+
individually as new ``Testcase`` instances with a different ``uid``. When a
4242
``Testcase`` is looped, and all of its contents (setup, tests, and cleanup) are
4343
run fully per each iteration.
4444

4545
``setup``/``cleanup``
46-
Setup and cleanup sections within each test case is unique, and are run
46+
Setup and cleanup sections within each Testcase is unique, and are run
4747
only once per ``Testcase``. They cannot be looped individually, but
4848
if their parent ``Testcase`` is looped, then they are run once per
4949
``Testcase`` iteration.
@@ -52,9 +52,9 @@ The following describes each section and their loop capability and behaviors:
5252
Test sections within ``Testcase`` are loopable individually. Each
5353
iteration has its own unique id and is reported as a new test
5454
section. When a looping ``test`` section's parent ``Testcase`` is
55-
looped, the resulting loops are multiplicative. E.g.: if a test case is
56-
looped ``2x``and contains a test that is also looped ``2x``, that
57-
test would loop ``2x`` per test case loop iteration.
55+
looped, the resulting loops are multiplicative. E.g.: if a Testcase is
56+
looped ``2x`` and contains a test that is also looped ``2x``, that
57+
test would loop ``2x`` per Testcase loop iteration.
5858

5959
.. hint::
6060

@@ -93,27 +93,27 @@ section object is then instantiated once for each iteration.
9393
def looped_subsection(self):
9494
pass
9595
96-
# Defining a test case that loops
96+
# Defining a Testcase that loops
9797
# ----------------------------------
98-
# This test case also contains a test section that is looped twice
98+
# This Testcase also contains a test section that is looped twice
9999
@aetest.loop(uids=['testcase_one', 'testcase_two'])
100100
class Testcase(aetest.Testcase):
101101
102-
# Setup section of this test case is run once
103-
# every time the test case is looped.
102+
# Setup section of this Testcase is run once
103+
# every time the Testcase is looped.
104104
@aetest.setup
105105
def setup(self):
106106
pass
107107
108108
# Looped test section
109-
# both iterations are run per test case iteration
109+
# both iterations are run per Testcase iteration
110110
@aetest.loop(uids=['test_one', 'test_two'])
111111
@aetest.test
112112
def test(self):
113113
pass
114114
115-
# Cleanup section of this test case is run once
116-
# every time the test case is looped.
115+
# Cleanup section of this Testcase is run once
116+
# every time the Testcase is looped.
117117
@aetest.cleanup
118118
def cleanup(self):
119119
pass
@@ -216,7 +216,7 @@ looped section is then driven to potentially do something different.
216216
217217
from pyats import aetest
218218
219-
# Loop this test case with a loop parameter named "a"
219+
# Loop this Testcase with a loop parameter named "a"
220220
# and set it to value 2 for the first iteration,
221221
# and 3 for the second iteration
222222
@aetest.loop(a=[2, 3])
@@ -229,7 +229,7 @@ looped section is then driven to potentially do something different.
229229
# this test prints the exponential of two inputs, a and b
230230
print("%s ^ %s = %s" % (a, b, a**b))
231231
232-
# The output of the test case would look like this:
232+
# The output of the Testcase would look like this:
233233
# 2 ^ 8 = 256
234234
# 2 ^ 9 = 512
235235
# 3 ^ 8 = 6561
@@ -449,7 +449,7 @@ would normally expect it to:
449449
def test_two(self, b):
450450
print('b = %s' % b)
451451
452-
# The output of the test case would be:
452+
# The output of the Testcase would be:
453453
# returning [1, 2, 3]
454454
# a = 1
455455
# a = 2
@@ -482,7 +482,7 @@ Dynamic Loop Marking
482482
--------------------
483483

484484
So far, all loop examples focus on defining the ``@loop`` decorator directly within the
485-
test scripts. E.g., the ``@loop`` decorators are coded as part of the test script.
485+
TestScripts. E.g., the ``@loop`` decorators are coded as part of the TestScript.
486486
However, it is also possible to dynamically mark sections for looping during
487487
runtime, e.g., creating loops based on information that is only available during
488488
a script’s run. To do this, use the ``loop.mark()`` function.
@@ -506,7 +506,7 @@ a script’s run. To do this, use the ``loop.mark()`` function.
506506
aetest.loop.mark(self.simple_test, uids=['test_one', 'test_two'])
507507
508508
# Note: the simple_test section is not directly marked for looping
509-
# instead, during runtime, its testcase's setup section marks it for
509+
# instead, during runtime, its Testcase's setup section marks it for
510510
# looping dynamically.
511511
512512
@aetest.test
@@ -515,7 +515,7 @@ a script’s run. To do this, use the ``loop.mark()`` function.
515515
# by using the internal parameter "section"
516516
print("current section: %s" % section.uid)
517517
518-
# Output of this test case
518+
# Output of this Testcase
519519
# current section: test_one
520520
# current section: test_two
521521
#
@@ -656,9 +656,9 @@ wish to customize loop behavior, it is possible to extend and override it.
656656
657657
658658
# This loop generator can be used as the @loop and loop.mark() argument.
659-
# Let's define a looped test case with it.
659+
# Let's define a looped Testcase with it.
660660
661-
# Looping this test case with a custom generator, and a=1, b=5
661+
# Looping this Testcase with a custom generator, and a=1, b=5
662662
@aetest.loop(generator=DemoGenerator, a=1, b=5)
663663
class Testcase(aetest.Testcase):
664664
@@ -668,7 +668,7 @@ wish to customize loop behavior, it is possible to extend and override it.
668668
def test(self, number):
669669
print('current number: %s' % number)
670670
671-
# Output of this test case
671+
# Output of this Testcase
672672
# current number: 1
673673
# current number: 2
674674
# current number: 3

docs/apidoc/easypy/pyats.easypy.runinfo.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,4 @@ Submodules
2222
:show-inheritance:
2323

2424

25-
.. automodule:: pyats.easypy.runinfo.kafka
26-
:members:
27-
:undoc-members:
28-
:show-inheritance:
29-
30-
31-
.. automodule:: pyats.easypy.runinfo.s3
32-
:members:
33-
:undoc-members:
34-
:show-inheritance:
3525

docs/apidoc/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ API Documentation
1313
robot/index
1414
async/index
1515
datastructures/index
16-
tcl/index
1716
log/index
1817
reporter/index
1918
results/index

docs/apidoc/kleenex/index.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,39 @@ Subpackages
1111

1212
.. toctree::
1313

14-
pyats.kleenex.loader
14+
pyats.clean.loader
1515
pyats.kleenex.reporter
16+
pyats.bringup
1617

1718
Submodules
1819
----------
1920

2021

21-
.. automodule:: pyats.kleenex.bases
22+
.. automodule:: pyats.bringup.bases
2223
:members:
2324
:undoc-members:
2425
:show-inheritance:
2526

2627

27-
.. automodule:: pyats.kleenex.bringup_base_cli_parser
28+
.. automodule:: pyats.bringup.base_cli_parser
2829
:members:
2930
:undoc-members:
3031
:show-inheritance:
3132

3233

33-
.. automodule:: pyats.kleenex.bringup_manager
34+
.. automodule:: pyats.bringup.manager
3435
:members:
3536
:undoc-members:
3637
:show-inheritance:
3738

3839

39-
.. automodule:: pyats.kleenex.bringup_manager_cli_parser
40+
.. automodule:: pyats.bringup.manager_cli_parser
4041
:members:
4142
:undoc-members:
4243
:show-inheritance:
4344

4445

45-
.. automodule:: pyats.kleenex.bringup_signals
46+
.. automodule:: pyats.bringup.signals
4647
:members:
4748
:undoc-members:
4849
:show-inheritance:
@@ -66,19 +67,19 @@ Submodules
6667
:show-inheritance:
6768

6869

69-
.. automodule:: pyats.kleenex.kleenex_traceback
70+
.. automodule:: pyats.clean.traceback
7071
:members:
7172
:undoc-members:
7273
:show-inheritance:
7374

7475

75-
.. automodule:: pyats.kleenex.schema
76+
.. automodule:: pyats.clean.schema
7677
:members:
7778
:undoc-members:
7879
:show-inheritance:
7980

8081

81-
.. automodule:: pyats.kleenex.utils
82+
.. automodule:: pyats.clean.utils
8283
:members:
8384
:undoc-members:
8485
:show-inheritance:

docs/apidoc/kleenex/pyats.kleenex.loader.rst renamed to docs/apidoc/kleenex/pyats.clean.loader.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
pyats.kleenex.loader package
1+
pyats.clean.loader package
22
============================
33

4-
.. automodule:: pyats.kleenex.loader
4+
.. automodule:: pyats.clean.loader
55
:members:
66
:undoc-members:
77
:show-inheritance:
@@ -10,7 +10,7 @@ Submodules
1010
----------
1111

1212

13-
.. automodule:: pyats.kleenex.loader.markup
13+
.. automodule:: pyats.clean.loader.markup
1414
:members:
1515
:undoc-members:
1616
:show-inheritance:

docs/apidoc/kleenex/pyats.kleenex.reporter.rst

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,7 @@ Submodules
1010
----------
1111

1212

13-
.. automodule:: pyats.kleenex.reporter.base
14-
:members:
15-
:undoc-members:
16-
:show-inheritance:
17-
18-
19-
.. automodule:: pyats.kleenex.reporter.clean
20-
:members:
21-
:undoc-members:
22-
:show-inheritance:
23-
24-
25-
.. automodule:: pyats.kleenex.reporter.context
13+
.. automodule:: pyats.kleenex.reporter.reporter
2614
:members:
2715
:undoc-members:
2816
:show-inheritance:

docs/apidoc/log/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Subpackages
1212
.. toctree::
1313

1414
pyats.log.commands
15+
pyats.atslog
1516

1617
Submodules
1718
----------

docs/apidoc/log/pyats.log.commands.parser.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ Submodules
1010
----------
1111

1212

13-
.. automodule:: pyats.log.commands.parser.base
13+
.. automodule:: pyats.log.commands.parser.base_parser
1414
:members:
1515
:undoc-members:
1616
:show-inheritance:
1717

1818

19-
.. automodule:: pyats.log.commands.parser.xml
19+
.. automodule:: pyats.log.commands.parser.xml_parser
2020
:members:
2121
:undoc-members:
2222
:show-inheritance:
2323

2424

25-
.. automodule:: pyats.log.commands.parser.yaml
25+
.. automodule:: pyats.log.commands.parser.yaml_parser
2626
:members:
2727
:undoc-members:
2828
:show-inheritance:

0 commit comments

Comments
 (0)