### studio_onboarding.py Get Updates Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Executes the studio_onboarding.py script to retrieve pending updates for devices and interfaces within a specified CloudVision studio, with build-only mode enabled. ```shell python studio_onboarding.py --server www.arista.io:443 --token-file token.tok --build-only True ``` -------------------------------- ### Get All Device EOS Versions Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md Retrieves the EOS version for all devices managed by CloudVision. Requires server address, token file, and optionally a certificate file. ```bash python3 get_versions.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt ``` -------------------------------- ### studio_update.py Get Studio Inputs Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Retrieves the input configuration for a specified studio (e.g., AVD campus fabric) using the studio_update.py script. ```shell python3 studio_update.py --server www.arista.io --token-file token.tok \ --operation=get --studio-id=studio-avd-campus-fabric-inputs ``` -------------------------------- ### CloudVision Service Example: Fetching Switches Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Demonstrates how to connect to CloudVision as a Service using a Python script and displays the JSON output for switch devices. This example highlights the differences in API endpoint and authentication for CloudVision as a Service. ```shell python3 get_switches.py --apiserver apiserver.arista.io:443 --auth=token,cvaasToken.txt ``` ```json { "0123F2E4462997EB155B7C50EC148767":{ "capabilities":[ "all" ], "deviceType":"", "eosVersion":"4.24.3M", "hostname":"tp-avd-leaf2", "isProvisioned":true, "mac":"50:08:00:b1:5b:0b", "modelName":"vEOS", "primaryManagementIP":"10.83.13.215", "status":"active", "terminAttrVersion":"v1.12.2" } } { "2568DB4A33177968A78C4FD5A8232159":{ "capabilities":[ "all" ], "deviceType":"", "eosVersion":"4.24.3M", "hostname":"tp-avd-spine2", "isProvisioned":true, "mac":"50:08:00:8c:22:49", "modelName":"vEOS", "primaryManagementIP":"10.83.13.213", "status":"active", "terminAttrVersion":"v1.12.2" } } ``` -------------------------------- ### studio_onboarding.py Help Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Displays the command-line interface help for the studio_onboarding.py script, outlining available arguments and operations for managing studios. ```shell python examples/resources/studio/studio_onboarding.py --help ``` -------------------------------- ### Update Studio Inputs via CLI Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Examples show updating studio inputs using the `studio_update.py` script. The first example uses `python3`, while the second demonstrates execution with `uv` and includes an optional certificate file. ```shell python3 studio_update.py --server www.arista.io --token-file token.tok \ --operation=set \ --studio-id studio-avd-campus-fabric \ --yaml-file=studio-avd-campus-fabric-inputs.yaml \ --build-only True ``` ```shell uv run studio_update.py --server 192.0.2.10:443 --token-file token.tok --cert-file cvp.crt \ --operation set \ --studio-id studio-avd-campus-fabric \ --yaml-file=studio-avd-campus-fabric-inputs.yaml \ --build-only True ``` -------------------------------- ### lookup_device.py CLI Help Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md Displays the command-line interface help for the lookup_device.py script, outlining available arguments for server connection, authentication, and device identification. ```bash python3 lookup_device.py --help ``` -------------------------------- ### get_versions.py CLI Help Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md Displays the command-line interface help for the get_versions.py script, detailing arguments for server connection, authentication, and device filtering. ```bash python3 get_versions.py --help ``` -------------------------------- ### Authenticate CloudVision On-Prem Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md Example command to retrieve an authentication token and certificate from an on-premise CloudVision deployment using a Python script. ```shell python3 get_token.py --server 192.0.2.79 --username cvpadmin --password arastra --ssl ``` -------------------------------- ### studio_onboarding.py Accept All Updates Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Uses the studio_onboarding.py script to accept all pending updates for a given workspace ID in the CloudVision studio. ```shell python studio_onboarding.py --server www.arista.io:443 --token-file token.tok \ --wsid 5f88c496-71ca-469d-af19-2a17a5f5d583 --operation set-all ``` -------------------------------- ### Retrieve Active Devices (On-Prem) Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md This example demonstrates how to use the example_utility.py script to fetch actively streaming devices from an on-premises CloudVision instance. It specifies the server, token file, and certificate for authentication, and outputs device serial numbers and hostnames. ```python python3 example_utility.py --server 10.83.12.79:443 --token-file ~/go79/token.txt --cert-file ~/go79/cvp.crt --active ``` -------------------------------- ### Get All Events with get_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Retrieves all events from the CloudVision server. Requires server address, token file, and certificate file for authentication. ```bash python3 get_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt ``` -------------------------------- ### Get Events After Specific Date with get_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Fetches events that occurred after a specified timestamp. Uses server details, token, and certificate, along with the --start parameter for filtering. ```bash python3 get_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt --start 2021-02-02T00:00:01.000000001Z ``` -------------------------------- ### example_utility.py Command Line Arguments Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md This section details the command-line arguments for the example_utility.py script. It outlines required parameters like server address and token file, as well as optional filters for device status and specific device lookups. ```APIDOC example_utility.py --help usage: example_utility.py [-h] --server SERVER --token-file TOKEN_FILE [--cert-file CERT_FILE] [--device DEVICE] [--active] [--inactive] Get devices in inventory. optional arguments: -h, --help show this help message and exit --server SERVER CloudVision server to connect to in : format --token-file TOKEN_FILE file with access token --cert-file CERT_FILE certificate to use as root CA --device DEVICE get a single device by serial number --active get only actively streaming devices --inactive get only non-actively streaming devices ``` -------------------------------- ### studio_onboarding.py Accept Specific Update Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Applies a specific update to a CloudVision studio workspace using the studio_onboarding.py script, identified by an update ID. ```shell python studio_onboarding.py --server www.cv-staging.corp.arista.io:443 --token-file token.tok \ --wsid 5f88c496-71ca-469d-af19-2a17a5f5d583 --operation set \ --update-id 'add::DEVICE::{"deviceId":"ZZZ7777777","hostname":"leaf503","interfaceSize":73}' ``` -------------------------------- ### Get Connectivity Monitor Data (Specific Device) Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Retrieves connectivity monitoring statistics for a specific device identified by its CloudVision device ID. ```shell python3 connectivityMonitorVrf.py --apiserver 10.83.12.174:443 --auth=token,token.txt,cvp.crt --device BAD032986065E8DC14CBB6472EC314A6 ``` -------------------------------- ### Authenticate On-Prem CloudVision Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/studio/README.md Demonstrates how to use the get_token.py script to authenticate with an on-premises CloudVision server using username and password. ```shell python3 get_token.py --server 192.0.2.79 --username cvpadmin --password arastra --ssl ``` -------------------------------- ### Get Switch MAC Address Table Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Retrieves and displays the MAC address table for a specified switch onboarded to CloudVision. Includes VLAN, MAC address, type, interface, and last move time. ```shell python3 get_switch_mac.py --apiserver 10.83.12.79:443 --auth=token,token.txt,cvp.crt --device ZZZ99999999 ``` -------------------------------- ### Get Specific Event Type Between Dates with get_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Filters events by a specific event type and a date range. Includes parameters for server, token, certificate, event type, start, and end times. ```bash python3 get_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt --event-type DEVICE_INTF_ERR_SMART --start 2021-01-31T00:00:01.000000001Z --end 2021-01-31T22:00:01.000000001Z ``` -------------------------------- ### Get Connectivity Monitor Data (All Devices) Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Retrieves connectivity monitoring statistics (host IP, response time, jitter, latency, packet loss) for all devices streaming these statistics via CloudVision. ```shell python3 connectivityMonitorVrf.py --apiserver 10.83.12.174:443 --auth=token,token.txt,cvp.crt ``` -------------------------------- ### Get Specific Device EOS Version Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md Retrieves the EOS version for a single, specified device using its serial number and hostname. Requires CloudVision server, token file, and certificate file. ```bash python3 get_versions.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt \ --serial ZZZ9999999 --hostname leaf1 ``` -------------------------------- ### Get Interface Status and Summary Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Retrieves the link status for all interfaces on a device and provides a summary of connected and disconnected interfaces. Additional states like operStatus and MTU can also be accessed. ```shell python3 get_intf_status.py --apiserver 10.83.12.79:443 --auth=token,~/go79/token.txt,~/go79/cvp.crt --deviceId JPE17182435 Interface Name Status Ethernet10 linkDown Ethernet1 linkDown Ethernet2 linkDown Ethernet3 linkDown Ethernet8 linkDown Ethernet5 linkDown Ethernet9 linkDown Ethernet24 linkUp Ethernet26 linkUp Management1 linkUp Ethernet Status on JPE17182435: 8 interfaces connected (including Management) 56 interfaces down ``` -------------------------------- ### Retrieve Active Devices (CloudVision as a Service) Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md This example shows how to retrieve actively streaming devices from CloudVision as a Service. It uses the service endpoint and a specific token file, demonstrating connectivity to the cloud-hosted service. ```python python3 example_utility.py --server www.arista.io:443 --token-file cvaasToken.txt --active ``` -------------------------------- ### Run get_events.py for CloudVision Service Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Example command to execute the `get_events.py` script to fetch events from CloudVision as a Service. It specifies the server endpoint, token file, and the desired event type. ```bash python3 get_events.py --server www.arista.io:443 --token-file cvaasToken.txt --event-type HIGH_CPU_LOAD_AVG ``` -------------------------------- ### Install CloudVision Python Library Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/README.md Instructions for installing the Arista CloudVision Python library using pip or from source. Ensures the latest version is used for optimal functionality. ```sh pip install --upgrade cloudvision ``` ```sh python setup.py install ``` -------------------------------- ### Get Events by Severity with get_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Filters events based on their severity level. Requires server, token, and certificate, and uses the --severity parameter to specify the desired level. ```bash python3 get_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt --severity INFO ``` -------------------------------- ### Authenticate CloudVision On-Prem Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md Demonstrates obtaining authentication token and certificate for CloudVision On-Prem using a Python script. Requires server address, username, and password. ```bash python3 get_token.py --server 10.83.12.79 --username cvpadmin --password arastra --ssl ``` -------------------------------- ### Get Network Data using GRPCClient Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/README.md Example Python script for the CloudVision Connector, showing how to retrieve data from a specified dataset. It utilizes the GRPCClient to query and process network information. ```python targetDataset = "analytics" path = ["DatasetInfo", "Devices"] # No filtering done on keys, accept all keys = [] ProtoBufQuery = CreateQuery([(path, keys)], targetDataset) with GRPCClient("my-cv-host:9900") as client: for notifBatch in client.Get([query]): for notif in notifBatch["notifications"]: # Get timestamp for all update here with notif.Timestamp PrettyPrint(notif["updates"]) ``` -------------------------------- ### Create and Assign Tags to Devices Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md Python command to create and assign defined tags to devices and interfaces within CloudVision, using previously obtained token and certificate files. ```shell python3 manage_tags.py --server 192.0.2.79:443 --token-file token.txt --cert-file cvp.crt --create-and-assign ``` -------------------------------- ### Subscribe to Interface Rate Counters Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Subscribes to rate counters for a specific interface on a device. This example shows fetching 'outOctets' and requires API server, authentication, device ID, and interface name. ```shell python3 get_intf_rate.py --apiserver 192.0.2.79.79:443 --auth=token,token.txt,cvp.crt --device JPE17182435 --interface Ethernet24 { "outOctets":99945180.4 } { "outOctets":99660196.3 } { "outOctets":99252974.8 } { "outOctets":99084092.4 } { "outOctets":100230212.3 ``` -------------------------------- ### List Actively Streaming Devices Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Demonstrates how to execute the `get_switches.py` script to retrieve a list of all actively streaming devices connected to CloudVision. It shows the command-line arguments required for API server connection and authentication. ```shell python3 get_switches.py --apiserver 10.83.12.79:443 --auth=token,token.txt,cvp.crt ``` ```json { "ZZZ9999999":{ "capabilities":[ "all" ], "eosVersion":"4.24.4M", "hostname":"leaf1", "isProvisioned":false, "mac":"de:ad:be:ef:ca:fe", "modelName":"DCS-7050TX-64", "primaryManagementIP":"172.28.160.226", "status":"active", "terminAttrVersion":"v1.10.0" } } { "ZZZ9999998":{ "capabilities":[ "all" ], "eosVersion":"4.24.3M", "hostname":"spine1", "isProvisioned":true, "mac":"de:ad:b3:3f:ca:f3", "modelName":"DCS-7280SR-48C6", "primaryManagementIP":"172.28.161.108", "status":"active", "terminAttrVersion":"v1.10.0" } } ``` -------------------------------- ### Get Events and Acknowledge with get_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Retrieves events matching specific criteria (event type, date range) and acknowledges them. The --ack flag is used to mark events as acknowledged. ```bash python3 get_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt --event-type INSUFFICIENT_PEER_LAG_REDUNDANCY --start 2021-01-31T00:00:01.000000001Z --end 2021-02-02T22:00:01.000000001Z --ack ``` -------------------------------- ### Get Max Interface Utilization Over Time Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Calculates the maximum Transmit (Tx) and Receive (Rx) utilization of an interface within a specified time period. It aggregates counters over 15-minute intervals and reports the peak values. ```shell python3 get_intf_maxrate_period.py --apiserver 10.1.1.1:443 --auth=token,token.txt,cvp.crt --device SGD20000000 --interface Port-Channel27 --start=2021-06-03T05:30:00 --end=2021-06-03T08:20:00 Max Tx (Mbps) is: 597.531184 Max Rx (Mbps) is: 22.940072 ``` -------------------------------- ### Get LLDP Neighbors from Device Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Retrieves Link Layer Discovery Protocol (LLDP) neighbors for a specified device using its serial number. Requires API server address, authentication credentials, and the device ID. ```shell python3 get_lldp_nei.py --apiserver 192.0.2.79:443 --auth=token,token.tok,cvp.crt --device 8520AF39790A4EC959550166DC5DEADE Port Neighbor Device ID Neighbor Port ID TTL Ethernet2 tp-avd-spine2 Ethernet3 120 Ethernet1 tp-avd-spine1.tst Ethernet3 120 Ethernet3 tp-avd-leaf4 Ethernet3 120 Ethernet4 tp-avd-host2 Ethernet1 120 Ethernet5 tp-avd-leaf4 Ethernet5 120 ``` -------------------------------- ### Lookup Device Information Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/inventory/README.md Fetches detailed information for a specific device using its serial number or hostname. Requires CloudVision server, token file, and optionally a certificate file. ```bash python3 lookup_device.py --server 10.83.12.79:443 --token-file ~/go79/token.txt --cert-file ~/go79/cvp.crt --hostname leaf1 ``` -------------------------------- ### Filter CloudVision Events by Time Range Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Shows how to retrieve CloudVision events within a specific time window using start and end timestamps. The `--exact_range=True` flag ensures events are strictly within the specified period. ```shell python3 get_events.py --apiserver 10.83.12.79:443 --auth=token,token.txt,cvp.crt --start=2021-02-02T10:00:00 --end=2021-02-02T21:46:00 --exact_range=True ``` -------------------------------- ### Assign Topology Tags to Devices Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md Illustrates how to use `manage_tags.py` to assign predefined topology tags (e.g., `topology_hint_type`, `topology_hint_rack`) to devices. This helps in organizing and visualizing the network topology based on device roles and physical location. ```shell python3 manage_tags.py --server 192.0.2.79:443 \ --token-file token.txt \ --cert-file cvp.crt \ --file topology_tags.yaml \ --create-and-assign ``` -------------------------------- ### Manage Device Tags with CloudVision CLI Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md These shell commands demonstrate how to manage device tags using the CloudVision CLI. They cover creating, assigning, and unassigning tags, as well as a combined create-and-assign operation. The commands require a server address, a token file, and a YAML file specifying tag configurations. ```shell python3 manage_tags.py --server www.arista.io:443 --token-file cvaasToken.txt --file tags.yaml --create ``` ```shell python3 manage_tags.py --server www.arista.io:443 --token-file cvaasToken.txt --file tags.yaml --assign ``` ```shell python3 manage_tags.py --server www.arista.io:443 --token-file cvaasToken.txt --file tags.yaml --unassign ``` ```shell python3 manage_tags.py --server www.arista.io:443 --token-file cvaasToken.txt --file tags.yaml --create-and-assign ``` -------------------------------- ### Authenticate CloudVision On-Prem with Token Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Demonstrates how to obtain an authentication token and certificate for CloudVision On-Prem using a Python script. This token expires in 24 hours and is saved to token.txt and cvp.crt. ```shell python3 get_token.py --server 10.83.12.79 --username cvpadmin --password arastra --ssl ``` -------------------------------- ### Define Interface Tags for Topology Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md YAML configuration defining device and interface tags, including 'lldp_chassis' and 'lldp_hostname', to enforce correct LLDP information for topology display. ```yaml tags: device_tags: - label: leaf1DTag1 value: leaf1DVal1 device_id: JPE14243257 - label: leaf1DTag2 value: leaf1DVal2 device_id: JPE14243257 interface_tags: - label: lldp_chassis value: de:ad:be:ef:ca:fe device_id: JPE14243257 interface_id: Ethernet24 - label: lldp_hostname value: tacsrv18 device_id: JPE14243257 interface_id: Ethernet24 ``` -------------------------------- ### Subscribe to All Events with sub_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Subscribes to a real-time stream of all events from the CloudVision server. Requires server address, token file, and certificate file. ```bash python3 sub_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt ``` -------------------------------- ### CloudVision Event Payload Example Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md A sample structured data payload representing a 'High CPU Load Average' event received from CloudVision as a Service. This format details the event's severity, title, description, associated device, and timestamps. ```text selecting events that match the filter partial_eq_filter { event_type { value: "HIGH_CPU_LOAD_AVG" } } value { key { key { value: "5b3e4aaaea6dfc33" } timestamp { seconds: 1612393259 nanos: 485938570 } } severity: EVENT_SEVERITY_WARNING title { value: "High CPU load average" } description { value: "Device\'s 15 minute CPU load average exceeded threshold of 2" } event_type { value: "HIGH_CPU_LOAD_AVG" } data { data { key: "deviceId" value: "7CA9C0014DBB4965F0748040DDB90A5C" } data { key: "threshold" value: "2" } data { key: "value" value: "2.594238" } } components { components { type: COMPONENT_TYPE_DEVICE components { key: "deviceId" value: "7CA9C0014DBB4965F0748040DDB90A5C" } } } } time { seconds: 1612393259 nanos: 485938570 } type: INITIAL ``` -------------------------------- ### Report Interfaces Administratively Up, Operationally Down Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Generates a report listing interfaces on a CloudVision-managed device that are administratively up but operationally down, along with the number of days since this state was detected. ```shell python3 examples/Connector/days_since_port_open.py --apiserver 10.18.140.7:443 --auth=token,token.txt,cvp.crt ``` -------------------------------- ### Create and Assign LLDP Chassis Tags Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md Demonstrates using `manage_tags.py` to create and assign `lldp_chassis` and `lldp_mode` tags to interfaces. This is crucial for ensuring devices are correctly represented in the topology by using the chassis MAC address instead of interface MAC addresses. ```shell python3 manage_tags.py --server {cvpIP}:443 --token-file {tokenFile} --cert-file {certFile} --file nx9k.yaml --create python3 manage_tags.py --server {cvpIP}:443 --token-file {tokenFile} --cert-file {certFile} --file nx9k.yaml --assign ``` ```shell python3 manage_tags.py --server {cvpIP}:443 --token-file {tokenFile} --cert-file {certFile} --file nx9k.yaml --create-and-assign ``` -------------------------------- ### Find Switches with High Disk Utilization Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Searches the CloudVision inventory for switches where specified mount points (/var/log, /var/core, /mnt/flash) exceed a defined utilization threshold (default 90%). Prints hostname and serial number for matching switches. ```shell python3 get_switches_full_dir.py --apiserver 10.83.12.79:443 --auth=token,token.txt,cvp.crt ``` -------------------------------- ### Authenticate CloudVision On-Prem Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Demonstrates how to obtain authentication tokens and certificates from an on-premises CloudVision server using a Python script. This involves specifying server details, username, and password. ```bash python3 get_token.py --server 10.83.12.79 --username cvpadmin --password arastra --ssl ``` -------------------------------- ### Synchronize Event Generation Rules Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md This script synchronizes event generation rule configurations between two CloudVision clusters. It involves cloning the repository, setting up authentication tokens, and executing the main synchronization script with source and destination parameters. ```shell git clone https://github.com/aristanetworks/cloudvision-python.git cd examples mkdir go79 mkdir go173 cp get_token.py go79/ cp get_token.py go173/ cd go79 python3 get_token.py --server 10.83.12.79 --username cvpadmin --password arastra --ssl cd ../go173 python3 get_token.py --server 10.83.12.173 --username cvpadmin --password arastra --ssl cd ../Connector python3 sync_events_cfg.py --src=10.83.12.79:443 --srcauth=token,../go79/token.txt,../go79/cvp.crt --dst=10.83.12.173:443 --dstauth=token,../go173/token.txt,../go173/cvp.crt ``` ```json { "eventName": { "default": { "updates": {}, "path_elements":[] }, "custom": { "updates": {}, "path_elements":[] } } } ``` -------------------------------- ### Assign Tags to Interfaces via Script Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/tag/v2/README.md Provides the command syntax for assigning previously created tags to interfaces using a Python script. This step is essential for applying the `lldp_chassis` and `lldp_mode` tags to ensure correct topology representation. ```shell python3 assign_tags.py --server {cvpIP}:443 --token-file {tokenFile} --cert-file {certFile} --file nx9k.yaml --assign ``` -------------------------------- ### Subscribe to Events by Severity with sub_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Subscribes to a real-time stream of events filtered by severity level. Uses the --severity parameter to specify the desired severity. ```bash python3 sub_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt --severity INFO ``` -------------------------------- ### Fetch All Active CloudVision Events Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md Demonstrates how to retrieve all currently active events from CloudVision using a Python script. It requires specifying the API server address and authentication details. The output is a JSON object detailing event information. ```shell python3 get_events.py --apiserver 10.83.12.79:443 --auth=token,~/go79/token.txt,~/go79/cvp.crt ``` ```json { "74694dfb259599":{ "ack":true, "acknowledgement":{ "timestamp":"1604061595270", "userId":"cvpadmin" }, "components":[ { "deviceId":"JPE17182435", "type":"device" } ], "data":{ "checkItems":{ "Flood List":{ "desc":"No flood list configured", "name":"Flood List", "result":"Fail" }, "Loopback IP Address":{ "desc":"", "name":"Loopback IP Address", "result":"Pass" }, "Routing":{ "desc":"", "name":"Routing", "result":"Pass" }, "VLAN-VNI Map":{ "desc":"", "name":"VLAN-VNI Map", "result":"Pass" } }, "deviceId":"JPE17182435" }, "delTime":0, "description":"Local VTEP configuration check failed", "eventType":"VXLAN_CONFIG_SANITY", "isInteractionUpdate":true, "key":"74694dfb259599", "keySchema":[ "deviceId" ], "lastUpdatedTime":1604061595270, "severity":"WARNING", "timestamp":1597406296448, "title":"Vxlan Config Sanity Check failed" } } ``` -------------------------------- ### Generate Arista Device Bug and Lifecycle Reports Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/Connector/README.md This script executes the `bugalerts.py` tool to fetch and display network device information. It requires API server details and authentication credentials. The output includes reports on bug counts, CVEs, and various lifecycle statements (End of Life, End of Sale, End of TAC Support, End of Hardware RMA Requests) for devices. ```shell python3 bugalerts.py --apiserver 10.83.12.79:443 --auth=token,token.txt,cvp.crt Report #1 - BugCount Device SN Number of bugs 0123F2E4462997EB155B7C50EC148767 8 2568DB4A33177968A78C4FD5A8232159 2 6323DA7D2B542B5D09630F87351BEA41 3 8520AF39790A4EC959550166DC5DEADE 3 CD0EADBEEA126915EA78E0FB4DC776CA 3 Report #2 - CVEs Device Hostname EOS Version CVEs tp-avd-leaf2 4.23.3M CVE-2018-0732,CVE-2020-10188 tp-avd-spine2 4.25.3.1M tp-avd-leaf4 4.25.3.1M tp-avd-leaf3 4.25.3.1M tp-avd-spine1 4.25.3.1M Report #3 - Bugs tp-avd-leaf2 4.23.3M 281795,444677,464188,472113,489787,496371,523122,556742 tp-avd-spine2 4.25.3.1M 556742,573022 tp-avd-leaf4 4.25.3.1M 556742,573022,583243 tp-avd-leaf3 4.25.3.1M 556742,573022,583243 tp-avd-spine1 4.25.3.1M 556742,573022,578276 Report #4 - Lifecycle statements - End of Life Hostname Serial number Model End of Life leaf1 ZZZ99999999 7328X-FM(4) 2025-10-02 leaf2 ABC12345678 7328X-FM(4) 2025-10-02 spine1 EFG09876543 DCS-7050QX-32(1) 2020-03-22 Report #5 - Lifecycle statements - End of Sale Hostname Serial number Model End of Sale leaf1 ZZZ99999999 7328X-FM(4), 7320X-32C-LC(5) 2021-10-02 leaf2 ABC12345678 7328X-FM(4), 7320X-32C-LC(8) 2021-10-02 spine1 EFG09876543 DCS-7050QX-32(1) 2017-03-23 Report #6 - Lifecycle statements - End of TAC Suppor Hostname Serial number Model End of TAC Support leaf1 ZZZ99999999 7328X-FM(4) 2025-10-02 leaf2 ABC12345678 7328X-FM(4) 2025-10-02 spine1 EFG09876543 DCS-7050QX-32(1) 2020-03-22 Report #7 - Lifecycle statements - End of Hardware RMA Requests Hostname Serial number Model End of Hardware RMA Requests leaf1 ZZZ99999999 7328X-FM(4) 2025-10-02 leaf2 ABC12345678 7328X-FM(4) 2025-10-02 spine1 EFG09876543 DCS-7050QX-32(1) 2020-03-22 Report #8 - End of Life (SW + HW) Device Type Component End of Life leaf1 software 4.27.0F 2024-09-27 leaf2 software 4.27.4M 2024-09-27 spine1 software 4.25.2F 2023-10-22 leaf3 hardware 7328X-FM(4) 2025-10-02 ``` -------------------------------- ### Subscribe and Annotate Critical Events Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/README.md Example Python script demonstrating how to subscribe to critical severity events from CloudVision and annotate them. It uses gRPC to connect to the EventService and EventAnnotationConfigService. ```python import time import google.protobuf.wrappers_pb2 import grpc from arista.event.v1 import models, services # setup credentials as channelCredentials with grpc.secure_channel("www.arista.io:443", channelCredentials) as channel: event_stub = services.EventServiceStub(channel) event_annotation_stub = services.EventAnnotationConfigServiceStub(channel) event_watch_request = services.EventStreamRequest( partial_eq_filter=[models.Event(severity=models.EVENT_SEVERITY_CRITICAL)], ) for resp in event_stub.Subscribe(event_watch_request): print(f"Critical event {resp.title.value} raised at {resp.key.timestamp}") # send alert here via email, webhook, or incident reporting tool # then make a note on the event indicating an alert has been sent now_ms = int(time.time() * 1000) notes_to_set = { now_ms: models.EventNoteConfig( note=google.protobuf.wrappers_pb2.StringValue( value="Administrator alerted", ), ), } annotation_config = models.EventAnnotationConfig( key=resp.key, notes=models.EventNotesConfig( notes=notes_to_set, ), ) event_note_update = services.EventAnnotationConfigSetRequest(value=annotation_config) event_annotation_stub.Set(event_note_update) ``` -------------------------------- ### Subscribe to Specific Event Types with sub_events.py Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/examples/resources/event/README.md Subscribes to a real-time stream of events filtered by specific event types. Uses the --event-type parameter to define the desired events. ```bash python3 sub_events.py --server 10.83.12.79:443 --token-file token.txt --cert-file cvp.crt --event-type DEVICE_INTF_ERR_SMART ``` -------------------------------- ### Python Project Dependencies Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/requirements.txt This snippet lists the required Python packages and their version constraints for the /aristanetworks/cloudvision-python project. These dependencies ensure compatibility and proper functionality of the project. ```python cryptography==44.0.2 grpcio>=1.53.0 msgpack>=1.0.3 protobuf>=5.28.3,<6.0dev requests>=2.20.1 typing-extensions>=4.2.0 ``` -------------------------------- ### Project Python Dependencies Source: https://github.com/aristanetworks/cloudvision-python/blob/trunk/requirements-dev.txt This section lists the core Python packages required for the project, including linters, formatters, type checkers, testing frameworks, and core libraries. These dependencies ensure code quality, maintainability, and proper execution of project functionalities. ```python isort==5.11.4 black==24.3.0 mypy-protobuf==3.6.0 mypy==0.981 pytest==8.3.4 numpy==1.26.4 pyyaml==6.0.1 flake8==3.8.4 grpcio-tools>=1.53.2 twine==4.0.1 types-attrs>=19.1.0 types-protobuf==5.29.1.20241207 types-PyYAML>=6.0.7 types-requests>=2.27.25 types-setuptools>=69.0.0.0 wheel==0.38.4 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.