Loading src/service/service/ServiceServiceServicerImpl.py +2 −17 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ from .tools.GeodesicDistance import gps_distance from .tools.OpticalTools import ( add_flex_lightpath, add_lightpath, delete_lightpath, adapt_reply, get_device_name_from_uuid, get_optical_band, refresh_opticalcontroller, DelFlexLightpath , extend_optical_band, reconfig_flex_lightpath, adapt_reply_ob, add_alien_flex_lightpath reconfig_flex_lightpath, adapt_reply_ob, add_alien_flex_lightpath, load_opticalcontroller_reply ) from .tools.OpticalSpectrumReservation import parse_optical_spectrum_reservation_constraints Loading @@ -55,21 +55,6 @@ LOGGER = logging.getLogger(__name__) METRICS_POOL = MetricsPool('Service', 'RPC') def _load_opticalcontroller_reply(reply_txt : str) -> Dict: try: reply_json = json.loads(reply_txt) except json.JSONDecodeError as exc: raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) from exc if not isinstance(reply_json, dict): raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) return reply_json class ServiceServiceServicerImpl(ServiceServiceServicer): def __init__(self, service_handler_factory : ServiceHandlerFactory) -> None: Loading Loading @@ -375,7 +360,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ) if reply_txt is None: return service_with_uuids.service_id reply_json = _load_opticalcontroller_reply(reply_txt) reply_json = load_opticalcontroller_reply(reply_txt) LOGGER.debug('[optical] reply_json[{:s}]={:s}'.format(str(type(reply_json)), str(reply_json))) optical_band_txt = "" Loading src/service/service/tools/OpticalTools.py +16 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ import functools, json, logging, requests, uuid from typing import Dict, List, Optional, Tuple from urllib.parse import urlencode from common.method_wrappers.ServiceExceptions import NotFoundException from common.method_wrappers.ServiceExceptions import NotFoundException, OperationFailedException from common.proto.context_pb2 import( ConfigActionEnum, ConfigRule, ConfigRule_Custom, Connection, ContextId, Device, DeviceId, Empty, EndPointId, OpticalBand, OpticalBandId, OpticalBandList, Loading @@ -42,6 +42,21 @@ LOGGER = logging.getLogger(__name__) TESTING = False def load_opticalcontroller_reply(reply_txt : str) -> Dict: try: reply_json = json.loads(reply_txt) except json.JSONDecodeError as exc: raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) from exc if not isinstance(reply_json, dict): raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) return reply_json get_optical_controller_setting = functools.partial(get_env_var_name, ServiceNameEnum.OPTICALCONTROLLER) VAR_NAME_OPTICAL_CTRL_BASEURL_HTTP = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_BASEURL_HTTP) VAR_NAME_OPTICAL_CTRL_SCHEMA = get_optical_controller_setting('SCHEMA') Loading Loading
src/service/service/ServiceServiceServicerImpl.py +2 −17 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ from .tools.GeodesicDistance import gps_distance from .tools.OpticalTools import ( add_flex_lightpath, add_lightpath, delete_lightpath, adapt_reply, get_device_name_from_uuid, get_optical_band, refresh_opticalcontroller, DelFlexLightpath , extend_optical_band, reconfig_flex_lightpath, adapt_reply_ob, add_alien_flex_lightpath reconfig_flex_lightpath, adapt_reply_ob, add_alien_flex_lightpath, load_opticalcontroller_reply ) from .tools.OpticalSpectrumReservation import parse_optical_spectrum_reservation_constraints Loading @@ -55,21 +55,6 @@ LOGGER = logging.getLogger(__name__) METRICS_POOL = MetricsPool('Service', 'RPC') def _load_opticalcontroller_reply(reply_txt : str) -> Dict: try: reply_json = json.loads(reply_txt) except json.JSONDecodeError as exc: raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) from exc if not isinstance(reply_json, dict): raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) return reply_json class ServiceServiceServicerImpl(ServiceServiceServicer): def __init__(self, service_handler_factory : ServiceHandlerFactory) -> None: Loading Loading @@ -375,7 +360,7 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ) if reply_txt is None: return service_with_uuids.service_id reply_json = _load_opticalcontroller_reply(reply_txt) reply_json = load_opticalcontroller_reply(reply_txt) LOGGER.debug('[optical] reply_json[{:s}]={:s}'.format(str(type(reply_json)), str(reply_json))) optical_band_txt = "" Loading
src/service/service/tools/OpticalTools.py +16 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ import functools, json, logging, requests, uuid from typing import Dict, List, Optional, Tuple from urllib.parse import urlencode from common.method_wrappers.ServiceExceptions import NotFoundException from common.method_wrappers.ServiceExceptions import NotFoundException, OperationFailedException from common.proto.context_pb2 import( ConfigActionEnum, ConfigRule, ConfigRule_Custom, Connection, ContextId, Device, DeviceId, Empty, EndPointId, OpticalBand, OpticalBandId, OpticalBandList, Loading @@ -42,6 +42,21 @@ LOGGER = logging.getLogger(__name__) TESTING = False def load_opticalcontroller_reply(reply_txt : str) -> Dict: try: reply_json = json.loads(reply_txt) except json.JSONDecodeError as exc: raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) from exc if not isinstance(reply_json, dict): raise OperationFailedException( 'optical-controller-reply', extra_details='reply={:s}'.format(str(reply_txt)) ) return reply_json get_optical_controller_setting = functools.partial(get_env_var_name, ServiceNameEnum.OPTICALCONTROLLER) VAR_NAME_OPTICAL_CTRL_BASEURL_HTTP = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_BASEURL_HTTP) VAR_NAME_OPTICAL_CTRL_SCHEMA = get_optical_controller_setting('SCHEMA') Loading