From e87411e6df60a0ead2f90c6975b5cea8ba1db20d Mon Sep 17 00:00:00 2001 From: krishnaa96 Date: Tue, 28 Apr 2020 12:49:39 +0530 Subject: Add nsi info in the nsi selection response Issue-ID: OPTFRA-746 Signed-off-by: krishnaa96 Change-Id: I799c9575b781d858b47e6695050f7f79308fdd43 --- .../optimizers/conductor/response_processor.py | 13 +++++++++---- .../slice_selection/new_solution_conductor_response.json | 8 +++++++- .../slice_selection/shared_solution_conductor_response.json | 8 +++++++- test/apps/slice_selection/shared_solution_nsi_response.json | 7 +++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/apps/slice_selection/optimizers/conductor/response_processor.py b/apps/slice_selection/optimizers/conductor/response_processor.py index 5b7be01..a841cb5 100644 --- a/apps/slice_selection/optimizers/conductor/response_processor.py +++ b/apps/slice_selection/optimizers/conductor/response_processor.py @@ -43,12 +43,17 @@ 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') 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..5c94914 100644 --- a/test/apps/slice_selection/shared_solution_nsi_response.json +++ b/test/apps/slice_selection/shared_solution_nsi_response.json @@ -6,11 +6,14 @@ "solutions":{ "sharedNSISolutions":[ { - "NSIName":"nsi_test_0212" + "NSIName":"nsi_test_0212", + "NSIId":"7ecdfb7a-bc38-4abd-9cb3-6677d71e892f", + "UUID":"c3d8a690-f138-4554-89af-9349aeb9b19a", + "invariantUUID":"590b9fcf-6927-495e-a898-a1418dd4820c" } ], "newNSISolutions":[ ] } -} \ No newline at end of file +} -- cgit 1.2.3-korg