summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy163
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn40
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy2
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java161
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java37
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java91
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java125
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java181
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json127
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json34
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java18
46 files changed, 1291 insertions, 190 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 50bcb8e54a..bee2d09711 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -545,7 +545,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
}
catch (Exception e) {
// Catch-all. Log the message and throw the original exception
- logger.debug("Cancel workflow {} failed for deployment : {} {}", workflowId, deploymentId, e);
+ logger.debug("Cancel workflow {} failed for deployment {} :", workflowId, deploymentId, e);
MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException);
exception.setPendingWorkflow(true);
throw exception;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index e8ef86a3b4..054234015f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -1295,7 +1295,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Set<HeatTemplateParam> paramSet = template.getParameters();
logger.debug("paramSet has {} entries", paramSet.size());
} catch (Exception e) {
- logger.debug("Exception occurred in convertInputMap:" + e.getMessage(), e);
+ logger.debug("Exception occurred in convertInputMap {} :", e.getMessage(), e);
}
for (HeatTemplateParam htp : template.getParameters()) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 949027f7c1..77e1449079 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -221,7 +221,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
} catch (Exception e) {
// might be ok - both are just blank
- logger.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e);
+ logger.debug("ERROR trying to parse the volumeGroupHeatStackId {}", volumeGroupHeatStackId,e);
}
this.createVfModule(cloudSiteId,
cloudOwner,
@@ -586,9 +586,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
return JSON_MAPPER.writeValueAsString(obj);
} catch (JsonParseException jpe) {
- logger.debug("Error converting json to string " + jpe.getMessage(),jpe);
+ logger.debug("Error converting json to string: {}", jpe.getMessage(),jpe);
} catch (Exception e) {
- logger.debug("Error converting json to string " + e.getMessage(),e);
+ logger.debug("Error converting json to string: {}", e.getMessage(),e);
}
return "[Error converting json to string]";
}
@@ -1904,14 +1904,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
jsonNode = JSON_MAPPER.readTree(jsonString);
} catch (JsonParseException jpe) {
//TODO - what to do here?
- //for now - send the error to debug, but just leave it as a String
- String errorMessage = jpe.getMessage();
- logger.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
+ //for now - send the error to debug
+ logger.debug("Json Error Converting {} - {}", parm.getParamName(), jpe.getMessage(), jpe);
hasJson = false;
jsonNode = null;
} catch (Exception e) {
// or here?
- logger.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(), e);
+ logger.debug("Json Error Converting {} {}", parm.getParamName(), e.getMessage(), e);
hasJson = false;
jsonNode = null;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index 2b49290727..62c373bea8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -415,21 +415,21 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String str = "" + stackOutputs.get(key);
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs", e);
+ logger.debug("Unable to add {} to outputs", key, e);
}
} else if (stackOutputs.get(key) instanceof JsonNode) {
try {
String str = this.convertNode((JsonNode) stackOutputs.get(key));
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
+ logger.debug("Unable to add {} to outputs - exception converting JsonNode", key, e);
}
} else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
try {
String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
+ logger.debug("Unable to add {} to outputs - exception converting LinkedHashMap", key, e);
}
} else {
try {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index bea4c1bb3b..80f111b570 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -85,7 +85,7 @@ public class SDNCRestClient{
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest)
{
-
+
logger.debug("BPEL Request:" + bpelRequest.toString());
// Added delay to allow completion of create request to SDNC
@@ -93,7 +93,9 @@ public class SDNCRestClient{
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
+ ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e);
+
Thread.currentThread().interrupt();
}
@@ -104,12 +106,10 @@ public class SDNCRestClient{
String sdncReqBody = null;
-
-
RequestTunables rt = new RequestTunables(bpelReqId,
bpelRequest.getRequestHeader().getMsoAction(),
bpelRequest.getRequestHeader().getSvcOperation(),
- bpelRequest.getRequestHeader().getSvcAction());
+ bpelRequest.getRequestHeader().getSvcAction());
rt = tunablesMapper.setTunables(rt);
rt.setSdncaNotificationUrl(env.getProperty(Constants.MY_URL_PROP));
@@ -176,8 +176,8 @@ public class SDNCRestClient{
sdncResp.setRespCode(con.getResponseCode());
sdncResp.setRespMsg(con.getResponseMessage());
- if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
- in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
//Not parsing the response -it contains a responseHdr section and data section
while ((inputLine = in.readLine()) != null) {
@@ -185,7 +185,7 @@ public class SDNCRestClient{
}
in.close();
}
-
+
sdncResp.setSdncRespXml(response.toString());
logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return(sdncResp);
@@ -314,7 +314,7 @@ public class SDNCRestClient{
SDNCCallbackAdapterPortType cbPort = cbSvc.getSDNCCallbackAdapterSoapHttpPort();
BindingProvider bp = (BindingProvider)cbPort;
-
+
if(null != wsdlUrl) {
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm());
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 484be19137..1ceafb6684 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -148,7 +148,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error('Caught exception in ' + method, e)
+ logger.error('Caught exception in {}: {}', method, e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -522,8 +522,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
throw bpmnError
}
catch(Exception e) {
- e.printStackTrace()
- logger.debug('Unexpected error encountered - ' + e.getMessage())
+ logger.debug('Unexpected error encountered - {}', e.getMessage(), e)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
finally {
@@ -645,7 +644,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
rollbackEnabled = defaultRollback
}
}
-
+
execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
logger.debug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index c1f9f5b0b3..e9e7d1ed7c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -63,8 +63,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_moduleExists",false)
execution.setVariable("CAAIVfMod_baseModuleConflict", false)
execution.setVariable("CAAIVfMod_vnfNameFromAAI", null)
-
-
+
+
// CreateAAIVfModule workflow response variable placeholders
execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null)
execution.setVariable("CAAIVfMod_queryGenericVnfResponse","")
@@ -80,14 +80,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CreateAAIVfModuleResponse","")
execution.setVariable("RollbackData", null)
- }
-
+ }
+
// parse the incoming CREATE_VF_MODULE request and store the Generic VNF
// and VF Module data in the flow DelegateExecution
public void preProcessRequest(DelegateExecution execution) {
initProcessVariables(execution)
- def vnfId = execution.getVariable("vnfId")
+ def vnfId = execution.getVariable("vnfId")
if (vnfId == null || vnfId.isEmpty()) {
execution.setVariable("CAAIVfMod_newGenericVnf", true)
execution.setVariable("CAAIVfMod_vnfId","")
@@ -96,14 +96,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_vnfId",vnfId)
}
- def vnfName = execution.getVariable("vnfName")
+ def vnfName = execution.getVariable("vnfName")
execution.setVariable("CAAIVfMod_vnfName", vnfName)
String vnfType = execution.getVariable("vnfType")
execution.setVariable("CAAIVfMod_vnfType", StringUtils.defaultString(vnfType))
execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId"))
-
+
String personaModelId = execution.getVariable("personaModelId")
execution.setVariable("CAAIVfMod_personaId",StringUtils.defaultString(personaModelId))
@@ -219,8 +219,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 201)
execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index dc4871119e..7e46784af2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
@@ -121,8 +121,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
execution.setVariable('CAAIVfModVG_getVfModuleResponse', "VF-Module Not found!!")
}
}catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
@@ -174,8 +173,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
logger.debug("CreateAAIVfModule Response code: " + 200)
logger.debug("CreateAAIVfModule Response: " + "Success")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PUT: {}', ex.getMessage(), ex)
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index 83f31450b8..4bce23eff7 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -76,7 +76,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
// expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
public void queryAAIForGenericVnf(DelegateExecution execution) {
-
+
def vnfId = execution.getVariable("DAAIVfMod_vnfId")
try {
@@ -112,8 +112,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 200)
execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI DELETE: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
}
}
@@ -131,8 +130,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 200)
execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "Vf Module Deleted")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 740d9f70b6..f008130c32 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -151,8 +151,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index 92c1579aa0..f371ccef4d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -126,7 +126,7 @@ class MsoUtils {
/***** Utilities when using XmlParser *****/
-
+
/**
* Convert a Node into a String by deserializing it and formatting it.
*
@@ -883,7 +883,7 @@ class MsoUtils {
callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"})
}
}catch(Exception e){
- log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
+ logger.debug("Unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: {}", e.getMessage(), e)
}
return callbackUrlToUse
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
index d909a77cc2..a7bb707dff 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
@@ -166,7 +166,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
logger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
}catch(Exception e){
- logger.debug('Internal Error occured during PreProcess Method: ', e)
+ logger.debug('Internal Error occured during PreProcess Method: {}', e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
}
logger.trace("End pre Process SDNCRequestScript ")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 9d7ce8234b..69d5f02df5 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -165,7 +165,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index c1d68c5f7c..f91bf54edc 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -161,7 +161,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 796ee43cf4..a40bf59097 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -206,7 +206,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address')
}
-
+
// Handle orchestration-status
String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
String orchestrationStatusEntry = null
@@ -214,7 +214,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status')
}
-
+
org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf();
payload.setVnfId(vnfId)
payload.setPersonaModelVersion(personaModelVersionEntry)
@@ -227,8 +227,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
try {
getAAIClient().update(uri,payload)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PATCH: {}', ex.getMessage(), ex)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
}
@@ -258,9 +257,9 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
return ""
}
else {
- return elementValue
+ return elementValue
}
-
+
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
index 259a7872a3..1960cafb0f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
@@ -69,7 +69,7 @@ class VidUtils {
public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) {
createXmlVolumeRequest(requestMap, action, serviceInstanceId, '')
}
-
+
/**
* Create a volume-request XML using a map
@@ -84,9 +84,9 @@ class VidUtils {
def serviceName = ''
def modelCustomizationName = ''
def asdcServiceModelVersion = ''
-
+
def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback
-
+
def backoutOnFailure = ""
if(suppressRollback != null){
if ( suppressRollback == true) {
@@ -95,7 +95,7 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: ''
def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
@@ -108,16 +108,16 @@ class VidUtils {
modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName
}
}
-
+
vnfType = serviceName + '/' + modelCustomizationName
-
+
def userParams = requestMap.requestDetails?.requestParameters?.userParams
def userParamsNode = ''
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
+
String xmlReq = """
<volume-request xmlns="http://www.w3.org/2001/XMLSchema">
<request-info>
@@ -145,9 +145,9 @@ class VidUtils {
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
}
-
+
/**
- * A common method that can be used to build volume-params node from a map.
+ * A common method that can be used to build volume-params node from a map.
* @param Map userParams
* @return
*/
@@ -166,9 +166,9 @@ class VidUtils {
}
/**
- * A common method that can be used to extract 'requestDetails'
+ * A common method that can be used to extract 'requestDetails'
* @param String json
- * @return String json requestDetails
+ * @return String json requestDetails
*/
@Deprecated
public getJsonRequestDetails(String jsonInput) {
@@ -183,10 +183,10 @@ class VidUtils {
return rtn
} else {
return rtn
- }
+ }
}
}
-
+
/**
* A common method that can be used to extract 'requestDetails' in Xml
* @param String json
@@ -203,17 +203,17 @@ class VidUtils {
return XmlTool.normalize(XML.toString(jsonObj))
}
}
-
+
/**
* Create a network-request XML using a map
- * @param execution
- * @param xmlRequestDetails - requestDetails in xml
+ * @param execution
+ * @param xmlRequestDetails - requestDetails in xml
* @return
* Note: See latest version: createXmlNetworkRequestInstance()
*/
public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) {
-
+
def requestId = execution.getVariable("requestId")
def serviceInstanceId = execution.getVariable("serviceInstanceId")
def requestAction = execution.getVariable("requestAction")
@@ -225,13 +225,13 @@ class VidUtils {
def instanceName = reqMap.requestDetails.requestInfo.instanceName
def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId
if (modelCustomizationId == null) {
- modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
+ modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
reqMap.requestDetails.modelInfo.modelCustomizationUuid : ""
}
def modelName = reqMap.requestDetails.modelInfo.modelName
def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId
def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId
- def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
+ def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString()
def backoutOnFailure = "true"
if(suppressRollback != null){
@@ -241,7 +241,7 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
//def userParams = reqMap.requestDetails.requestParameters.userParams
//def userParamsNode = buildUserParams(userParams)
def userParams = reqMap.requestDetails?.requestParameters?.userParams
@@ -249,26 +249,26 @@ class VidUtils {
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
//'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
String xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>${MsoUtils.xmlEscape(requestAction)}</action>
- <source>VID</source>
+ <action>${MsoUtils.xmlEscape(requestAction)}</action>
+ <source>VID</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- </request-info>
+ </request-info>
<network-inputs>
- <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
- <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
+ <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
+ <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
<network-type>${MsoUtils.xmlEscape(modelName)}</network-type>
- <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId>
- <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region>
+ <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId>
+ <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
- <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
</network-inputs>
@@ -281,8 +281,7 @@ class VidUtils {
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
} catch(Exception e) {
- logger.debug("{} {}", "Error in Vid Utils", e.getCause())
- e.printStackTrace();
+ logger.debug("Error in Vid Utils: {}", e.getCause(), e)
throw e
}
}
@@ -299,7 +298,7 @@ class VidUtils {
def networkModelVersion = ""
def networkModelCustomizationUuid = ""
def networkModelInvariantUuid = ""
-
+
// verify the DB Catalog response JSON structure
def networkModelInfo = execution.getVariable("networkModelInfo")
def jsonSlurper = new JsonSlurper()
@@ -326,14 +325,14 @@ class VidUtils {
} catch (Exception ex) {
throw ex
}
- }
-
+ }
+
def serviceModelUuid = ""
def serviceModelName = ""
def serviceModelVersion = ""
def serviceModelCustomizationUuid = ""
def serviceModelInvariantUuid = ""
-
+
// verify the DB Catalog response JSON structure
def serviceModelInfo = execution.getVariable("serviceModelInfo")
def jsonServiceSlurper = new JsonSlurper()
@@ -361,8 +360,8 @@ class VidUtils {
throw ex
}
}
-
-
+
+
def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : ""
def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : ""
def requestId = execution.getVariable("msoRequestId")
@@ -382,88 +381,88 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
//'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
def source = "VID"
def action = execution.getVariable("action")
-
+
def userParamsNode = ""
def userParams = execution.getVariable("networkInputParams")
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
String xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>${MsoUtils.xmlEscape(action)}</action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <action>${MsoUtils.xmlEscape(action)}</action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
- <network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
+ </request-info>
+ <network-inputs>
+ <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
+ <network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
<network-type>${MsoUtils.xmlEscape(networkModelName)}</network-type>
<subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
<global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
- <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
- <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<failIfExist>${MsoUtils.xmlEscape(failIfExist)}</failIfExist>
<networkModelInfo>
<modelName>${MsoUtils.xmlEscape(networkModelName)}</modelName>
<modelUuid>${MsoUtils.xmlEscape(networkModelUuid)}</modelUuid>
- <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid>
+ <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid>
<modelVersion>${MsoUtils.xmlEscape(networkModelVersion)}</modelVersion>
<modelCustomizationUuid>${MsoUtils.xmlEscape(networkModelCustomizationUuid)}</modelCustomizationUuid>
</networkModelInfo>
<serviceModelInfo>
<modelName>${MsoUtils.xmlEscape(serviceModelName)}</modelName>
<modelUuid>${MsoUtils.xmlEscape(serviceModelUuid)}</modelUuid>
- <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid>
+ <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid>
<modelVersion>${MsoUtils.xmlEscape(serviceModelVersion)}</modelVersion>
<modelCustomizationUuid>${MsoUtils.xmlEscape(serviceModelCustomizationUuid)}</modelCustomizationUuid>
-
- </serviceModelInfo>
- <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
+
+ </serviceModelInfo>
+ <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
</network-inputs>
<network-params>
${userParamsNode}
- </network-params>
+ </network-params>
</network-request>
"""
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
+
}
-
+
/**
* Create a vnf-request XML using a map
- * @param requestMap - map created from VID JSON
+ * @param requestMap - map created from VID JSON
* @param action
* @return
*/
public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) {
-
+
//def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
-
+
//relatedInstanceList.each {
// if (it.relatedInstance.modelInfo.modelType == 'vnf') {
// vnfType = it.relatedInstance.modelInfo.modelName
// vnfId = it.relatedInstance.modelInfo.modelInvariantId
// }
//}
-
+
def vnfName = ''
def asdcServiceModelInfo = ''
-
+
def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList
-
-
+
+
if (relatedInstanceList != null) {
relatedInstanceList.each {
if (it.relatedInstance.modelInfo?.modelType == 'service') {
@@ -474,30 +473,30 @@ class VidUtils {
}
}
}
-
+
def vnfType = execution.getVariable('vnfType')
def vnfId = execution.getVariable('vnfId')
def vfModuleId = execution.getVariable('vfModuleId')
def volumeGroupId = execution.getVariable('volumeGroupId')
def userParams = requestMap.requestDetails?.requestParameters?.userParams
-
-
+
+
def userParamsNode = ''
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
def isBaseVfModule = "false"
if (execution.getVariable('isBaseVfModule') == true) {
isBaseVfModule = "true"
}
-
+
def requestId = execution.getVariable("mso-request-id")
def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: ''
def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: ''
def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback
-
+
def backoutOnFailure = ""
if(suppressRollback != null){
if ( suppressRollback == true) {
@@ -506,14 +505,14 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: ''
def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: ''
def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: ''
def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: ''
def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: ''
def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
+
String xmlReq = """
<vnf-request>
<request-info>
@@ -524,17 +523,17 @@ class VidUtils {
</request-info>
<vnf-inputs>
<!-- not in use in 1610 -->
- <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
+ <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
<vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
- <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
+ <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
<vf-module-model-name>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-model-name>
<model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
<is-base-vf-module>${MsoUtils.xmlEscape(isBaseVfModule)}</is-base-vf-module>
<asdc-service-model-version>${MsoUtils.xmlEscape(asdcServiceModelInfo)}</asdc-service-model-version>
- <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
<service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
@@ -546,10 +545,10 @@ class VidUtils {
</vnf-params>
</vnf-request>
"""
-
+
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
}
-
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index ac67d949a5..aacd385a3b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -294,7 +294,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
- "BPMN", ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -398,7 +398,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
vnfAdapterWorkflowException(execution, callback)
}
} catch (Exception e) {
- logger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
index 5352fc2fe0..2cc6415a50 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
@@ -146,7 +146,7 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo
result.add(klass.newInstance());
}
} catch (InstantiationException | IllegalAccessException e) {
- logger.error("failed to build validator list for " + clazz.getName(), e);
+ logger.error("failed to build validator list for {}", clazz.getName(), e);
throw new RuntimeException(e);
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
index 9b98620f78..9437d02b69 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
@@ -2,48 +2,60 @@
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
<bpmn:process id="EtsiVnfInstantiateBB" name="&#10;EtsiVnfInstantiateBB" isExecutable="true">
<bpmn:serviceTask id="ServiceTask_02e82t2" name="Create &#10;CreateVnfRequest&#10;" camunda:expression="${VnfmAdapterCreateVnfTask.buildCreateVnfRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_016sgof</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_18fsqzd</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0f0vsnv</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:startEvent id="StartEvent_0ru3x55">
<bpmn:outgoing>SequenceFlow_016sgof</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="ServiceTask_02e82t2" />
+ <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="ServiceTask_1jf7hlc" />
<bpmn:endEvent id="EndEvent_001k15i">
- <bpmn:incoming>SequenceFlow_0cik89t</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0hp0ka1</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0f0vsnv" sourceRef="ServiceTask_02e82t2" targetRef="ServiceTask_06ao4xu" />
<bpmn:serviceTask id="ServiceTask_06ao4xu" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${VnfmAdapterCreateVnfTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0f0vsnv</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0cik89t</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0hp0ka1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1jf7hlc" name="&#10;Retrieve Input Parameters&#10;" camunda:asyncAfter="true" camunda:expression="${InputParameterRetrieverTask.getInputParameters(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_016sgof</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18fsqzd</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_0cik89t" sourceRef="ServiceTask_06ao4xu" targetRef="EndEvent_001k15i" />
+ <bpmn:sequenceFlow id="SequenceFlow_18fsqzd" sourceRef="ServiceTask_1jf7hlc" targetRef="ServiceTask_02e82t2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hp0ka1" sourceRef="ServiceTask_06ao4xu" targetRef="EndEvent_001k15i" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfInstantiateBB">
<bpmndi:BPMNShape id="ServiceTask_02e82t1_di" bpmnElement="ServiceTask_02e82t2">
- <dc:Bounds x="353" y="227" width="100" height="80" />
+ <dc:Bounds x="480" y="227" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0ru3x55_di" bpmnElement="StartEvent_0ru3x55">
<dc:Bounds x="232" y="249" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_016sgof_di" bpmnElement="SequenceFlow_016sgof">
<di:waypoint x="268" y="267" />
- <di:waypoint x="353" y="267" />
+ <di:waypoint x="332" y="267" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i">
- <dc:Bounds x="703" y="249" width="36" height="36" />
+ <dc:Bounds x="783" y="249" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0f0vsnv_di" bpmnElement="SequenceFlow_0f0vsnv">
- <di:waypoint x="453" y="267" />
- <di:waypoint x="522" y="267" />
+ <di:waypoint x="580" y="267" />
+ <di:waypoint x="629" y="267" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_06ao4xu_di" bpmnElement="ServiceTask_06ao4xu">
- <dc:Bounds x="522" y="227" width="100" height="80" />
+ <dc:Bounds x="629" y="227" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0cik89t_di" bpmnElement="SequenceFlow_0cik89t">
- <di:waypoint x="622" y="267" />
- <di:waypoint x="703" y="267" />
+ <bpmndi:BPMNShape id="ServiceTask_1jf7hlc_di" bpmnElement="ServiceTask_1jf7hlc">
+ <dc:Bounds x="332" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_18fsqzd_di" bpmnElement="SequenceFlow_18fsqzd">
+ <di:waypoint x="432" y="267" />
+ <di:waypoint x="480" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hp0ka1_di" bpmnElement="SequenceFlow_0hp0ka1">
+ <di:waypoint x="729" y="267" />
+ <di:waypoint x="783" y="267" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
index 19fe018e13..d588da38b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
@@ -416,7 +416,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()"
- logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
+ logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): {}", ex.getMessage(), ex)
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 7a606d515c..eface7b847 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -668,8 +668,7 @@ public class DoCreateVfModule extends VfModuleBase {
rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true")
execution.setVariable("rollbackData", rollbackData)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage())
+ logger.debug('Exception occurred while postProcessing CreateAAIVfModule request: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -741,8 +740,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -822,17 +820,16 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index 5f160bb068..e1b0776d3b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -362,7 +362,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
resourceClient.connect(uri, siUri)
}catch(Exception ex) {
- logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex)
+ logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf CreateGenericVnf Process")
}
logger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index 05ccfa02ba..26233811ae 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -621,8 +621,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
logger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index 47aec46277..f0182e5614 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory
public class DoDeleteVfModuleFromVnf extends VfModuleBase {
private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class);
-
+
def Prefix="DDVFMV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -66,7 +66,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
initProcessVariables(execution)
try {
-
+
// Building Block-type request
// Set mso-request-id to request-id for VNF Adapter interface
@@ -75,7 +75,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
execution.setVariable("requestId", requestId)
logger.debug("msoRequestId: " + requestId)
String tenantId = execution.getVariable("tenantId")
- logger.debug("tenantId: " + tenantId)
+ logger.debug("tenantId: " + tenantId)
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("cloudSiteId", cloudSiteId)
logger.debug("cloudSiteId: " + cloudSiteId)
@@ -102,15 +102,15 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}
else {
execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
- }
+ }
String sdncVersion = execution.getVariable("sdncVersion")
if (sdncVersion == null) {
sdncVersion = "1707"
}
execution.setVariable(Prefix + "sdncVersion", sdncVersion)
- logger.debug("Incoming Sdnc Version is: " + sdncVersion)
-
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
+
String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
@@ -122,8 +122,6 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
-
-
}catch(BpmnError b){
throw b
}catch(Exception e){
@@ -131,7 +129,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
}
}
-
+
public void queryAAIForVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.queryAAIForVfModule(' +
'execution=' + execution.getId() +
@@ -154,8 +152,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!")
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
execution.setVariable('DDVMFV_getVnfResponseCode', 500)
execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
@@ -169,7 +166,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
}
}
-
+
/**
* Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
* exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
index fb62babae9..ca367d0045 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
@@ -322,7 +322,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}
if (vfModuleBaseEntry != null) {
vfModulesList.add(vfModuleBaseEntry)
- }
+ }
}
}else{
execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', 404)
@@ -331,8 +331,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}
execution.setVariable("DDVAM_vfModules", vfModulesList)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index 013f66b008..a05d2527b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -1041,8 +1041,7 @@ public class DoUpdateVfModule extends VfModuleBase {
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -1051,7 +1050,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index 3dd5e61246..eb788a85b7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -265,8 +265,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
execution.setVariable("DUVAM_vfModules", vfModulesList)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
index 0b46a5a849..b12da9f959 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
@@ -362,7 +362,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - "
- logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
+ logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): {}", ex.getMessage(), ex)
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index ce1cdd5068..8adffb29b5 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -156,5 +156,11 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>nl.jqno.equalsverifier</groupId>
+ <artifactId>equalsverifier</artifactId>
+ <version>2.5.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
index d03173d0ac..667ac133af 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -27,6 +27,8 @@ public class Constants {
public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
+
+ public static final String INPUT_PARAMETER = "inputParameter";
public static final String DOT = ".";
public static final String UNDERSCORE = "_";
@@ -34,6 +36,9 @@ public class Constants {
public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
+
+ public static final String FORWARD_SLASH = "/";
+ public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
private Constants() {}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
new file mode 100644
index 0000000000..ebb9d521c3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
+import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class retrieve input parameters
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Component
+public class InputParameterRetrieverTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(InputParameterRetrieverTask.class);
+
+ private final InputParametersProvider inputParametersProvider;
+
+ private final ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ public InputParameterRetrieverTask(final InputParametersProvider inputParametersProvider,
+ final ExtractPojosForBB extractPojosForBB) {
+ this.inputParametersProvider = inputParametersProvider;
+ this.extractPojosForBB = extractPojosForBB;
+ }
+
+ public void getInputParameters(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing getInputParameters ...");
+
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ final InputParameter inputParameter = inputParametersProvider.getInputParameter(vnf);
+
+ LOGGER.debug("inputParameter: {}", inputParameter);
+ execution.setVariable(INPUT_PARAMETER, inputParameter);
+
+ LOGGER.debug("Finished executing getInputParameters ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke create and instantiation request", exception);
+ execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
index 23ddb6f3f7..4e15474e46 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
@@ -23,11 +23,14 @@ package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_REQUEST_PARAM_NAME;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DOT;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.SPACE;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.UNDERSCORE;
import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -83,10 +86,14 @@ public class VnfmAdapterCreateVnfTask {
final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
final ModelInfoGenericVnf modelInfoGenericVnf = vnf.getModelInfoGenericVnf();
+ final InputParameter inputParameter = getInputParameter(execution);
+
final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
createVnfRequest.setName(getName(vnf.getVnfName(), modelInfoGenericVnf.getModelInstanceName()));
createVnfRequest.setTenant(getTenant(cloudRegion));
+ createVnfRequest.setAdditionalParams(inputParameter.getAdditionalParams());
+ createVnfRequest.setExternalVirtualLinks(inputParameter.getExtVirtualLinks());
LOGGER.info("CreateVnfRequest : {}", createVnfRequest);
@@ -99,6 +106,11 @@ public class VnfmAdapterCreateVnfTask {
}
}
+ private InputParameter getInputParameter(final BuildingBlockExecution execution) {
+ final InputParameter inputParameter = execution.getVariable(INPUT_PARAMETER);
+ return inputParameter != null ? inputParameter : NullInputParameter.NULL_INSTANCE;
+ }
+
/**
* Invoke VNFM adapter to create and instantiate VNF
*
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
new file mode 100644
index 0000000000..5ade3240a0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+
+/**
+ * Wrapper class for instance parameters which are based on SOL003
+ *
+ * @author waqas.ikram@est.tech
+ */
+public class InputParameter implements Serializable {
+
+ private static final long serialVersionUID = 42034634585595304L;
+
+ private Map<String, String> additionalParams = new HashMap<>();
+
+ private List<ExternalVirtualLink> extVirtualLinks = new ArrayList<>();
+
+ public InputParameter(final Map<String, String> additionalParams, final List<ExternalVirtualLink> extVirtualLinks) {
+ this.additionalParams = additionalParams;
+ this.extVirtualLinks = extVirtualLinks;
+ }
+
+ /**
+ * @return the additionalParams
+ */
+ public Map<String, String> getAdditionalParams() {
+ return additionalParams;
+ }
+
+ /**
+ * @return the extVirtualLinks
+ */
+ public List<ExternalVirtualLink> getExtVirtualLinks() {
+ return extVirtualLinks;
+ }
+
+ /**
+ * @param additionalParams the additionalParams to set
+ */
+ public void setAdditionalParams(final Map<String, String> additionalParams) {
+ this.additionalParams = additionalParams;
+ }
+
+ /**
+ * @param extVirtualLinks the extVirtualLinks to set
+ */
+ public void setExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) {
+ this.extVirtualLinks = extVirtualLinks;
+ }
+
+ @Override
+ public String toString() {
+ return "InputParameter [additionalParams=" + additionalParams + ", extVirtualLinks=" + extVirtualLinks + "]";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java
new file mode 100644
index 0000000000..55203fb7cc
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public interface InputParametersProvider {
+
+ InputParameter getInputParameter(final GenericVnf genericVnf);
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
new file mode 100644
index 0000000000..6027e78d8b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
@@ -0,0 +1,161 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jayway.jsonpath.JsonPath;
+
+import net.minidev.json.JSONArray;
+
+/**
+ * This class retrieve pre-load data from SDNC using <br/>
+ * <b>GET</b> /config/VNF-API:preload-vnfs/vnf-preload-list/{vnf-name}/{vnf-type}
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Service
+public class InputParametersProviderImpl implements InputParametersProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(InputParametersProviderImpl.class);
+
+ private static final String EXT_VIRTUAL_LINKS = "extVirtualLinks";
+ private static final String ADDITIONAL_PARAMS = "additionalParams";
+ private static final String VNF_PARAMETERS_PATH = "$..vnf-parameters";
+
+ private final SDNCClient sdncClient;
+
+ @Autowired
+ public InputParametersProviderImpl(final SDNCClient sdncClient) {
+ this.sdncClient = sdncClient;
+ }
+
+ @Override
+ public InputParameter getInputParameter(final GenericVnf genericVnf) {
+ final String vnfName = genericVnf.getVnfName();
+ final String vnfType = getVnfType(genericVnf);
+ final String url = getPreloadVnfsUrl(vnfName, vnfType);
+
+ try {
+ LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
+ final String jsonResponse = sdncClient.get(url);
+
+ final JSONArray vnfParametersArray = JsonPath.read(jsonResponse, VNF_PARAMETERS_PATH);
+ if (vnfParametersArray != null) {
+ for (int index = 0; index < vnfParametersArray.size(); index++) {
+ final Object vnfParametersObject = vnfParametersArray.get(index);
+ if (vnfParametersObject instanceof JSONArray) {
+ final JSONArray vnfParameters = (JSONArray) vnfParametersObject;
+ final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParameters);
+ return new InputParameter(getAdditionalParameters(vnfParametersMap),
+ getExtVirtualLinks(vnfParametersMap));
+ }
+ }
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
+ }
+ LOGGER.warn("No input parameters found ...");
+ return NullInputParameter.NULL_INSTANCE;
+
+ }
+
+ private List<ExternalVirtualLink> getExtVirtualLinks(final Map<String, String> vnfParametersMap)
+ throws JsonParseException, IOException {
+ try {
+ final String extVirtualLinksString = vnfParametersMap.get(EXT_VIRTUAL_LINKS);
+
+ if (extVirtualLinksString != null && !extVirtualLinksString.isEmpty()) {
+ final ObjectMapper mapper = new ObjectMapper();
+ final TypeReference<List<ExternalVirtualLink>> extVirtualLinksStringTypeRef =
+ new TypeReference<List<ExternalVirtualLink>>() {};
+
+ return mapper.readValue(extVirtualLinksString, extVirtualLinksStringTypeRef);
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to parse {} ", EXT_VIRTUAL_LINKS, exception);
+ }
+ return Collections.emptyList();
+ }
+
+ private Map<String, String> getAdditionalParameters(final Map<String, String> vnfParametersMap)
+ throws JsonParseException, IOException {
+ try {
+ final String additionalParamsString = vnfParametersMap.get(ADDITIONAL_PARAMS);
+ if (additionalParamsString != null && !additionalParamsString.isEmpty()) {
+ final ObjectMapper mapper = new ObjectMapper();
+ final TypeReference<Map<String, String>> typeRef = new TypeReference<Map<String, String>>() {};
+ return mapper.readValue(additionalParamsString, typeRef);
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to parse {} ", ADDITIONAL_PARAMS, exception);
+ }
+ return Collections.emptyMap();
+ }
+
+ private Map<String, String> getVnfParameterMap(final JSONArray array) {
+ try {
+ if (array != null) {
+ final ObjectMapper mapper = new ObjectMapper();
+ final VnfParameter[] readValue = mapper.readValue(array.toJSONString(), VnfParameter[].class);
+ LOGGER.debug("Vnf parameters: {}", Arrays.asList(readValue));
+ return Arrays.asList(readValue).stream()
+ .filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
+ .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
+ }
+ } catch (final IOException exception) {
+ LOGGER.error("Unable to parse vnf parameters : {}", array, exception);
+ }
+ return Collections.emptyMap();
+ }
+
+ private String getPreloadVnfsUrl(final String vnfName, final String vnfType) {
+ return PRELOAD_VNFS_URL + vnfName + FORWARD_SLASH + vnfType;
+ }
+
+ private String getVnfType(final GenericVnf genericVnf) {
+ final ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ if (modelInfoGenericVnf != null && modelInfoGenericVnf.getModelName() != null) {
+ return modelInfoGenericVnf.getModelName();
+ }
+ return genericVnf.getVnfType();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java
new file mode 100644
index 0000000000..fb877ac55d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import java.util.Collections;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class NullInputParameter extends InputParameter {
+
+ private static final long serialVersionUID = -7261286746726871696L;
+
+ public static final NullInputParameter NULL_INSTANCE = new NullInputParameter();
+
+ private NullInputParameter() {
+ super(Collections.emptyMap(), Collections.emptyList());
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
new file mode 100644
index 0000000000..11e93e733d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import java.util.Objects;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * This is used to deserialize vnf-parameters from vnf-preload-list/{vnf-name}/{vnf-type} response
+ *
+ * @author waqas.ikram@est.tech
+ */
+public class VnfParameter {
+
+ @JsonProperty("vnf-parameter-name")
+ private String name;
+
+ @JsonProperty("vnf-parameter-value")
+ private String value;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return Objects.hash(name, value);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof VnfParameter) {
+ VnfParameter other = (VnfParameter) obj;
+ return Objects.equals(name, other.name) && Objects.equals(value, other.value);
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "VnfParameter [name=" + name + ", value=" + value + "]";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
new file mode 100644
index 0000000000..803b58b4b8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class InputParameterRetrieverTaskTest extends BaseTaskTest {
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Mock
+ private InputParametersProvider inputParametersProvider;
+
+ @Test
+ public void testGGetInputParameters_inputParameterStoredInExecutionContext() throws BBObjectNotFoundException {
+ final InputParameterRetrieverTask objUnderTest =
+ new InputParameterRetrieverTask(inputParametersProvider, extractPojosForBB);
+
+ final InputParameter inputParameter = new InputParameter(Collections.emptyMap(), Collections.emptyList());
+ when(inputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))).thenReturn(inputParameter);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf());
+ objUnderTest.getInputParameters(stubbedxecution);
+
+ final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER);
+ assertNotNull(actual);
+ assertTrue(actual instanceof InputParameter);
+ }
+
+ @Test
+ public void testGGetInputParameters_ThrowExecption_NullInputParameterStoredInExecutionContext()
+ throws BBObjectNotFoundException {
+ final InputParameterRetrieverTask objUnderTest =
+ new InputParameterRetrieverTask(inputParametersProvider, extractPojosForBB);
+
+ when(inputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class)))
+ .thenThrow(RuntimeException.class);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf());
+ objUnderTest.getInputParameters(stubbedxecution);
+
+ final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER);
+ assertNotNull(actual);
+ assertTrue(actual instanceof NullInputParameter);
+ }
+
+
+ private class StubbedBuildingBlockExecution implements BuildingBlockExecution {
+
+ private final Map<String, Serializable> execution = new HashMap<>();
+
+ @Override
+ public GeneralBuildingBlock getGeneralBuildingBlock() {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getVariable(final String key) {
+ return (T) execution.get(key);
+ }
+
+ @Override
+ public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
+ return null;
+ }
+
+ @Override
+ public void setVariable(final String key, final Serializable value) {
+ execution.put(key, value);
+ }
+
+ @Override
+ public Map<ResourceKey, String> getLookupMap() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public String getFlowToBeCalled() {
+ return null;
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
index ddfc08e08f..20abe6ece1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_REQUEST_PARAM_NAME;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
import java.io.Serializable;
import java.util.Collections;
@@ -41,8 +42,7 @@ import org.mockito.Mock;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception;
-import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterCreateVnfTask;
-import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterServiceProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -83,6 +83,8 @@ public class VnfmAdapterCreateVnfTaskTest extends BaseTaskTest {
public void testBuildCreateVnfRequest_withValidValues_storesRequestInExecution() throws Exception {
final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ stubbedxecution.setVariable(INPUT_PARAMETER,
+ new InputParameter(Collections.emptyMap(), Collections.emptyList()));
when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
objUnderTest.buildCreateVnfRequest(stubbedxecution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
new file mode 100644
index 0000000000..d21942d08f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class InputParametersProviderImplTest {
+
+ private static final String BASE_DIR = "src/test/resources/__files/";
+
+ private static final Path PRE_LOAD_SDNC_RESPONSE = Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponse.json");
+
+ private static final Path INVALID_PRE_LOAD_SDNC_RESPONSE =
+ Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponseWithInvalidData.json");
+
+ private static final Path INVALID_ADDITIONAL_AND_EXT_VM_DATA =
+ Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json");
+
+
+ private static final Path INVALID_VNF_PARAMS =
+ Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json");
+
+
+ private static final String MODEL_NAME = "MODEL_NAME";
+
+ private static final String GENERIC_VNF_NAME = "GENERIC_VNF_NAME";
+
+ private static final String URL = PRELOAD_VNFS_URL + GENERIC_VNF_NAME + FORWARD_SLASH + MODEL_NAME;
+
+ private static final String GENERIC_VNF_TYPE = MODEL_NAME;
+
+ @Mock
+ private SDNCClient mockedSdncClient;
+
+ @Test
+ public void testGetInputParameter_ValidResponseFromSdnc_NotEmptyInputParameter() throws Exception {
+ assertValues(getGenericVnf());
+ }
+
+ @Test
+ public void testGetInputParameter_ValidResponseFromSdncAndVnfType_NotEmptyInputParameter() throws Exception {
+ assertValues(getGenericVnf(GENERIC_VNF_TYPE));
+ }
+
+ @Test
+ public void testGetInputParameter_ValidResponseFromSdncInvalidData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_PRE_LOAD_SDNC_RESPONSE));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_ExceptionThrownFromSdnc_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenThrow(RuntimeException.class);
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual instanceof NullInputParameter);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_InvalidResponseData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_ADDITIONAL_AND_EXT_VM_DATA));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_EmptyResponseData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn("");
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual instanceof NullInputParameter);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_InvalidVnfParamsResponseData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_VNF_PARAMS));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ private void assertValues(final GenericVnf genericVnf) throws MapperException, BadResponseException, IOException {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(PRE_LOAD_SDNC_RESPONSE));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(genericVnf);
+ assertNotNull(actual);
+
+ final Map<String, String> actualAdditionalParams = actual.getAdditionalParams();
+ assertEquals(3, actualAdditionalParams.size());
+
+ final String actualInstanceType = actualAdditionalParams.get("instance_type");
+ assertEquals("m1.small", actualInstanceType);
+
+ final List<ExternalVirtualLink> actualExtVirtualLinks = actual.getExtVirtualLinks();
+ assertEquals(1, actualExtVirtualLinks.size());
+
+ final ExternalVirtualLink actualExternalVirtualLink = actualExtVirtualLinks.get(0);
+ assertEquals("ac1ed33d-8dc1-4800-8ce8-309b99c38eec", actualExternalVirtualLink.getId());
+ }
+
+ private String getReponseAsString(final Path filePath) throws IOException {
+ return new String(Files.readAllBytes(filePath));
+ }
+
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = getGenericVnf(GENERIC_VNF_TYPE);
+ final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelName(MODEL_NAME);
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ return genericVnf;
+ }
+
+ private GenericVnf getGenericVnf(final String vnfType) {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(DUMMY_GENERIC_VND_ID);
+ genericVnf.setVnfName(GENERIC_VNF_NAME);
+ genericVnf.setVnfType(vnfType);
+ return genericVnf;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
new file mode 100644
index 0000000000..46018b8f39
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import org.junit.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class VnfParameterTest {
+ @Test
+ public void testVnfParameter_equalAndHasCode() throws ClassNotFoundException {
+ EqualsVerifier.forClass(VnfParameter.class).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS)
+ .verify();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json
new file mode 100644
index 0000000000..0de25616e3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json
@@ -0,0 +1,127 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ },
+ {
+ "vnf-parameter-name": "additionalParams",
+ "vnf-parameter-value": "{\"image_id\": \"DUMMYVNF\",\"instance_type\": \"m1.small\",\"ftp_address\": \"ftp://0.0.0.0:2100/\"}"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_gateway_ip_1",
+ "vnf-parameter-value": "0.0.0.0"
+ },
+ {
+ "vnf-parameter-name": "availability_zone_1"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_gateway_ip_2"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_prefix_length",
+ "vnf-parameter-value": "28"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_OMCN_vLC_P4_prefix_length",
+ "vnf-parameter-value": "28"
+ },
+ {
+ "vnf-parameter-name": "gpbs",
+ "vnf-parameter-value": "2"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_ip_2",
+ "vnf-parameter-value": "192.0.0.1"
+ },
+ {
+ "vnf-parameter-name": "internal_mtu",
+ "vnf-parameter-value": "1500"
+ },
+ {
+ "vnf-parameter-name": "storage_drbd_sync_rate",
+ "vnf-parameter-value": "0"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_MEDIA_vLC_P3_net_id",
+ "vnf-parameter-value": "ONAPMME_MEDIA_vLC_P3"
+ },
+ {
+ "vnf-parameter-name": "extVirtualLinks",
+ "vnf-parameter-value": "[{\"id\":\"ac1ed33d-8dc1-4800-8ce8-309b99c38eec\",\"tenant\":{\"cloudOwner\":\"CloudOwner\",\"regionName\":\"RegionOne\",\"tenantId\":\"80c26954-2536-4bca-9e20-10f8a2c9c2ad\"},\"resourceId\":\"8ef8cd54-75fd-4372-a6dd-2e05ea8fbd9b\",\"extCps\":[{\"cpdId\":\"f449292f-2f0f-4656-baa3-a18d86bac80f\",\"cpConfig\":[{\"cpInstanceId\":\"07876709-b66f-465c-99a7-0f4d026197f2\",\"linkPortId\":null,\"cpProtocolData\":null}]}],\"extLinkPorts\":null}]"
+ },
+ {
+ "vnf-parameter-name": "vnfIpAddress",
+ "vnf-parameter-value": "127.0.0.0"
+ },
+ {
+ "vnf-parameter-name": "node_type",
+ "vnf-parameter-value": "sgsnl"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_SIG_vLC_P2_net_id",
+ "vnf-parameter-value": "ONAPMME_SIG_vLC_P2"
+ },
+ {
+ "vnf-parameter-name": "updateOss",
+ "vnf-parameter-value": "false"
+ },
+ {
+ "vnf-parameter-name": "tmo",
+ "vnf-parameter-value": "0"
+ },
+ {
+ "vnf-parameter-name": "ss7",
+ "vnf-parameter-value": "Not_Applicable"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_OMCN_vLC_P4_net_id",
+ "vnf-parameter-value": "ONAPMME_OMCN_vLC_P4"
+ },
+ {
+ "vnf-parameter-name": "key_name"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_dns_server_ip_2"
+ },
+ {
+ "vnf-parameter-name": "time_zone",
+ "vnf-parameter-value": "GMT"
+ },
+ {
+ "vnf-parameter-name": "enableRollback",
+ "vnf-parameter-value": "false"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json
new file mode 100644
index 0000000000..c2cf2b2f28
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json
@@ -0,0 +1,47 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ },
+ {
+ "vnf-parameter-name": "additionalParams",
+ "vnf-parameter-value": "[\"abc\"]"
+ },
+ {
+ "vnf-parameter-name": "extVirtualLinks",
+ "vnf-parameter-value": "{\"def\":\"123\"}"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json
new file mode 100644
index 0000000000..552adb9125
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json
@@ -0,0 +1,39 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json
new file mode 100644
index 0000000000..e19ad1c9d3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json
@@ -0,0 +1,34 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "hello": "world"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index 0958905720..edab3b07b6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -189,5 +190,22 @@ public class CamundaClientTest{
}
+ @Test
+ public void testPostWithRequestClientParameter() throws Exception {
+ CamundaClient testClient = new CamundaClient();
+ String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
+ HttpResponse mockResponse = createResponse(200, "{}");
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))).thenReturn(mockResponse);
+
+ testClient.setClient(mockHttpClient);
+ testClient.setUrl(orchestrationURI);
+
+ HttpResponse response = testClient.post(new RequestClientParameter.Builder().build());
+
+ assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+
+ }
+
}