![Header-Image](https://user-images.githubusercontent.com/70367776/188263859-0034b5f1-4e61-4f79-b34d-f7744f972810.png)
----
![PyPI](https://img.shields.io/pypi/v/nornir-maze?label=pypi%20version&style=plastic)
![PyPI - License](https://img.shields.io/pypi/l/nornir-maze?label=license&style=plastic)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/nornir-maze?label=wheel&style=plastic)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nornir-maze?label=python&style=plastic)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/nornir-maze?label=implementation&style=plastic)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/willikubny/nornir-maze?label=code%20size&style=plastic)
![Lines of code](https://img.shields.io/tokei/lines/github/willikubny/nornir-maze?label=total%20lines&style=plastic)
# Nornir-Maze
```diff
! Documentation under construction ...
```
### Introduction
Nornir_maze is a collection of Nornir tasks and general functions in Nornir stdout style.
By now nornir_maze contains the following modules:
#### General Modules with Helper Functions
* nornir_maze.git
* nornir_maze.utils
#### Cisco Software Upgrade
* nornir_maze.software_upgrade.utils
* nornir_maze.software_upgrade.nr_software_upgrade (ready-to-use script)
#### Cisco Support API
* nornir_maze.cisco_support.utils
* nornir_maze.cisco_support.api_calls
* nornir_maze.cisco_support.reports
#### Cisco Configuration Management
* nornir_maze.configuration_management.utils
* nornir_maze.configuration_management.pyats
* nornir_maze.configuration_management.cli.show_tasks
* nornir_maze.configuration_management.cli.config_tasks
* nornir_maze.configuration_management.cli.config_workflow
* nornir_maze.configuration_management.restconf.tasks
* nornir_maze.configuration_management.restconf.cisco_rpc
* nornir_maze.configuration_management.restconf.config_workflow
* nornir_maze.configuration_management.netconf.ops_tasks
* nornir_maze.configuration_management.netconf.config_tasks
* nornir_maze.configuration_management.netconf.config_workflow
## Installation
In order to use the tasks and functions from nornir-maze you will need to install the library from Pypi.
```bash
pip install nornir-maze
```
## Scripts Ready-to-Use
### nr_software_upgrade.py
The module `nornir_maze.software_upgrade.nr_software_upgrade` of nornir-maze is a ready-to-use script which can be imported and executed as shown below. The nr_software_upgrade script should work for the whole Cisco Catalys 9000 series. There are two options available to copy the software to the switches, which are an upload with SCP or a download with HTTP. Every task that is possible is first executed with RESTCONF and in case RESTCONF fails for any reason, then a CLI fallback task will be started only for the failed hosts.
```python3
#!/usr/bin/env python3
"""
OWN DESCRIPTION
"""
from nornir_maze.software_upgrade import nr_software_upgrade
def main() -> None:
"""
This is the main function and is executed when the file is directly executed.
"""
nr_software_upgrade.main()
if __name__ == "__main__":
main()
```
The script needs from the Nornir inventory a dictionary called `software` with three key value pairs. The `version` specifies the desired version which will be verified in the beginning in order to only taget host which really needs a software upgrade. The `filepath` specifies the path and filename and is needed of the SCP upload argument `local_upload` is used. The `http_url` is used as the default method if the `local_upload` argument is not used. Only one of both key value pairs are mandatory depending which method is used. Please read the comment below regading the dependencie of the `filepath` and the `http_url` key value pair.
To structure the Nornir inventory for different versions or files the `software` dictionary can be used in groups for the specific device us usecase.
```yaml
#### Cisco IOS-XE Software ###################################################################################
# The key "filepath" is mandatory for SCP upload and the key "http_url" is mandatory for HTTP download. If
# both keys "http_url" and "filepath" are present, then the md5 hash verification is made with "filepath"
# rather then with "http_url". This is much faster as the md5 hash can be computed directly on the local disk.
iosxe_c9200:
data:
software:
version: 17.03.04
filepath: docker_srv_httpd_nr_cm/htdocs/cat9k_lite_iosxe.17.03.04.SPA.bin
http_url: http://10.1.10.180:9999/cat9k_lite_iosxe.17.03.04.SPA.bin
iosxe_c9300_c9600:
data:
software:
version: 17.03.04
filepath: docker_srv_httpd_nr_cm/htdocs/cat9k_iosxe.17.03.04.SPA.bin
http_url: http://10.1.10.180:9999/cat9k_iosxe.17.03.04.SPA.bin
```
Raw data
{
"_id": null,
"home_page": "https://github.com/willikubny/nornir-maze",
"name": "nornir-maze",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Willi Kubny",
"author_email": "willi.kubny@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/93/52/d3da7fea4ac2c5875df019fd61239c2bdff8b317cc5913e8b26c2d192747/nornir-maze-0.0.115.tar.gz",
"platform": null,
"description": "![Header-Image](https://user-images.githubusercontent.com/70367776/188263859-0034b5f1-4e61-4f79-b34d-f7744f972810.png)\n\n----\n![PyPI](https://img.shields.io/pypi/v/nornir-maze?label=pypi%20version&style=plastic)\n![PyPI - License](https://img.shields.io/pypi/l/nornir-maze?label=license&style=plastic)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/nornir-maze?label=wheel&style=plastic)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nornir-maze?label=python&style=plastic)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/nornir-maze?label=implementation&style=plastic)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/willikubny/nornir-maze?label=code%20size&style=plastic)\n![Lines of code](https://img.shields.io/tokei/lines/github/willikubny/nornir-maze?label=total%20lines&style=plastic)\n\n\n# Nornir-Maze\n\n```diff\n! Documentation under construction ...\n```\n\n### Introduction\n\nNornir_maze is a collection of Nornir tasks and general functions in Nornir stdout style.\n\nBy now nornir_maze contains the following modules:\n\n#### General Modules with Helper Functions\n* nornir_maze.git\n* nornir_maze.utils\n\n#### Cisco Software Upgrade\n* nornir_maze.software_upgrade.utils\n* nornir_maze.software_upgrade.nr_software_upgrade (ready-to-use script)\n\n#### Cisco Support API\n* nornir_maze.cisco_support.utils\n* nornir_maze.cisco_support.api_calls\n* nornir_maze.cisco_support.reports\n\n#### Cisco Configuration Management\n* nornir_maze.configuration_management.utils\n* nornir_maze.configuration_management.pyats\n* nornir_maze.configuration_management.cli.show_tasks\n* nornir_maze.configuration_management.cli.config_tasks\n* nornir_maze.configuration_management.cli.config_workflow\n* nornir_maze.configuration_management.restconf.tasks\n* nornir_maze.configuration_management.restconf.cisco_rpc\n* nornir_maze.configuration_management.restconf.config_workflow\n* nornir_maze.configuration_management.netconf.ops_tasks\n* nornir_maze.configuration_management.netconf.config_tasks\n* nornir_maze.configuration_management.netconf.config_workflow\n\n## Installation\n\nIn order to use the tasks and functions from nornir-maze you will need to install the library from Pypi.\n\n```bash\npip install nornir-maze\n```\n\n## Scripts Ready-to-Use\n\n### nr_software_upgrade.py\n\nThe module `nornir_maze.software_upgrade.nr_software_upgrade` of nornir-maze is a ready-to-use script which can be imported and executed as shown below. The nr_software_upgrade script should work for the whole Cisco Catalys 9000 series. There are two options available to copy the software to the switches, which are an upload with SCP or a download with HTTP. Every task that is possible is first executed with RESTCONF and in case RESTCONF fails for any reason, then a CLI fallback task will be started only for the failed hosts.\n\n```python3\n#!/usr/bin/env python3\n\"\"\"\nOWN DESCRIPTION\n\"\"\"\n\nfrom nornir_maze.software_upgrade import nr_software_upgrade\n\n\ndef main() -> None:\n \"\"\"\n This is the main function and is executed when the file is directly executed.\n \"\"\"\n nr_software_upgrade.main()\n\n\nif __name__ == \"__main__\":\n main()\n```\n\nThe script needs from the Nornir inventory a dictionary called `software` with three key value pairs. The `version` specifies the desired version which will be verified in the beginning in order to only taget host which really needs a software upgrade. The `filepath` specifies the path and filename and is needed of the SCP upload argument `local_upload` is used. The `http_url` is used as the default method if the `local_upload` argument is not used. Only one of both key value pairs are mandatory depending which method is used. Please read the comment below regading the dependencie of the `filepath` and the `http_url` key value pair.\n\nTo structure the Nornir inventory for different versions or files the `software` dictionary can be used in groups for the specific device us usecase.\n\n```yaml\n#### Cisco IOS-XE Software ###################################################################################\n\n# The key \"filepath\" is mandatory for SCP upload and the key \"http_url\" is mandatory for HTTP download. If\n# both keys \"http_url\" and \"filepath\" are present, then the md5 hash verification is made with \"filepath\"\n# rather then with \"http_url\". This is much faster as the md5 hash can be computed directly on the local disk.\n\niosxe_c9200:\n data:\n software:\n version: 17.03.04\n filepath: docker_srv_httpd_nr_cm/htdocs/cat9k_lite_iosxe.17.03.04.SPA.bin\n http_url: http://10.1.10.180:9999/cat9k_lite_iosxe.17.03.04.SPA.bin\n\niosxe_c9300_c9600:\n data:\n software:\n version: 17.03.04\n filepath: docker_srv_httpd_nr_cm/htdocs/cat9k_iosxe.17.03.04.SPA.bin\n http_url: http://10.1.10.180:9999/cat9k_iosxe.17.03.04.SPA.bin\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Nornir_maze is a collection of Nornir tasks and general functions in Nornir stdout style.",
"version": "0.0.115",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9fd297e0bdab4e7fa99157386b18838a",
"sha256": "298beb8cae3a53a3f4583d3abcd882bafdf5e7f50556cf75f03d3b5a2aeb53b9"
},
"downloads": -1,
"filename": "nornir_maze-0.0.115-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9fd297e0bdab4e7fa99157386b18838a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 73278,
"upload_time": "2022-12-20T14:47:32",
"upload_time_iso_8601": "2022-12-20T14:47:32.907264Z",
"url": "https://files.pythonhosted.org/packages/31/64/ba050a6287d82c6efa2de7abe78261c609f649b8bf443609df838e32518f/nornir_maze-0.0.115-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "2811253fce5c13559c99e0973244a960",
"sha256": "ec3eb7a1a42dfc5fb7c61a8416a69ae78d42f724708673979069b27891694501"
},
"downloads": -1,
"filename": "nornir-maze-0.0.115.tar.gz",
"has_sig": false,
"md5_digest": "2811253fce5c13559c99e0973244a960",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 61292,
"upload_time": "2022-12-20T14:47:34",
"upload_time_iso_8601": "2022-12-20T14:47:34.270347Z",
"url": "https://files.pythonhosted.org/packages/93/52/d3da7fea4ac2c5875df019fd61239c2bdff8b317cc5913e8b26c2d192747/nornir-maze-0.0.115.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-20 14:47:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "willikubny",
"github_project": "nornir-maze",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pre-commit",
"specs": [
[
"==",
"2.20.0"
]
]
},
{
"name": "pyfiglet",
"specs": [
[
"==",
"0.8.post1"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0"
]
]
},
{
"name": "GitPython",
"specs": [
[
"==",
"3.1.18"
]
]
},
{
"name": "cisco-support",
"specs": [
[
"==",
"0.3.1"
]
]
},
{
"name": "nornir",
"specs": [
[
"==",
"3.3.0"
]
]
},
{
"name": "nornir-jinja2",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "nornir-netmiko",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "nornir-salt",
"specs": [
[
"==",
"0.16.1"
]
]
},
{
"name": "nornir-scrapli",
"specs": [
[
"==",
"2022.7.30"
]
]
},
{
"name": "nornir-utils",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "scrapli-ssh2",
"specs": [
[
"==",
"2020.10.24"
]
]
},
{
"name": "scrapli-netconf",
"specs": [
[
"==",
"2022.7.30"
]
]
},
{
"name": "pyats",
"specs": [
[
"==",
"22.10"
]
]
},
{
"name": "genie",
"specs": [
[
"==",
"22.10"
]
]
},
{
"name": "openpyxl",
"specs": [
[
"==",
"3.0.10"
]
]
},
{
"name": "XlsxWriter",
"specs": [
[
"==",
"3.0.3"
]
]
},
{
"name": "yaspin",
"specs": [
[
"==",
"2.2.0"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.28.1"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"1.5.1"
]
]
},
{
"name": "tabulate",
"specs": [
[
"==",
"0.9.0"
]
]
},
{
"name": "black",
"specs": [
[
"==",
"22.10.0"
]
]
},
{
"name": "yamllint",
"specs": [
[
"==",
"1.28.0"
]
]
},
{
"name": "pylint",
"specs": [
[
"==",
"2.15.5"
]
]
},
{
"name": "prospector",
"specs": [
[
"==",
"1.7.7"
]
]
},
{
"name": "bandit",
"specs": [
[
"==",
"1.7.4"
]
]
},
{
"name": "vulture",
"specs": [
[
"==",
"2.6"
]
]
},
{
"name": "yamllint",
"specs": [
[
"==",
"1.28.0"
]
]
}
],
"lcname": "nornir-maze"
}