diff options
58 files changed, 1807 insertions, 1422 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-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/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-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 856b713c94..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) @@ -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/pom.xml b/aria/pom.xml index a754d78ed1..5f3f2070f6 100644 --- a/aria/pom.xml +++ b/aria/pom.xml @@ -7,7 +7,6 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <groupId>org.onap.so</groupId> <artifactId>aria</artifactId> <name>ARIA related artifacts</name> <description>ARIA related artifacts</description> 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/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/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..b56a438364 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java @@ -0,0 +1,290 @@ +/*-
+ * ============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;
+
+ @JsonProperty("resourceType")
+ private String resourceType;
+
+ //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 resourceType.
+ */
+ @JsonProperty("resourceType")
+ public String getResourceType() {
+ return resourceType;
+ }
+
+
+ /**
+ * @param resourceType The resourceType to set.
+ */
+ @JsonProperty("resourceType")
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+
+ /**
+ * @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 2ad1e30316..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 @@ -94,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/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/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/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/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/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/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/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/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/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/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/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/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 c556ddadb5..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); @@ -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); @@ -5161,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/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>
|