aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xepsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties1
-rwxr-xr-xepsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java32
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/client/UnirestPatch.kt55
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java38
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java9
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java22
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java7
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js508
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html29
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java26
-rw-r--r--vid-automation/src/main/java/vid/automation/test/Constants.java2
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Features.java1
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java38
-rw-r--r--vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json54
20 files changed, 521 insertions, 321 deletions
diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
index cc887d8b1..5c78c253f 100755
--- a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
+++ b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
@@ -210,3 +210,4 @@ scheduler.server.url=http://BYO.scheduler:8989/scheduler
scheduler.submit.new.vnf.change=/v1/ChangeManagement/schedules/{scheduleId}/approvals
scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/
+scheduler.basic.auth=
diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties
index 345d041b0..2af6798d2 100755
--- a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties
+++ b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties
@@ -149,4 +149,4 @@ mso.dme2.client.timeout=${MSO_DME2_CLIENT_TIMEOUT}
mso.dme2.client.read.timeout=${MSO_DME2_CLIENT_READ_TIMEOUT}
mso.dme2.server.url=${MSO_DME2_SERVER_URL}
mso.dme2.enabled=${MSO_DME2_ENABLED}
-scheduler.basic.auth=
+scheduler.basic.auth=${SCHEDULER_BASIC_AUTH}
diff --git a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java
index 5f76044bb..50556e7ec 100644
--- a/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/client/SyncRestClient.java
@@ -20,12 +20,28 @@
package org.onap.vid.client;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.onap.vid.client.UnirestPatchKt.patched;
+
import io.joshworks.restclient.http.HttpResponse;
import io.joshworks.restclient.http.JsonNode;
import io.joshworks.restclient.http.RestClient;
import io.joshworks.restclient.http.exceptions.RestClientException;
import io.joshworks.restclient.http.mapper.ObjectMapper;
import io.joshworks.restclient.request.GetRequest;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.Map;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContexts;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
@@ -36,16 +52,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.properties.VidProperties;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.*;
-import java.security.cert.CertificateException;
-import java.util.Map;
-
public class SyncRestClient implements SyncRestClientInterface {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SyncRestClient.class);
private static final String[] SUPPORTED_SSL_VERSIONS = {"TLSv1", "TLSv1.2"};
@@ -151,11 +157,11 @@ public class SyncRestClient implements SyncRestClientInterface {
private <T> HttpResponse<T> callWithRetryOverHttpThrows(String url, HttpRequest<T> httpRequest) throws IOException {
try {
- return httpRequest.apply(url);
+ return patched(httpRequest.apply(url));
} catch (RestClientException e) {
if (causedBySslHandshakeError(e)) {
logger.warn(EELFLoggerDelegate.debugLogger, "SSL Handshake problem occured. Will try to retry over Http.", e);
- return httpRequest.apply(url.replaceFirst(HTTPS_SCHEMA, HTTP_SCHEMA));
+ return patched(httpRequest.apply(url.replaceFirst(HTTPS_SCHEMA, HTTP_SCHEMA)));
}
throw e;
}
@@ -172,7 +178,7 @@ public class SyncRestClient implements SyncRestClientInterface {
@Override
public <T> T readValue(String value, Class<T> aClass) {
try {
- return objectMapper.readValue(value, aClass);
+ return isEmpty(value) ? null : objectMapper.readValue(value, aClass);
} catch (IOException e) {
throw new SyncRestClientException("IOException while reading value", e);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/client/UnirestPatch.kt b/vid-app-common/src/main/java/org/onap/vid/client/UnirestPatch.kt
new file mode 100644
index 000000000..750646621
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/client/UnirestPatch.kt
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.client
+
+import io.joshworks.restclient.http.Headers
+import io.joshworks.restclient.http.HttpResponse
+import org.apache.http.HttpVersion
+import org.apache.http.message.BasicHttpResponse
+import java.io.InputStream
+
+/// Patch NPE in joshworks's Unirest HttpResponse::getBody when getRawBody is null
+fun <T> patched(httpResponse: HttpResponse<T>) =
+ if (willGetBodyTriggerNPE(httpResponse)) HttpResponsePatch(httpResponse) else httpResponse
+
+private fun <T> willGetBodyTriggerNPE(httpResponse: HttpResponse<T>) =
+ httpResponse.rawBody == null || httpResponse.rawBody.available() == 0
+
+private val dummyHttpResponse = BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "ok")
+
+/**
+ * This class inherits HttpResponse to have compatible interface,
+ * but implementation is done through delegation to another
+ * instance.
+ * For that, it's enough to pass dummy values to HttpResponse's
+ * constructor, as parent HttpResponse methods won't be used,
+ * only overridden.
+ */
+private class HttpResponsePatch<T>(private val delegatee: HttpResponse<T>) : HttpResponse<T>(
+ dummyHttpResponse, null, null
+) {
+ override fun getBody(): T? = if (willGetBodyTriggerNPE(delegatee)) null else delegatee.body
+ override fun getHeaders(): Headers? = delegatee.headers
+ override fun getStatus() = delegatee.status
+ override fun isSuccessful() = delegatee.isSuccessful
+ override fun getStatusText(): String? = delegatee.statusText
+ override fun getRawBody(): InputStream? = delegatee.rawBody
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
index fc656fc14..8d55c62c6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
@@ -21,13 +21,32 @@
package org.onap.vid.controller;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
import io.joshworks.restclient.http.mapper.ObjectMapper;
+import java.io.File;
+import java.io.IOException;
+import javax.servlet.ServletContext;
import org.onap.portalsdk.core.util.SystemProperties;
-import org.onap.vid.aai.*;
+import org.onap.vid.aai.AaiClient;
+import org.onap.vid.aai.AaiClientInterface;
+import org.onap.vid.aai.AaiOverTLSClient;
+import org.onap.vid.aai.AaiOverTLSClientInterface;
+import org.onap.vid.aai.AaiOverTLSPropertySupplier;
+import org.onap.vid.aai.AaiResponseTranslator;
+import org.onap.vid.aai.PombaClientImpl;
+import org.onap.vid.aai.PombaClientInterface;
+import org.onap.vid.aai.PombaRestInterface;
import org.onap.vid.aai.model.PortDetailsTranslator;
-import org.onap.vid.aai.util.*;
+import org.onap.vid.aai.util.AAIRestInterface;
+import org.onap.vid.aai.util.CacheProvider;
+import org.onap.vid.aai.util.HttpsAuthClient;
+import org.onap.vid.aai.util.SSLContextProvider;
+import org.onap.vid.aai.util.ServiceInstanceStandardQuery;
+import org.onap.vid.aai.util.ServletRequestHelper;
+import org.onap.vid.aai.util.SystemPropertyHelper;
import org.onap.vid.asdc.AsdcClient;
import org.onap.vid.asdc.parser.ToscaParserImpl2;
import org.onap.vid.asdc.parser.VidNotionsBuilder;
@@ -37,7 +56,13 @@ import org.onap.vid.client.SyncRestClientInterface;
import org.onap.vid.properties.AsdcClientConfiguration;
import org.onap.vid.scheduler.SchedulerService;
import org.onap.vid.scheduler.SchedulerServiceImpl;
-import org.onap.vid.services.*;
+import org.onap.vid.services.AAIServiceTree;
+import org.onap.vid.services.AAITreeNodeBuilder;
+import org.onap.vid.services.AaiService;
+import org.onap.vid.services.AaiServiceImpl;
+import org.onap.vid.services.ChangeManagementService;
+import org.onap.vid.services.PombaService;
+import org.onap.vid.services.PombaServiceImpl;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -48,11 +73,6 @@ import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-import javax.servlet.ServletContext;
-import java.io.File;
-import java.io.IOException;
-
@EnableSwagger2
@Configuration
public class WebConfig {
@@ -177,7 +197,7 @@ public class WebConfig {
@Override
public <T> T readValue(String s, Class<T> aClass) {
try {
- return objectMapper.readValue(s, aClass);
+ return isEmpty(s) ? null : objectMapper.readValue(s, aClass);
} catch (IOException e) {
throw new RuntimeException(e);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
index b44bce163..9ec917d9c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/Subscriber.java
@@ -21,11 +21,16 @@
package org.onap.vid.model;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Map;
+
/**
* Created by Oren on 7/4/17.
*/
+
+@JsonIgnoreProperties(ignoreUnknown = true)
public class Subscriber {
@JsonProperty("global-customer-id")
@@ -39,8 +44,4 @@ public class Subscriber {
@JsonProperty("resource-version")
public String resourceVersion;
-
-
-
-
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index ae3c74d86..4cb495e2f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -580,13 +580,13 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
@Override
public MsoResponseWrapper2 deactivateAndCloudDelete(String serviceInstanceId, String vnfInstanceId, String vfModuleInstanceId, RequestDetails requestDetails) {
String path = getDeactivateAndCloudDeletePath(serviceInstanceId, vnfInstanceId, vfModuleInstanceId);
- return new MsoResponseWrapper2<>(msoClientInterface.post(path, new RequestDetailsWrapper<>(requestDetails), RequestReferencesContainer.class));
+ return new MsoResponseWrapper2<>(msoClientInterface.post(path, requestDetails, RequestReferencesContainer.class));
}
@Override
public MsoResponseWrapper2 activateFabricConfiguration(String serviceInstanceId, RequestDetails requestDetails) {
String path = getActivateFabricConfigurationPath(serviceInstanceId);
- return new MsoResponseWrapper2<>(msoClientInterface.post(path, new RequestDetailsWrapper<>(requestDetails), RequestReferencesContainer.class));
+ return new MsoResponseWrapper2<>(msoClientInterface.post(path, requestDetails, RequestReferencesContainer.class));
}
@Override
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
index cab75bfed..46bd2731d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
@@ -121,7 +121,8 @@ public interface MsoInterface {
<T> HttpResponse<T> get(String path, Class<T> responseClass);
- <T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
- Class<T> responseClass);
+ <T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper, Class<T> responseClass);
+
+ <T> HttpResponse<T> post(String path, RequestDetails requestDetails, Class<T> responseClass);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java
index 2c55265b5..562182a3c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoUtil.java
@@ -8,9 +8,9 @@
* 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.
@@ -21,12 +21,16 @@
package org.onap.vid.mso;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.joshworks.restclient.http.HttpResponse;
+import org.apache.commons.lang3.exception.ExceptionUtils;
-import java.util.Objects;
public class MsoUtil {
+ final static ObjectMapper objectMapper = new ObjectMapper();
+
private MsoUtil() {
}
@@ -36,11 +40,19 @@ public class MsoUtil {
return new MsoResponseWrapper(status, response);
}
- public static <T> MsoResponseWrapper wrapResponse(HttpResponse<T> httpResponse) {
+ public static <T> MsoResponseWrapper wrapResponse(HttpResponse<T> httpResponse) {
MsoResponseWrapper msoResponseWrapper = new MsoResponseWrapper();
msoResponseWrapper.setStatus(httpResponse.getStatus());
if (httpResponse.getRawBody() != null) {
- msoResponseWrapper.setEntity(Objects.toString(httpResponse.getBody()));
+ try {
+ T body = httpResponse.getBody();
+ String entityStr = body instanceof String ? (String) body : objectMapper.writeValueAsString(httpResponse.getBody());
+ msoResponseWrapper.setEntity(entityStr);
+ }
+ catch(JsonProcessingException e)
+ {
+ ExceptionUtils.rethrow(e);
+ }
}
return msoResponseWrapper;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
index 06ca7a9d3..64182e088 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
@@ -478,6 +478,13 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
return client.post(path, commonHeaders, requestDetailsWrapper, responseClass);
}
+ @Override
+ public <T> HttpResponse<T> post(String endpoint, RequestDetails requestDetails, Class<T> responseClass) {
+ String path = baseUrl + endpoint;
+
+ return client.post(path, commonHeaders, requestDetails, responseClass);
+ }
+
public HttpResponse<SOWorkflowList> getWorkflowListByModelId(String endpoint){
String path = baseUrl + endpoint;
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 eea501f15..d5040b138 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
@@ -128,10 +128,10 @@
//list vfmodules ids in AAI that belong to that vnf instance
var modulesAaiIds = _.filter(newVNFName.relatedTo, function(item){
- return item["node-type"] === "vf-module";
- }).map(function(item){
- return item.id;
- });
+ return item["node-type"] === "vf-module";
+ }).map(function(item){
+ return item.id;
+ });
_.forEach(newVNFName.vfModules, function (mdl, key) {
mdl.scale = false; //defaults to not scale unless user changes it
@@ -164,10 +164,10 @@
var extractVNFModel = function (csarVNF, sdcService, selectionVNF) {
/**
- @param selectionVNF A vnf *instance* selected in "available VNF" drop-down box
- @param csarVNF A VNF *MODEL* that has an invariantUuid same as selectionVNF (might be
- a different version; i.e. selectionVNF.modelVersionId <> csarVNF.uuid)
- @param sdcService The Service *MODEL* which has the related VNF `csarVNF`.
+ @param selectionVNF A vnf *instance* selected in "available VNF" drop-down box
+ @param csarVNF A VNF *MODEL* that has an invariantUuid same as selectionVNF (might be
+ a different version; i.e. selectionVNF.modelVersionId <> csarVNF.uuid)
+ @param sdcService The Service *MODEL* which has the related VNF `csarVNF`.
*/
var versionCsarData = {
vnfInstanceId: "",
@@ -233,177 +233,177 @@
};
- /***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;
- result.requestDetails = [];
- _.forEach(changeManagement.vnfNames, function (vnf) {
-
- try{
- var requestInfoData ={};
- var requestParametersData ={};
- var moduleToScale = _.find(vnf.vfModules, {"scale": true});
- if (vnf.availableVersions && vnf.availableVersions.length!=0){
-
- requestInfoData ={
- source: vnf.availableVersions[0].requestInfo.source,
- suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback,
- requestorId: vnf.availableVersions[0].requestInfo.requestorId
- }
-
- if(workflowType=='Update'){
- requestParametersData = {
- usePreload: vnf.availableVersions[0].requestParameters.usePreload
- }
- }else if(workflowType=="Replace"){
- requestParametersData = {
- rebuildVolumeGroups: vnf.availableVersions[0].requestParameters.usePreload
- }
- }else if(workflowType=="VNF In Place Software Update"){
- var payloadObj = {
- '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 = {
+ /***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;
+ result.requestDetails = [];
+ _.forEach(changeManagement.vnfNames, function (vnf) {
+
+ try{
+ var requestInfoData ={};
+ var requestParametersData ={};
+ var moduleToScale = _.find(vnf.vfModules, {"scale": true});
+ if (vnf.availableVersions && vnf.availableVersions.length!=0){
+
+ requestInfoData ={
+ source: vnf.availableVersions[0].requestInfo.source,
+ suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback,
+ requestorId: vnf.availableVersions[0].requestInfo.requestorId
+ }
+
+ if(workflowType=='Update'){
+ requestParametersData = {
+ usePreload: vnf.availableVersions[0].requestParameters.usePreload
+ }
+ }else if(workflowType=="Replace"){
+ requestParametersData = {
+ rebuildVolumeGroups: vnf.availableVersions[0].requestParameters.usePreload
+ }
+ }else if(workflowType=="VNF In Place Software Update"){
+ var payloadObj = {
+ '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)
+ }
+ }else if(workflowType=="VNF Config Update"){
+ requestParametersData = {
+ payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value
+ }
+ }else if(workflowType=="VNF Scale Out"){
+ if(!moduleToScale) return null;
+
+ if(moduleToScale.userParams) {
+ requestParametersData = {
+ userParams: moduleToScale.userParams
+ //,usePreload: true
+ }
+ }else{
+ requestParametersData = {
+ userParams: []
+ //,usePreload: false
+ }
+ }
+ }
+ $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType '+ workflowType);
+ $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: requestParametersData '+ requestParametersData);
+
+ }else if(workflowType=="VNF In Place Software Update"){
+ var payloadObj = {
+ '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)
- }
- }else if(workflowType=="VNF Config Update"){
- requestParametersData = {
- payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value
- }
- }else if(workflowType=="VNF Scale Out"){
- if(!moduleToScale) return null;
-
- if(moduleToScale.userParams) {
- requestParametersData = {
- userParams: moduleToScale.userParams
- //,usePreload: true
- }
- }else{
- requestParametersData = {
- userParams: []
- //,usePreload: false
- }
- }
- }
- $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: workflowType '+ workflowType);
- $log.info('SchedulerWidgetCtrl:extractChangeManagementCallbackDataStr info:: requestParametersData '+ requestParametersData);
-
- }else if(workflowType=="VNF In Place Software Update"){
- var payloadObj = {
- '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)
- }
- }else if(workflowType=="VNF Config Update"){
- requestParametersData = {
- payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value
- }
- }
-
- var data;
- if(workflowType=="VNF Scale Out") {
- data = {
- vnfName: vnf.name,
- vnfInstanceId: vnf.id,
- modelInfo: {
- modelType: 'vfModule',
- modelInvariantId: moduleToScale.invariantUuid,
- modelName: moduleToScale.modelCustomizationName,
- modelVersion: moduleToScale.version,
- modelCustomizationName: moduleToScale.modelCustomizationName,
- modelCustomizationId: moduleToScale.customizationUuid,
- modelVersionId: moduleToScale.uuid
- },
- cloudConfiguration: vnf.cloudConfiguration,
- requestInfo: requestInfoData,
- relatedInstanceList: [],
- requestParameters:requestParametersData,
- configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value)
- };
- requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1);
- }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
- };
- }
+ }
+ }else if(workflowType=="VNF Config Update"){
+ requestParametersData = {
+ payload: vm.getInternalWorkFlowParameter("VNF Config Update", "FILE", "Attach configuration file").value
+ }
+ }
- var serviceInstanceId = '';
- _.forEach(vnf['service-instance-node'], function (instanceNode) {
- if(instanceNode['node-type'] === 'service-instance'){
- serviceInstanceId = instanceNode.properties['service-instance-id'];
- }
- });
-
- if (vnf.availableVersions && vnf.availableVersions.length!=0){
- _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) {
- var rel = related.relatedInstance;
- var relatedInstance = {
- instanceId: serviceInstanceId,
- modelInfo: {
- modelType: rel.modelInfo.modelType,
- modelInvariantId: rel.modelInfo.modelInvariantId,
- modelVersionId: rel.modelInfo.modelVersionId,
- modelName: rel.modelInfo.modelName,
- modelVersion: rel.modelInfo.modelVersion,
- modelCustomizationName: rel.modelInfo.modelCustomizationName,
- modelCustomizationId: rel.modelInfo.modelCustomizationId
- }
- };
- if (rel.vnfInstanceId)
- relatedInstance.instanceId = rel.vnfInstanceId;
-
- data.relatedInstanceList.push({relatedInstance: relatedInstance});
- });
+ var data;
if(workflowType=="VNF Scale Out") {
- //push vnf to related as well as the service instance
- var relatedInstance = {
- instanceId: vnf.id,
+ data = {
+ vnfName: vnf.name,
+ vnfInstanceId: vnf.id,
modelInfo: {
- modelCustomizationId: vnf.availableVersions[0].modelInfo.modelCustomizationId,
- modelCustomizationName: vnf.availableVersions[0].modelInfo.modelCustomizationName,
- modelInvariantId: vnf.availableVersions[0].modelInfo.modelInvariantId,
- modelName: vnf.availableVersions[0].modelInfo.modelName,
- modelType: vnf.availableVersions[0].modelInfo.modelType,
- modelVersion: vnf.availableVersions[0].modelInfo.modelVersion,
- modelVersionId: vnf.availableVersions[0].modelInfo.modelVersionId
- }
+ modelType: 'vfModule',
+ modelInvariantId: moduleToScale.invariantUuid,
+ modelName: moduleToScale.modelCustomizationName,
+ modelVersion: moduleToScale.version,
+ modelCustomizationName: moduleToScale.modelCustomizationName,
+ modelCustomizationId: moduleToScale.customizationUuid,
+ modelVersionId: moduleToScale.uuid
+ },
+ cloudConfiguration: vnf.cloudConfiguration,
+ requestInfo: requestInfoData,
+ relatedInstanceList: [],
+ requestParameters:requestParametersData,
+ configurationParameters: JSON.parse(vm.getInternalWorkFlowParameter("VNF Scale Out", "text", "Configuration Parameters").value)
+ };
+ requestInfoData.instanceName = vnf.name + "_" + (moduleToScale.currentCount + 1);
+ }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.relatedInstanceList.push({relatedInstance: relatedInstance});
}
+
+ var serviceInstanceId = '';
+ _.forEach(vnf['service-instance-node'], function (instanceNode) {
+ if(instanceNode['node-type'] === 'service-instance'){
+ serviceInstanceId = instanceNode.properties['service-instance-id'];
+ }
+ });
+
+ if (vnf.availableVersions && vnf.availableVersions.length!=0){
+ _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) {
+ var rel = related.relatedInstance;
+ var relatedInstance = {
+ instanceId: serviceInstanceId,
+ modelInfo: {
+ modelType: rel.modelInfo.modelType,
+ modelInvariantId: rel.modelInfo.modelInvariantId,
+ modelVersionId: rel.modelInfo.modelVersionId,
+ modelName: rel.modelInfo.modelName,
+ modelVersion: rel.modelInfo.modelVersion,
+ modelCustomizationName: rel.modelInfo.modelCustomizationName,
+ modelCustomizationId: rel.modelInfo.modelCustomizationId
+ }
+ };
+ if (rel.vnfInstanceId)
+ relatedInstance.instanceId = rel.vnfInstanceId;
+
+ data.relatedInstanceList.push({relatedInstance: relatedInstance});
+ });
+ if(workflowType=="VNF Scale Out") {
+ //push vnf to related as well as the service instance
+ var relatedInstance = {
+ instanceId: vnf.id,
+ modelInfo: {
+ modelCustomizationId: vnf.availableVersions[0].modelInfo.modelCustomizationId,
+ modelCustomizationName: vnf.availableVersions[0].modelInfo.modelCustomizationName,
+ modelInvariantId: vnf.availableVersions[0].modelInfo.modelInvariantId,
+ modelName: vnf.availableVersions[0].modelInfo.modelName,
+ modelType: vnf.availableVersions[0].modelInfo.modelType,
+ modelVersion: vnf.availableVersions[0].modelInfo.modelVersion,
+ modelVersionId: vnf.availableVersions[0].modelInfo.modelVersionId
+ }
+ };
+ data.relatedInstanceList.push({relatedInstance: relatedInstance});
+ }
+ }
+ }catch(err){
+ $log.error('SchedulerCtrl::extractChangeManagementCallbackDataStr error: ' + err);
+ vm.errorMsg = err;
}
- }catch(err){
- $log.error('SchedulerCtrl::extractChangeManagementCallbackDataStr error: ' + err);
- vm.errorMsg = err;
- }
- result.requestDetails.push(data);
- });
- return JSON.stringify(result);
- }
+ result.requestDetails.push(data);
+ });
+ return JSON.stringify(result);
+ }
- function getWorkflowParametersFromForm() {
+ function getWorkflowParametersFromForm() {
let workflowParameters =
{requestDetails:{
cloudConfiguration:{},
@@ -414,8 +414,8 @@
let parameters = vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow);
parameters.forEach((parameter)=>{
let inputField = document.getElementById('so-workflow-parameter-'+parameter.soFieldName);
- workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName]=inputField.value;
- });
+ workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName]=inputField.value;
+ });
return workflowParameters;
}
@@ -423,13 +423,13 @@
vm.openModal = function () {
if(vm.hasScheduler) { //scheduling supported
vm.scheduleWorkflow();
- } else {
+ } else {
//no scheduling support
vm.executeWorkflow();
}
};
- vm.scheduleWorkflow = function () {
+ vm.scheduleWorkflow = function () {
$scope.widgetParameter = ""; // needed by the scheduler?
// properties needed by the scheduler so it knows whether to show
@@ -525,8 +525,8 @@
const nodeType = vnfsData[i]['node-type'];
if (nodeType === "generic-vnf") {
if (_.find(vnfsData[i]['related-to'], function (node) {
- return node['node-type'] === 'vserver'
- }) !== undefined) {
+ return node['node-type'] === 'vserver'
+ }) !== undefined) {
vm.vnfs.push(vnfsData[i]);
}
} else if (nodeType === "service-instance") {
@@ -566,8 +566,8 @@
var versions = [];
_.forEach(vm.vnfs, function (vnf) {
if (vnf.properties['nf-role'] === vm.changeManagement['vnfType']
- && vnf.properties["model-invariant-id"]
- && vnf.properties["model-version-id"]) {
+ && vnf.properties["model-invariant-id"]
+ && vnf.properties["model-version-id"]) {
vm.serviceInstancesToGetVersions.push({
"model-invariant-id": vnf.properties["model-invariant-id"],
"model-version-id": vnf.properties["model-version-id"]
@@ -710,70 +710,70 @@
};
vm.loadWorkFlows = function () {
- vm.localWorkflowsParameters = new Map();
- vm.remoteWorkflowsParameters = new Map();
+ vm.localWorkflowsParameters = new Map();
+ vm.remoteWorkflowsParameters = new Map();
if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_HANDLE_SO_WORKFLOWS)) {
- return vm.loadRemoteWorkFlows()
- .then(function () {
- vm.workflows = vm.remoteWorkflows.map(item => item.name);
- }).then(function () {
- vm.loadRemoteWorkFlowsParameters();
- });
- }else{
- return vm.loadLocalWorkFlows()
- .then(vm.loadLocalWorkFlowsParameters)
- .then(function () {
- vm.workflows = vm.localWorkflows;
- })
- }
+ return vm.loadRemoteWorkFlows()
+ .then(function () {
+ vm.workflows = vm.remoteWorkflows.map(item => item.name);
+ }).then(function () {
+ vm.loadRemoteWorkFlowsParameters();
+ });
+ }else{
+ return vm.loadLocalWorkFlows()
+ .then(vm.loadLocalWorkFlowsParameters)
+ .then(function () {
+ vm.workflows = vm.localWorkflows;
+ })
+ }
};
vm.loadLocalWorkFlows = function () {
- return changeManagementService.getWorkflows(vm.changeManagement.vnfNames)
- .then(function (response) {
- vm.localWorkflows = response.data.workflows || [];
- }).catch(function (error) {
- $log.error(error);
- vm.errorMsg = error;
- });
+ return changeManagementService.getWorkflows(vm.changeManagement.vnfNames)
+ .then(function (response) {
+ vm.localWorkflows = response.data.workflows || [];
+ }).catch(function (error) {
+ $log.error(error);
+ vm.errorMsg = error;
+ });
};
vm.loadRemoteWorkFlows = function () {
- let vnfModelIDs = vm.changeManagement.vnfNames.map(vnfName => vnfName.modelVersionId);
- return changeManagementService.getSOWorkflows(vnfModelIDs)
- .then(function (response) {
- vm.remoteWorkflows = response.data || [];
- }).catch(function (error) {
- $log.error(error);
- vm.errorMsg = error;
- });
+ let vnfModelIDs = vm.changeManagement.vnfNames.map(vnfName => vnfName.modelVersionId);
+ return changeManagementService.getSOWorkflows(vnfModelIDs)
+ .then(function (response) {
+ vm.remoteWorkflows = response.data || [];
+ }).catch(function (error) {
+ $log.error(error);
+ vm.errorMsg = error;
+ });
};
vm.loadLocalWorkFlowsParameters = function () {
- vm.localWorkflows.forEach(function(workflow) {
- vm.loadLocalWorkFlowParameters(workflow);
- });
+ vm.localWorkflows.forEach(function(workflow) {
+ vm.loadLocalWorkFlowParameters(workflow);
+ });
};
vm.loadLocalWorkFlowParameters = function (workflow) {
- changeManagementService.getLocalWorkflowParameter(workflow)
- .then(function (response) {
- vm.localWorkflowsParameters.set(workflow, response.data.parameterDefinitions);
- })
- .catch(function (error) {
- $log.error(error);
- vm.errorMsg = error;
- });
+ changeManagementService.getLocalWorkflowParameter(workflow)
+ .then(function (response) {
+ vm.localWorkflowsParameters.set(workflow, response.data.parameterDefinitions);
+ })
+ .catch(function (error) {
+ $log.error(error);
+ vm.errorMsg = error;
+ });
};
vm.loadRemoteWorkFlowsParameters = function () {
- vm.remoteWorkflows.forEach(function(workflow) {
- if (workflow.source ==='SDC' || workflow.source === 'sdc' ){
- vm.loadRemoteWorkFlowParameters(workflow);
- } else {
- vm.loadLocalWorkFlowParameters(workflow.name);
- }
- });
+ vm.remoteWorkflows.forEach(function(workflow) {
+ if (workflow.source ==='SDC' || workflow.source === 'sdc' ){
+ vm.loadRemoteWorkFlowParameters(workflow);
+ } else {
+ vm.loadLocalWorkFlowParameters(workflow.name);
+ }
+ });
};
vm.loadRemoteWorkFlowParameters = function (workflow) {
@@ -783,21 +783,21 @@
return param.soPayloadLocation === "userParams"
})
.forEach(function (param) {
- let workflowParams = vm.repackAttributes(param);
- if (param.validation.length > 0) {
- let validation = param.validation[0];
- if ('maxLength' in validation) {
- workflowParams.maxLength = validation.maxLength;
- }
- if ('allowableChars' in validation) {
- workflowParams.pattern = validation.allowableChars;
+ let workflowParams = vm.repackAttributes(param);
+ if (param.validation.length > 0) {
+ let validation = param.validation[0];
+ if ('maxLength' in validation) {
+ workflowParams.maxLength = validation.maxLength;
+ }
+ if ('allowableChars' in validation) {
+ workflowParams.pattern = validation.allowableChars;
+ }
}
- }
- workflowParams.type = param.inputType;
+ workflowParams.type = param.inputType;
- parameters.push(workflowParams);
- }
- );
+ parameters.push(workflowParams);
+ }
+ );
vm.remoteWorkflowsParameters.set(workflow.name, parameters);
};
@@ -813,23 +813,35 @@
};
vm.getRemoteWorkFlowParameters = function (workflow) {
- if (workflow && vm.remoteWorkflowsParameters.has(workflow)) {
- return vm.remoteWorkflowsParameters.get(workflow)
- }
- return [];
+ if (workflow && vm.remoteWorkflowsParameters.has(workflow)) {
+ return vm.remoteWorkflowsParameters.get(workflow)
+ }
+ return [];
};
+ vm.hasPatternError = function(form, itemName){
+ return form[itemName].$error.pattern;
+ }
+
+ vm.hasAsyncFnError = function(form, itemName){
+ return form[itemName].$error.validateAsyncFn;
+ }
+
+ vm.getIdFor = function(type, id, name){
+ return "internal-workflow-parameter-" + type + "-" + id + "-" + (name ? name.split(' ').join('-').toLowerCase() : "");
+ }
+
vm.getInternalWorkFlowParameters = function (workflow, 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 [];
+ 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).filter(parameter => parameter.type==type) != []) {
return vm.localWorkflowsParameters.get(workflow).filter(parameter => parameter.type==type).filter(parameter => parameter.name === parameterName)[0]
- }
+ }
};
vm.getRemoteWorkflowSource = (workflow) => {
@@ -896,4 +908,4 @@
init();
}
-})();
+})(); \ No newline at end of file
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 7ccddbafd..3f4a94ee0 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
@@ -7,9 +7,9 @@
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.
@@ -83,22 +83,22 @@
<div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getInternalWorkFlowParameters(vm.changeManagement.workflow, 'FILE')">
<label class="control-label">{{item.name}}</label>
<div class="file-wrapper">
- <input id="internal-workflow-parameter-file-{{item.id}}" class="file-input" type="file" ngf-select ng-model="item.value" ngf-validate-async-fn="vm.uploadConfigFile($file)" name="configUpdateFile" accept="{{item.acceptableFileType}}" ngf-pattern="{{item.acceptableFileType}}" ng-required="{{item.required}}"/>
- <label id="internal-workflow-parameter-file-{{item.id}}-label" class="file-input-label">{{item.value&&item.value.name||"Select File"}} </label>
- <label for="internal-workflow-parameter-file-{{item.id}}"><span class="icon-browse"></span></label>
+ <input id="{{vm.getIdFor('file',item.id,item.name)}}" ng-change="vm.onChange(item)" class="file-input" type="file" ngf-select ng-model="item.value" ngf-validate-async-fn="vm.uploadConfigFile($file)" ng-attr-name="{{'internal-workflow-parameter-file-name-' + item.id}}" accept="{{item.acceptableFileType}}" ngf-pattern="{{item.acceptableFileType}}" ng-required="{{item.required}}"/>
+ <label id="{{vm.getIdFor('file',item.id,item.name)}}-label" class="file-input-label">{{item.value&&item.value.name||"Select File"}} </label>
+ <label ng-attr-for="{{vm.getIdFor('file',item.id,item.name)}}"><span class="icon-browse"></span></label>
</div>
- <label id="errorLabel" class="icon-alert error" ng-if="item.value.$error.pattern">{{item.msgOnPatternError}}</label>
- <label id="errorContentLabel" class="icon-alert error" ng-if="item.value.$error.validateAsyncFn">{{item.msgOnContentError}}</label>
+ <label id="errorLabel" class="icon-alert error" ng-if="vm.hasPatternError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnPatternError}}</label>
+ <label id="errorContentLabel" class="icon-alert error" ng-if="vm.hasAsyncFnError(newChangeManagement, 'internal-workflow-parameter-file-name-' + item.id)">{{item.msgOnContentError}}</label>
</div>
<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}}">
+ <label ng-attr-for="{{vm.getIdFor('text',item.id,item.name)}}" class="control-label">{{item.name}}</label>
+ <input ng-model="item.value" type="text" id="{{vm.getIdFor('text',item.id,item.name)}}" pattern="{{item.pattern}}" ng-required="{{item.required}}">
</div>
<div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow)">
- <label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label>
- <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}">
+ <label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label>
+ <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}">
</div>
</div>
@@ -146,7 +146,6 @@
</div>
</div>
</div>
-
</div>
<div class="modal-footer">
@@ -155,9 +154,9 @@
</div>
<div class="pull-right">
<button type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</button>
- <button ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2)" type="submit" id="submit" name="submit" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">{{vm.hasScheduler ? "Schedule" : "Confirm"}}</button>
- <button ng-if="vm.isScaleOut() && vm.wizardStep === 1" ng-click="vm.nextStep();" type="button" id="next" name="next" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">Next</button>
+ <button ng-if="!vm.isScaleOut() || (vm.isScaleOut() && vm.wizardStep === 2) || vm.hasScheduler" type="submit" id="submit" name="submit" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">{{vm.hasScheduler ? "Schedule" : "Confirm"}}</button>
+ <button ng-if="(vm.isScaleOut() && vm.wizardStep === 1) && !vm.hasScheduler" ng-click="vm.nextStep();" type="button" id="next" name="next" class="btn btn-primary" data-ng-disabled="newChangeManagement.$invalid">Next</button>
<button ng-if="isShowErrorReport() && vm.errorMsg!==''" ng-click="showReportWindow()" type="button" class="btn btn-danger" >Create report</button>
</div>
</div>
-</form>
+</form> \ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm
index 6e0569059..ceccb0af9 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm
@@ -492,8 +492,7 @@
<li ng-repeat="pnf in pnfs" ui-tree-node>
<div ui-tree-handle class="tree-node tree-node-content">
PNF: {{pnf}}
-
- <a class="dissociate-pnf pull-right btn btn-primary btn-xs" data-nodrag
+ <a ng-if="isMacro()===false" class="dissociate-pnf pull-right btn btn-primary btn-xs" data-nodrag
ng-click="dissociatePnf(pnf)" style="margin-right: 8px;">
<span>Dissociate</span>
</a>
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
index 0efdb6b69..207e63579 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
@@ -923,7 +923,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
MsoResponseWrapper2 responseWrapped = new MsoResponseWrapper2<>(expectedResponse);
- given(msoInterface.post(eq(path), any(org.onap.vid.changeManagement.RequestDetailsWrapper.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse);
+ given(msoInterface.post(eq(path), any(RequestDetails.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse);
// when
MsoResponseWrapper2 response = msoBusinessLogic.deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails);
@@ -948,7 +948,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
MsoResponseWrapper2 responseWrapped = new MsoResponseWrapper2<>(expectedResponse);
- given(msoInterface.post(eq(path), any(org.onap.vid.changeManagement.RequestDetailsWrapper.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse);
+ given(msoInterface.post(eq(path), any(RequestDetails.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse);
// when
MsoResponseWrapper2 response = msoBusinessLogic.activateFabricConfiguration(serviceInstanceId, requestDetails);
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java
index faa7a6a8d..74e17a44a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java
@@ -76,7 +76,7 @@ public class ChangeManagementServiceUnitTest extends AbstractTestNGSpringContext
void testInPlaceSoftwareUpdateRequest() throws Exception {
- doReturn(new HttpResponse<>(any(), RequestReferencesContainer.class, any())).when(restClientUnderTest).post(anyString(), any(), any());
+ doReturn(new HttpResponse<>(any(), RequestReferencesContainer.class, any())).when(restClientUnderTest).post(anyString(), any(RequestDetailsWrapper.class), any());
URL requestJsonUrl = this.getClass().getResource("/services/change_management_software_update_request.json");
ChangeManagementRequest changeManagementRequest = objectMapper.readValue(requestJsonUrl, ChangeManagementRequest.class);
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java
new file mode 100644
index 000000000..0005cbd75
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/scheduler/PresetDeleteSchedulerChangeManagement.java
@@ -0,0 +1,26 @@
+package org.onap.simulator.presetGenerator.presets.scheduler;
+
+import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
+import org.springframework.http.HttpMethod;
+
+public class PresetDeleteSchedulerChangeManagement extends BasePreset {
+
+ @Override
+ public HttpMethod getReqMethod() {
+ return HttpMethod.DELETE;
+ }
+
+ @Override
+ public String getReqPath() {
+ return getRootPath() + "/83aec7bf-602f-49eb-9788-bbc33ac550d9";
+ }
+
+ @Override
+ protected String getRootPath() {
+ return "/scheduler/v1/ChangeManagement/schedules";
+ }
+
+ @Override
+ public int getResponseCode() { return 204; }
+
+}
diff --git a/vid-automation/src/main/java/vid/automation/test/Constants.java b/vid-automation/src/main/java/vid/automation/test/Constants.java
index 6605fe2e6..0e614dece 100644
--- a/vid-automation/src/main/java/vid/automation/test/Constants.java
+++ b/vid-automation/src/main/java/vid/automation/test/Constants.java
@@ -97,7 +97,7 @@ public class Constants {
public static final String newModalFromVNFVersionInputId = "fromVNFVersion";
public static final String newModalVNFNameInputId = "vnfName";
public static final String newModalWorkFlowInputId = "workflow";
- public static final String newModalConfigUpdateInputId = "config-update-input";
+ public static final String newModalConfigUpdateInputId = "internal-workflow-parameter-file-5-attach-configuration-file";
public static final String newModalTargetVersionInputsClass = "vnf-versions-select-as-text";
public static final String newModalSubscriberText = "CRAIG/ROBERTS";
public static final String newModalServiceTypeText = "vRichardson";
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
index 005c06551..40f3013dd 100644
--- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
@@ -40,6 +40,7 @@ public enum Features implements Feature {
FLAG_1908_RESUME_MACRO_SERVICE,
FLAG_1908_RELEASE_TENANT_ISOLATION,
FLAG_1908_VNF_FC_NEW_INSTANTIATION_UI,
+ FLAG_HANDLE_SO_WORKFLOWS
;
public boolean isActive() {
diff --git a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
index 2f5489f31..dbc603c26 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java
@@ -8,6 +8,7 @@ import org.junit.Assert;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
import org.onap.sdc.ci.tests.datatypes.UserCredentials;
import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.onap.simulator.presetGenerator.presets.scheduler.PresetDeleteSchedulerChangeManagement;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement;
@@ -69,11 +70,13 @@ public class ChangeManagementTest extends VidBaseTestCase {
private void openAndFill1stScreen(String vnfName, String vnfTargetVersion, String workflow) {
String subscriberId = VNF_DATA_WITH_IN_PLACE.subscriberId;
+ String subscriberName = VNF_DATA_WITH_IN_PLACE.subscriberName;
String serviceType = VNF_DATA_WITH_IN_PLACE.serviceType;
String vnfType = VNF_DATA_WITH_IN_PLACE.vnfType;
String vnfSourceVersion = VNF_DATA_WITH_IN_PLACE.vnfSourceVersion;
ChangeManagementPage.openNewChangeManagementModal();
Wait.angularHttpRequestsLoaded();
+ SelectOption.waitForOptionInSelect(subscriberName, "subscriberName");
ChangeManagementPage.selectSubscriberById(subscriberId);
Wait.angularHttpRequestsLoaded();
SelectOption.byIdAndVisibleText(Constants.ChangeManagement.newModalServiceTypeInputId, serviceType);
@@ -119,6 +122,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
static final int vnfZrdm3amdns02test2Id = 11822;
static final int vnfHarrisonKrisId = 12822;
static String subscriberId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ static String subscriberName = "Emanuel";
static String serviceType = "vRichardson";
static String vnfType = "vMobileDNS";
static String vnfSourceVersion = "1.0";
@@ -164,6 +168,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
, "changeManagement/service-design-and-creation.json"
, "changeManagement/mso_get_manual_task.json"
, "changeManagement/mso_post_manual_task.json"
+ , "changeManagement/mso_get_change_managements_scaleout.json"
);
SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND);
@@ -253,8 +258,10 @@ public class ChangeManagementTest extends VidBaseTestCase {
@Test
public void clickOnScheduledJob_SuccessfulMessageAppear() {
+
+ SimulatorApi.registerExpectationFromPreset(new PresetDeleteSchedulerChangeManagement(),SimulatorApi.RegistrationStrategy.APPEND);
+
ChangeManagementPage.openChangeManagementPage();
-// Wait.angularHttpRequestsLoaded();
GeneralUIUtils.ultimateWait();
clickAndAssertOnCancelButton(SCHEDULED_ID);
updateSimulatorWithParametersOfScheduledJod("get_scheduler_details_short_with_after_cancel" +
@@ -305,6 +312,7 @@ public class ChangeManagementTest extends VidBaseTestCase {
boolean isNotDisplayed = GeneralUIUtils.waitForElementInVisibilityByTestId("icon-status-" + scheduledId, 5);
Assert.assertTrue(isNotDisplayed);
}
+
public void updateSimulatorWithParametersOfScheduledJod(String jasonFile){
SimulatorApi.registerExpectation(
new String[] {"changeManagement/"+jasonFile},
@@ -312,12 +320,15 @@ public class ChangeManagementTest extends VidBaseTestCase {
);
}
+ @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false)
@Test
public void testWorkflowVNFInPlaceSoftwareUpdateNotInWorkflowsListWhenNotExpected() {
+
List<String> workflows = getListOfWorkflowsFor("Harrison Kris");
assertThat(workflows, not(hasItem(VNF_DATA_WITH_IN_PLACE.workflowName)));
}
+ @FeatureTogglingTest(value = Features.FLAG_HANDLE_SO_WORKFLOWS, flagActive = false)
@Test
public void testWorkflowVNFInPlaceSoftwareUpdateInWorkflowsListWhenExpected() {
List<String> workflows = getListOfWorkflowsFor(VNF_DATA_WITH_IN_PLACE.vnfName);
@@ -344,13 +355,14 @@ public class ChangeManagementTest extends VidBaseTestCase {
@Test
public void testWorkflowVNFInPlaceSoftwareUpdateShows3Fields() {
+
openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate();
List<String> idsWithoutMatchingElement =
Stream.of(
- "operations-timeout",
- "existing-software-version",
- "new-software-version")
+ "internal-workflow-parameter-text-2-operations-timeout",
+ "internal-workflow-parameter-text-3-existing-software-version",
+ "internal-workflow-parameter-text-4-new-software-version")
.filter(id -> Get.byId(id) == null)
.collect(Collectors.toList());
assertThat("all three special VNFInPlace fields should appear", idsWithoutMatchingElement, is(empty()));
@@ -403,13 +415,13 @@ public class ChangeManagementTest extends VidBaseTestCase {
}
private void fillVNFInPlace3Fields(String operationsTimeout, String existingSwVersion, String newSwVersion) {
- Get.byId("operations-timeout").clear();
- Get.byId("existing-software-version").clear();
- Get.byId("new-software-version").clear();
+ Get.byId("internal-workflow-parameter-text-2-operations-timeout").clear();
+ Get.byId("internal-workflow-parameter-text-3-existing-software-version").clear();
+ Get.byId("internal-workflow-parameter-text-4-new-software-version").clear();
- Get.byId("operations-timeout").sendKeys(operationsTimeout);
- Get.byId("existing-software-version").sendKeys(existingSwVersion);
- Get.byId("new-software-version").sendKeys(newSwVersion);
+ Get.byId("internal-workflow-parameter-text-2-operations-timeout").sendKeys(operationsTimeout);
+ Get.byId("internal-workflow-parameter-text-3-existing-software-version").sendKeys(existingSwVersion);
+ Get.byId("internal-workflow-parameter-text-4-new-software-version").sendKeys(newSwVersion);
}
private List<String> getListOfWorkflowsFor(String vnfName) {
@@ -533,13 +545,8 @@ public class ChangeManagementTest extends VidBaseTestCase {
ChangeManagementPage.openChangeManagementPage();
Click.byId(Constants.ChangeManagement.dashboardFinishedTabId);
Assert.assertThat(Get.byClassAndText("vnf-name","Unlocked instance"),is(notNullValue()));
-
}
-
-
-
-
@Test
public void testMainDashboardTableContent () {
ChangeManagementPage.openChangeManagementPage();
@@ -549,7 +556,6 @@ public class ChangeManagementTest extends VidBaseTestCase {
//TODO: After scheduler will be ready than we will examine if the content is valid.
}
-
@Test
public void testOnlyOneModalIsOpen() throws Exception {
diff --git a/vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json
new file mode 100644
index 000000000..01d28a41c
--- /dev/null
+++ b/vid-automation/src/main/resources/registration_to_simulator/changeManagement/mso_get_change_managements_scaleout.json
@@ -0,0 +1,54 @@
+{
+ "simulatorRequest": {
+ "method": "GET",
+ "path": "/mso/orchestrationRequests/v.",
+ "queryParams": {
+ "filter": "action:EQUALS:scaleOut"
+ }
+ },
+ "simulatorResponse": {
+ "responseCode": 200,
+ "body": {
+ "requestList": [
+ {
+ "request": {
+ "requestId":"2a22aff4-620f-44b6-92a1-8a41be396d96\n\n",
+ "requestScope":"vfModule",
+ "requestStatus":{
+ "percentProgress":100.0,
+ "requestState":"IN_PROGRESS",
+ "statusMessage":"Scale-Out Is In Progress",
+ "finishTime":"Fri, 08 Sep 2017 19:34:33 GMT"
+ },
+ "requestType":"scaleOut",
+ "startTime":"Fri, 08 Sep 2017 19:34:32 GMT",
+ "instanceReferences":{
+ "serviceInstanceId":"6dd0f8de-93c7-48a2-914b-1a8d58e0eb48",
+ "vnfInstanceId":"7c00cc1e-6425-4fc3-afc3-0289db288d4c",
+ "requestorId":"ds828e"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "2d6502bf-c488-4903-817e-2ed2c644dcf4",
+ "requestScope": "vfModule",
+ "requestStatus": {
+ "percentProgress": 100.0,
+ "requestState": "COMPLETE",
+ "statusMessage": "Completed successfully",
+ "finishTime": "Thu, 09 Nov 2017 10:58:14 GMT"
+ },
+ "requestType": "scaleOut",
+ "startTime": "Thu, 09 Nov 2017 10:58:14 GMT",
+ "instanceReferences": {
+ "serviceInstanceId": "54ba3628-9ee5-4b32-8a2a-3abf001bed4e",
+ "vnfInstanceId": "b8d99523-1e83-4fd1-b42f-849361ef7024",
+ "requestorId": "az2016"
+ }
+ }
+ }
+ ]
+ }
+ }
+} \ No newline at end of file