Skip to main content

CVProxy - CloudVision Proxy

Project description

Arista CloudVision Proxy

Arista are transitioning their CloudVision provisioning model to use Studios and Workspaces, but the HTTP REST API only supports the legacy provisioning model, which has now been deprecated. The new API uses gRPC and is rather complex, but Arista provides a Python library to talk to the API, which is used by Ansible via the arista.avd.cv_deploy role. The purpose of this tool is to use pyavd to handle the complexity and to provide a HTTP proxy to convert between simplified JSON and gRPC using the same workflow that Ansible uses via pyavd._cv.workflows.deploy_to_cv.

Installation

python3 -m pip install --upgrade cvproxy

Usage

 cvproxy -s [-l <address>] [-p <port>] [-xff]

   -s                         - start CVProxy
   -l <address>               - specify a listen address (default is '127.0.0.1')
   -p <port>                  - specify a listen port (default is 8080)
   -xff                       - use X-Forwarded-For

It works by accepting a HTTP POST request with a Content-Type of application/json, which should adhere to the following schema:

"unevaluatedProperties": false,
"required": ["devices", "cv_server", "cv_token"],
"properties": {
  "devices": {
    "minProperties": 1,
    "unevaluatedProperties": false,
    "patternProperties": {
      "^[a-z][a-z0-9_.-]*$": {
        "unevaluatedProperties": false,
        "required": ["configlet"],
        "properties": {
          "serial_number": { "type": "string", "pattern": "^[A-Z][A-Z0-9]{10}$" },
          "configlet": { "type": "string", "pattern": "^(?=(.{4})+$)[A-Za-z0-9+/-]+={0,2}$" }
        }
      }
    }
  },
  "cv_server": { "type": "string", "minLength": 1 },
  "cv_token": { "type": "string", "minLength": 1 },
  "cv_change_control_name": { "type": "string", "minLength": 1 },
  "cv_delete_workspace": { "type": "boolean" }
}

The serial_number attribute is optional as it should be able to identify the device based on the hostname, unless it is a new device and there is no existing configlet. The configlet attribute is mandatory and is the configlet for the device, which must be Base64 encoded.

Example:

"devices": {
  "leaf-1a": {
    "configlet": "<base64 encoded configlet>"
  },
  "leaf-1b": {
    "configlet": "<base64 encoded configlet>"
  }
},
"cv_server": "www.cv-prod-uk-1.arista.io",
"cv_token": "<service token>"

If the HTTP POST request succeeds and there are any changes then a Change Control will be created in CloudVision ready for you to review and approve. The cv_change_control_name attribute is optional and if not provided will use the AVD default. The cv_delete_workspace attribute is also optional and if set to "true" will cleanup and delete the submitted Workspace.

Successful HTTP responses will be JSON encoded and will always contain a status attribute, which will either be "ok" or "error". If it is set to "ok" then an optional change_control attribute will be included if a Change Control was generated. If it is set to "error" then an errors attribute will also be provided with details of why it failed.

The recommended deployment is to deploy HAProxy in front of CVProxy, as HAProxy is better equipped to deal with TLS termination and it also supports HTTP/2 and HTTP/3 transports.

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

cvproxy-1.0.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

cvproxy-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file cvproxy-1.0.0.tar.gz.

File metadata

  • Download URL: cvproxy-1.0.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cvproxy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3980e29ff115e9baf1aeef70d42838e46cd7736ce844c1a8fb02cdefdf875cf2
MD5 8dcdb6d254936ccf6d31b19fa789b3c6
BLAKE2b-256 2e14e8faf7140acc8a671417114efd53ffcae3e7247dfab216ac897b6f09ad3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvproxy-1.0.0.tar.gz:

Publisher: pypi-release.yml on cmason3/cvproxy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cvproxy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cvproxy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cvproxy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e649e95e3c13dd65e12f016b02d8dc6703d92f4ca61169d8a93388b872e06eff
MD5 db13e9c1a09af058e1cf3c8db300d1c4
BLAKE2b-256 635f2a16ec8a9bba0629589536e334414f8ceb4eb26ba7126a681233df6b5d5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cvproxy-1.0.0-py3-none-any.whl:

Publisher: pypi-release.yml on cmason3/cvproxy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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