- Notifications
You must be signed in to change notification settings - Fork25
aruba/pycentral
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Welcome to PyCentral, a Python SDK for interacting with HPE Aruba Networking Central via REST APIs. This library provides tools for automating repetitive tasks, configuring multiple devices, monitoring, and more.
Warning
This is apre-release version of PyCentral-v2, and the features are constantly being updated as the APIs evolve. This version of the SDK allows you to make API calls to New Central, GLP, and Classic Central.
If you are looking for the stable version of PyCentral (v1), it is still available and fully supported. PyCentral-v1, which only supports Classic Central, can be foundhere.
Thispre-release version allows users to make REST API calls to New Central, the next generation of HPE Aruba Networking Central. It also supports making REST API calls to the HPE GreenLake Platform.
Upgrading to this pre-release version will not break PyCentral-v1 code. All the PyCentral-v1 code has been moved to theclassic
folder within the PyCentral directory, ensuring backward compatibility. You can find Classic Central PyCentral Documentationhere.
To install the latest pre-release version of PyCentral, use the following command:
pip3 install --pre pycentral
If you already have PyCentral-v1 and would like to upgrade to the pre-release version, use the following command:
pip3 install --upgrade --pre pycentral
Once you have installed the pre-release version of PyCentral, you need to obtain the necessary authentication details based on the platform you are working with:
For New Central, you must obtain the following details before making API requests:
- Base URL or Cluster Name: Base URL is the API Gateway URL for your New Central account based on the geographical cluster of your account on the HPE GreenLake Platform. You can find the base URL or cluster name of your New Central account's API Gateway from the tablehere.
- Client ID and Client Secret: These credentials are required to generate an access token to authenticate API requests. You can obtain them by creating a Personal API Client for your New Central Account. Follow the detailed steps in theCreate Client Credentials documentation.
If you are working with HPE GreenLake APIs, authentication is slightly different:
- GLP does not require a Base URL.
- You only need theClient ID & Client Secret for the HPE GreenLake Platform.
Before running the script, create atoken.yaml
file in the same directory and populate it with the required credentials as follows:
new_central:base_url:<api-base-url>client_id:<client-id>client_secret:<client-secret>glp:client_id:<client-id>client_secret:<client-secret>
Once you have thetoken.yaml
file ready, you can run the following Python script:
importosfrompycentralimportNewCentralBase# Validate token file existstoken_file="token.yaml"ifnotos.path.exists(token_file):raiseFileNotFoundError(f"Token file '{token_file}' not found. Please provide a valid token file." )# Initialize NewCentralBase class with the token credentials for New Central/GLPnew_central_conn=NewCentralBase(token_info=token_file,)# New Central API Callnew_central_resp=new_central_conn.command(api_method="GET",api_path="network-monitoring/v1alpha1/aps")print(new_central_resp)print()# GLP API Callglp_resp=new_central_conn.command(api_method="GET",api_path="devices/v1/devices",app_name="glp")print(glp_resp)
Run the script using the following command:
python3 demo.py
The Classic Central functionality is still fully supported by the SDK and has been moved to a dedicated documentation page. For information on using the SDK with Classic Central, including authentication methods, API calls, and workflow examples, please see theClassic Central Documentation.
About
Aruba Central Python SDK
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.