User Tools

Site Tools


automation:test-the-network

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
automation:test-the-network [2025/07/06 07:27] jotasandokuautomation:test-the-network [2025/07/18 22:04] (current) jotasandoku
Line 2: Line 2:
   * **Unit testing (atomic level)** - individual functions/methods. (Module testing often gets lumped into either "unit testing" (for simple modules) or "component testing" (for complex modules))   * **Unit testing (atomic level)** - individual functions/methods. (Module testing often gets lumped into either "unit testing" (for simple modules) or "component testing" (for complex modules))
   * Component testing - groups of related units working together   * Component testing - groups of related units working together
-  * **Integration testing** - multiple components interacting+  * **Integration testing** - multiple components interactingfPYATS
   * System testing - entire application   * System testing - entire application
  
 +----
  
 +
 +====PYATS===
 +  * {{ :automation:pyats_and_network_validation.pdf |}}
 +  * {{ :automation:pyats_and_network_validation_examples.pdf |}}
 +  * {{ :automation:pyats_oreilly-danw.pdf | OREILLY-PRES}} / [[https://github.com/dannywade/oreilly-live-training-pyats]]
 +
 +Topics
 +  * 'Testbed' - Describes the physical devices and connections in a YAML file. Is an inventory file but augmented. You can have interfaces and topology with links and also credentials. Unicon is a library underneath. Used to control device connectivity (~paramiko)
 +  * TestScripts: Contains the logic of all the tests.
 +    * Jobs: executes TestScripts as tasks. Also allows to execute multiple TestScripts in parallel
 +
 +  * pyATS library (Genie): Data PARSING. Tooling used to extract the network data.
 +    * Genie Harness: Used to build **test cases using YAML datafiles**
 +
 +  * Easypy - Runtime
 +  * Others: Blitz, Clean, 'Health Check'; Robot
 +  * AEtest (Easy Testing): scaffolding/framework for the Testing
 +
 +
 +=== TESTSCRIPT ===
 +Is the python file that holds all your tests.
 +
 +  * Common setup: Initial configuration and device initialization including loops - decorator : ''@aetest.setup''
 +  * Testcases: 'Container'(self-contained) for our tests. Setup/Test/Cleanup. testcase.uid (must be unique, is a python 'property') - decorator: ''@aetest.test''
 +  * Cleanup: Resets the testing environment after the test - decorator: ''@aetest.cleanup''
 +
 +** see slides 46,47 for examples (classes..)) **
 +\\
 +Test Parameters: TestScript > Testcase > TestSection  (they are classes (eg: testcase). see code))
 +
 +  * Callable 
 +  * Test Parameters - decorator : ''@aetest.parameter''
 +  * Test Execution: 
 +    * Standalone: all logging is sent to stdout. See slide 64-65
 +    * Easypy: Standardized runtime env within pyATS. Helpful for regression testing
 +
 +----
 ---- ----
 ==== OPTIONS ==== ==== OPTIONS ====
 === Classic1: Unittest / **pytest** libraries === === Classic1: Unittest / **pytest** libraries ===
-TODO 
- 
 == Assertions == == Assertions ==
   * **Definition:** Statements used in tests to verify that a specific condition holds true.   * **Definition:** Statements used in tests to verify that a specific condition holds true.
Line 98: Line 134:
  
  
----- 
  
 ===== Further Reading ===== ===== Further Reading =====
  
-    [[https://docs.pytest.org/en/stable/how-to/fixtures.html|Pytest Fixture Documentation]] +  * [[https://docs.pytest.org/en/stable/how-to/fixtures.html|Pytest Fixture Documentation]] 
- +  [[https://realpython.com/pytest-python-testing/#using-pytest-fixtures|Real Python: Pytest Fixtures]] 
-    [[https://realpython.com/pytest-python-testing/#using-pytest-fixtures|Real Python: Pytest Fixtures]] +  [[https://docs.pytest.org/en/stable/how-to/fixtures.html#parametrizing-fixtures|Parametrising Fixtures]] 
- +  [[https://gist.github.com/kwaldrip/0ed22c6e3c8b476b8a84cf3c137b3e15|Pytest Fixture Cheat Sheet (Gist)]]  
-    [[https://docs.pytest.org/en/stable/how-to/fixtures.html#parametrizing-fixtures|Parametrising Fixtures]] +  * [[https://packetpushers.net/blog/open-source-networking-projects/#automation]] << more examples in this packetpushers site
- +
-    [[https://gist.github.com/kwaldrip/0ed22c6e3c8b476b8a84cf3c137b3e15|Pytest Fixture Cheat Sheet (Gist)]] +
- +
- +
- +
- +
----- +
- +
-== Parametrization == +
-  * **Definition:** Technique to run the same test with different sets of parameters. +
-  * **Usage:** Implemented with <code>@pytest.mark.parametrize</code>+
-  * **Example:** +
-    <code python> +
-    @pytest.mark.parametrize("ip", ["8.8.8.8", "1.1.1.1"]) +
-    def test_ping(ip): +
-        assert ping(ip) +
-    </code> +
-  * **Purpose:** Increase coverage by testing with multiple data sets. +
- +
----- +
- +
-== Other Relevant Concepts == +
-  * **Testcase/Testscript:**  +
-    * A testcase is a Python class, often subclassing <code>aetest.Testcase</code>, containing test sections. +
-    * A testscript is a file containing one or more testcases. +
-  * **Sections:**  +
-    * Special methods within a testcase, such as <code>setup</code>, <code>test</code>, and <code>cleanup</code>+
-  * **Testbed:**  +
-    * A YAML or Python file describing devices and connections used in tests. +
-  * **Loggers:**  +
-    * Used for reporting test steps and results (<code>log</code> object). +
-  * **aetest:**  +
-    * Core pyATS test harness module for organizing and running tests. +
- +
- +
- +
----- +
- +
-== Examples == +
-  * NUTS (network unit tests): [[https://packetpushers.net/blog/open-source-networking-projects/#automation]] << more examples in this packetpushers site+
automation/test-the-network.1751786851.txt.gz · Last modified: by jotasandoku