Add nsi info in the nsi selection response 27/106727/1
authorkrishnaa96 <krishna.moorthy6@wipro.com>
Tue, 28 Apr 2020 07:19:39 +0000 (12:49 +0530)
committerkrishnaa96 <krishna.moorthy6@wipro.com>
Tue, 28 Apr 2020 07:20:50 +0000 (12:50 +0530)
Issue-ID: OPTFRA-746
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: I799c9575b781d858b47e6695050f7f79308fdd43

apps/slice_selection/optimizers/conductor/response_processor.py
test/apps/slice_selection/new_solution_conductor_response.json
test/apps/slice_selection/shared_solution_conductor_response.json
test/apps/slice_selection/shared_solution_nsi_response.json

index 5b7be01..a841cb5 100644 (file)
@@ -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)
index 39fef7b..fea3544 100644 (file)
@@ -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
+}
index 5bccd44..13ea29c 100644 (file)
@@ -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
+}
index b0c0e2a..5c94914 100644 (file)
@@ -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
+}