Skip to content
Snippets Groups Projects

Resolve "Improve common framework to identify deployed components"

7 files
+ 91
45
Compare changes
  • Side-by-side
  • Inline
Files
7
+ 18
0
@@ -108,3 +108,21 @@ def get_grpc_grace_period():
@@ -108,3 +108,21 @@ def get_grpc_grace_period():
def get_http_bind_address():
def get_http_bind_address():
return get_setting(ENVVAR_HTTP_BIND_ADDRESS, default=DEFAULT_HTTP_BIND_ADDRESS)
return get_setting(ENVVAR_HTTP_BIND_ADDRESS, default=DEFAULT_HTTP_BIND_ADDRESS)
 
 
 
##### ----- Detect deployed microservices ----- #####
 
 
def is_microservice_deployed(service_name : ServiceNameEnum) -> bool:
 
host_env_var_name = get_env_var_name(service_name, ENVVAR_SUFIX_SERVICE_HOST )
 
port_env_var_name = get_env_var_name(service_name, ENVVAR_SUFIX_SERVICE_PORT_GRPC)
 
return (host_env_var_name in os.environ) and (port_env_var_name in os.environ)
 
 
def is_deployed_bgpls () -> bool: return is_microservice_deployed(ServiceNameEnum.BGPLS )
 
def is_deployed_e2e_orch () -> bool: return is_microservice_deployed(ServiceNameEnum.E2EORCHESTRATOR )
 
def is_deployed_forecaster() -> bool: return is_microservice_deployed(ServiceNameEnum.FORECASTER )
 
def is_deployed_load_gen () -> bool: return is_microservice_deployed(ServiceNameEnum.LOAD_GENERATOR )
 
def is_deployed_optical () -> bool: return is_microservice_deployed(ServiceNameEnum.OPTICALCONTROLLER)
 
def is_deployed_policy () -> bool: return is_microservice_deployed(ServiceNameEnum.POLICY )
 
def is_deployed_qkd_app () -> bool: return is_microservice_deployed(ServiceNameEnum.QKD_APP )
 
def is_deployed_slice () -> bool: return is_microservice_deployed(ServiceNameEnum.SLICE )
 
def is_deployed_te () -> bool: return is_microservice_deployed(ServiceNameEnum.TE )
Loading