diff --git a/geant_service_orchestrator/oss-params-example.json b/geant_service_orchestrator/oss-params-example.json new file mode 100644 index 0000000000000000000000000000000000000000..32187e1f9b06bd7d60113065b2d705094b88ca85 --- /dev/null +++ b/geant_service_orchestrator/oss-params-example.json @@ -0,0 +1,20 @@ +{ + "RESOURCE_MANAGER_API_PREFIX": "http://localhost:44444", + "IPAM": { + "INFOBLOX": { + "scheme": "https", + "wapi_version": "v2.12", + "host": "10.0.0.1", + "username": "robot-user", + "password": "robot-user-password" + }, + "TRUNK": { + "V4": {"container": "1.1.0.0/19", "mask": 31}, + "V6": {"container": "dead:beef::/29", "mask": 96} + }, + "GEANT_IP": { + "V4": {"container": "1.1.8.0/19", "mask": 31}, + "V6": {"container": "dead:beef::/29", "mask": 96} + } + } +} \ No newline at end of file diff --git a/geant_service_orchestrator/settings.py b/geant_service_orchestrator/settings.py new file mode 100644 index 0000000000000000000000000000000000000000..98352e6ba99ec019ff4eb8a8ea317a8830401825 --- /dev/null +++ b/geant_service_orchestrator/settings.py @@ -0,0 +1,42 @@ +import json +import os +from typing import Optional +from pydantic import BaseSettings + + +class InfoBloxParams(BaseSettings): + scheme: str + wapi_version: str + host: str + username: str + password: str + + +class ServiceNetworkProtocolParams(BaseSettings): + container: str # ipaddress? + mask: int + + +class ServiceNetworkParams(BaseSettings): + V4: ServiceNetworkProtocolParams + V6: ServiceNetworkProtocolParams + + +class IPAMParams(BaseSettings): + INFOBLOX: InfoBloxParams + TRUNK: ServiceNetworkParams + GEANT_IP: ServiceNetworkParams + + +class OSSParams(BaseSettings): + IPAM: IPAMParams + RESOURCE_MANAGER_API_PREFIX: str # api prefix + + +def load_oss_params() -> OSSParams: + with open(os.environ['OSS_PARAMS_FILENAME']) as f: + return OSSParams(**json.loads(f.read())) + + +if __name__ == '__main__': + print(load_oss_params()) \ No newline at end of file