aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java9
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java526
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java183
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/client/HttpBasicClient.java15
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt9
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt23
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java186
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java81
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java28
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties1
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties1
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js1
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js4
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js14
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm2
25 files changed, 349 insertions, 797 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index 7e96c93cd..159401009 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -459,7 +459,7 @@ public class AaiClient implements AaiClientInterface {
}
@Override
- public AaiResponse getVNFData(String globalSubscriberId, String serviceType) {
+ public AaiResponse<AaiGetVnfResponse> getVNFData(String globalSubscriberId, String serviceType) {
String payload = "{\"start\": [\"business/customers/customer/" + globalSubscriberId + SERVICE_SUBSCRIPTIONS_PATH + encodePathSegment(serviceType) +"/service-instances\"]," +
"\"query\": \"query/vnf-topology-fromServiceInstance\"}";
Response resp = doAaiPut(QUERY_FORMAT_SIMPLE, payload, false);
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
index af5429c28..2a879e295 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
@@ -65,7 +65,7 @@ public interface AaiClientInterface extends ProbeInterface {
AaiResponse getInstanceGroupsByCloudRegion(String cloudOwner, String cloudRegionId, String networkFunction);
- AaiResponse getVNFData(String globalSubscriberId, String serviceType);
+ AaiResponse<AaiGetVnfResponse> getVNFData(String globalSubscriberId, String serviceType);
AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId);
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java
index f2f6ca50a..099f2449b 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java
@@ -32,6 +32,7 @@ public class ModelVer {
private String distributionStatus;
private String resourceVersion;
private String modelDescription;
+ private String orchestrationType;
@@ -89,4 +90,12 @@ public class ModelVer {
this.modelDescription = modelDescription;
}
+ public String getOrchestrationType() {
+ return orchestrationType;
+ }
+
+ @JsonAlias("orchestration-type")
+ public void setOrchestrationType(String orchestrationType) {
+ this.orchestrationType = orchestrationType;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
index 034800516..4369c17fc 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.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.
@@ -22,7 +22,8 @@ package org.onap.vid.aai.util;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
-import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY;
+import static org.onap.vid.logging.Headers.INVOCATION_ID;
+import static org.onap.vid.logging.Headers.PARTNER_NAME;
import com.att.eelf.configuration.EELFLogger;
import java.io.UnsupportedEncodingException;
@@ -30,6 +31,7 @@ import java.net.URI;
import java.net.URLEncoder;
import java.util.Optional;
import java.util.UUID;
+import java.util.function.Supplier;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
@@ -41,6 +43,7 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.vid.aai.ExceptionWithRequestInfo;
import org.onap.vid.aai.ResponseWithRequestInfo;
import org.onap.vid.aai.exceptions.InvalidPropertyException;
+import org.onap.vid.logging.RequestIdHeader;
import org.onap.vid.utils.Logging;
import org.onap.vid.utils.Unchecked;
import org.springframework.beans.factory.annotation.Autowired;
@@ -52,305 +55,222 @@ import org.springframework.http.HttpMethod;
*/
public class AAIRestInterface {
- /** The logger. */
- protected EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AAIRestInterface.class);
-
- protected final EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("aai");
-
- /** The client. */
- private Client client = null;
-
- /** The rest srvr base URL. */
- private String restSrvrBaseURL;
-
- @Autowired
- protected HttpsAuthClient httpsAuthClientFactory;
- private final ServletRequestHelper servletRequestHelper;
- private final SystemPropertyHelper systemPropertyHelper;
- protected final Logging loggingService;
-
- protected static final String START_STRING = " start";
- protected static final String TRANSACTION_ID_HEADER = "X-TransactionId";
- protected static final String FROM_APP_ID_HEADER = "X-FromAppId";
- protected static final String SUCCESSFUL_API_MESSAGE = " REST api call was successful!";
- protected static final String URL_DECLARATION = ", url=";
-
- public AAIRestInterface(HttpsAuthClient httpsAuthClientFactory,
- ServletRequestHelper servletRequestHelper,
- SystemPropertyHelper systemPropertyHelper,
- Logging loggingService) {
- this.httpsAuthClientFactory = httpsAuthClientFactory;
- this.servletRequestHelper = servletRequestHelper;
- this.systemPropertyHelper = systemPropertyHelper;
- this.loggingService = loggingService;
- initRestClient();
- }
-
- /**
- * For testing purpose
- */
- AAIRestInterface(Optional<Client> client,
- HttpsAuthClient httpsAuthClientFactory,
- ServletRequestHelper servletRequestHelper,
- SystemPropertyHelper systemPropertyHelper,
- Logging loggingService){
- this.httpsAuthClientFactory = httpsAuthClientFactory;
- this.servletRequestHelper = servletRequestHelper;
- this.systemPropertyHelper = systemPropertyHelper;
- this.loggingService = loggingService;
- if (client != null && client.isPresent()){
- this.client = client.get();
- }
-
- }
-
- /**
- * Encode URL.
- *
- * @param nodeKey the node key
- * @return the string
- * @throws UnsupportedEncodingException the unsupported encoding exception
- */
- public String encodeURL (String nodeKey) throws UnsupportedEncodingException {
- return URLEncoder.encode(nodeKey, "UTF-8").replaceAll("\\+", "%20");
- }
-
- protected void initRestClient() {
- initRestClient(false);
- }
-
-
- private void initRestClient(boolean propagateExceptions) {
- if (client == null) {
- try {
- client = httpsAuthClientFactory.getClient(HttpClientMode.WITH_KEYSTORE);
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, "Exception in REST call to DB in initRestClient" + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, "Exception in REST call to DB : " + e.toString());
- if (propagateExceptions) {
- ExceptionUtils.rethrow(e);
- }
- }
- }
- }
-
-
-
- /**
- * Sets the rest srvr base URL.
- *
- * @param baseURL the base URL
- */
- public void setRestSrvrBaseURL(String baseURL)
- {
- if (baseURL == null) {
- logger.info(EELFLoggerDelegate.errorLogger, "REST Server base URL cannot be null.");
- logger.debug(EELFLoggerDelegate.debugLogger, "REST Server base URL cannot be null.");
- }
-
- restSrvrBaseURL = baseURL;
- }
-
- /**
- * Gets the rest srvr base URL.
- *
- * @return the rest srvr base URL
- */
- public String getRestSrvrBaseURL() {
- return restSrvrBaseURL;
- }
-
-
- /**
- * Rest get.
- *
- * @param fromAppId the from app id
- * @param transId the trans id
- * @param requestUri the request uri
- * @param xml the xml
- * @return the string
- */
- public ResponseWithRequestInfo RestGet(String fromAppId, String transId, URI requestUri, boolean xml) {
- return RestGet(fromAppId, transId, requestUri, xml, false);
- }
-
- public ResponseWithRequestInfo RestGet(String fromAppId, String transId, URI requestUri, boolean xml, boolean propagateExceptions) {
- return doRest(fromAppId, transId, requestUri, null, HttpMethod.GET, xml, propagateExceptions);
- }
-
- public ResponseWithRequestInfo doRest(String fromAppId, String transId, URI requestUri, String payload, HttpMethod method, boolean xml, boolean propagateExceptions) {
- String url = null;
- String methodName = "Rest"+method.name();
- try {
-
- url = systemPropertyHelper.getFullServicePath(requestUri);
-
- initRestClient(propagateExceptions);
-
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);
- logger.debug(EELFLoggerDelegate.debugLogger, url + " for the get REST API");
-
- loggingService.logRequest(outgoingRequestsLogger, method, url, payload);
-
- final Response response;
- Invocation.Builder requestBuilder = client.target(url)
- .request()
- .accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)
- .header(TRANSACTION_ID_HEADER, transId)
- .header(FROM_APP_ID_HEADER, fromAppId)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId());
-
- requestBuilder = systemPropertyHelper.isClientCertEnabled() ?
- requestBuilder : authenticateRequest(requestBuilder);
-
- Invocation restInvocation = StringUtils.isEmpty(payload) ?
- requestBuilder.build(method.name()) :
- requestBuilder.build(method.name(), Entity.entity(payload, MediaType.APPLICATION_JSON));
-
- response = restInvocation.invoke();
- loggingService.logResponse(outgoingRequestsLogger, method, url, response);
-
- if (response.getStatusInfo().getFamily() == Response.Status.Family.SUCCESSFUL) {
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + SUCCESSFUL_API_MESSAGE);
- logger.info(EELFLoggerDelegate.errorLogger, methodName + SUCCESSFUL_API_MESSAGE);
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, response));
- }
- return new ResponseWithRequestInfo(response, url, method);
- } catch (Exception e) {
- logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));
- if (propagateExceptions) {
- throw new ExceptionWithRequestInfo(method, defaultIfNull(url, requestUri.toASCIIString()), e);
- } else {
- return new ResponseWithRequestInfo(null, url, method);
- }
- }
- }
-
- protected String extractOrGenerateRequestId() {
- return servletRequestHelper.extractOrGenerateRequestId();
- }
-
-
- /**
- * Delete.
- *
- * @param sourceID the source ID
- * @param transId the trans id
- * @param path the path
- * @return true, if successful
- */
- public boolean Delete(String sourceID, String transId, String path) {
- String methodName = "Delete";
- transId += ":" + UUID.randomUUID().toString();
- logger.debug(methodName + START_STRING);
- Boolean response = false;
- String url = systemPropertyHelper.getFullServicePath(path);
- try {
-
- initRestClient();
- loggingService.logRequest(outgoingRequestsLogger, HttpMethod.DELETE, url);
- final Response cres = client.target(url)
- .request()
- .accept(MediaType.APPLICATION_JSON)
- .header(TRANSACTION_ID_HEADER, transId)
- .header(FROM_APP_ID_HEADER, sourceID)
- .header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId())
- .delete();
- loggingService.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, cres);
- if (cres.getStatusInfo().equals(Response.Status.NOT_FOUND)) {
- logger.debug(EELFLoggerDelegate.debugLogger, "Resource does not exist...: " + cres.getStatus()
- + ":" + cres.readEntity(String.class));
- response = false;
- } else if (cres.getStatusInfo().equals(Response.Status.OK) || cres.getStatusInfo().equals(Response.Status.NO_CONTENT)) {
- logger.debug(EELFLoggerDelegate.debugLogger, "Resource " + url + " deleted");
- logger.info(EELFLoggerDelegate.errorLogger, "Resource " + url + " deleted");
- response = true;
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger, "Deleting Resource failed: " + cres.getStatus()
- + ":" + cres.readEntity(String.class));
- response = false;
- }
-
- } catch (Exception e) {
- logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));
- }
- return response;
- }
-
-
- /**
- * Rest put.
- *
- * @param fromAppId the from app id
- * @param path the path
- * @param payload the payload
- * @param xml the xml
- * @param propagateExceptions
- * @return the string
- */
- public ResponseWithRequestInfo RestPut(String fromAppId, String path, String payload, boolean xml, boolean propagateExceptions) {
- return doRest(fromAppId, UUID.randomUUID().toString(), Unchecked.toURI(path), payload, HttpMethod.PUT, xml, propagateExceptions);
- }
-
-
-
- /**
- * Rest post.
- *
- * @param fromAppId the from app id
- * @param path the path
- * @param payload the payload
- * @param xml the xml
- * @return the string
- */
- public Response RestPost(String fromAppId, String path, String payload, boolean xml) {
- String methodName = "RestPost";
- String url=systemPropertyHelper.getServiceBasePath(path);
- String transId = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);
-
- Response response = null;
- try {
- initRestClient();
- loggingService.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, payload);
- response = authenticateRequest(client.target(url)
- .request()
- .accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)
- .header(TRANSACTION_ID_HEADER, transId)
- .header(FROM_APP_ID_HEADER, fromAppId))
- .header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId())
- .post(Entity.entity(payload, MediaType.APPLICATION_JSON));
- loggingService.logResponse(outgoingRequestsLogger, HttpMethod.POST, url, response);
-
- if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
- logger.info(EELFLoggerDelegate.errorLogger, getValidResponseLogMessage(methodName));
- logger.debug(EELFLoggerDelegate.debugLogger, getValidResponseLogMessage(methodName));
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, response));
- }
- } catch (Exception e) {
- logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));
- }
- return response;
- }
-
- protected String getFailedResponseLogMessage(String path, String methodName, Exception e) {
- return methodName + URL_DECLARATION + path + ", Exception: " + e.toString();
- }
-
- protected String getValidResponseLogMessage(String methodName) {
- return methodName + URL_DECLARATION;
- }
-
- protected String getInvalidResponseLogMessage(String path, String methodName, Response cres) {
- return methodName + " with status=" + cres.getStatus() + URL_DECLARATION + path;
- }
-
- private Invocation.Builder authenticateRequest(Invocation.Builder requestBuilder) throws InvalidPropertyException, UnsupportedEncodingException {
- return requestBuilder
- .header("Authorization", "Basic " + systemPropertyHelper.getEncodedCredentials());
- }
+ /** The logger. */
+ protected EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AAIRestInterface.class);
+
+ protected final EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("aai");
+
+ /** The client. */
+ private Client client = null;
+
+ /** The rest srvr base URL. */
+ private String restSrvrBaseURL;
+
+ @Autowired
+ protected HttpsAuthClient httpsAuthClientFactory;
+ private final ServletRequestHelper servletRequestHelper;
+ private final SystemPropertyHelper systemPropertyHelper;
+ protected final Logging loggingService;
+
+ protected static final String START_STRING = " start";
+ protected static final String TRANSACTION_ID_HEADER = "X-TransactionId";
+ protected static final String FROM_APP_ID_HEADER = "X-FromAppId";
+ protected static final String SUCCESSFUL_API_MESSAGE = " REST api call was successful!";
+ protected static final String URL_DECLARATION = ", url=";
+
+ public AAIRestInterface(HttpsAuthClient httpsAuthClientFactory,
+ ServletRequestHelper servletRequestHelper,
+ SystemPropertyHelper systemPropertyHelper,
+ Logging loggingService) {
+ this.httpsAuthClientFactory = httpsAuthClientFactory;
+ this.servletRequestHelper = servletRequestHelper;
+ this.systemPropertyHelper = systemPropertyHelper;
+ this.loggingService = loggingService;
+ initRestClient();
+ }
+
+ /**
+ * For testing purpose
+ */
+ AAIRestInterface(Optional<Client> client,
+ HttpsAuthClient httpsAuthClientFactory,
+ ServletRequestHelper servletRequestHelper,
+ SystemPropertyHelper systemPropertyHelper,
+ Logging loggingService){
+ this.httpsAuthClientFactory = httpsAuthClientFactory;
+ this.servletRequestHelper = servletRequestHelper;
+ this.systemPropertyHelper = systemPropertyHelper;
+ this.loggingService = loggingService;
+ if (client != null && client.isPresent()){
+ this.client = client.get();
+ }
+
+ }
+
+ /**
+ * Encode URL.
+ *
+ * @param nodeKey the node key
+ * @return the string
+ * @throws UnsupportedEncodingException the unsupported encoding exception
+ */
+ public String encodeURL (String nodeKey) throws UnsupportedEncodingException {
+ return URLEncoder.encode(nodeKey, "UTF-8").replaceAll("\\+", "%20");
+ }
+
+ protected void initRestClient() {
+ initRestClient(false);
+ }
+
+
+ private void initRestClient(boolean propagateExceptions) {
+ if (client == null) {
+ try {
+ client = httpsAuthClientFactory.getClient(HttpClientMode.WITH_KEYSTORE);
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, "Exception in REST call to DB in initRestClient" + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, "Exception in REST call to DB : " + e.toString());
+ if (propagateExceptions) {
+ ExceptionUtils.rethrow(e);
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * Sets the rest srvr base URL.
+ *
+ * @param baseURL the base URL
+ */
+ public void setRestSrvrBaseURL(String baseURL)
+ {
+ if (baseURL == null) {
+ logger.info(EELFLoggerDelegate.errorLogger, "REST Server base URL cannot be null.");
+ logger.debug(EELFLoggerDelegate.debugLogger, "REST Server base URL cannot be null.");
+ }
+
+ restSrvrBaseURL = baseURL;
+ }
+
+ /**
+ * Gets the rest srvr base URL.
+ *
+ * @return the rest srvr base URL
+ */
+ public String getRestSrvrBaseURL() {
+ return restSrvrBaseURL;
+ }
+
+
+ public ResponseWithRequestInfo RestGet(String fromAppId, String transId, URI requestUri, boolean xml) {
+ return RestGet(fromAppId, transId, requestUri, xml, false);
+ }
+
+ public ResponseWithRequestInfo RestGet(String fromAppId, String transId, URI requestUri, boolean xml, boolean propagateExceptions) {
+ return doRest(fromAppId, transId, requestUri, null, HttpMethod.GET, xml, propagateExceptions);
+ }
+
+ public ResponseWithRequestInfo doRest(String fromAppId, String transId, URI requestUri, String payload, HttpMethod method, boolean xml, boolean propagateExceptions) {
+ return doRest(fromAppId, transId, ()->systemPropertyHelper.getFullServicePath(requestUri), payload, method, xml, propagateExceptions);
+ }
+
+
+ public ResponseWithRequestInfo doRest(String fromAppId, String transId, Supplier<String> urlSupplier, String payload, HttpMethod method, boolean xml, boolean propagateExceptions) {
+ String url = null;
+ String methodName = "Rest"+method.name();
+ try {
+
+ url = urlSupplier.get();
+
+ initRestClient(propagateExceptions);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);
+ logger.debug(EELFLoggerDelegate.debugLogger, url + " for the get REST API");
+
+ loggingService.logRequest(outgoingRequestsLogger, method, url, payload);
+
+ final Response response;
+
+ String requestId = extractOrGenerateRequestId();
+
+ Invocation.Builder requestBuilder = client.target(url)
+ .request()
+ .accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)
+ .header(PARTNER_NAME.getHeaderName(), PARTNER_NAME.getHeaderValue())
+ .header(TRANSACTION_ID_HEADER, transId)
+ .header(FROM_APP_ID_HEADER, fromAppId)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .header(RequestIdHeader.ONAP_ID.getHeaderName(), requestId)
+ .header(RequestIdHeader.ECOMP_ID.getHeaderName(), requestId)
+ .header(INVOCATION_ID.getHeaderName(), INVOCATION_ID.getHeaderValue())
+ ;
+
+ requestBuilder = systemPropertyHelper.isClientCertEnabled() ?
+ requestBuilder : authenticateRequest(requestBuilder);
+
+ Invocation restInvocation = StringUtils.isEmpty(payload) ?
+ requestBuilder.build(method.name()) :
+ requestBuilder.build(method.name(), Entity.entity(payload, MediaType.APPLICATION_JSON));
+
+ response = restInvocation.invoke();
+ loggingService.logResponse(outgoingRequestsLogger, method, url, response);
+
+ if (response.getStatusInfo().getFamily() == Response.Status.Family.SUCCESSFUL) {
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + SUCCESSFUL_API_MESSAGE);
+ logger.info(EELFLoggerDelegate.errorLogger, methodName + SUCCESSFUL_API_MESSAGE);
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, response));
+ }
+ return new ResponseWithRequestInfo(response, url, method);
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));
+ if (propagateExceptions) {
+ throw new ExceptionWithRequestInfo(method, defaultIfNull(url, ""), e);
+ } else {
+ return new ResponseWithRequestInfo(null, url, method);
+ }
+ }
+ }
+
+ protected String extractOrGenerateRequestId() {
+ return servletRequestHelper.extractOrGenerateRequestId();
+ }
+
+
+ public ResponseWithRequestInfo RestPut(String fromAppId, String path, String payload, boolean xml, boolean propagateExceptions) {
+ return doRest(fromAppId, UUID.randomUUID().toString(), Unchecked.toURI(path), payload, HttpMethod.PUT, xml, propagateExceptions);
+ }
+
+
+ public Response RestPost(String fromAppId, String path, String payload, boolean xml) {
+ ResponseWithRequestInfo response = doRest(
+ fromAppId,
+ UUID.randomUUID().toString(),
+ ()->systemPropertyHelper.getServiceBasePath(path),
+ payload,
+ HttpMethod.POST,
+ xml,
+ false);
+ return response.getResponse();
+ }
+
+ protected String getFailedResponseLogMessage(String path, String methodName, Exception e) {
+ return methodName + URL_DECLARATION + path + ", Exception: " + e.toString();
+ }
+
+ protected String getValidResponseLogMessage(String methodName) {
+ return methodName + URL_DECLARATION;
+ }
+
+ protected String getInvalidResponseLogMessage(String path, String methodName, Response cres) {
+ return methodName + " with status=" + cres.getStatus() + URL_DECLARATION + path;
+ }
+
+ private Invocation.Builder authenticateRequest(Invocation.Builder requestBuilder) throws InvalidPropertyException, UnsupportedEncodingException {
+ return requestBuilder
+ .header("Authorization", "Basic " + systemPropertyHelper.getEncodedCredentials());
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java
index ca151a731..0d37fb39e 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java
@@ -23,88 +23,59 @@ package org.onap.vid.asdc.beans;
import java.util.Collection;
import java.util.UUID;
-/**
- * The Class Service.
- */
public class Service {
- /**
- * The Enum DistributionStatus.
- */
public enum DistributionStatus {
- /** The distribution not approved. */
DISTRIBUTION_NOT_APPROVED,
- /** The distribution approved. */
DISTRIBUTION_APPROVED,
- /** The distributed. */
DISTRIBUTED,
- /** The distribution rejected. */
DISTRIBUTION_REJECTED,
- /** The destributed for tenant isolation. */
DISTRIBUTION_COMPLETE_OK
}
- /**
- * The Enum LifecycleState.
- */
public enum LifecycleState {
- /** The not certified checkout. */
NOT_CERTIFIED_CHECKOUT,
- /** The not certified checkin. */
NOT_CERTIFIED_CHECKIN,
- /** The ready for certification. */
READY_FOR_CERTIFICATION,
- /** The certification in progress. */
CERTIFICATION_IN_PROGRESS,
- /** The certified. */
CERTIFIED
}
- /** The uuid. */
private String uuid;
- /** The invariant UUID. */
private String invariantUUID;
- /** The name. */
private String name;
- /** The version. */
private String version;
- /** The tosca model URL. */
private String toscaModelURL;
- /** The category. */
private String category;
- /** The lifecycle state. */
private Service.LifecycleState lifecycleState;
- /** The last updater user uid. */
private String lastUpdaterUserId;
- /** The last updater full name. */
private String lastUpdaterFullName;
- /** The distribution status. */
private String distributionStatus;
- /** The artifacts. */
private Collection<Artifact> artifacts;
- /** The resources. */
private Collection<SubResource> resources;
+
+ private String orchestrationType;
public static class ServiceBuilder {
@@ -118,6 +89,7 @@ public class Service {
private String distributionStatus;
private Collection<Artifact> artifacts;
private Collection<SubResource> resources;
+ private String orchestrationType;
public ServiceBuilder setUuid(String uuid) {
this.uuid = uuid;
@@ -169,253 +141,131 @@ public class Service {
return this;
}
+ public ServiceBuilder setOrchestrationType(String orchestrationType) {
+ this.orchestrationType = orchestrationType;
+ return this;
+ }
+
public Service build() {
return new Service(this);
}
}
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
public String getUuid() {
return uuid;
}
- /**
- * Gets the invariant UUID.
- *
- * @return the invariant UUID
- */
public String getInvariantUUID() {
return invariantUUID;
}
- /**
- * Gets the name.
- *
- * @return the name
- */
public String getName() {
return name;
}
- /**
- * Gets the version.
- *
- * @return the version
- */
public String getVersion() {
return version;
}
- /**
- * Gets the tosca model URL.
- *
- * @return the tosca model URL
- */
public String getToscaModelURL() {
return toscaModelURL;
}
- /**
- * Gets the category.
- *
- * @return the category
- */
public String getCategory() {
return category;
}
- /**
- * Gets the lifecycle state.
- *
- * @return the lifecycle state
- */
public Service.LifecycleState getLifecycleState() {
return lifecycleState;
}
- /**
- * Gets the last updater user uid.
- *
- * @return the last updater user uid
- */
public String getLastUpdaterUserId() {
return lastUpdaterUserId;
}
- /**
- * Gets the last updater full name.
- *
- * @return the last updater full name
- */
public String getLastUpdaterFullName() {
return lastUpdaterFullName;
}
- /**
- * Gets the distribution status.
- *
- * @return the distribution status
- */
public String getDistributionStatus() {
return distributionStatus;
}
- /**
- * Gets the artifacts.
- *
- * @return the artifacts
- */
public Collection<Artifact> getArtifacts() {
return artifacts;
}
- /**
- * Gets the resources.
- *
- * @return the resources
- */
public Collection<SubResource> getResources() {
return resources;
}
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
+ public String getOrchestrationType() {
+ return orchestrationType;
+ }
+
public void setUuid(String uuid) {
this.uuid = uuid;
}
- /**
- * Sets the invariant UUID.
- *
- * @param invariantUUID the new invariant UUID
- */
public void setInvariantUUID(String invariantUUID) {
this.invariantUUID = invariantUUID;
}
- /**
- * Sets the name.
- *
- * @param name the new name
- */
public void setName(String name) {
this.name = name;
}
- /**
- * Sets the version.
- *
- * @param version the new version
- */
public void setVersion(String version) {
this.version = version;
}
- /**
- * Sets the tosca model URL.
- *
- * @param toscaModelURL the new tosca model URL
- */
public void setToscaModelURL(String toscaModelURL) {
this.toscaModelURL = toscaModelURL;
}
- /**
- * Sets the category.
- *
- * @param category the new category
- */
public void setCategory(String category) {
this.category = category;
}
- /**
- * Sets the lifecycle state.
- *
- * @param lifecycleState the new lifecycle state
- */
public void setLifecycleState(Service.LifecycleState lifecycleState) {
this.lifecycleState = lifecycleState;
}
- /**
- * Sets the last updater user uid.
- *
- * @param lastUpdaterUserId the new last updater user uid
- */
public void set(String lastUpdaterUserId) {
this.lastUpdaterUserId = lastUpdaterUserId;
}
- /**
- * Sets the last updater full name.
- *
- * @param lastUpdaterFullName the new last updater full name
- */
public void setLastUpdaterFullName(String lastUpdaterFullName) {
this.lastUpdaterFullName = lastUpdaterFullName;
}
- /**
- * Sets the distribution status.
- *
- * @param distributionStatus the new distribution status
- */
public void setDistributionStatus(String distributionStatus) {
this.distributionStatus = distributionStatus;
}
- /**
- * Sets the artifacts.
- *
- * @param artifacts the new artifacts
- */
public void setArtifacts(Collection<Artifact> artifacts) {
this.artifacts = artifacts;
}
- /**
- * Sets the resources.
- *
- * @param resources the new resources
- */
public void setResources(Collection<SubResource> resources) {
this.resources = resources;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
+ public void setOrchestrationType(String orchestrationType) {
+ this.orchestrationType = orchestrationType;
+ }
+
@Override
public String toString() {
return uuid;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode() {
return UUID.fromString(getUuid()).hashCode();
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object o) {
if (o == this)
@@ -442,5 +292,6 @@ public class Service {
this.distributionStatus = serviceBuilder.distributionStatus;
this.artifacts = serviceBuilder.artifacts;
this.resources = serviceBuilder.resources;
+ this.orchestrationType = serviceBuilder.orchestrationType;
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
index 9e139a02a..96be59123 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
@@ -29,6 +29,7 @@ import static org.onap.vid.client.SyncRestClientInterface.HEADERS.AUTHORIZATION;
import static org.onap.vid.client.SyncRestClientInterface.HEADERS.CONTENT_TYPE;
import static org.onap.vid.client.SyncRestClientInterface.HEADERS.X_ECOMP_INSTANCE_ID;
import static org.onap.vid.client.UnirestPatchKt.extractRawAsString;
+import static org.onap.vid.logging.Headers.PARTNER_NAME;
import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY;
import com.att.eelf.configuration.EELFLogger;
@@ -152,6 +153,7 @@ public class SdcRestClient implements AsdcClient {
private Map<String, String> prepareHeaders(String auth, String contentType) {
return ImmutableMap.of(
X_ECOMP_INSTANCE_ID, SystemProperties.getProperty(APP_DISPLAY_NAME),
+ PARTNER_NAME.getHeaderName(), PARTNER_NAME.getHeaderValue(),
AUTHORIZATION, auth,
REQUEST_ID_HEADER_KEY, Logging.extractOrGenerateRequestId(),
CONTENT_TYPE, contentType
diff --git a/vid-app-common/src/main/java/org/onap/vid/client/HttpBasicClient.java b/vid-app-common/src/main/java/org/onap/vid/client/HttpBasicClient.java
index 3c061986c..5607018b0 100644
--- a/vid-app-common/src/main/java/org/onap/vid/client/HttpBasicClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/client/HttpBasicClient.java
@@ -21,14 +21,11 @@
package org.onap.vid.client;
-import org.glassfish.jersey.client.ClientConfig;
-import org.glassfish.jersey.client.ClientProperties;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-
import javax.servlet.ServletContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* General HTTP client.
@@ -51,10 +48,8 @@ public class HttpBasicClient{
*/
public static Client getClient() {
- ClientConfig config = new ClientConfig();
- config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
-
- return ClientBuilder.newClient(config)
- .register(org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider.class);
+ return ClientBuilder
+ .newClient()
+ .register(org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider.class);
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java b/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java
index b7ff82afe..928e19357 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/LoggerController.java
@@ -20,6 +20,8 @@
package org.onap.vid.controller;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.File;
import java.io.IOException;
import java.util.List;
@@ -63,7 +65,7 @@ public class LoggerController extends RestrictedBaseController {
this.logfilePathCreator = logfilePathCreator;
}
- @GetMapping(value = "/{loggerName:audit|error|metrics}")
+ @GetMapping(value = "/{loggerName:audit|audit2019|error|metrics}")
public String getLog(@PathVariable String loggerName, HttpServletRequest request,
@RequestParam(value="limit", defaultValue = "5000") Integer limit) throws IOException {
@@ -74,7 +76,7 @@ public class LoggerController extends RestrictedBaseController {
}
String logfilePath = logfilePathCreator.getLogfilePath(loggerName);
- try (final ReversedLinesFileReader reader = new ReversedLinesFileReader(new File(logfilePath))) {
+ try (final ReversedLinesFileReader reader = new ReversedLinesFileReader(new File(logfilePath), UTF_8)) {
Supplier<String> reverseLinesSupplier = () -> {
try {
return reader.readLine();
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
index 5b05caa7a..4e7a77cd3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
@@ -30,6 +30,7 @@ import org.onap.vid.mso.MsoBusinessLogic;
import org.onap.vid.mso.MsoBusinessLogicImpl;
import org.onap.vid.mso.MsoInterface;
import org.onap.vid.mso.MsoProperties;
+import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.rest.MsoRestClientNew;
import org.onap.vid.services.CloudOwnerService;
import org.onap.vid.services.CloudOwnerServiceImpl;
@@ -49,14 +50,23 @@ public class MsoConfig {
}
@Bean
- public MsoRestClientNew msoClient(ObjectMapper unirestObjectMapper,
- HttpsAuthClient httpsAuthClient,
+ public MsoRestClientNew msoRestClientNew(ObjectMapper unirestObjectMapper,
SystemPropertiesWrapper systemPropertiesWrapper,
Logging loggingService){
// Satisfy both interfaces -- MsoInterface and RestMsoImplementation
return new MsoRestClientNew(
new SyncRestClient(unirestObjectMapper, loggingService),
SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL),
+ systemPropertiesWrapper
+ );
+ }
+
+ @Bean
+ public RestMsoImplementation restMsoImplementation(HttpsAuthClient httpsAuthClient,
+ SystemPropertiesWrapper systemPropertiesWrapper,
+ Logging loggingService){
+ // Satisfy both interfaces -- MsoInterface and RestMsoImplementation
+ return new RestMsoImplementation(
httpsAuthClient,
systemPropertiesWrapper,
loggingService
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
index 535c97ce7..da66e8951 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
@@ -38,7 +38,6 @@ import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.MsoResponseWrapper2;
import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.RestObject;
-import org.onap.vid.mso.rest.MsoRestClientNew;
import org.onap.vid.mso.rest.Request;
import org.onap.vid.mso.rest.RequestDetails;
import org.onap.vid.mso.rest.RequestDetailsWrapper;
@@ -90,7 +89,7 @@ public class MsoController extends RestrictedBaseController {
private final CloudOwnerService cloudOwnerService;
@Autowired
- public MsoController(MsoBusinessLogic msoBusinessLogic, MsoRestClientNew msoClientInterface, CloudOwnerService cloudOwnerService) {
+ public MsoController(MsoBusinessLogic msoBusinessLogic, RestMsoImplementation msoClientInterface, CloudOwnerService cloudOwnerService) {
this.msoBusinessLogic = msoBusinessLogic;
this.restMso = msoClientInterface;
this.cloudOwnerService = cloudOwnerService;
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
index ac5c2751c..df97f89f8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt
@@ -427,14 +427,17 @@ abstract class ResourceCommand(
protected fun pushChildrenJobsToBroker(children:Collection<BaseResource>,
dataForChild: Map<String, Any>,
jobType: JobType?=null): List<String> {
- var counter = 0;
- return children
- .map {Pair(it, counter++)}
+ return setPositionWhereIsMissing(children)
.map { jobAdapter.createChildJob(jobType ?: it.first.jobType, it.first, sharedData, dataForChild, it.second) }
.map { jobsBrokerService.add(it) }
.map { it.toString() }
}
+ protected fun setPositionWhereIsMissing(children: Collection<BaseResource>): List<Pair<BaseResource, Int>> {
+ var orderingPosition = children.map{ defaultIfNull(it.position, 0) }.max() ?: 0
+ return children
+ .map {Pair(it, it.position ?: ++orderingPosition)}
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt b/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt
index a0bbceea1..e9f83ef22 100644
--- a/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt
@@ -4,18 +4,35 @@ package org.onap.vid.logging
import org.onap.portalsdk.core.util.SystemProperties
import org.onap.vid.logging.RequestIdHeader.*
+import java.util.*
import javax.servlet.http.HttpServletRequest
-enum class RequestIdHeader(val headerName: String) {
+interface Header {
+ val headerName: String
+ fun stringEquals(header: String): Boolean = headerName.equals(header, true)
+}
+
+abstract class NamedHeader(override val headerName: String) : Header {
+ abstract fun getHeaderValue(): String
+}
+
+@JvmField
+val PARTNER_NAME = object : NamedHeader("X-ONAP-PartnerName") {
+ override fun getHeaderValue() = "VID.VID"
+}
+
+@JvmField
+val INVOCATION_ID = object : NamedHeader("X-InvocationID") {
+ override fun getHeaderValue() = UUID.randomUUID().toString()
+}
+enum class RequestIdHeader(override val headerName: String) : Header {
ONAP_ID("X-ONAP-RequestID"),
REQUEST_ID("X-RequestID"),
TRANSACTION_ID("X-TransactionID"),
ECOMP_ID(SystemProperties.ECOMP_REQUEST_ID),
;
- fun stringEquals(header: String) = headerName.equals(header, true)
-
fun getHeaderValue(request: HttpServletRequest): String? = request.getHeader(headerName)
}
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 3d980dce8..8f9b98a55 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
@@ -30,6 +30,7 @@ import static org.onap.vid.controller.MsoController.REQUEST_TYPE;
import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
import static org.onap.vid.controller.MsoController.WORKFLOW_ID;
+import static org.onap.vid.logging.Headers.PARTNER_NAME;
import static org.onap.vid.mso.MsoProperties.MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS;
import static org.onap.vid.mso.MsoProperties.MSO_REST_API_OPERATIONAL_ENVIRONMENT_ACTIVATE;
import static org.onap.vid.mso.MsoProperties.MSO_REST_API_OPERATIONAL_ENVIRONMENT_CREATE;
@@ -230,7 +231,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
UUID requestId = UUID.randomUUID();
extraHeaders.put("X-ONAP-RequestID",requestId.toString());
- extraHeaders.put("X-ONAP-PartnerName","VID");
+ extraHeaders.put(PARTNER_NAME.getHeaderName(), PARTNER_NAME.getHeaderValue());
extraHeaders.put("X-RequestorID",userId);
return msoClientInterface.invokeWorkflow(request,final_endpoint,extraHeaders);
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 d1cb3a37b..a16b44925 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
@@ -21,14 +21,13 @@
package org.onap.vid.mso;
import io.joshworks.restclient.http.HttpResponse;
+import java.util.Map;
import org.onap.vid.aai.HttpResponseWithRequestInfo;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
-import org.onap.vid.model.SOWorkflowList;
import org.onap.vid.changeManagement.WorkflowRequestDetail;
+import org.onap.vid.model.SOWorkflowList;
import org.onap.vid.mso.rest.RequestDetails;
-import java.util.Map;
-
/**
* Created by pickjonathan on 21/06/2017.
*/
@@ -124,6 +123,5 @@ public interface MsoInterface {
<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/RestMsoImplementation.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
index ee1eb0429..91b288998 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
@@ -20,6 +20,8 @@
package org.onap.vid.mso;
+import static org.onap.vid.logging.Headers.INVOCATION_ID;
+import static org.onap.vid.logging.Headers.PARTNER_NAME;
import static org.onap.vid.utils.Logging.ONAP_REQUEST_ID_HEADER_KEY;
import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY;
import static org.onap.vid.utils.Logging.getMethodCallerName;
@@ -36,15 +38,12 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.Response;
import org.apache.commons.codec.binary.Base64;
-import org.apache.http.HttpException;
import org.eclipse.jetty.util.security.Password;
+import org.glassfish.jersey.client.ClientProperties;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.vid.aai.ExceptionWithRequestInfo;
import org.onap.vid.aai.util.HttpClientMode;
import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.client.HttpBasicClient;
-import org.onap.vid.exceptions.GenericUncheckedException;
-import org.onap.vid.mso.rest.RestInterface;
import org.onap.vid.utils.Logging;
import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,7 +52,7 @@ import org.springframework.http.HttpMethod;
/**
* Created by pickjonathan on 26/06/2017.
*/
-public class RestMsoImplementation implements RestInterface {
+public class RestMsoImplementation {
/**
@@ -85,7 +84,7 @@ public class RestMsoImplementation implements RestInterface {
*/
@Autowired
- protected RestMsoImplementation(HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemProperties, Logging loggingService){
+ public RestMsoImplementation(HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemProperties, Logging loggingService){
this.httpsAuthClient=httpsAuthClient;
this.systemProperties = systemProperties;
this.loggingService = loggingService;
@@ -108,12 +107,12 @@ public class RestMsoImplementation implements RestInterface {
MultivaluedHashMap<String, Object> commonHeaders = new MultivaluedHashMap();
commonHeaders.put("Authorization", Collections.singletonList(("Basic " + authStringEnc)));
- commonHeaders.put("X-ONAP-PartnerName", Collections.singletonList("VID"));
+ commonHeaders.put(PARTNER_NAME.getHeaderName(), Collections.singletonList(PARTNER_NAME.getHeaderValue()));
String requestIdValue = Logging.extractOrGenerateRequestId();
commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue));
commonHeaders.put(ONAP_REQUEST_ID_HEADER_KEY, Collections.singletonList(requestIdValue));
-
+ commonHeaders.put(INVOCATION_ID.getHeaderName(), Collections.singletonList(INVOCATION_ID.getHeaderValue()));
boolean useSsl = true;
if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) {
@@ -136,52 +135,6 @@ public class RestMsoImplementation implements RestInterface {
return commonHeaders;
}
- public <T> RestObjectWithRequestInfo<T> Get(T t, String path, RestObject<T> restObject, boolean warpException) {
- String methodName = "Get";
-
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_LOG);
-
- String url = null;
- String rawData = null;
- Integer status = null;
-
- try {
- restObject.set(t);
- url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
-
- MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
- loggingService.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
- final Response cres = client.target(url)
- .request()
- .accept(APPLICATION_JSON)
- .headers(commonHeaders)
- .get();
- loggingService.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, cres);
-
- cres.bufferEntity();
- status = cres.getStatus();
- rawData = cres.readEntity(String.class);
-
- restObject.setStatusCode(status);
-
- if (status == 200 || status == 202) {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + REST_API_SUCCESSFULL_LOG);
-
- } else {
- throw new GenericUncheckedException(new HttpException(methodName + WITH_STATUS + status + " (200 or 202 expected), url= " + url));
- }
-
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + " received status=" + status);
-
- return new RestObjectWithRequestInfo<>(HttpMethod.GET, url, restObject, status, rawData);
- } catch (RuntimeException e) {
- throw warpException ? new ExceptionWithRequestInfo(HttpMethod.GET, url, rawData, status, e) : e;
- }
- }
-
- @Override
public <T> RestObject<T> GetForObject(String path, Class<T> clazz) {
final String methodName = getMethodName();
logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {})", getMethodCallerName(), methodName, path, clazz);
@@ -211,80 +164,11 @@ public class RestMsoImplementation implements RestInterface {
return restObject;
}
- @Override
- public <T> void Delete(T t, Object r, String path, RestObject<T> restObject) {
-
- String methodName = "Delete";
- String url="";
- Response cres;
-
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + START_LOG);
-
- try {
- MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
-
- url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- loggingService.logRequest(outgoingRequestsLogger, HttpMethod.DELETE, url, r);
- cres = client.target(url)
- .request()
-
- .accept(APPLICATION_JSON)
- .headers(commonHeaders)
- //.entity(r)
- .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON))
- .invoke();
- loggingService.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, cres);
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if (status == 404) { // resource not found
- String msg = "Resource does not exist...: " + cres.getStatus();
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + msg);
- } else if (status == 200 || status == 204){
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + "Resource " + url + " deleted");
- } else if (status == 202) {
- String msg = "Delete in progress: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + msg);
- }
- else {
- String msg = "Deleting Resource failed: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + msg);
- }
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + NO_RESPONSE_ENTITY_LOG
- + e.getMessage());
- throw e;
- }
-
- }
- catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
- throw e;
- }
- }
-
public <T> RestObject<T> PostForObject(Object requestDetails, String path, Class<T> clazz) {
logger.debug(EELFLoggerDelegate.debugLogger, REST_MSG_TEMPLATE, getMethodCallerName(), getMethodName(), requestDetails, path, clazz);
return restCall(HttpMethod.POST, clazz, requestDetails, path);
}
- public <T> RestObject<T> DeleteForObject(Object requestDetails, String path, Class<T> clazz) {
- logger.debug(EELFLoggerDelegate.debugLogger, REST_MSG_TEMPLATE, getMethodCallerName(), getMethodName(), requestDetails, path, clazz);
- return restCall(HttpMethod.DELETE, clazz, requestDetails, path);
- }
-
- @Override
- public void Post(String t, Object r, String path, RestObject<String> restObject) {
- logger.debug(EELFLoggerDelegate.debugLogger, REST_MSG_TEMPLATE, getMethodCallerName(), getMethodName(), t.getClass(), r, path);
- restObject.copyFrom(restCall(HttpMethod.POST, String.class, r, path));
- }
-
public Invocation.Builder prepareClient(String path, String methodName) {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
@@ -320,7 +204,9 @@ public class RestMsoImplementation implements RestInterface {
final Invocation.Builder restBuilder = client.target(url)
.request()
.accept(APPLICATION_JSON)
- .headers(commonHeaders);
+ .headers(commonHeaders)
+ .property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true)
+ ;
Invocation restInvocation = payload==null ?
restBuilder.build(httpMethod.name()) :
@@ -364,56 +250,4 @@ public class RestMsoImplementation implements RestInterface {
return restObject;
}
- @Override
- public <T> void Put(T t, org.onap.vid.changeManagement.RequestDetailsWrapper r, String path, RestObject<T> restObject) {
-
- String methodName = "Put";
- String url="";
-
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + START_LOG);
-
- try {
-
- MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
-
- url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- loggingService.logRequest(outgoingRequestsLogger, HttpMethod.PUT, url, r);
- // Change the content length
- final Response cres = client.target(url)
- .request()
- .accept(APPLICATION_JSON)
- .headers(commonHeaders)
- //.header("content-length", 201)
- .put(Entity.entity(r, MediaType.APPLICATION_JSON));
-
- loggingService.logResponse(outgoingRequestsLogger, HttpMethod.PUT, url, cres);
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + NO_RESPONSE_ENTITY_LOG
- + e.getMessage());
- throw e;
- }
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if ( status >= 200 && status <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, "<== " + methodName + REST_API_SUCCESSFULL_LOG);
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + REST_API_SUCCESSFULL_LOG);
-
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_STATUS +status+ URL_LOG +url);
- }
-
- } catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
- throw e;
-
- }
- }
}
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 b2ccde93b..5e19dad46 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
@@ -20,6 +20,7 @@
*/
package org.onap.vid.mso.rest;
+import static org.onap.vid.logging.Headers.PARTNER_NAME;
import static org.onap.vid.utils.Logging.ONAP_REQUEST_ID_HEADER_KEY;
import com.google.common.collect.ImmutableMap;
@@ -38,11 +39,11 @@ import org.eclipse.jetty.util.security.Password;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.HttpResponseWithRequestInfo;
-import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.changeManagement.MsoRequestDetails;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.client.SyncRestClient;
+import org.onap.vid.logging.Headers;
import org.onap.vid.model.RequestReferencesContainer;
import org.onap.vid.model.SOWorkflowList;
import org.onap.vid.mso.MsoInterface;
@@ -50,7 +51,6 @@ import org.onap.vid.mso.MsoProperties;
import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.MsoResponseWrapperInterface;
import org.onap.vid.mso.MsoUtil;
-import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.RestObject;
import org.onap.vid.utils.Logging;
import org.onap.vid.utils.SystemPropertiesWrapper;
@@ -60,27 +60,28 @@ import org.springframework.http.HttpMethod;
/**
* Created by pickjonathan on 21/06/2017.
*/
-public class MsoRestClientNew extends RestMsoImplementation implements MsoInterface {
+public class MsoRestClientNew implements MsoInterface {
/**
* The Constant dateFormat.
*/
public static final String X_FROM_APP_ID = "X-FromAppId";
- public static final String X_ONAP_PARTNER_NAME = "X-ONAP-PartnerName";
final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
private static final String START = " start";
private final SyncRestClient client;
private final String baseUrl;
+ private final SystemPropertiesWrapper systemProperties;
private final Map<String, String> commonHeaders;
+
/**
* The logger.
*/
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class);
- public MsoRestClientNew(SyncRestClient client, String baseUrl, HttpsAuthClient authClient, SystemPropertiesWrapper systemPropertiesWrapper, Logging loggingService) {
- super(authClient,systemPropertiesWrapper, loggingService);
+ public MsoRestClientNew(SyncRestClient client, String baseUrl, SystemPropertiesWrapper systemPropertiesWrapper) {
this.client = client;
this.baseUrl = baseUrl;
+ this.systemProperties = systemPropertiesWrapper;
this.commonHeaders = initCommonHeaders();
}
@@ -482,14 +483,6 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
return client.post(path, getHeaders(), requestDetailsWrapper, responseClass);
}
- @Override
- public <T> HttpResponse<T> post(String endpoint, RequestDetails requestDetails, Class<T> responseClass) {
- String path = baseUrl + endpoint;
-
- return client.post(path, getHeaders(), requestDetails, responseClass);
- }
-
-
public HttpResponse<SOWorkflowList> getWorkflowListByModelId(String endpoint){
String path = baseUrl + endpoint;
@@ -545,6 +538,7 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
String requestIdValue = Logging.extractOrGenerateRequestId();
map.put(SystemProperties.ECOMP_REQUEST_ID, requestIdValue);
map.put(ONAP_REQUEST_ID_HEADER_KEY, requestIdValue);
+ map.put(Headers.INVOCATION_ID.getHeaderName(), Headers.INVOCATION_ID.getHeaderValue());
return map;
}
@@ -563,7 +557,7 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
map.put(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
map.put(X_FROM_APP_ID, systemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));
- map.put(X_ONAP_PARTNER_NAME, "VID");
+ map.put(PARTNER_NAME.getHeaderName(), PARTNER_NAME.getHeaderValue());
return ImmutableMap.copyOf(map);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java
deleted file mode 100644
index 3a0d8fd8e..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/RestInterface.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*-
- * ============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.mso.rest;
-
-import org.onap.vid.changeManagement.RequestDetailsWrapper;
-import org.onap.vid.mso.RestObject;
-import org.onap.vid.mso.RestObjectWithRequestInfo;
-
-/**
- * Created by pickjonathan on 26/06/2017.
- */
-public interface RestInterface {
-
- /**
- * Gets the.
- *
- * @param <T> the generic type
- * @param t the t
- * @param path the path
- * @param restObject the rest object
- * @param warpException
- * @throws Exception the exception
- */
- <T> RestObjectWithRequestInfo<T> Get(T t, String path, RestObject<T> restObject, boolean warpException);
-
- /**
- * Delete.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- <T> void Delete(T t, Object r, String path, RestObject<T> restObject);
-
- /**
- * Post.
- *
- * @param t the t
- * @param r the r
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- void Post(String t, Object r, String path, RestObject<String> restObject);
-
- /**
- * Put.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- <T> void Put(T t, RequestDetailsWrapper r, String path, RestObject<T> restObject);
-
- <T> RestObject<T> GetForObject(String path, Class<T> clazz);
-
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index 7384c97e2..a3343d36b 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -74,6 +74,7 @@ public enum Features implements Feature {
FLAG_PNP_INSTANTIATION,
FLAG_HANDLE_SO_WORKFLOWS,
FLAG_CREATE_ERROR_REPORTS,
+ FLAG_SHOW_ORCHESTRATION_TYPE,
FLAG_DISABLE_HOMING,
FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG,
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT,
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index b6404fa68..b64a233c7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -75,7 +75,6 @@ import org.onap.vid.aai.model.RelationshipData;
import org.onap.vid.aai.model.RelationshipList;
import org.onap.vid.aai.model.Result;
import org.onap.vid.aai.model.ServiceRelationships;
-import org.onap.vid.aai.model.VnfResult;
import org.onap.vid.asdc.beans.Service;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.ServiceInstanceSearchResult;
@@ -137,7 +136,9 @@ public class AaiServiceImpl implements AaiService {
.setToscaModelURL(null)
.setLifecycleState(null)
.setArtifacts(null)
- .setResources(null).build();
+ .setResources(null)
+ .setOrchestrationType(modelVer.getOrchestrationType())
+ .build();
@@ -150,6 +151,10 @@ public class AaiServiceImpl implements AaiService {
return services;
}
+ private boolean hasData(AaiResponse<?> aaiResponse) {
+ return aaiResponse != null && aaiResponse.getT() != null;
+ }
+
private boolean validateModel(Model model){
if (model == null) {
return false;
@@ -388,24 +393,7 @@ public class AaiServiceImpl implements AaiService {
@Override
public AaiResponse<AaiGetVnfResponse> getVNFData(String globalSubscriberId, String serviceType) {
AaiResponse<AaiGetVnfResponse> response = aaiClient.getVNFData(globalSubscriberId, serviceType);
- return filterChangeManagementVNFCandidatesResponse(response);
- }
-
- protected AaiResponse<AaiGetVnfResponse> filterChangeManagementVNFCandidatesResponse(AaiResponse<AaiGetVnfResponse> response) {
-
- if (response != null && response.getT() != null) {
- List<VnfResult> filteredVnfs = response.getT().results.stream()
- .filter(result -> (
- result.nodeType.equalsIgnoreCase("generic-vnf") ||
- result.nodeType.equalsIgnoreCase("service-instance")))
- .collect(Collectors.toList());
-
- AaiGetVnfResponse aaiGetVnfResponse = new AaiGetVnfResponse();
- aaiGetVnfResponse.results = filteredVnfs;
- return new AaiResponse<>(aaiGetVnfResponse, response.getErrorMessage(), response.getHttpCode());
- }
-
- return new AaiResponse<>();
+ return hasData(response) ? response : new AaiResponse<>();
}
@Override
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
index db2ff8e97..d4910bf25 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
@@ -36,3 +36,4 @@ FLAG_DISABLE_HOMING = true
FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH=false
FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = false
FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE = false
+FLAG_SHOW_ORCHESTRATION_TYPE = false
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
index d1ce91f44..709de9566 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
@@ -15,6 +15,7 @@ FLAG_1810_AAI_LOCAL_CACHE = true
FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER = false
FLAG_HANDLE_SO_WORKFLOWS = true
FLAG_CREATE_ERROR_REPORTS = true
+FLAG_SHOW_ORCHESTRATION_TYPE = false
# Modern UI (Drawing-Board; View/Edit)
# - - - - - - - - - - - - - - - - - -
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
index f76d4786f..3575c382d 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -264,6 +264,7 @@ appDS2
FLAG_1908_RELEASE_TENANT_ISOLATION: "FLAG_1908_RELEASE_TENANT_ISOLATION",
FLAG_FLASH_REPLACE_VF_MODULE: "FLAG_FLASH_REPLACE_VF_MODULE",
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT: "FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT",
+ FLAG_SHOW_ORCHESTRATION_TYPE: "FLAG_SHOW_ORCHESTRATION_TYPE",
}
};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js
index 9cb905038..b29680f9d 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js
@@ -89,6 +89,10 @@
});
};
+ $scope.isShowOrchestrationType = function() {
+ return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ORCHESTRATION_TYPE);
+ };
+
var wholeData=[];
$scope.filterDataWithHigherVersion = function(serviceData){
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 d966df8d9..9eed4c14d 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
@@ -541,7 +541,7 @@
});
};
- function isCompatibleVNFRole(vnf) {
+ function isCompatibleNFRole(vnf) {
return vnf.properties['nf-role'] === vm.changeManagement['vnfType'] || !vm.changeManagement['vnfType'];
@@ -549,7 +549,7 @@
function isValidVnf(vnf) {
- let result = isCompatibleVNFRole(vnf) && vnf.properties["model-invariant-id"]
+ let result = isCompatibleNFRole(vnf) && vnf.properties["model-invariant-id"]
&& vnf.properties["model-version-id"];
return result;
@@ -577,9 +577,9 @@
vm.vnfTypes = [];
vm.vnfTypesTemp = [];
vm.serviceInstances = [];
- vm.fromVNFVersions=[];
- vm.vnfNames =[];
- vm.changeManagement.vnfNames =[];
+ vm.fromVNFVersions = [];
+ vm.vnfNames = [];
+ vm.changeManagement.vnfNames = [];
var instances = vm.changeManagement.serviceType["service-instances"]["service-instance"];
// var promiseArrOfGetVnfs = preparePromiseArrOfGetVnfs(instances);
@@ -723,7 +723,7 @@
};
vm.loadVNFNames = function () {
- vm.changeManagement.vnfNames =[];
+ vm.changeManagement.vnfNames = [];
vm.vnfNames = [];
const vnfs = vm.changeManagement.fromVNFVersion ? vm.vnfs : [];
@@ -731,7 +731,7 @@
var selectedVersionNumber = getVersionNameForId(vm.changeManagement.fromVNFVersion);
- if (isCompatibleVNFRole(vnf) &&
+ if (isCompatibleNFRole(vnf) &&
selectedVersionNumber === getVersionNameForId(vnf.properties["model-version-id"])) {
var vServer = {};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm
index 4570a0b08..06fc7f67b 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm
@@ -48,6 +48,7 @@
<tr>
<th att-table-header key="action">Action</th>
<th att-table-header key="uuid">UUID</th>
+ <th ng-if="isShowOrchestrationType()" att-table-header key="orchestrationType">Orchestration Type</th>
<th att-table-header key="invariantUUID">Invariant UUID</th>
<th att-table-header default-sort="A" key="name">Name</th>
<th att-table-header key="version">Version</th>
@@ -62,6 +63,7 @@
<tr class="sdcServiceModel" data-tests-id="Browse_SDC_Service_Models-uuid-{{service['uuid']}}">
<td class="deploy" att-table-body ><button class="deploy-service-class" type=button data-tests-id="deploy-{{service['uuid']}}" ng-click="deployService(service)" att-button btn-type="{{deployButtonType}}" size="small">Deploy</button></td>
<td class="uuid" att-table-body ng-bind="service['uuid']"></td>
+ <td ng-if="isShowOrchestrationType()" class="orchestrationType" att-table-body ng-bind="service['orchestrationType']"></td>
<td class="invariantUUID" att-table-body data-tests-id="Invariant-{{service['invariantUUID']}}" ng-bind="service['invariantUUID']"></td>
<td class="name" att-table-body ng-bind="service['name']"></td>
<td class="version" att-table-body ng-bind="service['version']"></td>