{"id":20589006,"url":"https://github.com/ciscodevnet/pyats-ios-sample","last_synced_at":"2025-04-14T22:05:17.354Z","repository":{"id":26599714,"uuid":"109320372","full_name":"CiscoDevNet/pyats-ios-sample","owner":"CiscoDevNet","description":"pyATS Example script for Cisco IOS Testbed","archived":false,"fork":false,"pushed_at":"2021-12-03T00:40:51.000Z","size":38,"stargazers_count":29,"open_issues_count":1,"forks_count":13,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-14T22:04:48.663Z","etag":null,"topics":["ccie","ccna","ccnp","cisco","cisco-ios","pyats","pyats-examples","routers","test-automation"],"latest_commit_sha":null,"homepage":"https://developer.cisco.com/site/pyats/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CiscoDevNet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-02T21:24:03.000Z","updated_at":"2025-03-31T19:30:13.000Z","dependencies_parsed_at":"2022-07-27T08:32:24.501Z","dependency_job_id":null,"html_url":"https://github.com/CiscoDevNet/pyats-ios-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpyats-ios-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpyats-ios-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpyats-ios-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpyats-ios-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CiscoDevNet","download_url":"https://codeload.github.com/CiscoDevNet/pyats-ios-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968737,"owners_count":21191159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ccie","ccna","ccnp","cisco","cisco-ios","pyats","pyats-examples","routers","test-automation"],"created_at":"2024-11-16T07:27:30.520Z","updated_at":"2025-04-14T22:05:17.329Z","avatar_url":"https://github.com/CiscoDevNet.png","language":"Python","readme":"# pyats-ios-sample\n\n# Introduction\n\nThis repo provides a demonstration of Cisco pyATS with a NetDevOps style workflow.\n\n# Requirements\n\n* Python 2.7\n* Docker\n\n# Workflow\n\n### Make sure virl cli is configured\n\n```\nexport VIRL_HOST=myvirlserver.change.me\n```\n\n### Clone this repo / create virtualenv / install requirements\n\n```\ngit clone https://github.com/kecorbin/pyats-ios-sample\ncd pyats-ios-sample\nvirtualenv venv\nsource venv/bin/activate\npip install -r requirements.txt\n\n```\n\n### Launch topology\n\n```\nvirl up\n```\nIt may take a minute to boot the nodes, make sure that you allow enough time for\nthe topology to boot. This can be verified using the `virl ls` and `virl nodes`\ncommands\n\n#### Sample outputs\n\n```\nvirl ls\n\nRunning Simulations\n╒═════════════════════════════════╤══════════╤════════════════════════════╤═══════════╕\n│ Simulation                      │ Status   │ Launched                   │ Expires   │\n╞═════════════════════════════════╪══════════╪════════════════════════════╪═══════════╡\n│ pyats-ios-sample_default_UbI56G │ ACTIVE   │ 2017-12-13T22:02:36.810310 │           │\n╘═════════════════════════════════╧══════════╧════════════════════════════╧═══════════╛\n\nvirl nodes\n\n\n    Here is a list of all the running nodes\n\n╒═══════════╤══════════╤═════════╤═════════════╤════════════╤══════════════════════╤════════════════════╕\n│ Node      │ Type     │ State   │ Reachable   │ Protocol   │ Management Address   │ External Address   │\n╞═══════════╪══════════╪═════════╪═════════════╪════════════╪══════════════════════╪════════════════════╡\n│ ~mgmt-lxc │ mgmt-lxc │ ACTIVE  │ REACHABLE   │ ssh        │ 10.255.0.154         │ 10.94.238.236      │\n├───────────┼──────────┼─────────┼─────────────┼────────────┼──────────────────────┼────────────────────┤\n│ ios2      │ IOSv     │ ACTIVE  │ UNREACHABLE │ telnet     │ 10.255.0.156         │ N/A                │\n├───────────┼──────────┼─────────┼─────────────┼────────────┼──────────────────────┼────────────────────┤\n│ ios1      │ IOSv     │ ACTIVE  │ UNREACHABLE │ telnet     │ 10.255.0.155         │ N/A                │\n╘═══════════╧══════════╧═════════╧═════════════╧════════════╧══════════════════════╧════════════════════╛\n\n```\n\n### Generate pyATS testbed inventory\n\nThe virlutils package provides us an easy way of dynamically generating a testbed\ndefinition with the accurate connectivity information for the simulation.\n\n```\nvirl generate pyats\n```\n\n\n### Verify\n\nLaunch pyATS test suite\n\n```\nmake test\n```\n\n#### Sample output\n\n```\n2017-12-13T23:01:17: %EASYPY-INFO: +------------------------------------------------------------------------------+\n2017-12-13T23:01:17: %EASYPY-INFO: |                             Task Result Summary                              |\n2017-12-13T23:01:17: %EASYPY-INFO: +------------------------------------------------------------------------------+\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example.commonSetup                                    PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example.PingTestcase[device=ios1]                      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example.PingTestcase[device=ios2]                      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example.VerifyInterfaceCountTestcase[device=ios1]      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example.VerifyInterfaceCountTestcase[device=ios2]      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example.commonCleanup                                  PASSED\n2017-12-13T23:01:17: %EASYPY-INFO:\n2017-12-13T23:01:17: %EASYPY-INFO: +------------------------------------------------------------------------------+\n2017-12-13T23:01:17: %EASYPY-INFO: |                             Task Result Details                              |\n2017-12-13T23:01:17: %EASYPY-INFO: +------------------------------------------------------------------------------+\n2017-12-13T23:01:17: %EASYPY-INFO: __task1: pyats_ios_example\n2017-12-13T23:01:17: %EASYPY-INFO: |-- commonSetup                                                           PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |-- check_topology                                                    PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |-- establish_connections                                             PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |   |-- Step 1: Connecting to Router-1                                PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |   `-- Step 2: Connecting to Router-2                                PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   `-- marking_interface_count_testcases                                 PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |-- PingTestcase[device=ios1]                                             PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |-- ping[destination=10.10.10.1]                                      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   `-- ping[destination=10.10.10.2]                                      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |-- PingTestcase[device=ios2]                                             PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |-- ping[destination=10.10.10.1]                                      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   `-- ping[destination=10.10.10.2]                                      PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |-- VerifyInterfaceCountTestcase[device=ios1]                             PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |-- extract_interface_count                                           PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   `-- verify_interface_count                                            PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |-- VerifyInterfaceCountTestcase[device=ios2]                             PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   |-- extract_interface_count                                           PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: |   `-- verify_interface_count                                            PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: `-- commonCleanup                                                         PASSED\n2017-12-13T23:01:17: %EASYPY-INFO:     `-- disconnect                                                        PASSED\n2017-12-13T23:01:17: %EASYPY-INFO:         |-- Step 1: Disconnecting from Router-1                           PASSED\n2017-12-13T23:01:17: %EASYPY-INFO:         `-- Step 2: Disconnecting from Router-2                           PASSED\n2017-12-13T23:01:17: %EASYPY-INFO: No SMTP server information configured, ignoring sending notification email.\n2017-12-13T23:01:17: %EASYPY-INFO: Done!\n\n```\n\n# pyATS details\n\nThis repo contains a full test script in pyATS with local libraries that connects to a\ntestbed of IOS devices, and runs various test cases that parses command outputs,\ncollects router information, and report them in log.\n\n## General Information\n\n- Website: https://developer.cisco.com/site/pyats/\n- Bug Tracker: https://github.com/CiscoTestAutomation/pyats/issues\n- Documentation: https://developer.cisco.com/site/pyats/docs/\n\n## Arguments\n\nThis script requires one script argument `testbed` to be passed in when run\nunder standalone execution for demonstration purposes.\ntestbed: the path to testbed yaml file\n\nThis script requires one script argument `testbed_file` and two optional\nscript argument `ios1` and `ios2` to be passed in when run under easypy for\ndemonstration purposes.\n\n    testbed_file: the path to testbed yaml file\n    ios1: the device name defined in the testbed yaml file, if modified\n    ios2: the device name defined in the testbed yaml file, if modified\n\n## Topology\n\n```\n\n    +-------------+                                      +-------------+\n    |             |                                      |             |\n    |    ios1     | ------------------------------------ |    ios2     |\n    |             |          Gig0/1 \u003c-\u003e Gig0/1           |             |\n    +-------------+                                      +-------------+\n\n## Testing\n\nThis script performs the following tests for demonstration purposes.\n\n- router connection: basic device connection test\n- `ping` command: basic device ping test; logs ping result.\n- interface count verification\n  - execute `show version` command: basic command execution and data\n    parsing; extract ethernet and serial interface counts; logs interface\n    counts.\n  - execute `show ip interface brief` command: basic command execution and\n    data parsing; extract all ethernet and serial interfaces; logs number of\n    interface counts.\n  - verify ethernet and serial interface counts from above commands.\n- router disconnect: basic device disconnect test\n\n## Examples\n\n```\n# to run under standalone execution\n$ python pyats_ios_example.py --testbed pyats_ios_example.yaml\n\n# to run under easypy\n$ easypy pyats_ios_example_job.py -testbed_file pyats_ios_example.yaml\n```\n\nReferences:\n   For the complete and up-to-date user guide on pyATS, visit:\n    https://developer.cisco.com/site/pyats/docs/","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fpyats-ios-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscodevnet%2Fpyats-ios-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fpyats-ios-sample/lists"}