diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-02-22 05:10:53 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-02-22 05:10:53 +0000 |
commit | cd2da745c3c67c9ed7db80e28e7c1dbf967eefc4 (patch) | |
tree | 1510ee63dbd3073aebaf603b706e5037d52a39f3 /mso-api-handlers/mso-api-handler-infra/src/main/java/org | |
parent | 105a61a957b627fe23d0d5f9dba4b5e6d9f1567c (diff) | |
parent | 7c0e474d487b0e6aa49956efebcabb5122fc38f6 (diff) |
Merge "Select recipe for create service"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java/org')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index f6b30e8772..403e9407a6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -243,7 +243,8 @@ public class E2EServiceInstances { RecipeLookupResult recipeLookupResult = null; try { db = CatalogDatabase.getInstance(); - recipeLookupResult = getServiceInstanceOrchestrationURI(db, action); + //TODO Get the service template model version uuid from AAI. + recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action); } catch (Exception e) { msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", @@ -474,7 +475,7 @@ public class E2EServiceInstances { RecipeLookupResult recipeLookupResult = null; try { db = CatalogDatabase.getInstance(); - recipeLookupResult = getServiceInstanceOrchestrationURI(db, action); + recipeLookupResult = getServiceInstanceOrchestrationURI(db, e2eSir.getService().getTemplateId(), action); } catch (Exception e) { msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); @@ -669,14 +670,15 @@ public class E2EServiceInstances { /** * Getting recipes from catalogDb * - * @param db - * @param action - * @return + * @param db the catalog db + * @param serviceModelUUID the service model version uuid + * @param action the action for the service + * @return the service recipe result */ private RecipeLookupResult getServiceInstanceOrchestrationURI( - CatalogDatabase db, Action action) { + CatalogDatabase db, String serviceModelUUID, Action action) { - RecipeLookupResult recipeLookupResult = getServiceURI(db, action); + RecipeLookupResult recipeLookupResult = getServiceURI(db, serviceModelUUID, action); if (recipeLookupResult != null) { msoLogger.debug("Orchestration URI is: " @@ -691,20 +693,32 @@ public class E2EServiceInstances { /** * Getting recipes from catalogDb - * - * @param db - * @param action - * @return + * If Service recipe is not set, use default recipe, if set , use special recipe. + * @param db the catalog db + * @param serviceModelUUID the service version uuid + * @param action the action of the service. + * @return the service recipe result. */ - private RecipeLookupResult getServiceURI(CatalogDatabase db, Action action) { + private RecipeLookupResult getServiceURI(CatalogDatabase db, String serviceModelUUID, Action action) { String defaultServiceModelName = "UUI_DEFAULT"; - Service serviceRecord = db + Service defaultServiceRecord = db .getServiceByModelName(defaultServiceModelName); - ServiceRecipe recipe = db.getServiceRecipeByModelUUID( - serviceRecord.getModelUUID(), action.name()); - + ServiceRecipe defaultRecipe = db.getServiceRecipeByModelUUID( + defaultServiceRecord.getModelUUID(), action.name()); + //set recipe as default generic recipe + ServiceRecipe recipe = defaultRecipe; + //check the service special recipe + if(null != serviceModelUUID && ! serviceModelUUID.isEmpty()){ + ServiceRecipe serviceSpecialRecipe = db.getServiceRecipeByModelUUID( + serviceModelUUID, action.name()); + if(null != serviceSpecialRecipe){ + //set service special recipe. + recipe = serviceSpecialRecipe; + } + } + if (recipe == null) { return null; } |