summaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
authorEricMoore <eric.e.moore@est.tech>2020-03-01 19:14:22 +0200
committerEylon Malin <eylon.malin@intl.att.com>2020-05-03 13:17:59 +0000
commiteda0409e699d09b44676e82217391f2724edb6a8 (patch)
tree33b7023a8c16535da1c71937fc3cfe49a9b027be /vid-app-common
parent89050ec38eb9b61cd3ce4283f0bc910c5e414624 (diff)
Change Management: Support PNF software upgrade
Issue-ID: VID-505 Change-Id: I128b22092b78cf05a904648c276807a7ebb21aca Signed-off-by: Ittay Stern <ittay.stern@att.com> Signed-off-by: EricMoore <eric.e.moore@est.tech>
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java4
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js2
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js71
3 files changed, 53 insertions, 24 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java
index 71d577cd4..441f80cf7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java
@@ -44,6 +44,10 @@ public class LocalWorkflowsServiceImpl implements LocalWorkflowsService {
new LocalWorkflowParameterDefinition(3, "existingSoftwareVersion", "Existing software version", true, LocalWorkflowType.text, "[-a-zA-Z0-9.]+"),
new LocalWorkflowParameterDefinition(4, "newSoftwareVersion", "New software version", true, LocalWorkflowType.text, "[-a-zA-Z0-9.]+")
)
+ )).put("PNF Software Upgrade", new LocalWorkflowParameterDefinitions(
+ ImmutableList.of(
+ new LocalWorkflowParameterDefinition(6, "targetSoftwareVersion", "Target software version", true, LocalWorkflowType.text, "[-a-zA-Z0-9.]+")
+ )
))
.put("VNF Config Update", new LocalWorkflowParameterDefinitions(
ImmutableList.of(
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js b/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js
index 5cff246c2..789273592 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js
@@ -27,7 +27,7 @@
var result = [];
if(changeManagements && metadata && metadata.statuses) {
angular.forEach(changeManagements, function(changeManagement) {
- var found = metadata.statuses
+ var found = changeManagement.requestStatus && metadata.statuses
.map(function(c) { return c.toLowerCase(); })
.indexOf(changeManagement.requestStatus.requestState.toLowerCase()) !== -1;
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 9eed4c14d..a4bdb367b 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
@@ -251,7 +251,6 @@
/***converting objects to scheduler format (taken from IST) - was altered for Scale out support ***/
function extractChangeManagementCallbackDataStr(changeManagement) {
- console.log(changeManagement);
var result = {};
result.requestType = changeManagement.workflow;
var workflowType = changeManagement.workflow;
@@ -287,6 +286,21 @@
requestParametersData = {
payload: JSON.stringify(payloadObj)
};
+ } else if (workflowType == "PNF Software Upgrade") {
+ requestParametersData = {
+ userParams: [
+ { "name":"pnfId",
+ "value":vnf.properties["vnf-id"]
+ },
+ { "name":"pnfName",
+ "value": vnf.name
+ },
+ { "name":"targetSoftwareVersion",
+ "value":vm.getInternalWorkFlowParameter(workflowType, 'text', 'Target software version').value
+ }
+ ]
+ };
+
} else if (workflowType == "VNF Config Update") {
requestParametersData = {
payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value
@@ -318,7 +332,7 @@
requestParametersData = {
payload: JSON.stringify(payloadObj)
};
- } else if (workflowType == "VNF Config Update") {
+ } else if (workflowType == "VNF Config Update") {
requestParametersData = {
payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value
};
@@ -345,24 +359,10 @@
configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value)
};
requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1);
+ } else if (workflowType === "PNF Software Upgrade") {
+ data = nativeWorkflowRequestData('pnf', requestParametersData, vnf, requestInfoData);
} else {
- data = {
- vnfName: vnf.name,
- vnfInstanceId: vnf.id,
- modelInfo: {
- modelType: 'vnf',
- modelInvariantId: vnf.properties['model-invariant-id'],
- modelVersionId: vnf.modelVersionId,
- modelName: vnf.properties['vnf-name'],
- modelVersion: vnf.version,
- modelCustomizationName: vnf.properties['model-customization-name'],
- modelCustomizationId: vnf.properties['model-customization-id']
- },
- cloudConfiguration: vnf.cloudConfiguration,
- requestInfo: requestInfoData,
- relatedInstanceList: [],
- requestParameters: requestParametersData
- };
+ data = nativeWorkflowRequestData('vnf', requestParametersData, vnf, requestInfoData);
}
var serviceInstanceId = '';
@@ -419,6 +419,29 @@
return JSON.stringify(result);
}
+ function nativeWorkflowRequestData(modelType, requestParametersData, vnf, requestInfoData) {
+ var data = {
+ modelInfo: {
+ modelType: modelType,
+ modelInvariantId: vnf.properties['model-invariant-id'],
+ modelVersionId: vnf.modelVersionId,
+ modelName: vnf.properties['vnf-name'],
+ modelVersion: vnf.version,
+ modelCustomizationName: vnf.properties['model-customization-name'],
+ modelCustomizationId: vnf.properties['model-customization-id']
+ },
+ cloudConfiguration: vnf.cloudConfiguration,
+ requestInfo: requestInfoData,
+ requestParameters: requestParametersData
+ };
+ data[modelType + 'InstanceId'] = vnf.id;
+ if (modelType == "vnf"){
+ data[modelType + 'Name'] = vnf.name;
+ data['relatedInstanceList'] = [] ;
+ }
+ return data;
+ }
+
function getWorkflowParametersFromForm() {
let workflowParameters =
{
@@ -477,8 +500,6 @@
widgetParameter: $scope.widgetParameter
};
- console.log("vm.scheduleWorkflow data:", data);
-
if (window.parent !== window.self) {
window.parent.postMessage(data, VIDCONFIGURATION.SCHEDULER_PORTAL_URL);
} else {
@@ -492,7 +513,7 @@
vm.triggerLocalWorkflow();
} else {
let source = vm.getRemoteWorkflowSource(vm.changeManagement.workflow);
- if (source === "NATIVE") {
+ if (_.toUpper(source) === "NATIVE") {
vm.triggerLocalWorkflow();
} else {
vm.triggerRemoteWorkflow();
@@ -828,7 +849,11 @@
};
vm.loadRemoteWorkFlows = function () {
- let vnfModelIDs = vm.changeManagement.vnfNames.map(vnfName => vnfName.modelVersionId);
+ let vnfModelIDs = (vm.changeManagement.vnfNames || []).map(vnfName => vnfName.modelVersionId);
+ if (vnfModelIDs.length === 0) {
+ vm.remoteWorkflows = [];
+ return $q.resolve();
+ }
return changeManagementService.getSOWorkflows(vnfModelIDs)
.then(function (response) {
vm.remoteWorkflows = response.data || [];