cvprac is a Python client library designed to interact with the Arista CloudVision Portal (CVP) RESTful API. It simplifies API calls, handles session management, error retries, and abstracts CVP version-specific API changes, enabling easier automation and integration with CVP. The library is actively maintained, with a typical release cadence of several updates per year, and is currently at version 1.4.2.
pip install cvpracVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to establish a connection to an Arista CloudVision Portal (CVP) instance using `cvprac.CvpClient`. It prioritizes API token authentication, suitable for both CloudVision as-a-Service (CVaaS) and on-prem deployments, falling back to username/password for older on-prem setups. It then fetches and prints basic CVP information. Ensure `CVP_HOST` and either `CVP_API_TOKEN` or `CVP_USERNAME`/`CVP_PASSWORD` environment variables are set.
Migrate to API token-based authentication. Ensure `api_token` parameter is used with `client.connect()`.
Update all calls to `client.connect()` to use `api_token` instead of `cvaas_token`.
Ensure your environment is running Python 3.7 or newer. Old Python 2 scripts will likely fail.
Always refer to the Arista CVP API documentation for your specific CVP version. Test automation against CVP upgrades. Consult `cvprac` release notes for CVP version validations.
Ensure `cvprac` version is 1.4.0 or newer. If you are using an older `cvprac` and cannot upgrade, you might need to ensure `setuptools` is installed in a version that still provides `pkg_resources` (though this is not recommended). Prefer upgrading `cvprac`.
Verify CVP `nodes` list, `username`, `password`, `api_token`, and `protocol` parameters in `client.connect()`. Ensure CVP is reachable from the client machine and that API token has correct permissions. For CVaaS, confirm `is_cvaas=True` and use an API token.
Check network connectivity and latency to the CVP API endpoint. Verify the assigned roles/permissions for the API token or user account being used, especially for executing tasks or change controls. For CVaaS, ensure any necessary firewall rules for egress traffic from the CVP instance are configured to reach target devices.
Double-check the CVP hostname/IP. Monitor CVP health. Increase connection `timeout` in `client.connect()`. `cvprac` has internal retry mechanisms, but persistent errors suggest a fundamental network or server issue.