aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js45
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js34
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html2
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_workflows_by_model_id.json94
4 files changed, 137 insertions, 38 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
index 246834cdd..c6a5b31af 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
@@ -243,9 +243,9 @@
}
}else if(workflowType=="VNF In Place Software Update"){
var payloadObj = {
- 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'STRING', 'Existing software version').value,
- 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'STRING', 'New software version').value,
- 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'STRING', 'Operations timeout').value
+ 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value,
+ 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value,
+ 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value
};
requestParametersData = {
payload: JSON.stringify(payloadObj)
@@ -274,9 +274,9 @@
}else if(workflowType=="VNF In Place Software Update"){
var payloadObj = {
- 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'STRING', 'Existing software version').value,
- 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'STRING', 'New software version').value,
- 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'STRING', 'Operations timeout').value
+ 'existing_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Existing software version').value,
+ 'new_software_version':vm.getInternalWorkFlowParameter(workflowType, 'text', 'New software version').value,
+ 'operations_timeout':vm.getInternalWorkFlowParameter(workflowType, 'text', 'Operations timeout').value
};
requestParametersData = {
payload: JSON.stringify(payloadObj)
@@ -305,7 +305,7 @@
requestInfo: requestInfoData,
relatedInstanceList: [],
requestParameters:requestParametersData,
- configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "STRING", "Configuration Parameters").value)
+ configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value)
};
requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1);
}else{
@@ -428,10 +428,16 @@
};
vm.executeWorkflow = function () {
- if (vm.localWorkflows && vm.localWorkflows.length > 0) {
+ if ( vm.localWorkflows && vm.localWorkflows.length > 0 ) {
vm.triggerLocalWorkflow();
} else {
- vm.triggerRemoteWorkflow();
+ let source = vm.getRemoteWorkflowSource(vm.changeManagement.workflow);
+ if( source === "NATIVE"){
+ vm.localWorkflowsParameters = vm.remoteWorkflowsParameters;
+ vm.triggerLocalWorkflow();
+ }else {
+ vm.triggerRemoteWorkflow();
+ }
}
};
@@ -726,12 +732,7 @@
vm.loadLocalWorkFlowParameters = function (workflow) {
changeManagementService.getLocalWorkflowParameter(workflow)
.then(function (response) {
- let fileParameters = response.data.parameterDefinitions.filter(item => item.type === 'FILE');
- let textParameters = response.data.parameterDefinitions.filter(item => item.type === 'STRING');
- let parameters = new Map();
- parameters.set('FILE', fileParameters);
- parameters.set('STRING', textParameters);
- vm.localWorkflowsParameters.set(workflow, parameters);
+ vm.localWorkflowsParameters.set(workflow, response.data.parameterDefinitions);
})
.catch(function (error) {
$log.error(error);
@@ -762,6 +763,8 @@
workflowParams.pattern = validation.allowableChars;
}
}
+ workflowParams.type = param.inputType;
+
parameters.push(workflowParams);
}
);
@@ -787,18 +790,22 @@
};
vm.getInternalWorkFlowParameters = function (workflow, type) {
- if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).has(type)) {
- return vm.localWorkflowsParameters.get(workflow).get(type)
+ if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) != []) {
+ return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type)
}
return [];
};
vm.getInternalWorkFlowParameter = function (workflow, type, parameterName) {
- if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).has(type)) {
- return vm.localWorkflowsParameters.get(workflow).get(type).filter(parameter => parameter.name === parameterName)[0]
+ if (workflow && vm.localWorkflowsParameters.has(workflow) && vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type) != []) {
+ return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type).filter(parameter => parameter.name === parameterName)[0]
}
};
+ vm.getRemoteWorkflowSource = (workflow) => {
+ return vm.getCachedWorkflowDetails(workflow)[0].source;
+ };
+
vm.getCachedWorkflowDetails = function (workflow) {
return vm.remoteWorkflows.filter( function (remoteWorkflow) {
return remoteWorkflow.name === workflow;
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js
index 5989ffdd6..afc643993 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js
@@ -33,6 +33,7 @@ describe('Testing workFlows from SO', () => {
beforeEach(inject(function (_$controller_) {
$notNeeded = jestMock.fn();
+
// mock ChangeManagementService
$changeManagementService = jestMock.fn();
$changeManagementService.getAllSDCServices = jestMock.fn(() => Promise.resolve([]));
@@ -92,7 +93,7 @@ describe('Testing workFlows from SO', () => {
"id": 1,
"name": "Configuration Parameters",
"required": true,
- "type": "STRING",
+ "type": "text",
"pattern": ".*",
"msgOnPatternError": null,
"msgOnContentError": null,
@@ -168,7 +169,8 @@ describe('Testing workFlows from SO', () => {
"id": "new_software_version",
"soFieldName": "new_software_version",
"maxLength": '500',
- "pattern": '.*'
+ "pattern": '.*',
+ "type": "text"
}]]
]));
});
@@ -181,9 +183,9 @@ describe('Testing workFlows from SO', () => {
let getLocalWorkflowsParametersStub = Promise.resolve({"data": {}});
let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 0"}]});
let getSOWorkflowsParametersPromiseStub = Promise.resolve({"data":{"parameterDefinitions": [
- {"id": 1, "name": "parameter 1", "required": true, "type": "STRING", "pattern": "[0-9]*"},
- {"id": 2, "name": "parameter 2", "required": true, "type": "STRING", "pattern": ".*"},
- {"id": 3, "name": "parameter 3", "required": false, "type": "STRING", "pattern": "[0-9]*"}]}});
+ {"id": 1, "name": "parameter 1", "required": true, "type": "text", "pattern": "[0-9]*"},
+ {"id": 2, "name": "parameter 2", "required": true, "type": "text", "pattern": ".*"},
+ {"id": 3, "name": "parameter 3", "required": false, "type": "text", "pattern": "[0-9]*"}]}});
$controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
$changeManagementService.getWorkflows = () => getWorkflowsStub;
@@ -208,7 +210,7 @@ describe('Testing workFlows from SO', () => {
"id": 1,
"name": "Configuration Parameters",
"required": true,
- "type": "STRING",
+ "type": "text",
"pattern": ".*",
"msgOnPatternError": null,
"msgOnContentError": null,
@@ -223,9 +225,7 @@ describe('Testing workFlows from SO', () => {
// when
let result = new Map();
- const scaleOutResult = new Map();
- scaleOutResult.set("FILE", []);
- scaleOutResult.set("STRING", [
+ const scaleOutResult = [
{
"acceptableFileType": null,
"id": 1,
@@ -234,9 +234,9 @@ describe('Testing workFlows from SO', () => {
"name": "Configuration Parameters",
"pattern": ".*",
"required": true,
- "type": "STRING",
+ "type": "text",
}
- ]);
+ ];
result.set("VNF Scale Out", scaleOutResult);
return $controller.loadWorkFlows()
@@ -268,7 +268,7 @@ describe('Testing workFlows from SO', () => {
"id": 1,
"name": "Configuration Parameters",
"required": true,
- "type": "STRING",
+ "type": "text",
"pattern": ".*",
"msgOnPatternError": null,
"msgOnContentError": null,
@@ -283,7 +283,7 @@ describe('Testing workFlows from SO', () => {
// when
return $controller.loadWorkFlows()
.then(() => {
- let internalWorkFlowParameters = $controller.getInternalWorkFlowParameters("NON-EXISTENT WF", "STRING");
+ let internalWorkFlowParameters = $controller.getInternalWorkFlowParameters("NON-EXISTENT WF", "text");
expect(internalWorkFlowParameters).toEqual([]);
});
});
@@ -298,7 +298,7 @@ describe('Testing workFlows from SO', () => {
"id": 1,
"name": "Configuration Parameters",
"required": true,
- "type": "STRING",
+ "type": "text",
"pattern": ".*",
"msgOnPatternError": null,
"msgOnContentError": null,
@@ -328,7 +328,7 @@ describe('Testing workFlows from SO', () => {
"id": 1,
"name": "Configuration Parameters",
"required": true,
- "type": "STRING",
+ "type": "text",
"pattern": ".*",
"msgOnPatternError": null,
"msgOnContentError": null,
@@ -348,12 +348,12 @@ describe('Testing workFlows from SO', () => {
"name": "Configuration Parameters",
"pattern": ".*",
"required": true,
- "type": "STRING",
+ "type": "text",
}];
// when
return $controller.loadWorkFlows()
.then(() => {
- let internalWorkFlowParameters = $controller.getInternalWorkFlowParameters("VNF Scale Out", "STRING");
+ let internalWorkFlowParameters = $controller.getInternalWorkFlowParameters("VNF Scale Out", "text");
expect(internalWorkFlowParameters).toEqual(result);
});
});
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
index a5a6d1610..1c91ba5e9 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
@@ -90,7 +90,7 @@
<label id="errorContentLabel" class="icon-alert error" ng-if="item.value.$error.validateAsyncFn">{{item.msgOnContentError}}</label>
</div>
- <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'STRING')">
+ <div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'text')">
<label for="internal-workflow-parameter-text-{{item.id}}" class="control-label">{{item.name}}</label>
<input ng-model="item.value" type="text" id="internal-workflow-parameter-text-{{item.id}}" pattern="{{item.pattern}}" ng-required="{{item.required}}">
</div>
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_workflows_by_model_id.json b/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_workflows_by_model_id.json
index d26d07b93..bf969a680 100644
--- a/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_workflows_by_model_id.json
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/get_workflows_by_model_id.json
@@ -100,7 +100,99 @@
}
]
}
- }]
+ },
+ {
+ "workflowSpecification": {
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "ab6478e4-ea33-3346-ac12-ab121484a333",
+ "artifactName": "inPlaceSoftwareUpdate-1_0.bpmn",
+ "artifactVersion": "1.0",
+ "artifactDescription": "xyz xyz",
+ "workflowName": "VNF In Place Software Update",
+ "operationName": "VNF In Place Software Update",
+ "workflowSource": "native",
+ "workflowResourceTarget": "vnf"
+ },
+ "activitySequence": [{
+ "name": "VNFQuiesceTrafficActivity",
+ "description": "Activity to QuiesceTraffic on VNF"
+ },
+ {
+ "name": "VNFHealthCheckActivity",
+ "description": "Activity to HealthCheck VNF"
+ },
+ {
+ "name": "FlowCompleteActivity",
+ "description": "Activity to Complete the BPMN Flow"
+ }
+ ],
+ "workflowInputParameters": [{
+ "label": "Cloud Owner",
+ "inputType": "text",
+ "required": true,
+ "validation": [{
+ "maxLength": "7",
+ "allowableChars": "[a-zA-Z0-9]*"
+ }],
+ "soFieldName": "cloudOwner",
+ "soPayloadLocation": "cloudConfiguration"
+ },
+ {
+ "label": "Cloud Region ID",
+ "inputType": "text",
+ "required": true,
+ "validation": [{
+ "maxLength": "7",
+ "allowableChars": "[a-zA-Z0-9]*"
+ }],
+ "soFieldName": "lcpCloudRegionId",
+ "soPayloadLocation": "cloudConfiguration"
+ },
+ {
+ "label": "Tenant/Project ID",
+ "inputType": "text",
+ "required": true,
+ "validation": [{
+ "maxLength": "36",
+ "allowableChars": "[a-zA-Z0-9]*"
+ }],
+ "soFieldName": "tenantId",
+ "soPayloadLocation": "cloudConfiguration"
+ },
+ {
+ "label": "Operations timeout",
+ "inputType": "text",
+ "required": true,
+ "description": "some description",
+ "validation": [{
+ "maxLength": "50",
+ "allowableChars": "[0-9]*"
+ }],
+ "soFieldName": "operations_timeout",
+ "soPayloadLocation": "userParams"
+ },
+ {
+ "label": "Existing software version",
+ "inputType": "text",
+ "required": true,
+ "validation": [{
+ "maxLength": "50",
+ "allowableChars": "[a-zA-Z0-9]*"
+ }],
+ "soFieldName": "existing_software_version",
+ "soPayloadLocation": "userParams"
+ },
+ {
+ "label": "New software version",
+ "inputType": "text",
+ "required": true,
+ "soFieldName": "new_software_version",
+ "soPayloadLocation": "userParams"
+ }
+ ]
+ }
+ }]
}
}
}