Skip to main content

HPE Aruba Networking Central Python Package

Project description

PyCentral (Python SDK for HPE Aruba Networking Central)

⚠️ Pre-release Notice
This is a pre-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 found here.

A Python SDK for interacting with HPE Aruba Networking Central via REST APIs.
Automate onboarding, configuration, monitoring, and management for:

  • New Central
  • HPE GreenLake Platform (GLP)
  • Classic Central (via the classic module for backward compatibility)

Upgrading to this pre-release version will not break PyCentral-v1 code. All the PyCentral-v1 code has been moved to the classic folder within the PyCentral directory, ensuring backward compatibility. You can find Classic Central PyCentral Documentation here.


Install

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

Authentication

New Central

You will need:

  • Base URL or Cluster Name: Identifies your Central Account's API gateway. Both options function identically. Use whichever is convenient:
    • Base URL — URL for requests to your Central API Gateway. For instructions on how to locate your Base URL, see Finding Your Base URL in Central.
    • Cluster Name — Name of the cluster where your account is provisioned. A table detailing all cluster names can be found here.
  • 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 the Create Client Credentials documentation.
new_central:
  base_url: <api-base-url>
  client_id: <client-id>
  client_secret: <client-secret>

HPE GreenLake Platform (GLP)

If you are working with HPE GreenLake APIs, authentication is slightly different:

  • GLP does not require a Base URL.
  • You only need the Client ID & Client Secret for the HPE GreenLake Platform.
glp:
  client_id: <client-id>
  client_secret: <client-secret>

Example

Before running the script, create a token.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 the token.yaml file ready, you can run the following Python script:

import os
from pycentral import NewCentralBase

# Validate token file exists
token_file = "token.yaml"
if not os.path.exists(token_file):
    raise FileNotFoundError(
        f"Token file '{token_file}' not found. Please provide a valid token file."
    )

# Initialize NewCentralBase class with the token credentials for New Central/GLP
with NewCentralBase(token_info=token_file) as conn:
   
    # Make the API call to retrieve device inventory
    resp = conn.command(
        api_method="GET",
        api_path="network-monitoring/v1/device-inventory"
    )
    
    # If the response code is 200, print the device inventory response; otherwise, print the error code and message
    if resp["code"] == 200:
        print(resp["msg"])
    else:
        print(f"Error {resp['code']}: {resp['msg']}")

Run the script using the following command:

python3 demo.py

Compatibility

  • v2 supports New Central and GLP.
  • Classic Central (v1) remains in the classic module for backward compatibility.
  • Existing v1 code will continue to work without changes.

Documentation


Classic Central

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 the Classic Central Documentation.

Documentation

Use-Cases and Workflows

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

mv_pycentral-2.0a19.tar.gz (137.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mv_pycentral-2.0a19-py3-none-any.whl (182.1 kB view details)

Uploaded Python 3

File details

Details for the file mv_pycentral-2.0a19.tar.gz.

File metadata

  • Download URL: mv_pycentral-2.0a19.tar.gz
  • Upload date:
  • Size: 137.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for mv_pycentral-2.0a19.tar.gz
Algorithm Hash digest
SHA256 a94899752bb7ab6ae7281a627f5a99674dc4e269701121f9f02f2a2c174e5353
MD5 e97282d24f1c21ea2e25463839132c3a
BLAKE2b-256 5beb456d5c41ab5be2d6b241dba172c8de1330aec0e598e3bab149c8f7dbc9c6

See more details on using hashes here.

File details

Details for the file mv_pycentral-2.0a19-py3-none-any.whl.

File metadata

  • Download URL: mv_pycentral-2.0a19-py3-none-any.whl
  • Upload date:
  • Size: 182.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for mv_pycentral-2.0a19-py3-none-any.whl
Algorithm Hash digest
SHA256 8d148b11b59c2d12d73b7a2aa187c98b519b3b1539d51faaed4c500c9623954e
MD5 c1807b48e2d53b6e52e3d0ab2dbdb4e3
BLAKE2b-256 59b964d7c69e9c2c131313d66a2ca5ab4978eccf1f33cdfbb935f92b9c3dca1b

See more details on using hashes here.

Supported by

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