Loading src/service/service/service_handlers/l3nm_ncefan/ConfigRules.py +19 −1 Original line number Diff line number Diff line Loading @@ -107,14 +107,32 @@ def setup_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]: def teardown_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]: app_flow_id : str = json_settings["app_flow_id"] application_name : str = f"App_Flow_{app_flow_id}" app_flow_name : str = f"App_Flow_{app_flow_id}" qos_profile_name : str = json_settings.get("app_flow_qos_profile", "AR_VR_Gaming") app_flow = {"name": app_flow_name } qos_profile = {"name": qos_profile_name} application = {"name": application_name} app_flow_datamodel = { "huawei-nce-app-flow:app-flows": { "app-flow": [app_flow], "qos-profiles": {"qos-profile": [qos_profile]}, "applications": {"application": [application]}, } } json_config_rules = [ json_config_rule_delete( "/service[{:s}]/AppFlow".format(service_uuid), {}, app_flow_datamodel ), json_config_rule_delete( "/service[{:s}]/AppFlow/operation".format(service_uuid), {}, ), ] return json_config_rules src/service/service/service_handlers/l3nm_ncefan/L3NM_NCEFAN_ServiceHandler.py +43 −4 Original line number Diff line number Diff line Loading @@ -480,12 +480,51 @@ class L3NM_NCEFAN_ServiceHandler(_ServiceHandler): service_uuid = self.__service.service_id.service_uuid.uuid results = [] try: context_client = ContextClient() service_config = self.__service.service_config src_device_uuid, src_endpoint_uuid = get_device_endpoint_uuids(endpoints[0]) src_device_obj = self.__task_executor.get_device( DeviceId(**json_device_id(src_device_uuid)) ) src_device_obj = self.__task_executor.get_device(DeviceId(**json_device_id(src_device_uuid))) controller = self.__task_executor.get_device_controller(src_device_obj) json_config_rules = teardown_config_rules(service_uuid, {}) list_devices = context_client.ListDevices(Empty()) devices = list_devices.devices device_name_map = {d.name: d for d in devices} running_ietf_slice_cr = get_custom_config_rule( service_config, RUNNING_RESOURCE_KEY ) running_resource_value_dict = json.loads( running_ietf_slice_cr.custom.resource_value ) slice_service = running_resource_value_dict["network-slice-services"][ "slice-service" ][0] service_name = slice_service["id"] sdps = slice_service["sdps"]["sdp"] sdp_ids = [sdp["id"] for sdp in sdps] for sdp in sdps: node_id = sdp["node-id"] device_obj = device_name_map[node_id] device_controller = self.__task_executor.get_device_controller( device_obj ) if ( device_controller is None or controller.name != device_controller.name ): continue src_sdp_idx = sdp_ids.pop(sdp_ids.index(sdp["id"])) dst_sdp_idx = sdp_ids[0] break else: raise Exception("connection group id not found") resource_value_dict = { "app_flow_id": f"{src_sdp_idx}_{dst_sdp_idx}_{service_name}", } json_config_rules = teardown_config_rules(service_uuid, resource_value_dict) if len(json_config_rules) > 0: del controller.device_config.config_rules[:] for json_config_rule in json_config_rules: Loading Loading
src/service/service/service_handlers/l3nm_ncefan/ConfigRules.py +19 −1 Original line number Diff line number Diff line Loading @@ -107,14 +107,32 @@ def setup_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]: def teardown_config_rules(service_uuid: str, json_settings: Dict) -> List[Dict]: app_flow_id : str = json_settings["app_flow_id"] application_name : str = f"App_Flow_{app_flow_id}" app_flow_name : str = f"App_Flow_{app_flow_id}" qos_profile_name : str = json_settings.get("app_flow_qos_profile", "AR_VR_Gaming") app_flow = {"name": app_flow_name } qos_profile = {"name": qos_profile_name} application = {"name": application_name} app_flow_datamodel = { "huawei-nce-app-flow:app-flows": { "app-flow": [app_flow], "qos-profiles": {"qos-profile": [qos_profile]}, "applications": {"application": [application]}, } } json_config_rules = [ json_config_rule_delete( "/service[{:s}]/AppFlow".format(service_uuid), {}, app_flow_datamodel ), json_config_rule_delete( "/service[{:s}]/AppFlow/operation".format(service_uuid), {}, ), ] return json_config_rules
src/service/service/service_handlers/l3nm_ncefan/L3NM_NCEFAN_ServiceHandler.py +43 −4 Original line number Diff line number Diff line Loading @@ -480,12 +480,51 @@ class L3NM_NCEFAN_ServiceHandler(_ServiceHandler): service_uuid = self.__service.service_id.service_uuid.uuid results = [] try: context_client = ContextClient() service_config = self.__service.service_config src_device_uuid, src_endpoint_uuid = get_device_endpoint_uuids(endpoints[0]) src_device_obj = self.__task_executor.get_device( DeviceId(**json_device_id(src_device_uuid)) ) src_device_obj = self.__task_executor.get_device(DeviceId(**json_device_id(src_device_uuid))) controller = self.__task_executor.get_device_controller(src_device_obj) json_config_rules = teardown_config_rules(service_uuid, {}) list_devices = context_client.ListDevices(Empty()) devices = list_devices.devices device_name_map = {d.name: d for d in devices} running_ietf_slice_cr = get_custom_config_rule( service_config, RUNNING_RESOURCE_KEY ) running_resource_value_dict = json.loads( running_ietf_slice_cr.custom.resource_value ) slice_service = running_resource_value_dict["network-slice-services"][ "slice-service" ][0] service_name = slice_service["id"] sdps = slice_service["sdps"]["sdp"] sdp_ids = [sdp["id"] for sdp in sdps] for sdp in sdps: node_id = sdp["node-id"] device_obj = device_name_map[node_id] device_controller = self.__task_executor.get_device_controller( device_obj ) if ( device_controller is None or controller.name != device_controller.name ): continue src_sdp_idx = sdp_ids.pop(sdp_ids.index(sdp["id"])) dst_sdp_idx = sdp_ids[0] break else: raise Exception("connection group id not found") resource_value_dict = { "app_flow_id": f"{src_sdp_idx}_{dst_sdp_idx}_{service_name}", } json_config_rules = teardown_config_rules(service_uuid, resource_value_dict) if len(json_config_rules) > 0: del controller.device_config.config_rules[:] for json_config_rule in json_config_rules: Loading