Giter Site home page Giter Site logo

jonxstill / cloudvision-python-actions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aristanetworks/cloudvision-python-actions

0.0 0.0 0.0 129 KB

Example Python action scripts for integrating with Change Controls in Arista's CloudVision platform

License: Apache License 2.0

Shell 1.85% Python 96.98% Makefile 1.17%

cloudvision-python-actions's Introduction

CloudVision Custom Python3 Actions

Note: This is only available from CloudVision 2021.3.0 onwards

Note: Check out release branches (e.g. 2022.2) or the releases page for scripts compatible with your CloudVision version

Overview

Here are a number of example Python3 scripts in action pack form to serve as reference to those designing their own user scripts.

Please note that scripts in the trunk branch may not be compatible with your installation of CloudVision. Please refer to the branch/release corresponding to your CloudVision version for compatible scripts.

These action packs are also able to be uploaded to a CloudVision cluster, where they can be used as needed, or duplicated and customised. Those action packs listed in bundled.yaml are bundled by default with CloudVision on-premises installations.

How to Upload Action Packs to a CloudVision cluster

CloudVision 2023.1+ / CVaaS

From CloudVision version 2023.1 (or on CVaaS), the Packaging UI under the general settings can be used to add or remove actionpacks downloaded from the releases page.

CloudVision 2022.3 or before

For on-premises installation versions 2022.3 or before, the following approach needs to be taken to install actionpacks. (This approach can alternatively be used for on-premises installations of version 2023.1 onwards instead of the Packaging UI as well)

Note: The following method of uploading scripts is not available for CVaaS customers.

Pre-requisites

  • git
  • tar
  • make (optional, used for tarring up multiple packs at once)

Steps

Prepare the action pack

  • Clone the github repo into a folder using git clone
  • Check out the branch/tag associated with the wanted release e.g. git checkout 2022.2
  • tar up the action pack while you are in the actionpacks directory (or equivalent directory). The name of the tar is not important, but it is good practice to use the same name as the as the directory you are tarring, and include the version string.
    • If using an OS X (Apple) machine, be sure to include the --disable-copyfile flag when running tar, or the actionpack may not be accepted. This flag is not available on Linux machines
    • Alternatively (in a 2022 or beyond release), running make actionpacks (or make actionpacks-mac on an OS X system) will tar up all action packs in the repository and add them into the gen folder

Note: For CloudVision version 2023.1 onwards, check the releases page to download the prebuilt tar files directly.

Upload the actionpack

  • Use scp to copy the tar file over to any of the cvp nodes in the system.
  • On the cvp node, upload the action pack via the the actionpack_cli

Note: This will upload the action pack as the aerisadmin user, which means that only the aerisadmin user will be able to modify or delete them (copies can still be made and modified/deleted by any user authorised to create actions).

To avoid making an aeris admin gated script, it is advised to create a new action, and to copy the script and arguments wanted from the example in question.

Example

Note: This example is using the event-monitor action pack, which is bundled by default, for a CloudVision 2022.2.* installation, with tar being run on an OS X machine.

For CloudVision version 2023.1 onwards, check the releases page to download the prebuilt tar files such as event-monitor-action-pack directly.

Creating the action pack tar

  • Clone the repo, enter it, and checkout the version of CloudVision that is being run
> git clone [email protected]:aristanetworks/cloudvision-python-actions.git
...
> cd cloudvision-python-actions
> git checkout 2022.2
  • tar up the desired action pack as shown below (or run make actionpacks to tar all packs and put them into the gen folder):
> tar --disable-copyfile cvf event-monitor-action-pack_1.0.0.tar event-monitor-action-pack
a event-monitor-action-pack
a event-monitor-action-pack/config.yaml
a event-monitor-action-pack/event-monitor
a event-monitor-action-pack/event-monitor/config.yaml
a event-monitor-action-pack/event-monitor/script.py

Uploading the action pack

  • scp the .tar action pack over to the cvp node

  • ssh onto the node and run /cvpi/tools/actionpack_cli event-monitor-action-pack_1.0.0.tar

Removing an action pack uploaded via actionpack_cli

Running the following curl command from the cli of the CloudVision instance will remove an actionpack from the system. curl -X DELETE https://localhost:8443/cvpservice/package/v1/packages/<action-pack-id> -k --cacert <cvp-ca-cert> --cert <aerisadmin-cert> --key <aerisadmin-key> Where the action-pack-id will be the name of the tar file uploaded through actionpack_cli Note: From 2023.1, the Packaging UI in general settings can alternatively be used to remove actionpacks.

cloudvision-python-actions's People

Contributors

chetryan avatar cianmcgrath avatar guillaumevilar avatar jrecchia1029 avatar noredistribution avatar perimore avatar rsndv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.