Update AAI plugin for NSSI selection 09/120309/2
authorkrishnaa96 <krishna.moorthy6@wipro.com>
Thu, 8 Apr 2021 09:42:52 +0000 (15:12 +0530)
committerkrishnaa96 <krishna.moorthy6@wipro.com>
Mon, 12 Apr 2021 12:33:27 +0000 (18:03 +0530)
Slice profiles are related to NSSI directly
as service-instance instead of allotted
resource

Issue-ID: OPTFRA-937
Signed-off-by: krishnaa96 <krishna.moorthy6@wipro.com>
Change-Id: I7ffc948b66f13fb7813acbb4151575c838e50141

conductor/conductor/data/plugins/inventory_provider/aai.py
conductor/conductor/data/plugins/inventory_provider/utils/aai_utils.py
conductor/conductor/tests/functional/simulators/aaisim/responses/get_nssi_response.json

index fd5ca3f..93b0a3b 100644 (file)
@@ -1917,7 +1917,9 @@ class AAI(base.InventoryProviderBase):
         return candidates
 
     def get_profile_instances(self, nxi_instance):
-        related_nodes = self._get_aai_rel_link_data(nxi_instance, "allotted-resource",
+        slice_role = nxi_instance['service-role']
+        related_key = "allotted-resource" if slice_role == 'nsi' else 'service-instance'
+        related_nodes = self._get_aai_rel_link_data(nxi_instance, related_key,
                                                     "service-instance.service-instance-id")
         profile_instances = []
         for node in related_nodes:
index 4c6accc..c88b459 100644 (file)
@@ -99,4 +99,4 @@ def get_model_ver_info(model_version):
 
 def get_profiles(profile_instances, profile_type):
     profile_type_plural = profile_type + 's'
-    return [x[profile_type_plural][profile_type][0] for x in profile_instances]
+    return [x[profile_type_plural][profile_type][0] for x in profile_instances if x.get(profile_type_plural)]
index 0e76264..bab57df 100644 (file)
@@ -36,7 +36,7 @@
                     }
                 ]
             }, {
-      "related-to": "allotted-resource",
+      "related-to": "service-instance",
       "relationship-label": "org.onap.relationships.inventory.Uses",
       "related-link": "/aai/v21/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/1c7046f2-a5a3-4d7f-9da8-388ee641a795/allotted-resources/allotted-resource/462e46c2-cd84-45e4-a6c1-77f4ef88328d",
       "relationship-data": [{