Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 10d93c2d authored by Magdalena GOMEZ's avatar Magdalena GOMEZ Committed by Diego MENDEZ
Browse files

Refactored rps plugin tests and removed legacy code

parent f6c50db4
Branches
Tags
5 merge requests!133Draft: Rebase v4 firewall,!131Draft: Rebase v4.1,!129Draft: Rebase v4,!125Develop,!121Removed legacy code and refactored mac address plugin and cert plugin tests
Showing
with 0 additions and 115602 deletions
...@@ -30,7 +30,6 @@ lint-job: ...@@ -30,7 +30,6 @@ lint-job:
- source "$CI_PROJECT_DIR/plugins/venv/bin/activate" - source "$CI_PROJECT_DIR/plugins/venv/bin/activate"
- pip install 'pylint==3.2' - pip install 'pylint==3.2'
script: script:
- pylint "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/netbox_rps_plugin" "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/tests"
- pylint "$CI_PROJECT_DIR/tests" - pylint "$CI_PROJECT_DIR/tests"
after_script: after_script:
- deactivate - deactivate
...@@ -80,7 +79,6 @@ run-test-job: ...@@ -80,7 +79,6 @@ run-test-job:
before_script: before_script:
- python3 -m venv "$CI_PROJECT_DIR/plugins/venv" - python3 -m venv "$CI_PROJECT_DIR/plugins/venv"
- source "$CI_PROJECT_DIR/plugins/venv/bin/activate" - source "$CI_PROJECT_DIR/plugins/venv/bin/activate"
- pip install -r "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/tests/requirements.e2e.txt"
- pip install -r "$CI_PROJECT_DIR/tests/requirements.e2e.txt" - pip install -r "$CI_PROJECT_DIR/tests/requirements.e2e.txt"
script: script:
- env HOST="${TEST_HOST}" PORT="${TEST_PORT}" API_KEY="$API_KEY" pytest -s --junit-xml=tests-report-netbox-rps-plugin.xml "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/tests/" - env HOST="${TEST_HOST}" PORT="${TEST_PORT}" API_KEY="$API_KEY" pytest -s --junit-xml=tests-report-netbox-rps-plugin.xml "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/tests/"
......
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/kreuzwerker/docker" {
version = "3.0.2"
constraints = "3.0.2"
hashes = [
"h1:XjdpVL61KtTsuPE8swok3GY8A+Bu3TZs8T2DOEpyiXo=",
"zh:15b0a2b2b563d8d40f62f83057d91acb02cd0096f207488d8b4298a59203d64f",
"zh:23d919de139f7cd5ebfd2ff1b94e6d9913f0977fcfc2ca02e1573be53e269f95",
"zh:38081b3fe317c7e9555b2aaad325ad3fa516a886d2dfa8605ae6a809c1072138",
"zh:4a9c5065b178082f79ad8160243369c185214d874ff5048556d48d3edd03c4da",
"zh:5438ef6afe057945f28bce43d76c4401254073de01a774760169ac1058830ac2",
"zh:60b7fadc287166e5c9873dfe53a7976d98244979e0ab66428ea0dea1ebf33e06",
"zh:61c5ec1cb94e4c4a4fb1e4a24576d5f39a955f09afb17dab982de62b70a9bdd1",
"zh:a38fe9016ace5f911ab00c88e64b156ebbbbfb72a51a44da3c13d442cd214710",
"zh:c2c4d2b1fd9ebb291c57f524b3bf9d0994ff3e815c0cd9c9bcb87166dc687005",
"zh:d567bb8ce483ab2cf0602e07eae57027a1a53994aba470fa76095912a505533d",
"zh:e83bf05ab6a19dd8c43547ce9a8a511f8c331a124d11ac64687c764ab9d5a792",
"zh:e90c934b5cd65516fbcc454c89a150bfa726e7cf1fe749790c7480bbeb19d387",
"zh:f05f167d2eaf913045d8e7b88c13757e3cf595dd5cd333057fdafc7c4b7fed62",
"zh:fcc9c1cea5ce85e8bcb593862e699a881bd36dffd29e2e367f82d15368659c3d",
]
}
global-include *.html
# RPS Plugin for Netbox
A Netbox v3.5 plugin for RPS mapping management
![Screenshot of the Netbox RPS plugin detail screen](./docs/Screenshot 2023-05-14 at 11.38.51.png)
## Quickstart
```shell
$ terraform init
$ terraform apply -var="deploy_service=true"
```
And browse [http://localhost:8000](http://localhost:8000).
* username is `username`
* and password is `password`
## Build
To build a [`netboxcommunity/netbox:v3.5-2.6.0`](https://hub.docker.com/layers/netboxcommunity/netbox/v3.5-2.6.0/images/sha256-edbb00e74a5cdb4bfeb51abbd9280cc005d1242152a67be7e2cd057e7d568fc2?context=explore)
Docker image including the plugin pre-installed, simply run
```shell
$ docker build .
```
Refer to the community [Docker image](https://hub.docker.com/r/netboxcommunity/netbox)
for environment variable configuration.
## Tests
see [tests directory](./tests/README.md)
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}
provider "docker" {
host = "unix:///var/run/docker.sock"
}
variable "deploy_administration" {
type = bool
default = false
}
variable "deploy_service" {
type = bool
default = false
}
resource "docker_network" "network" {
name = "netbox_rps"
}
resource "docker_image" "redis" {
name = "redis:7-alpine"
}
resource "docker_container" "redis" {
image = docker_image.redis.image_id
name = "redis"
command = [
"sh",
"-c", # this is to evaluate the $REDIS_PASSWORD from the env
"redis-server --appendonly yes --requirepass \"$REDIS_PASSWORD\"" # $$ is because of Docker
]
env = [
"REDIS_PASSWORD=password"
]
ports {
internal = 6379
external = 6379
}
networks_advanced {
name = docker_network.network.name
}
}
resource "docker_image" "postgres" {
name = "postgres:15-alpine"
}
resource "docker_container" "postgres" {
image = docker_image.postgres.image_id
name = "postgres"
env = [
"POSTGRES_USER=username",
"POSTGRES_PASSWORD=password",
"POSTGRES_DB=netbox"
]
ports {
internal = 5432
external = 5432
}
networks_advanced {
name = docker_network.network.name
}
}
resource "docker_container" "adminer" {
count = var.deploy_administration ? 1 : 0
image = "adminer"
name = "adminer"
ports {
internal = 8080
external = 8080
}
networks_advanced {
name = docker_network.network.name
}
}
resource "docker_image" "netbox" {
count = var.deploy_service ? 1 : 0
name = "netbox_rps"
build {
context = "."
}
}
resource "docker_container" "netbox" {
count = var.deploy_service ? 1 : 0
name = "netbox"
image = docker_image.netbox[0].image_id
ports {
internal = 8080
external = 8000
}
networks_advanced {
name = docker_network.network.name
}
env = [
"CORS_ORIGIN_ALLOW_ALL=True",
"DB_HOST=postgres",
"DB_NAME=postgres",
"DB_USER=username",
"DB_PASSWORD=password",
"REDIS_CACHE_DATABASE=1",
"REDIS_CACHE_HOST=redis",
"REDIS_CACHE_PASSWORD=password",
"REDIS_CACHE_SSL=false",
"REDIS_DATABASE=0",
"REDIS_HOST=redis",
"REDIS_PASSWORD=password",
"REDIS_SSL=false",
"SECRET_KEY=r8OwDznj!!dci#ParztZELKezarlkjjlazjkhat9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj",
"SKIP_SUPERUSER=false",
"SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567",
"SUPERUSER_EMAIL=username@global.ntt",
"SUPERUSER_NAME=username",
"SUPERUSER_PASSWORD=password",
]
}
plugins/netbox-rps-plugin/docs/Screenshot 2023-05-14 at 11.38.51.png

730 KiB

This diff is collapsed.
"""Netbox Plugin Configuration"""
# pylint: disable=E0401
from extras.plugins import PluginConfig
class NetBoxRpsConfig(PluginConfig):
"""Netbox Plugin Configuration class"""
name = "netbox_rps_plugin"
verbose_name = "NetBox RPS"
description = "A Netbox plugin to add RPS resources"
version = "0.12.0"
author = "Vincent Simonin"
author_email = "vincent.simonin@ext.ec.europa.eu"
base_url = "rps"
default_settings = {
"default_sorry_page": "https://sorry.ec.europa.eu/"
}
# pylint: disable=C0103
config = NetBoxRpsConfig
"""API Serializer definitions"""
from rest_framework import serializers
from netbox.api.serializers import NetBoxModelSerializer, WritableNestedSerializer
from ..models import Mapping, HttpHeader, SamlConfig, clean_url
class NestedMappingSerializer(WritableNestedSerializer):
"""Nested Mapping Serializer class"""
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_rps_plugin-api:mapping-detail"
)
class Meta:
model = Mapping
fields = ("id", "url", "display")
class NestedSamlConfigSerializer(WritableNestedSerializer):
"""Nested SAML Config Serializer class"""
url = url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_rps_plugin-api:samlconfig-detail"
)
class Meta:
model = SamlConfig
fields = (
"id",
"url",
"acs_url",
"logout_url",
"force_nauth",
)
class SamlConfigSerializer(NetBoxModelSerializer):
"""SAML Config Serializer class"""
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_rps_plugin-api:samlconfig-detail"
)
mapping = NestedMappingSerializer()
class Meta:
model = SamlConfig
fields = (
"id",
"url",
"acs_url",
"logout_url",
"force_nauth",
"mapping",
"custom_fields",
"created",
"last_updated",
"tags",
)
class HttpHeaderSerializer(NetBoxModelSerializer):
"""HTTP Header Serializer class"""
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_rps_plugin-api:httpheader-detail"
)
mapping = NestedMappingSerializer()
class Meta:
model = HttpHeader
fields = (
"id",
"url",
"name",
"value",
"apply_to",
"mapping",
"custom_fields",
"created",
"last_updated",
"tags",
)
class NestedHttpHeaderSerializer(WritableNestedSerializer):
"""Nested HTTP Header Serializer class"""
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_rps_plugin-api:httpheader-detail"
)
class Meta:
model = HttpHeader
fields = ("id", "url", "name", "value", "apply_to")
class MappingSerializer(NetBoxModelSerializer):
"""Mapping Serializer class"""
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_rps_plugin-api:mapping-detail"
)
http_headers = NestedHttpHeaderSerializer(many=True, required=False)
saml_config = NestedSamlConfigSerializer(required=False)
class Meta:
model = Mapping
fields = (
"id",
"url",
"source",
"target",
"authentication",
"testingpage",
"webdav",
"Comment",
"gzip_proxied",
"keepalive_requests",
"keepalive_timeout",
"proxy_cache",
"proxy_read_timeout",
"client_max_body_size",
"extra_protocols",
"sorry_page",
"custom_fields",
"created",
"last_updated",
"tags",
"http_headers",
"saml_config",
)
def create(self, validated_data):
"""Be sure that URL is cleaned"""
instance = super().create(validated_data)
instance.source = clean_url(instance.source)
instance.target = clean_url(instance.target)
instance.save()
return instance
def update(self, instance, validated_data):
"""Be sure that URL is cleaned"""
validated_data["source"] = clean_url(validated_data["source"])
validated_data["target"] = clean_url(validated_data["target"])
return super().update(instance, validated_data)
"""API URLs definition"""
from netbox.api.routers import NetBoxRouter
from . import views
APP_NAME = 'netbox_rps_plugin'
router = NetBoxRouter()
router.register('mapping', views.MappingViewSet)
router.register('http_header', views.HttpHeaderViewSet)
router.register('saml_config', views.SamlConfigViewSet)
urlpatterns = router.urls
"""API views definitions"""
from netbox.api.viewsets import NetBoxModelViewSet
from .. import filtersets, models
from .serializers import MappingSerializer, HttpHeaderSerializer, SamlConfigSerializer
class MappingViewSet(NetBoxModelViewSet):
"""Mapping view set class"""
queryset = models.Mapping.objects.prefetch_related("http_headers", "tags").all()
serializer_class = MappingSerializer
filterset_class = filtersets.MappingFilterSet
http_method_names = ["get", "post", "patch", "delete"]
class HttpHeaderViewSet(NetBoxModelViewSet):
"""HTTP Header view set class"""
queryset = models.HttpHeader.objects.prefetch_related("mapping", "tags").all()
serializer_class = HttpHeaderSerializer
filterset_class = filtersets.HttpHeaderFilterSet
http_method_names = ["get", "post", "patch", "delete"]
class SamlConfigViewSet(NetBoxModelViewSet):
"""SAML config view set class"""
queryset = models.SamlConfig.objects.prefetch_related("mapping", "tags").all()
serializer_class = SamlConfigSerializer
http_method_names = ["get", "post", "patch", "delete"]
"""Filtersets definitions"""
from django_filters import filters
from netbox.filtersets import NetBoxModelFilterSet
from django.db.models import Q
from .models import Mapping, HttpHeader
class MappingFilterSet(NetBoxModelFilterSet):
"""Mapping filterset definition class"""
extra_protocols = filters.CharFilter(lookup_expr="icontains")
class Meta:
model = Mapping
fields = (
"id",
"authentication",
"source",
"target",
"Comment",
"webdav",
"extra_protocols",
"testingpage",
"gzip_proxied",
"keepalive_requests",
"keepalive_timeout",
"proxy_cache",
"proxy_read_timeout",
"client_max_body_size",
"sorry_page",
)
# pylint: disable=W0613
def search(self, queryset, name, value):
"""override"""
if not value.strip():
return queryset
return queryset.filter(
Q(source__icontains=value)
| Q(target__icontains=value)
| Q(Comment__icontains=value)
)
class HttpHeaderFilterSet(NetBoxModelFilterSet):
"""HTTP Header filterset definition class"""
class Meta:
model = HttpHeader
fields = ("id", "name", "value", "apply_to", "mapping")
# pylint: disable=W0613
def search(self, queryset, name, value):
"""override"""
if not value.strip():
return queryset
return queryset.filter(Q(name__icontains=value) | Q(value__icontains=value))
"""Forms definitions"""
from django import forms
from django.utils.translation import gettext as _
from netbox.forms import (
NetBoxModelForm,
NetBoxModelFilterSetForm,
NetBoxModelImportForm,
)
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
from .models import (
Mapping,
AuthenticationChoices,
ExtraProtocolChoices,
HttpHeader,
ApplyToChoices,
SamlConfig,
URL_MAX_SIZE,
)
class MappingForm(NetBoxModelForm):
"""Mapping form definition class"""
extra_protocols = forms.MultipleChoiceField(
choices=ExtraProtocolChoices, required=False
)
class Meta:
model = Mapping
fields = (
"source",
"target",
"authentication",
"webdav",
"extra_protocols",
"testingpage",
"gzip_proxied",
"keepalive_requests",
"keepalive_timeout",
"proxy_cache",
"proxy_read_timeout",
"client_max_body_size",
"sorry_page",
"Comment",
"tags",
)
help_texts = {
"target": "URL-friendly unique shorthand",
"keepalive_requests": "Min value 100 requests, max 5000 requests, default 1000 requests.",
"keepalive_timeout": "In seconds. Min value 1, max 300, default 75.",
"proxy_read_timeout": "In seconds. Min value 1, max 300, default 60.",
"client_max_body_size": "In Mega Bytes. Min 1, max 255, default 1.",
}
labels = {
"source": "Source URL",
"target": "Target URL",
"testingpage": "Testing Page URL",
"keepalive_timeout": "Keepalive timeout (s)",
"proxy_read_timeout": " Proxy read timeout (s)",
"client_max_body_size": "Client max body size (MB)",
"sorry_page": "Sorry Page URL",
"protocols": "Protocols",
}
class MappingFilterForm(NetBoxModelFilterSetForm):
"""Mapping filter form definition class"""
model = Mapping
source = forms.CharField(
max_length=URL_MAX_SIZE, min_length=1, required=False, label="Source URL"
)
target = forms.CharField(
max_length=URL_MAX_SIZE, min_length=1, required=False, label="Target URL"
)
authentication = forms.MultipleChoiceField(
choices=AuthenticationChoices,
required=False,
)
webdav = forms.BooleanField(
required=False, widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES)
)
extra_protocols = forms.MultipleChoiceField(
choices=ExtraProtocolChoices,
required=False,
)
testingpage = forms.CharField(
max_length=120, min_length=1, required=False, label="Testing URL"
)
Comment = forms.CharField(
max_length=500, min_length=1, required=False, label="Comment"
)
gzip_proxied = webdav = forms.BooleanField(
required=False, widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES)
)
keepalive_requests = forms.IntegerField(
min_value=100, max_value=5000, required=False
)
keepalive_timeout = forms.IntegerField(min_value=1, max_value=300, required=False)
proxy_cache = forms.BooleanField(
required=False, widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES)
)
proxy_read_timeout = forms.IntegerField(min_value=1, max_value=300, required=False)
client_max_body_size = forms.IntegerField(
min_value=1, max_value=255, required=False
)
sorry_page = forms.CharField(
max_length=URL_MAX_SIZE, min_length=1, required=False, label="Sorry Page URL"
)
tag = TagFilterField(model)
class MappingImportForm(NetBoxModelImportForm):
"""Mapping importation form definition class"""
authentication = forms.MultipleChoiceField(
choices=AuthenticationChoices,
required=False,
help_text='Authentication method. Can be "none", "ldap" and "ecas". Default to "none".',
)
keepalive_requests = forms.IntegerField(
min_value=100,
max_value=5000,
required=False,
help_text="Min value 100 requests, max 5000 requests, default 1000 requests.",
)
keepalive_timeout = forms.IntegerField(
min_value=1,
max_value=300,
required=False,
help_text="In seconds. Min value 1, max 300, default 75.",
)
proxy_read_timeout = forms.IntegerField(
min_value=1,
max_value=300,
required=False,
help_text="In seconds. Min value 1, max 300, default 60.",
)
client_max_body_size = forms.IntegerField(
min_value=1,
max_value=255,
required=False,
help_text="In Mega Bytes. Min 1, max 255, default 1.",
)
sorry_page = forms.CharField(
max_length=URL_MAX_SIZE,
min_length=1,
required=False,
help_text="Sorry Page URL",
)
class Meta:
model = Mapping
fields = (
"source",
"target",
"authentication",
"testingpage",
"webdav",
"testingpage",
"Comment",
"gzip_proxied",
"keepalive_requests",
"keepalive_timeout",
"proxy_cache",
"proxy_read_timeout",
"client_max_body_size",
"sorry_page",
)
help_texts = {
"source": "Source URL",
"target": "Target URL",
"testingpage": "Testing page URL",
"webdav": 'Define if the mapping handle Webdav protocol. Default to "false"',
"gzip_proxied": 'Is gzip proxied. Default to "false"',
"proxy_cache": 'Is proxy cache activated. Default to "false"',
}
class HttpHeaderForm(NetBoxModelForm):
"""HTTP header form definition class"""
class Meta:
model = HttpHeader
fields = ("mapping", "name", "value", "apply_to")
labels = {
"mapping": "Mapping",
"name": "Name",
"value": "Value",
"apply_to": "Apply to",
}
class HttpHeaderFilterForm(NetBoxModelFilterSetForm):
"""HTTP header filter form definition class"""
model = HttpHeader
name = forms.CharField(
max_length=120, min_length=1, required=False, label="Header name"
)
value = forms.CharField(
max_length=256, min_length=1, required=False, label="Header value"
)
apply_to = forms.ChoiceField(
choices=add_blank_choice(ApplyToChoices), required=False, label="Apply to"
)
mapping = DynamicModelMultipleChoiceField(
queryset=Mapping.objects.all(), required=False, label=_("Mapping")
)
tag = TagFilterField(model)
class SamlConfigForm(NetBoxModelForm):
"""SAML config form definition class"""
class Meta:
model = SamlConfig
fields = ("mapping", "acs_url", "logout_url", "force_nauth")
labels = {
"mapping": "Mapping",
"acs_url": "ACS URL",
"logout_url": "Logout URL",
"force_nauth": "Force AuthnRequest",
}
"""Migration File"""
# pylint: disable=C0103
from django.db import migrations, models
import taggit.managers
import utilities.json
class Migration(migrations.Migration):
"""Migration Class"""
initial = True
dependencies = [
("extras", "0084_staging"),
("ipam", "0063_standardize_description_comments"),
]
operations = [
migrations.CreateModel(
name="Mapping",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False
),
),
("created", models.DateTimeField(auto_now_add=True, null=True)),
("last_updated", models.DateTimeField(auto_now=True, null=True)),
(
"custom_field_data",
models.JSONField(
blank=True,
default=dict,
encoder=utilities.json.CustomFieldJSONEncoder,
),
),
("source", models.CharField(blank=True, max_length=120)),
("target", models.CharField(blank=True, max_length=120)),
("authentication", models.CharField(max_length=30)),
("testingpage", models.CharField(max_length=120)),
("webdav", models.BooleanField(default=False)),
("Comment", models.CharField(blank=True, max_length=500)),
(
"tags",
taggit.managers.TaggableManager(
through="extras.TaggedItem", to="extras.Tag"
),
),
],
options={
"ordering": ("source"),
},
),
]
"""Migration File"""
# pylint: disable=C0103
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import taggit.managers
import utilities.json
class Migration(migrations.Migration):
"""Migration Class"""
initial = True
dependencies = [("netbox_rps_plugin", "0001_initial")]
operations = [
migrations.CreateModel(
name="HttpHeader",
# pylint: disable=R0801
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False
),
),
("created", models.DateTimeField(auto_now_add=True, null=True)),
("last_updated", models.DateTimeField(auto_now=True, null=True)),
(
"custom_field_data",
models.JSONField(
blank=True,
default=dict,
encoder=utilities.json.CustomFieldJSONEncoder,
),
),
("name", models.CharField(blank=True, max_length=120)),
("value", models.CharField(blank=True, max_length=120)),
("apply_to", models.CharField(max_length=30)),
(
"mapping",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="http_headers",
to="netbox_rps_plugin.mapping",
),
),
(
"tags",
taggit.managers.TaggableManager(
through="extras.TaggedItem", to="extras.Tag"
),
),
],
options={
"ordering": ("name"),
},
),
]
"""Migration File"""
# pylint: disable=C0103
from django.db import migrations, models
class Migration(migrations.Migration):
"""Migration Class"""
dependencies = [("netbox_rps_plugin", "0002_http_header")]
operations = [
migrations.AlterField(
model_name="httpheader",
name="value",
field=models.CharField(max_length=256, null=True, blank=True),
),
migrations.AddConstraint(
model_name="httpheader",
constraint=models.UniqueConstraint(
fields=("mapping", "name", "apply_to"),
name="netbox_rps_plugin_httpheader_unique_mapping_name_apply_to",
),
),
]
"""Migration File"""
# pylint: disable=C0103
from django.db import migrations, models
class Migration(migrations.Migration):
"""Migration Class"""
dependencies = [("netbox_rps_plugin", "0003_http_header_unique_constraint")]
operations = [
migrations.AlterField(
model_name="mapping",
name="testingpage",
field=models.CharField(max_length=120, null=True, blank=True),
),
]
"""Migration File"""
# pylint: disable=C0103
from django.db import migrations, models
class Migration(migrations.Migration):
"""Migration Class"""
dependencies = [("netbox_rps_plugin", "0004_testingpage_nullable")]
operations = [
migrations.AlterField(
model_name="mapping",
name="source",
field=models.CharField(
null=False, blank=False, max_length=120, unique=True
),
),
]
"""Migration File"""
# pylint: disable=C0103
from django.db import migrations, models
class Migration(migrations.Migration):
"""Migration Class"""
dependencies = [("netbox_rps_plugin", "0005_source_mapping_unique_constraint")]
operations = [
migrations.AlterField(
model_name="mapping",
name="source",
field=models.CharField(
null=False, blank=False, max_length=2000, unique=True
),
),
migrations.AlterField(
model_name="mapping",
name="target",
field=models.CharField(null=False, blank=False, max_length=2000),
),
migrations.AlterField(
model_name="mapping",
name="testingpage",
field=models.CharField(null=True, blank=True, max_length=2000),
),
]
"""Migration File"""
# pylint: disable=C0103
from django.db import migrations, models
import utilities.json
import taggit.managers
import django.db.models.deletion
class Migration(migrations.Migration):
"""Migration Class"""
dependencies = [("netbox_rps_plugin", "0006_url_max_length")]
operations = [
migrations.CreateModel(
name="SamlConfig",
# pylint: disable=R0801
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False
),
),
("created", models.DateTimeField(auto_now_add=True, null=True)),
("last_updated", models.DateTimeField(auto_now=True, null=True)),
(
"custom_field_data",
models.JSONField(
blank=True,
default=dict,
encoder=utilities.json.CustomFieldJSONEncoder,
),
),
(
"tags",
taggit.managers.TaggableManager(
through="extras.TaggedItem", to="extras.Tag"
),
),
("acs_url", models.CharField(blank=False, null=False, max_length=2000)),
(
"logout_url",
models.CharField(blank=False, null=False, max_length=2000),
),
("force_nauth", models.BooleanField(default=False)),
(
"mapping",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="saml_config",
to="netbox_rps_plugin.mapping",
),
),
],
),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment