Skip to main content

Provides a class with custom functions for easy management of hp procurve and aruba switches

Project description

Code style PyPI


Logo

hp_procurvearuba

For easy management of hp procurve and aruba switches
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

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

(back to top)

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')

(back to top)

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

(back to top)

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

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Adeel Rauf - adraf2000@gmail.com

Project Link: https://github.com/adraf82/hp_procurvearuba

(back to top)

Acknowledgments

Credit goes to the creators and maintainers of the following projects;

(back to top)

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

hp_procurvearuba-2.0.0.tar.gz (14.1 kB view hashes)

Uploaded Source

Built Distribution

hp_procurvearuba-2.0.0-py3-none-any.whl (10.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page