diff --git a/geant_service_orchestrator/services/provisioning_proxy.py b/geant_service_orchestrator/services/provisioning_proxy.py new file mode 100644 index 0000000000000000000000000000000000000000..c34c20cdede7902654fe8c65e60e3aee9f5e4e31 --- /dev/null +++ b/geant_service_orchestrator/services/provisioning_proxy.py @@ -0,0 +1,33 @@ +from geant_service_orchestrator import settings +import requests + + +def get_api_version(oss_params=settings.ANSIBLEParams): + r = requests.get( + f'{oss_params.host}' + f'/api/version' + ) + r.raise_for_status() + + +# +# Some examples I want to keep around for now +# +# +# def next_lag(router_name, oss_params=settings.OSSParams): +# r = requests.post( +# f'{oss_params.RESOURCE_MANAGER_API_PREFIX}' +# f'/api/interfaces/next-lag/{router_name}') +# r.raise_for_status() +# response = r.json() +# return response['name'] +# +# +# def next_physical(router_name, lag_name, oss_params=settings.OSSParams): +# # TODO: speed needed (if first interface) +# r = requests.post( +# f'{oss_params.RESOURCE_MANAGER_API_PREFIX}' +# f'/api/interfaces/next-physical/{router_name}/{lag_name}') +# r.raise_for_status() +# response = r.json() +# return response['name'] diff --git a/geant_service_orchestrator/settings.py b/geant_service_orchestrator/settings.py index a0c79368c937971dccf06b8cafdeb927d7cad62c..bb586da69527e59d2b40fa88d052f25cc5b55401 100644 --- a/geant_service_orchestrator/settings.py +++ b/geant_service_orchestrator/settings.py @@ -33,9 +33,16 @@ class IPAMParams(BaseSettings): GEANT_IP: ServiceNetworkParams +class ANSIBLEParams(BaseSettings): + host: str + auth: str # FIXME: unfinished + api_version: int + + class OSSParams(BaseSettings): IPAM: IPAMParams RESOURCE_MANAGER_API_PREFIX: str # api prefix + ANSIBLE: ANSIBLEParams def load_oss_params() -> OSSParams: