Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added min max rules model, api, and tests #2

Merged
merged 2 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ python:
- 3.6
- 3.7
- 3.8
- 3.9

env:
matrix:
- "NAUTOBOT_VER=1.0.0"
- "NAUTOBOT_VER=1.0.1"

services:
- "docker"
Expand All @@ -37,7 +38,7 @@ jobs:
script:
- "invoke black"
- "invoke bandit"
- "invoke pydocstyle"
# - "invoke pydocstyle"
- "invoke flake8"
- "invoke yamllint"
# - "invoke pylint"
Expand Down
38 changes: 12 additions & 26 deletions development/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@

ARG python_ver=3.7
FROM python:${python_ver}
ARG PYTHON_VER
ARG NAUTOBOT_VER
FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER}

ARG nautobot_ver=v1.0.0b1
ENV PYTHONUNBUFFERED 1

RUN mkdir /prom_cache
ENV prometheus_multiproc_dir /prom_cache

RUN mkdir -p /opt/nautobot

RUN pip install --upgrade pip\
&& pip install poetry
WORKDIR /source

# -------------------------------------------------------------------------------------
# Install Nautobot
# -------------------------------------------------------------------------------------
COPY packages/nautobot-1.0.0b1-py3-none-any.whl /tmp
RUN pip install /tmp/nautobot-1.0.0b1-py3-none-any.whl
# Copy in only pyproject.toml/poetry.lock to help with caching this layer if no updates to dependencies
COPY poetry.lock pyproject.toml /source/
# --no-root declares not to install the project package since we're wanting to take advantage of caching dependency installation
# and the project is copied in and installed after this step
RUN poetry install --no-interaction --no-ansi --no-root

# -------------------------------------------------------------------------------------
# Install Nautobot Plugin
# -------------------------------------------------------------------------------------
RUN mkdir -p /source
WORKDIR /source
# Copy in the rest of the source code and install local Nautobot plugin
COPY . /source
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
RUN poetry install --no-interaction --no-ansi

ENV NAUTOBOT_CONFIG /opt/nautobot/configuration.py
WORKDIR /opt/nautobot/
COPY development/nautobot_config.py /opt/nautobot/nautobot_config.py
39 changes: 28 additions & 11 deletions development/dev.env
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
ALLOWED_HOSTS=*
BANNER_TOP="Data Validation Engine plugin dev"
CHANGELOG_RETENTION=0
DB_HOST=postgres
DB_NAME=nautobot
DB_PASSWORD=decinablesprewad
DB_USER=nautobot
HIDE_RESTRICTED_UI=True
DEBUG=True
DEVELOPER=True
[email protected]
EMAIL_PASSWORD=
EMAIL_PORT=25
EMAIL_SERVER=localhost
EMAIL_TIMEOUT=5
EMAIL_USERNAME=nautobot
MAX_PAGE_SIZE=0
METRICS_ENABLED=True
NAPALM_TIMEOUT=5
NAUTOBOT_CONFIG=/etc/nautobot/nautobot_config.py
PGPASSWORD=decinablesprewad
POSTGRES_DB=nautobot
POSTGRES_PASSWORD=decinablesprewad
POSTGRES_HOST=postgres
POSTGRES_PASSWORD=notverysecurepwd
POSTGRES_USER=nautobot
REDIS_HOST=redis
REDIS_PASSWORD=decinablesprewad
REDIS_PASSWORD=notverysecurepwd
REDIS_PORT=6379
# Uncomment REDIS_SSL if using SSL
# REDIS_SSL=True
SECRET_KEY=012345678901234567890123456789012345678901234567890123456789
# Uncomment REDIS_SSL if using SSL
SECRET_KEY=r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj
SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
[email protected]
SUPERUSER_NAME=admin
SUPERUSER_PASSWORD=admin
# Golden Configuration specific
PER_FEATURE_WIDTH=13
PER_FEATURE_HEIGHT=4
PER_FEATURE_BAR_WIDTH=0.15
ENABLE_COMPLIANCE=True
ENABLE_INTENDED=True
ENABLE_BACKUP=True
ENABLE_SOTAGG=True
ALLOWED_OS=all
lampwins marked this conversation as resolved.
Show resolved Hide resolved
100 changes: 53 additions & 47 deletions development/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,59 @@

---
version: "3"
services:
nautobot:
x-nautobot-build: &nautobot-build
build:
args:
NAUTOBOT_VER: "${NAUTOBOT_VER}"
PYTHON_VER: "${PYTHON_VER}"
context: "../"
dockerfile: "development/Dockerfile"
image: "nautobot-data-validation-engine/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
command: >
sh -c "nautobot-server migrate &&
nautobot-server runserver 0.0.0.0:8000"
ports:
- "8000:8000"
depends_on:
- "postgres"
- "redis"
x-nautobot-base: &nautobot-base
image: "nautobot_data_validation_engine/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
env_file:
- "./dev.env"
volumes:
- "./nautobot_config.py:/etc/nautobot/nautobot_config.py"
- "../:/source"
- "dev.env"
tty: true
worker:
build:
context: "../"
dockerfile: "development/Dockerfile"
image: "nautobot-data-validation-engine/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
command: >
sh -c "nautobot-server rqworker"
depends_on:
- "nautobot"
env_file:
- "./dev.env"
volumes:
- "./nautobot_config.py:/etc/nautobot/nautobot_config.py"
- "../nautobot_data_validation_engine:/source/nautobot_data_validation_engine"
tty: true
postgres:
image: "postgres:12"
env_file:
- "./dev.env"
volumes:
- "pgdata_nautobot_data_validation_engine:/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_nautobot_data_validation_engine: {}

version: "3.4"
services:
nautobot:
command: "nautobot-server runserver 0.0.0.0:8080 --insecure"
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
ports:
- "8080:8080"
depends_on:
- "postgres"
- "redis"
<<: *nautobot-build
<<: *nautobot-base
worker:
entrypoint: "nautobot-server rqworker"
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
depends_on:
- "nautobot"
healthcheck:
disable: true
<<: *nautobot-base
postgres:
image: "postgres:13-alpine"
env_file:
- "dev.env"
volumes:
- "pgdata_nautobot_data_validation_engine:/var/lib/postgresql/data"
ports:
- "5432:5432"
redis:
image: "redis:6-alpine"
command:
- "sh"
- "-c" # this is to evaluate the $REDIS_PASSWORD from the env
- "redis-server --appendonly yes --requirepass $$REDIS_PASSWORD"
env_file:
- "dev.env"
ports:
- "6379:6379"
volumes:
pgdata_nautobot_data_validation_engine: # yamllint disable-line rule:empty-values
Loading