-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9b47d5
commit 9d528e0
Showing
1 changed file
with
38 additions
and
64 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 |
---|---|---|
@@ -1,92 +1,66 @@ | ||
# omnivista_py | ||
# omnivista_py - An API Client for the Alcatel-Lucent OmniVista 2500 | ||
> a Python library that simplifies interaction with the OmniVista API. | ||
`omnivista_py` is a Python library that simplifies interaction with the OmniVista API. It allows easy authentication with a username and password, management of network devices, and querying of performance data. With integrated error handling and optional logging, the client provides developers with an effective tool for automating and monitoring network infrastructures. | ||
![PyPI - Version](https://img.shields.io/pypi/v/omnivista_py) | ||
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/omnivista_py) | ||
![PyPI - Wheel](https://img.shields.io/pypi/wheel/omnivista_py) | ||
[![Upload Python Package](https://github.com/phillipyosief/omnivista_py/actions/workflows/python-publish.yml/badge.svg)](https://github.com/phillipyosief/omnivista_py/actions/workflows/python-publish.yml) | ||
|
||
## Installation | ||
omnivista_py allows easy management of network devices, and querying of performance data. With integrated error handling and optional logging | ||
|
||
To install the library, use pip: | ||
## Installation | ||
|
||
Using [PyPi](https://pypi.org/project/omnivista-py/) | ||
```sh | ||
pip install omnivista_py | ||
``` | ||
|
||
## Usage | ||
## Usage example | ||
|
||
### Initialization | ||
|
||
First, initialize the `OVClient` with the base URL of the API, username, password, and optional parameters for SSL verification and logging. | ||
With omnivista_py, it has never been easier to search for a device and retrieve information about it. | ||
|
||
Here is an example of how to initialize the client, search for 3 devices using three different attributes, and then print out their software version, configured IP interfaces, and the current directory they are running in. | ||
```python | ||
from omnivista_py import OVClient | ||
from omnivista_py import OVClient, Device | ||
|
||
client = OVClient( | ||
url="https://omnivista.company.de", | ||
url="https://omnivista.com", | ||
username="your_username", | ||
password="your_password", | ||
verify=True, # Optional, default is True | ||
log=True # Optional, default is False | ||
password="your_password" | ||
) | ||
``` | ||
|
||
### Authentication | ||
|
||
Log in to the API: | ||
|
||
```python | ||
client.login() | ||
``` | ||
|
||
### Device Management | ||
client.login | ||
|
||
#### Get All Devices | ||
device1 = client.Device(client, ip_address="192.168.1.1") | ||
device2 = client.Device(client, hostname="myalcateldevice") | ||
device3 = client.Device(client, mac_address="3a:5f:1c:7e:2b:9d") | ||
|
||
Retrieve a list of all devices: | ||
devices = [device1, device2, device3] | ||
|
||
```python | ||
devices = client.get_all_devices() | ||
for device in devices: | ||
print(device.get_software_version()) | ||
print(device.get_ip_interfaces()) | ||
print(device.get_running_directory()) | ||
``` | ||
|
||
#### Device Information | ||
|
||
Create a `Device` instance and retrieve various information: | ||
You can find more examples [here]() | ||
|
||
```python | ||
device = client.Device(client, ip_address="192.168.1.1") | ||
|
||
# Get all information | ||
info = device.get_all_information() | ||
|
||
# Get specific details | ||
hostname = device.get_hostname() | ||
ip_address = device.get_ip_address() | ||
mac_address = device.get_mac_address() | ||
model_name = device.get_model_name() | ||
running_directory = device.get_running_directory() | ||
location = device.get_location() | ||
description = device.get_description() | ||
software_version = device.get_software_version() | ||
software_version_advanced = device.get_software_version_advanced() | ||
ip_interfaces = device.get_ip_interfaces() | ||
``` | ||
## Future Plans | ||
There are several features and improvements planned for future releases of omnivita_py. | ||
Which you can find all under [Projects](https://github.com/phillipyosief/omnivista_py/projects) | ||
|
||
## Error Handling | ||
|
||
The library includes custom exceptions for error handling: | ||
## Meta | ||
|
||
- `APIClientError`: Base class for exceptions in this module. | ||
- `AuthenticationError`: Raised for authentication-related errors. | ||
- `DeviceRetrievalError`: Raised when retrieving devices fails. | ||
- `LoginError`: Raised when login fails. | ||
Phillip Jerome Yosief | ||
|
||
Example: | ||
Distributed under the MIT license. See [``LICENSE``](LICENSE) for more information. | ||
|
||
```python | ||
try: | ||
client.login() | ||
except LoginError as e: | ||
print(f"Login failed: {e}") | ||
``` | ||
[github.com/phillipyosief/](https://github.com/phillipyosief/) | ||
|
||
## License | ||
## Contributing | ||
|
||
This project is licensed under the MIT License. | ||
1. Fork it (<https://github.com/phillipyosief/omnivista_py/fork>) | ||
2. Create your feature branch (`git checkout -b feature/fooBar`) | ||
3. Commit your changes (`git commit -am 'Add some fooBar'`) | ||
4. Push to the branch (`git push origin feature/fooBar`) | ||
5. Create a new Pull Request |