Let's add all the features for a full solution testing
- Trigger No Shut Interface
Trigger to execute on our device, test we want to perform on our device.
One of the goal of a trigger is to write re-usable Testcase. To achieve it you need:
- Testcase which does not have anything hardcoded
- Topology / Configuration related information to be provided as arguments -
- Sleep Timeout to be provided as argument
To be topology / configuration independent, nm
- Add Verification around our Triggers
Verify that the state of your network is unaffected by your triggers
Take a snapshot pre trigger, and compare it post Trigger.
List of available Verifications: https://pubhub.devnetcloud.com/media/genie-feature-browser/docs/#/verifications New one can be created: https://pubhub.devnetcloud.com/media/genie-docs/docs/userguide/harness/developer/verifications.html
- Add configuration to the devices before running any Trigger
Base configuration to apply on the device(s) to start the test. A typical usecase is applying the full device(s) configuration.
Configuration can be copied to the device with Tftp/Ftp/Scp or jinja2. In this example we are using Jinja2.
- Add Health Check of our device - Verify Core, Traceback, Memory load, Cpu Load
Verify the state of the device, see if any Core or Traceback has been generated, verify the load of the memory and CPU during the execution of the TestScript.
All Yaml File Driven
https://pubhub.devnetcloud.com/media/genie-docs/docs/health/index.html
- Add pyATS Clean - Will wipe your device configuration - Can be modified to do whatever you want
Fully customizable clean - Can fully clean any device, to just ping a server. Modular to prepare your device to the state needed before the script execution.
https://pubhub.devnetcloud.com/media/genie-docs/docs/clean/index.html
-
Add configuration to your device at the begining of the script
-
Modifying our Common Setup to only run what we want - Subsection datafile
By default the common setup will run Subsection by default. These can be modified by providing a subsection datafile. New one can be added, removed, modified.
That's a lot.
Each feature can be used independently, just use what is needed.
Let's run it one by one, to see what each does.
pyats run genie --trigger-datafile trigger_datafile.yaml --trigger-uids TriggerReload --testbed-file tb.yaml --liveview
Let's add verification and shorten our common setup and add configuration to our device
pyats run genie --trigger-datafile trigger_datafile.yaml --trigger-uids TriggerReload --testbed-file tb.yaml --liveview --verifications-uids Verify_BgpAll --subsection-datafile subsection_datafile.yaml --config-datafile configuration.j2
Let's add device health
pyats run genie --trigger-datafile trigger_datafile.yaml --trigger-uids TriggerReload --testbed-file tb.yaml --liveview --verifications-uids Verify_BgpAll --subsection-datafile subsection_datafile.yaml --config-datafile configuration.j2 --health-file health.yaml
Let's add the clean
pyats run genie --trigger-datafile trigger_datafile.yaml --trigger-uids TriggerReload --testbed-file tb.yaml --liveview --verifications-uids Verify_BgpAll --subsection-datafile subsection_datafile.yaml --config-datafile configuration.j2 --health-file health.yaml --clean-file clean.yaml --invoke-clean
Here is the list of what each argument does. The full list can be found here:
https://pubhub.devnetcloud.com/media/genie-docs/docs/userguide/harness/user/reference.html https://pubhub.devnetcloud.com/media/pyats/docs/easypy/usages.html#standard-arguments
trigger-datafile -> Mention which Trigger file to use trigger-uids -> Which trigger to execute within this trigger datafile verification-uids -> Which Verifications to execute subsection-datafile -> Subsection datafile to use testbed-file -> Testbed to use config-datafile -> Configuration to apply to your device within the common setup - Right after connecting to the devices liveview - Live logviewer that shows at runtime what is running. Add --liveview-host 0.0.0.0 if not running on laptop