diff options
7 files changed, 168 insertions, 65 deletions
diff --git a/apps/nst/optimizers/conf/configIinputs.json b/apps/nst/optimizers/conf/configIinputs.json index 59fd5ed..d4140f9 100644 --- a/apps/nst/optimizers/conf/configIinputs.json +++ b/apps/nst/optimizers/conf/configIinputs.json @@ -1,11 +1,31 @@ { "NST": [{ "NST1 ": { - "name": "NST_1", - "id": "NST_1_id", - "latency": 5, + "name": "EmbbNst", + "id": "EmbbNst_1", + "latency": 20, "uplink": 5, - "downlink": 8 + "downlink": 8, + "reliability": 95, + "areaTrafficCapDL": 10, + "areaTrafficCapUL": 100, + "maxNumberofUEs": 10000, + "areas": " area1|area2", + "expDataRateDL": 10, + "expDataRateUL": 1000, + "uEMobilityLevel": "stationary", + "resourceSharingLevel": "shared", + "skip_post_instantiation_configuration": "true", + "controller_actor": "SO-REF-DATA", + "sNSSAI": "01-3226E7D1", + "plmnIdList": "39-00", + "sST": "embb", + "uEMobilityLevel": "stationary", + "activityFactor": "0", + "coverageAreaTAList": "Beijing;Beijing;HaidanDistrict;WanshouluStreet", + "modeluuid": "fe6c82b9-4e53-4322-a671-e2d8637bfbb7", + "modelinvariantuuid": "7d7df980-cb81-45f8-bad9-4e5ad2876393" + } }, { @@ -14,8 +34,20 @@ "id": "NST_2_id", "latency": 3, "uplink": 7, - "downlink": 1 + "downlink": 1, + "areaTrafficCapDL": 100, + "areaTrafficCapUL": 100, + "maxNumberofUEs": 300, + "areas": " area1|area2", + "expDataRateDL": 10, + "expDataRateUL": 30, + "uEMobilityLevel": "stationary", + "resourceSharingLevel": "shared", + "skip_post_instantiation_configuration": "true", + "controller_actor": "SO-REF-DATA", + "modeluuid": "7981375e-5e0a-4bf5-93fa-f3e3c02f2b15", + "modelinvariantuuid": "087f11b4-aca0-4341-8104-e5bb2b73285g" } } ] -}
\ No newline at end of file +} diff --git a/apps/nst/optimizers/nst_select_processor.py b/apps/nst/optimizers/nst_select_processor.py index c340a90..04d5ba7 100644 --- a/apps/nst/optimizers/nst_select_processor.py +++ b/apps/nst/optimizers/nst_select_processor.py @@ -17,48 +17,45 @@ import json -from osdf.logging.osdf_logging import MH, audit_log +import os +BASE_DIR = os.path.dirname(__file__) """ This application generates NST SELECTION API calls using the information received from SO """ -def buildSolution(request_json): - return { - "NSTsolution" : getNSTSolution(request_json) - } -def getNSTSolution(request_json): -# the file is in the same folder for now will move it to the conf folder o fthe has once its integrated there... - with open('./conf/configIinputs.json', 'r') as openfile: - serviceProfile = request_json["serviceProfile"] - resourceName = "NST" - serviceProfileParameters = serviceProfile["serviceProfileParameters"] - nst_object = json.load(openfile) - foundNst = False - for nst in nst_object[resourceName]: - [(nstName, nstList)] = nst.items() - matchall = False - for constraint_name in serviceProfileParameters: - value = serviceProfileParameters[constraint_name] - constraint_value= nstList[constraint_name] - if constraint_value != value: - matchall = False - break - else: - matchall = True - if matchall: - foundNst = True - NSTName = nstList["name"] - matchlevel = 1 - if not(foundNst): - NSTName = None - matchlevel = 0 - return { - "invariantUUID" : "INvariant UUID", - "UUID" : "uuid", - "NSTName" : NSTName, - "matchLevel" : matchlevel - } +def get_nst_solution(request_json): +# the file is in the same folder for now will move it to the conf folder of the has once its integrated there... + config_input_json = os.path.join(BASE_DIR, 'conf/configIinputs.json') + try: + with open(config_input_json, 'r') as openfile: + serviceProfile = request_json["serviceProfile"] + nstSolutionList = [] + resourceName = "NST" + serviceProfileParameters = serviceProfile["serviceProfileParameters"] + nst_object = json.load(openfile) + for nst in nst_object[resourceName]: + [(nstName, nstList)] = nst.items() + individual_nst = dict() + matchall = False + for constraint_name in serviceProfileParameters: + value = serviceProfileParameters[constraint_name] + constraint_value = nstList.get(constraint_name) + if (not constraint_value): + matchall = False + break + else: + matchall = True + if matchall: + individual_nst["NSTName"] = nstList.get("name") + individual_nst["UUID"] = nstList.get("modeluuid") + individual_nst["invariantUUID"] = nstList.get("modelinvariantuuid") + individual_nst["individual_nst"] = 1 + nstSolutionList.append(individual_nst) + + return nstSolutionList + except Exception as err: + raise err def process_nst_selection( request_json, osdf_config): @@ -68,7 +65,7 @@ def process_nst_selection( request_json, osdf_config): :param osdf_config: Configuration specific to OSDF application (core + deployment) :return: response from NST Opt """ - solution = buildSolution(request_json) + solution = get_nst_solution(request_json) return { "requestId" : request_json['requestInfo']['requestId'], diff --git a/apps/slice_selection/models/api/nsi_selection_response.py b/apps/slice_selection/models/api/nsi_selection_response.py index 9547200..a927efa 100644 --- a/apps/slice_selection/models/api/nsi_selection_response.py +++ b/apps/slice_selection/models/api/nsi_selection_response.py @@ -22,12 +22,21 @@ from schematics.types.compound import ModelType, ListType, DictType # TODO: update osdf.models +class NSSI(OSDFModel): + NSSIId = StringType(required=True) + NSSIName = StringType(required=True) + UUID = StringType(required=True) + invariantUUID = StringType(required=True) + sliceProfile = ListType(DictType(BaseType)) + + class SharedNSISolution(OSDFModel): invariantUUID = StringType(required=True) UUID = StringType(required=True) NSIName = StringType(required=True) NSIId = StringType(required=True) matchLevel = StringType(required=True) + NSSIs = ListType(ModelType(NSSI)) class NSSTInfo(OSDFModel): diff --git a/apps/slice_selection/optimizers/conductor/response_processor.py b/apps/slice_selection/optimizers/conductor/response_processor.py index 5b7be01..c175c1a 100644 --- a/apps/slice_selection/optimizers/conductor/response_processor.py +++ b/apps/slice_selection/optimizers/conductor/response_processor.py @@ -43,12 +43,30 @@ def conductor_response_processor(overall_recommendations, nst_info_map, request_ for nst_name, recommendations in overall_recommendations.items(): for recommendation in recommendations: - nsi_set = set(values['candidate']['nsi_name'] for key, values in recommendation.items()) + nsi_set = set(values['candidate']['nsi_id'] for key, values in recommendation.items()) if len(nsi_set) == 1: - nsi = nsi_set.pop() - debug_log.debug("The NSSIs in the solution belongs to the same NSI {}".format(nsi)) + nsi_id = nsi_set.pop() + candidate = list(recommendation.values())[0]['candidate'] + debug_log.debug("The NSSIs in the solution belongs to the same NSI {}" + .format(nsi_id)) shared_nsi_solution = dict() - shared_nsi_solution["NSIName"] = nsi + shared_nsi_solution["NSIId"] = nsi_id + shared_nsi_solution["NSIName"] = candidate.get('nsi_name') + shared_nsi_solution["UUID"] = candidate.get('nsi_model_version_id') + shared_nsi_solution["invariantUUID"] = candidate.get('nsi_model_invariant_id') + + nssi_info_list = get_nssi_solutions(recommendation) + nssis = list() + for nssi_info in nssi_info_list: + nssi = dict() + nssi["NSSIId"] = nssi_info.get("NSSISolution").get("NSSIId") + nssi["NSSIName"] = nssi_info.get("NSSISolution").get("NSSIName") + nssi["UUID"] = "" + nssi["invariantUUID"] = "" + nssi["sliceProfile"] = [nssi_info.get("sliceProfile")] + nssis.append(nssi) + + shared_nsi_solution["NSSIs"] = nssis shared_nsi_solutions.append(shared_nsi_solution) else: nssi_solutions = get_nssi_solutions(recommendation) diff --git a/test/apps/slice_selection/new_solution_conductor_response.json b/test/apps/slice_selection/new_solution_conductor_response.json index 39fef7b..fea3544 100644 --- a/test/apps/slice_selection/new_solution_conductor_response.json +++ b/test/apps/slice_selection/new_solution_conductor_response.json @@ -44,6 +44,9 @@ "reliability":null, "cost":1.0, "nsi_name":"nsi_test_0211", + "nsi_id": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", + "nsi_model_version_id": "c3d8a690-f138-4554-89af-9349aeb9b19a", + "nsi_model_invariant_id": "590b9fcf-6927-495e-a898-a1418dd4820c", "instance_name":"nssi_test_0211" } }, @@ -77,6 +80,9 @@ "reliability":null, "cost":1.0, "nsi_name":"nsi_test_0212", + "nsi_id": "0cf2caed-c0e2-4a9d-8590-6a871e86f178", + "nsi_model_version_id": "a841af61-3c77-4310-ae63-61e1cbf7fe9b", + "nsi_model_invariant_id": "4e5351fe-0877-4c2e-bf75-ccb149f34a77", "instance_name":"nssi_test_ran_0211" } } @@ -84,4 +90,4 @@ ] } ] -}
\ No newline at end of file +} diff --git a/test/apps/slice_selection/shared_solution_conductor_response.json b/test/apps/slice_selection/shared_solution_conductor_response.json index 5bccd44..13ea29c 100644 --- a/test/apps/slice_selection/shared_solution_conductor_response.json +++ b/test/apps/slice_selection/shared_solution_conductor_response.json @@ -44,6 +44,9 @@ "reliability":null, "cost":1.0, "nsi_name":"nsi_test_0212", + "nsi_id": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", + "nsi_model_version_id": "c3d8a690-f138-4554-89af-9349aeb9b19a", + "nsi_model_invariant_id": "590b9fcf-6927-495e-a898-a1418dd4820c", "instance_name":"nssi_test_0211" } }, @@ -77,6 +80,9 @@ "reliability":null, "cost":1.0, "nsi_name":"nsi_test_0212", + "nsi_id": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", + "nsi_model_version_id": "c3d8a690-f138-4554-89af-9349aeb9b19a", + "nsi_model_invariant_id": "590b9fcf-6927-495e-a898-a1418dd4820c", "instance_name":"nssi_test_ran_0211" } } @@ -84,4 +90,4 @@ ] } ] -}
\ No newline at end of file +} diff --git a/test/apps/slice_selection/shared_solution_nsi_response.json b/test/apps/slice_selection/shared_solution_nsi_response.json index b0c0e2a..2c74196 100644 --- a/test/apps/slice_selection/shared_solution_nsi_response.json +++ b/test/apps/slice_selection/shared_solution_nsi_response.json @@ -1,16 +1,51 @@ { - "requestId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "transactionId":"d290f1ee-6c54-4b01-90e6-d701748f0851", - "requestStatus":"completed", - "statusMessage":"", - "solutions":{ - "sharedNSISolutions":[ - { - "NSIName":"nsi_test_0212" - } - ], - "newNSISolutions":[ - - ] - } -}
\ No newline at end of file + "requestId": "d290f1ee-6c54-4b01-90e6-d701748f0851", + "requestStatus": "completed", + "solutions": { + "newNSISolutions": [], + "sharedNSISolutions": [ + { + "NSIId": "7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", + "NSIName": "nsi_test_0212", + "NSSIs": [ + { + "NSSIId": "1a636c4d-5e76-427e-bfd6-241a947224b0", + "NSSIName": "nssi_test_0211", + "UUID": "", + "invariantUUID": "", + "sliceProfile": [ + { + "coverage_area_ta_list": "[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", + "exp_data_rate_dl": 100, + "exp_data_rate_ul": 100, + "latency": 20, + "resource_sharing_level": "0", + "ue_mobility_level": "stationary" + } + ] + }, + { + "NSSIId": "490c68b0-639c-11ea-bc55-0242ac130003", + "NSSIName": "nssi_test_ran_0211", + "UUID": "", + "invariantUUID": "", + "sliceProfile": [ + { + "coverage_area_ta_list": "[{\"province\":\"??\",\"city\":\"???\",\"county\":\"???\",\"street\":\"?????\"}]", + "exp_data_rate_dl": 100, + "exp_data_rate_ul": 100, + "latency": 15, + "resource_sharing_level": "0", + "ue_mobility_level": "stationary" + } + ] + } + ], + "UUID": "c3d8a690-f138-4554-89af-9349aeb9b19a", + "invariantUUID": "590b9fcf-6927-495e-a898-a1418dd4820c" + } + ] + }, + "statusMessage": "", + "transactionId": "d290f1ee-6c54-4b01-90e6-d701748f0851" +} |