Skip to main content

Tests Python Support

nexus-pcv

A CLI tool to perform a pre-change validation on Nexus Dashboard Insights. It can either work with provided JSON file(s) or a terraform plan output from a Nexus as Code project. It waits for the analysis to complete and evaluates the results.

$ nexus-pcv -h
Usage: nexus-pcv [OPTIONS]

  A CLI tool to perform a pre-change validation on Nexus Dashboard Insights.

Options:
  --version                  Show the version and exit.
  -v, --verbosity LVL        Either CRITICAL, ERROR, WARNING, INFO or DEBUG.
  -i, --hostname-ip TEXT     ND hostname or IP (required, env:
                             PCV_HOSTNAME_IP).
  -u, --username TEXT        ND username (required, env: PCV_USERNAME).
  -p, --password TEXT        ND password (required, env: PCV_PASSWORD).
  -d, --domain TEXT          ND login domain (optional, default: 'local', env:
                             PCV_DOMAIN).
  -g, --group TEXT           NDI insights group name (optional, default:
                             'default', env: PCV_GROUP).
  -s, --site TEXT            NDI site or fabric name (required, env:
                             PCV_SITE).
  -n, --name TEXT            NDI pre-change validation name (optional, env:
                             PCV_NAME).
  --suppress-events TEXT     NDI comma-separated list of events to suppress
                             (optional, default: 'APP_EPG_NOT_DEPLOYED,APP_EPG
                             _HAS_NO_CONTRACT_IN_ENFORCED_VRF', env:
                             PCV_SUPPRESS_EVENTS).
  --timeout INTEGER          NDI pre-change validation timeout in minutes
                             (optional, default: 15, env: PCV_TIMEOUT).
  -f, --file FILE            NDI proposed change JSON file (optional, env:
                             PCV_FILE).
  -t, --nac-tf-plan FILE     NDI proposed change Terraform plan output
                             (optional, env: PCV_NAC_TF_PLAN).
  -o, --output-summary FILE  NDI summary of new events/anomalies written to a
                             file (optional, env: PCV_OUTPUT_SUMMARY).
  -r, --output-url FILE      NDI link (URL) to pre-change validation results
                             written to a file (optional, env:
                             PCV_OUTPUT_URL).
  -h, --help                 Show this message and exit.

Installation

Python 3.7+ is required to install nexus-pcv. Don't have Python 3.7 or later? See Python 3 Installation & Setup Guide.

nexus-pcv can be installed in a virtual environment using pip:

pip install nexus-pcv

CI/CD Integration

The tool can easily be integrated with CI/CD workflows. Arguments can either be provided via command line or environment variables. The tool will exit with a non-zero exit code in case of an error or non-suppressed events being discovered during the pre-change analysis. The --output-summary and --output-url arguments can be used to write a summary and/or a link (URL) to a file, which can then be embedded into notifications (e.g., Webex).

Nexus as Code Integration

Nexus as Code allows users to instantiate network fabrics in minutes using an easy to use, opinionated data model. More information about Nexus as Code can be found here. A planned change can be validated before applying it to a production environment by running a terraform plan operation first and then providing the output to nexus-pcv to trigger a pre-change validation.

export PCV_HOSTNAME_IP=10.1.1.1
export PCV_USERNAME=admin
export PCV_PASSWORD=Cisco123
export PCV_GROUP=LAB
export PCV_SITE=LAB1
terraform plan -out=plan.tfplan
terraform show -json plan.tfplan > plan.json
nexus-pcv --name "PCV1" --nac-tf-plan plan.json

Metadata

Release files for nexus-pcv 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexus-pcv 0.2.1
File Size Uploaded
nexus_pcv-0.2.1.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nexus-pcv 0.2.1
File Interpreter ABI Platform
nexus_pcv-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.3 kB

Release files / nexus_pcv-0.2.1.tar.gz

Download URL nexus_pcv-0.2.1.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7c824afbd8863ecc2e88c69057d50150730efe75775956bd877625137eb14651
BLAKE2b-256 checksum
How to use checksums
1384c87869af1ef0e21fa9d9330920ae2926277ae9649a963d6d7913895ff0ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1017-azure

Release files / nexus_pcv-0.2.1-py3-none-any.whl

Download URL nexus_pcv-0.2.1-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
796110fd8590d40192281e74eebccbfd655386d2b1666c2b2b58920e74c3d5ac
BLAKE2b-256 checksum
How to use checksums
0e7fe9b4db4fcd763f0871dd48382c35559db2d2946bc9465855aa82886ab690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1017-azure

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page