intro-network-tests

Demos, examples, content for the talk "Introduction to Writing Network Tests with pyATS"

published

Resources

Demo Network

If you'd like to run the demo tests in this repository, first step is to reserve the network that goes along with the testbed.yaml file.

DevNet Sandbox: Cisco Network Services Orchestrator

This sandbox provides a sample network configured with interfaces, routing, etc that can be used for a variety of tests and labs.

Installing pyATS

It is recommended to review the pyATS Getting Started Guide, but you can get started quickly with this.

pip install pyats[full]

Note: you'll need to be on Linux or macOS and be in a virtualenv of Python 3.5+

Running the Sample Network Test

The folder network_test_project will check that all devices in the testbed are reachable, and that interfaces aren't showing any errors.

The testbed.yaml file is setup to look in the environment variables for the user/password for devices.

testbed:
  name: Multi Platform Network
  credentials:
    default:
      username: '%ENV{PYATS_USERNAME}'
      password: '%ENV{PYATS_PASSWORD}'
    enable:
      password: '%ENV{PYATS_PASSWORD}'
    line:
      password: '%ENV{PYATS_PASSWORD}'
    linux: 
      password: '%ENV{PYATS_PASSWORD}'

As the Sandbox is a sample network, the values for these are included in the pyats_env file in the repository. "source" it to set these variables.

source pyats_env

Now you can run the test with

pyats run job network_test_project/network_test_job.py --testbed testbed.yaml

Note: you'll need to be VPN connected to the DevNet Sandbox to run the test

To checkout the results and logs from the test, use the pyats logs view function to open a browser view.

View code on GitHub
  • Owner

  • Contributors

    +1Github contributor
  • Categories

  • Products

    pyATS
  • Programming Languages

    Python
  • License

    MIT License

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.