Skip to content

Commit

Permalink
chore: AristaCV documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
snaselj committed Aug 18, 2023
1 parent 9a378f0 commit 9232676
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 2 deletions.
200 changes: 200 additions & 0 deletions docs/admin/integrations/aristacv_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# Arista CloudVision Integration Setup

This guide will walk you through steps to set up Arista CloudVision integration with the `nautobot_ssot` App.

## Prerequisites

Before configuring the integration, please ensure, that `nautobot-ssot` App was [installed with integration extra dependencies](../install.md#install-guide).

```shell
pip install nautobot-ssot[aristacv]
```

## Configuration

Integration behavior can be controlled with the following settings:

| Configuration Variable | Type | Usage |
| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| aristacv_cvp_host | string | Hostname or ip address of the onprem instance of CloudVision. |
| aristacv_cvp_port | string | gRPC port (defaults to 8443, but this port has changed to 443 as of CVP 2021.3.0) |
| aristacv_cvp_user | string | The username used to connect to the on-prem instance of CloudVision. |
| aristacv_cvp_password | string | The password used by the user specified above. |
| aristacv_cvp_token | string | Token to be used when connecting to CloudVision. |
| aristacv_verify | boolean | If False, the integration will download the certificate from CloudVision and trust it for gRPC calls. |

To connect to a cloud instance of CloudVision you must set the following variable:

| Configuration Variable | Type | Usage | Default |
| ---------------------- | ------ | ------------------------------------------- | ----------------- |
| aristacv_cvaas_url | string | URL used to connect to your CvaaS instance. | www.arista.io:443 |

When syncing from CloudVis integration will create new Arista devices that do not exist in Nautobot. When creating new devices in Nautobot, a site, device role, device role color, device status, and device are required. You may define which values to use by configuring the following values in your `nautobot_config.py` file. If you define a `default_device_role` and `default_device_status` that already exist, the default color value for both of those will be ignored as it will pull that information from Nautobot.

| Configuration Variable | Type | Usage | Default |
| --------------------------------------------------- | ------ | ---------------------------------------------------------- | -------------------- |
| aristacv_from_cloudvision_default_site | string | Default site created when syncing new devices to Nautobot. | cloudvision_imported |
| aristacv_from_cloudvision_default_device_role | string | Default role created when syncing new devices to Nautobot. | network |
| aristacv_from_cloudvision_default_device_role_color | string | Default role color used for default role. | ff0000 |

> When these variables are not defined in the App settings, the integration will use the default values mentioned.
When an Arista device exists in Nautobot but not in CloudVision, this integration can either delete or leave the device in Nautobot. That behavior can be set with the following variable in the `nautobot_config.py` file.

| Configuration Variable | Type | Usage | Default |
| ------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| aristacv_delete_devices_on_sync | boolean | If true, devices in Nautobot with device type manufacturer name set to Arista that do not exist in CloudVision but do exist in Nautobot upon sync will be deleted. | False |

> When this variable is not defined in the App settings, the integration will default to using `False`.
Optionally, an import tag with the name `cloudvision_imported` can be applied to devices that are imported from CloudVision.

| Configuration Variable | Type | Usage | Default |
| ------------------------- | ------- | ------------------------------------------------------ | ------- |
| aristacv_apply_import_tag | boolean | Apply import tag to devices imported from CloudVision. | False |

> If apply_import_tag is set to True, the tag value that is applied to devices is `cloudvision_imported`.
In addition, you can control whether only active devices are imported or whether all devices regardless of status are imported.

| Configuration Variable | Type | Usage | Default |
| ---------------------- | ------- | -------------------------------------------- | ------- |
| aristacv_import_active | boolean | Only import active devices from CloudVision. | False |

There is also the option of having your CloudVision instance created within Nautobot and linked to the Devices managed by the instance. If the `create_controller` setting is `True` then a CloudVision Device will be created and Relationships created to the imported Devices from CVP. The `controller_site` setting allows you to specify the name of the Site you wish the Device to be created in. If this setting is blank a new CloudVision Site will be created and the Device will be placed in it.

| Configuration Variable | Type | Usage | Default |
| -------------------------- | ------- | --------------------------------------------- | ------- |
| aristacv_create_controller | boolean | Create CloudVision Device in Nautobot. | False |
| aristacv_controller_site | string | The Site to associate with CloudVision Device.| "" |

Finally, there is the option to parse device hostname's for codes that indicate the assigned site or device role. This is done through a combination of a few settings. First, the hostname_patterns setting defines a list of regex patterns that define your hostname structure. These patterns must include a named capture group using the `site` and `role` key to identify the portion of the hostname that indicates those pieces of data, ie `(?P<site>\w+)` and `(?P<role>\w+)`. Once those pieces are extracted they are then evaluated against the relevant map, ie the value for the `site` capture group is looked for in the `site_mappings` dictionary expecting the value to be a key with the map value being the name of the Site. If the Site doesn't exist it will be created in Staging status. For the Device Role, it will be created if it doesn't exist in Nautobot. Please note that the hostname is converted to all lowercase when the parsing is performed so the keys are expected to be all lowercase too.

| Configuration Variable | Type | Usage | Default |
| -------------------------- | --------- | ---------------------------------------------------------- | ------- |
| aristacv_hostname_patterns | List[str] | Define the portions of a hostname that indicate site/role. | [] |
| aristacv_site_mappings | dict | Define the site name associated with code in hostname. | {} |
| aristacv_role_mappings | dict | Define the role name associated with code in hostname. | {} |

> As the Device hostname is used as the identifier for Device objects any change in hostname implies a new Device and thus should trigger a deletion and creation of a new Device in Nautobot. For this reason, the hostname parsing feature is not done during updates and only at initial creation of the Device. If you need to correct the Site or Role for a Device after initial creation you will need to manually correct it or delete it and run the import Job again.
Below is an example snippet from `nautobot_config.py` that demonstrates how to enable and configure Arista CloudVision integration:

```python
PLUGINS_CONFIG = {
"nautobot_ssot": {
"enable_aristacv": True,
"aristacv_cvp_token": os.getenv("NAUTOBOT_ARISTACV_TOKEN", ""),
"aristacv_cvp_host": os.getenv("NAUTOBOT_ARISTACV_HOST", ""),
"aristacv_cvp_port": os.getenv("NAUTOBOT_ARISTACV_PORT", 443),
"aristacv_cvp_user": os.getenv("NAUTOBOT_ARISTACV_USERNAME", ""),
"aristacv_cvp_password": os.getenv("NAUTOBOT_ARISTACV_PASSWORD", ""),
"aristacv_verify": is_truthy(os.getenv("NAUTOBOT_ARISTACV_VERIFY", True)),
"aristacv_from_cloudvision_default_site": "",
"aristacv_from_cloudvision_default_device_role": "",
"aristacv_from_cloudvision_default_device_role_color": "",
"aristacv_delete_devices_on_sync": is_truthy(os.getenv("NAUTOBOT_ARISTACV_DELETE_ON_SYNC", False)),
"aristacv_apply_import_tag": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_TAG", False)),
"aristacv_import_active": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_ACTIVE", False)),
"aristacv_create_controller": is_truthy(os.getenv("NAUTOBOT_ARISTACV_CREATE_CONTROLLER", False)),
"aristacv_controller_site": os.getenv("NAUTOBOT_ARISTACV_CONTROLLER_SITE", ""),
"aristacv_hostname_patterns": [""],
"aristacv_site_mappings": {},
"aristacv_role_mappings": {},
}
```

!!! note
All integration settings are defined in the block above as an example. Only some will be needed as described below.

Upon installation, this integration creates the following custom fields in Nautobot:

- `arista_bgp`
- `arista_eos`
- `arista_eostrain`
- `arista_mlag`
- `arista_mpls`
- `arista_pim`
- `arista_pimbidir`
- `arista_sflow`
- `arista_systype`
- `arista_tapagg`
- `arista_terminattr`
- `arista_topology_network_type`
- `arista_topology_type`
- `arista_ztp`

> While these contain the prefix "arista" in the custom field admin portal, when looking at them on a device the prefix is removed.

Other custom fields may need to be created by the user. When a sync is run and a system tag for a device in CloudVision is found without a corresponding custom field, the sync log will display a message. To have that data synced, a custom field must be created in the Admin UI using the given name in the message.

![Custom_Fields_Arista](../../images/aristacv-custom-fields.png)

## Upgrading from `nautobot-plugin-ssot-aristacv` App

!!! warning
When upgrading from `nautobot-plugin-ssot-aristacv` App, it's necessary to [avoid conflicts](../upgrade.md#potential-apps-conflicts).

- Uninstall the old App:
```shell
pip uninstall nautobot-plugin-ssot-aristacv
```
- Upgrade the App with required extras:
```shell
pip install --upgrade nautobot-ssot[aristacv]
```
- Fix `nautobot_config.py` by removing `aristacv` from `PLUGINS` and merging App configuration into `nautobot_ssot`:
```python
PLUGINS = [
"nautobot_ssot",
# "aristacv" # REMOVE THIS LINE
]

PLUGINS_CONFIG = {
# "aristacv": { REMOVE THIS APP CONFIGURATION
# MOVE CONFIGURATION TO `nautobot_ssot` SECTION
# "cvp_token": os.getenv("NAUTOBOT_ARISTACV_TOKEN", ""),
# "cvp_host": os.getenv("NAUTOBOT_ARISTACV_HOST", ""),
# "cvp_port": os.getenv("NAUTOBOT_ARISTACV_PORT", 443),
# "cvp_user": os.getenv("NAUTOBOT_ARISTACV_USERNAME", ""),
# "cvp_password": os.getenv("NAUTOBOT_ARISTACV_PASSWORD", ""),
# "verify": is_truthy(os.getenv("NAUTOBOT_ARISTACV_VERIFY", True)),
# "from_cloudvision_default_site": "",
# "from_cloudvision_default_device_role": "",
# "from_cloudvision_default_device_role_color": "",
# "delete_devices_on_sync": is_truthy(os.getenv("NAUTOBOT_ARISTACV_DELETE_ON_SYNC", False)),
# "apply_import_tag": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_TAG", False)),
# "import_active": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_ACTIVE", False)),
# "create_controller": is_truthy(os.getenv("NAUTOBOT_ARISTACV_CREATE_CONTROLLER", False)),
# "controller_site": os.getenv("NAUTOBOT_ARISTACV_CONTROLLER_SITE", ""),
# "hostname_patterns": [""],
# "site_mappings": {},
# "role_mappings": {},
# }
"nautobot_ssot": {
# Enable Arista CloudVision integration
"enable_aristacv": True,
# Following lines are moved from `aristacv` and prefixed with `aristacv_`
"aristacv_cvp_token": os.getenv("NAUTOBOT_ARISTACV_TOKEN", ""),
"aristacv_cvp_host": os.getenv("NAUTOBOT_ARISTACV_HOST", ""),
"aristacv_cvp_port": os.getenv("NAUTOBOT_ARISTACV_PORT", 443),
"aristacv_cvp_user": os.getenv("NAUTOBOT_ARISTACV_USERNAME", ""),
"aristacv_cvp_password": os.getenv("NAUTOBOT_ARISTACV_PASSWORD", ""),
"aristacv_verify": is_truthy(os.getenv("NAUTOBOT_ARISTACV_VERIFY", True)),
"aristacv_from_cloudvision_default_site": "",
"aristacv_from_cloudvision_default_device_role": "",
"aristacv_from_cloudvision_default_device_role_color": "",
"aristacv_delete_devices_on_sync": is_truthy(os.getenv("NAUTOBOT_ARISTACV_DELETE_ON_SYNC", False)),
"aristacv_apply_import_tag": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_TAG", False)),
"aristacv_import_active": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_ACTIVE", False)),
"aristacv_create_controller": is_truthy(os.getenv("NAUTOBOT_ARISTACV_CREATE_CONTROLLER", False)),
"aristacv_controller_site": os.getenv("NAUTOBOT_ARISTACV_CONTROLLER_SITE", ""),
"aristacv_hostname_patterns": [""],
"aristacv_site_mappings": {},
"aristacv_role_mappings": {},
}
}
```

!!! note
Configuration keys are prefixed with `aristacv_`.
Binary file added docs/images/aristacv-custom-fields.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/aristacv-cv-to-naut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/aristacv-fromcv-sync.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/aristacv-integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/aristacv-naut-to-cv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/aristacv-tocv-sync.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions docs/user/integrations/aristacv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Arista CloudVision SSoT Integration

The Arista CloudVision SSoT integration is built as part of the [Nautobot Single Source of Truth (SSoT)](../..tps://github.com/nautobot/nautobot-plugin-ssot) App. The SSoT App enables Nautobot to be the aggregation point for data coming from multiple systems of record (SoR).

From Nautobot into CloudVision, it synchronizes user device tags. From CloudVision into Nautobot, it synchronizes devices, their interfaces, associated IP addresses, and their system tags. Here is a table showing the data mappings when syncing from CloudVision.

| CloudVision System Tags | Nautobot Device Custom Field |
| ----------------------- | ---------------------------- |
| topology_network_type | Topology Network Type |
| mlag | mlag |
| mpls | mpls |
| model | Device Type `*` |
| systype | systype |
| serialnumber | Device Serial Number |
| pimbidir | pimbidir |
| sflow | sFlow |
| eostrain | EOS Train |
| tapagg | TAP Aggregation |
| pim | pim |
| bgp | bgp |
| terminattr | TerminAttr Version |
| ztp | ztp |
| eos | EOS Version `**` |
| topology_type | Topology Type |

`*` The model system tag is mapped to the device type model in Nautobot.

`**` If the [Device Lifecycle plug-in](https://github.com/nautobot/nautobot-plugin-device-lifecycle-mgmt) is found to be installed, a matching Version will be created with a RelationshipAssociation connecting the device and that Version.

When syncing User tags from Nautobot to CloudVision the data mappings are as follows:

| Nautobot | CloudVision |
| ---------- | ------------- |
| Interface | Interface |
| ---------- | ------------- |
| Tags | Device Tags |

## Usage

This integration can sync data both `to` and `from` Nautobot. Once the integration has been installed successfully two new options are available under the [Nautobot Single Source of Truth (SSoT)](https://github.com/nautobot/nautobot-plugin-ssot) App.

![Arista Integration](../../images/aristacv-integration.png)

Please be aware that interfaces that are part of a breakout bundle, ie a 40G port broken out into 4x10G ports, will show the base interface SFP transceiver as the interface type. This is due to the way interfaces and transceivers are returned from CloudVision.

### Syncing From CloudVision

> When loading Nautobot data, this tool only loads devices with a device type that has a manufacturer of "Arista"
When syncing data from CloudVision to Nautobot, devices along with their interfaces and tags are synchronized. When a device exists in CloudVision that doesn't exist in Nautobot, this tool creates the device in Nautobot with the default values specified in the configuration file. When a device exists in Nautobot that does not exist in CloudVision, this tool can be configured to either delete or skip that device.
You can watch the below video for an example.

![fromcv_sync](../../images/aristacv-fromcv-sync.gif)

When syncing data from Nautobot to CloudVision, the tag data in Nautobot is copied into User Tags in CloudVision. You can watch the video below for an example.

![tocv_sync](../../images/aristacv-tocv-sync.gif)

## Screenshots

This screenshot shows the CloudVision to Nautobot home page. This contains a list of all the system tags from CloudVision and how they map to custom fields in Nautobot. This also displays your integration configuration and the sync history.

![cv_to_naut](../../images/aristacv-cv-to-naut.png)

This screenshot shows the Nautobot to CloudVision home page. It also contains data mappings, integration configuration and sync history.

![naut_to_cv](../../images/aristacv-naut-to-cv.png)
6 changes: 4 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ nav:
- Integrations:
- "user/integrations/index.md"
- Cisco ACI: "user/integrations/aci.md"
- Arista CloudVision: "user/integrations/aristacv.md"
- Developing Jobs: "user/developing_jobs.md"
- Frequently Asked Questions: "user/faq.md"
- External Interactions: "user/external_interactions.md"
- Administrator Guide:
- Install and Configure: "admin/install.md"
- Integrations Installation:
- "user/integrations/index.md"
- Cisco ACI: "user/integrations/aci.md"
- "admin/integrations/index.md"
- Cisco ACI: "admin/integrations/aci_setup.md"
- Arista CloudVision: "admin/integrations/aristacv_setup.md"
- Upgrade: "admin/upgrade.md"
- Uninstall: "admin/uninstall.md"
- Compatibility Matrix: "admin/compatibility_matrix.md"
Expand Down

0 comments on commit 9232676

Please sign in to comment.