-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e556df2
Showing
29 changed files
with
3,114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ntc_netbox_plugin_onboarding.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
language: python | ||
|
||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
|
||
env: | ||
- NETBOX_VER=v2.8.1 | ||
# - NETBOX_VER=latest | ||
|
||
services: | ||
- docker | ||
|
||
before_script: | ||
- pip install invoke docker-compose poetry | ||
|
||
script: | ||
- invoke build --python-ver $TRAVIS_PYTHON_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
truthy: disable | ||
brackets: { min-spaces-inside: 0, max-spaces-inside: 1 } | ||
braces: { min-spaces-inside: 0, max-spaces-inside: 1 } | ||
line-length: { allow-non-breakable-inline-mappings: true, allow-non-breakable-words: true, max: 180 } | ||
comments-indentation: disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
ARG python_ver=3.7 | ||
FROM python:${python_ver} | ||
|
||
ARG netbox_ver=master | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN mkdir -p /opt | ||
|
||
RUN pip install --upgrade pip\ | ||
&& pip install poetry | ||
|
||
# ------------------------------------------------------------------------------------- | ||
# Install NetBox | ||
# ------------------------------------------------------------------------------------- | ||
RUN git clone --single-branch --branch ${netbox_ver} https://github.com/netbox-community/netbox.git /opt/netbox/ && \ | ||
cd /opt/netbox/ && \ | ||
pip install -r /opt/netbox/requirements.txt | ||
|
||
# ------------------------------------------------------------------------------------- | ||
# Install Netbox Plugin | ||
# ------------------------------------------------------------------------------------- | ||
RUN mkdir -p /source | ||
WORKDIR /source | ||
COPY . /source | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-ansi | ||
|
||
WORKDIR /opt/netbox/netbox/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ALLOWED_HOSTS=* | ||
DB_NAME=netbox | ||
DB_USER=netbox | ||
DB_PASSWORD=decinablesprewad | ||
PGPASSWORD=decinablesprewad | ||
DB_HOST=postgres | ||
NAPALM_TIMEOUT=5 | ||
MAX_PAGE_SIZE=0 | ||
SECRET_KEY=bqn8nn4qmjvx4hv2u5qr4pp46s3w9skbb63y | ||
POSTGRES_USER=netbox | ||
POSTGRES_PASSWORD=decinablesprewad | ||
POSTGRES_DB=netbox | ||
CHANGELOG_RETENTION=0 | ||
REDIS_HOST=redis | ||
REDIS_PORT=6379 | ||
# Uncomment REDIS_SSL if using SSL | ||
# REDIS_SSL=True | ||
REDIS_PASSWORD=decinablesprewad | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
version: '3' | ||
services: | ||
netbox: | ||
build: | ||
context: ../ | ||
dockerfile: development/Dockerfile | ||
command: > | ||
sh -c "python manage.py migrate && | ||
python manage.py runserver 0.0.0.0:8000" | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- postgres | ||
- redis | ||
env_file: | ||
- ./dev.env | ||
volumes: | ||
- ./netbox_master/configuration.py:/opt/netbox/netbox/netbox/configuration.py | ||
- ../netbox_onboarding:/source/netbox_onboarding | ||
tty: true | ||
worker: | ||
build: | ||
context: ../ | ||
dockerfile: development/Dockerfile | ||
command: sh -c "python manage.py rqworker" | ||
depends_on: | ||
- netbox | ||
env_file: | ||
- ./dev.env | ||
volumes: | ||
- ./netbox_master/configuration.py:/opt/netbox/netbox/netbox/configuration.py | ||
- ../netbox_onboarding:/source/netbox_onboarding | ||
tty: true | ||
postgres: | ||
image: postgres:10 | ||
env_file: dev.env | ||
volumes: | ||
- pgdata_netbox_onboarding:/var/lib/postgresql/data | ||
redis: | ||
image: redis:5-alpine | ||
command: | ||
- sh | ||
- -c # this is to evaluate the $REDIS_PASSWORD from the env | ||
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose | ||
env_file: ./dev.env | ||
volumes: | ||
pgdata_netbox_onboarding: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
import os | ||
|
||
# For reference see http://netbox.readthedocs.io/en/latest/configuration/mandatory-settings/ | ||
# Based on https://github.com/digitalocean/netbox/blob/develop/netbox/netbox/configuration.example.py | ||
|
||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
######################### | ||
# # | ||
# Required settings # | ||
# # | ||
######################### | ||
|
||
# This is a list of valid fully-qualified domain names (FQDNs) for the NetBox server. NetBox will not permit write | ||
# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name. | ||
# | ||
# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local'] | ||
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "").split(" ") | ||
|
||
# PostgreSQL database configuration. | ||
DATABASE = { | ||
"NAME": os.environ.get("DB_NAME", "netbox"), # Database name | ||
"USER": os.environ.get("DB_USER", ""), # PostgreSQL username | ||
"PASSWORD": os.environ.get("DB_PASSWORD", ""), | ||
# PostgreSQL password | ||
"HOST": os.environ.get("DB_HOST", "localhost"), # Database server | ||
"PORT": os.environ.get("DB_PORT", ""), # Database port (leave blank for default) | ||
} | ||
|
||
# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file. | ||
# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and | ||
# symbols. NetBox will not run without this defined. For more information, see | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SECRET_KEY | ||
SECRET_KEY = os.environ.get("SECRET_KEY", "") | ||
|
||
# Redis database settings. The Redis database is used for caching and background processing such as webhooks | ||
# Seperate sections for webhooks and caching allow for connecting to seperate Redis instances/datbases if desired. | ||
# Full connection details are required in both sections, even if they are the same. | ||
REDIS = { | ||
"caching": { | ||
"HOST": os.environ.get("REDIS_HOST", "redis"), | ||
"PORT": int(os.environ.get("REDIS_PORT", 6379)), | ||
"PASSWORD": os.environ.get("REDIS_PASSWORD", ""), | ||
"DATABASE": 1, | ||
"DEFAULT_TIMEOUT": 300, | ||
"SSL": bool(os.environ.get("REDIS_SSL", False)), | ||
}, | ||
"tasks": { | ||
"HOST": os.environ.get("REDIS_HOST", "redis"), | ||
"PORT": int(os.environ.get("REDIS_PORT", 6379)), | ||
"PASSWORD": os.environ.get("REDIS_PASSWORD", ""), | ||
"DATABASE": 0, | ||
"DEFAULT_TIMEOUT": 300, | ||
"SSL": bool(os.environ.get("REDIS_SSL", False)), | ||
}, | ||
} | ||
|
||
|
||
######################### | ||
# # | ||
# Optional settings # | ||
# # | ||
######################### | ||
|
||
# Specify one or more name and email address tuples representing NetBox administrators. These people will be notified of | ||
# application errors (assuming correct email settings are provided). | ||
ADMINS = [ | ||
# ['John Doe', '[email protected]'], | ||
] | ||
|
||
# Optionally display a persistent banner at the top and/or bottom of every page. HTML is allowed. To display the same | ||
# content in both banners, define BANNER_TOP and set BANNER_BOTTOM = BANNER_TOP. | ||
BANNER_TOP = os.environ.get("BANNER_TOP", None) | ||
BANNER_BOTTOM = os.environ.get("BANNER_BOTTOM", None) | ||
|
||
# Text to include on the login page above the login form. HTML is allowed. | ||
BANNER_LOGIN = os.environ.get("BANNER_LOGIN", "") | ||
|
||
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set: | ||
# BASE_PATH = 'netbox/' | ||
BASE_PATH = os.environ.get("BASE_PATH", "") | ||
|
||
# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90) | ||
CHANGELOG_RETENTION = int(os.environ.get("CHANGELOG_RETENTION", 0)) | ||
|
||
# API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be | ||
# allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or | ||
# CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers | ||
CORS_ORIGIN_ALLOW_ALL = True | ||
CORS_ORIGIN_WHITELIST = [] | ||
CORS_ORIGIN_REGEX_WHITELIST = [] | ||
|
||
# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal | ||
# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging | ||
# on a production system. | ||
DEBUG = True | ||
DEVELOPER = True | ||
|
||
# Email settings | ||
EMAIL = { | ||
"SERVER": "localhost", | ||
"PORT": 25, | ||
"USERNAME": "", | ||
"PASSWORD": "", | ||
"TIMEOUT": 10, | ||
"FROM_EMAIL": "", | ||
} | ||
|
||
# Enforcement of unique IP space can be toggled on a per-VRF basis. | ||
# To enforce unique IP space within the global table (all prefixes and IP addresses not assigned to a VRF), | ||
# set ENFORCE_GLOBAL_UNIQUE to True. | ||
ENFORCE_GLOBAL_UNIQUE = False | ||
|
||
# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs: | ||
# https://docs.djangoproject.com/en/1.11/topics/logging/ | ||
LOGGING = {} | ||
|
||
# Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users | ||
# are permitted to access most data in NetBox (excluding secrets) but not make any changes. | ||
LOGIN_REQUIRED = False | ||
|
||
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set: | ||
# BASE_PATH = 'netbox/' | ||
BASE_PATH = os.environ.get("BASE_PATH", "") | ||
|
||
# Setting this to True will display a "maintenance mode" banner at the top of every page. | ||
MAINTENANCE_MODE = os.environ.get("MAINTENANCE_MODE", False) | ||
|
||
# An API consumer can request an arbitrary number of objects =by appending the "limit" parameter to the URL (e.g. | ||
# "?limit=1000"). This setting defines the maximum limit. Setting it to 0 or None will allow an API consumer to request | ||
# all objects by specifying "?limit=0". | ||
MAX_PAGE_SIZE = int(os.environ.get("MAX_PAGE_SIZE", 1000)) | ||
|
||
# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that | ||
# the default value of this setting is derived from the installed location. | ||
MEDIA_ROOT = os.environ.get("MEDIA_ROOT", os.path.join(BASE_DIR, "media")) | ||
|
||
NAPALM_USERNAME = os.environ.get("NAPALM_USERNAME", "") | ||
NAPALM_PASSWORD = os.environ.get("NAPALM_PASSWORD", "") | ||
|
||
# NAPALM timeout (in seconds). (Default: 30) | ||
NAPALM_TIMEOUT = os.environ.get("NAPALM_TIMEOUT", 30) | ||
|
||
# NAPALM optional arguments (see http://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must | ||
# be provided as a dictionary. | ||
NAPALM_ARGS = { | ||
"secret": NAPALM_PASSWORD, | ||
# Include any additional args here | ||
} | ||
|
||
# Determine how many objects to display per page within a list. (Default: 50) | ||
PAGINATE_COUNT = os.environ.get("PAGINATE_COUNT", 50) | ||
|
||
# Enable installed plugins. Add the name of each plugin to the list. | ||
PLUGINS = ["netbox_onboarding"] | ||
|
||
# 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. | ||
PLUGINS_CONFIG = {"netbox_sotagg": {"github_repo": "networktocode-llc/gizmo-sot"}} | ||
|
||
# When determining the primary IP address for a device, IPv6 is preferred over IPv4 by default. Set this to True to | ||
# prefer IPv4 instead. | ||
PREFER_IPV4 = os.environ.get("PREFER_IPV4", False) | ||
|
||
# Remote authentication support | ||
REMOTE_AUTH_ENABLED = False | ||
REMOTE_AUTH_BACKEND = "utilities.auth_backends.RemoteUserBackend" | ||
REMOTE_AUTH_HEADER = "HTTP_REMOTE_USER" | ||
REMOTE_AUTH_AUTO_CREATE_USER = True | ||
REMOTE_AUTH_DEFAULT_GROUPS = [] | ||
REMOTE_AUTH_DEFAULT_PERMISSIONS = [] | ||
|
||
# This determines how often the GitHub API is called to check the latest release of NetBox. Must be at least 1 hour. | ||
RELEASE_CHECK_TIMEOUT = 24 * 3600 | ||
|
||
# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the | ||
# version check or use the URL below to check for release in the official NetBox repository. | ||
RELEASE_CHECK_URL = None | ||
# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases' | ||
|
||
SESSION_FILE_PATH = None | ||
|
||
# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of | ||
# this setting is derived from the installed location. | ||
REPORTS_ROOT = os.environ.get("REPORTS_ROOT", os.path.join(BASE_DIR, "reports")) | ||
|
||
# Time zone (default: UTC) | ||
TIME_ZONE = os.environ.get("TIME_ZONE", "UTC") | ||
|
||
# Date/time formatting. See the following link for supported formats: | ||
# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date | ||
DATE_FORMAT = os.environ.get("DATE_FORMAT", "N j, Y") | ||
SHORT_DATE_FORMAT = os.environ.get("SHORT_DATE_FORMAT", "Y-m-d") | ||
TIME_FORMAT = os.environ.get("TIME_FORMAT", "g:i a") | ||
SHORT_TIME_FORMAT = os.environ.get("SHORT_TIME_FORMAT", "H:i:s") | ||
DATETIME_FORMAT = os.environ.get("DATETIME_FORMAT", "N j, Y g:i a") | ||
SHORT_DATETIME_FORMAT = os.environ.get("SHORT_DATETIME_FORMAT", "Y-m-d H:i") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
(c) 2020 Network To Code | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
__version__ = "1.0.0" | ||
|
||
from extras.plugins import PluginConfig | ||
|
||
|
||
class OnboardingConfig(PluginConfig): | ||
name = "netbox_onboarding" | ||
verbose_name = "Plugin for Easy Device Onboarding" | ||
version = "1.0.0" | ||
author = "Network to Code" | ||
description = "" | ||
base_url = "onboarding" | ||
required_settings = [] | ||
default_settings = {} | ||
caching_config = {} | ||
|
||
config = OnboardingConfig |
Empty file.
Oops, something went wrong.