Newer
Older
""":term:`GSO` settings.
Ensuring that the required parameters are set correctly. An example file ``oss-params-example.json`` is present in the
:term:`GSO` package itself.
from pydantic import BaseSettings, NonNegativeInt
class GeneralParams(BaseSettings):
"""General parameters for a :term:`GSO` configuration file."""
public_hostname: str
"""The hostname that :term:`GSO` is publicly served at, used for building the callback URL that the provisioning
proxy uses."""
environment: str
"""The environment in which :term:`GSO` runs."""
class CeleryParams(BaseSettings):
"""Parameters for Celery."""
broker_url: str
result_backend: str
timezone: str = "Europe/Amsterdam"
enable_utc: bool = True
result_expires: int = 3600
"""Parameters related to InfoBlox."""
scheme: str
wapi_version: str
host: str
username: str
password: str
class V4Netmask(NonNegativeInt):
"""A valid netmask for an IPv4 network or address."""
le = 32
class V6Netmask(NonNegativeInt):
"""A valid netmask for an IPv6 network or address."""
le = 128
"""A set of parameters that describe an IPv4 network in InfoBlox."""
containers: list[ipaddress.IPv4Network]
JORGE SASIAIN
committed
networks: list[ipaddress.IPv4Network]
mask: V4Netmask
"""A set of parameters that describe an IPv6 network in InfoBlox."""
containers: list[ipaddress.IPv6Network]
JORGE SASIAIN
committed
networks: list[ipaddress.IPv6Network]
mask: V6Netmask
class ServiceNetworkParams(BaseSettings):
"""Parameters for InfoBlox.
The parameters 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 :term:`IPAM`."""
LO: ServiceNetworkParams
TRUNK: ServiceNetworkParams
GEANT_IP: ServiceNetworkParams
SI: ServiceNetworkParams
LT_IAS: ServiceNetworkParams
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
class MonitoringLibreNMSDevGroupsParams(BaseSettings):
"""
Parameters related to LibreNMS device groups.
"""
routers_lab: str
routers_prod: str
class MonitoringSNMPV2Params(BaseSettings):
"""
Parameters related to SNMPv2.
"""
community: str
class MonitoringSNMPV3Params(BaseSettings):
"""
Parameters related to SNMPv3.
"""
authlevel: str
authname: str
authpass: str
authalgo: str
cryptopass: str
cryptoalgo: str
class MonitoringSNMPParams(BaseSettings):
"""
Parameters related to SNMP.
"""
version: str
V2: MonitoringSNMPV2Params
V3: MonitoringSNMPV3Params
class MonitoringLibreNMSParams(BaseSettings):
"""
Parameters related to LibreNMS.
"""
endpoint: str
token: str
DEVICE_GROUPS: MonitoringLibreNMSDevGroupsParams
class MonitoringParams(BaseSettings):
"""
Parameters related to the monitoring.
"""
LIBRENMS: MonitoringLibreNMSParams
SNMP: MonitoringSNMPParams
class ProvisioningProxyParams(BaseSettings):
"""Parameters for the provisioning proxy."""
#: .. deprecated:: 0.1
#: Not used anymore, may be left out from config file.
auth: str | None
class NetBoxParams(BaseSettings):
"""Parameters for NetBox."""
token: str
api: str
"""The set of parameters required for running :term:`GSO`."""
GENERAL: GeneralParams
NETBOX: NetBoxParams
MONITORING: MonitoringParams
PROVISIONING_PROXY: ProvisioningProxyParams
"""Look for ``OSS_PARAMS_FILENAME`` in the environment and load the parameters from that file."""
with Path(os.environ["OSS_PARAMS_FILENAME"]).open(encoding="utf-8") as file: