Skip to main content

Collection of API functions for Aruba products.

Project description

aos_api_connector

API connector for ArubaOS products

APIs supported:

  • ArubaOS-S Switches
  • ArubaOS-CX Switches
  • Aruba ClearPass

Installation

Install through pypi via pip:

pip install aos-api-connector

Or manually using the GitHub.

Usage

Every type of API has an API caller class. You can create instances of that class with at least three arguments:

  • Username
  • Password
  • URL / IP / FQDN address of the device

After creating the device, use connect() to create a session. Then use the other functions to use the API. When you are finished use disconnect() to logout.

AurubaOS-S Switch

from aos_api_connector.aos_s import aos_api_caller as aos_s


data = { "url": "172.16.78.65",
  "username": "admin",
  "password": "Aruba123",
  "api_version": "v7"
}
switch = aos_s.AOSSwitchAPIClient(**data)
switch.connect()
sys_info = switch.get_system_info()
print(sys_info)
switch.disconnect()

ArubaOS-CX

from aos_api_connector.aos_cx import aoscx_api_caller as aos_cx


data = { "url": "172.16.78.65",
  "username": "admin",
  "password": "Aruba123",
  "api_version": "v10.04"
}
switch = aos_cx.AOSCXwitchAPIClient(**data)
switch.connect()
sys_info = switch.get_system_info()
print(sys_info)
switch.disconnect()

ClearPass

ClearPass neds either an API token or a username password. That has to be set during instantiation of the API caller class. You can choose with which you want to login, look into example folder for more info.

from  aos_api_connector.cppm import cppm_api_caller as cppm


data = {  
	"url": "10.10.10.10",  
	"api_version": "v1",  
	"client_id": "api_client",  
	"grant_type": "client_credentials",  
	"client_secret": "lTOcISWlXzDV3HCZLT8CVJlN9zxrUirdP+gHpva4mWZ5"  
	}
cppm_test = cppm.CPPMAPIClient(**data)
cppm_test.connect()  
nd_info = cppm_test.get_all_network_devices()  
for nd in nd_info['_embedded']['items']:  
    print(f"Name: {nd['name']} \nIP: {nd['ip_address']} \n\n")

Please note that there is no syntax check!

Some parameters are case sensitive. For example, api_version, there is no check for "V7" or "v7", but only "v7" will work.

Differences between classes

The functions between the two classes should have the same name, if they end up doing the same. So both classes have connect(), disconnect() or get_vlans() even if they are implemented differently.

Roadmap

I am working on implementing more functions and to create classes for the ClearPass and ArubaOS WLAN APIs. After that I will create workflows spanning different APIs.

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

aos-api-connector-0.1.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

aos_api_connector-0.1.2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file aos-api-connector-0.1.2.tar.gz.

File metadata

  • Download URL: aos-api-connector-0.1.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for aos-api-connector-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8f6a06baf1420da37a6313ff523b916394732ea996e7088d3c15594949a7e8ae
MD5 431393e3bad7a87c32d504a44f8b8271
BLAKE2b-256 613482d66ac1fa15bfa219c1b425acdbff9dfbaaa5ce09c6112a91b90de12d36

See more details on using hashes here.

File details

Details for the file aos_api_connector-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aos_api_connector-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for aos_api_connector-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc9ac64ed0bee493d9b979a0bf992ea24c1b0f6c1945a1f937cbbaf08809d8eb
MD5 1c8ca8e1ab2f2e061803e2801de81719
BLAKE2b-256 cea37172bafc24e38b77d9098e59920a0e23698a45565ed278a2cf2f0414c406

See more details on using hashes here.

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