aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java6
6 files changed, 62 insertions, 34 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 0f52c96d0e..1e77c35ee3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -337,6 +337,9 @@ public class BBInputSetupMapperLayer {
context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters()));
context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters()));
}
+ if (requestDetails.getConfigurationParameters() != null) {
+ context.setConfigurationParameters(requestDetails.getConfigurationParameters());
+ }
return context;
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json
index 926bf2ccb7..5eb9a26901 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json
@@ -27,7 +27,13 @@
"skip": "ignore"
}
]
- }
+ },
+ "configurationParameters": [
+ {
+ "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]",
+ "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]"
+ }
+ ]
},
"orchContext": {
"is-rollback-enabled": false
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json
index dfc6d4f555..906903e0b2 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json
@@ -25,6 +25,11 @@
"skip": "ignore"
}
]
- }
-
+ },
+ "configurationParameters": [
+ {
+ "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]",
+ "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]"
+ }
+ ]
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json
index 7386828d27..9afbdd9150 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json
@@ -23,6 +23,12 @@
}
]
- }
+ },
+ "configurationParameters": [
+ {
+ "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]",
+ "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]"
+ }
+ ]
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 8bc499c310..d8a6fc2e1d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -81,6 +81,7 @@ public class WorkflowAction {
private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String VF_MODULES = "vfModules";
private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI.";
private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow";
private static final String G_ACTION = "requestAction";
@@ -665,35 +666,38 @@ public class WorkflowAction {
}
protected Resource extractResourceIdAndTypeFromUri(String uri) {
- Pattern patt = Pattern.compile(
- "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
- Matcher m = patt.matcher(uri);
- Boolean generated = false;
-
- if (m.find()) {
- logger.debug("found match on {} : {} " , uri , m);
- String type = m.group("type");
- String id = m.group("id");
- String action = m.group("action");
- if (type == null) {
- throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
- }
- if (action == null) {
- if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
- id = UUID.randomUUID().toString();
- generated = true;
- }
- } else {
- if (action.matches(supportedTypes)) {
- id = UUID.randomUUID().toString();
- generated = true;
- type = action;
- }
- }
- return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated);
- } else {
- throw new IllegalArgumentException("Uri could not be parsed: " + uri);
- }
+ Pattern patt = Pattern.compile(
+ "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ Matcher m = patt.matcher(uri);
+ Boolean generated = false;
+
+ if (m.find()) {
+ logger.debug("found match on {} : {} " , uri , m);
+ String type = m.group("type");
+ String id = m.group("id");
+ String action = m.group("action");
+ if (type == null) {
+ throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
+ }
+ if (action == null) {
+ if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ }else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ }
+ } else {
+ if (action.matches(supportedTypes)) {
+ id = UUID.randomUUID().toString();
+ generated = true;
+ type = action;
+ }
+ }
+ return new Resource(WorkflowType.fromString(convertTypeFromPlural(type)), id, generated);
+ } else {
+ throw new IllegalArgumentException("Uri could not be parsed: " + uri);
+ }
}
protected String validateResourceIdInAAI(String generatedResourceId, WorkflowType type, String instanceName,
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 65d16adb40..c27b5dd655 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -1318,7 +1318,7 @@ public class WorkflowActionTest extends BaseTaskTest {
String uri5 = "'/v6/serviceInstances/123/vnfs";
String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction";
String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace";
-
+ String uri8 = "/v6/serviceInstances/123/vnfs/1234/vfModules/scaleOut";
Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true);
Resource expected2 = new Resource(WorkflowType.VNF, "1234", false);
Resource expected3 = new Resource(WorkflowType.VNF, "1234", false);
@@ -1344,6 +1344,10 @@ public class WorkflowActionTest extends BaseTaskTest {
result = workflowAction.extractResourceIdAndTypeFromUri(uri7);
assertEquals(expected4.getResourceId(),result.getResourceId());
assertEquals(expected4.getResourceType(),result.getResourceType());
+ result = workflowAction.extractResourceIdAndTypeFromUri(uri8);
+ assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length());
+ assertEquals("VfModule", result.getResourceType().toString());
+
}
@Test