actrac 1.0.0__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.
- actrac-1.0.0/PKG-INFO +305 -0
- actrac-1.0.0/README.md +281 -0
- actrac-1.0.0/actrac/__init__.py +36 -0
- actrac-1.0.0/actrac/api.py +721 -0
- actrac-1.0.0/actrac/client.py +235 -0
- actrac-1.0.0/actrac/constants.py +86 -0
- actrac-1.0.0/actrac/errors.py +39 -0
- actrac-1.0.0/pyproject.toml +47 -0
actrac-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: actrac
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Library for interacting with ACT REST API
|
|
5
|
+
License: BSD-3-Clause
|
|
6
|
+
Author: Arista Cloud Test Development
|
|
7
|
+
Author-email: act-dev@arista.com
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: System Administrators
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: System :: Networking
|
|
21
|
+
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# ACT Restful API Client (ACTRAC) Library
|
|
25
|
+
|
|
26
|
+
## Table of Contents
|
|
27
|
+
|
|
28
|
+
1. [Overview](#overview)
|
|
29
|
+
- [Requirements](#requirements)
|
|
30
|
+
1. [Installation](#installation)
|
|
31
|
+
- [Development: Run from Source](#development-run-from-source)
|
|
32
|
+
1. [Getting Started](#getting-started)
|
|
33
|
+
- [Connecting](#connecting)
|
|
34
|
+
- [Examples](#examples)
|
|
35
|
+
1. [Notes](#notes)
|
|
36
|
+
1. [Testing](#testing)
|
|
37
|
+
1. [Contact or Questions](#contact-or-questions)
|
|
38
|
+
1. [Contributing](#contributing)
|
|
39
|
+
- [Working With Git](#working-with-git)
|
|
40
|
+
- [Submitting Pull Requests](#submitting-pull-requests)
|
|
41
|
+
- [Pull Request Semantics](#pull-request-semantics)
|
|
42
|
+
1. [License](#license)
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
45
|
+
|
|
46
|
+
This module provides a Python client for interfacing with the ACT REST API.
|
|
47
|
+
This can be used for spinning up (deploying/starting) ACT environments to run tests against
|
|
48
|
+
and then spinning them down (undeploying/stopping) after the tests have completed.
|
|
49
|
+
|
|
50
|
+
### Requirements
|
|
51
|
+
|
|
52
|
+
- Python 3.10 or later
|
|
53
|
+
- Poetry 1.3.1 or later (required to run from source)
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
### Installing Package
|
|
58
|
+
|
|
59
|
+
The library is published as a python pacakge on PyPi and installable via pip.
|
|
60
|
+
|
|
61
|
+
### Development: Run from Source
|
|
62
|
+
|
|
63
|
+
You can also run the ACTRAC library in a Python Poetry virtual
|
|
64
|
+
environment. For more information, read this:
|
|
65
|
+
<https://python-poetry.org/docs/>
|
|
66
|
+
|
|
67
|
+
These instructions will help you install and run the ACTRAC library
|
|
68
|
+
from source. This is useful if you plan on contributing or if you would always
|
|
69
|
+
like to see the latest code in the develop branch. Note that these steps
|
|
70
|
+
require the poetry and git commands.
|
|
71
|
+
|
|
72
|
+
#### Pre-Requisite: Download and Install Poetry
|
|
73
|
+
|
|
74
|
+
<https://python-poetry.org/docs/#installation>
|
|
75
|
+
|
|
76
|
+
#### Step 1: Clone the ACTRAC library from Github repo
|
|
77
|
+
|
|
78
|
+
# Go to a directory where you'd like to keep the source
|
|
79
|
+
admin:~ admin$ cd ~/projects
|
|
80
|
+
admin:~ admin$ git clone https://github.com/Arista-ACT/actrac.git
|
|
81
|
+
admin:~ admin$ cd actrac
|
|
82
|
+
|
|
83
|
+
#### Step 2: Check out the desired version or branch
|
|
84
|
+
|
|
85
|
+
# Go to a directory where you'd like to keep the source
|
|
86
|
+
admin:~ admin$ cd ~/projects/actrac
|
|
87
|
+
|
|
88
|
+
# To see a list of available versions or branches
|
|
89
|
+
admin:~ admin$ git tag
|
|
90
|
+
admin:~ admin$ git branch
|
|
91
|
+
|
|
92
|
+
# Checkout the desired version of code
|
|
93
|
+
admin:~ admin$ git checkout v0.2.0
|
|
94
|
+
|
|
95
|
+
#### Step 3: Install actrac library using Poetry
|
|
96
|
+
|
|
97
|
+
# Go to a directory where you'd like to keep the source
|
|
98
|
+
admin:~ admin$ cd ~/projects/actrac
|
|
99
|
+
|
|
100
|
+
# Install
|
|
101
|
+
admin:~ admin$ poetry install
|
|
102
|
+
|
|
103
|
+
#### Step 4: Install ACTRAC library development requirements
|
|
104
|
+
|
|
105
|
+
No different from standard poetry install currently.
|
|
106
|
+
|
|
107
|
+
## Getting Started
|
|
108
|
+
|
|
109
|
+
Once the package has been installed you can run the following example to
|
|
110
|
+
verify that everything has been installed properly.
|
|
111
|
+
|
|
112
|
+
# Run UnitTests
|
|
113
|
+
admin:~ admin$ make unittest
|
|
114
|
+
|
|
115
|
+
### Connecting
|
|
116
|
+
|
|
117
|
+
Connecting to ACT will depend on what Tenant you have access to. You will have
|
|
118
|
+
to make sure you are connected to the appropriate VPN using an OVPN client and
|
|
119
|
+
profile before running any scripts that will interact with the ACT API.
|
|
120
|
+
|
|
121
|
+
### OVPN
|
|
122
|
+
|
|
123
|
+
Connect using OpenVPN Client using the appropriate profile.
|
|
124
|
+
|
|
125
|
+
### API KEY
|
|
126
|
+
|
|
127
|
+
To use the ACT API you will need to generate an API KEY for authenticating the API requests.
|
|
128
|
+
Generate this key using the ACT UI after logging in using existing ACT credentials.
|
|
129
|
+
|
|
130
|
+
### Examples
|
|
131
|
+
|
|
132
|
+
Example connecting to the ACT API and getting all available versions:
|
|
133
|
+
|
|
134
|
+
>>> from actrac.client import ACTClient
|
|
135
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="https://lab.act.arista.com", log_stdout=True)
|
|
136
|
+
>>> client.connect(username, password)
|
|
137
|
+
>>> result = client.api.available_node_versions()
|
|
138
|
+
>>> print result
|
|
139
|
+
{...large output omitted...}
|
|
140
|
+
>>>
|
|
141
|
+
|
|
142
|
+
Example connecting to the ACT API and getting all available versions for a HTTPS Tenant:
|
|
143
|
+
|
|
144
|
+
>>> from actrac.client import ACTClient
|
|
145
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="https://<tenant identifier>.act.arista.com", log_stdout=True)
|
|
146
|
+
>>> client.connect(username, password)
|
|
147
|
+
>>> result = client.api.available_node_versions()
|
|
148
|
+
>>> print result
|
|
149
|
+
{...large output omitted...}
|
|
150
|
+
>>>
|
|
151
|
+
|
|
152
|
+
Example connecting to the ACT API and getting all labs:
|
|
153
|
+
|
|
154
|
+
>>> from actrac.client import ACTClient
|
|
155
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="lab.act.arista.com", log_stdout=True)
|
|
156
|
+
>>> client.connect(username, password)
|
|
157
|
+
>>> result = client.api.read_labs()
|
|
158
|
+
>>> print result
|
|
159
|
+
{...large output omitted...}
|
|
160
|
+
>>>
|
|
161
|
+
|
|
162
|
+
Example connecting to the ACT API and attempting to start a lab and wait for it to be running:
|
|
163
|
+
|
|
164
|
+
>>> from actrac.client import ACTClient
|
|
165
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="lab.act.arista.com", log_stdout=True)
|
|
166
|
+
>>> client.connect(username, password)
|
|
167
|
+
>>> result = client.api.read_lab_by_name("EXAMPLE LAB")
|
|
168
|
+
>>> lab_id = result["lab_id"]
|
|
169
|
+
>>> print("START DEPLOY WAIT FOR RUNNING\n")
|
|
170
|
+
>>> client.loop.run_until_complete(client.api.deploy_lab_wait_for_running(lab_id))
|
|
171
|
+
{...}
|
|
172
|
+
>>>
|
|
173
|
+
|
|
174
|
+
## Testing
|
|
175
|
+
|
|
176
|
+
Currently there are a couple of example scripts in the ./examples directory that can be used
|
|
177
|
+
to verify interaction with your ACT Tenant via ACTRAC.
|
|
178
|
+
|
|
179
|
+
There are also unittests for the client that are maintained by the ACT development team.
|
|
180
|
+
|
|
181
|
+
Additionally any external contribution must contain appropriate unittests.
|
|
182
|
+
|
|
183
|
+
## Contact or Questions
|
|
184
|
+
|
|
185
|
+
The ACTRAC Library is developed by Arista ACT Team and supported
|
|
186
|
+
by the Arista ACT community. You can contact the team that
|
|
187
|
+
develops these modules by sending an email to <act-dev@arista.com>.
|
|
188
|
+
|
|
189
|
+
For customers that are looking for a premium level of support, please
|
|
190
|
+
contact your local account team or email <act-dev@arista.com> for help.
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
Contributing pull requests are gladly welcomed for this repository.
|
|
195
|
+
Not only contributing to the code but also we encourage the users to contribute
|
|
196
|
+
in the form of examples, docs, tutorials, and user guides.
|
|
197
|
+
|
|
198
|
+
Please note that all contributions that modify the library behavior
|
|
199
|
+
require corresponding test cases otherwise the pull request will be
|
|
200
|
+
rejected.
|
|
201
|
+
|
|
202
|
+
### Working With Git
|
|
203
|
+
|
|
204
|
+
It is recommended to fork the project and then start development on the forked repository's **develop** branch. This can achieved with the below steps:
|
|
205
|
+
|
|
206
|
+
- Info...
|
|
207
|
+
|
|
208
|
+
- Create a new feature branch (off the develop branch) to contain your feature, change, or fix:
|
|
209
|
+
|
|
210
|
+
git checkout -b <feature-branch-name>
|
|
211
|
+
|
|
212
|
+
- OPTIONAL: Install pre-commit checks. This will trigger linting and unit tests on every git commit, so that any issues are identified locally. This is optional but it may help to catch issues early.
|
|
213
|
+
|
|
214
|
+
`pre-commit install`
|
|
215
|
+
|
|
216
|
+
- Commit your changes in logical chunks. Please adhere to these [git commit
|
|
217
|
+
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
|
218
|
+
or your code is unlikely to be merged into the main project. Use Git's
|
|
219
|
+
[git rebase](https://docs.github.com/en/get-started/using-git/about-git-rebase)
|
|
220
|
+
feature to tidy up your commits before making them public.
|
|
221
|
+
|
|
222
|
+
- Locally merge (or rebase) the upstream development branch into your feature branch every time before pushing it to your fork:
|
|
223
|
+
|
|
224
|
+
# Here the <dev-branch> is develop
|
|
225
|
+
git pull [--rebase] upstream <dev-branch>
|
|
226
|
+
|
|
227
|
+
- Push your feature branch up to your fork:
|
|
228
|
+
|
|
229
|
+
git push origin <feature-branch-name>
|
|
230
|
+
|
|
231
|
+
- [Open a Pull Request]()
|
|
232
|
+
with a clear title, description and explain how to test the feature.
|
|
233
|
+
|
|
234
|
+
### Submitting Pull Requests
|
|
235
|
+
|
|
236
|
+
- It is recommended to open an issue before starting work on a pull request to make sure if the same issue is not reported previously and someone is already working on that. When suggesting a new feature, also make sure it won't conflict with any work that's already in progress.
|
|
237
|
+
|
|
238
|
+
- Once the issue is opened either self-assign the issue or ask the maintainer to assign it for you. This will make sure no others are working on the same issue.
|
|
239
|
+
|
|
240
|
+
- All new functionality must include relevant tests where applicable.
|
|
241
|
+
|
|
242
|
+
- When submitting a pull request, please be sure to work off of the **develop** branch and not from other branches. The **develop** branch is used for ongoing development, while the **master** will hold the last stable version.
|
|
243
|
+
|
|
244
|
+
- To automate release-notes creation and make filtering process easier, it is strongly recommended to use [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) syntax at least for Pull Request (PR) title.
|
|
245
|
+
|
|
246
|
+
- All code submissions must follow the below criteria:
|
|
247
|
+
|
|
248
|
+
- The issue/PR title should follow the semantic as described [here](#pull-request-semantics)
|
|
249
|
+
- All the tests are updated and are passed successfully
|
|
250
|
+
- Python syntax is valid
|
|
251
|
+
|
|
252
|
+
### Pull Request Semantics
|
|
253
|
+
|
|
254
|
+
The Pull Request title should start with one of the below to easily segregate if
|
|
255
|
+
its a feature add or a bug or something related documentation etc.
|
|
256
|
+
|
|
257
|
+
It is strongly recommended to use one from the below:
|
|
258
|
+
|
|
259
|
+
- ```Feat```: Create a capability e.g. feature, test, dependency
|
|
260
|
+
- ```Fix```: Fix an issue e.g. bug, typo, accident, misstatement
|
|
261
|
+
- ```Doc```: Refactor of documentation, e.g. help files
|
|
262
|
+
- ```Example```: Add a new example or modify an [existing one](docs/labs/)
|
|
263
|
+
- ```Test```: Add or refactor anything regarding test, e.g add a new testCases or missing testCases
|
|
264
|
+
- ```Refactor```: A code change that MUST be just a refactoring
|
|
265
|
+
- ```Bump```: Increase the version of something e.g. dependency
|
|
266
|
+
- ```Revert```: Change back to the previous commit
|
|
267
|
+
- ```Optimize```: Refactor of performance, e.g. speed up code
|
|
268
|
+
- ```CI```: Update CI components, e.g. molecule files or Github Actions
|
|
269
|
+
- ```Cut```: Remove a capability e.g. feature, test, dependency
|
|
270
|
+
|
|
271
|
+
For example:
|
|
272
|
+
|
|
273
|
+
- Feat: Add support for decommissioning APIs
|
|
274
|
+
- Test: Add missing test cases for message sending
|
|
275
|
+
- Doc: Document new examples for new message handling
|
|
276
|
+
|
|
277
|
+
## License
|
|
278
|
+
|
|
279
|
+
Copyright© 2026, Arista Networks, Inc. All rights reserved.
|
|
280
|
+
|
|
281
|
+
Redistribution and use in source and binary forms, with or without
|
|
282
|
+
modification, are permitted provided that the following conditions are
|
|
283
|
+
met:
|
|
284
|
+
|
|
285
|
+
- Redistributions of source code must retain the above copyright
|
|
286
|
+
notice, this list of conditions and the following disclaimer.
|
|
287
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
288
|
+
notice, this list of conditions and the following disclaimer in the
|
|
289
|
+
documentation and/or other materials provided with the distribution.
|
|
290
|
+
- Neither the name of Arista Networks nor the names of its
|
|
291
|
+
contributors may be used to endorse or promote products derived from
|
|
292
|
+
this software without specific prior written permission.
|
|
293
|
+
|
|
294
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS
|
|
295
|
+
IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
296
|
+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
297
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS BE
|
|
298
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
299
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
300
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
301
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
302
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
303
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
304
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
|
305
|
+
|
actrac-1.0.0/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# ACT Restful API Client (ACTRAC) Library
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
1. [Overview](#overview)
|
|
6
|
+
- [Requirements](#requirements)
|
|
7
|
+
1. [Installation](#installation)
|
|
8
|
+
- [Development: Run from Source](#development-run-from-source)
|
|
9
|
+
1. [Getting Started](#getting-started)
|
|
10
|
+
- [Connecting](#connecting)
|
|
11
|
+
- [Examples](#examples)
|
|
12
|
+
1. [Notes](#notes)
|
|
13
|
+
1. [Testing](#testing)
|
|
14
|
+
1. [Contact or Questions](#contact-or-questions)
|
|
15
|
+
1. [Contributing](#contributing)
|
|
16
|
+
- [Working With Git](#working-with-git)
|
|
17
|
+
- [Submitting Pull Requests](#submitting-pull-requests)
|
|
18
|
+
- [Pull Request Semantics](#pull-request-semantics)
|
|
19
|
+
1. [License](#license)
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
This module provides a Python client for interfacing with the ACT REST API.
|
|
24
|
+
This can be used for spinning up (deploying/starting) ACT environments to run tests against
|
|
25
|
+
and then spinning them down (undeploying/stopping) after the tests have completed.
|
|
26
|
+
|
|
27
|
+
### Requirements
|
|
28
|
+
|
|
29
|
+
- Python 3.10 or later
|
|
30
|
+
- Poetry 1.3.1 or later (required to run from source)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### Installing Package
|
|
35
|
+
|
|
36
|
+
The library is published as a python pacakge on PyPi and installable via pip.
|
|
37
|
+
|
|
38
|
+
### Development: Run from Source
|
|
39
|
+
|
|
40
|
+
You can also run the ACTRAC library in a Python Poetry virtual
|
|
41
|
+
environment. For more information, read this:
|
|
42
|
+
<https://python-poetry.org/docs/>
|
|
43
|
+
|
|
44
|
+
These instructions will help you install and run the ACTRAC library
|
|
45
|
+
from source. This is useful if you plan on contributing or if you would always
|
|
46
|
+
like to see the latest code in the develop branch. Note that these steps
|
|
47
|
+
require the poetry and git commands.
|
|
48
|
+
|
|
49
|
+
#### Pre-Requisite: Download and Install Poetry
|
|
50
|
+
|
|
51
|
+
<https://python-poetry.org/docs/#installation>
|
|
52
|
+
|
|
53
|
+
#### Step 1: Clone the ACTRAC library from Github repo
|
|
54
|
+
|
|
55
|
+
# Go to a directory where you'd like to keep the source
|
|
56
|
+
admin:~ admin$ cd ~/projects
|
|
57
|
+
admin:~ admin$ git clone https://github.com/Arista-ACT/actrac.git
|
|
58
|
+
admin:~ admin$ cd actrac
|
|
59
|
+
|
|
60
|
+
#### Step 2: Check out the desired version or branch
|
|
61
|
+
|
|
62
|
+
# Go to a directory where you'd like to keep the source
|
|
63
|
+
admin:~ admin$ cd ~/projects/actrac
|
|
64
|
+
|
|
65
|
+
# To see a list of available versions or branches
|
|
66
|
+
admin:~ admin$ git tag
|
|
67
|
+
admin:~ admin$ git branch
|
|
68
|
+
|
|
69
|
+
# Checkout the desired version of code
|
|
70
|
+
admin:~ admin$ git checkout v0.2.0
|
|
71
|
+
|
|
72
|
+
#### Step 3: Install actrac library using Poetry
|
|
73
|
+
|
|
74
|
+
# Go to a directory where you'd like to keep the source
|
|
75
|
+
admin:~ admin$ cd ~/projects/actrac
|
|
76
|
+
|
|
77
|
+
# Install
|
|
78
|
+
admin:~ admin$ poetry install
|
|
79
|
+
|
|
80
|
+
#### Step 4: Install ACTRAC library development requirements
|
|
81
|
+
|
|
82
|
+
No different from standard poetry install currently.
|
|
83
|
+
|
|
84
|
+
## Getting Started
|
|
85
|
+
|
|
86
|
+
Once the package has been installed you can run the following example to
|
|
87
|
+
verify that everything has been installed properly.
|
|
88
|
+
|
|
89
|
+
# Run UnitTests
|
|
90
|
+
admin:~ admin$ make unittest
|
|
91
|
+
|
|
92
|
+
### Connecting
|
|
93
|
+
|
|
94
|
+
Connecting to ACT will depend on what Tenant you have access to. You will have
|
|
95
|
+
to make sure you are connected to the appropriate VPN using an OVPN client and
|
|
96
|
+
profile before running any scripts that will interact with the ACT API.
|
|
97
|
+
|
|
98
|
+
### OVPN
|
|
99
|
+
|
|
100
|
+
Connect using OpenVPN Client using the appropriate profile.
|
|
101
|
+
|
|
102
|
+
### API KEY
|
|
103
|
+
|
|
104
|
+
To use the ACT API you will need to generate an API KEY for authenticating the API requests.
|
|
105
|
+
Generate this key using the ACT UI after logging in using existing ACT credentials.
|
|
106
|
+
|
|
107
|
+
### Examples
|
|
108
|
+
|
|
109
|
+
Example connecting to the ACT API and getting all available versions:
|
|
110
|
+
|
|
111
|
+
>>> from actrac.client import ACTClient
|
|
112
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="https://lab.act.arista.com", log_stdout=True)
|
|
113
|
+
>>> client.connect(username, password)
|
|
114
|
+
>>> result = client.api.available_node_versions()
|
|
115
|
+
>>> print result
|
|
116
|
+
{...large output omitted...}
|
|
117
|
+
>>>
|
|
118
|
+
|
|
119
|
+
Example connecting to the ACT API and getting all available versions for a HTTPS Tenant:
|
|
120
|
+
|
|
121
|
+
>>> from actrac.client import ACTClient
|
|
122
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="https://<tenant identifier>.act.arista.com", log_stdout=True)
|
|
123
|
+
>>> client.connect(username, password)
|
|
124
|
+
>>> result = client.api.available_node_versions()
|
|
125
|
+
>>> print result
|
|
126
|
+
{...large output omitted...}
|
|
127
|
+
>>>
|
|
128
|
+
|
|
129
|
+
Example connecting to the ACT API and getting all labs:
|
|
130
|
+
|
|
131
|
+
>>> from actrac.client import ACTClient
|
|
132
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="lab.act.arista.com", log_stdout=True)
|
|
133
|
+
>>> client.connect(username, password)
|
|
134
|
+
>>> result = client.api.read_labs()
|
|
135
|
+
>>> print result
|
|
136
|
+
{...large output omitted...}
|
|
137
|
+
>>>
|
|
138
|
+
|
|
139
|
+
Example connecting to the ACT API and attempting to start a lab and wait for it to be running:
|
|
140
|
+
|
|
141
|
+
>>> from actrac.client import ACTClient
|
|
142
|
+
>>> client = ACTClient(api_key="EXAMPLE", base_url="lab.act.arista.com", log_stdout=True)
|
|
143
|
+
>>> client.connect(username, password)
|
|
144
|
+
>>> result = client.api.read_lab_by_name("EXAMPLE LAB")
|
|
145
|
+
>>> lab_id = result["lab_id"]
|
|
146
|
+
>>> print("START DEPLOY WAIT FOR RUNNING\n")
|
|
147
|
+
>>> client.loop.run_until_complete(client.api.deploy_lab_wait_for_running(lab_id))
|
|
148
|
+
{...}
|
|
149
|
+
>>>
|
|
150
|
+
|
|
151
|
+
## Testing
|
|
152
|
+
|
|
153
|
+
Currently there are a couple of example scripts in the ./examples directory that can be used
|
|
154
|
+
to verify interaction with your ACT Tenant via ACTRAC.
|
|
155
|
+
|
|
156
|
+
There are also unittests for the client that are maintained by the ACT development team.
|
|
157
|
+
|
|
158
|
+
Additionally any external contribution must contain appropriate unittests.
|
|
159
|
+
|
|
160
|
+
## Contact or Questions
|
|
161
|
+
|
|
162
|
+
The ACTRAC Library is developed by Arista ACT Team and supported
|
|
163
|
+
by the Arista ACT community. You can contact the team that
|
|
164
|
+
develops these modules by sending an email to <act-dev@arista.com>.
|
|
165
|
+
|
|
166
|
+
For customers that are looking for a premium level of support, please
|
|
167
|
+
contact your local account team or email <act-dev@arista.com> for help.
|
|
168
|
+
|
|
169
|
+
## Contributing
|
|
170
|
+
|
|
171
|
+
Contributing pull requests are gladly welcomed for this repository.
|
|
172
|
+
Not only contributing to the code but also we encourage the users to contribute
|
|
173
|
+
in the form of examples, docs, tutorials, and user guides.
|
|
174
|
+
|
|
175
|
+
Please note that all contributions that modify the library behavior
|
|
176
|
+
require corresponding test cases otherwise the pull request will be
|
|
177
|
+
rejected.
|
|
178
|
+
|
|
179
|
+
### Working With Git
|
|
180
|
+
|
|
181
|
+
It is recommended to fork the project and then start development on the forked repository's **develop** branch. This can achieved with the below steps:
|
|
182
|
+
|
|
183
|
+
- Info...
|
|
184
|
+
|
|
185
|
+
- Create a new feature branch (off the develop branch) to contain your feature, change, or fix:
|
|
186
|
+
|
|
187
|
+
git checkout -b <feature-branch-name>
|
|
188
|
+
|
|
189
|
+
- OPTIONAL: Install pre-commit checks. This will trigger linting and unit tests on every git commit, so that any issues are identified locally. This is optional but it may help to catch issues early.
|
|
190
|
+
|
|
191
|
+
`pre-commit install`
|
|
192
|
+
|
|
193
|
+
- Commit your changes in logical chunks. Please adhere to these [git commit
|
|
194
|
+
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
|
195
|
+
or your code is unlikely to be merged into the main project. Use Git's
|
|
196
|
+
[git rebase](https://docs.github.com/en/get-started/using-git/about-git-rebase)
|
|
197
|
+
feature to tidy up your commits before making them public.
|
|
198
|
+
|
|
199
|
+
- Locally merge (or rebase) the upstream development branch into your feature branch every time before pushing it to your fork:
|
|
200
|
+
|
|
201
|
+
# Here the <dev-branch> is develop
|
|
202
|
+
git pull [--rebase] upstream <dev-branch>
|
|
203
|
+
|
|
204
|
+
- Push your feature branch up to your fork:
|
|
205
|
+
|
|
206
|
+
git push origin <feature-branch-name>
|
|
207
|
+
|
|
208
|
+
- [Open a Pull Request]()
|
|
209
|
+
with a clear title, description and explain how to test the feature.
|
|
210
|
+
|
|
211
|
+
### Submitting Pull Requests
|
|
212
|
+
|
|
213
|
+
- It is recommended to open an issue before starting work on a pull request to make sure if the same issue is not reported previously and someone is already working on that. When suggesting a new feature, also make sure it won't conflict with any work that's already in progress.
|
|
214
|
+
|
|
215
|
+
- Once the issue is opened either self-assign the issue or ask the maintainer to assign it for you. This will make sure no others are working on the same issue.
|
|
216
|
+
|
|
217
|
+
- All new functionality must include relevant tests where applicable.
|
|
218
|
+
|
|
219
|
+
- When submitting a pull request, please be sure to work off of the **develop** branch and not from other branches. The **develop** branch is used for ongoing development, while the **master** will hold the last stable version.
|
|
220
|
+
|
|
221
|
+
- To automate release-notes creation and make filtering process easier, it is strongly recommended to use [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) syntax at least for Pull Request (PR) title.
|
|
222
|
+
|
|
223
|
+
- All code submissions must follow the below criteria:
|
|
224
|
+
|
|
225
|
+
- The issue/PR title should follow the semantic as described [here](#pull-request-semantics)
|
|
226
|
+
- All the tests are updated and are passed successfully
|
|
227
|
+
- Python syntax is valid
|
|
228
|
+
|
|
229
|
+
### Pull Request Semantics
|
|
230
|
+
|
|
231
|
+
The Pull Request title should start with one of the below to easily segregate if
|
|
232
|
+
its a feature add or a bug or something related documentation etc.
|
|
233
|
+
|
|
234
|
+
It is strongly recommended to use one from the below:
|
|
235
|
+
|
|
236
|
+
- ```Feat```: Create a capability e.g. feature, test, dependency
|
|
237
|
+
- ```Fix```: Fix an issue e.g. bug, typo, accident, misstatement
|
|
238
|
+
- ```Doc```: Refactor of documentation, e.g. help files
|
|
239
|
+
- ```Example```: Add a new example or modify an [existing one](docs/labs/)
|
|
240
|
+
- ```Test```: Add or refactor anything regarding test, e.g add a new testCases or missing testCases
|
|
241
|
+
- ```Refactor```: A code change that MUST be just a refactoring
|
|
242
|
+
- ```Bump```: Increase the version of something e.g. dependency
|
|
243
|
+
- ```Revert```: Change back to the previous commit
|
|
244
|
+
- ```Optimize```: Refactor of performance, e.g. speed up code
|
|
245
|
+
- ```CI```: Update CI components, e.g. molecule files or Github Actions
|
|
246
|
+
- ```Cut```: Remove a capability e.g. feature, test, dependency
|
|
247
|
+
|
|
248
|
+
For example:
|
|
249
|
+
|
|
250
|
+
- Feat: Add support for decommissioning APIs
|
|
251
|
+
- Test: Add missing test cases for message sending
|
|
252
|
+
- Doc: Document new examples for new message handling
|
|
253
|
+
|
|
254
|
+
## License
|
|
255
|
+
|
|
256
|
+
Copyright© 2026, Arista Networks, Inc. All rights reserved.
|
|
257
|
+
|
|
258
|
+
Redistribution and use in source and binary forms, with or without
|
|
259
|
+
modification, are permitted provided that the following conditions are
|
|
260
|
+
met:
|
|
261
|
+
|
|
262
|
+
- Redistributions of source code must retain the above copyright
|
|
263
|
+
notice, this list of conditions and the following disclaimer.
|
|
264
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
265
|
+
notice, this list of conditions and the following disclaimer in the
|
|
266
|
+
documentation and/or other materials provided with the distribution.
|
|
267
|
+
- Neither the name of Arista Networks nor the names of its
|
|
268
|
+
contributors may be used to endorse or promote products derived from
|
|
269
|
+
this software without specific prior written permission.
|
|
270
|
+
|
|
271
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS
|
|
272
|
+
IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
273
|
+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
274
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS BE
|
|
275
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
276
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
277
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
278
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
279
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
280
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
281
|
+
THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2024, Arista Networks, Inc.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
|
6
|
+
# modification, are permitted provided that the following conditions are
|
|
7
|
+
# met:
|
|
8
|
+
#
|
|
9
|
+
# Redistributions of source code must retain the above copyright notice,
|
|
10
|
+
# this list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# Redistributions in binary form must reproduce the above copyright
|
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# Neither the name of Arista Networks nor the names of its
|
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
|
18
|
+
# this software without specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
21
|
+
# 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
|
|
24
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
27
|
+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
28
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
29
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
30
|
+
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
#
|
|
32
|
+
|
|
33
|
+
"""REST API Client for interacting with ACT."""
|
|
34
|
+
|
|
35
|
+
__version__ = "1.0.0"
|
|
36
|
+
__author__ = "ACT Dev Arista Networks, Inc."
|