Provides a class with custom functions for easy management of hp procurve and aruba switches
Project description
hp_procurvearuba
For easy management of hp procurve and aruba switches
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
About hp_procurvearuba
The hp_procurvearuba project was created with the aim of simplifying the management of HP procurve and aruba switches. The project provides a wrapper around the netmiko HPProcurveSSH class consisting of a composite class called HP with custom functions to manage HP procurve and aruba switches.
The project consists of functions that will find and display only the information requested such as the find_switch_serial_number function which displays the serial number of the switch;
-------------------------
HOSTNAME SERIAL_NUMBER
-------------------------
HP_1 SG59FLX6CK
-------------------------
There are many other practical functions in the hp_procurvearuba library such as functions for backing up configuration files, uploading configuration files and loading firmware with tftp and sftp.
To view the full list of functions and docstrings inclued in the library see the procurvearuba module here
Installation
The hp_procurvearuba package can be installed with pip as follows;
pip install hp_procurvearuba
Prerequisites
External dependencies for the package will be installed with pip. To see the full list of dependencies see requirements.txt here
The hp_procurvearuba project uses textfsm from the ntc-templates library for many functions. Set the environment variable NET_TEXTFSM to point to the index file in ntc-templates as below;
export NET_TEXTFSM=/path/to/ntc-templates/ntc_templates/templates
Getting Started
Create a dictionary with your device details. Here is a list of devices displayed in yaml format;
devices:
- device_type: hp_procurve
ip: 192.168.1.1
hostname: HP_1
password: password
username: username
- device_type: hp_procurve
ip: 192.168.1.2
hostname: HP_2
password: password
username: username
Import the HP class with the following line;
from hp_procurvearuba import HP
Create an instance of the HP class;
with open('devices.yml', 'r') as f:
device_data = yaml.safe_load(f)
device_data = device_data.pop('devices')
device_data = device_data
for device in device_data:
hp_obj = HP(**device)
Invoke the function you require;
hp_obj.sftp_backup_config('192.168.1.3')
Usage
For an example of a useable script and a devices inventory file please refer to the example_script.py and devices.yaml files in examples
Included in the package is a set of unit tests. Pytest can be run against any of the functions. The full list of test functions can be found in the test_funcs.py file here
Contributing
Contributions to the project are welcome. Any contributions you make are greatly appreciated. Please fork the repository and create a pull request. Run the tox program inside the root folder hp_procurvearuba when testing your changes. If you are adding a new function to the project, please add an accompanying unit test to the test_funcs.py file here
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Adeel Rauf - adraf2000@gmail.com
Project Link: https://github.com/adraf82/hp_procurvearuba
Acknowledgments
Credit goes to the creators and maintainers of the following projects;
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hp_procurvearuba-2.0.0.tar.gz
.
File metadata
- Download URL: hp_procurvearuba-2.0.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70ecac2234b09349e0138ffc83fb98930d38cb6aed87d5808df99000332ae0c7 |
|
MD5 | 3c38297a627f54b8f67ef8abeb716a57 |
|
BLAKE2b-256 | c6363237788fa3aeffb4ec91b1965bcf695a4f186492528c841b4b042125655c |
File details
Details for the file hp_procurvearuba-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: hp_procurvearuba-2.0.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4685ae4b9ca4a95061c99dd88b9de6a0c03cb399bfc7708b7da8bb9562408db2 |
|
MD5 | 6bac5557701720d032fd46d29cf1837c |
|
BLAKE2b-256 | 1153e06891e17ccde155d88573e2303faf2095d311c2194e0cbc3bacffd69f53 |