mv-pycentral 1.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. mv_pycentral-1.4.3/LICENSE +21 -0
  2. mv_pycentral-1.4.3/PKG-INFO +154 -0
  3. mv_pycentral-1.4.3/README.md +120 -0
  4. mv_pycentral-1.4.3/mv_pycentral.egg-info/PKG-INFO +154 -0
  5. mv_pycentral-1.4.3/mv_pycentral.egg-info/SOURCES.txt +27 -0
  6. mv_pycentral-1.4.3/mv_pycentral.egg-info/dependency_links.txt +1 -0
  7. mv_pycentral-1.4.3/mv_pycentral.egg-info/requires.txt +7 -0
  8. mv_pycentral-1.4.3/mv_pycentral.egg-info/top_level.txt +1 -0
  9. mv_pycentral-1.4.3/pycentral/__init__.py +0 -0
  10. mv_pycentral-1.4.3/pycentral/audit_logs.py +182 -0
  11. mv_pycentral-1.4.3/pycentral/base.py +690 -0
  12. mv_pycentral-1.4.3/pycentral/base_utils.py +250 -0
  13. mv_pycentral-1.4.3/pycentral/configuration.py +1397 -0
  14. mv_pycentral-1.4.3/pycentral/constants.py +42 -0
  15. mv_pycentral-1.4.3/pycentral/device_inventory.py +252 -0
  16. mv_pycentral-1.4.3/pycentral/firmware_management.py +277 -0
  17. mv_pycentral-1.4.3/pycentral/licensing.py +488 -0
  18. mv_pycentral-1.4.3/pycentral/monitoring.py +313 -0
  19. mv_pycentral-1.4.3/pycentral/msp.py +889 -0
  20. mv_pycentral-1.4.3/pycentral/rapids.py +513 -0
  21. mv_pycentral-1.4.3/pycentral/refresh_api_token.py +67 -0
  22. mv_pycentral-1.4.3/pycentral/topology.py +145 -0
  23. mv_pycentral-1.4.3/pycentral/url_utils.py +244 -0
  24. mv_pycentral-1.4.3/pycentral/user_management.py +427 -0
  25. mv_pycentral-1.4.3/pycentral/visualrf.py +351 -0
  26. mv_pycentral-1.4.3/pycentral/workflows/__init__.py +0 -0
  27. mv_pycentral-1.4.3/pycentral/workflows/workflows_utils.py +154 -0
  28. mv_pycentral-1.4.3/setup.cfg +4 -0
  29. mv_pycentral-1.4.3/setup.py +32 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Aruba, a Hewlett Packard Enterprise company
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: mv-pycentral
3
+ Version: 1.4.3
4
+ Summary: Aruba Central Python Package
5
+ Home-page: https://github.com/Moviri/mv-pycentral
6
+ Author: aruba-automation
7
+ Author-email: dynatrace_extensions@moviri.com
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: Topic :: System :: Networking
13
+ Classifier: Development Status :: 4 - Beta
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests==2.32.5
18
+ Requires-Dist: PyYAML==6.0.3
19
+ Requires-Dist: urllib3==2.6.3
20
+ Requires-Dist: certifi==2026.1.4
21
+ Provides-Extra: colorlog
22
+ Requires-Dist: colorlog; extra == "colorlog"
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: license-file
30
+ Dynamic: provides-extra
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
34
+
35
+ # pycentral
36
+ #### Aruba Central Python Package Index SDK
37
+
38
+ Aruba Central is an unified cloud-based network management and configuration platform for campus, branch, remote and data center networks. There are various needs for automation and programmability like automating repetitive tasks, configuring multiple devices, monitoring and more. This python package is to programmatically interact with Aruba Central via REST APIs.
39
+
40
+ ### How To Install
41
+ In order to run the workflow scripts, please complete the steps below:
42
+ 1. install virtual env (refer https://docs.python.org/3/library/venv.html). Make sure python version 3 is installed in system.
43
+ ```
44
+ $ python3 -m venv centralenv
45
+ ```
46
+
47
+ 2. Activate the virtual env
48
+ ```
49
+ $ source centralenv/bin/activate
50
+ in Windows:
51
+ $ centralenv/Scripts/activate.bat
52
+ ```
53
+
54
+ 3. Install the **pycentral** package
55
+ ```
56
+ (centralenv)$ pip3 install pycentral
57
+ ```
58
+
59
+ To install package with *extras* `colorLog` which will display log in color
60
+ ```
61
+ (centralenv)$ pip3 install pycentral[colorLog]
62
+ ```
63
+
64
+ Now you can start making your script based on modules in pycentral or use different workflows from the subpackage `workflows`.
65
+
66
+ ## Executing Scripts
67
+
68
+ 1. Gathering variables required for the package base class `ArubaCentralBase`.
69
+
70
+ * **base_url** OR **cluster_name**: You can find the base URL or cluster name of the Central account's API Gateway from the table <a href="https://www.arubanetworks.com/techdocs/central/latest/content/nms/api/domain_url.htm" target="_blank">here</a>. The base URL or cluster name is based on the geographical Central cluster in which the account is registered.
71
+
72
+ * **access_token**: You can create an API access token for Aruba Central from -
73
+ * <a href="https://developer.arubanetworks.com/aruba-central/docs/api-gateway-obtaining-access-tokens#obtain-access-token-via-web-ui" target="_blank">Aruba Central UI</a>
74
+ * <a href="https://developer.arubanetworks.com/aruba-central/docs/api-oauth-access-token" target="_blank">OAuth APIs</a>
75
+
76
+ * Optional variables - You need to provide the below variables if you want to use PyCentral's ability to generate access tokens from Aruba Central with the help of OAuth APIs.
77
+ * **username** and **password**: Aruba Central user's *username* and *password*. The access token generated by the OAUTH APIs will have the same role/privileges as the provided Aruba Central user.
78
+
79
+ * **client_id** and **client_secret**: Obtain client_id and client_secret variables by creating an API Gateway client in Aruba Central. Refer the following <a href="https://developer.arubanetworks.com/aruba-central/docs/api-gateway-creating-application-token" target="_blank">documentation</a> for more details.
80
+
81
+ * **customer_id**: Obtain the **customer_id** by clicking on the figure icon on top right corner of Aruba Central WebUI.
82
+
83
+ ![Customer ID](https://github.com/aruba/pycentral/raw/master/pictures/customer-id.png)
84
+
85
+
86
+ 2. Providing input variables to the Python scripts. One of the following options can be used.
87
+ * Provide variables directly to Aruba Central Base class in dictionary format.
88
+
89
+ Access token approach:
90
+ ```python
91
+ central_info = {
92
+ "base_url": "<api-gateway-domain-url>",
93
+ "token": {
94
+ "access_token": "<api-gateway-access-token>"
95
+ }
96
+ }
97
+ ```
98
+
99
+ OAUTH APIs approach with capability to generate new access token:
100
+ ```python
101
+ central_info = {
102
+ "username": "<aruba-central-account-username>",
103
+ "password": "<aruba-central-account-password>",
104
+ "client_id": "<api-gateway-client-id>",
105
+ "client_secret": "<api-gateway-client-secret>",
106
+ "customer_id": "<aruba-central-customer-id>",
107
+ "base_url": "<api-gateway-domain-url>"
108
+ }
109
+ ```
110
+ Alternatively, you can use **cluster_name** instead of **base_url** in the above mentioned dictionaries. You can find the list of clusters that are supported in the <a href="https://github.com/aruba/pycentral/blob/master/pycentral/constants.py" target="_blank">constants.py file</a>. If you would like to add support for other Central clusters, you can do so by adding it in the constants.py.
111
+ Refer the sample scripts in *step3* and *step4* for examples.
112
+
113
+ * **OR** Provide the required variables using JSON/YAML file. Refer to the sample input files to understand how the files have to be structured -
114
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/input_token_only.yaml" target="_blank">sample_scripts/input_token_only.yaml</a>
115
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/input_credentials.yaml" target="_blank">sample_scripts/input_credentials.yaml</a>
116
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/input_token_only_cluster.yaml" target="_blank">sample_scripts/input_token_only_cluster_name.yaml</a>
117
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/input_credentials_cluster_name.yaml" target="_blank">sample_scripts/input_credentials_cluster_name.yaml</a>
118
+
119
+ More sample input files can be found in the <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/" target="_blank">sample_scripts folder</a>. Use `pycentral.workflows_utils.get_conn_from_file()` function which accepts name of the file and returns
120
+ the `ArubaCentralBase` instance object.
121
+
122
+ 3. **Making API call using pycentral base**: Using the base class `ArubaCentralBase`, any Aruba Central supported REST API calls can be made. Refer the following sample script <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/pycentral_base_sample.py" target="_blank">sample_scripts/pycentral_base_sample.py</a>
123
+
124
+ Obtain the HTTP Request related information from Aruba Central Swagger documentation or <a href="https://developer.arubanetworks.com/aruba-central/reference" target="_blank">API references</a> page in Aruba Developer Hub.
125
+
126
+ 4. **Making API call using pycentral modules**: Some API endpoints supported by Aruba Central are implemented as modules in the Python package. Refer the following sample script using modules <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/pycentral_module_sample.py" target="_blank">sample_scripts/pycentral_module_sample.py</a>
127
+
128
+ To obtain a list of implemented modules and its documentation refer the <a href="https://pycentral.readthedocs.io/en/latest/" target="_blank">pycentral module documentation</a>
129
+
130
+ 5. **Workflows**: Workflows are used to achieve an automation use-case which generally involves multiple API calls or dealing with scale and repetitive tasks with ease. Check out the <a href="https://github.com/aruba/central-python-workflows" target="_blank"> central-python-workflows </a> repository to check out workflows that utilize the Pycentral library.
131
+
132
+ ## Documentation:
133
+ * **Python package documentation:**
134
+ * <a href="https://pycentral.readthedocs.io/en/latest/" target="_blank">pycentral module documentation</a>
135
+ * **Use-Cases and Workflows:**
136
+ - <a href="https://developer.arubanetworks.com/aruba-central/docs/python-getting-started" target="_blank">Aruba Developer Hub</a>
137
+ - <a href="https://github.com/aruba/central-python-workflows" target="_blank">central-python-workflows</a>
138
+
139
+ ## Note:
140
+ The package takes one of the two approaches to gain access to Aruba Central APIs.
141
+
142
+ * **OAUTH APIs:** By taking OAUTH approach to generate new access_token, the python package will cache the tokens locally for re-use. Caching tokens locally, helps preventing creation of new access_token every time the script is run. In addition, when the access_token is expired the script will attempt to use the supplied credentials and attempt to refresh the expired token.
143
+
144
+ Override the `ArubaCentralBase.storeToken()` and `ArubaCentralBase.loadToken()` function definitions to change this behavior of caching in local file(JSON) and manage tokens more securely.
145
+
146
+ * **Access Token**: This process is more secure. By providing only the *access_token* instead of credentials, the package will not cache the tokens. But loses the ability to handle expired token and to generate new access tokens.
147
+
148
+ ## How to contribute
149
+ Please see the accompanying <a href="https://github.com/aruba/pycentral/blob/master/CONTRIBUTIONS.md" target="_blank">CONTRIBUTIONS.md</a> file for guidelines on how to contribute to this repository.
150
+
151
+ ## Troubleshooting Issues
152
+ If you encounter module import errors, make sure that the package has been installed correctly.
153
+
154
+ Additionally, please read the <a href="https://github.com/aruba/pycentral/blob/master/RELEASE-NOTES.md" target="_blank">RELEASE-NOTES.md</a> file for the current release information and known issues.
@@ -0,0 +1,120 @@
1
+ # pycentral
2
+ #### Aruba Central Python Package Index SDK
3
+
4
+ Aruba Central is an unified cloud-based network management and configuration platform for campus, branch, remote and data center networks. There are various needs for automation and programmability like automating repetitive tasks, configuring multiple devices, monitoring and more. This python package is to programmatically interact with Aruba Central via REST APIs.
5
+
6
+ ### How To Install
7
+ In order to run the workflow scripts, please complete the steps below:
8
+ 1. install virtual env (refer https://docs.python.org/3/library/venv.html). Make sure python version 3 is installed in system.
9
+ ```
10
+ $ python3 -m venv centralenv
11
+ ```
12
+
13
+ 2. Activate the virtual env
14
+ ```
15
+ $ source centralenv/bin/activate
16
+ in Windows:
17
+ $ centralenv/Scripts/activate.bat
18
+ ```
19
+
20
+ 3. Install the **pycentral** package
21
+ ```
22
+ (centralenv)$ pip3 install pycentral
23
+ ```
24
+
25
+ To install package with *extras* `colorLog` which will display log in color
26
+ ```
27
+ (centralenv)$ pip3 install pycentral[colorLog]
28
+ ```
29
+
30
+ Now you can start making your script based on modules in pycentral or use different workflows from the subpackage `workflows`.
31
+
32
+ ## Executing Scripts
33
+
34
+ 1. Gathering variables required for the package base class `ArubaCentralBase`.
35
+
36
+ * **base_url** OR **cluster_name**: You can find the base URL or cluster name of the Central account's API Gateway from the table <a href="https://www.arubanetworks.com/techdocs/central/latest/content/nms/api/domain_url.htm" target="_blank">here</a>. The base URL or cluster name is based on the geographical Central cluster in which the account is registered.
37
+
38
+ * **access_token**: You can create an API access token for Aruba Central from -
39
+ * <a href="https://developer.arubanetworks.com/aruba-central/docs/api-gateway-obtaining-access-tokens#obtain-access-token-via-web-ui" target="_blank">Aruba Central UI</a>
40
+ * <a href="https://developer.arubanetworks.com/aruba-central/docs/api-oauth-access-token" target="_blank">OAuth APIs</a>
41
+
42
+ * Optional variables - You need to provide the below variables if you want to use PyCentral's ability to generate access tokens from Aruba Central with the help of OAuth APIs.
43
+ * **username** and **password**: Aruba Central user's *username* and *password*. The access token generated by the OAUTH APIs will have the same role/privileges as the provided Aruba Central user.
44
+
45
+ * **client_id** and **client_secret**: Obtain client_id and client_secret variables by creating an API Gateway client in Aruba Central. Refer the following <a href="https://developer.arubanetworks.com/aruba-central/docs/api-gateway-creating-application-token" target="_blank">documentation</a> for more details.
46
+
47
+ * **customer_id**: Obtain the **customer_id** by clicking on the figure icon on top right corner of Aruba Central WebUI.
48
+
49
+ ![Customer ID](https://github.com/aruba/pycentral/raw/master/pictures/customer-id.png)
50
+
51
+
52
+ 2. Providing input variables to the Python scripts. One of the following options can be used.
53
+ * Provide variables directly to Aruba Central Base class in dictionary format.
54
+
55
+ Access token approach:
56
+ ```python
57
+ central_info = {
58
+ "base_url": "<api-gateway-domain-url>",
59
+ "token": {
60
+ "access_token": "<api-gateway-access-token>"
61
+ }
62
+ }
63
+ ```
64
+
65
+ OAUTH APIs approach with capability to generate new access token:
66
+ ```python
67
+ central_info = {
68
+ "username": "<aruba-central-account-username>",
69
+ "password": "<aruba-central-account-password>",
70
+ "client_id": "<api-gateway-client-id>",
71
+ "client_secret": "<api-gateway-client-secret>",
72
+ "customer_id": "<aruba-central-customer-id>",
73
+ "base_url": "<api-gateway-domain-url>"
74
+ }
75
+ ```
76
+ Alternatively, you can use **cluster_name** instead of **base_url** in the above mentioned dictionaries. You can find the list of clusters that are supported in the <a href="https://github.com/aruba/pycentral/blob/master/pycentral/constants.py" target="_blank">constants.py file</a>. If you would like to add support for other Central clusters, you can do so by adding it in the constants.py.
77
+ Refer the sample scripts in *step3* and *step4* for examples.
78
+
79
+ * **OR** Provide the required variables using JSON/YAML file. Refer to the sample input files to understand how the files have to be structured -
80
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/input_token_only.yaml" target="_blank">sample_scripts/input_token_only.yaml</a>
81
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/input_credentials.yaml" target="_blank">sample_scripts/input_credentials.yaml</a>
82
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/input_token_only_cluster.yaml" target="_blank">sample_scripts/input_token_only_cluster_name.yaml</a>
83
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/input_credentials_cluster_name.yaml" target="_blank">sample_scripts/input_credentials_cluster_name.yaml</a>
84
+
85
+ More sample input files can be found in the <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/" target="_blank">sample_scripts folder</a>. Use `pycentral.workflows_utils.get_conn_from_file()` function which accepts name of the file and returns
86
+ the `ArubaCentralBase` instance object.
87
+
88
+ 3. **Making API call using pycentral base**: Using the base class `ArubaCentralBase`, any Aruba Central supported REST API calls can be made. Refer the following sample script <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/pycentral_base_sample.py" target="_blank">sample_scripts/pycentral_base_sample.py</a>
89
+
90
+ Obtain the HTTP Request related information from Aruba Central Swagger documentation or <a href="https://developer.arubanetworks.com/aruba-central/reference" target="_blank">API references</a> page in Aruba Developer Hub.
91
+
92
+ 4. **Making API call using pycentral modules**: Some API endpoints supported by Aruba Central are implemented as modules in the Python package. Refer the following sample script using modules <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/pycentral_module_sample.py" target="_blank">sample_scripts/pycentral_module_sample.py</a>
93
+
94
+ To obtain a list of implemented modules and its documentation refer the <a href="https://pycentral.readthedocs.io/en/latest/" target="_blank">pycentral module documentation</a>
95
+
96
+ 5. **Workflows**: Workflows are used to achieve an automation use-case which generally involves multiple API calls or dealing with scale and repetitive tasks with ease. Check out the <a href="https://github.com/aruba/central-python-workflows" target="_blank"> central-python-workflows </a> repository to check out workflows that utilize the Pycentral library.
97
+
98
+ ## Documentation:
99
+ * **Python package documentation:**
100
+ * <a href="https://pycentral.readthedocs.io/en/latest/" target="_blank">pycentral module documentation</a>
101
+ * **Use-Cases and Workflows:**
102
+ - <a href="https://developer.arubanetworks.com/aruba-central/docs/python-getting-started" target="_blank">Aruba Developer Hub</a>
103
+ - <a href="https://github.com/aruba/central-python-workflows" target="_blank">central-python-workflows</a>
104
+
105
+ ## Note:
106
+ The package takes one of the two approaches to gain access to Aruba Central APIs.
107
+
108
+ * **OAUTH APIs:** By taking OAUTH approach to generate new access_token, the python package will cache the tokens locally for re-use. Caching tokens locally, helps preventing creation of new access_token every time the script is run. In addition, when the access_token is expired the script will attempt to use the supplied credentials and attempt to refresh the expired token.
109
+
110
+ Override the `ArubaCentralBase.storeToken()` and `ArubaCentralBase.loadToken()` function definitions to change this behavior of caching in local file(JSON) and manage tokens more securely.
111
+
112
+ * **Access Token**: This process is more secure. By providing only the *access_token* instead of credentials, the package will not cache the tokens. But loses the ability to handle expired token and to generate new access tokens.
113
+
114
+ ## How to contribute
115
+ Please see the accompanying <a href="https://github.com/aruba/pycentral/blob/master/CONTRIBUTIONS.md" target="_blank">CONTRIBUTIONS.md</a> file for guidelines on how to contribute to this repository.
116
+
117
+ ## Troubleshooting Issues
118
+ If you encounter module import errors, make sure that the package has been installed correctly.
119
+
120
+ Additionally, please read the <a href="https://github.com/aruba/pycentral/blob/master/RELEASE-NOTES.md" target="_blank">RELEASE-NOTES.md</a> file for the current release information and known issues.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: mv-pycentral
3
+ Version: 1.4.3
4
+ Summary: Aruba Central Python Package
5
+ Home-page: https://github.com/Moviri/mv-pycentral
6
+ Author: aruba-automation
7
+ Author-email: dynatrace_extensions@moviri.com
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: Topic :: System :: Networking
13
+ Classifier: Development Status :: 4 - Beta
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: requests==2.32.5
18
+ Requires-Dist: PyYAML==6.0.3
19
+ Requires-Dist: urllib3==2.6.3
20
+ Requires-Dist: certifi==2026.1.4
21
+ Provides-Extra: colorlog
22
+ Requires-Dist: colorlog; extra == "colorlog"
23
+ Dynamic: author
24
+ Dynamic: author-email
25
+ Dynamic: classifier
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: home-page
29
+ Dynamic: license-file
30
+ Dynamic: provides-extra
31
+ Dynamic: requires-dist
32
+ Dynamic: requires-python
33
+ Dynamic: summary
34
+
35
+ # pycentral
36
+ #### Aruba Central Python Package Index SDK
37
+
38
+ Aruba Central is an unified cloud-based network management and configuration platform for campus, branch, remote and data center networks. There are various needs for automation and programmability like automating repetitive tasks, configuring multiple devices, monitoring and more. This python package is to programmatically interact with Aruba Central via REST APIs.
39
+
40
+ ### How To Install
41
+ In order to run the workflow scripts, please complete the steps below:
42
+ 1. install virtual env (refer https://docs.python.org/3/library/venv.html). Make sure python version 3 is installed in system.
43
+ ```
44
+ $ python3 -m venv centralenv
45
+ ```
46
+
47
+ 2. Activate the virtual env
48
+ ```
49
+ $ source centralenv/bin/activate
50
+ in Windows:
51
+ $ centralenv/Scripts/activate.bat
52
+ ```
53
+
54
+ 3. Install the **pycentral** package
55
+ ```
56
+ (centralenv)$ pip3 install pycentral
57
+ ```
58
+
59
+ To install package with *extras* `colorLog` which will display log in color
60
+ ```
61
+ (centralenv)$ pip3 install pycentral[colorLog]
62
+ ```
63
+
64
+ Now you can start making your script based on modules in pycentral or use different workflows from the subpackage `workflows`.
65
+
66
+ ## Executing Scripts
67
+
68
+ 1. Gathering variables required for the package base class `ArubaCentralBase`.
69
+
70
+ * **base_url** OR **cluster_name**: You can find the base URL or cluster name of the Central account's API Gateway from the table <a href="https://www.arubanetworks.com/techdocs/central/latest/content/nms/api/domain_url.htm" target="_blank">here</a>. The base URL or cluster name is based on the geographical Central cluster in which the account is registered.
71
+
72
+ * **access_token**: You can create an API access token for Aruba Central from -
73
+ * <a href="https://developer.arubanetworks.com/aruba-central/docs/api-gateway-obtaining-access-tokens#obtain-access-token-via-web-ui" target="_blank">Aruba Central UI</a>
74
+ * <a href="https://developer.arubanetworks.com/aruba-central/docs/api-oauth-access-token" target="_blank">OAuth APIs</a>
75
+
76
+ * Optional variables - You need to provide the below variables if you want to use PyCentral's ability to generate access tokens from Aruba Central with the help of OAuth APIs.
77
+ * **username** and **password**: Aruba Central user's *username* and *password*. The access token generated by the OAUTH APIs will have the same role/privileges as the provided Aruba Central user.
78
+
79
+ * **client_id** and **client_secret**: Obtain client_id and client_secret variables by creating an API Gateway client in Aruba Central. Refer the following <a href="https://developer.arubanetworks.com/aruba-central/docs/api-gateway-creating-application-token" target="_blank">documentation</a> for more details.
80
+
81
+ * **customer_id**: Obtain the **customer_id** by clicking on the figure icon on top right corner of Aruba Central WebUI.
82
+
83
+ ![Customer ID](https://github.com/aruba/pycentral/raw/master/pictures/customer-id.png)
84
+
85
+
86
+ 2. Providing input variables to the Python scripts. One of the following options can be used.
87
+ * Provide variables directly to Aruba Central Base class in dictionary format.
88
+
89
+ Access token approach:
90
+ ```python
91
+ central_info = {
92
+ "base_url": "<api-gateway-domain-url>",
93
+ "token": {
94
+ "access_token": "<api-gateway-access-token>"
95
+ }
96
+ }
97
+ ```
98
+
99
+ OAUTH APIs approach with capability to generate new access token:
100
+ ```python
101
+ central_info = {
102
+ "username": "<aruba-central-account-username>",
103
+ "password": "<aruba-central-account-password>",
104
+ "client_id": "<api-gateway-client-id>",
105
+ "client_secret": "<api-gateway-client-secret>",
106
+ "customer_id": "<aruba-central-customer-id>",
107
+ "base_url": "<api-gateway-domain-url>"
108
+ }
109
+ ```
110
+ Alternatively, you can use **cluster_name** instead of **base_url** in the above mentioned dictionaries. You can find the list of clusters that are supported in the <a href="https://github.com/aruba/pycentral/blob/master/pycentral/constants.py" target="_blank">constants.py file</a>. If you would like to add support for other Central clusters, you can do so by adding it in the constants.py.
111
+ Refer the sample scripts in *step3* and *step4* for examples.
112
+
113
+ * **OR** Provide the required variables using JSON/YAML file. Refer to the sample input files to understand how the files have to be structured -
114
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/input_token_only.yaml" target="_blank">sample_scripts/input_token_only.yaml</a>
115
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/input_credentials.yaml" target="_blank">sample_scripts/input_credentials.yaml</a>
116
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/input_token_only_cluster.yaml" target="_blank">sample_scripts/input_token_only_cluster_name.yaml</a>
117
+ * <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/input_credentials_cluster_name.yaml" target="_blank">sample_scripts/input_credentials_cluster_name.yaml</a>
118
+
119
+ More sample input files can be found in the <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/sample_scripts/" target="_blank">sample_scripts folder</a>. Use `pycentral.workflows_utils.get_conn_from_file()` function which accepts name of the file and returns
120
+ the `ArubaCentralBase` instance object.
121
+
122
+ 3. **Making API call using pycentral base**: Using the base class `ArubaCentralBase`, any Aruba Central supported REST API calls can be made. Refer the following sample script <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/pycentral_base_sample.py" target="_blank">sample_scripts/pycentral_base_sample.py</a>
123
+
124
+ Obtain the HTTP Request related information from Aruba Central Swagger documentation or <a href="https://developer.arubanetworks.com/aruba-central/reference" target="_blank">API references</a> page in Aruba Developer Hub.
125
+
126
+ 4. **Making API call using pycentral modules**: Some API endpoints supported by Aruba Central are implemented as modules in the Python package. Refer the following sample script using modules <a href="https://github.com/aruba/pycentral/blob/master/sample_scripts/pycentral_module_sample.py" target="_blank">sample_scripts/pycentral_module_sample.py</a>
127
+
128
+ To obtain a list of implemented modules and its documentation refer the <a href="https://pycentral.readthedocs.io/en/latest/" target="_blank">pycentral module documentation</a>
129
+
130
+ 5. **Workflows**: Workflows are used to achieve an automation use-case which generally involves multiple API calls or dealing with scale and repetitive tasks with ease. Check out the <a href="https://github.com/aruba/central-python-workflows" target="_blank"> central-python-workflows </a> repository to check out workflows that utilize the Pycentral library.
131
+
132
+ ## Documentation:
133
+ * **Python package documentation:**
134
+ * <a href="https://pycentral.readthedocs.io/en/latest/" target="_blank">pycentral module documentation</a>
135
+ * **Use-Cases and Workflows:**
136
+ - <a href="https://developer.arubanetworks.com/aruba-central/docs/python-getting-started" target="_blank">Aruba Developer Hub</a>
137
+ - <a href="https://github.com/aruba/central-python-workflows" target="_blank">central-python-workflows</a>
138
+
139
+ ## Note:
140
+ The package takes one of the two approaches to gain access to Aruba Central APIs.
141
+
142
+ * **OAUTH APIs:** By taking OAUTH approach to generate new access_token, the python package will cache the tokens locally for re-use. Caching tokens locally, helps preventing creation of new access_token every time the script is run. In addition, when the access_token is expired the script will attempt to use the supplied credentials and attempt to refresh the expired token.
143
+
144
+ Override the `ArubaCentralBase.storeToken()` and `ArubaCentralBase.loadToken()` function definitions to change this behavior of caching in local file(JSON) and manage tokens more securely.
145
+
146
+ * **Access Token**: This process is more secure. By providing only the *access_token* instead of credentials, the package will not cache the tokens. But loses the ability to handle expired token and to generate new access tokens.
147
+
148
+ ## How to contribute
149
+ Please see the accompanying <a href="https://github.com/aruba/pycentral/blob/master/CONTRIBUTIONS.md" target="_blank">CONTRIBUTIONS.md</a> file for guidelines on how to contribute to this repository.
150
+
151
+ ## Troubleshooting Issues
152
+ If you encounter module import errors, make sure that the package has been installed correctly.
153
+
154
+ Additionally, please read the <a href="https://github.com/aruba/pycentral/blob/master/RELEASE-NOTES.md" target="_blank">RELEASE-NOTES.md</a> file for the current release information and known issues.
@@ -0,0 +1,27 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ mv_pycentral.egg-info/PKG-INFO
5
+ mv_pycentral.egg-info/SOURCES.txt
6
+ mv_pycentral.egg-info/dependency_links.txt
7
+ mv_pycentral.egg-info/requires.txt
8
+ mv_pycentral.egg-info/top_level.txt
9
+ pycentral/__init__.py
10
+ pycentral/audit_logs.py
11
+ pycentral/base.py
12
+ pycentral/base_utils.py
13
+ pycentral/configuration.py
14
+ pycentral/constants.py
15
+ pycentral/device_inventory.py
16
+ pycentral/firmware_management.py
17
+ pycentral/licensing.py
18
+ pycentral/monitoring.py
19
+ pycentral/msp.py
20
+ pycentral/rapids.py
21
+ pycentral/refresh_api_token.py
22
+ pycentral/topology.py
23
+ pycentral/url_utils.py
24
+ pycentral/user_management.py
25
+ pycentral/visualrf.py
26
+ pycentral/workflows/__init__.py
27
+ pycentral/workflows/workflows_utils.py
@@ -0,0 +1,7 @@
1
+ requests==2.32.5
2
+ PyYAML==6.0.3
3
+ urllib3==2.6.3
4
+ certifi==2026.1.4
5
+
6
+ [colorLog]
7
+ colorlog
@@ -0,0 +1 @@
1
+ pycentral
File without changes