diff options
40 files changed, 944 insertions, 867 deletions
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..699bd7c684 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 @@ -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-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 0b404d76bd..99f6e86b00 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -333,7 +333,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { * * @param serviceId * @param operationId - * @param resourceUUID + * @param resourceTemplateUUID * @return * @throws MsoRequestsDbException * @since ONAP Amsterdam Release @@ -350,7 +350,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { * * @param serviceId * @param operationId - * @param resourceUUID + * @param resourceTemplateUUID * @param operationType * @param resourceInstanceID * @param jobId @@ -363,13 +363,13 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { */ @Override public void updateResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID, - String operType, String resourceInstanceID, String jobId, String status, String progress, + String operationType, String resourceInstanceID, String jobId, String status, String progress, String errorCode, String statusDescription) throws MsoRequestsDbException { ResourceOperationStatus resStatus = new ResourceOperationStatus(); resStatus.setServiceId(serviceId); resStatus.setOperationId(operationId); resStatus.setResourceTemplateUUID(resourceTemplateUUID); - resStatus.setOperType(operType); + resStatus.setOperType(operationType); resStatus.setResourceInstanceID(resourceInstanceID); resStatus.setJobId(jobId); resStatus.setStatus(status); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java index be0466af73..fa257164cf 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java @@ -154,12 +154,7 @@ public abstract class SDNCConnector { LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", ""); return createResponseFromContent(statusCode, statusMessage, responseContent, rt); - } catch (SocketTimeoutException e) { - String errMsg = "Request to SDNC timed out"; - logError(errMsg, e); - return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); - - } catch (ConnectTimeoutException e) { + } catch (SocketTimeoutException | ConnectTimeoutException e) { String errMsg = "Request to SDNC timed out"; logError(errMsg, e); return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java index 48da1aba71..5f779dd085 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java @@ -60,7 +60,7 @@ public class VfcAdapterRest { /** * Create a NS <br> * - * @param servletReq the http request + * @param data the http request * @return * @since ONAP Amsterdam Release */ diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java index 61966d07f2..30d42ae387 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java @@ -39,7 +39,7 @@ public class ApplicationException extends Exception { * </p> * * @param errorCode error status - * @param errorDetail error detail + * @param errorMsg error detail * @since ONAP Amsterdam Release 2017-9-6 */ public ApplicationException(int errorCode, String errorMsg) { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index afee1bbfaa..fcbbf8515a 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -166,12 +166,7 @@ public class RestfulUtil { method = null; return createResponse(statusCode, responseContent); - } catch(SocketTimeoutException e) { - String errMsg = "Request to VFC timed out"; - logError(errMsg, e); - return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); - - } catch(ConnectTimeoutException e) { + } catch(SocketTimeoutException | ConnectTimeoutException e) { String errMsg = "Request to VFC timed out"; logError(errMsg, e); return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java index c79d09e09a..13727bdc49 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java @@ -47,7 +47,7 @@ public class ValidateUtil { * Assert String parameter.<br/>
*
* @param paramValue parameter data
- * @param name of parameter
+ * @param paramName parameter name
* @since ONAP Amsterdam Release 2017-9-6
*/
public static void assertStringNotNull(String paramValue, String paramName)
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java index 95d3bf610f..759ceedd0f 100644 --- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java @@ -60,7 +60,7 @@ public class VfcAdapterTest { /** * mock get request body <br> * - * @param request + * @param fileName * @return * @since ONAP Amsterdam Release */ @@ -71,7 +71,6 @@ public class VfcAdapterTest { /** * Mock the request body form a file <br> * - * @param fileName * @since ONAP Amsterdam Release */ private void mockRestfulUtil() { diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java index 4842580d85..5c654298fb 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -371,8 +371,9 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { * @param cloudSiteId CLLI code of the cloud site in which to delete * @param tenantId Openstack tenant identifier * @param vnfName VNF Name or Openstack ID + * @param messageId * @param msoRequest Request tracking information for logs - * @param notificationURL the target URL for asynchronous response + * @param notificationUrl the target URL for asynchronous response */ @Override public void deleteVnfA (String cloudSiteId, diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index caab1e31bc..9022c26ccd 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -536,8 +536,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { final Object obj = JSON_MAPPER.treeToValue(node, Object.class); final String json = JSON_MAPPER.writeValueAsString(obj); return json; - } catch (JsonParseException jpe) { - LOGGER.debug("Error converting json to string " + jpe.getMessage(),jpe); } catch (Exception e) { LOGGER.debug("Error converting json to string " + e.getMessage(),e); } diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java index 3452a10db9..856b713c94 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 @@ -145,7 +145,7 @@ public interface VduPlugin { * @param tenantId The cloud tenant in which to delete the VDU. * @param vduInstanceId The unique id of the deployment to delete. * @param timeoutMinutes Timeout after which the delete action will be cancelled - * @param deleteBlueprint Flag to also delete the blueprint + * @param keepBlueprintLoaded Flag to also delete the blueprint * * @return A VduInfo object, representing the state of the instance just prior to deletion. * diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java index 295dddd53a..430bd10892 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java @@ -78,7 +78,7 @@ public class ASDCGlobalController { /** * Check that controllers list needs to be updated or not. - * @param return true if the list has been updated + * return true if the list has been updated */ private boolean updateControllersListIfNeeded () { boolean updateNeeded=false; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java index 5972c76c41..2ad1e30316 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java @@ -38,11 +38,10 @@ public class CryptoUtils { public static final String AES = "AES";
/**
- * encrypt a value and generate a keyfile
+ * encrypt a value and generate a keyfile
* if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * @throws IOException
- */
+ * @throws GeneralSecurityException
+ * */
public static String encrypt(String value, String keyString) throws GeneralSecurityException
{
SecretKeySpec sks = getSecretKeySpec(keyString);
@@ -53,9 +52,8 @@ public class CryptoUtils { }
/**
- * decrypt a value
+ * decrypt a value
* @throws GeneralSecurityException
- * @throws IOException
*/
public static String decrypt(String message, String keyString) throws GeneralSecurityException
{
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java index 765bf61c49..f7db52b1c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java @@ -71,7 +71,7 @@ public class ApplicationControllerSupport { } /** - * @param inputClass + * @param action * @return * @throws ClassNotFoundException * @throws InstantiationException diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java index 124e2c3a28..f54eba406e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java @@ -42,7 +42,7 @@ public class DMaaPRestClient extends RestClient { @Override protected void initializeHeaderMap(Map<String, String> headerMap) { - headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes())); + headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes())); } @Override diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java index c746c0d448..df30e43822 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java @@ -27,8 +27,8 @@ public interface SDNOValidator { /** * Issues a health diagnostic request for a given vnf to SDN-O * - * @param vnfName - * @param uuid + * @param vnfId + * @param requestingUserId * @throws IOException * @throws Exception */ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java index b71f708797..6f0095fb02 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java @@ -1829,7 +1829,7 @@ public class WorkflowTest { /**
* Constructor
* @param contentType the HTTP content type (optional)
- * @param type the callback message type (optional)
+ * @param messageType the callback message type (optional)
* @param content the content
*/
public CallbackData(String contentType, String messageType, String content) {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java index 6059a357b6..b6272057a5 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java @@ -238,7 +238,6 @@ public class PropertyConfiguration { * Reads properties from the specified file, updates the property file cache, and * returns the properties in a map. * @param file the file to read - * @param reload true if this is a reload event * @return a map of properties */ private Map<String, String> readProperties(File file) throws IOException { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java index b972d6a815..a1719a90ef 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java @@ -176,7 +176,7 @@ public class PropertyConfigurationSetup { * PropertyConfiguration, just like they do when a property file is updated on * a real MSO system. This method will optionally wait for the new properties * to be loaded. Timeout results in an IOException. - * @param values new properties + * @param properties new properties * @param wait maximum amount of time to wait for new properties to be loaded, * in milliseconds. A value of zero means, "Do not wait." * @throws IOException diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/JsonWrapper.java index 4d895f3279..fbed36548e 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,10 +92,6 @@ 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) {
@@ -113,8 +109,6 @@ public abstract class JsonWrapper implements Serializable { jsonString = mapper.writeValueAsString(list);
} catch (JsonGenerationException e) {
LOGGER.debug("Exception :",e);
- } catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
} catch (IOException e) {
LOGGER.debug("Exception :",e);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java index a09f5a7849..20903c0717 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/VnfResource.java @@ -146,7 +146,6 @@ public class VnfResource extends Resource { *
* default setter for this field deprecated
* @param modelName << serviceResources.modelInfo.modelName
- * @param modelInstanceName
*/
public void constructVnfType(String modelName) {
this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index 2612c383ab..b0152a1296 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -117,7 +117,7 @@ public class JsonUtils { * to convert a JSONObject to an XML Doc. The intent of this is to
* correctly generate XML from JSON including TAGs for JSONArrays
*
- * @param jsonObj org.json.JSON object to be converted to XML
+ * @param obj object to be converted to XML
* @param tagName optional XML tagname supplied primarily during recursive calls
* @return String containing the XML translation
*/
@@ -913,7 +913,7 @@ public class JsonUtils { * and puts it in a Java List<String>.
*
* @param execution
- * @param stringArray - the getJsonValue of a json array of strings
+ * @param jsonArrayOfStrings - the getJsonValue of a json array of strings
*
* @return List - a java list containing the strings
*
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonWrapper.java index 967b1dfe1c..cfa5c853a3 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,10 +85,6 @@ 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) {
@@ -106,8 +102,6 @@ public abstract class JsonWrapper implements Serializable { jsonString = mapper.writeValueAsString(list);
} catch (JsonGenerationException e) {
LOGGER.debug("Exception :",e);
- } catch (JsonMappingException e) {
- LOGGER.debug("Exception :",e);
} catch (IOException e) {
LOGGER.debug("Exception :",e);
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java index 177fafcd4b..c48b671b72 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/mybatis/URNMapping.java @@ -93,7 +93,7 @@ public class URNMapping { * aai:endpoint becomes URN_aai_endpoint <br/> * ae:internal-reporting becomes URN_ae_internal_reporting <br/> * - * @param name the URN + * @param urn the URN * @return a normalized identifier */ public static String createIdentifierFromURN(String urn) { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java index f5b9f8dc56..1fc43baef8 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java @@ -130,7 +130,7 @@ public final class XmlTool { /** * Encodes a value so it can be used inside an XML text element. - * @param s the string to encode + * @param value the string to encode * @return the encoded string */ public static String encode(Object value) { @@ -171,7 +171,7 @@ public final class XmlTool { /** * Encodes a value so it can be used inside an XML attribute. - * @param s the string to encode + * @param value the string to encode * @return the encoded string */ public static String encodeAttr(Object value) { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index dd6d4514bc..e1cae802e7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -1,753 +1,835 @@ -/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.bpmn.vcpe.scripts;
-
-import groovy.xml.XmlUtil
-import groovy.json.*
-
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.common.scripts.VidUtils
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.domain.*
-
-import java.util.UUID;
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.apache.commons.lang3.*
-import org.apache.commons.codec.binary.Base64;
-import org.springframework.web.util.UriUtils;
-import static org.apache.commons.lang3.StringUtils.*
-
-/**
- * This groovy class supports the <class>CreateVcpeResCustService.bpmn</class> process.
- *
- * @author ek1439
- *
- */
-public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
-
- private static final String DebugFlag = "isDebugLogEnabled"
-
- String Prefix="CVRCS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
-
- /**
- * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
- * @param execution
- */
- public InitializeProcessVariables(Execution execution){
- /* Initialize all the process variables in this block */
-
- execution.setVariable("createVcpeServiceRequest", "")
- execution.setVariable("globalSubscriberId", "")
- execution.setVariable("serviceInstanceName", "")
- execution.setVariable("msoRequestId", "")
- execution.setVariable(Prefix+"VnfsCreatedCount", 0)
- execution.setVariable("productFamilyId", "")
- execution.setVariable("brgWanMacAddress", "")
-
- //TODO
- execution.setVariable("sdncVersion", "1707")
- }
-
- // **************************************************
- // Pre or Prepare Request Section
- // **************************************************
- /**
- * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
- * @param execution
- */
- public void preProcessRequest (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix",Prefix)
-
- utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
-
- try {
- // initialize flow variables
- InitializeProcessVariables(execution)
-
- //Config Inputs
- String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')
- if (isBlank(aaiDistDelay)) {
- msg = "URN_mso_workflow_aai_distribution_delay is null"
- utils.log("DEBUG", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
- execution.setVariable("aaiDistDelay", aaiDistDelay)
- utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled)
-
- // check for incoming json message/input
- String createVcpeServiceRequest = execution.getVariable("bpmnRequest")
- utils.logAudit(createVcpeServiceRequest)
- execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest);
- println 'createVcpeServiceRequest - ' + createVcpeServiceRequest
-
- // extract requestId
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
-
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {
- serviceInstanceId = UUID.randomUUID().toString()
- utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled)
- } else {
- utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled)
- }
-
- serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
- execution.setVariable("serviceInstanceId", serviceInstanceId)
-
- String requestAction = execution.getVariable("requestAction")
- execution.setVariable("requestAction", requestAction)
-
- setBasicDBAuthHeader(execution, isDebugEnabled)
-
- String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source")
- if ((source == null) || (source.isEmpty())) {
- source = "VID"
- }
- execution.setVariable("source", source)
-
- // extract globalSubscriberId
- String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")
-
- // verify element global-customer-id is sent from JSON input, throw exception if missing
- if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) {
- String dataErrorMessage = " Element 'globalSubscriberId' is missing. "
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- execution.setVariable("globalCustomerId", globalSubscriberId)
- }
-
- // extract subscriptionServiceType
- String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)
-
- String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback")
- execution.setVariable("disableRollback", suppressRollback)
- utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled)
-
- String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
- execution.setVariable("productFamilyId", productFamilyId)
- utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled)
-
- String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo")
- execution.setVariable("subscriberInfo", subscriberInfo)
- utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled)
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)
-
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
+/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.domain.* + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +/** + * This groovy class supports the <class>CreateVcpeResCustService.bpmn</class> process. + * + * @author ek1439 + * + */ +public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { + + private static final String DebugFlag = "isDebugLogEnabled" + + String Prefix="CVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the + * <class>CreateServiceInstance.bpmn</class> process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("createVcpeServiceRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable(Prefix+"VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + execution.setVariable("brgWanMacAddress", "") + execution.setVariable("customerLocation", "") + + //TODO + execution.setVariable("sdncVersion", "1707") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the + * <class>CreateServiceInstance.bpmn</class> process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + //Config Inputs + String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') + if (isBlank(aaiDistDelay)) { + msg = "URN_mso_workflow_aai_distribution_delay is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("aaiDistDelay", aaiDistDelay) + utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled) + + // check for incoming json message/input + String createVcpeServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(createVcpeServiceRequest) + execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); + println 'createVcpeServiceRequest - ' + createVcpeServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + setBasicDBAuthHeader(execution, isDebugEnabled) + + String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + source = "VID" + } + execution.setVariable("source", source) + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.subscriberInfo") + execution.setVariable("subscriberInfo", subscriberInfo) + utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) + - Map<String, String> inputMap = [:]
-
-
- if (userParams) {
- userParams.each {
- userParam ->
- if("BRG_WAN_MAC_Address".equals(userParam?.name)) {
- execution.setVariable("brgWanMacAddress", userParam.value)
- inputMap.put("BRG_WAN_MAC_Address", userParam.value)
- }
- }
- }
-
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
- execution.setVariable("serviceInputParams", inputMap)
-
- utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled)
-
- //For Completion Handler & Fallout Handler
- String requestInfo =
- """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>"""
-
- execution.setVariable(Prefix+"requestInfo", requestInfo)
-
- utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
-
- } catch (BpmnError e) {
- throw e;
-
- } catch (Exception ex){
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void sendSyncResponse(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String requestId = execution.getVariable("mso-request-id")
-
- // RESTResponse (for API Handler (APIH) Reply Task)
- String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
-
- utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
- sendWorkflowResponse(execution, 202, syncResponse)
-
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- //
- // *******************************
- public void prepareDecomposeService(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
-
- //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB
- String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo")
- execution.setVariable("serviceModelInfo", serviceModelInfo)
-
- utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- //
- // *******************************
- public void prepareCreateServiceInstance(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
-// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters")
-// execution.setVariable("serviceInputParams", serviceInputParams)
-
- - String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName")
- execution.setVariable("serviceInstanceName", serviceInstanceName)
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName())
-
- utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void postProcessServiceInstanceCreate (Execution execution){
- def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable(DebugFlag)
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String requestId = execution.getVariable("mso-request-id")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
-
- try {
-
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${requestId}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <serviceInstanceName>${serviceInstanceName}</serviceInstanceName>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
- execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload)
- utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload)
- logDebug('Exited ' + method, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- }
-
-
- public void processDecomposition (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- // VNFs
- List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()
- filterVnfs(vnfList)
- serviceDecomposition.setServiceVnfs(vnfList)
-
- execution.setVariable("vnfList", vnfList)
- execution.setVariable("vnfListString", vnfList.toString())
-
- String vnfModelInfoString = ""
- if (vnfList != null && vnfList.size() > 0) {
- execution.setVariable(Prefix+"VNFsCount", vnfList.size())
- utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled)
- ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
-
- vnfModelInfoString = vnfModelInfo.toString()
- String vnfModelInfoWithRoot = vnfModelInfo.toString()
- vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
- } else {
- execution.setVariable(Prefix+"VNFsCount", 0)
- utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled)
- }
-
- execution.setVariable("vnfModelInfo", vnfModelInfoString)
- execution.setVariable("vnfModelInfoString", vnfModelInfoString)
- utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- sendSyncError(execution)
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- private void filterVnfs(List<VnfResource> vnfList) {
- if(vnfList == null) {
- return
- }
-
- // remove BRG & TXC from VNF list
-
- Iterator<VnfResource> it = vnfList.iterator()
- while(it.hasNext()) {
- VnfResource vr = it.next()
-
- String role = vr.getNfRole()
- if(role == "BRG" || role == "TunnelXConn") {
- it.remove()
- }
- }
- }
-
-
- public void prepareCreateAllottedResourceTXC(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //allottedResourceModelInfo
- //allottedResourceRole
- //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
- //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
- List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
- if (allottedResources != null) {
- Iterator iter = allottedResources.iterator();
- while (iter.hasNext()){
- AllottedResource allottedResource = (AllottedResource)iter.next();
-
- utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
- utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
- if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){
- //set create flag to true
- execution.setVariable("createTXCAR", true)
- ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
- execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName())
- execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole())
- execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType())
- //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC,
- //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated).
- execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId())
- } - }
- }
-
- //unit test only
- String allottedResourceId = execution.getVariable("allottedResourceId")
- execution.setVariable("allottedResourceIdTXC", allottedResourceId)
- utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
- public void prepareCreateAllottedResourceBRG(Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //allottedResourceModelInfo
- //allottedResourceRole
- //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
- //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
- List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
- if (allottedResources != null) {
- Iterator iter = allottedResources.iterator();
- while (iter.hasNext()){
- AllottedResource allottedResource = (AllottedResource)iter.next();
-
- utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
- utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
- if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){
- //set create flag to true
- execution.setVariable("createBRGAR", true)
- ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
- execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName())
- execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole())
- execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType())
- //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG,
- //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated).
- execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId())
- }
- }
- }
-
- //unit test only
- String allottedResourceId = execution.getVariable("allottedResourceId")
- execution.setVariable("allottedResourceIdBRG", allottedResourceId)
- utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- - - // *******************************
- // Generate Network request Section
- // *******************************
- public void prepareVnfAndModulesCreate (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- // String disableRollback = execution.getVariable("disableRollback")
- // def backoutOnFailure = ""
- // if(disableRollback != null){
- // if ( disableRollback == true) {
- // backoutOnFailure = "false"
- // } else if ( disableRollback == false) {
- // backoutOnFailure = "true"
- // }
- // }
- //failIfExists - optional
-
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
- execution.setVariable("productFamilyId", productFamilyId)
- utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled)
-
- List<VnfResource> vnfList = execution.getVariable("vnfList")
-
- Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")
- String vnfModelInfoString = null;
-
- if (vnfList != null && vnfList.size() > 0 ) {
- utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled)
- ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo()
- utils.log("DEBUG", "got 0 ", isDebugEnabled)
- ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo()
- vnfModelInfoString = vnfModelInfo.toString()
- } else {
- //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored
- vnfModelInfoString = execution.getVariable("vnfModelInfo")
- }
-
- utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
-
- // extract cloud configuration
- String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
- execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
- utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)
- String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId")
- execution.setVariable("tenantId", tenantId)
- utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)
-
- String sdncVersion = execution.getVariable("sdncVersion")
- utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- // Validate Vnf request Section -> increment count
- // *******************************
- public void validateVnfCreate (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")
- vnfsCreatedCount++
-
- execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount)
-
- utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *****************************************
- // Prepare Completion request Section
- // *****************************************
- public void postProcessResponse (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String source = execution.getVariable("source")
- String requestId = execution.getVariable("mso-request-id")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- String msoCompletionRequest =
- """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:ns="http://org.openecomp/mso/request/types/v1">
- <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>
- <status-message>Service Instance has been created successfully via macro orchestration</status-message>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <mso-bpel-name>BPMN macro create</mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- // Format Response
- String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
-
- utils.logAudit(xmlMsoCompletionRequest)
- execution.setVariable(Prefix+"Success", true)
- execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void preProcessRollback (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
- try {
-
- Object workflowException = execution.getVariable("WorkflowException");
-
- if (workflowException instanceof WorkflowException) {
- utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
- execution.setVariable("prevWorkflowException", workflowException);
- //execution.setVariable("WorkflowException", null);
- }
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
- } catch(Exception ex) {
- String msg = "Exception in preProcessRollback. " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- }
- utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
- }
-
- public void postProcessRollback (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
- String msg = ""
- try {
- Object workflowException = execution.getVariable("prevWorkflowException");
- if (workflowException instanceof WorkflowException) {
- utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
- execution.setVariable("WorkflowException", workflowException);
- }
- } catch (BpmnError b) {
- utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
- throw b;
- } catch(Exception ex) {
- msg = "Exception in postProcessRollback. " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- }
- utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
- }
-
- public void prepareFalloutRequest(Execution execution){
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)
-
- try {
- WorkflowException wfex = execution.getVariable("WorkflowException")
- utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)
- String requestInfo = execution.getVariable(Prefix+"requestInfo")
- utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)
-
- //TODO. hmmm. there is no way to UPDATE error message.
-// String errorMessage = wfex.getErrorMessage()
-// boolean successIndicator = execution.getVariable("DCRESI_rolledBack")
-// if (successIndicator){
-// errorMessage = errorMessage + ". Rollback successful."
-// } else {
-// errorMessage = errorMessage + ". Rollback not completed."
-// }
-
- String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
-
- execution.setVariable(Prefix+"falloutRequest", falloutRequest)
-
- } catch (Exception ex) {
- utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process")
- }
- utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)
- }
-
-
- public void sendSyncError (Execution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix", Prefix)
-
- utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String errorMessage = ""
- def wfe = execution.getVariable("WorkflowException")
- if (wfe instanceof WorkflowException) {
- errorMessage = wfe.getErrorMessage()
- } else {
- errorMessage = "Sending Sync Error."
- }
-
- String buildworkflowException =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- utils.logAudit(buildworkflowException)
- sendWorkflowResponse(execution, 500, buildworkflowException)
- } catch (Exception ex) {
- utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
- }
- }
-
- public void processJavaException(Execution execution){
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix",Prefix)
- try{
- utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)
- utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
- utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)
- execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
- }catch(BpmnError b){
- utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
- execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
- }
- utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
- }
-}
+ //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + + + if (userParams) { + userParams.each { + userParam -> + if("BRG_WAN_MAC_Address".equals(userParam?.name)) { + execution.setVariable("brgWanMacAddress", userParam.value) + inputMap.put("BRG_WAN_MAC_Address", userParam.value) + } + if("Customer_Location".equals(userParam?.name)) { + execution.setVariable("customerLocation", userParam.value) + userParam.value.each { + customerLocParam -> + inputMap.put(customerLocParam.key, customerLocParam.value) + } + } + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + utils.log("DEBUG", "Incoming brgWanMacAddress is: " + + execution.getVariable('brgWanMacAddress'), isDebugEnabled) + utils.log("DEBUG", "Incoming customerLocation is: " + + execution.getVariable('customerLocation'), isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info>""" + + execution.setVariable(Prefix+"requestInfo", requestInfo) + + utils.log("DEBUG", + " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow." + + " Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{ + "instanceId":"${serviceInstanceId}", + "requestId":"${requestId}" + }}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB + String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + utils.log("DEBUG", + " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from + * DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") +// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, +// "requestDetails.requestParameters") +// execution.setVariable("serviceInputParams", serviceInputParams) + + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) + + utils.log("DEBUG", + " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postProcessServiceInstanceCreate (Execution execution){ + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + + 'execution=' + execution.getId() +')' + def isDebugLogEnabled = execution.getVariable(DebugFlag) + logDebug('Entered ' + method, isDebugLogEnabled) + + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:req="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateInfraRequest> + <requestId>${requestId}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <serviceInstanceName>${serviceInstanceName}</serviceInstanceName> + </req:updateInfraRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload) + utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload) + logDebug('Exited ' + method, isDebugLogEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + } + + + public void processDecomposition (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs() + filterVnfs(vnfList) + serviceDecomposition.setServiceVnfs(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix+"VNFsCount", vnfList.size()) + utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix+"VNFsCount", 0) + utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "processDecomposition() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + private void filterVnfs(List<VnfResource> vnfList) { + if(vnfList == null) { + return + } + + // remove BRG & TXC from VNF list + + Iterator<VnfResource> it = vnfList.iterator() + while(it.hasNext()) { + VnfResource vr = it.next() + + String role = vr.getNfRole() + if(role == "BRG" || role == "TunnelXConn") { + it.remove() + } + } + } + + + public void prepareCreateAllottedResourceTXC(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from + * DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this + //BB will query the full model from the Catalog DB. + List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + + allottedResource.getAllottedResourceType(), isDebugEnabled) + if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ + //set create flag to true + execution.setVariable("createTXCAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoTXC", + allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the + // decomposition that represents the TXC, + //and in its homingSolution section should be found the infraServiceInstanceId + // (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing + // BB would have populated). + execution.setVariable("parentServiceInstanceIdTXC", + allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdTXC", allottedResourceId) + utils.log("DEBUG", + "setting allottedResourceId CreateVcpeResCustService "+ allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", + isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. " + + "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + public void prepareCreateAllottedResourceBRG(Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from + * DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this + // BB will query the full model from the Catalog DB. + List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + + allottedResource.getAllottedResourceType(), isDebugEnabled) + if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ + //set create flag to true + execution.setVariable("createBRGAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoBRG", + allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the + // decomposition that represents the BRG, + //and in its homingSolution section should be found the infraServiceInstanceId + // (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing + // BB would have populated). + execution.setVariable("parentServiceInstanceIdBRG", + allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdBRG", allottedResourceId) + utils.log("DEBUG", + "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", + isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. " + + "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", + " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) + + List<VnfResource> vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.size() > 0 ) { + utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) + ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() + utils.log("DEBUG", "got 0 ", isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + utils.log("DEBUG", + " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount) + + utils.log("DEBUG", + " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance has been created successfully via macro orchestration</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>BPMN macro create</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable(Prefix+"Success", true) + execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + + "Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable(Prefix+"requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable(Prefix+"falloutRequest", falloutRequest) + + } catch (Exception ex) { + utils.log("DEBUG", + "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), + isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") + } + utils.log("DEBUG", + "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String errorMessage = "" + def wfe = execution.getVariable("WorkflowException") + if (wfe instanceof WorkflowException) { + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + // Adding below line temporarily until this flows error handling gets updated + execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + // Adding below line temporarily until this flows error handling gets updated + execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 54bd8cda61..38a44ab1f6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -150,7 +150,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) { logger.info("AbstractSdncOperationTask.getPostStringBody begin!"); - String postBody = new String(postBodyTemplate); + String postBody = postBodyTemplate; postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode()); postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId()); postBody = postBody.replace("$operType", resourceOperationStatus.getOperType()); @@ -166,7 +166,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) { logger.info("AbstractSdncOperationTask.getGetStringBody begin!"); - String getBody = new String(getBodyTemplate); + String getBody = getBodyTemplate; getBody = getBody.replace("$operationId", operationId); getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID); getBody = getBody.replace("$serviceId", serviceId); 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/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/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java index 87f5786807..3170e49371 100644 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java +++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java @@ -242,16 +242,16 @@ public class RESTClient { /** * Creates a RESTClient with the RESTConfig object. * - * @param RESTConfig config to use for sending request + * @param restConfig config to use for sending request * * @throws RESTException if unable to create a RESTClient */ - public RESTClient(RESTConfig cfg) throws RESTException { + public RESTClient(RESTConfig restConfig) throws RESTException { this.headers = new LinkedHashMap<>(); this.parameters = new LinkedHashMap<>(); - this.URL = cfg.getURL(); - this.proxyHost = cfg.getProxyHost(); - this.proxyPort = cfg.getProxyPort(); + this.URL = restConfig.getURL(); + this.proxyHost = restConfig.getProxyHost(); + this.proxyPort = restConfig.getProxyPort(); } /** diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java index 7b559dfbcb..db58c5a49e 100644 --- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java +++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java @@ -598,8 +598,8 @@ public class MsoPropertiesFactoryTest { assertFalse(msoProperties.equals(msoProperties2)); assertTrue(msoProperties.equals(msoProperties)); assertFalse(msoProperties.equals(null)); - assertFalse(msoProperties.equals(new String())); - + assertFalse(msoProperties.toString().isEmpty()); + // Test a reload with timer set to 1 in PATH_MSO_JSON_PROP2 msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java index 371d3162de..9258cabe5b 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java @@ -60,7 +60,8 @@ public class CamundaClient extends RequestClient{ if(encryptedCredentials != null){ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); if(userCredentials != null){ - post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader("Authorization", "Basic " + DatatypeConverter + .printBase64Binary(userCredentials.getBytes())); } } } @@ -83,7 +84,8 @@ public class CamundaClient extends RequestClient{ if(encryptedCredentials != null){ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY); if(userCredentials != null){ - post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes()))); + post.addHeader("Authorization", "Basic " + DatatypeConverter + .printBase64Binary(userCredentials.getBytes())); } } } @@ -115,7 +117,8 @@ public class CamundaClient extends RequestClient{ if(encryptedCredentials != null){ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.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/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java index 364169d4c1..4b179daa7c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java @@ -52,7 +52,8 @@ public class CamundaTaskClient extends RequestClient{ if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -90,7 +91,8 @@ public class CamundaTaskClient extends RequestClient{ if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- get.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ get.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index 7f2f78df81..d6b0b6b419 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -699,7 +699,7 @@ public class RequestsDatabase { * update the resource operation * <br> * - * @param operstatus the resource operation object + * @param operStatus the resource operation object * @since ONAP Amsterdam Release */ public void updateResOperStatus(ResourceOperationStatus operStatus) { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index bd3b988254..c556ddadb5 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 @@ -1638,7 +1638,7 @@ public class CatalogDatabase implements Closeable { * Return the VnfResourceCustomization object identified by the given modelCustomizationUuid 1707 * Note that the corresponding VnfResource Object will be put in the VnfResourceCustomization bean * - * @param getVnfResourceCustomizationByModelVersionId + * @param modelVersionId * @return VnfResourceCustomization or null if not found */ public VnfResourceCustomization getVnfResourceCustomizationByModelVersionId(String modelVersionId) { @@ -1920,7 +1920,7 @@ public class CatalogDatabase implements Closeable { * Return the VnfResourceCustomization object identified by the given modelCustomizationUuid 1707 * Note that the corresponding VnfResource Object will be put in the VnfResourceCustomization bean * - * @param modelCustomizationUuid + * @param modelUuid * @return VnfResourceCustomization or null if not found */ public VnfResource getVnfResourceByModelUuid(String modelUuid) { @@ -2828,7 +2828,7 @@ public class CatalogDatabase implements Closeable { * Return a VNF Module List that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION * - * @param vnfModuleType + * @param vfModuleType * @parm modelCustomizationUuid * @param asdcServiceModelVersion * @param modelVersion @@ -3366,7 +3366,9 @@ public class CatalogDatabase implements Closeable { /** * Return a ServiceToResourceCustomization object * - * @param vfModuleModelUuid, heatFilesArtifactUuid + * @param serviceModelUuid + * @param resourceModelCustomizationUuid + * @param modelType * @return VfModuleToHeatFiles or null if none found */ public ServiceToResourceCustomization getServiceToResourceCustomization(String serviceModelUuid, String resourceModelCustomizationUuid, String modelType) { @@ -3392,7 +3394,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Map<String, HeatFiles> for returning the heat files associated with a vfModule 1707 * - * @param parentHeatTemplateId + * @param vfModuleModelUuid * @return Map<String,Object> or null if none found */ public Map <String, HeatFiles> getHeatFilesForVfModule(String vfModuleModelUuid) { @@ -3608,7 +3610,7 @@ public class CatalogDatabase implements Closeable { /** * Retrieves a Heat environment from DB based on its unique key. 1707 * - * @param name the environment artifact name + * @param artifactUuid the environment artifact name * @param version the environment resource version * @return the heat environment from DB or null if not found */ @@ -3841,7 +3843,7 @@ public class CatalogDatabase implements Closeable { /** * Return the newest version of a specific Tosca CSAR Record resource (queried by Name). * - * @param ToscaCsar + * @param artifactChecksum * @return ToscaCsar object or null if none found */ public ToscaCsar getToscaCsar (String artifactChecksum) { @@ -4404,9 +4406,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID * - * @param networkType - * @param action - * @param serviceType + * @param modelUUID * @return NetworkRecipe object or null if none found */ public NetworkResource getNetworkResourceByModelUuid(String modelUUID) { @@ -4588,9 +4588,7 @@ public class CatalogDatabase implements Closeable { /** * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID * - * @param networkType - * @param action - * @param serviceType + * @param modelCustomizationUuid * @return NetworkRecipe object or null if none found */ public NetworkResource getNetworkResourceByModelCustUuid(String modelCustomizationUuid) { @@ -4679,7 +4677,7 @@ public class CatalogDatabase implements Closeable { /** * Return a VnfComponents recipe that matches a given VF_MODULE_ID, VNF_COMPONENT_TYPE, ACTION * - * @param vfModuleId + * @param vfModuleModelUUId * @param vnfComponentType * @param action * @return VnfComponentsRecipe object or null if none found @@ -4801,7 +4799,7 @@ public class CatalogDatabase implements Closeable { /** * Return a VfModule record that matches a given MODEL_NAME * - * @param modelName + * @param modelUUID * @return VfModule object or null if none found */ public VfModule getVfModuleByModelUUID (String modelUUID) { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java index 7f8c3dbacb..7ef5a4a7b9 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java @@ -89,7 +89,7 @@ public class ModelRecipe extends MavenLikeVersioning implements Serializable { } /** - * @param versionStr the versionStr to set + * @param schemaVersion the versionStr to set */ public void setSchemaVersion(String schemaVersion) { this.schemaVersion = schemaVersion; @@ -31,7 +31,7 @@ <module>status-control</module> <module>bpmn</module> <module>packages</module> - <module>aria</module> + <!--module>aria</module--> </modules> <properties> <project.mso.base.folder>.</project.mso.base.folder> |