Skip to content

Commit

Permalink
Merge pull request #138 from nautobot/u/snaselj-132-aristacv
Browse files Browse the repository at this point in the history
Add Arista CloudVision integration
  • Loading branch information
jdrew82 authored Jul 10, 2023
2 parents dc803d2 + 34daec5 commit 9d4b1b0
Show file tree
Hide file tree
Showing 42 changed files with 14,035 additions and 6 deletions.
4 changes: 2 additions & 2 deletions development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ RUN pip show nautobot | grep "^Version: " | sed -e 's/Version: /nautobot==/' > c
#
# We can't use the entire freeze as it takes forever to resolve with rigidly fixed non-direct dependencies,
# especially those that are only direct to Nautobot but the container included versions slightly mismatch
RUN poetry export -f requirements.txt --without-hashes --output poetry_freeze_base.txt
RUN poetry export -f requirements.txt --with dev --without-hashes --output poetry_freeze_all.txt
RUN poetry export -f requirements.txt --without-hashes --extras all --output poetry_freeze_base.txt
RUN poetry export -f requirements.txt --without-hashes --extras all --with dev --output poetry_freeze_all.txt
RUN sort poetry_freeze_base.txt poetry_freeze_all.txt | uniq -u > poetry_freeze_dev.txt

# Install all local project as editable, constrained on Nautobot version, to get any additional
Expand Down
3 changes: 3 additions & 0 deletions development/creds.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ MYSQL_PASSWORD=${NAUTOBOT_DB_PASSWORD}
# NAUTOBOT_REDIS_HOST=localhost
# NAUTOBOT_CONFIG=development/nautobot_config.py

NAUTOBOT_ARISTACV_CVP_PASSWORD="changeme"
NAUTOBOT_ARISTACV_CVP_TOKEN="changeme"

NAUTOBOT_SSOT_INFOBLOX_PASSWORD="changeme"

# ACI Credentials. Append friendly name to the end to identify each APIC.
Expand Down
12 changes: 12 additions & 0 deletions development/development.env
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ NAUTOBOT_SSOT_ACI_IGNORE_TENANTS="[mgmt,infra]"
NAUTOBOT_SSOT_ACI_COMMENTS="Created by ACI SSoT Integration"
NAUTOBOT_SSOT_ACI_SITE="Data Center"

NAUTOBOT_SSOT_ENABLE_ARISTACV="True"
NAUTOBOT_ARISTACV_CONTROLLER_SITE=""
NAUTOBOT_ARISTACV_CREATE_CONTROLLER="True"
NAUTOBOT_ARISTACV_CVAAS_URL="www.arista.io:443"
NAUTOBOT_ARISTACV_CVP_HOST=""
NAUTOBOT_ARISTACV_CVP_PORT="443"
NAUTOBOT_ARISTACV_CVP_USERNAME="changeme"
NAUTOBOT_ARISTACV_DELETE_ON_SYNC="False"
NAUTOBOT_ARISTACV_IMPORT_ACTIVE="False"
NAUTOBOT_ARISTACV_IMPORT_TAG="False"
NAUTOBOT_ARISTACV_VERIFY=True

NAUTOBOT_SSOT_ENABLE_INFOBLOX="True"
NAUTOBOT_SSOT_INFOBLOX_DEFAULT_STATUS="active"
NAUTOBOT_SSOT_INFOBLOX_ENABLE_RFC1918_NETWORK_CONTAINERS="True"
Expand Down
34 changes: 33 additions & 1 deletion development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@
#

# Enable installed plugins. Add the name of each plugin to the list.
PLUGINS = ["nautobot_ssot"]
PLUGINS = [
"nautobot_ssot",
"nautobot_device_lifecycle_mgmt",
]

# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
Expand All @@ -156,7 +159,36 @@
"aci_comments": os.getenv("NAUTOBOT_SSOT_ACI_COMMENTS"),
# Site to associate objects. Specify existing, or a new site with this name will be created.
"aci_site": os.getenv("NAUTOBOT_SSOT_ACI_SITE"),
"aristacv_apply_import_tag": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_TAG", False)),
"aristacv_controller_site": os.getenv("NAUTOBOT_ARISTACV_CONTROLLER_SITE", ""),
"aristacv_create_controller": is_truthy(os.getenv("NAUTOBOT_ARISTACV_CREATE_CONTROLLER", False)),
"aristacv_cvaas_url": os.getenv("NAUTOBOT_ARISTACV_CVAAS_URL", "www.arista.io:443"),
"aristacv_cvp_host": os.getenv("NAUTOBOT_ARISTACV_CVP_HOST", ""),
"aristacv_cvp_password": os.getenv("NAUTOBOT_ARISTACV_CVP_PASSWORD", ""),
"aristacv_cvp_port": os.getenv("NAUTOBOT_ARISTACV_CVP_PORT", "443"),
"aristacv_cvp_token": os.getenv("NAUTOBOT_ARISTACV_CVP_TOKEN", ""),
"aristacv_cvp_user": os.getenv("NAUTOBOT_ARISTACV_CVP_USERNAME", ""),
"aristacv_delete_devices_on_sync": is_truthy(os.getenv("NAUTOBOT_ARISTACV_DELETE_ON_SYNC", False)),
"aristacv_from_cloudvision_default_device_role": "network",
"aristacv_from_cloudvision_default_device_role_color": "ff0000",
"aristacv_from_cloudvision_default_site": "cloudvision_imported",
"aristacv_hostname_patterns": [[r"(?P<site>\w{2,3}\d+)-(?P<role>\w+)-\d+"]],
"aristacv_import_active": is_truthy(os.getenv("NAUTOBOT_ARISTACV_IMPORT_ACTIVE", False)),
"aristacv_role_mappings": {
"bb": "backbone",
"edge": "edge",
"dist": "distribution",
"leaf": "leaf",
"rtr": "router",
"spine": "spine",
},
"aristacv_site_mappings": {
"ams01": "Amsterdam",
"atl01": "Atlanta",
},
"aristacv_verify": is_truthy(os.getenv("NAUTOBOT_ARISTACV_VERIFY", True)),
"enable_aci": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_ACI")),
"enable_aristacv": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_ARISTACV")),
"enable_infoblox": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_INFOBLOX")),
"hide_example_jobs": is_truthy(os.getenv("NAUTOBOT_SSOT_HIDE_EXAMPLE_JOBS")),
"infoblox_default_status": os.getenv("NAUTOBOT_SSOT_INFOBLOX_DEFAULT_STATUS", "active"),
Expand Down
21 changes: 20 additions & 1 deletion nautobot_ssot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,27 @@ class NautobotSSOTPluginConfig(PluginConfig):
"aci_ignore_tenants": [],
"aci_comments": "",
"aci_site": "",
"enable_infoblox": False,
"aristacv_apply_import_tag": False,
"aristacv_controller_site": "",
"aristacv_create_controller": False,
"aristacv_cvaas_url": "www.arista.io:443",
"aristacv_cvp_host": "",
"aristacv_cvp_password": "",
"aristacv_cvp_port": "443",
"aristacv_cvp_token": "",
"aristacv_cvp_user": "",
"aristacv_delete_devices_on_sync": False,
"aristacv_from_cloudvision_default_device_role": "",
"aristacv_from_cloudvision_default_device_role_color": "",
"aristacv_from_cloudvision_default_site": "",
"aristacv_hostname_patterns": [],
"aristacv_import_active": False,
"aristacv_role_mappings": {},
"aristacv_site_mappings": {},
"aristacv_verify": True,
"enable_aci": False,
"enable_aristacv": False,
"enable_infoblox": False,
"hide_example_jobs": True,
"infoblox_default_status": "",
"infoblox_enable_rfc1918_network_containers": False,
Expand Down
1 change: 1 addition & 0 deletions nautobot_ssot/integrations/aristacv/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Base module for Arista CloudVision integration."""
88 changes: 88 additions & 0 deletions nautobot_ssot/integrations/aristacv/constant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""Storage of data that will not change throughout the life cycle of the application."""

from django.conf import settings


def _read_settings() -> dict:
config = settings.PLUGINS_CONFIG["nautobot_ssot"]
return {key[9:]: value for key, value in config.items() if key.startswith("aristacv_")}


APP_SETTINGS = _read_settings()

PORT_TYPE_MAP = {
"xcvr1000BaseT": "1000base-t",
"xcvr10GBaseSr": "10gbase-x-xfp",
"xcvr10GBaseLr": "10gbase-x-xfp",
"1000BASE-SX": "1000base-x-gbic",
"1000BASE-LX": "1000base-x-gbic",
"1000BASE-T": "1000base-t",
"10GBASE-T": "10gbase-t",
"10GBASE-MRA-T": "10gbase-t",
"10GBASE-CR": "10gbase-cx4",
"10GBASE-CR (QSFP+)": "10gbase-cx4",
"10GBASE-AOC": "10gbase-x-xfp",
"10GBASE-SR": "10gbase-x-xfp",
"10GBASE-SRL": "10gbase-x-xfp",
"10GBASE-LR": "10gbase-x-xfp",
"10GBASE-LRL": "10gbase-x-xfp",
"10GBASE-ER": "10gbase-x-sfpp",
"10GBASE-ERLBD": "10gbase-x-sfpp",
"10GBASE-ERBD": "10gbase-x-sfpp",
"10GBASE-ZR": "10gbase-x-sfpp",
"10GBASE-DWDM": "10gbase-x-x2",
"25GBASE-CR": "25gbase-x-sfp28",
"25GBASE-CR (QSFP)": "25gbase-x-sfp28",
"25GBASE-AOC": "25gbase-x-sfp28",
"25GBASE-SR": "25gbase-x-sfp28",
"25GBASE-MR-SR": "25gbase-x-sfp28",
"25GBASE-MR-XSR": "25gbase-x-sfp28",
"25GBASE-LR": "25gbase-x-sfp28",
"25GBASE-MR-LR": "25gbase-x-sfp28",
"40GBASE-CR4": "40gbase-x-qsfpp",
"40GBASE-AOC": "40gbase-x-qsfpp",
"40GBASE-SR4": "40gbase-x-qsfpp",
"40GBASE-XSR4": "40gbase-x-qsfpp",
"40GBASE-BIDI": "40gbase-x-qsfpp",
"40GBASE-LR4": "40gbase-x-qsfpp",
"40GBASE-LRL4": "40gbase-x-qsfpp",
"40GBASE-PLRL4": "40gbase-x-qsfpp",
"40GBASE-PLR4": "40gbase-x-qsfpp",
"40GBASE-ER4": "40gbase-x-qsfpp",
"100GBASE-CR4": "100gbase-x-cfp4",
"100GBASE-AOC": "100gbase-x-qsfp28",
"100GBASE-SR4": "100gbase-x-qsfp28",
"100GBASE-XSR4": "100gbase-x-qsfp28",
"100GBASE-SWDM4": "100gbase-x-qsfp28",
"100GBASE-BIDI": "100gbase-x-qsfp28",
"100GBASE-PSM4": "100gbase-x-qsfp28",
"100GBASE-PLRL4": "100gbase-x-qsfp28",
"100GBASE-LR4": "100gbase-x-qsfp28",
"100GBASE-LRL4": "100gbase-x-qsfp28",
"100GBASE-CWDM4": "100gbase-x-qsfp28",
"100GBASE-XCWDM4": "100gbase-x-qsfp28",
"100GBASE-ERL4": "100gbase-x-qsfp28",
"100GBASE-ZR4": "100gbase-x-qsfp28",
"100GBASE-DR": "100gbase-x-qsfp28",
"100GBASE-FR": "100gbase-x-qsfp28",
"100GBASE-LR": "100gbase-x-qsfp28",
"200GBASE-CR4": "200gbase-x-cfp2",
"200GBASE-AOC": "200gbase-x-qsfp56",
"200GBASE-SR4": "200gbase-x-qsfp56",
"200GBASE-FR4": "200gbase-x-qsfp56",
"400GBASE-CR8": "400gbase-x-qsfpdd",
"400GBASE-AOC": "400gbase-x-qsfpdd",
"400GBASE-SR8": "400gbase-x-qsfpdd",
"400GBASE-SR8-C": "400gbase-x-qsfpdd",
"400GBASE-DR4": "400gbase-x-qsfpdd",
"400GBASE-XDR4": "400gbase-x-qsfpdd",
"400GBASE-PLR4": "400gbase-x-qsfpdd",
"400GBASE-FR4": "400gbase-x-qsfpdd",
"400GBASE-LR4": "400gbase-x-qsfpdd",
"400GBASE-2FR4": "400gbase-x-osfp",
"400GBASE-ZR": "400gbase-x-qsfpdd",
}

CLOUDVISION_PLATFORM = "arista_eos_cloudvision"

ARISTA_PLATFORM = "arista_eos"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Adapter classes for loading DiffSyncModels with data from AristaCV or Nautobot."""
Loading

0 comments on commit 9d4b1b0

Please sign in to comment.