Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from nautobot/develop
Browse files Browse the repository at this point in the history
v1.0.2
  • Loading branch information
qduk authored Oct 1, 2021
2 parents d1fce62 + d1c0249 commit b2b700c
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 113 deletions.
179 changes: 179 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
name: "CI"
on:
- "push"
- "pull_request"

jobs:
black:
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Linting: black"
run: "poetry run invoke black"
bandit:
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
needs:
- "black"
pydocstyle:
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Linting: pydocstyle"
run: "poetry run invoke pydocstyle"
needs:
- "black"
flake8:
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Linting: flake8"
run: "poetry run invoke flake8"
needs:
- "black"
yamllint:
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_LOCAL: "True"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
needs:
- "black"
build:
runs-on: "ubuntu-20.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Build Container"
run: "poetry run invoke build"
needs:
- "bandit"
- "pydocstyle"
- "flake8"
- "yamllint"
pylint:
runs-on: "ubuntu-20.04"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Build Container"
run: "poetry run invoke build"
- name: "Linting: Pylint"
run: "poetry run invoke pylint"
needs:
- "build"
unittest:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
nautobot-version: ["1.0.1"]
runs-on: "ubuntu-20.04"
env:
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_NAUTOBOT_CHATOPS_ARISTA_CLOUDVISION_NAUTOBOT_VER: "${{ matrix.nautobot-version }}"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v1"
- name: "Copy credentials"
run: "cp development/creds.example.env development/creds.env"
- name: "Build Container"
run: "poetry run invoke build"
- name: "Run Tests"
run: "poetry run invoke unittest"
needs:
- "pylint"
publish_gh:
name: "Publish to GitHub"
runs-on: "ubuntu-20.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
- name: "Run Poetry Version"
run: "poetry version $RELEASE_VERSION"
- name: "Run Poetry Build"
run: "poetry build"
- name: "Upload binaries to release"
uses: "svenstaro/upload-release-action@v2"
with:
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}"
file: "dist/*"
tag: "${{ github.ref }}"
overwrite: true
file_glob: true
needs:
- "unittest"
publish_pypi:
name: "Push Package to PyPI"
runs-on: "ubuntu-20.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.9"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
- name: "Run Poetry Version"
run: "poetry version $RELEASE_VERSION"
- name: "Run Poetry Build"
run: "poetry build"
- name: "Push to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"
with:
user: "__token__"
password: "${{ secrets.PYPI_API_TOKEN }}"
needs:
- "unittest"
77 changes: 0 additions & 77 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

## v1.0.2 - 2021-09-30

### Added

- #15 Customization of CVaaS URL
- #15 Changed Arista Logo

### Changed

- #15 Changed Arista Logo

### Fixed

- Error when ON_PREM is not set
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ After that, you must update environment variables depending on if you are using
For CVAAS the following environment variables must be set.

- `CVAAS_TOKEN`: Token generated from CVAAS service account. Documentation for that process can be found [here](https://www.arista.com/assets/data/pdf/qsg/qsg-books/QS_CloudVision_as_a_Service.pdf) in section 1.7
- `CVAAS_URL`: This is the url of your CloudVision-as-a-Service. When setting this make sure to include `www`. When not set, this defaults to `www.arista.io`

For on premise instance of CloudVision, these environment variables must be set.

Expand Down
3 changes: 2 additions & 1 deletion development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,12 @@ def is_truthy(arg):
},
"nautobot_chatops_arista_cloudvision": {
"cvaas_token": os.environ.get("CVAAS_TOKEN"),
"cvaas_url": os.environ.get("CVAAS_URL"),
"cvp_username": os.environ.get("CVP_USERNAME"),
"cvp_password": os.environ.get("CVP_PASSWORD"),
"cvp_host": os.environ.get("CVP_HOST"),
"cvp_insecure": os.environ.get("CVP_INSECURE"),
"on_prem": os.environ.get("ON_PREM", False),
"on_prem": os.environ.get("ON_PREM"),
},
}

Expand Down
2 changes: 1 addition & 1 deletion nautobot_chatops_arista_cloudvision/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Plugin declaration for nautobot_chatops_arista_cloudvision."""

__version__ = "0.1.0"
__version__ = "1.0.2"

from nautobot.extras.plugins import PluginConfig

Expand Down
6 changes: 5 additions & 1 deletion nautobot_chatops_arista_cloudvision/cvpgrpcutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import grpc
import arista.tag.v1 as tag
from google.protobuf import wrappers_pb2 as wrappers
from .utils import CVAAS_ADDR


def connect_cv(settings):
Expand Down Expand Up @@ -32,7 +33,10 @@ def connect_cv(settings):
call_creds = grpc.access_token_call_credentials(response.json()["sessionId"])
# Set up credentials for CVaaS using supplied token.
else:
cvp_url = "www.arista.io:443"
if CVAAS_ADDR is None:
cvp_url = "www.arista.io:443"
else:
cvp_url = CVAAS_ADDR
call_creds = grpc.access_token_call_credentials(settings.get("cvaas_token"))
channel_creds = grpc.ssl_channel_credentials()
conn_creds = grpc.composite_channel_credentials(channel_creds, call_creds)
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b2b700c

Please sign in to comment.