Skip to content
Snippets Groups Projects
Commit a2f0a59f authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by Neda Moeini
Browse files

restrict IPv4 and v6 netmask values to valid range in settings

parent af39ed7c
No related branches found
No related tags found
1 merge request!83Clean up the repo a bit, and add some unit tests
......@@ -2,4 +2,4 @@
The GÉANT interpretation of [`orchestrator-core`](https://github.com/workfloworchestrator/orchestrator-core).
## Documentation
You can build the documentation locally using either [build-docs.sh](build-docs.sh) or [test-docs.sh](test-docs.sh).
You can build the documentation locally using [build-docs.sh](build-docs.sh).
......@@ -8,7 +8,7 @@ import json
import logging
import os
from pydantic import BaseSettings
from pydantic import BaseSettings, NonNegativeInt
logger = logging.getLogger(__name__)
......@@ -31,12 +31,20 @@ class InfoBloxParams(BaseSettings):
password: str
class V4Netmask(NonNegativeInt):
le = 32
class V6Netmask(NonNegativeInt):
le = 128
class V4NetworkParams(BaseSettings):
"""A set of parameters that describe an IPv4 network in InfoBlox."""
containers: list[ipaddress.IPv4Network]
networks: list[ipaddress.IPv4Network]
mask: int # TODO: validation on mask?
mask: V4Netmask
class V6NetworkParams(BaseSettings):
......@@ -44,7 +52,7 @@ class V6NetworkParams(BaseSettings):
containers: list[ipaddress.IPv6Network]
networks: list[ipaddress.IPv6Network]
mask: int # TODO: validation on mask?
mask: V6Netmask
class ServiceNetworkParams(BaseSettings):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment