Newer
Older
"""
GSO settings, ensuring that the required parameters are set correctly.
"""
from pydantic import BaseSettings, Field
class GeneralParams(BaseSettings):
"""
General parameters for a GSO configuration file.
"""
#: The hostname that GSO is publicly served at, used for building the
#: callback URL that the provisioning proxy uses.
public_hostname: str
"""
Parameters related to InfoBlox.
"""
scheme: str
wapi_version: str
host: str
username: str
password: str
"""
A set of parameters that describe an IPv4 network in InfoBlox.
"""
containers: list[ipaddress.IPv4Network]
networks: list[ipaddress.IPv4Network]
mask: int = Field(None, ge=0, le=32)
"""
A set of parameters that describe an IPv6 network in InfoBlox.
"""
containers: list[ipaddress.IPv6Network]
networks: list[ipaddress.IPv6Network]
mask: int = Field(None, ge=0, le=128)
class ServiceNetworkParams(BaseSettings):
"""
Parameters for InfoBlox that describe IPv4 and v6 networks, and the
corresponding domain name that should be used as a suffix.
"""
domain_name: str
"""
A set of parameters related to IPAM.
"""
LO: ServiceNetworkParams
TRUNK: ServiceNetworkParams
GEANT_IP: ServiceNetworkParams
class ProvisioningProxyParams(BaseSettings):
"""
Parameters for the provisioning proxy.
"""
auth: str # FIXME: unfinished
api_version: int
"""
The set of parameters required for running GSO.
"""
GENERAL: GeneralParams
RESOURCE_MANAGER_API_PREFIX: str
PROVISIONING_PROXY: ProvisioningProxyParams
look for OSS_PARAMS_FILENAME in the environment and load the parameters
from that file.
with open(os.environ['OSS_PARAMS_FILENAME'], encoding='utf-8') as file:
return OSSParams(**json.loads(file.read()))