-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test cases updated and CI/CD setup added (#2)
* Changes made to get_environment method,test cases and requirements * Jdev (#1) * Added CI actions for GitHub * Added CI actions for GitHub * Updated action * Updated action * Updated action * Updated setup.py ready for releases * Updated setup.py ready for releases * Updated setup.py ready for releases * updated ci * updated ci * updated ci * fixed mocked data for get_interfaces * fixed textfsm template locator * added datetime>=4.3 to requirements.txt * updated mocked data based on windows and github epoch time * updated mocked data based on windows and github epoch time * Added datetime to requirements in setup.py * Adding note for test_get_interfaces not working on local system. Co-authored-by: Jonathon Lundstrom <[email protected]> Co-authored-by: jgcumming <[email protected]>
- Loading branch information
1 parent
66848a7
commit 90547fa
Showing
64 changed files
with
4,557 additions
and
5,282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python. | ||
# It will be extended to perform the NAPALM CI checks against the nokia napalm-sros driver shortly. | ||
|
||
name: napalm-sros | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.6" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
## **Testing for NAPALM with Nokia SR OS** | ||
1) To run the test framework, first install pytest: ```pip install pytest``` | ||
2) Locate the file: \"test/unit/sros/test_getters.py\" and run the class to test the getter methods | ||
3) Locate the file \"test/unit/TestDriver.py\" and run \"Class TestConfigNokiaSROSDriver\" to test all the config methods of NAPALM | ||
+ Location of files required by this test: | ||
- `napalm_sros/templates/set_hostname.j2` | ||
- `test/unit/sros/initial.conf` - Initial configuration sample | ||
- `test/unit/sros/merge_good.conf` - Merge config example | ||
- `test/unit/sros/merge_good.diff` - Compare output for merge | ||
- `test/unit/sros/merge_typo.conf` - Merege config example with error | ||
- `test/unit/sros/new_good.conf` - Replace config example | ||
- `test/unit/sros/new_good.diff` - Compare output for replace | ||
- `test/unit/sros/new_typo.conf` - Replace config example with error | ||
4) Location of mocked output files used for these tests is : `test/unit/mocked_data` | ||
2) You can run the test two ways: | ||
1) Run command `python -m pytest` | ||
2) Locate and run the file `test/test_getters.py` | ||
|
||
Note: The test "test_get_interfaces" passes for CI/CD on Github, but it does not pass on individual local system due to | ||
computational difference on different Operating Systems of date and time. | ||
|
||
|
||
We welcome suggestions and contributions of additional tests for the framework. Please contact the Nokia owners of this repository for how to contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
# from napalm import get_network_driver | ||
# | ||
# driver = get_network_driver("sros") | ||
# optional_args = {'port': 830} | ||
# device = driver("127.0.0.1", "vagrant", "vagrant", 60, optional_args) | ||
# device.open() | ||
# print(device.get_facts()) | ||
# print(device.get_optics()) | ||
# device.close() | ||
|
||
|
||
from napalm import get_network_driver | ||
|
||
driver = get_network_driver("sros") | ||
optional_args = {'port': 830} | ||
device = driver("127.0.0.1", "vagrant", "vagrant", 60, optional_args) | ||
device = driver("10.1.0.101", "admin", "admin", 60, optional_args) | ||
device.open() | ||
print(device.get_facts()) | ||
print(device.get_optics()) | ||
print(device.get_config()) | ||
# print(device.get_optics()) | ||
device.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
napalm>=3.3.1 | ||
|
||
pytest>=5.4.3 | ||
setuptools>=47.3.1 | ||
pip>=20.1.1 | ||
textfsm>=1.1.0 | ||
paramiko>=2.7.1 | ||
lxml>=4.6.2 | ||
lxml==4.6.2 | ||
ncclient>=0.6.7 | ||
|
||
xmltodict>=0.12.0 | ||
dictdiffer>=0.9.0 | ||
dictdiffer>=0.9.0 | ||
datetime>=4.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
"""setup.py file.""" | ||
|
||
from setuptools import setup, find_packages | ||
with open("requirements.txt", "r") as file: | ||
reqs = [req for req in file.read().splitlines() if (len(req) > 0 and not req.startswith("#"))] | ||
__author__ = 'Ashna Shah <[email protected]>' | ||
|
||
with open("README.md", "r", encoding="utf-8") as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name="napalm-sros", | ||
version="0.1.0", | ||
version="1.0.0", | ||
packages=find_packages(), | ||
author="Ashna Shah", | ||
author_email="[email protected]", | ||
author="Nokia", | ||
author_email="", | ||
description="Network Automation and Programmability Abstraction Layer with Multivendor support", | ||
classifiers=[ | ||
'Topic :: Utilities', | ||
'Programming Language :: Python :: 3.6', | ||
'Operating System :: POSIX :: Linux', | ||
'Operating System :: MacOS', | ||
"Topic :: Internet", | ||
"Programming Language :: Python :: 3.6", | ||
"Natural Language :: English", | ||
"Development Status :: 4 - Beta", | ||
], | ||
url="https://github.com/napalm-automation/napalm-sros", | ||
include_package_data=True, | ||
install_requires=reqs, | ||
) | ||
install_requires=[ | ||
"napalm>=3.3.1", | ||
"pytest>=5.4.3", | ||
"textfsm>=1.1.0", | ||
"paramiko>=2.7.1", | ||
"lxml>=4.6.2", | ||
"ncclient>=0.6.7", | ||
"xmltodict>=0.12.0", | ||
"dictdiffer>=0.9.0", | ||
"datetime>=4.3", | ||
], | ||
python_requires=">=3.6", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
) |
Oops, something went wrong.