diff options
106 files changed, 2711 insertions, 1711 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java index 2d6d0271f8..445c135dab 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java @@ -127,7 +127,7 @@ public class CloudConfigFactory implements Serializable { * @return true if Properties have been reloaded, false otherwise */ @Schedule(minute = "*/1", hour = "*", persistent = false) - public void reloadCloudConfig () { + public static void reloadCloudConfig () { try { if (!rwl.writeLock ().tryLock () && !rwl.writeLock ().tryLock (30L, TimeUnit.SECONDS)) { diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java index c438d0a277..6862492d7e 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java @@ -143,7 +143,7 @@ public class MsoHeatUtils extends MsoCommonUtils { String tenantId, String stackName, String heatTemplate, - Map <String, ? extends Object> stackInputs, + Map <String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes) throws MsoException { // Just call the new method with the environment & files variable set to null @@ -165,7 +165,7 @@ public class MsoHeatUtils extends MsoCommonUtils { String tenantId, String stackName, String heatTemplate, - Map <String, ? extends Object> stackInputs, + Map <String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes, String environment) throws MsoException { @@ -188,7 +188,7 @@ public class MsoHeatUtils extends MsoCommonUtils { String tenantId, String stackName, String heatTemplate, - Map <String, ? extends Object> stackInputs, + Map <String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes, String environment, @@ -211,7 +211,7 @@ public class MsoHeatUtils extends MsoCommonUtils { String tenantId, String stackName, String heatTemplate, - Map <String, ? extends Object> stackInputs, + Map <String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes, String environment, @@ -275,7 +275,7 @@ public class MsoHeatUtils extends MsoCommonUtils { String tenantId, String stackName, String heatTemplate, - Map <String, ? extends Object> stackInputs, + Map <String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes, String environment, @@ -1240,8 +1240,6 @@ public class MsoHeatUtils extends MsoCommonUtils { final Object obj = JSON_MAPPER.treeToValue(node, Object.class); final String json = JSON_MAPPER.writeValueAsString(obj); return json; - } catch (JsonParseException jpe) { - LOGGER.debug("Error converting json to string " + jpe.getMessage(), jpe); } catch (Exception e) { LOGGER.debug("Error converting json to string " + e.getMessage(), e); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java index f7e67d87f8..75bb00351c 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java @@ -428,8 +428,6 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { final Object obj = JSON_MAPPER.treeToValue(node, Object.class); final String json = JSON_MAPPER.writeValueAsString(obj); return json; - } catch (JsonParseException jpe) { - LOGGER.debug("Error converting json to string " + jpe.getMessage(), jpe); } catch (Exception e) { LOGGER.debug("Error converting json to string " + e.getMessage(), e); } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java index 5c3470acd9..9efaee921f 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java @@ -433,7 +433,7 @@ public class BeanTest { m.invoke(obj); } else if (types.length == 1) { String type = types[0].getTypeName(); - if (type.indexOf("<") != -1) { + if (type.contains("<")) { type = type.substring(0, type.indexOf("<")); } Class paramCls = Class.forName(type); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java index d0d3999cf4..c1c5aee8f1 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java @@ -531,44 +531,43 @@ public class CatalogDbAdapterRest { @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) { int respStatus = HttpStatus.SC_OK; - CatalogDatabase db = CatalogDatabase.getInstance(); - String entity = ""; - try{ - if(rmUuid != null && !"".equals(rmUuid)){ - LOGGER.debug ("Query recipe by resource model uuid: " + rmUuid); - //check vnf and network and ar, the resource could be any resource. - Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action); - if(null == recipe){ - recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action); - } - if(null == recipe){ - recipe = db.getArRecipeByModuleUuid(rmUuid, action); - } - if(recipe != null){ - QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); - entity = resourceRecipe.JSON2(false, false); - } - else{ - respStatus = HttpStatus.SC_NOT_FOUND; - } - }else{ - throw(new Exception("Incoming parameter is null or blank")); - } - LOGGER.debug ("Query recipe exit"); - return Response - .status(respStatus) - .entity(entity) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - }catch(Exception e){ - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) {}) - .build(); - }finally { - db.close(); - } + String entity = ""; + try (CatalogDatabase db = CatalogDatabase.getInstance()) { + if (rmUuid != null && !"".equals(rmUuid)) { + LOGGER.debug("Query recipe by resource model uuid: " + rmUuid); + //check vnf and network and ar, the resource could be any resource. + Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action); + if (null == recipe) { + recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action); + } + if (null == recipe) { + recipe = db.getArRecipeByModuleUuid(rmUuid, action); + } + if (recipe != null) { + QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); + entity = resourceRecipe.JSON2(false, false); + } else { + respStatus = HttpStatus.SC_NOT_FOUND; + } + } else { + throw (new Exception("Incoming parameter is null or blank")); + } + LOGGER.debug("Query recipe exit"); + return Response + .status(respStatus) + .entity(entity) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", + MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), + CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) { + }) + .build(); + } } } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 0b404d76bd..99f6e86b00 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -333,7 +333,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { * * @param serviceId * @param operationId - * @param resourceUUID + * @param resourceTemplateUUID * @return * @throws MsoRequestsDbException * @since ONAP Amsterdam Release @@ -350,7 +350,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { * * @param serviceId * @param operationId - * @param resourceUUID + * @param resourceTemplateUUID * @param operationType * @param resourceInstanceID * @param jobId @@ -363,13 +363,13 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { */ @Override public void updateResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID, - String operType, String resourceInstanceID, String jobId, String status, String progress, + String operationType, String resourceInstanceID, String jobId, String status, String progress, String errorCode, String statusDescription) throws MsoRequestsDbException { ResourceOperationStatus resStatus = new ResourceOperationStatus(); resStatus.setServiceId(serviceId); resStatus.setOperationId(operationId); resStatus.setResourceTemplateUUID(resourceTemplateUUID); - resStatus.setOperType(operType); + resStatus.setOperType(operationType); resStatus.setResourceInstanceID(resourceInstanceID); resStatus.setJobId(jobId); resStatus.setStatus(status); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java index be0466af73..fa257164cf 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java @@ -154,12 +154,7 @@ public abstract class SDNCConnector { LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", ""); return createResponseFromContent(statusCode, statusMessage, responseContent, rt); - } catch (SocketTimeoutException e) { - String errMsg = "Request to SDNC timed out"; - logError(errMsg, e); - return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); - - } catch (ConnectTimeoutException e) { + } catch (SocketTimeoutException | ConnectTimeoutException e) { String errMsg = "Request to SDNC timed out"; logError(errMsg, e); return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java index 48da1aba71..5f779dd085 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java @@ -60,7 +60,7 @@ public class VfcAdapterRest { /** * Create a NS <br> * - * @param servletReq the http request + * @param data the http request * @return * @since ONAP Amsterdam Release */ diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java index 61966d07f2..039c1604ba 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java @@ -20,7 +20,7 @@ package org.openecomp.mso.adapters.vfc.exceptions; -import javax.ws.rs.core.Response;; +import javax.ws.rs.core.Response; public class ApplicationException extends Exception { @@ -39,7 +39,7 @@ public class ApplicationException extends Exception { * </p> * * @param errorCode error status - * @param errorDetail error detail + * @param errorMsg error detail * @since ONAP Amsterdam Release 2017-9-6 */ public ApplicationException(int errorCode, String errorMsg) { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index afee1bbfaa..fcbbf8515a 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -166,12 +166,7 @@ public class RestfulUtil { method = null; return createResponse(statusCode, responseContent); - } catch(SocketTimeoutException e) { - String errMsg = "Request to VFC timed out"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); - - } catch(ConnectTimeoutException e) { + } catch(SocketTimeoutException | ConnectTimeoutException e) { String errMsg = "Request to VFC timed out"; logError(errMsg, e); return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java index c79d09e09a..13727bdc49 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java @@ -47,7 +47,7 @@ public class ValidateUtil { * Assert String parameter.<br/>
*
* @param paramValue parameter data
- * @param name of parameter
+ * @param paramName parameter name
* @since ONAP Amsterdam Release 2017-9-6
*/
public static void assertStringNotNull(String paramValue, String paramName)
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java index 95d3bf610f..759ceedd0f 100644 --- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java @@ -60,7 +60,7 @@ public class VfcAdapterTest { /** * mock get request body <br> * - * @param request + * @param fileName * @return * @since ONAP Amsterdam Release */ @@ -71,7 +71,6 @@ public class VfcAdapterTest { /** * Mock the request body form a file <br> * - * @param fileName * @since ONAP Amsterdam Release */ private void mockRestfulUtil() { diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java index 4842580d85..5c654298fb 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -371,8 +371,9 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { * @param cloudSiteId CLLI code of the cloud site in which to delete * @param tenantId Openstack tenant identifier * @param vnfName VNF Name or Openstack ID + * @param messageId * @param msoRequest Request tracking information for logs - * @param notificationURL the target URL for asynchronous response + * @param notificationUrl the target URL for asynchronous response */ @Override public void deleteVnfA (String cloudSiteId, diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index caab1e31bc..9022c26ccd 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -536,8 +536,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { final Object obj = JSON_MAPPER.treeToValue(node, Object.class); final String json = JSON_MAPPER.writeValueAsString(obj); return json; - } catch (JsonParseException jpe) { - LOGGER.debug("Error converting json to string " + jpe.getMessage(),jpe); } catch (Exception e) { LOGGER.debug("Error converting json to string " + e.getMessage(),e); } diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java index 3452a10db9..2118eec0a5 100755 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java @@ -88,7 +88,7 @@ public interface VduPlugin { String tenantId, String vduInstanceName, VduBlueprint vduBlueprint, - Map <String, ? extends Object> inputs, + Map <String, ?> inputs, String environmentFile, int timeoutMinutes, boolean suppressBackout) @@ -145,7 +145,7 @@ public interface VduPlugin { * @param tenantId The cloud tenant in which to delete the VDU. * @param vduInstanceId The unique id of the deployment to delete. * @param timeoutMinutes Timeout after which the delete action will be cancelled - * @param deleteBlueprint Flag to also delete the blueprint + * @param keepBlueprintLoaded Flag to also delete the blueprint * * @return A VduInfo object, representing the state of the instance just prior to deletion. * @@ -198,7 +198,7 @@ public interface VduPlugin { String tenantId, String vduInstanceId, VduBlueprint vduBlueprint, - Map <String, ? extends Object> inputs, + Map <String, ?> inputs, String environmentFile, int timeoutMinutes) throws MsoException; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java index 4a29c32e28..98a00033f7 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java @@ -66,7 +66,7 @@ public class VduInfoTest { public void testGetOutputs() { Object obj = new Object(); String str = "some text"; - outputs = new HashMap<String, Object>(); + outputs = new HashMap<>(); outputs.put(str, obj); vduInfo.setOutputs(outputs); Assert.assertNotNull(vduInfo.getOutputs()); @@ -78,7 +78,7 @@ public class VduInfoTest { public void testGetInputs() { Object obj = new Object(); String str = "some text"; - inputs = new HashMap<String, Object>(); + inputs = new HashMap<>(); inputs.put(str, obj); vduInfo.setInputs(inputs); Assert.assertNotNull(vduInfo.getInputs()); diff --git a/adapters/pom.xml b/adapters/pom.xml index 6877d76ae3..25346583c1 100644 --- a/adapters/pom.xml +++ b/adapters/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> <name>MSO Adapters</name> <description>Adapters for MSO</description> diff --git a/aria/aria-rest-java-client/pom.xml b/aria/aria-rest-java-client/pom.xml index f35403cf81..0af9923401 100755 --- a/aria/aria-rest-java-client/pom.xml +++ b/aria/aria-rest-java-client/pom.xml @@ -25,7 +25,14 @@ <groupId>aria-client</groupId> <artifactId>aria-client</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> + + <parent> + <groupId>org.onap.so</groupId> + <artifactId>aria</artifactId> + <version>1.2.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> <dependencies> <dependency> diff --git a/aria/pom.xml b/aria/pom.xml index a754d78ed1..95ef93b6c8 100644 --- a/aria/pom.xml +++ b/aria/pom.xml @@ -5,10 +5,12 @@ <groupId>org.onap.so</groupId> <artifactId>so</artifactId> <version>1.2.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> </parent> - <groupId>org.onap.so</groupId> <artifactId>aria</artifactId> + <version>1.2.0-SNAPSHOT</version> + <name>ARIA related artifacts</name> <description>ARIA related artifacts</description> <packaging>pom</packaging> diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index c3add03408..027e470c3c 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>asdc-controller</artifactId> <name>asdc-controller</name> <description>ASDC CLient and Controller</description> diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java index 295dddd53a..430bd10892 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java @@ -78,7 +78,7 @@ public class ASDCGlobalController { /** * Check that controllers list needs to be updated or not. - * @param return true if the list has been updated + * return true if the list has been updated */ private boolean updateControllersListIfNeeded () { boolean updateNeeded=false; diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java index f22debce1e..8c08d3eb26 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java @@ -419,39 +419,34 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
logger.debug("vfGroups:" + vfGroups.toString());
- Collections.sort(vfGroups, new Comparator<org.openecomp.sdc.toscaparser.api.Group>() {
-
- @Override
- public int compare(org.openecomp.sdc.toscaparser.api.Group group1,
- org.openecomp.sdc.toscaparser.api.Group group2) {
-
- // Field name1Field = group1.class.getDeclaredField("name");
- // name1Field.setAccessible(true);
- String thisName = group1.getName(); // (String)
- // name1Field.get(group1);
- String thatName = group2.getName(); // (String)
- // name1Field.get(group2);
-
- Matcher m = lastDigit.matcher(thisName);
- Matcher m2 = lastDigit.matcher(thatName);
-
- String thisDigit = "0";
- String thatDigit = "0";
- if(m.find()) {
- thisDigit = m.group();
- } else {
- return -1;
- }
- if(m2.find()) {
- thatDigit = m2.group();
- } else {
- return 1;
- }
+ vfGroups.sort((group1, group2) -> {
+
+ // Field name1Field = group1.class.getDeclaredField("name");
+ // name1Field.setAccessible(true);
+ String thisName = group1.getName(); // (String)
+ // name1Field.get(group1);
+ String thatName = group2.getName(); // (String)
+ // name1Field.get(group2);
+
+ Matcher m = lastDigit.matcher(thisName);
+ Matcher m2 = lastDigit.matcher(thatName);
+
+ String thisDigit = "0";
+ String thatDigit = "0";
+ if (m.find()) {
+ thisDigit = m.group();
+ } else {
+ return -1;
+ }
+ if (m2.find()) {
+ thatDigit = m2.group();
+ } else {
+ return 1;
+ }
- return new Integer(thisDigit).compareTo(new Integer(thatDigit));
+ return new Integer(thisDigit).compareTo(new Integer(thatDigit));
- }
- });
+ });
logger.debug("vfGroupsAfter:" + vfGroups.toString());
@@ -878,7 +873,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID();
- if(vfModuleModelUUID != null && vfModuleModelUUID.indexOf(".") > -1){
+ if(vfModuleModelUUID != null && vfModuleModelUUID.contains(".")){
vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf("."));
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java index 2080be137c..396784add4 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java @@ -42,51 +42,15 @@ public class ASDCNotificationLogging { if (asdcNotification == null) { return "NULL"; } - StringBuilder buffer = new StringBuilder("ASDC Notification:"); - buffer.append(System.lineSeparator()); - - buffer.append("DistributionID:"); - buffer.append(testNull(asdcNotification.getDistributionID())); - buffer.append(System.lineSeparator()); - - - buffer.append("ServiceName:"); - buffer.append(testNull(asdcNotification.getServiceName())); - buffer.append(System.lineSeparator()); - - - buffer.append("ServiceVersion:"); - buffer.append(testNull(asdcNotification.getServiceVersion())); - buffer.append(System.lineSeparator()); - - - buffer.append("ServiceUUID:"); - buffer.append(testNull(asdcNotification.getServiceUUID())); - buffer.append(System.lineSeparator()); - - - buffer.append("ServiceInvariantUUID:"); - buffer.append(testNull(asdcNotification.getServiceInvariantUUID())); - buffer.append(System.lineSeparator()); - - - buffer.append("ServiceDescription:"); - buffer.append(testNull(asdcNotification.getServiceDescription())); - buffer.append(System.lineSeparator()); - - - buffer.append("Service Artifacts List:"); - buffer.append(System.lineSeparator()); - buffer.append(testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts()))); - buffer.append(System.lineSeparator()); - - buffer.append("Resource Instances List:"); - buffer.append(System.lineSeparator()); - buffer.append(testNull(dumpASDCResourcesList(asdcNotification))); - buffer.append(System.lineSeparator()); - - - return buffer.toString(); + return "ASDC Notification:" + System.lineSeparator() + + "DistributionID:" + testNull(asdcNotification.getDistributionID()) + System.lineSeparator() + + "ServiceName:" + testNull(asdcNotification.getServiceName()) + System.lineSeparator() + + "ServiceVersion:" + testNull(asdcNotification.getServiceVersion()) + System.lineSeparator() + + "ServiceUUID:" + testNull(asdcNotification.getServiceUUID()) + System.lineSeparator() + + "ServiceInvariantUUID:" + testNull(asdcNotification.getServiceInvariantUUID()) + System.lineSeparator() + + "ServiceDescription:" + testNull(asdcNotification.getServiceDescription()) + System.lineSeparator() + + "Service Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())) + System.lineSeparator() + + "Resource Instances List:" + System.lineSeparator() + testNull(dumpASDCResourcesList(asdcNotification)) + System.lineSeparator(); } public static String dumpCSARNotification(INotificationData asdcNotification, ToscaResourceStructure toscaResourceStructure) { @@ -418,52 +382,17 @@ public class ASDCNotificationLogging { return null; } - StringBuilder buffer = new StringBuilder("Resource Instance Info:"); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceInstanceName:"); - buffer.append(testNull(resourceInstance.getResourceInstanceName())); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceCustomizationUUID:"); - buffer.append(testNull(resourceInstance.getResourceCustomizationUUID())); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceInvariantUUID:"); - buffer.append(testNull(resourceInstance.getResourceInvariantUUID())); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceName:"); - buffer.append(testNull(resourceInstance.getResourceName())); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceType:"); - buffer.append(testNull(resourceInstance.getResourceType())); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceUUID:"); - buffer.append(testNull(resourceInstance.getResourceUUID())); - buffer.append(System.lineSeparator()); - - buffer.append("ResourceVersion:"); - buffer.append(testNull(resourceInstance.getResourceVersion())); - buffer.append(System.lineSeparator()); - - buffer.append("Category:"); - buffer.append(testNull(resourceInstance.getCategory())); - buffer.append(System.lineSeparator()); - - buffer.append("SubCategory:"); - buffer.append(testNull(resourceInstance.getSubcategory())); - buffer.append(System.lineSeparator()); - - buffer.append("Resource Artifacts List:"); - buffer.append(System.lineSeparator()); - buffer.append(testNull(dumpArtifactInfoList(resourceInstance.getArtifacts()))); - buffer.append(System.lineSeparator()); - - return buffer.toString(); - + return "Resource Instance Info:" + System.lineSeparator() + + "ResourceInstanceName:" + testNull(resourceInstance.getResourceInstanceName()) + System.lineSeparator() + + "ResourceCustomizationUUID:" + testNull(resourceInstance.getResourceCustomizationUUID()) + System.lineSeparator() + + "ResourceInvariantUUID:" + testNull(resourceInstance.getResourceInvariantUUID()) + System.lineSeparator() + + "ResourceName:" + testNull(resourceInstance.getResourceName()) + System.lineSeparator() + + "ResourceType:" + testNull(resourceInstance.getResourceType()) + System.lineSeparator() + + "ResourceUUID:" + testNull(resourceInstance.getResourceUUID()) + System.lineSeparator() + + "ResourceVersion:" + testNull(resourceInstance.getResourceVersion()) + System.lineSeparator() + + "Category:" + testNull(resourceInstance.getCategory()) + System.lineSeparator() + + "SubCategory:" + testNull(resourceInstance.getSubcategory()) + System.lineSeparator() + + "Resource Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())) + System.lineSeparator(); } diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java index c0a1f53283..f9871b745a 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java @@ -43,19 +43,15 @@ public class NotificationLogging implements InvocationHandler { private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>(); protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC); - - private static InvocationHandler handler = new InvocationHandler() { - @Override - public Object invoke(Object arg0, Method arg1, Object[] arg2) - throws Throwable { - List<Method> methods = objectMethodsToLog.get(arg0); - if ((methods == null) || (methods.isEmpty())) { - // Do nothing for now... - return null; - } - methods.add(arg1); - return arg1.invoke(arg0, arg2); + + private static InvocationHandler handler = (arg0, arg1, arg2) -> { + List<Method> methods = objectMethodsToLog.get(arg0); + if ((methods == null) || (methods.isEmpty())) { + // Do nothing for now... + return null; } + methods.add(arg1); + return arg1.invoke(arg0, arg2); }; public static InvocationHandler getHandler() { diff --git a/bpmn/MSOCockpit/pom.xml b/bpmn/MSOCockpit/pom.xml index e64f68bad0..950e8785a7 100644 --- a/bpmn/MSOCockpit/pom.xml +++ b/bpmn/MSOCockpit/pom.xml @@ -7,7 +7,6 @@ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.so</groupId>
<artifactId>MSOCockpit</artifactId>
<packaging>pom</packaging>
<name>MSOCockpit</name>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy index 3397aa9b54..baebf794d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy @@ -11,7 +11,7 @@ class GenericUtils extends StringUtils{ return true;
}
for (int i = 0; i < strLen; i++) {
- if (Character.isWhitespace(cs.charAt(i)) == false) {
+ if (!Character.isWhitespace(cs.charAt(i))) {
return false;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy index 437d592bb6..9de1708b5b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -725,7 +725,7 @@ class SDNCAdapterUtils { execution.setVariable(prefix+'sdncResponseSuccess', false)
taskProcessor.utils.log("DEBUG", "Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response, isDebugLogEnabled)
- if (successIndicator == true){
+ if (successIndicator){
if (response == null || response.trim().equals("")) {
taskProcessor.utils.log("DEBUG", response + ' is empty');
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
@@ -842,7 +842,7 @@ class SDNCAdapterUtils { execution.setVariable(prefix+'sdncResponseSuccess', false)
taskProcessor.utils.log("sdncAdapter Success Indicator is: " + success, isDebugLogEnabled)
- if (success == true) {
+ if (success) {
// we need to look inside the request data for error
def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
@@ -974,4 +974,4 @@ class SDNCAdapterUtils { -} +}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java index 446de10ee2..e43af18ceb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java @@ -129,7 +129,7 @@ public class BpmnRestClient { if(encryptedCredentials != null) {
String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY);
if(userCredentials != null) {
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java new file mode 100644 index 0000000000..1cddc54f43 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java @@ -0,0 +1,317 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.common.recipe;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+/**
+ * the inputs for the resource recipe
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Beijing Release 2018-03-08
+ */
+@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "resourceType","resourceCustomizationUuid"})
+@JsonRootName("variables")
+public class ResourceInput {
+
+ @JsonProperty("resourceInstanceName")
+ private String resourceInstanceName;
+
+ @JsonProperty("resourceInstanceDes")
+ private String resourceInstanceDes;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("serviceType")
+ private String serviceType;
+
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+
+ @JsonProperty("operationId")
+ private String operationId;
+
+ //for create resource
+ @JsonProperty("resourceInvariantUuid")
+ private String resourceInvariantUuid;
+
+ //for create resource
+ @JsonProperty("resourceUuid")
+ private String resourceUuid;
+
+ //for create resource
+ @JsonProperty("resourceCustomizationUuid")
+ private String resourceCustomizationUuid;
+
+ //for delete resource
+ @JsonProperty("resourceInstancenUuid")
+ private String resourceInstancenUuid;
+
+ @JsonProperty("resourceParameters")
+ private String resourceParameters;
+
+ @JsonProperty("operationType")
+ private String operationType;
+
+
+ /**
+ * @return Returns the resourceInstanceName.
+ */
+ @JsonProperty("resourceInstanceName")
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+
+ /**
+ * @param resourceInstanceName The resourceInstanceName to set.
+ */
+ @JsonProperty("resourceInstanceName")
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+
+ /**
+ * @return Returns the resourceInstanceDes.
+ */
+ @JsonProperty("resourceInstanceDes")
+ public String getResourceInstanceDes() {
+ return resourceInstanceDes;
+ }
+
+
+ /**
+ * @param resourceInstanceDes The resourceInstanceDes to set.
+ */
+ @JsonProperty("resourceInstanceDes")
+ public void setResourceInstanceDes(String resourceInstanceDes) {
+ this.resourceInstanceDes = resourceInstanceDes;
+ }
+
+
+ /**
+ * @return Returns the globalSubscriberId.
+ */
+ @JsonProperty("globalSubscriberId")
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+
+ /**
+ * @param globalSubscriberId The globalSubscriberId to set.
+ */
+ @JsonProperty("globalSubscriberId")
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+
+ /**
+ * @return Returns the serviceType.
+ */
+ @JsonProperty("serviceType")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+
+ /**
+ * @param serviceType The serviceType to set.
+ */
+ @JsonProperty("serviceType")
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+
+ /**
+ * @return Returns the serviceId.
+ */
+ @JsonProperty("serviceInstanceId")
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+
+ /**
+ * @param serviceId The serviceId to set.
+ */
+ @JsonProperty("serviceInstanceId")
+ public void setServiceInstanceId(String serviceId) {
+ this.serviceInstanceId = serviceId;
+ }
+
+
+ /**
+ * @return Returns the operationId.
+ */
+ @JsonProperty("operationId")
+ public String getOperationId() {
+ return operationId;
+ }
+
+
+ /**
+ * @param operationId The operationId to set.
+ */
+ @JsonProperty("operationId")
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+
+
+ /**
+ * @return Returns the resourceInvariantUuid.
+ */
+ @JsonProperty("resourceInvariantUuid")
+ public String getResourceInvariantUuid() {
+ return resourceInvariantUuid;
+ }
+
+
+
+ /**
+ * @param resourceInvariantUuid The resourceInvariantUuid to set.
+ */
+ @JsonProperty("resourceInvariantUuid")
+ public void setResourceInvariantUuid(String resourceInvariantUuid) {
+ this.resourceInvariantUuid = resourceInvariantUuid;
+ }
+
+
+
+ /**
+ * @return Returns the resourceUuid.
+ */
+ @JsonProperty("resourceUuid")
+ public String getResourceUuid() {
+ return resourceUuid;
+ }
+
+
+
+ /**
+ * @param resourceUuid The resourceUuid to set.
+ */
+ @JsonProperty("resourceUuid")
+ public void setResourceUuid(String resourceUuid) {
+ this.resourceUuid = resourceUuid;
+ }
+
+
+ /**
+ * @return Returns the resourceCustomizationUuid.
+ */
+ @JsonProperty("resourceCustomizationUuid")
+ public String getResourceCustomizationUuid() {
+ return resourceCustomizationUuid;
+ }
+
+
+ /**
+ * @param resourceCustomizationUuid The resourceCustomizationUuid to set.
+ */
+ @JsonProperty("resourceCustomizationUuid")
+ public void setResourceCustomizationUuid(String resourceCustomizationUuid) {
+ this.resourceCustomizationUuid = resourceCustomizationUuid;
+ }
+
+
+ /**
+ * @return Returns the resourceParameters.
+ */
+ @JsonProperty("resourceParameters")
+ public String getResourceParameters() {
+ return resourceParameters;
+ }
+
+
+ /**
+ * @param resourceParameters The resourceParameters to set.
+ */
+ @JsonProperty("resourceParameters")
+ public void setResourceParameters(String resourceParameters) {
+ this.resourceParameters = resourceParameters;
+ }
+
+
+ /**
+ * @return Returns the operationType.
+ */
+ @JsonProperty("operationType")
+ public String getOperationType() {
+ return operationType;
+ }
+
+
+ /**
+ * @param operationType The operationType to set.
+ */
+ @JsonProperty("operationType")
+ public void setOperationType(String operationType) {
+ this.operationType = operationType;
+ }
+
+
+
+ /**
+ * @return Returns the resourceInstancenUuid.
+ */
+ @JsonProperty("resourceInstancenUuid")
+ public String getResourceInstancenUuid() {
+ return resourceInstancenUuid;
+ }
+
+
+
+ /**
+ * @param resourceInstancenUuid The resourceInstancenUuid to set.
+ */
+ @JsonProperty("resourceInstancenUuid")
+ public void setResourceInstancenUuid(String resourceInstancenUuid) {
+ this.resourceInstancenUuid = resourceInstancenUuid;
+ }
+
+ @Override
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ String jsonStr = "";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch(JsonProcessingException e) {
+
+ e.printStackTrace();
+ }
+ return jsonStr;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java index 5972c76c41..846b87aba8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java @@ -38,11 +38,10 @@ public class CryptoUtils { public static final String AES = "AES";
/**
- * encrypt a value and generate a keyfile
+ * encrypt a value and generate a keyfile
* if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * @throws IOException
- */
+ * @throws GeneralSecurityException
+ * */
public static String encrypt(String value, String keyString) throws GeneralSecurityException
{
SecretKeySpec sks = getSecretKeySpec(keyString);
@@ -53,9 +52,8 @@ public class CryptoUtils { }
/**
- * decrypt a value
+ * decrypt a value
* @throws GeneralSecurityException
- * @throws IOException
*/
public static String decrypt(String message, String keyString) throws GeneralSecurityException
{
@@ -96,23 +94,5 @@ public class CryptoUtils { return b;
}
- /**
- * Not Used...
- *
- * Call Rttp utility jar to encrypt pwd
- * @param clearPassword
- * @return
- * @throws GeneralSecurityException
- * @throws Exception
- *
- public static String encryptRttpPwd(String clearPassword) throws GeneralSecurityException {
- try {
- return RttpBasicAuth.encrypt(clearPassword);
- } catch (Exception e) {
- // wrap generic exception
- throw new GeneralSecurityException(e);
- }
- }
- */
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java index 765bf61c49..f7db52b1c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java @@ -71,7 +71,7 @@ public class ApplicationControllerSupport { } /** - * @param inputClass + * @param action * @return * @throws ClassNotFoundException * @throws InstantiationException diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java index 74b1c3f802..1436d83a94 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java @@ -157,14 +157,9 @@ public abstract class RestClient { } client.register(this.getMapper()); Optional<ClientResponseFilter> responseFilter = this.addResponseFilter(); - if (responseFilter.isPresent()) { - client.register(responseFilter.get()); - } - if (!path.isPresent()) { - webTarget = client.target(host.toString()); - } else { - webTarget = client.target(UriBuilder.fromUri(host + path.get().toString())); - } + responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter)); + webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString()))) + .orElseGet(() -> client.target(host.toString())); this.accept = MediaType.APPLICATION_JSON; this.contentType = MediaType.APPLICATION_JSON; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java index b5ab63ce35..01f6738947 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java @@ -36,7 +36,7 @@ public enum PolicyServiceType { private final String name; - private PolicyServiceType(String name) { + PolicyServiceType(String name) { this.name = name; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java index c746c0d448..df30e43822 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java @@ -27,8 +27,8 @@ public interface SDNOValidator { /** * Issues a health diagnostic request for a given vnf to SDN-O * - * @param vnfName - * @param uuid + * @param vnfId + * @param requestingUserId * @throws IOException * @throws Exception */ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java index 9fcde31e4f..0bb5186a17 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java @@ -68,7 +68,7 @@ public class BPMNUtil { }
@SuppressWarnings("unchecked")
- public static <T extends Object> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
String pID = getProcessInstanceId(processEngineServices,
processDefinitionID);
assertProcessInstanceFinished(processEngineServices, pID);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java index b71f708797..6f0095fb02 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java @@ -1829,7 +1829,7 @@ public class WorkflowTest { /**
* Constructor
* @param contentType the HTTP content type (optional)
- * @param type the callback message type (optional)
+ * @param messageType the callback message type (optional)
* @param content the content
*/
public CallbackData(String contentType, String messageType, String content) {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java index 2ebb44a644..38d0584d0d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/FileUtil.java @@ -35,11 +35,6 @@ public class FileUtil { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private FileUtil() { - /** - * Constructor. - */ - } /** * Read the specified resource file and return the contents as a String. * diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java index 74f50ba438..9ead882b07 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/MockResource.java @@ -108,7 +108,7 @@ public class MockResource { @Produces("application/json") public Response start(@PathParam("portNumber") Integer portNumber) { if (portNumber == null) portNumber = defaultPort; - return startMockServer(portNumber.intValue()); + return startMockServer(portNumber); } diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 960a553757..27d1c97d4b 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> - <groupId>org.onap.so</groupId> <artifactId>MSOCoreBPMN</artifactId> <packaging>jar</packaging> diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java index 9c79df85ff..1e55586be3 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java @@ -245,7 +245,7 @@ public class HealthCheckHandler { payload.append("<soapenv:Header/>\n"); payload.append("<soapenv:Body>\n"); payload.append("<req:getSiteStatus>\n"); - payload.append("<siteName>" + site + "</siteName>\n"); + payload.append("<siteName>").append(site).append("</siteName>\n"); payload.append("</req:getSiteStatus>\n"); payload.append("</soapenv:Body>\n"); payload.append("</soapenv:Envelope>\n"); diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java index 6059a357b6..b6272057a5 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java @@ -238,7 +238,6 @@ public class PropertyConfiguration { * Reads properties from the specified file, updates the property file cache, and * returns the properties in a map. * @param file the file to read - * @param reload true if this is a reload event * @return a map of properties */ private Map<String, String> readProperties(File file) throws IOException { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java index b972d6a815..a1719a90ef 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java @@ -176,7 +176,7 @@ public class PropertyConfigurationSetup { * PropertyConfiguration, just like they do when a property file is updated on * a real MSO system. This method will optionally wait for the new properties * to be loaded. Timeout results in an IOException. - * @param values new properties + * @param properties new properties * @param wait maximum amount of time to wait for new properties to be loaded, * in milliseconds. A value of zero means, "Do not wait." * @throws IOException diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java index 653f75cc3a..fbc312e750 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/InventoryType.java @@ -27,7 +27,7 @@ public enum InventoryType{ private String type;
- private InventoryType(String type){
+ InventoryType(String type){
this.type = type;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java index 4d895f3279..f37db4abdd 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java @@ -92,16 +92,10 @@ public abstract class JsonWrapper implements Serializable { JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
- } catch (JsonGenerationException e) {
- LOGGER.debug("Exception :",e);
- } catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
- } catch (JSONException e) {
- LOGGER.debug("Exception :",e);
- } catch (IOException e) {
+ } catch (JSONException | IOException e) {
LOGGER.debug("Exception :",e);
}
- return json;
+ return json;
}
public String listToJson(List list) {
@@ -111,10 +105,6 @@ public abstract class JsonWrapper implements Serializable { String jsonString = "";
try {
jsonString = mapper.writeValueAsString(list);
- } catch (JsonGenerationException e) {
- LOGGER.debug("Exception :",e);
- } catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
} catch (IOException e) {
LOGGER.debug("Exception :",e);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java index a09f5a7849..20903c0717 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java @@ -146,7 +146,6 @@ public class VnfResource extends Resource { *
* default setter for this field deprecated
* @param modelName << serviceResources.modelInfo.modelName
- * @param modelInstanceName
*/
public void constructVnfType(String modelName) {
this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index 2612c383ab..b0152a1296 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -117,7 +117,7 @@ public class JsonUtils { * to convert a JSONObject to an XML Doc. The intent of this is to
* correctly generate XML from JSON including TAGs for JSONArrays
*
- * @param jsonObj org.json.JSON object to be converted to XML
+ * @param obj object to be converted to XML
* @param tagName optional XML tagname supplied primarily during recursive calls
* @return String containing the XML translation
*/
@@ -913,7 +913,7 @@ public class JsonUtils { * and puts it in a Java List<String>.
*
* @param execution
- * @param stringArray - the getJsonValue of a json array of strings
+ * @param jsonArrayOfStrings - the getJsonValue of a json array of strings
*
* @return List - a java list containing the strings
*
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java index 967b1dfe1c..2fe625849b 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java @@ -85,16 +85,10 @@ public abstract class JsonWrapper implements Serializable { JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
- } catch (JsonGenerationException e) {
+ } catch (JSONException | IOException e) {
LOGGER.debug("Exception :",e);
- } catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
- } catch (JSONException e) {
- LOGGER.debug("Exception :",e);
- } catch (IOException e) {
- LOGGER.debug("Exception :",e);
- }
- return json;
+ }
+ return json;
}
public String listToJson(List list) {
@@ -104,10 +98,6 @@ public abstract class JsonWrapper implements Serializable { String jsonString = "";
try {
jsonString = mapper.writeValueAsString(list);
- } catch (JsonGenerationException e) {
- LOGGER.debug("Exception :",e);
- } catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
} catch (IOException e) {
LOGGER.debug("Exception :",e);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java index 177fafcd4b..c48b671b72 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java @@ -93,7 +93,7 @@ public class URNMapping { * aai:endpoint becomes URN_aai_endpoint <br/> * ae:internal-reporting becomes URN_ae_internal_reporting <br/> * - * @param name the URN + * @param urn the URN * @return a normalized identifier */ public static String createIdentifierFromURN(String urn) { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index c346308e2b..730c1451d5 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -321,14 +321,8 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { } private void loadFromDB(DelegateExecution execution, ProcessEngineConfigurationImpl processEngineConfiguration) { - Command<List<URNMapping>> command = new Command<List<URNMapping>>() { - @SuppressWarnings("unchecked") - @Override - public List<URNMapping> execute(CommandContext commandContext) { - return (List<URNMapping>) commandContext.getDbSqlSession().selectList( - "mso.urnMapping.selectAll", null); - } - }; + Command<List<URNMapping>> command = commandContext -> (List<URNMapping>) commandContext.getDbSqlSession() + .selectList("mso.urnMapping.selectAll", null); CustomMyBatisSessionFactory sessionFactory = new CustomMyBatisSessionFactory(); sessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java index f5b9f8dc56..1fc43baef8 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java @@ -130,7 +130,7 @@ public final class XmlTool { /** * Encodes a value so it can be used inside an XML text element. - * @param s the string to encode + * @param value the string to encode * @return the encoded string */ public static String encode(Object value) { @@ -171,7 +171,7 @@ public final class XmlTool { /** * Encodes a value so it can be used inside an XML attribute. - * @param s the string to encode + * @param value the string to encode * @return the encoded string */ public static String encodeAttr(Object value) { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index cfdc0e9bfa..fd9b6d42e8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -27,6 +27,12 @@ import groovy.json.* import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.ServiceInstance import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.AllottedResource +import org.openecomp.mso.bpmn.core.domain.NetworkResource +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.bpmn.common.recipe.ResourceInput +import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient import org.openecomp.mso.bpmn.core.json.JsonUtils import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -42,6 +48,8 @@ import org.openecomp.mso.rest.RESTConfig import java.util.List; import java.util.UUID; +import javax.mail.Quota.Resource; + import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution import org.json.JSONObject; @@ -225,7 +233,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -242,7 +250,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { else { boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI == true){ + if(foundInAAI){ utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) msg = "ServiceInstance already exists in AAI:" + serviceInstanceName utils.log("INFO", msg, isDebugEnabled) @@ -266,7 +274,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceId = execution.getVariable("serviceInstanceId") boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -305,7 +313,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -322,7 +330,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { else { boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI == true){ + if(foundInAAI){ String aaiService = execution.getVariable("GENGS_service") if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name")) @@ -400,11 +408,11 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - String incomingRequest = execution.getVariable("uuiRequest") - String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources") - List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + List<Resource> resourceList = serviceDecomposition.getServiceResources() + for(String resource : resourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceId") + ":" + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" @@ -491,41 +499,34 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { if (networks == null) { utils.log("INFO", "No matching networks in Catalog DB for serviceModelUUID=" + serviceModelUUID, isDebugEnabled) } - String incomingRequest = execution.getVariable("uuiRequest") - String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources") - List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr) - // Only one match herenetwork - List<String> nsResources = new ArrayList<String>() - List<String> wanResources = new ArrayList<String>() - List<String> resourceSequence = new ArrayList<String>() - for(String resource : resourceList){ - String resourceName = jsonUtil.getJsonValue(resource, "resourceName") - String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId") - //check is network. - boolean isNetwork = false; - if(networks != null){ - for(int i = 0; i < networks.size(); i++){ - String networkUUID = jsonUtil.getJsonValueForKey(networks.get(i), "modelVersionId") - if(StringUtils.equals(resourceUUID, networkUUID)){ - isNetwork = true - break - } - } - } - if(isNetwork){ - wanResources.add(resourceName) - }else{ - nsResources.add(resourceName) - } + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //we use VF to define a network service + List<VnfResource> vnfResourceList= serviceDecomposition.getServiceVnfs() + + //here wan is defined as a network resource + List<NetworkResource> networkResourceList = serviceDecomposition.getServiceNetworks() + + //allotted resource + List<AllottedResource> arResourceList= serviceDecomposition.getServiceAllottedResources() + //define sequenced resource list, we deploy vf first and then network and then ar + //this is defaule sequence + List<Resource> sequencedResourceList = new ArrayList<Resource>(); + if(null != vnfResourceList){ + sequencedResourceList.addAll(vnfResourceList) + } + if(null != networkResourceList){ + sequencedResourceList.addAll(networkResourceList) + } + if(null != arResourceList){ + sequencedResourceList.addAll(arResourceList) } - resourceSequence.addAll(nsResources) - resourceSequence.addAll(wanResources) - String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" + + String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) - execution.setVariable("resourceSequence", resourceSequence) - utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) - execution.setVariable("wanResources", wanResources) + execution.setVariable("sequencedResourceList", sequencedResourceList) + utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled) utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled) } @@ -533,15 +534,9 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) def currentIndex = execution.getVariable("currentResourceIndex") - List<String> resourceSequence = execution.getVariable("resourceSequence") - List<String> wanResources = execution.getVariable("wanResources") - String resourceName = resourceSequence.get(currentIndex) - execution.setVariable("resourceType",resourceName) - if(wanResources.contains(resourceName)){ - execution.setVariable("controllerInfo", "SDN-C") - }else{ - execution.setVariable("controllerInfo", "VF-C") - } + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) + utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled) utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) } @@ -554,8 +549,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) - List<String> resourceSequence = execution.getVariable("resourceSequence") - if(nextIndex >= resourceSequence.size()){ + List<String> sequencedResourceList = execution.getVariable("sequencedResourceList") + if(nextIndex >= sequencedResourceList.size()){ execution.setVariable("allResourceFinished", "true") }else{ execution.setVariable("allResourceFinished", "false") @@ -569,4 +564,59 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { public void postConfigRequest(execution){ //now do noting } + + public void prepareResourceRecipeRequest(execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) + ResourceInput resourceInput = new ResourceInput() + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String resourceInstanceName = resourceType + "_" + serviceInstanceName + resourceInput.setResourceInstanceName(resourceInstanceName) + utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setServiceType(serviceType) + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setOperationId(operationId) + resourceInput.setOperationType(operationType); + def currentIndex = execution.getVariable("currentResourceIndex") + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) + String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() + resourceInput.setResourceCustomizationUuid(resourceCustomizationUuid); + String resourceInvariantUuid = currentResource.getModelInfo().getModelInvariantUuid() + resourceInput.setResourceInvariantUuid(resourceInvariantUuid) + String resourceUuid = currentResource.getModelInfo().getModelUuid() + resourceInput.setResourceUuid(resourceUuid) + + String incomingRequest = execution.getVariable("uuiRequest") + String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources") + String serviceRequestInputs = jsonUtil.getJsonValue(incomingRequest, "service.parameters.requestInputs") + String serviceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description") + resourceInput.setResourceInstanceDes(serviceDescription) + utils.log("INFO", "Prepare Resource Request:" + resourceInput.toString(), isDebugEnabled) + List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr) + String locationConstraints = "" + String resourceRequestInputs = "" + for(String resource : resourceList){ + String resourceUuidTmp = jsonUtil.getJsonValue(resource, "resourceUuid") + String resourceCustomizationUuidTmp = jsonUtil.getJsonValue(resource, "resourceCustomizationUuid") + if(StringUtils.equals(resourceUuidTmp, resourceUuid) && StringUtils.equals(resourceCustomizationUuidTmp, resourceCustomizationUuid)){ + + String resourceParameters = jsonUtil.getJsonValue(resource, "parameters") + locationConstraints = jsonUtil.getJsonValue(resourceParameters, "locationConstraints") + resourceRequestInputs = jsonUtil.getJsonValue(resourceParameters, "requestInputs") + } + } + //set the requestInputs from tempalte To Be Done + //String resourceParameters = ResourceRequestBuilder.buildRequestParameters() + String resourceParameters = "" + resourceInput.setResourceParameters(resourceParameters) + execution.setVariable("resourceInput", resourceInput) + utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index dfe210ccf6..743eb1a46e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -178,14 +178,14 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce String serviceInstanceId = execution.getVariable("serviceInstanceId")
boolean rollbackAAI = execution.getVariable("rollbackAAI")
boolean rollbackSDNC = execution.getVariable("rollbackSDNC")
- if (rollbackAAI == true || rollbackSDNC == true)
+ if (rollbackAAI || rollbackSDNC)
{
execution.setVariable("rolledBack", true)
}
- if (rollbackAAI == true)
+ if (rollbackAAI)
{
boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful
execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback")
utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy index cc34b03c64..ea29de94d7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy @@ -227,7 +227,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { try {
String serviceInstanceName = execution.getVariable("serviceInstanceName")
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
WorkflowException workflowException = execution.getVariable("WorkflowException")
utils.logAudit("workflowException: " + workflowException)
@@ -244,7 +244,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { else
{
boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
- if(foundInAAI == true){
+ if(foundInAAI){
utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
utils.log("INFO", msg, isDebugEnabled)
@@ -270,7 +270,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { try {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
WorkflowException workflowException = execution.getVariable("WorkflowException")
utils.logAudit("workflowException: " + workflowException)
@@ -311,7 +311,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { try {
String serviceInstanceName = execution.getVariable("serviceInstanceName")
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
WorkflowException workflowException = execution.getVariable("WorkflowException")
utils.logAudit("workflowException: " + workflowException)
@@ -328,7 +328,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { else
{
boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
- if(foundInAAI == true){
+ if(foundInAAI){
String aaiService = execution.getVariable("GENGS_service")
if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index affb932ff4..91ecabcec3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -368,7 +368,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -385,7 +385,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { else { boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI == true){ + if(foundInAAI){ utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) msg = "ServiceInstance already exists in AAI:" + serviceInstanceName utils.log("DEBUG", msg, isDebugEnabled) @@ -409,7 +409,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceId = execution.getVariable("serviceInstanceId") boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -576,7 +576,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceName = execution.getVariable("serviceInstanceName") boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("DEBUG","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -593,7 +593,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { else { boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI == true){ + if(foundInAAI){ String aaiService = execution.getVariable("GENGS_service") if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name")) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy index 3c12c0b64a..9a84c6b7b8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy @@ -177,14 +177,14 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso String serviceInstanceId = execution.getVariable("serviceInstanceId")
boolean rollbackAAI = execution.getVariable("rollbackAAI")
boolean rollbackSDNC = execution.getVariable("rollbackSDNC")
- if (rollbackAAI == true || rollbackSDNC == true)
+ if (rollbackAAI || rollbackSDNC)
{
execution.setVariable("rolledBack", true)
}
- if (rollbackAAI == true)
+ if (rollbackAAI)
{
boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful
execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback")
utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index 82eea437d0..c5d87d817a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -181,7 +181,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { utils.log("ERROR", "Exception Occured Processing postProcessCreateVfModuleRollback. Exception is:\n" + e, isDebugLogEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
- if (rolledBack == false) {
+ if (!rolledBack) {
logDebug("Failure on DoCreateVfModuleRollback", isDebugLogEnabled)
utils.log("ERROR", "Unsuccessful rollback of DoCreateVfModule")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule")
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index bf61013c76..40e2baab7f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -317,7 +317,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") String serviceType = "" - if(foundInAAI == true){ + if(foundInAAI){ utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) String siData = execution.getVariable("GENGS_service") @@ -412,7 +412,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess } }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -446,7 +446,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess try { String serviceInstanceId = execution.getVariable("serviceInstanceId") boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ msg = "Error deleting Service-instance in AAI" + serviceInstanceId utils.log("INFO", msg, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 7de0ed0b02..4c3f6bc73c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -180,7 +180,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String serviceType = ""
- if(foundInAAI == true){
+ if(foundInAAI){
utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
String siData = execution.getVariable("GENGS_service")
@@ -194,7 +194,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce }else{
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
WorkflowException workflowException = execution.getVariable("WorkflowException")
utils.logAudit("workflowException: " + workflowException)
@@ -964,7 +964,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce try {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
- if(succInAAI != true){
+ if(!succInAAI){
msg = "Error deleting Service-instance in AAI" + serviceInstanceId
utils.log("INFO", msg, isDebugEnabled)
WorkflowException workflowException = execution.getVariable("WorkflowException")
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index edebc3dbb3..a3407553c8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -273,7 +273,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { NetworkUtils networkUtils = new NetworkUtils() isVfRelationshipExist = networkUtils.isVfRelationshipExist(aaiResponseAsString) execution.setVariable(Prefix + "isVfRelationshipExist", isVfRelationshipExist) - if (isVfRelationshipExist == true) { + if (isVfRelationshipExist) { String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index 1c9b80ac8d..fd4162fa5c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -308,7 +308,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") String serviceType = "" - if(foundInAAI == true){ + if(foundInAAI){ utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) //Extract GlobalSubscriberId @@ -409,7 +409,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { } }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") utils.logAudit("workflowException: " + workflowException) @@ -443,7 +443,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { try { String serviceInstanceId = execution.getVariable("serviceInstanceId") boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") - if(succInAAI != true){ + if(!succInAAI){ msg = "Error deleting Service-instance in AAI" + serviceInstanceId utils.log("DEBUG", msg, isDebugEnabled) WorkflowException workflowException = execution.getVariable("WorkflowException") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..c91f353293 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -0,0 +1,260 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil + +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.List; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the <class>UpdateCustomE2EServiceInstance.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Update + * + */ +public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="UPDSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + utils.log("INFO", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") + utils.log("INFO", "userParams:" + userParams, isDebugEnabled) + List<String> paramList = jsonUtil.StringArrayToList(execution, userParams) + String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") + //modelInfo + if (isBlank(uuiRequest)) { + msg = "Input uuiRequest is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("uuiRequest", uuiRequest) + } + + utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled) + + //requestParameters + String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.parameters.serviceType") + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("serviceType", serviceType) + } + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String updateServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() + utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, updateServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id> + <action>UPDATE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance was updated successfully.</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>UpdateGenericALaCarteServiceInstance</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id> + <action>UPDATE</action> + <source>${source}</source> + </request-info>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in UpdateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1"
+ xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id> + <action>UPDATE</action> + <source>UUI</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index dd6d4514bc..e1cae802e7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -1,753 +1,835 @@ -/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.bpmn.vcpe.scripts;
-
-import groovy.xml.XmlUtil
-import groovy.json.*
-
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.common.scripts.VidUtils
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.domain.*
-
-import java.util.UUID;
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.apache.commons.lang3.*
-import org.apache.commons.codec.binary.Base64;
-import org.springframework.web.util.UriUtils;
-import static org.apache.commons.lang3.StringUtils.*
-
-/**
- * This groovy class supports the <class>CreateVcpeResCustService.bpmn</class> process.
- *
- * @author ek1439
- *
- */
-public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
-
- private static final String DebugFlag = "isDebugLogEnabled"
-
- String Prefix="CVRCS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
-
- /**
- * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
- * @param execution
- */
- public InitializeProcessVariables(Execution execution){
- /* Initialize all the process variables in this block */
-
- execution.setVariable("createVcpeServiceRequest", "")
- execution.setVariable("globalSubscriberId", "")
- execution.setVariable("serviceInstanceName", "")
- execution.setVariable("msoRequestId", "")
- execution.setVariable(Prefix+"VnfsCreatedCount", 0)
- execution.setVariable("productFamilyId", "")
- execution.setVariable("brgWanMacAddress", "")
-
- //TODO
- execution.setVariable("sdncVersion", "1707")
- }
-
- // **************************************************
- // Pre or Prepare Request Section
- // **************************************************
- /**
- * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
- * @param execution
- */
- public void preProcessRequest (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix",Prefix)
-
- utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
-
- try {
- // initialize flow variables
- InitializeProcessVariables(execution)
-
- //Config Inputs
- String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')
- if (isBlank(aaiDistDelay)) {
- msg = "URN_mso_workflow_aai_distribution_delay is null"
- utils.log("DEBUG", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
- execution.setVariable("aaiDistDelay", aaiDistDelay)
- utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled)
-
- // check for incoming json message/input
- String createVcpeServiceRequest = execution.getVariable("bpmnRequest")
- utils.logAudit(createVcpeServiceRequest)
- execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest);
- println 'createVcpeServiceRequest - ' + createVcpeServiceRequest
-
- // extract requestId
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
-
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {
- serviceInstanceId = UUID.randomUUID().toString()
- utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled)
- } else {
- utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled)
- }
-
- serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
- execution.setVariable("serviceInstanceId", serviceInstanceId)
-
- String requestAction = execution.getVariable("requestAction")
- execution.setVariable("requestAction", requestAction)
-
- setBasicDBAuthHeader(execution, isDebugEnabled)
-
- String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source")
- if ((source == null) || (source.isEmpty())) {
- source = "VID"
- }
- execution.setVariable("source", source)
-
- // extract globalSubscriberId
- String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")
-
- // verify element global-customer-id is sent from JSON input, throw exception if missing
- if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) {
- String dataErrorMessage = " Element 'globalSubscriberId' is missing. "
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- execution.setVariable("globalCustomerId", globalSubscriberId)
- }
-
- // extract subscriptionServiceType
- String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)
-
- String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback")
- execution.setVariable("disableRollback", suppressRollback)
- utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled)
-
- String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
- execution.setVariable("productFamilyId", productFamilyId)
- utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled)
-
- String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo")
- execution.setVariable("subscriberInfo", subscriberInfo)
- utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled)
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)
-
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
+/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.domain.* + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +/** + * This groovy class supports the <class>CreateVcpeResCustService.bpmn</class> process. + * + * @author ek1439 + * + */ +public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { + + private static final String DebugFlag = "isDebugLogEnabled" + + String Prefix="CVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the + * <class>CreateServiceInstance.bpmn</class> process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("createVcpeServiceRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable(Prefix+"VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + execution.setVariable("brgWanMacAddress", "") + execution.setVariable("customerLocation", "") + + //TODO + execution.setVariable("sdncVersion", "1707") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the + * <class>CreateServiceInstance.bpmn</class> process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + //Config Inputs + String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') + if (isBlank(aaiDistDelay)) { + msg = "URN_mso_workflow_aai_distribution_delay is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("aaiDistDelay", aaiDistDelay) + utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled) + + // check for incoming json message/input + String createVcpeServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(createVcpeServiceRequest) + execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); + println 'createVcpeServiceRequest - ' + createVcpeServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + setBasicDBAuthHeader(execution, isDebugEnabled) + + String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + source = "VID" + } + execution.setVariable("source", source) + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.subscriberInfo") + execution.setVariable("subscriberInfo", subscriberInfo) + utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) + - Map<String, String> inputMap = [:]
-
-
- if (userParams) {
- userParams.each {
- userParam ->
- if("BRG_WAN_MAC_Address".equals(userParam?.name)) {
- execution.setVariable("brgWanMacAddress", userParam.value)
- inputMap.put("BRG_WAN_MAC_Address", userParam.value)
- }
- }
- }
-
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
- execution.setVariable("serviceInputParams", inputMap)
-
- utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled)
-
- //For Completion Handler & Fallout Handler
- String requestInfo =
- """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>"""
-
- execution.setVariable(Prefix+"requestInfo", requestInfo)
-
- utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
-
- } catch (BpmnError e) {
- throw e;
-
- } catch (Exception ex){
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void sendSyncResponse(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String requestId = execution.getVariable("mso-request-id")
-
- // RESTResponse (for API Handler (APIH) Reply Task)
- String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
-
- utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
- sendWorkflowResponse(execution, 202, syncResponse)
-
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- //
- // *******************************
- public void prepareDecomposeService(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
-
- //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB
- String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo")
- execution.setVariable("serviceModelInfo", serviceModelInfo)
-
- utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- //
- // *******************************
- public void prepareCreateServiceInstance(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
-// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters")
-// execution.setVariable("serviceInputParams", serviceInputParams)
-
- - String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName")
- execution.setVariable("serviceInstanceName", serviceInstanceName)
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName())
-
- utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void postProcessServiceInstanceCreate (Execution execution){
- def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable(DebugFlag)
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String requestId = execution.getVariable("mso-request-id")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
-
- try {
-
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${requestId}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <serviceInstanceName>${serviceInstanceName}</serviceInstanceName>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
- execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload)
- utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload)
- logDebug('Exited ' + method, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- }
-
-
- public void processDecomposition (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- // VNFs
- List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()
- filterVnfs(vnfList)
- serviceDecomposition.setServiceVnfs(vnfList)
-
- execution.setVariable("vnfList", vnfList)
- execution.setVariable("vnfListString", vnfList.toString())
-
- String vnfModelInfoString = ""
- if (vnfList != null && vnfList.size() > 0) {
- execution.setVariable(Prefix+"VNFsCount", vnfList.size())
- utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled)
- ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
-
- vnfModelInfoString = vnfModelInfo.toString()
- String vnfModelInfoWithRoot = vnfModelInfo.toString()
- vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
- } else {
- execution.setVariable(Prefix+"VNFsCount", 0)
- utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled)
- }
-
- execution.setVariable("vnfModelInfo", vnfModelInfoString)
- execution.setVariable("vnfModelInfoString", vnfModelInfoString)
- utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- sendSyncError(execution)
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- private void filterVnfs(List<VnfResource> vnfList) {
- if(vnfList == null) {
- return
- }
-
- // remove BRG & TXC from VNF list
-
- Iterator<VnfResource> it = vnfList.iterator()
- while(it.hasNext()) {
- VnfResource vr = it.next()
-
- String role = vr.getNfRole()
- if(role == "BRG" || role == "TunnelXConn") {
- it.remove()
- }
- }
- }
-
-
- public void prepareCreateAllottedResourceTXC(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //allottedResourceModelInfo
- //allottedResourceRole
- //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
- //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
- List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
- if (allottedResources != null) {
- Iterator iter = allottedResources.iterator();
- while (iter.hasNext()){
- AllottedResource allottedResource = (AllottedResource)iter.next();
-
- utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
- utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
- if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){
- //set create flag to true
- execution.setVariable("createTXCAR", true)
- ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
- execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName())
- execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole())
- execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType())
- //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC,
- //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated).
- execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId())
- } - }
- }
-
- //unit test only
- String allottedResourceId = execution.getVariable("allottedResourceId")
- execution.setVariable("allottedResourceIdTXC", allottedResourceId)
- utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
- public void prepareCreateAllottedResourceBRG(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //allottedResourceModelInfo
- //allottedResourceRole
- //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
- //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
- List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
- if (allottedResources != null) {
- Iterator iter = allottedResources.iterator();
- while (iter.hasNext()){
- AllottedResource allottedResource = (AllottedResource)iter.next();
-
- utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
- utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
- if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){
- //set create flag to true
- execution.setVariable("createBRGAR", true)
- ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
- execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName())
- execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole())
- execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType())
- //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG,
- //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated).
- execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId())
- }
- }
- }
-
- //unit test only
- String allottedResourceId = execution.getVariable("allottedResourceId")
- execution.setVariable("allottedResourceIdBRG", allottedResourceId)
- utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- - - // *******************************
- // Generate Network request Section
- // *******************************
- public void prepareVnfAndModulesCreate (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- // String disableRollback = execution.getVariable("disableRollback")
- // def backoutOnFailure = ""
- // if(disableRollback != null){
- // if ( disableRollback == true) {
- // backoutOnFailure = "false"
- // } else if ( disableRollback == false) {
- // backoutOnFailure = "true"
- // }
- // }
- //failIfExists - optional
-
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
- execution.setVariable("productFamilyId", productFamilyId)
- utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled)
-
- List<VnfResource> vnfList = execution.getVariable("vnfList")
-
- Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")
- String vnfModelInfoString = null;
-
- if (vnfList != null && vnfList.size() > 0 ) {
- utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled)
- ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo()
- utils.log("DEBUG", "got 0 ", isDebugEnabled)
- ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo()
- vnfModelInfoString = vnfModelInfo.toString()
- } else {
- //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored
- vnfModelInfoString = execution.getVariable("vnfModelInfo")
- }
-
- utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
-
- // extract cloud configuration
- String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
- execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
- utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)
- String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId")
- execution.setVariable("tenantId", tenantId)
- utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)
-
- String sdncVersion = execution.getVariable("sdncVersion")
- utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- // Validate Vnf request Section -> increment count
- // *******************************
- public void validateVnfCreate (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")
- vnfsCreatedCount++
-
- execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount)
-
- utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *****************************************
- // Prepare Completion request Section
- // *****************************************
- public void postProcessResponse (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String source = execution.getVariable("source")
- String requestId = execution.getVariable("mso-request-id")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- String msoCompletionRequest =
- """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:ns="http://org.openecomp/mso/request/types/v1">
- <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>
- <status-message>Service Instance has been created successfully via macro orchestration</status-message>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <mso-bpel-name>BPMN macro create</mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- // Format Response
- String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
-
- utils.logAudit(xmlMsoCompletionRequest)
- execution.setVariable(Prefix+"Success", true)
- execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void preProcessRollback (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
- try {
-
- Object workflowException = execution.getVariable("WorkflowException");
-
- if (workflowException instanceof WorkflowException) {
- utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
- execution.setVariable("prevWorkflowException", workflowException);
- //execution.setVariable("WorkflowException", null);
- }
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
- } catch(Exception ex) {
- String msg = "Exception in preProcessRollback. " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- }
- utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
- }
-
- public void postProcessRollback (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
- String msg = ""
- try {
- Object workflowException = execution.getVariable("prevWorkflowException");
- if (workflowException instanceof WorkflowException) {
- utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
- execution.setVariable("WorkflowException", workflowException);
- }
- } catch (BpmnError b) {
- utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
- throw b;
- } catch(Exception ex) {
- msg = "Exception in postProcessRollback. " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- }
- utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
- }
-
- public void prepareFalloutRequest(Execution execution){
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)
-
- try {
- WorkflowException wfex = execution.getVariable("WorkflowException")
- utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)
- String requestInfo = execution.getVariable(Prefix+"requestInfo")
- utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)
-
- //TODO. hmmm. there is no way to UPDATE error message.
-// String errorMessage = wfex.getErrorMessage()
-// boolean successIndicator = execution.getVariable("DCRESI_rolledBack")
-// if (successIndicator){
-// errorMessage = errorMessage + ". Rollback successful."
-// } else {
-// errorMessage = errorMessage + ". Rollback not completed."
-// }
-
- String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
-
- execution.setVariable(Prefix+"falloutRequest", falloutRequest)
-
- } catch (Exception ex) {
- utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process")
- }
- utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)
- }
-
-
- public void sendSyncError (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix", Prefix)
-
- utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String errorMessage = ""
- def wfe = execution.getVariable("WorkflowException")
- if (wfe instanceof WorkflowException) {
- errorMessage = wfe.getErrorMessage()
- } else {
- errorMessage = "Sending Sync Error."
- }
-
- String buildworkflowException =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- utils.logAudit(buildworkflowException)
- sendWorkflowResponse(execution, 500, buildworkflowException)
- } catch (Exception ex) {
- utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
- }
- }
-
- public void processJavaException(Execution execution){
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix",Prefix)
- try{
- utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)
- utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
- utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)
- execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
- }catch(BpmnError b){
- utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
- execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
- }
- utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
- }
-}
+ //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + + + if (userParams) { + userParams.each { + userParam -> + if("BRG_WAN_MAC_Address".equals(userParam?.name)) { + execution.setVariable("brgWanMacAddress", userParam.value) + inputMap.put("BRG_WAN_MAC_Address", userParam.value) + } + if("Customer_Location".equals(userParam?.name)) { + execution.setVariable("customerLocation", userParam.value) + userParam.value.each { + customerLocParam -> + inputMap.put(customerLocParam.key, customerLocParam.value) + } + } + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + utils.log("DEBUG", "Incoming brgWanMacAddress is: " + + execution.getVariable('brgWanMacAddress'), isDebugEnabled) + utils.log("DEBUG", "Incoming customerLocation is: " + + execution.getVariable('customerLocation'), isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info>""" + + execution.setVariable(Prefix+"requestInfo", requestInfo) + + utils.log("DEBUG", + " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow." + + " Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{ + "instanceId":"${serviceInstanceId}", + "requestId":"${requestId}" + }}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB + String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + utils.log("DEBUG", + " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from + * DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") +// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, +// "requestDetails.requestParameters") +// execution.setVariable("serviceInputParams", serviceInputParams) + + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) + + utils.log("DEBUG", + " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postProcessServiceInstanceCreate (Execution execution){ + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + + 'execution=' + execution.getId() +')' + def isDebugLogEnabled = execution.getVariable(DebugFlag) + logDebug('Entered ' + method, isDebugLogEnabled) + + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:req="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateInfraRequest> + <requestId>${requestId}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <serviceInstanceName>${serviceInstanceName}</serviceInstanceName> + </req:updateInfraRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload) + utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload) + logDebug('Exited ' + method, isDebugLogEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + } + + + public void processDecomposition (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs() + filterVnfs(vnfList) + serviceDecomposition.setServiceVnfs(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix+"VNFsCount", vnfList.size()) + utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix+"VNFsCount", 0) + utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "processDecomposition() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + private void filterVnfs(List<VnfResource> vnfList) { + if(vnfList == null) { + return + } + + // remove BRG & TXC from VNF list + + Iterator<VnfResource> it = vnfList.iterator() + while(it.hasNext()) { + VnfResource vr = it.next() + + String role = vr.getNfRole() + if(role == "BRG" || role == "TunnelXConn") { + it.remove() + } + } + } + + + public void prepareCreateAllottedResourceTXC(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from + * DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this + //BB will query the full model from the Catalog DB. + List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + + allottedResource.getAllottedResourceType(), isDebugEnabled) + if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ + //set create flag to true + execution.setVariable("createTXCAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoTXC", + allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the + // decomposition that represents the TXC, + //and in its homingSolution section should be found the infraServiceInstanceId + // (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing + // BB would have populated). + execution.setVariable("parentServiceInstanceIdTXC", + allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdTXC", allottedResourceId) + utils.log("DEBUG", + "setting allottedResourceId CreateVcpeResCustService "+ allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", + isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. " + + "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + public void prepareCreateAllottedResourceBRG(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from + * DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this + // BB will query the full model from the Catalog DB. + List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + + allottedResource.getAllottedResourceType(), isDebugEnabled) + if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ + //set create flag to true + execution.setVariable("createBRGAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoBRG", + allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the + // decomposition that represents the BRG, + //and in its homingSolution section should be found the infraServiceInstanceId + // (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing + // BB would have populated). + execution.setVariable("parentServiceInstanceIdBRG", + allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdBRG", allottedResourceId) + utils.log("DEBUG", + "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", + isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. " + + "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) + + List<VnfResource> vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.size() > 0 ) { + utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) + ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() + utils.log("DEBUG", "got 0 ", isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount) + + utils.log("DEBUG", + " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance has been created successfully via macro orchestration</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>BPMN macro create</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable(Prefix+"Success", true) + execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable(Prefix+"requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable(Prefix+"falloutRequest", falloutRequest) + + } catch (Exception ex) { + utils.log("DEBUG", + "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), + isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") + } + utils.log("DEBUG", + "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String errorMessage = "" + def wfe = execution.getVariable("WorkflowException") + if (wfe instanceof WorkflowException) { + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + // Adding below line temporarily until this flows error handling gets updated + execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + // Adding below line temporarily until this flows error handling gets updated + execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index c26b14e57c..cac2ad871a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -222,7 +222,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc try { execution.setVariable("rollbackData", null) boolean skipRollback = execution.getVariable("skipRollback") - if (skipRollback != true) + if (!skipRollback) { execution.setVariable("rolledBack", true) utils.log("DEBUG","rolledBack", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index ff621e5954..08f2df2d09 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -222,7 +222,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc try { execution.setVariable("rollbackData", null) boolean skipRollback = execution.getVariable("skipRollback") - if (skipRollback != true) + if (!skipRollback) { execution.setVariable("rolledBack", true) utils.log("DEBUG","rolledBack", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 38a44ab1f6..0749c789b4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -43,7 +41,6 @@ import org.openecomp.mso.bpmn.core.PropertyConfiguration; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.requestsdb.RequestsDbConstant; import org.openecomp.mso.requestsdb.ResourceOperationStatus; import org.slf4j.Logger; @@ -62,12 +59,12 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); private static final String DEFAULT_MSB_IP = "127.0.0.1"; - private static final int DEFAULT_MSB_Port = 80; + private static final int DEFAULT_MSB_PORT = 80; private static final String SDCADAPTOR_INPUTS = "resourceParameters"; + private static final String TOPOLOGY_PROPERTIES = "topology.properties"; public static final String ONAP_IP = "ONAP_IP"; - private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - private static final String postBodyTemplate = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/requestsdb\"><soapenv:Header/><soapenv:Body>\n"+ + private static final String POST_BODY_TEMPLATE = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/requestsdb\"><soapenv:Header/><soapenv:Body>\n"+ " <ns:updateResourceOperationStatus>\n"+ " <errorCode>$errorCode</errorCode>\n"+ " <jobId>$jobId</jobId>\n"+ @@ -80,7 +77,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { " <statusDescription>$statusDescription</statusDescription>\n"+ " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>"; - private static final String getBodyTemplate = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/requestsdb\"><soapenv:Header/><soapenv:Body>\n" + + private static final String GET_BODY_TEMPLATE = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/requestsdb\"><soapenv:Header/><soapenv:Body>\n" + " <ns:getResourceOperationStatus>\n" + " <operationId>$operationId</operationId>\n" + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n" + @@ -98,7 +95,6 @@ public abstract class AbstractSdncOperationTask extends BaseTask { httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); logger.info("AbstractSdncOperationTask.updateResOperStatus end!"); - //requestsDB.updateResOperStatus(resourceOperationStatus); } protected String getPostbody(Object inputEntity) { @@ -108,7 +104,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); postBody = objectMapper.writeValueAsString(inputEntity); } catch (JsonProcessingException e) { - e.printStackTrace(); + logger.error(e.getStackTrace().toString()); } return postBody; } @@ -118,24 +114,20 @@ public abstract class AbstractSdncOperationTask extends BaseTask { String result = null; String errorMsg; - label91: { - try(CloseableHttpClient httpClient = HttpClients.createDefault()) { - CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); - result = EntityUtils.toString(closeableHttpResponse.getEntity()); - logger.info("result = {}", result); -// LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, result.toString(), "SDNC", ""); - if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { - logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); - throw new RouteException(result, "SERVICE_GET_ERR"); - } - - closeableHttpResponse.close(); - break label91; - } catch (IOException e) { - errorMsg = url + ":httpPostWithJSON connect faild"; - logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); - throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD"); + try(CloseableHttpClient httpClient = HttpClients.createDefault()) { + CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); + result = EntityUtils.toString(closeableHttpResponse.getEntity()); + logger.info("result = {}", result); + if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); + throw new RouteException(result, "SERVICE_GET_ERR"); } + + closeableHttpResponse.close(); + } catch (IOException e) { + errorMsg = url + ":httpPostWithJSON connect faild"; + logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg); + throwsRouteException(errorMsg, e, "POST_CONNECT_FAILD"); } logger.info("AbstractSdncOperationTask.httpPost end!"); @@ -150,7 +142,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) { logger.info("AbstractSdncOperationTask.getPostStringBody begin!"); - String postBody = postBodyTemplate; + String postBody = POST_BODY_TEMPLATE; postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode()); postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId()); postBody = postBody.replace("$operType", resourceOperationStatus.getOperType()); @@ -166,7 +158,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) { logger.info("AbstractSdncOperationTask.getGetStringBody begin!"); - String getBody = getBodyTemplate; + String getBody = GET_BODY_TEMPLATE; getBody = getBody.replace("$operationId", operationId); getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID); getBody = getBody.replace("$serviceId", serviceId); @@ -186,35 +178,6 @@ public abstract class AbstractSdncOperationTask extends BaseTask { ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result); logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!"); return resourceOperationStatus; - - //return requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); - } - - private String httpGet(String url, HttpGet httpGet) throws RouteException { - logger.info("AbstractSdncOperationTask.httpGet begin!"); - String result = ""; - String errorMsg; - try(CloseableHttpClient httpClient = HttpClients.createDefault()) { - CloseableHttpResponse e = httpClient.execute(httpGet); - result = EntityUtils.toString(e.getEntity()); - logger.info("result = {}", result); - if (e.getStatusLine().getStatusCode() != 200) { - logger.info("exception: fail for status code = {}", e.getStatusLine().getStatusCode()); - throw new RouteException(result, "SERVICE_GET_ERR"); - } - e.close(); - } catch (ClientProtocolException e) { - errorMsg = url + ":httpGetWithJSON connect faild"; - logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, e, "GET_CONNECT_FAILD"); - } catch (IOException e) { - errorMsg = url + ":httpGetWithJSON connect faild"; - logger.info("exception: GET_CONNECT_FAILD {}", errorMsg); - throwsRouteException(errorMsg, e, "GET_CONNECT_FAILD"); - } - - logger.info("AbstractSdncOperationTask.httpGet end!"); - return result; } private ResourceOperationStatus getResourceOperationStatusFromXmlString(String result) { @@ -233,33 +196,30 @@ public abstract class AbstractSdncOperationTask extends BaseTask { return resourceOperationStatus; } - private String getValueByName(String Name, String xml) { - if (!StringUtils.isBlank(xml) && xml.contains(Name)) { - String start = "<" + Name + ">"; - String end = "</" + Name + ">"; + private String getValueByName(String name, String xml) { + if (!StringUtils.isBlank(xml) && xml.contains(name)) { + String start = "<" + name + ">"; + String end = "</" + name + ">"; return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, ""); } return ""; } - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + protected static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); @Override public void execute(DelegateExecution execution) { logger.info("AbstractSdncOperationTask.execute begin!"); - GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(execution); -// updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); + GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(); try { Map<String, String> inputs = getInputs(execution); -// updateProgress(execution, null, null, "30", "getGenericResourceApiClient finished!"); sendRestrequestAndHandleResponse(execution, inputs, genericResourceApiClient); execution.setVariable("SDNCA_SuccessIndicator", true); -// updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); } catch (Exception e) { logger.info("exception: AbstractSdncOperationTask.fail!"); logger.error("exception: AbstractSdncOperationTask.fail!:", e); - e.printStackTrace(); + logger.error(e.getStackTrace().toString()); execution.setVariable("SDNCA_SuccessIndicator", false); updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!"); @@ -279,9 +239,6 @@ public abstract class AbstractSdncOperationTask extends BaseTask { String key = iterator.next(); inputs.put(key, paras.getString(key)); } -/* if (paras.keys().hasNext()) { - paras.keySet().stream().forEach(key -> inputs.put(key, paras.getString((String) key))); - }*/ } logger.info("AbstractSdncOperationTask.getInputs end!"); return inputs; @@ -321,14 +278,14 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } catch (Exception exception) { logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); - LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); + msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); } } protected boolean isSend2SdncDirectly() { logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); - Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); + Map<String, String> properties = PropertyConfiguration.getInstance().getProperties(TOPOLOGY_PROPERTIES); if (properties != null) { String sdncIp = properties.get("sdnc-ip"); String sdncPort = properties.get("sdnc-port"); @@ -365,11 +322,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask { return returnPort; } - private GenericResourceApi getGenericResourceApiClient(DelegateExecution execution) { + private GenericResourceApi getGenericResourceApiClient() { logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!"); -// updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!"); String msbIp = System.getenv().get(ONAP_IP); - int msbPort = DEFAULT_MSB_Port; + int msbPort = DEFAULT_MSB_PORT; Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties"); if (properties != null) { if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) { @@ -380,7 +336,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } String strMsbPort = properties.get("msb-port"); if (StringUtils.isBlank(strMsbPort)) { - strMsbPort = getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_Port)); + strMsbPort = getString(properties, "msb.port", String.valueOf(DEFAULT_MSB_PORT)); } msbPort = Integer.valueOf(strMsbPort); } @@ -402,19 +358,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { return vlaue; } } catch (Exception e) { - LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); - } - return defaultValue; - } - - private Integer getInteger(DelegateExecution execution, String name, Integer defaultValue) { - Integer vlaue = (Integer) execution.getVariable(name); - try { - if (vlaue != null) { - return vlaue; - } - } catch (Exception e) { - LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); + msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString()); } return defaultValue; } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 60bc83b0ea..25c85f7394 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -42,7 +42,7 @@ import java.util.Map; * Created by 10112215 on 2017/9/20. */ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger logger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); + private static final Logger sdncLogger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; @@ -51,7 +51,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs, GenericResourceApi genericResourceApiClient) throws Exception { - logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); @@ -63,41 +63,41 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); saveOutput(execution, outputEntity); } else { - Send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); + send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); - logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } - private void Send2SdncDirectly(String defaulAuth, + private void send2SdncDirectly(String defaulAuth, RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { - logger.info("SdncNetworkTopologyOperationTask.Send2SdncDirectly begin!"); + sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); - logger.info("SdncNetworkTopologyOperationTask.Send2SdncDirectly end!"); + sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); } - private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws Exception { - logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); + private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { + sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); - int errorCode = Integer.valueOf(responseCode); + int errorCode = Integer.parseInt(responseCode); String errorMessage = output.getOutput().getResponseMessage(); WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage); - logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); - throw new Exception(""); + sdncLogger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); + throw new RouteException(); } - - logger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); + + sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 602894475c..130c97e273 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -42,7 +42,7 @@ import java.util.Map; * Created by 10112215 on 2017/9/26. */ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger logger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); + private static final Logger sdncLogger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; @@ -51,7 +51,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs, GenericResourceApi genericResourceApiClient) throws Exception { - logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); // updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); @@ -63,39 +63,39 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask // updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); saveOutput(execution, outputEntity); } else { - Send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); + send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } - logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } - private void Send2SdncDirectly(String defaulAuth, + private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { - logger.info("SdncServiceTopologyOperationTask.Send2SdncDirectly begin!"); + sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); - logger.info("SdncServiceTopologyOperationTask.Send2SdncDirectly end!"); + sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { - logger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); + sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); - int errorCode = Integer.valueOf(responseCode); + int errorCode = Integer.parseInt(responseCode); String errorMessage = output.getOutput().getResponseMessage(); WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); // updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); - logger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); - throw new Exception(""); + sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); + throw new RouteException(); } - logger.info("SdncServiceTopologyOperationTask.saveOutput end!"); + sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java index 49d702d1ee..add87b131e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -41,7 +41,7 @@ import java.util.Map; public class SdncUnderlayVpnOperationClient { private static final String DEFAULT_MSB_IP = "127.0.0.1"; - private static final int DEFAULT_MSB_Port = 10081; + private static final int DEFAULT_MSB_PORT = 10081; private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); private String serviceId; @@ -54,11 +54,11 @@ public class SdncUnderlayVpnOperationClient { public boolean excute(String msbIp, int msbPort, Map<String, String> inputs, - String serviceId_i, - String operationId_i, + String iServiceID, + String iOperationID, String resourceTemplateUUID_i){ - serviceId = serviceId_i; - operationId = operationId_i; + serviceId = iServiceID; + operationId = iOperationID; resourceTemplateUUID = resourceTemplateUUID_i; GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort); updateProgress(RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); @@ -72,15 +72,13 @@ public class SdncUnderlayVpnOperationClient { updateProgress(null, null, "50", "RequestBody build finished!"); RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; try { - networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyOperation - (HeaderUtil.DefaulAuth ,body).execute().body(); + genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body(); } catch (Exception e) { logger.debug("Exception: ", e); updateProgress(RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); return false; } updateProgress(null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(networkRpcOutputEntiy); updateProgress(RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); return true; } @@ -90,7 +88,7 @@ public class SdncUnderlayVpnOperationClient { msbIp = DEFAULT_MSB_IP; } if (msbPort <= 0) { - msbPort = DEFAULT_MSB_Port; + msbPort = DEFAULT_MSB_PORT; } MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); @@ -117,7 +115,7 @@ public class SdncUnderlayVpnOperationClient { requestsDB.updateResOperStatus(resourceOperationStatus); } - private void saveOutput(RpcNetworkTopologyOperationOutputEntity output) { - + private void saveOutput() { + // Not implemented. } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn index 67b0f968fa..29dbca4e55 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVFCNetworkServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> - <bpmn:process id="DoCreateVFCNetworkServiceInstance" name="DoCreateVFCNetworkServiceInstance" isExecutable="true"> + <bpmn:process id="CreateVFCNSResource" name="CreateVFCNSResource" isExecutable="true"> <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> </bpmn:startEvent> @@ -258,4 +258,4 @@ dcsi.timeDelay(execution)]]></bpmn:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..e7a88be5b8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -0,0 +1,337 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> + <bpmn:process id="UpdateCustomE2EServiceInstance" name="UpdateCustomE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_00qj6ro" name="Update SI Start Flow"> + <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:subProcess id="SubProcess_0ka59nc" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_0u3lw39" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1dsbjjb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yay321</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_0v1ffn4"> + <bpmn:outgoing>SequenceFlow_1dsbjjb</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0eznq6x"> + <bpmn:incoming>SequenceFlow_1yay321</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" /> + <bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" /> + </bpmn:subProcess> + <bpmn:callActivity id="DoUpdateE2EServiceInstance" name="Call DoUpdateE2EServiceInstance " calledElement="DoUpdateE2EServiceInstance"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="failIfExists" target="failIfExists" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="initialStatus" target="initialStatus" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="URN_mso_adapters_openecomp_db_endpoint" target="URN_mso_adapters_openecomp_db_endpoint" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_0bpd6c0" name="End"> + <bpmn:incoming>SequenceFlow_0yayvrf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1s09c7d" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s2spoq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0z4faf9</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi= new UpdateCustomE2EServiceInstance()
+csi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0ttvn8r" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14zu6wr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0je30si</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new UpdateCustomE2EServiceInstance()
+csi.prepareCompletionRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_02fyxz0" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0dug28e"> + <bpmn:outgoing>SequenceFlow_0e1r62n</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_03wysuk"> + <bpmn:incoming>SequenceFlow_1ysapam</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0u8o9p2" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0n9pexp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01umodj</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new UpdateCustomE2EServiceInstance()
+csi.prepareFalloutRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1ang7q8" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_01umodj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ysapam</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1rn6nqi" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0e1r62n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0n9pexp</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new UpdateCustomE2EServiceInstance()
+csi.sendSyncError(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0e1r62n" sourceRef="StartEvent_0dug28e" targetRef="ScriptTask_1rn6nqi" /> + <bpmn:sequenceFlow id="SequenceFlow_1ysapam" sourceRef="CallActivity_1ang7q8" targetRef="EndEvent_03wysuk" /> + <bpmn:sequenceFlow id="SequenceFlow_0n9pexp" sourceRef="ScriptTask_1rn6nqi" targetRef="ScriptTask_0u8o9p2" /> + <bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new UpdateCustomE2EServiceInstance()
+csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0aqn64l" name="Success?"> + <bpmn:incoming>SequenceFlow_0klbpxx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14zu6wr</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1fueo69</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_07uk5iy"> + <bpmn:incoming>SequenceFlow_1fueo69</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_0nbdy47" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0s2spoq" sourceRef="StartEvent_00qj6ro" targetRef="ScriptTask_1s09c7d" /> + <bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="DoUpdateE2EServiceInstance" /> + <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoUpdateE2EServiceInstance" targetRef="ExclusiveGateway_0aqn64l" /> + <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> + <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_0xupxj9" /> + <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" /> + <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UpdateCustomE2EServiceInstance"> + <bpmndi:BPMNShape id="StartEvent_00qj6ro_di" bpmnElement="StartEvent_00qj6ro"> + <dc:Bounds x="-6" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-24" y="221" width="73" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0ka59nc_di" bpmnElement="SubProcess_0ka59nc" isExpanded="true"> + <dc:Bounds x="463" y="632" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoUpdateE2EServiceInstance"> + <dc:Bounds x="717" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0"> + <dc:Bounds x="1258" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1268" y="322" width="22" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> + <dc:Bounds x="214" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r"> + <dc:Bounds x="1038" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> + <dc:Bounds x="1226" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true"> + <dc:Bounds x="348" y="370" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9"> + <dc:Bounds x="459" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true"> + <dc:Bounds x="903" y="173" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="903" y="145" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy"> + <dc:Bounds x="910" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="883" y="322" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> + <di:waypoint xsi:type="dc:Point" x="30" y="198" /> + <di:waypoint xsi:type="dc:Point" x="214" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="77" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro"> + <di:waypoint xsi:type="dc:Point" x="559" y="198" /> + <di:waypoint xsi:type="dc:Point" x="717" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="593" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> + <di:waypoint xsi:type="dc:Point" x="817" y="198" /> + <di:waypoint xsi:type="dc:Point" x="903" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="815" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> + <di:waypoint xsi:type="dc:Point" x="1276" y="238" /> + <di:waypoint xsi:type="dc:Point" x="1276" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1246" y="262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9"> + <di:waypoint xsi:type="dc:Point" x="314" y="198" /> + <di:waypoint xsi:type="dc:Point" x="459" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="341.5" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr"> + <di:waypoint xsi:type="dc:Point" x="953" y="198" /> + <di:waypoint xsi:type="dc:Point" x="990" y="198" /> + <di:waypoint xsi:type="dc:Point" x="990" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1038" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987" y="195" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> + <di:waypoint xsi:type="dc:Point" x="1138" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1226" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1137" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69"> + <di:waypoint xsi:type="dc:Point" x="928" y="223" /> + <di:waypoint xsi:type="dc:Point" x="928" y="250" /> + <di:waypoint xsi:type="dc:Point" x="928" y="250" /> + <di:waypoint xsi:type="dc:Point" x="928" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="901" y="228" width="15" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39"> + <dc:Bounds x="611" y="687" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0v1ffn4_di" bpmnElement="StartEvent_0v1ffn4"> + <dc:Bounds x="496" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="469" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0eznq6x_di" bpmnElement="EndEvent_0eznq6x"> + <dc:Bounds x="772" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="745" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0dug28e_di" bpmnElement="StartEvent_0dug28e"> + <dc:Bounds x="363" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="336" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_03wysuk_di" bpmnElement="EndEvent_03wysuk"> + <dc:Bounds x="942" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="915" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0u8o9p2_di" bpmnElement="ScriptTask_0u8o9p2"> + <dc:Bounds x="621" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ang7q8_di" bpmnElement="CallActivity_1ang7q8"> + <dc:Bounds x="798" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1rn6nqi_di" bpmnElement="ScriptTask_1rn6nqi"> + <dc:Bounds x="443" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1dsbjjb_di" bpmnElement="SequenceFlow_1dsbjjb"> + <di:waypoint xsi:type="dc:Point" x="532" y="727" /> + <di:waypoint xsi:type="dc:Point" x="611" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yay321_di" bpmnElement="SequenceFlow_1yay321"> + <di:waypoint xsi:type="dc:Point" x="711" y="727" /> + <di:waypoint xsi:type="dc:Point" x="772" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="701.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0e1r62n_di" bpmnElement="SequenceFlow_0e1r62n"> + <di:waypoint xsi:type="dc:Point" x="399" y="474" /> + <di:waypoint xsi:type="dc:Point" x="421" y="474" /> + <di:waypoint xsi:type="dc:Point" x="421" y="474" /> + <di:waypoint xsi:type="dc:Point" x="442" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ysapam_di" bpmnElement="SequenceFlow_1ysapam"> + <di:waypoint xsi:type="dc:Point" x="898" y="474" /> + <di:waypoint xsi:type="dc:Point" x="942" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="875" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0n9pexp_di" bpmnElement="SequenceFlow_0n9pexp"> + <di:waypoint xsi:type="dc:Point" x="543" y="474" /> + <di:waypoint xsi:type="dc:Point" x="570" y="474" /> + <di:waypoint xsi:type="dc:Point" x="570" y="474" /> + <di:waypoint xsi:type="dc:Point" x="621" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01umodj_di" bpmnElement="SequenceFlow_01umodj"> + <di:waypoint xsi:type="dc:Point" x="721" y="474" /> + <di:waypoint xsi:type="dc:Point" x="798" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="715.5" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index 3b97cad585..7a494db998 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -109,6 +109,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { assertTrue(map.containsKey("subscriberInfo")) verify(mex).setVariable("brgWanMacAddress", "brgmac") + verify(mex).setVariable("customerLocation", ["customerLatitude":"32.897480", "customerLongitude":"-97.040443", "customerName":"some_company"]) assertTrue(map.containsKey("serviceInputParams")) assertTrue(map.containsKey(Prefix+"requestInfo")) @@ -141,6 +142,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { def req = request .replace('"source"', '"sourceXXX"') .replace('"BRG_WAN_MAC_Address"', '"BRG_WAN_MAC_AddressXXX"') + .replace('"Customer_Location"', '"Customer_LocationXXX"') when(mex.getVariable("bpmnRequest")).thenReturn(req) when(mex.getVariable("serviceInstanceId")).thenReturn(null) @@ -164,6 +166,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { assertTrue(map.containsKey("subscriberInfo")) assertEquals("", map.get("brgWanMacAddress")) + assertEquals("", map.get("customerLocation")) assertTrue(map.containsKey("serviceInputParams")) assertTrue(map.containsKey(Prefix+"requestInfo")) diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java index 0af43a2c42..1b3bfa8c76 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java @@ -134,9 +134,9 @@ public class CreateVcpeResCustServiceTest extends AbstractTestBase { assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); assertEquals(null, workflowException); - assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0); - assertTrue(completionReq.indexOf("action>CREATE<") >= 0); - assertTrue(completionReq.indexOf("source>VID<") >= 0); + assertTrue(completionReq.contains("request-id>testRequestId<")); + assertTrue(completionReq.contains("action>CREATE<")); + assertTrue(completionReq.contains("source>VID<")); assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount")); } @@ -200,9 +200,9 @@ public class CreateVcpeResCustServiceTest extends AbstractTestBase { assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); assertEquals(null, workflowException); - assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0); - assertTrue(completionReq.indexOf("action>CREATE<") >= 0); - assertTrue(completionReq.indexOf("source>VID<") >= 0); + assertTrue(completionReq.contains("request-id>testRequestId<")); + assertTrue(completionReq.contains("action>CREATE<")); + assertTrue(completionReq.contains("source>VID<")); assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount")); } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java index 88b6464de0..d026b7a949 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java @@ -162,9 +162,9 @@ public class DeleteVcpeResCustServiceTest extends AbstractTestBase { assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); assertEquals(null, workflowException); - assertTrue(completionReq.indexOf("<request-id>testRequestId<") >= 0); - assertTrue(completionReq.indexOf("<action>DELETE<") >= 0); - assertTrue(completionReq.indexOf("<source>VID<") >= 0); + assertTrue(completionReq.contains("<request-id>testRequestId<")); + assertTrue(completionReq.contains("<action>DELETE<")); + assertTrue(completionReq.contains("<source>VID<")); assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount")); @@ -223,9 +223,9 @@ public class DeleteVcpeResCustServiceTest extends AbstractTestBase { assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); assertEquals(null, workflowException); - assertTrue(completionReq.indexOf("<request-id>testRequestId<") >= 0); - assertTrue(completionReq.indexOf("<action>DELETE<") >= 0); - assertTrue(completionReq.indexOf("<source>VID<") >= 0); + assertTrue(completionReq.contains("<request-id>testRequestId<")); + assertTrue(completionReq.contains("<action>DELETE<")); + assertTrue(completionReq.contains("<source>VID<")); assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount")); diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json index a0168bd96a..3e05ba0f9d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json @@ -32,12 +32,19 @@ "aLaCarte":"false", "userParams": [ - { - "name":"BRG_WAN_MAC_Address", - "value":"brgmac" - } - ] + { + "name":"BRG_WAN_MAC_Address", + "value":"brgmac" + }, + { + "name": "Customer_Location", + "value": { + "customerLatitude": "32.897480", + "customerLongitude": "-97.040443", + "customerName": "some_company" + } + } + ] } - } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json index 17c6d15fe7..cf02444705 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json @@ -29,14 +29,21 @@ { "subscriptionServiceType":"123456789", "aLaCarte":"false", - "userParams": - [ - { - "name":"BRG_WAN_MAC_Address", - "value":"brgmac" - } - ] + "userParams": + [ + { + "name":"BRG_WAN_MAC_Address", + "value":"brgmac" + }, + { + "name": "Customer_Location", + "value": { + "customerLatitude": "32.897480", + "customerLongitude": "-97.040443", + "customerName": "some_company" + } + } + ] } - } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json index 8583e66d33..39be40aedd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json @@ -29,14 +29,21 @@ { "subscriptionServiceType":"123456789", "aLaCarte":"false", - "userParams": - [ - { - "name":"BRG_WAN_MAC_Address", - "value":"brgmac" - } - ] + "userParams": + [ + { + "name":"BRG_WAN_MAC_Address", + "value":"brgmac" + }, + { + "name": "Customer_Location", + "value": { + "customerLatitude": "32.897480", + "customerLongitude": "-97.040443", + "customerName": "some_company" + } + } + ] } - } } diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml index 5d89e29025..9c5ce1487e 100644 --- a/bpmn/MSORESTClient/pom.xml +++ b/bpmn/MSORESTClient/pom.xml @@ -9,7 +9,6 @@ <version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.onap.so</groupId>
<artifactId>MSORESTClient</artifactId>
<packaging>jar</packaging>
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java index 87f5786807..3170e49371 100644 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java +++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java @@ -242,16 +242,16 @@ public class RESTClient { /** * Creates a RESTClient with the RESTConfig object. * - * @param RESTConfig config to use for sending request + * @param restConfig config to use for sending request * * @throws RESTException if unable to create a RESTClient */ - public RESTClient(RESTConfig cfg) throws RESTException { + public RESTClient(RESTConfig restConfig) throws RESTException { this.headers = new LinkedHashMap<>(); this.parameters = new LinkedHashMap<>(); - this.URL = cfg.getURL(); - this.proxyHost = cfg.getProxyHost(); - this.proxyPort = cfg.getProxyPort(); + this.URL = restConfig.getURL(); + this.proxyHost = restConfig.getProxyHost(); + this.proxyPort = restConfig.getProxyPort(); } /** diff --git a/bpmn/pom.xml b/bpmn/pom.xml index d36d4c785d..bcd95e5f09 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -9,7 +9,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> <name>BPMN Subsystem</name> <description>BPMN Subsystem for MSO</description> diff --git a/common/pom.xml b/common/pom.xml index 48518aea31..c83f7d344a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>common</artifactId> <name>MSO Common classes</name> <description>MSO Common classes:- Logger</description> diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java index b8c4aed8fa..6588995308 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java +++ b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java @@ -98,11 +98,11 @@ public class MsoLogger { public enum Catalog { APIH, BPEL, RA, ASDC, GENERAL - }; + } public enum StatusCode { COMPLETE, ERROR - }; + } public enum ResponseCode { Suc(0), PermissionError(100), DataError(300), DataNotFound(301), BadRequest(302), SchemaError( @@ -115,10 +115,10 @@ public class MsoLogger { return this.value; } - private ResponseCode(int value) { + ResponseCode(int value) { this.value = value; } - }; + } public enum ErrorCode { PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError( @@ -130,10 +130,10 @@ public class MsoLogger { return this.value; } - private ErrorCode(int value) { + ErrorCode(int value) { this.value = value; } - }; + } private EELFLogger logger, auditLogger, metricsLogger; private static final String CONFIG_FILE = System.getProperty("jboss.home.dir") + "/mso-config/uuid/uuid_" diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java index 8da155fe08..ec0b54a14f 100644 --- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java +++ b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java @@ -159,15 +159,9 @@ public class MsoJsonProperties extends AbstractMsoProperties { @Override public String toString() { - StringBuilder response = new StringBuilder(); - response.append("Config file ").append(propertiesFileName).append("(Timer:").append(automaticRefreshInMinutes) - .append("mins):").append(System.getProperty("line.separator")); - response.append(this.jsonRootNode.toString()); - response.append(System.getProperty("line.separator")); - response.append(System.getProperty("line.separator")); - return response.toString(); - + return "Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" + System + .getProperty("line.separator") + this.jsonRootNode.toString() + System.getProperty("line.separator") + + System.getProperty("line.separator"); } - } diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java index 488bb354ee..b89a5d4791 100644 --- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java +++ b/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java @@ -23,8 +23,8 @@ package org.openecomp.mso.properties; public class MsoPropertiesParameters { - protected enum MsoPropertiesType {JSON_PROP,JAVA_PROP}; - + protected enum MsoPropertiesType {JSON_PROP,JAVA_PROP} + protected MsoPropertiesType msoPropertiesType; protected int refreshCounter; diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index 8eab5d6a47..28cc3b5ff4 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -8,8 +8,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - - <groupId>org.onap.so</groupId> <artifactId>mso-api-handler-common</artifactId> <name>ECOMP MSO API Handler common</name> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java index 4e1468c4e9..2c7bd1cc36 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java @@ -130,33 +130,35 @@ public class NetworkInfoHandler { if (ar.getVnfType () != null) { vi.setNetworkType (ar.getVnfType ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + + break; } if (ar.getTenantId () != null) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java index c87b4f387d..3d419926f1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java @@ -147,24 +147,27 @@ public class NetworkMsoInfraRequest { } // Verify that the elements correspond to the version - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null || - this.networkInputs.getServiceInstanceId() != null) { - throw new ValidationException ("format for v1 version of network request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null || - this.networkInputs.getServiceInstanceId() != null) { - throw new ValidationException ("format for v2 version of network request"); - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null + || + this.networkInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v1 version of network request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null || + this.networkInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v2 version of network request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of network request"); + } + break; } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of network request"); - } - } switch (action) { case UPDATE: diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java index 79247deca8..6a770202fa 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java @@ -158,33 +158,35 @@ public class NetworkRequestHandler { if (ar.getVnfType () != null) { vi.setNetworkType (ar.getVnfType ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + + break; } if (ar.getTenantId () != null) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java index a5e1f6f4e2..d13212a483 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java @@ -148,50 +148,52 @@ public class VnfInfoHandler { if (ar.getVolumeGroupId () != null) { vi.setVolumeGroupId (ar.getVolumeGroupId ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + break; } qr.setVnfInputs (vi); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java index 80d0c48a5e..1f3008aa1a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java @@ -157,26 +157,29 @@ public class VnfMsoInfraRequest { throw new ValidationException ("format for vnf request"); } // Verify that the elements correspond to the version - - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.vnfInputs.getVfModuleName () != null || this.vnfInputs.getVfModuleId () != null || - this.vnfInputs.getVfModuleModelName () != null || this.vnfInputs.getAsdcServiceModelVersion () != null || - this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null || - this.vnfInputs.getServiceInstanceId () != null) { - throw new ValidationException ("format for v1 version of vnf request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null || this.vnfInputs.getServiceInstanceId () != null) { - throw new ValidationException ("format for v2 version of vnf request"); - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.vnfInputs.getVfModuleName() != null || this.vnfInputs.getVfModuleId() != null || + this.vnfInputs.getVfModuleModelName() != null || this.vnfInputs.getAsdcServiceModelVersion() != null + || + this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null || + this.vnfInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v1 version of vnf request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null + || this.vnfInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v2 version of vnf request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of vnf request"); + } + break; } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of vnf request"); - } - } if (!InfraUtils.isActionAllowed (props, "vnf", version, action.value ())) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java index 2b7e71ad9c..098ed31b58 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java @@ -179,50 +179,52 @@ public class VnfRequestHandler { if (ar.getVolumeGroupId () != null) { vi.setVolumeGroupId (ar.getVolumeGroupId ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + break; } qr.setVnfInputs (vi); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java index 3de945a275..c74bb0734d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java @@ -134,43 +134,45 @@ public class VolumeInfoHandler { if (ar.getVnfType () != null) { vi.setVnfType (ar.getVnfType ()); } - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - if (ar.getVnfId () != null) { - vi.setVnfId (ar.getVnfId ()); - } - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + if (ar.getVnfId() != null) { + vi.setVnfId(ar.getVnfId()); + } + break; + } if (ar.getTenantId () != null) { vi.setTenantId (ar.getTenantId ()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java index 0524a85bf3..f908a3f0d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java @@ -144,24 +144,27 @@ public class VolumeMsoInfraRequest { // Verify that the elements correspond to the version - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || - this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v1 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v2 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of volume request"); - } - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || + this.volumeInputs.getVfModuleModelName() != null + || this.volumeInputs.getAsdcServiceModelVersion() != null || + this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) { + throw new ValidationException("format for v1 version of volume request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || + this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) { + throw new ValidationException("format for v2 version of volume request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of volume request"); + } + break; + } if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java index d1c1c18e87..e3af83df92 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java @@ -166,43 +166,45 @@ public class VolumeRequestHandler { if (ar.getVnfType () != null) { vi.setVnfType (ar.getVnfType ()); } - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - if (ar.getVnfId () != null) { - vi.setVnfId (ar.getVnfId ()); - } - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + if (ar.getVnfId() != null) { + vi.setVnfId(ar.getVnfId()); + } + break; + } if (ar.getTenantId () != null) { vi.setTenantId (ar.getTenantId ()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index 21c59ac6d5..664f810b35 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -127,7 +127,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -198,7 +198,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -269,7 +269,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -333,7 +333,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -393,7 +393,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -434,7 +434,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -459,7 +459,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -485,7 +485,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -510,7 +510,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -527,7 +527,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
// assertTrue(true);
}
@@ -553,7 +553,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
@Test
@@ -571,7 +571,7 @@ public class E2EServiceInstancesTest { Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
assertTrue(respStr
- .indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
+ .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));
}
@Test
@@ -581,7 +581,7 @@ public class E2EServiceInstancesTest { Response resp = instance.deleteE2EServiceInstance(request, "v3",
"12345678");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
+ assertTrue(respStr.contains("SVC1000"));
}
@Test
@@ -610,4 +610,147 @@ public class E2EServiceInstancesTest { .getE2EServiceInstances("12345", "v3", "123456");
}
+
+ @Test
+ public void updateE2EServiceInstanceTestNormal() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ operationStatus.setProgress("100");
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("success"));
+ }
+
+ @Test
+ public void updateE2EServiceInstanceTestChkStatusFalse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java index 27d395857b..d3d995e851 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java @@ -64,7 +64,7 @@ public class ServiceInstanceTest { String requestJson = "{\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v5");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
}
@Test
@@ -84,7 +84,8 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding.") != -1);
+ assertTrue(respBody.contains(
+ "Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding."));
}
@Test
@@ -121,7 +122,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Exception while creating record in DB null") != -1);
+ assertTrue(respBody.contains("Exception while creating record in DB null"));
}
@Test
@@ -165,7 +166,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Failed calling bpmn properties") != -1);
+ assertTrue(respBody.contains("Failed calling bpmn properties"));
}
@Test(expected = Exception.class)
@@ -306,7 +307,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);
+ assertTrue(respBody.contains("Request Failed due to BPEL error with HTTP Status"));
}
@Test
@@ -377,7 +378,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v5");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("No valid modelVersionId is specified") != -1);
+ assertTrue(respBody.contains("No valid modelVersionId is specified"));
}
@Test
@@ -441,7 +442,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("bpelResponse is null") != -1);
+ assertTrue(respBody.contains("bpelResponse is null"));
}
@Test
@@ -461,7 +462,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
+ assertTrue(respBody.contains("Recipe could not be retrieved from catalog DB null"));
}
@@ -476,7 +477,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v5");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelVersionId is specified"));
}
@Test
@@ -490,7 +491,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid instanceName is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid instanceName is specified"));
}
@@ -505,7 +506,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid model-info is specified"));
}
@Test
@@ -519,7 +520,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"1234\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
}
@Test
@@ -533,7 +534,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
}
@@ -548,7 +549,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelType is specified"));
}
@Test
@@ -562,7 +563,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"testmodel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Mapping of request to JSON object failed.") != -1);
+ assertTrue(respBody.contains("Mapping of request to JSON object failed."));
}
@Test
@@ -576,7 +577,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid modelName is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid modelName is specified"));
}
@Test
@@ -590,7 +591,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. AutoBuildVfModule is not valid in the v2 version") != -1);
+ assertTrue(respBody.contains("Error parsing request. AutoBuildVfModule is not valid in the v2 version"));
}
@Test
@@ -604,7 +605,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
}
@Test
@@ -618,7 +619,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respBody = resp.getEntity().toString();
- assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ assertTrue(respBody.contains("Error parsing request. No valid subscriptionServiceType is specified"));
}
@Test
@@ -627,7 +628,7 @@ public class ServiceInstanceTest { String requestJson = "{\"name\":\"test\"}";
Response resp = instance.createServiceInstance(requestJson, "v2");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
/*** Activate Service Instance Test Cases ***/
@@ -638,7 +639,7 @@ public class ServiceInstanceTest { String requestJson = "{\"name\":\"test\"}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
@Test
@@ -652,7 +653,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
}
@Test
@@ -666,7 +667,8 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ assertTrue(respStr.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
}
@Test
@@ -680,7 +682,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Deactivate Service Instance Test Cases ***/
@@ -691,7 +693,7 @@ public class ServiceInstanceTest { String requestJson = "{\"name\":\"test\"}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
@Test
@@ -705,7 +707,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
}
@Test
@@ -719,7 +721,8 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ assertTrue(respStr.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
}
@Test
@@ -733,7 +736,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Delete Service Instance Test Cases ***/
@@ -744,7 +747,7 @@ public class ServiceInstanceTest { String requestJson = "{\"name\":\"test\"}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ assertTrue(respStr.contains("Mapping of request to JSON object failed"));
}
@Test
@@ -758,7 +761,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
}
@Test
@@ -772,7 +775,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid modelVersionId is specified"));
}
@Test
@@ -786,7 +789,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Create Vnf Instance Test Cases ***/
@@ -802,7 +805,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid cloudConfiguration is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid cloudConfiguration is specified"));
}
@Test
@@ -817,7 +820,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"cloudConfiguration\":{}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid lcpCloudRegionId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid lcpCloudRegionId is specified"));
}
@Test
@@ -832,7 +835,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Error parsing request. No valid tenantId is specified") != -1);
+ assertTrue(respStr.contains("Error parsing request. No valid tenantId is specified"));
}
@Test
@@ -847,7 +850,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Replace Vnf Instance Test Cases ***/
@@ -863,7 +866,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.replaceVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Update Vnf Instance Test Cases ***/
@@ -880,7 +883,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.updateVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
/*** Update Vnf Instance Test Cases ***/
@@ -897,6 +900,6 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
Response resp = instance.deleteVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index 7f2f78df81..d6b0b6b419 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -699,7 +699,7 @@ public class RequestsDatabase { * update the resource operation * <br> * - * @param operstatus the resource operation object + * @param operStatus the resource operation object * @since ONAP Amsterdam Release */ public void updateResOperStatus(ResourceOperationStatus operStatus) { diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index 06eedc5675..08d5ba7d41 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>mso-api-handlers</artifactId> <name>API Handler</name> <description>API Handler for MSO</description> diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index e3115f1ff1..99977a46aa 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>mso-catalog-db</artifactId> <name>mso-catalog-db</name> <description>MSO Catalog Database definition and Hibernate objects</description> diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index bd3b988254..6b27c50609 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -1175,14 +1175,11 @@ public class CatalogDatabase implements Closeable { * @return VnfRecipe object or null if none found */ public VnfRecipe getVnfRecipeByNameVersion(String modelName, String modelVersion, String action) { - StringBuilder hql = new StringBuilder("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action "); long startTime = System.currentTimeMillis(); - LOGGER.debug("Catalog database - get VNF recipe with name " + modelName - + " and action " - + action); + LOGGER.debug("Catalog database - get VNF recipe with name " + modelName + " and action " + action); - Query query = getSession().createQuery(hql.toString()); + Query query = getSession().createQuery("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action "); query.setParameter(VNF_TYPE, modelName); query.setParameter(MODEL_VERSION, modelVersion); query.setParameter(ACTION, action); @@ -1195,7 +1192,7 @@ public class CatalogDatabase implements Closeable { return null; } - Collections.sort(resultList, new MavenLikeVersioningComparator()); + resultList.sort(new MavenLikeVersioningComparator()); Collections.reverse(resultList); LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); @@ -1638,7 +1635,7 @@ public class CatalogDatabase implements Closeable { * Return the VnfResourceCustomization object identified by the given modelCustomizationUuid 1707 * Note that the corresponding VnfResource Object will be put in the VnfResourceCustomization bean * - * @param getVnfResourceCustomizationByModelVersionId + * @param modelVersionId * @return VnfResourceCustomization or null if not found */ public VnfResourceCustomization getVnfResourceCustomizationByModelVersionId(String modelVersionId) { @@ -1920,7 +1917,7 @@ public class CatalogDatabase implements Closeable { * Return the VnfResourceCustomization object identified by the given modelCustomizationUuid 1707 * Note that the corresponding VnfResource Object will be put in the VnfResourceCustomization bean * - * @param modelCustomizationUuid + * @param modelUuid * @return VnfResourceCustomization or null if not found */ public VnfResource getVnfResourceByModelUuid(String modelUuid) { @@ -2828,7 +2825,7 @@ public class CatalogDatabase implements Closeable { * Return a VNF Module List that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION * - * @param vnfModuleType + * @param vfModuleType * @parm modelCustomizationUuid * @param asdcServiceModelVersion * @param modelVersion @@ -3366,7 +3363,9 @@ public class CatalogDatabase implements Closeable { /** * Return a ServiceToResourceCustomization object * - * @param vfModuleModelUuid, heatFilesArtifactUuid + * @param serviceModelUuid + * @param resourceModelCustomizationUuid + * @param modelType * @return VfModuleToHeatFiles or null if none found */ public ServiceToResourceCustomization getServiceToResourceCustomization(String serviceModelUuid, String resourceModelCustomizationUuid, String modelType) { @@ -3392,7 +3391,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Map<String, HeatFiles> for returning the heat files associated with a vfModule 1707 * - * @param parentHeatTemplateId + * @param vfModuleModelUuid * @return Map<String,Object> or null if none found */ public Map <String, HeatFiles> getHeatFilesForVfModule(String vfModuleModelUuid) { @@ -3608,7 +3607,7 @@ public class CatalogDatabase implements Closeable { /** * Retrieves a Heat environment from DB based on its unique key. 1707 * - * @param name the environment artifact name + * @param artifactUuid the environment artifact name * @param version the environment resource version * @return the heat environment from DB or null if not found */ @@ -3841,7 +3840,7 @@ public class CatalogDatabase implements Closeable { /** * Return the newest version of a specific Tosca CSAR Record resource (queried by Name). * - * @param ToscaCsar + * @param artifactChecksum * @return ToscaCsar object or null if none found */ public ToscaCsar getToscaCsar (String artifactChecksum) { @@ -4404,9 +4403,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID * - * @param networkType - * @param action - * @param serviceType + * @param modelUUID * @return NetworkRecipe object or null if none found */ public NetworkResource getNetworkResourceByModelUuid(String modelUUID) { @@ -4576,7 +4573,7 @@ public class CatalogDatabase implements Closeable { return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); + resultList.sort(new MavenLikeVersioningComparator()); Collections.reverse (resultList); return resultList.get (0); @@ -4588,9 +4585,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID * - * @param networkType - * @param action - * @param serviceType + * @param modelCustomizationUuid * @return NetworkRecipe object or null if none found */ public NetworkResource getNetworkResourceByModelCustUuid(String modelCustomizationUuid) { @@ -4679,7 +4674,7 @@ public class CatalogDatabase implements Closeable { /** * Return a VnfComponents recipe that matches a given VF_MODULE_ID, VNF_COMPONENT_TYPE, ACTION * - * @param vfModuleId + * @param vfModuleModelUUId * @param vnfComponentType * @param action * @return VnfComponentsRecipe object or null if none found @@ -4801,7 +4796,7 @@ public class CatalogDatabase implements Closeable { /** * Return a VfModule record that matches a given MODEL_NAME * - * @param modelName + * @param modelUUID * @return VfModule object or null if none found */ public VfModule getVfModuleByModelUUID (String modelUUID) { @@ -5163,7 +5158,7 @@ public class CatalogDatabase implements Closeable { return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); + resultList.sort(new MavenLikeVersioningComparator()); Collections.reverse (resultList); return resultList.get (0); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java index b4c1f0594f..e22d1eb036 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java @@ -37,10 +37,6 @@ public class ArRecipe extends Recipe implements Serializable { @Override public String toString () { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append(",modelName=").append(modelName); - sb.append(",arParamXSD=").append(getParamXSD()); - return sb.toString(); + return super.toString() + ",modelName=" + modelName + ",arParamXSD=" + getParamXSD(); } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java index 7f8c3dbacb..7ef5a4a7b9 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java @@ -89,7 +89,7 @@ public class ModelRecipe extends MavenLikeVersioning implements Serializable { } /** - * @param versionStr the versionStr to set + * @param schemaVersion the versionStr to set */ public void setSchemaVersion(String schemaVersion) { this.schemaVersion = schemaVersion; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java index b211dbd4c3..cb5bf64b8c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java @@ -179,21 +179,17 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser @Override public String toString() { - StringBuilder sb = new StringBuilder("VnfResourceCustomization: "); - sb.append("ModelCustUuid=").append(this.modelCustomizationUuid); - sb.append(", ModelInstanceName=").append(this.modelInstanceName); - sb.append(", vnfResourceModelUuid=").append(this.vnfResourceModelUUID); - sb.append(", creationTimestamp=").append(this.created); - sb.append(", minInstances=").append(this.minInstances); - sb.append(", maxInstances=").append(this.maxInstances); - sb.append(", availabilityZoneMaxCount=").append(this.availabilityZoneMaxCount); -// sb.append(", vnfResource:\n" + this.vnfResource == null ? "null" : this.vnfResource.toString()); - sb.append(", nfFunction=").append(this.nfFunction); - sb.append(", nfType=").append(this.nfType); - sb.append(", nfRole=").append(this.nfRole); - sb.append(", nfNamingCode=").append(this.nfNamingCode); - - return sb.toString(); + return "VnfResourceCustomization: " + "ModelCustUuid=" + this.modelCustomizationUuid + + ", ModelInstanceName=" + this.modelInstanceName + + ", vnfResourceModelUuid=" + this.vnfResourceModelUUID + + ", creationTimestamp=" + this.created + + ", minInstances=" + this.minInstances + + ", maxInstances=" + this.maxInstances + + ", availabilityZoneMaxCount=" + this.availabilityZoneMaxCount + + ", nfFunction=" + this.nfFunction + + ", nfType=" + this.nfType + + ", nfRole=" + this.nfRole + + ", nfNamingCode=" + this.nfNamingCode; } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java index 3dddb17d7c..c99a714b11 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/MavenVersioningTest.java @@ -167,7 +167,7 @@ public class MavenVersioningTest { list.add(test11); list.add(test12); - Collections.sort(list,new MavenLikeVersioningComparator()); + list.sort(new MavenLikeVersioningComparator()); //Collections.reverse(list); assertTrue(list.get(0).getVersion().equals("0.02")); assertTrue(list.get(1).getVersion().equals("1.1")); diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index 1957dc7928..b13bbcfb4d 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -9,7 +9,6 @@ </parent> <packaging>pom</packaging> - <groupId>org.onap.so</groupId> <artifactId>docker</artifactId> <name>MSO Docker Deliveries</name> diff --git a/packages/pom.xml b/packages/pom.xml index 74d4c309a4..c298501212 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.onap.so</groupId>
<artifactId>packages</artifactId>
<packaging>pom</packaging>
<name>MSO Packages</name>
diff --git a/status-control/pom.xml b/status-control/pom.xml index e8ba05e065..413090ec65 100644 --- a/status-control/pom.xml +++ b/status-control/pom.xml @@ -9,7 +9,6 @@ <version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.onap.so</groupId>
<artifactId>status-control</artifactId>
<name>MSO Status Control module</name>
<description>Contains classes to update and query the MSO status per site</description>
|