Skip to content

CLI tool to directly import CloudVision device user tags to Nautobot device tags.

Notifications You must be signed in to change notification settings

nautobot/nautobot-arista-cloudvision-importer

Repository files navigation

Arista CloudVision Importer

This tool acts as your initial sync of user tags from CloudVision to tags in Nautobot. After running this tool once, you can use the "Sync To" feature in the SSoT plugin found here to keep CloudVision up to date with any new tags created in Nautobot.

If devices in CloudVision already have tags assigned to them, this tool will assign the tags to the device in Nautobot as long as the device exists. If the deivce does not exist in Nautobot, only the tag is created. Below is a small gif showing the CLI tool in action.

arista_importer

This tool only syncs tags from CloudVision to Nautobot and will NOT delete tags from Nautobot even if the tag is deleted in CloudVision.

Installation

This command line tool is ran from poetry. To install poetry follow the instructions here.

To use this tool, clone this repository to your local machine using

git clone git@github.com:nautobot/nautobot-arista-cloudvision-importer.git

Once the repo is cloned, you will need to change your working directory to the root of the project to run the commands in the section below.

Usage

Before using this tool, you need to configure a few variables in the pyproject.toml file under the [tool.nautobot_aristacv_importer] section.

For Nautobot, you need to configure the the following:

  • nautobot_url - The url to your Nautobot instance.
  • nautobot_token - The created token used to authenticate to your Nautobot instance. Token creation information can be found here

For CloudVision, the variables you set depend on whether you are using an onprem instance of CloudVision or CloudVision as a service (CVAAS). For onprem, the following must be set:

  • cvp_host - The ip to your CloudVision instance.
  • cvp_user - The username used to connect to CloudVision.
  • cvp_password - The password used to connect to CloudVision.
  • insecure - A boolean telling the tool whether or not to download and automatically trust the CloudVision certificate. Defaults to False.

The following must be set when connecting to CloudVision as a service.

  • cvaas_token - The token for the service account that will be used to connect to CVAAS.

Once configured you need to run poetry install to install dependencies for the tool. After that you can run the tool using the command poetry run nautobot_aristacv_importer. The terminal will display the the expected diff and ask you to verify whether you would like to proceed with the sync or not.

CLI Helper Commands

The project is coming with a CLI helper based on invoke to help facilitate testing and docker container management. Testing is performed in a docker container to ensure environment uniformity. In order to run the tests you must first build the docker container using invoke build. From there, you can run any of the commands below to test your code. Each command also has its own help invoke <command> --help

Testing

  bandit           Run bandit to validate basic static code security analysis.
  black            Run black to check that Python files adhere to its style standards.
  flake8           This will run flake8 for the specified name and Python version.
  pydocstyle       Run pydocstyle to validate docstring formatting adheres to NTC defined standards.
  pylint           Run pylint code analysis.
  pytest           Run pytest.
  tests            Run all tests for this plugin.

Docker Management

  build            Build all docker images.
  rebuild          Clean the docker image and then rebuild without using cache.
  clean            Remove the project specific image.

Questions

For any questions or comments, please check the FAQ first and feel free to swing by the Network to Code slack channel (channel #networktocode). Sign up here

About

CLI tool to directly import CloudVision device user tags to Nautobot device tags.

Topics

Resources

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages