summaryrefslogtreecommitdiffstats
path: root/conductor
diff options
context:
space:
mode:
authorkrishnaa96 <krishna.moorthy6@wipro.com>2021-04-08 15:12:52 +0530
committerkrishnaa96 <krishna.moorthy6@wipro.com>2021-04-12 18:03:27 +0530
commitee7f623ef6b19a95f7b3316e497317b8e773a000 (patch)
treec74968f87338b1c5db80041b3a7b44a09c7b6c99 /conductor
parent1a15ae246b3896b183d648a3c855f0f13ff01bcf (diff)
Update AAI plugin for NSSI selection
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
Diffstat (limited to 'conductor')
-rw-r--r--conductor/conductor/data/plugins/inventory_provider/aai.py4
-rw-r--r--conductor/conductor/data/plugins/inventory_provider/utils/aai_utils.py2
-rw-r--r--conductor/conductor/tests/functional/simulators/aaisim/responses/get_nssi_response.json2
3 files changed, 5 insertions, 3 deletions
diff --git a/conductor/conductor/data/plugins/inventory_provider/aai.py b/conductor/conductor/data/plugins/inventory_provider/aai.py
index fd5ca3f..93b0a3b 100644
--- a/conductor/conductor/data/plugins/inventory_provider/aai.py
+++ b/conductor/conductor/data/plugins/inventory_provider/aai.py
@@ -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:
diff --git a/conductor/conductor/data/plugins/inventory_provider/utils/aai_utils.py b/conductor/conductor/data/plugins/inventory_provider/utils/aai_utils.py
index 4c6accc..c88b459 100644
--- a/conductor/conductor/data/plugins/inventory_provider/utils/aai_utils.py
+++ b/conductor/conductor/data/plugins/inventory_provider/utils/aai_utils.py
@@ -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)]
diff --git a/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nssi_response.json b/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nssi_response.json
index 0e76264..bab57df 100644
--- a/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nssi_response.json
+++ b/conductor/conductor/tests/functional/simulators/aaisim/responses/get_nssi_response.json
@@ -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": [{