diff options
Diffstat (limited to 'mso-api-handlers')
5 files changed, 54 insertions, 41 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index e11fbb8c25..9159bb2a52 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -3,13 +3,13 @@ <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-api-handlers</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-api-handler-common</artifactId> <name>ECOMP MSO API Handler common</name> @@ -73,13 +73,13 @@ </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-requests-db</artifactId> <version>${project.version}</version> </dependency> diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 71f8249546..2eb5f1e185 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-api-handlers</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> @@ -68,22 +68,22 @@ </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-requests-db</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-api-handler-common</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>status-control</artifactId> <version>${project.version}</version> </dependency> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index 317859da0e..988d72cc6f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -654,33 +654,35 @@ public class ServiceInstances { // SERVICE REQUEST // Construct the default service name // TODO need to make this a configurable property - String defaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + String sourceDefaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + String defaultService = "*"; Service serviceRecord = null; - if(msoRequest.getALaCarteFlag()){ - serviceRecord = db.getServiceByName(defaultServiceName); - }else{ - serviceRecord = db.getServiceByVersionAndInvariantId(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion()); - } int serviceId; ServiceRecipe recipe = null; - if(serviceRecord !=null){ - serviceId = serviceRecord.getId(); - recipe = db.getServiceRecipe(serviceId, action.name()); + + //if an aLaCarte flag was Not sent in the request, look first if there is a custom recipe for the specific model version + if(!msoRequest.getALaCarteFlag()){ + serviceRecord = db.getServiceByVersionAndInvariantId(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion()); + if(serviceRecord !=null){ + serviceId = serviceRecord.getId(); + recipe = db.getServiceRecipe(serviceId, action.name()); + } } - //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found - RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters(); - if(reqParam!=null && reqParam.isALaCarteSet() && recipe==null){ - return null; - }else if (recipe == null) { //aLaCarte wasn't sent, so we'll try the default - serviceRecord = db.getServiceByName(defaultServiceName); - serviceId = serviceRecord.getId(); - recipe = db.getServiceRecipe(serviceId, action.name()); + + if (recipe == null) { + //find source(initiator) default recipe + recipe = db.getServiceRecipeByServiceNameAndAction(sourceDefaultServiceName, action.name()); + } + if (recipe == null) { + //find default recipe + recipe = db.getServiceRecipeByServiceNameAndAction(defaultService, action.name()); } if(recipe==null){ return null; } return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } @@ -787,27 +789,38 @@ public class ServiceInstances { private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + String sourceDefaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + String defaultNetworkType = "*"; String modelName = msoRequest.getModelInfo().getModelName(); Recipe recipe = null; - if(msoRequest.getALaCarteFlag()){ - recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); - }else{ + //if an aLaCarte flag was Not sent in the request, look first if there is a custom recipe for the specific ModelCustomizationId + if(!msoRequest.getALaCarteFlag()){ + String networkType = null; + if(msoRequest.getModelInfo().getModelCustomizationId()!=null){ NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(msoRequest.getModelInfo().getModelCustomizationId()); if(networkResource!=null){ - recipe = db.getNetworkRecipe(networkResource.getNetworkType(), action.name()); + networkType = networkResource.getNetworkType(); }else{ throw new ValidationException("no catalog entry found"); } }else{ //ok for version < 3 - recipe = db.getNetworkRecipe(modelName, action.name()); - } - if(recipe == null){ - recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); + networkType = modelName; } + + //find latest version Recipe for the given networkType and action + recipe = db.getNetworkRecipe(networkType, action.name()); + } + + if(recipe == null){ + //find source(initiator) default recipe + recipe = db.getNetworkRecipe(sourceDefaultNetworkType, action.name()); + } + if(recipe == null){ + //find default recipe + recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); } if (recipe == null) { return null; diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml index 63520f065b..ef69e8acb1 100644 --- a/mso-api-handlers/mso-requests-db/pom.xml +++ b/mso-api-handlers/mso-requests-db/pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-api-handlers</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> @@ -97,7 +97,7 @@ <version>1.0.0.Final</version> </dependency> <dependency> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>common</artifactId> <version>${project.version}</version> </dependency> diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index 23f7be3f04..c4e1bbb50d 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -2,12 +2,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.openecomp</groupId> - <artifactId>mso</artifactId> + <groupId>org.openecomp.so</groupId> + <artifactId>so</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> - <groupId>org.openecomp.mso</groupId> + <groupId>org.openecomp.so</groupId> <artifactId>mso-api-handlers</artifactId> <name>API Handler</name> <description>API Handler for MSO</description> @@ -35,4 +35,4 @@ <artifactId>httpclient</artifactId> </dependency> </dependencies> -</project>
\ No newline at end of file +</project> |