aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrishnaa96 <krishna.moorthy6@wipro.com>2020-04-28 12:49:39 +0530
committerkrishnaa96 <krishna.moorthy6@wipro.com>2020-04-28 12:50:50 +0530
commite87411e6df60a0ead2f90c6975b5cea8ba1db20d (patch)
tree9fcc347572a3f25aa7a4252eb765cf72469955e9
parentd4a0085a8f75c62912d19613459ad1bc3dce3e73 (diff)
Add nsi info in the nsi selection response
Issue-ID: OPTFRA-746 Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com> Change-Id: I799c9575b781d858b47e6695050f7f79308fdd43
-rw-r--r--apps/slice_selection/optimizers/conductor/response_processor.py13
-rw-r--r--test/apps/slice_selection/new_solution_conductor_response.json8
-rw-r--r--test/apps/slice_selection/shared_solution_conductor_response.json8
-rw-r--r--test/apps/slice_selection/shared_solution_nsi_response.json7
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
+}