Skip to content

Commit ec91524

Browse files
committed
modernization
1 parent 0eb664d commit ec91524

24 files changed

+396
-379
lines changed

.gitignore

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
db.sqlite3
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Environments
85+
.env
86+
.venv
87+
env/
88+
venv/
89+
ENV/
90+
env.bak/
91+
venv.bak/
92+
93+
# Spyder project settings
94+
.spyderproject
95+
.spyproject
96+
97+
# Rope project settings
98+
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/

NOTICE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Copyright (c) 2019 Cisco Systems, Inc. and/or its affiliates
1+
Copyright (c) 2020 Cisco Systems, Inc. and/or its affiliates
22

33
This project includes software developed at Cisco Systems, Inc. and/or its affiliates.

README.md

+34-18
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,56 @@
11
[![published](https://static.production.devnetcloud.com/codeexchange/assets/images/devnet-published.svg)](https://developer.cisco.com/codeexchange/github/repo/CiscoTestAutomation/solutions_examples)
22

3-
# pyATS and Genie Solutions examples
3+
# pyATS Solutions Examples
44

5-
This repository contains several scripts for network health checking using the
6-
[pyATS Framework](https://developer.cisco.com/site/pyats/)
5+
This repository contains several NetDevOps scripts build by our user community
6+
using [pyATS Framework](https://developer.cisco.com/pyats/)
77

8-
These are intended be examples/starting points for solving common network operations
9-
challenges.
8+
## Contributions
109

10+
Everyone is welcome to leverage these scripts as starting points on solving
11+
common network operations challenges.
1112

12-
# Installation / configuration
13+
If you have additional thoughts, ideas, or samples you'd like to contribute,
14+
feel free to open a PR and become a member of the development community!
1315

14-
##### Installation
15-
```
16-
git clone https://github.com/CiscoTestAutomation/solutions_examples.git
16+
## Installation
17+
18+
```bash
19+
# first, ensure you have a pyATS virtual environment
20+
# eg:
21+
mkdir -p ~/workspace/pyats
22+
cd ~/workspace/pyats
23+
python3 -m venv .
24+
source bin/activate
25+
pip install --upgrade pip setuptools
26+
pip install pyats[full]
27+
28+
# now, clone this repository
29+
git clone https://github.com/CiscoTestAutomation/solutions_examples
1730
cd solutions_examples
18-
python3 -m venv venv
19-
source venv/bin/activate
31+
32+
# install the common dependencies
2033
pip install -r requirements.txt
34+
35+
# you're good to go!
2136
```
2237

23-
You can visit our [documentation](https://pubhub.devnetcloud.com/media/pyats-packages/docs/genie/cookbooks/genie.html#how-to-install-genie) for more information.
38+
You can visit our [documentation](https://developer.cisco.com/docs/pyats/) for more information.
2439

25-
##### Simulation
40+
## VIRL Simulation
2641

2742
We've provided a [topology.virl](./topology.virl) file for you to test with.
2843

29-
##### Testbed configuration
44+
## Testbed configuration
3045

3146
We've provided a [default_testbed.yaml](./testedbed.yaml) to go along with the
3247
sample topology. you'll likely need to change it to match your devices
3348

34-
# checks
49+
## Notable Examples
50+
51+
* [bgp_adjacencies](./bgp_adjacencies) - "if a neighbor is configured, it should be established"
3552

36-
* #### [bgp_adjacencies](./bgp_adjacencies) - "if a neighbor is configured, it should be established"
53+
* [crc_errors](./crc_errors) - "No interface should be accumulating CRC errors"
3754

38-
* #### [crc_errors](./crc_errors) - "No interface should be accumulating CRC errors"
55+
* [hostname_checker](./hostname_checker) - "Verify devices hostname with Testbed file names"
3956

40-
* #### [hostname_checker](./hostname_checker) - "Verify devices hostname with Testbed file names"

bgp_adjacencies/BGP_Neighbors_Established.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from tabulate import tabulate
88

99
# Needed for aetest script
10-
from ats import aetest
11-
from ats.log.utils import banner
10+
from pyats import aetest
11+
from pyats.log.utils import banner
1212

1313
# Genie Imports
1414
from genie.conf import Genie

bgp_adjacencies/BGP_check_job.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
# pyats run job BGP_check_job.py --testbed-file <testbed_file.yaml>
33
# Description: This job file checks that all BGP neighbors are in Established state
44
import os
5-
from ats.easypy import run
6-
75

86
# All run() must be inside a main function
9-
def main():
7+
def main(runtime):
108
# Find the location of the script in relation to the job file
11-
bgp_tests = os.path.join('./BGP_Neighbors_Established.py')
9+
bgp_tests = os.path.join(os.path.dirname(__file__),
10+
'BGP_Neighbors_Established.py')
1211
# Execute the testscript
13-
# run(testscript=testscript)
14-
run(testscript=bgp_tests)
12+
runtime.tasks.run(testscript=bgp_tests)

bgp_adjacencies/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ This check connects to all devices defined in the testbed, and parses BGP operat
55
# Running
66

77
```
8-
easypy BGP_check_job.py -html_logs -testbed_file ../default_testbed.yaml
8+
pyats run job BGP_check_job.py --html-logs --testbed-file ../default_testbed.yaml
99
```

crc_errors/CRC_Count_check.py

-155
This file was deleted.

crc_errors/CRC_check_job.py

-12
This file was deleted.

0 commit comments

Comments
 (0)