summaryrefslogtreecommitdiffstats
path: root/catalog-fe/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-fe/src/main')
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/Constants.java15
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/client/BackendClient.java179
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/Audit.java73
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/CrudOperation.java26
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HttpRequestInfo.java77
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/ImportMetadata.java80
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java85
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/MyObjectMapperProvider.java49
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigMgrServlet.java88
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java114
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServlet.java49
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java214
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java219
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/KibanaServlet.java98
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java279
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/SSLProxyServlet.java108
-rw-r--r--catalog-fe/src/main/resources/application-context.xml23
-rw-r--r--catalog-fe/src/main/resources/config/configuration.yaml78
-rw-r--r--catalog-fe/src/main/resources/config/ecomp-error-configuration.yaml48
-rw-r--r--catalog-fe/src/main/resources/config/logback.xml125
-rw-r--r--catalog-fe/src/main/resources/config/rest-configuration-info.yaml12
-rw-r--r--catalog-fe/src/main/resources/jetty-ipaccess.xml30
-rw-r--r--catalog-fe/src/main/resources/portal.properties28
-rw-r--r--catalog-fe/src/main/resources/scripts/install.sh61
-rw-r--r--catalog-fe/src/main/resources/scripts/installJettyBase.sh14
-rw-r--r--catalog-fe/src/main/resources/scripts/jvm.properties5
-rw-r--r--catalog-fe/src/main/resources/scripts/startJetty.sh10
-rw-r--r--catalog-fe/src/main/resources/scripts/updateSslParams.sh33
-rw-r--r--catalog-fe/src/main/webapp/META-INF/MANIFEST.MF9
-rw-r--r--catalog-fe/src/main/webapp/WEB-INF/jetty-web.xml8
-rw-r--r--catalog-fe/src/main/webapp/WEB-INF/web.xml280
31 files changed, 2517 insertions, 0 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/Constants.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/Constants.java
new file mode 100644
index 0000000000..e157efcda9
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/Constants.java
@@ -0,0 +1,15 @@
+package org.openecomp.sdc.fe;
+
+public class Constants {
+
+ public static String HTTP_IV_USER = "HTTP_IV_USER";
+ public static String USER_ID = "USER_ID";
+ public static String HTTP_CSP_FIRSTNAME = "HTTP_CSP_FIRSTNAME";
+ public static String HTTP_CSP_LASTNAME = "HTTP_CSP_LASTNAME";
+ public static String HTTP_IV_REMOTE_ADDRESS = "HTTP_IV_REMOTE_ADDRESS";
+ public static String HTTP_CSP_WSTYPE = "HTTP_CSP_WSTYPE";
+ public static String HTTP_CSP_EMAIL = "HTTP_CSP_EMAIL";
+
+ public static final String WEBSEAL_USER_ID_HEADER = "csp-attuid";
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/client/BackendClient.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/client/BackendClient.java
new file mode 100644
index 0000000000..93e17144c0
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/client/BackendClient.java
@@ -0,0 +1,179 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.client;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.ws.rs.container.AsyncResponse;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.entity.InputStreamEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.api.ResponseInfo;
+import org.openecomp.sdc.common.api.ResponseInfo.ResponseStatusEnum;
+import org.openecomp.sdc.fe.impl.Audit;
+import org.openecomp.sdc.fe.impl.HttpRequestInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BackendClient {
+
+ private static Logger log = LoggerFactory.getLogger(BackendClient.class.getName());
+
+ private HostnameVerifier hostnameVerifier = null;
+
+ private CloseableHttpClient backendHttpClient;
+ private String backendHost;
+ private String backendContext;
+
+ public BackendClient(String protocol, String backendHost, String backendContext) {
+
+ this.backendContext = backendContext;
+ hostnameVerifier = new HostnameVerifier() {
+
+ public boolean verify(String hostname, SSLSession session) {
+
+ return true;
+ }
+ };
+
+ if (protocol == null || protocol.isEmpty() || protocol.equals(Constants.HTTP)) {
+ backendHttpClient = HttpClients.createDefault();
+ this.backendHost = Constants.HTTP + "://" + backendHost;
+ } else {
+ // NULL can be returned in case of error
+ backendHttpClient = getSslClient();
+ this.backendHost = Constants.HTTPS + "://" + backendHost;
+ }
+
+ }
+
+ public HostnameVerifier getHostnameVerifier() {
+ return hostnameVerifier;
+ }
+
+ private CloseableHttpClient getSslClient() {
+
+ CloseableHttpClient httpClient = null;
+ try {
+
+ // SSLContextBuilder is not thread safe
+ SSLContextBuilder builder = new SSLContextBuilder();
+ builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
+ SSLContext sslContext = builder.build();
+
+ httpClient = HttpClientBuilder.create().setSSLHostnameVerifier(hostnameVerifier).setSslcontext(sslContext)
+ .build();
+
+ } catch (Exception e) {
+ log.error("Failed to create https client", e);
+ return null;
+ }
+
+ return httpClient;
+
+ }
+
+ public ResponseInfo forwardRequestToBackend(HttpRequestInfo requestInfo, List<String> requiredHeaders,
+ AsyncResponse asyncResponse) {
+
+ ResponseInfo responseInfo = null;
+ log.debug("forwardRequestToBackend");
+ if (backendHttpClient == null) {
+ responseInfo = new ResponseInfo(ResponseStatusEnum.INTERNAL_ERROR, "Failed to create https client");
+ Audit.error(log, requestInfo, HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ asyncResponse.resume(
+ Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).entity(responseInfo.toString()).build());
+ return responseInfo;
+ }
+
+ CloseableHttpResponse response = null;
+ int status = HttpStatus.SC_INTERNAL_SERVER_ERROR;
+ HttpPost httpPost = new HttpPost(backendHost + backendContext);
+ try {
+
+ log.debug("Executing request {}", httpPost.getRequestLine());
+ httpPost.setEntity(new InputStreamEntity(requestInfo.getRequestData()));
+ boolean allHeadersAreSet = copyHeadersToRequest(requiredHeaders, requestInfo, httpPost);
+ if (!allHeadersAreSet) {
+ responseInfo = new ResponseInfo(ResponseStatusEnum.MISSING_HEADERS, "Required headers are missing");
+ asyncResponse
+ .resume(Response.status(HttpStatus.SC_BAD_REQUEST).entity(responseInfo.toString()).build());
+ Audit.error(log, requestInfo, HttpStatus.SC_BAD_REQUEST);
+ } else {
+ response = backendHttpClient.execute(httpPost);
+ status = response.getStatusLine().getStatusCode();
+ asyncResponse.resume(Response.status(status).entity(response.getEntity()).build());
+ }
+ Audit.info(log, requestInfo, status);
+
+ } catch (IOException e) {
+ log.error("connection with backend failed with exception", e);
+ responseInfo = new ResponseInfo(ResponseStatusEnum.INTERNAL_ERROR, e.getMessage());
+ Audit.error(log, requestInfo, HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ asyncResponse.resume(
+ Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).entity(responseInfo.toString()).build());
+ } finally {
+ try {
+ if (response != null) {
+ response.close();
+ }
+ backendHttpClient.close();
+ } catch (IOException e) {
+ log.error("failed to close httpClient: " + e.getMessage());
+ }
+
+ }
+
+ return responseInfo;
+
+ }
+
+ private boolean copyHeadersToRequest(List<String> requiredHeaders, HttpRequestInfo requestInfo, HttpPost httpPost) {
+ boolean allHeadersAreSet = false;
+ Map<String, String> originalHeaders = requestInfo.getHeaders();
+ for (String headerName : requiredHeaders) {
+ String headerValue = originalHeaders.get(headerName);
+ if (headerValue != null) {
+ httpPost.setHeader(headerName, headerValue);
+ } else {
+ log.error("missing required header " + headerName);
+ return allHeadersAreSet;
+ }
+ }
+ allHeadersAreSet = true;
+ return allHeadersAreSet;
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/Audit.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/Audit.java
new file mode 100644
index 0000000000..449d8a932d
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/Audit.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.impl;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.sdc.common.api.Constants;
+import org.slf4j.Logger;
+
+public class Audit {
+
+ private Audit() {
+ }
+
+ public static void error(Logger log, HttpRequestInfo requestInfo, int status) {
+ String errorMsg = "Internal Error";
+ if (requestInfo != null && requestInfo.getHeaders() != null) {
+ Map<String, String> requestHeaders = requestInfo.getHeaders();
+ errorMsg = String.format(Constants.ERROR_LOG_FORMAT, requestHeaders.get(Constants.USER_ID_HEADER),
+ requestHeaders.get(Constants.FIRST_NAME_HEADER) + " "
+ + requestHeaders.get(Constants.LAST_NAME_HEADER),
+ requestHeaders.get(Constants.ORIGIN_HEADER), requestHeaders.get(Constants.ACCESS_HEADER),
+ requestInfo.getRequestURL(), status);
+ }
+ log.error(errorMsg);
+ }
+
+ public static void error(Logger log, HttpServletRequest request, int status) {
+ String errorMsg = "Internal Error";
+ if (request != null) {
+
+ errorMsg = String.format(Constants.ERROR_LOG_FORMAT, request.getHeader(Constants.USER_ID_HEADER),
+ request.getHeader(Constants.FIRST_NAME_HEADER) + " "
+ + request.getHeader(Constants.LAST_NAME_HEADER),
+ request.getHeader(Constants.ORIGIN_HEADER), request.getHeader(Constants.ACCESS_HEADER),
+ request.getRequestURL(), status);
+ }
+ log.error(errorMsg);
+ }
+
+ public static void info(Logger log, HttpRequestInfo requestInfo, int status) {
+ String errorMsg = "Internal Error";
+ if (requestInfo != null && requestInfo.getHeaders() != null) {
+ Map<String, String> requestHeaders = requestInfo.getHeaders();
+ errorMsg = String.format(Constants.ERROR_LOG_FORMAT, requestHeaders.get(Constants.USER_ID_HEADER),
+ requestHeaders.get(Constants.FIRST_NAME_HEADER) + " "
+ + requestHeaders.get(Constants.LAST_NAME_HEADER),
+ requestHeaders.get(Constants.ORIGIN_HEADER), requestHeaders.get(Constants.ACCESS_HEADER),
+ requestInfo.getRequestURL(), status);
+ }
+ log.info(errorMsg);
+ }
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/CrudOperation.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/CrudOperation.java
new file mode 100644
index 0000000000..27fc02c00a
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/CrudOperation.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.impl;
+
+public enum CrudOperation {
+
+ CREATE, RETRIEVE, UPDATE, DELETE
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HttpRequestInfo.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HttpRequestInfo.java
new file mode 100644
index 0000000000..6a2a41fe1d
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HttpRequestInfo.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class HttpRequestInfo {
+
+ public HttpRequestInfo(HttpServletRequest request, Map<String, String> headersMap, String data) {
+ headers = headersMap;
+ requestURL = request.getRequestURI();
+ requestData = new ByteArrayInputStream(data.getBytes());
+ originServletContext = request.getContextPath();
+ }
+
+ private Map<String, String> headers;
+ private String requestURL;
+ private InputStream requestData;
+ private String originServletContext;
+
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
+ public String getRequestURL() {
+ return requestURL;
+ }
+
+ public void setRequestURL(String requestURL) {
+ this.requestURL = requestURL;
+ }
+
+ public InputStream getRequestData() {
+ return requestData;
+ }
+
+ public void setRequestData(InputStream requestData) {
+ this.requestData = requestData;
+ }
+
+ public String getOriginServletContext() {
+ return originServletContext;
+ }
+
+ public void setOriginServletContext(String originServletContext) {
+ this.originServletContext = originServletContext;
+ }
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/ImportMetadata.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/ImportMetadata.java
new file mode 100644
index 0000000000..0d0aa7bd4c
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/ImportMetadata.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.impl;
+
+public class ImportMetadata {
+
+ private String name;
+ private long size;
+ private String mime;
+ private String creator;
+ private String md5Checksum;
+
+ public ImportMetadata(String name, long size, String mime, String creator, String md5Checksum) {
+ super();
+ this.name = name;
+ this.size = size;
+ this.mime = mime;
+ this.creator = creator;
+ this.md5Checksum = md5Checksum;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public void setSize(long size) {
+ this.size = size;
+ }
+
+ public String getMime() {
+ return mime;
+ }
+
+ public void setMime(String mime) {
+ this.mime = mime;
+ }
+
+ public String getCreator() {
+ return creator;
+ }
+
+ public void setCreator(String creator) {
+ this.creator = creator;
+ }
+
+ public String getMd5Checksum() {
+ return md5Checksum;
+ }
+
+ public void setMd5Checksum(String md5Checksum) {
+ this.md5Checksum = md5Checksum;
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java
new file mode 100644
index 0000000000..b132c46866
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.listen;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.listener.AppContextListener;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.openecomp.sdc.fe.monitoring.FeMonitoringService;
+import org.openecomp.sdc.fe.servlets.HealthCheckService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FEAppContextListener extends AppContextListener implements ServletContextListener {
+
+ private static Logger log = LoggerFactory.getLogger(FEAppContextListener.class.getName());
+
+ public void contextInitialized(ServletContextEvent context) {
+
+ super.contextInitialized(context);
+
+ ConfigurationManager configurationManager = new ConfigurationManager(
+ ExternalConfiguration.getConfigurationSource());
+ log.debug("loading configuration from configDir:{} appName:{}", ExternalConfiguration.getConfigDir(),
+ ExternalConfiguration.getAppName());
+ context.getServletContext().setAttribute(Constants.CONFIGURATION_MANAGER_ATTR, configurationManager);
+
+ // Health Check service
+ HealthCheckService hcs = new HealthCheckService(context.getServletContext());
+ hcs.start(configurationManager.getConfiguration().getHealthCheckIntervalInSeconds(5));
+ context.getServletContext().setAttribute(Constants.HEALTH_CHECK_SERVICE_ATTR, hcs);
+
+ // Monitoring service
+ FeMonitoringService fms = new FeMonitoringService(context.getServletContext());
+ fms.start(configurationManager.getConfiguration().getSystemMonitoring().getProbeIntervalInSeconds(15));
+
+ if (configurationManager.getConfiguration() == null) {
+ log.debug("ERROR: configuration was not properly loaded");
+ return;
+ }
+
+ ExecutorService executorPool = Executors
+ .newFixedThreadPool(configurationManager.getConfiguration().getThreadpoolSize());
+ context.getServletContext().setAttribute(Constants.THREAD_EXECUTOR_ATTR, executorPool);
+
+ log.debug("After executing {}", this.getClass());
+ }
+
+ public void contextDestroyed(ServletContextEvent context) {
+
+ ExecutorService executorPool = (ExecutorService) context.getServletContext()
+ .getAttribute(Constants.THREAD_EXECUTOR_ATTR);
+ if (executorPool != null) {
+ executorPool.shutdown();
+ }
+
+ super.contextDestroyed(context);
+
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/MyObjectMapperProvider.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/MyObjectMapperProvider.java
new file mode 100644
index 0000000000..f891ba4e3f
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/MyObjectMapperProvider.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.listen;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+@Provider
+public class MyObjectMapperProvider implements ContextResolver<ObjectMapper> {
+ final ObjectMapper defaultObjectMapper;
+
+ public MyObjectMapperProvider() {
+ defaultObjectMapper = createDefaultMapper();
+ }
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+ return defaultObjectMapper;
+ }
+
+ private static ObjectMapper createDefaultMapper() {
+ final ObjectMapper result = new ObjectMapper();
+ result.configure(SerializationFeature.INDENT_OUTPUT, true);
+
+ return result;
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigMgrServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigMgrServlet.java
new file mode 100644
index 0000000000..7792225742
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigMgrServlet.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.rest.api.RestConfigurationInfo;
+import org.openecomp.sdc.common.servlets.BasicServlet;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Root resource (exposed at "/" path)
+ */
+@Path("/configmgr")
+public class ConfigMgrServlet extends BasicServlet {
+
+ private static Logger log = LoggerFactory.getLogger(ConfigMgrServlet.class.getName());
+
+ @GET
+ @Path("/get")
+ @Produces(MediaType.APPLICATION_JSON)
+ public String getConfig(@Context final HttpServletRequest request, @QueryParam("type") String type) {
+
+ String result = null;
+
+ ServletContext context = request.getSession().getServletContext();
+
+ ConfigurationManager configurationManager = (ConfigurationManager) context
+ .getAttribute(Constants.CONFIGURATION_MANAGER_ATTR);
+
+ if (type == null || type.equals("configuration")) {
+
+ Configuration configuration = configurationManager.getConfiguration();
+ if (configuration == null) {
+ log.warn("Configuration of type " + Configuration.class + " was not found");
+ } else {
+ log.info("The value returned from getConfig is " + configuration);
+
+ result = gson.toJson(configuration);
+
+ }
+ } else if (type.equals("rest")) {
+
+ RestConfigurationInfo configuration = configurationManager.getRestClientConfiguration();
+ if (configuration == null) {
+ log.warn("Configuration of type " + RestConfigurationInfo.class + " was not found");
+ } else {
+ log.info("The value returned from getConfig is " + configuration);
+
+ result = gson.toJson(configuration);
+
+ }
+
+ }
+ return result;
+
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
new file mode 100644
index 0000000000..92bb9e8743
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.AsyncResponse;
+import javax.ws.rs.container.Suspended;
+import javax.ws.rs.container.TimeoutHandler;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.sdc.common.api.ConfigurationSource;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.servlets.BasicServlet;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Root resource (exposed at "/" path)
+ */
+@Path("/config")
+public class ConfigServlet extends BasicServlet {
+
+ private static Logger log = LoggerFactory.getLogger(ConfigServlet.class.getName());
+
+ @GET
+ @Path("/get")
+ @Produces(MediaType.APPLICATION_JSON)
+ public String getConfig(@Context final HttpServletRequest request) {
+
+ String result = null;
+
+ ServletContext context = request.getSession().getServletContext();
+
+ ConfigurationSource configurationSource = (ConfigurationSource) context
+ .getAttribute(Constants.CONFIGURATION_SOURCE_ATTR);
+ if (configurationSource != null) {
+ Configuration configuration = configurationSource.getAndWatchConfiguration(Configuration.class, null);
+
+ if (configuration == null) {
+ log.warn("Configuration of type " + Configuration.class + " was not found");
+ }
+ log.debug("{}", configuration);
+ if (log.isInfoEnabled()) {
+ log.info("Info level ENABLED...");
+ }
+ log.info("The value returned from getConfig is " + configuration);
+
+ result = gson.toJson(configuration);
+
+ } else {
+ log.warn("Source Configuration object was not initialized in the context.");
+ }
+
+ return result;
+
+ }
+
+ @GET
+ @Path("/asyncget")
+ public void asyncGet(@Suspended final AsyncResponse asyncResponse) {
+
+ asyncResponse.setTimeoutHandler(new TimeoutHandler() {
+
+ @Override
+ public void handleTimeout(AsyncResponse asyncResponse) {
+ asyncResponse.resume(
+ Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("Operation time out.").build());
+ }
+ });
+ asyncResponse.setTimeout(3, TimeUnit.SECONDS);
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ String result = veryExpensiveOperation();
+ asyncResponse.resume(result);
+ }
+
+ private String veryExpensiveOperation() {
+
+ return "veryExpensiveOperation SUCCESS";
+
+ }
+ }).start();
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServlet.java
new file mode 100644
index 0000000000..da5b321339
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeHealthCheckServlet.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.servlets.BasicServlet;
+
+import com.jcabi.aspects.Loggable;
+
+@Loggable(prepend = true, value = Loggable.TRACE, trim = false)
+@Path("/healthCheck")
+public class FeHealthCheckServlet extends BasicServlet {
+
+ // private static Logger log =
+ // LoggerFactory.getLogger(FeHealthCheckServlet.class.getName());
+
+ @GET
+ public Response getFEandBeHealthCheck(@Context final HttpServletRequest request) {
+ ServletContext context = request.getSession().getServletContext();
+ HealthCheckService hcs = ((HealthCheckService) context.getAttribute(Constants.HEALTH_CHECK_SERVICE_ATTR));
+ return hcs.getFeHealth();
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java
new file mode 100644
index 0000000000..1cd28deb7a
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java
@@ -0,0 +1,214 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import java.net.URI;
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.client.api.Response;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.config.EcompErrorName;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.openecomp.sdc.fe.config.FeEcompErrorManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+public class FeProxyServlet extends SSLProxyServlet {
+ private static final long serialVersionUID = 1L;
+ private static final String URL = "%s://%s:%s%s";
+ private static Logger log = LoggerFactory.getLogger(FeProxyServlet.class.getName());
+ private static Cache<String, MdcData> mdcDataCache = CacheBuilder.newBuilder().expireAfterWrite(10, TimeUnit.SECONDS).build();
+
+ @Override
+ public URI rewriteURI(HttpServletRequest request) {
+ try {
+ logFeRequest(request);
+ } catch (Exception e) {
+ FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FeHttpLoggingError, "FE Request");
+ FeEcompErrorManager.getInstance().logFeHttpLoggingError("FE Request");
+ log.error("Unexpected FE request logging error :", e);
+ }
+ String originalUrl = request.getRequestURL().toString();
+ String redirectedUrl = getModifiedUrl(request);
+
+ log.debug("FeProxyServlet Redirecting request from: {} , to: {}", originalUrl, redirectedUrl);
+
+ return URI.create(redirectedUrl);
+ }
+
+ @Override
+ protected void onResponseSuccess(HttpServletRequest request, HttpServletResponse response, Response proxyResponse) {
+ try {
+ logFeResponse(request, proxyResponse);
+ } catch (Exception e) {
+ FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FeHttpLoggingError, "FE Response");
+ FeEcompErrorManager.getInstance().logFeHttpLoggingError("FE Response");
+ log.error("Unexpected FE response logging error :", e);
+ }
+ super.onResponseSuccess(request, response, proxyResponse);
+ }
+
+ private void logFeRequest(HttpServletRequest httpRequest) {
+
+ MDC.clear();
+
+ Long transactionStartTime = System.currentTimeMillis();
+ // UUID - In FE, we are supposed to get the below header from UI.
+ // We do not generate it if it's missing - BE does.
+ String uuid = httpRequest.getHeader(Constants.X_ECOMP_REQUEST_ID_HEADER);
+ String serviceInstanceID = httpRequest.getHeader(Constants.X_ECOMP_SERVICE_ID_HEADER);
+
+ if (uuid != null && uuid.length() > 0) {
+ // User Id for logging
+ String userId = httpRequest.getHeader(Constants.USER_ID_HEADER);
+
+ String remoteAddr = httpRequest.getRemoteAddr();
+ String localAddr = httpRequest.getLocalAddr();
+
+ mdcDataCache.put(uuid, new MdcData(serviceInstanceID, userId, remoteAddr, localAddr, transactionStartTime));
+
+ updateMdc(uuid, serviceInstanceID, userId, remoteAddr, localAddr, null);
+ }
+ inHttpRequest(httpRequest);
+ }
+
+ private void logFeResponse(HttpServletRequest request, Response proxyResponse) {
+ String uuid = request.getHeader(Constants.X_ECOMP_REQUEST_ID_HEADER);
+ String transactionRoundTime = null;
+
+ if (uuid != null) {
+ MdcData mdcData = mdcDataCache.getIfPresent(uuid);
+ if (mdcData != null) {
+ Long transactionStartTime = mdcData.getTransactionStartTime();
+ if (transactionStartTime != null) {// should'n ever be null, but
+ // just to be defensive
+ transactionRoundTime = Long.toString(System.currentTimeMillis() - transactionStartTime);
+ }
+ updateMdc(uuid, mdcData.getServiceInstanceID(), mdcData.getUserId(), mdcData.getRemoteAddr(), mdcData.getLocalAddr(), transactionRoundTime);
+ }
+ }
+ outHttpResponse(proxyResponse);
+
+ MDC.clear();
+ }
+
+ // Extracted for purpose of clear method name, for logback %M parameter
+ private void inHttpRequest(HttpServletRequest httpRequest) {
+ log.info("{} {} {}", httpRequest.getMethod(), httpRequest.getRequestURI(), httpRequest.getProtocol());
+ }
+
+ // Extracted for purpose of clear method name, for logback %M parameter
+ private void outHttpResponse(Response proxyResponse) {
+ log.info("SC=\"{}\"", proxyResponse.getStatus());
+ }
+
+ private void updateMdc(String uuid, String serviceInstanceID, String userId, String remoteAddr, String localAddr, String transactionStartTime) {
+ MDC.put("uuid", uuid);
+ MDC.put("serviceInstanceID", serviceInstanceID);
+ MDC.put("userId", userId);
+ MDC.put("remoteAddr", remoteAddr);
+ MDC.put("localAddr", localAddr);
+ MDC.put("timer", transactionStartTime);
+ }
+
+ private class MdcData {
+ private String serviceInstanceID;
+ private String userId;
+ private String remoteAddr;
+ private String localAddr;
+ private Long transactionStartTime;
+
+ public MdcData(String serviceInstanceID, String userId, String remoteAddr, String localAddr, Long transactionStartTime) {
+ super();
+ this.serviceInstanceID = serviceInstanceID;
+ this.userId = userId;
+ this.remoteAddr = remoteAddr;
+ this.localAddr = localAddr;
+ this.transactionStartTime = transactionStartTime;
+ }
+
+ public Long getTransactionStartTime() {
+ return transactionStartTime;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public String getRemoteAddr() {
+ return remoteAddr;
+ }
+
+ public String getLocalAddr() {
+ return localAddr;
+ }
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+ }
+
+ public String getModifiedUrl(HttpServletRequest request) {
+
+ Configuration config = getConfiguration(request);
+ if (config == null) {
+ log.error("failed to retrive configuration.");
+ }
+ String scheme = config.getBeProtocol();
+ String uri = request.getRequestURI().toString();
+ StringBuilder url = new StringBuilder();
+ url.append(scheme).append("://").append(config.getBeHost());
+ url.append(":");
+ if (config.getBeProtocol().equals(BE_PROTOCOL.HTTP.getProtocolName())) {
+ url.append(config.getBeHttpPort());
+ } else {
+ url.append(config.getBeSslPort());
+ }
+ url.append(uri);
+ String queryString = request.getQueryString(); // d=789
+ if (queryString != null) {
+ url.append("?").append(queryString);
+ }
+
+ String redirectedUrl = url.toString();
+ String onboardingForwardContext = config.getOnboardingForwardContext();
+ if (onboardingForwardContext == null || onboardingForwardContext.isEmpty()) {
+ onboardingForwardContext = "/onboarding-api";
+ }
+ redirectedUrl = redirectedUrl.replace("/sdc1/feProxy/onboarding-api", onboardingForwardContext);
+ redirectedUrl = redirectedUrl.replace("/sdc1/feProxy", "/sdc2");
+ return redirectedUrl;
+
+ }
+
+ private Configuration getConfiguration(HttpServletRequest request) {
+ Configuration config = ((ConfigurationManager) request.getSession().getServletContext().getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration();
+ return config;
+ }
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java
new file mode 100644
index 0000000000..338e8d4c01
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/HealthCheckService.java
@@ -0,0 +1,219 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.core.Response;
+
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.api.HealthCheckInfo;
+import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent;
+import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus;
+import org.openecomp.sdc.common.api.HealthCheckWrapper;
+import org.openecomp.sdc.common.config.EcompErrorName;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.openecomp.sdc.fe.config.FeEcompErrorManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
+
+public class HealthCheckService {
+
+ private class HealthStatus {
+ public String body;
+ public int statusCode;
+
+ public HealthStatus(int code, String body) {
+ this.body = body;
+ this.statusCode = code;
+ }
+ }
+
+ private static final String URL = "%s://%s:%s/sdc2/rest/healthCheck";
+ private static Logger healthLogger = LoggerFactory.getLogger("asdc.fe.healthcheck");
+ private static Logger log = LoggerFactory.getLogger(HealthCheckService.class.getName());
+
+ private HealthStatus lastHealthStatus = new HealthStatus(500, "{}");
+
+ private class HealthCheckScheduledTask implements Runnable {
+ @Override
+ public void run() {
+ healthLogger.trace("Executing FE Health Check Task - Start");
+ HealthStatus currentHealth = checkHealth();
+ int currentHealthStatus = currentHealth.statusCode;
+ healthLogger.trace("Executing FE Health Check Task - Status = {}", currentHealthStatus);
+
+ // In case health status was changed, issue alarm/recovery
+ if (currentHealthStatus != lastHealthStatus.statusCode) {
+ log.trace("FE Health State Changed to {}. Issuing alarm / recovery alarm...", currentHealthStatus);
+ logFeAlarm(currentHealthStatus);
+ }
+
+ // Anyway, update latest response
+ lastHealthStatus = currentHealth;
+ }
+ }
+
+ /**
+ * This executor will execute the health check task.
+ */
+ ScheduledExecutorService healthCheckExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "FE-Health-Check-Thread");
+ }
+ });
+ private ServletContext context;
+
+ public HealthCheckService(ServletContext context) {
+ this.context = context;
+ }
+
+ public void start(int interval) {
+ this.healthCheckExecutor.scheduleAtFixedRate(new HealthCheckScheduledTask(), 0, interval, TimeUnit.SECONDS);
+ }
+
+ /**
+ * To be used by the HealthCheckServlet
+ *
+ * @return
+ */
+ public Response getFeHealth() {
+ return this.buildResponse(lastHealthStatus.statusCode, lastHealthStatus.body);
+ }
+
+ private HealthStatus checkHealth() {
+ CloseableHttpClient httpClient = null;
+ try {
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
+ .getConfiguration();
+ String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeHost(),
+ config.getBeHttpPort());
+ httpClient = getHttpClient(config);
+ HttpGet httpGet = new HttpGet(redirectedUrl);
+ CloseableHttpResponse beResponse;
+ int beStatus;
+ String feAggHealthCheck;
+ try {
+ beResponse = httpClient.execute(httpGet);
+ beStatus = beResponse.getStatusLine().getStatusCode();
+ String beJsonResponse = EntityUtils.toString(beResponse.getEntity());
+ feAggHealthCheck = getFeHealthCheckInfos(gson, beJsonResponse);
+ } catch (Exception e) {
+ log.error("Health Check error when trying to connect to BE", e);
+ String beDowneResponse = gson.toJson(getBeDownCheckInfos());
+ return new HealthStatus(500, beDowneResponse);
+ }
+ return new HealthStatus(beStatus, feAggHealthCheck);
+ } catch (Exception e) {
+ FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FeHealthCheckGeneralError, "Unexpected FE Health check error");
+ FeEcompErrorManager.getInstance().logFeHealthCheckGeneralError("Unexpected FE Health check error");
+ log.error("Unexpected FE health check error {}", e.getMessage());
+ return new HealthStatus(500, e.getMessage());
+ } finally {
+ if (httpClient != null) {
+ try {
+ httpClient.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ private Response buildResponse(int status, String jsonResponse) {
+ healthLogger.trace("FE and BE health check status: {}", jsonResponse);
+ return Response.status(status).entity(jsonResponse).build();
+ }
+
+ private void logFeAlarm(int lastFeStatus) {
+
+ switch (lastFeStatus) {
+ case 200:
+ FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FeHealthCheckRecovery,
+ "FE Health Recovered");
+ FeEcompErrorManager.getInstance().logFeHealthCheckRecovery("FE Health Recovered");
+ break;
+ case 500:
+ FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FeHealthCheckConnectionError,
+ "Connection with ASDC-BE is probably down");
+ FeEcompErrorManager.getInstance().logFeHealthCheckError("Connection with ASDC-BE is probably down");
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ private String getFeHealthCheckInfos(Gson gson, String responseString) {
+ Type wrapperType = new TypeToken<HealthCheckWrapper>() {
+ }.getType();
+ HealthCheckWrapper healthCheckWrapper = gson.fromJson(responseString, wrapperType);
+ String appVersion = ExternalConfiguration.getAppVersion();
+ String description = "OK";
+ healthCheckWrapper.getComponentsInfo()
+ .add(new HealthCheckInfo(HealthCheckComponent.FE, HealthCheckStatus.UP, appVersion, description));
+ return gson.toJson(healthCheckWrapper);
+ }
+
+ private HealthCheckWrapper getBeDownCheckInfos() {
+ List<HealthCheckInfo> healthCheckInfos = new ArrayList<HealthCheckInfo>();
+ healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.FE, HealthCheckStatus.UP,
+ ExternalConfiguration.getAppVersion(), "OK"));
+ healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, null));
+ healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.ES, HealthCheckStatus.UNKNOWN, null, null));
+ healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.UNKNOWN, null, null));
+ healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.UNKNOWN, null, null));
+ HealthCheckWrapper hcWrapper = new HealthCheckWrapper(healthCheckInfos, "UNKNOWN", "UNKNOWN");
+ return hcWrapper;
+ }
+
+ private CloseableHttpClient getHttpClient(Configuration config) {
+ int timeout = 3000;
+ int socketTimeout = config.getHealthCheckSocketTimeoutInMs(5000);
+ RequestConfig.Builder requestBuilder = RequestConfig.custom();
+ requestBuilder.setConnectTimeout(timeout).setConnectionRequestTimeout(timeout).setSocketTimeout(socketTimeout);
+
+ HttpClientBuilder builder = HttpClientBuilder.create();
+ builder.setDefaultRequestConfig(requestBuilder.build());
+ return builder.build();
+ }
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/KibanaServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/KibanaServlet.java
new file mode 100644
index 0000000000..64784b3265
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/KibanaServlet.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import java.net.URI;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.client.api.Request;
+import org.eclipse.jetty.client.api.Response;
+import org.eclipse.jetty.proxy.ProxyServlet;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KibanaServlet extends ProxyServlet {
+ private static final long serialVersionUID = 1L;
+ private static Logger log = LoggerFactory.getLogger(KibanaServlet.class.getName());
+
+ @Override
+ public URI rewriteURI(HttpServletRequest request) {
+
+ String originalUrl = request.getRequestURI();
+
+ String redirectedUrl = getModifiedUrl(request);
+
+ log.debug("KibanaServlet Redirecting request from: {} , to: {}", originalUrl, redirectedUrl);
+
+ return URI.create(redirectedUrl);
+ }
+
+ @Override
+ public void customizeProxyRequest(Request proxyRequest, HttpServletRequest request) {
+ super.customizeProxyRequest(proxyRequest, request);
+
+ }
+
+ @Override
+ protected void onResponseSuccess(HttpServletRequest request, HttpServletResponse response, Response proxyResponse) {
+
+ super.onResponseSuccess(request, response, proxyResponse);
+ }
+
+ public String getModifiedUrl(HttpServletRequest request) {
+ Configuration config = getConfiguration(request);
+ if (config == null) {
+ log.error("failed to retrive configuration.");
+ }
+ // String scheme = request.getScheme();
+ String contextPath = request.getContextPath(); // /mywebapp
+ String servletPath = request.getServletPath(); // /servlet/MyServlet
+ String pathInfo = request.getPathInfo(); // /a/b;c=123
+ String queryString = request.getQueryString(); // d=789
+
+ StringBuilder url = new StringBuilder();
+ url.append(config.getKibanaProtocol()).append("://").append(config.getKibanaHost());
+ url.append(":").append(config.getKibanaPort());
+ url.append(contextPath).append(servletPath);
+
+ if (pathInfo != null) {
+ url.append(pathInfo);
+ }
+ if (queryString != null) {
+ url.append("?").append(queryString);
+ }
+
+ String redirectedUrl = url.toString().replace("/sdc1/kibanaProxy/", "/");
+ return redirectedUrl;
+
+ }
+
+ private Configuration getConfiguration(HttpServletRequest request) {
+ Configuration config = ((ConfigurationManager) request.getSession().getServletContext()
+ .getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration();
+ return config;
+ }
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java
new file mode 100644
index 0000000000..4eba2e5eb5
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/PortalServlet.java
@@ -0,0 +1,279 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+
+import org.openecomp.portalsdk.core.onboarding.crossapi.ECOMPSSO;
+import org.openecomp.sdc.common.config.EcompErrorName;
+import org.openecomp.sdc.common.impl.MutableHttpServletRequest;
+import org.openecomp.sdc.fe.Constants;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.openecomp.sdc.fe.config.FeEcompErrorManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Root resource (exposed at "/" path)
+ */
+@Path("/")
+public class PortalServlet extends HttpServlet {
+
+ private static Logger log = LoggerFactory.getLogger(PortalServlet.class.getName());
+ private static final long serialVersionUID = 1L;
+ public static final String MISSING_HEADERS_MSG = "Missing Headers In Request";
+ public static final String AUTHORIZATION_ERROR_MSG = "Autherization error";
+ public static final String NEW_LINE = System.getProperty("line.separator");
+
+ /**
+ * Entry point from ECOMP portal
+ */
+ @GET
+ @Path("/portal")
+ public void doGet(@Context final HttpServletRequest request, @Context final HttpServletResponse response) {
+ try {
+ addRequestHeadersUsingWebseal(request, response);
+ } catch (Exception e) {
+ FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FePortalServletError, "Portal Servlet");
+ FeEcompErrorManager.getInstance().logFePortalServletError("Portal Servlet");
+ log.error("Error during getting portal page", e);
+ }
+ }
+
+ /**
+ * Building new HTTP request and setting headers for the request The request
+ * will dispatch to index.html
+ *
+ * @param request
+ * @param response
+ * @throws ServletException
+ * @throws IOException
+ */
+ private void addRequestHeadersUsingWebseal(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
+
+ response.setContentType("text/html");
+
+ // Create new request object to dispatch
+ MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(request);
+
+ // Get configuration object (reads data from configuration.yaml)
+ Configuration configuration = getConfiguration(request);
+
+ // Check if we got header from webseal
+ String userId = request.getHeader(Constants.WEBSEAL_USER_ID_HEADER);
+ if (null == userId) {
+ // Authentication via ecomp portal
+ try {
+ String valdiateECOMPSSO = ECOMPSSO.valdiateECOMPSSO(request);
+ String userIdFromCookie = ECOMPSSO.getUserIdFromCookie(request);
+ if (valdiateECOMPSSO == null || ("").equals(userIdFromCookie)) {
+ // This is probably a webseal request, so missing header in request should be printed.
+ response.sendError(HttpServletResponse.SC_USE_PROXY, MISSING_HEADERS_MSG);
+ }
+ userId = userIdFromCookie;
+ } catch (Exception e) {
+ response.sendError(HttpServletResponse.SC_USE_PROXY, AUTHORIZATION_ERROR_MSG);
+ }
+ }
+
+ // Replace webseal header with open source header
+ mutableRequest.putHeader(Constants.USER_ID, userId);
+
+ // Getting identification headers from configuration.yaml
+ // (identificationHeaderFields) and setting them to new request
+ // mutableRequest
+ List<List<String>> identificationHeaderFields = configuration.getIdentificationHeaderFields();
+ for (List<String> possibleHeadersToRecieve : identificationHeaderFields) {
+ String allowedHeaderToPass = possibleHeadersToRecieve.get(0);
+ setNewHeader(possibleHeadersToRecieve, allowedHeaderToPass, request, mutableRequest);
+ }
+
+ // Getting optional headers from configuration.yaml
+ // (optionalHeaderFields) and setting them to new request mutableRequest
+ List<List<String>> optionalHeaderFields = configuration.getOptionalHeaderFields();
+ for (List<String> possibleHeadersToRecieve : optionalHeaderFields) {
+ String allowedHeaderToPass = possibleHeadersToRecieve.get(0);
+ setNewHeader(possibleHeadersToRecieve, allowedHeaderToPass, request, mutableRequest);
+ }
+
+ // Print headers from original request for debug purposes
+ printHeaders(request);
+
+ // In case using webseal, validate all mandatory headers (identificationHeaderFields) are included in the new request (mutableRequest).
+ // Via ecomp portal do not need to check the headers.
+ boolean allHeadersExist = true;
+ if (null != request.getHeader(Constants.WEBSEAL_USER_ID_HEADER)) {
+ allHeadersExist = checkHeaders(mutableRequest);
+ }
+
+ if (allHeadersExist) {
+ addCookies(response, mutableRequest, getMandatoryHeaders(request));
+ addCookies(response, mutableRequest, getOptionalHeaders(request));
+ RequestDispatcher rd = request.getRequestDispatcher("index.html");
+ rd.forward(mutableRequest, response);
+ } else {
+ response.sendError(HttpServletResponse.SC_USE_PROXY, MISSING_HEADERS_MSG);
+ }
+ }
+
+ /**
+ * Print all request headers to the log
+ *
+ * @param request
+ */
+ private void printHeaders(HttpServletRequest request) {
+
+ if (log.isDebugEnabled()) {
+ StringBuilder builder = new StringBuilder();
+ String sessionId = "";
+ if (request.getSession() != null) {
+ String id = request.getSession().getId();
+ if (id != null) {
+ sessionId = id;
+ }
+ }
+
+ builder.append("Receiving request with headers:" + NEW_LINE);
+ log.debug("{}", request.getHeaderNames());
+ @SuppressWarnings("unchecked")
+ Enumeration<String> headerNames = request.getHeaderNames();
+ if (headerNames != null) {
+ while (headerNames.hasMoreElements()) {
+ String headerName = headerNames.nextElement();
+ String headerValue = request.getHeader(headerName);
+ builder.append("session " + sessionId + " header: name = " + headerName + ", value = " + headerValue + NEW_LINE);
+ }
+ }
+
+ log.debug(builder.toString());
+ }
+
+ }
+
+ /**
+ * Add cookies (that where set in the new request headers) in the response
+ *
+ * @param response
+ * @param request
+ * @param headers
+ */
+ private void addCookies(HttpServletResponse response, HttpServletRequest request, String[] headers) {
+ for (int i = 0; i < headers.length; i++) {
+ String currHeader = headers[i];
+ String headerValue = request.getHeader(currHeader);
+ if (headerValue != null) {
+ response.addCookie(new Cookie(currHeader, headerValue));
+ }
+ }
+ }
+
+ /**
+ * Get mandatory headers (identificationHeaderFields) String array, and
+ * checks that each header exists in the new request
+ *
+ * @param request
+ * @return boolean
+ */
+ private boolean checkHeaders(HttpServletRequest request) {
+ String[] mandatoryHeaders = getMandatoryHeaders(request);
+
+ boolean allHeadersExist = true;
+ for (int i = 0; i < mandatoryHeaders.length; i++) {
+ String headerValue = request.getHeader(mandatoryHeaders[i]);
+ if (headerValue == null) {
+ allHeadersExist = false;
+ break;
+ }
+ }
+ return allHeadersExist;
+ }
+
+ /**
+ * Get mandatory headers (identificationHeaderFields) from
+ * configuration.yaml file and return String[]
+ *
+ * @param request
+ * @return String[]
+ */
+ private String[] getMandatoryHeaders(HttpServletRequest request) {
+ Configuration configuration = getConfiguration(request);
+ List<List<String>> identificationHeaderFields = configuration.getIdentificationHeaderFields();
+ String[] mandatoryHeaders = new String[identificationHeaderFields.size()];
+ for (int i = 0; i < identificationHeaderFields.size(); i++) {
+ mandatoryHeaders[i] = identificationHeaderFields.get(i).get(0);
+ }
+ return mandatoryHeaders;
+ }
+
+ /**
+ * Get optional headers (optionalHeaderFields) from configuration.yaml file
+ * and return String[]
+ *
+ * @param request
+ * @return String[]
+ */
+ private String[] getOptionalHeaders(HttpServletRequest request) {
+ Configuration configuration = getConfiguration(request);
+ List<List<String>> optionalHeaderFields = configuration.getOptionalHeaderFields();
+ String[] optionalHeaders = new String[optionalHeaderFields.size()];
+ for (int i = 0; i < optionalHeaderFields.size(); i++) {
+ optionalHeaders[i] = optionalHeaderFields.get(i).get(0);
+ }
+ return optionalHeaders;
+ }
+
+ /**
+ * Return Configuration object to read from configuration.yaml
+ *
+ * @param request
+ * @return Configuration
+ */
+ private Configuration getConfiguration(HttpServletRequest request) {
+ ConfigurationManager configManager = (ConfigurationManager) request.getSession().getServletContext().getAttribute(org.openecomp.sdc.common.api.Constants.CONFIGURATION_MANAGER_ATTR);
+ return configManager.getConfiguration();
+ }
+
+ private boolean setNewHeader(List<String> possibleOldHeaders, String newHeaderToSet, HttpServletRequest oldRequest, MutableHttpServletRequest newRequest) {
+ boolean newHeaderIsSet = false;
+ for (int i = 0; i < possibleOldHeaders.size() && !newHeaderIsSet; i++) {
+ String headerValue = oldRequest.getHeader(possibleOldHeaders.get(i));
+ if (headerValue != null) {
+ newRequest.putHeader(newHeaderToSet, headerValue);
+ newHeaderIsSet = true;
+ }
+ }
+ return newHeaderIsSet;
+ }
+
+}
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/SSLProxyServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/SSLProxyServlet.java
new file mode 100644
index 0000000000..c3ba279c8c
--- /dev/null
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/SSLProxyServlet.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.sdc.fe.servlets;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.api.Request;
+import org.eclipse.jetty.http.HttpHeader;
+import org.eclipse.jetty.proxy.ProxyServlet;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.fe.config.Configuration;
+import org.openecomp.sdc.fe.config.ConfigurationManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class SSLProxyServlet extends ProxyServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static Logger log = LoggerFactory.getLogger(SSLProxyServlet.class.getName());
+
+ public enum BE_PROTOCOL {
+ HTTP("http"), SSL("ssl");
+ private String protocolName;
+
+ public String getProtocolName() {
+ return protocolName;
+ }
+
+ BE_PROTOCOL(String protocolName) {
+ this.protocolName = protocolName;
+ }
+ };
+
+ @Override
+ public void customizeProxyRequest(Request proxyRequest, HttpServletRequest request) {
+ super.customizeProxyRequest(proxyRequest, request);
+ // Add Missing Headers to proxy request
+ @SuppressWarnings("unchecked")
+ Enumeration<String> headerNames = request.getHeaderNames();
+ while (headerNames.hasMoreElements()) {
+ String headerName = headerNames.nextElement();
+ if (!proxyRequest.getHeaders().containsKey(headerName)) {
+ String headerVal = request.getHeader(headerName);
+ log.debug("Adding missing header to request, header name: {} , header value: {}", headerName,
+ headerVal);
+ proxyRequest.header(headerName, headerVal);
+ }
+ }
+ proxyRequest.getHeaders().remove(HttpHeader.HOST);
+
+ }
+
+ @Override
+ protected HttpClient createHttpClient() throws ServletException {
+ Configuration config = ((ConfigurationManager) getServletConfig().getServletContext()
+ .getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration();
+ boolean isSecureClient = !config.getBeProtocol().equals(BE_PROTOCOL.HTTP.getProtocolName());
+ HttpClient client = (isSecureClient) ? getSecureHttpClient() : super.createHttpClient();
+ setTimeout(600000);
+ client.setIdleTimeout(600000);
+ client.setStopTimeout(600000);
+
+ return client;
+ }
+
+ private HttpClient getSecureHttpClient() throws ServletException {
+ // Instantiate and configure the SslContextFactory
+ SslContextFactory sslContextFactory = new SslContextFactory(true);
+
+ // Instantiate HttpClient with the SslContextFactory
+ HttpClient httpClient = new HttpClient(sslContextFactory);
+
+ // Configure HttpClient, for example:
+ httpClient.setFollowRedirects(false);
+
+ // Start HttpClient
+ try {
+ httpClient.start();
+
+ return httpClient;
+ } catch (Exception x) {
+ throw new ServletException(x);
+ }
+ }
+}
diff --git a/catalog-fe/src/main/resources/application-context.xml b/catalog-fe/src/main/resources/application-context.xml
new file mode 100644
index 0000000000..a5ec92697a
--- /dev/null
+++ b/catalog-fe/src/main/resources/application-context.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
+
+ <context:annotation-config />
+ <aop:aspectj-autoproxy proxy-target-class="true" />
+
+ <context:component-scan
+ base-package="org.openecomp.sdnc.catalog.backend.dao,
+ org.elasticsearch.mapping,
+ org.openecomp.sdnc.catalog.backend.artifacts">
+
+ </context:component-scan>
+
+
+
+ <!-- <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> -->
+</beans>
diff --git a/catalog-fe/src/main/resources/config/configuration.yaml b/catalog-fe/src/main/resources/config/configuration.yaml
new file mode 100644
index 0000000000..6be93b330d
--- /dev/null
+++ b/catalog-fe/src/main/resources/config/configuration.yaml
@@ -0,0 +1,78 @@
+# Needed for logging purposes. To be populated by DevOps - currently dummy
+feFqdn: asdcFe.att.com
+
+# catalog backend hostname
+beHost: localhost
+
+# catalog backend http port
+beHttpPort: 8080
+
+# catalog backend http context
+beContext: /sdc2/rest/v1/catalog/upload/resources
+
+# catalog backend protocol
+beProtocol: http
+
+# catalog backend ssl port
+beSslPort: 8443
+
+# threadpool size for handling requests
+threadpoolSize: 50
+
+# request processing timeout (seconds)
+requestTimeout: 10
+
+healthCheckSocketTimeoutInMs: 5000
+
+healthCheckIntervalInSeconds: 5
+
+identificationHeaderFields:
+ -
+ - &HTTP_IV_USER HTTP_IV_USER
+ - &iv-user iv-user
+ -
+ - &USER_ID USER_ID
+ - &user-id user-id
+ -
+ - &HTTP_CSP_ATTUID HTTP_CSP_ATTUID
+ - &csp-attuid csp-attuid
+ -
+ - &HTTP_CSP_WSTYPE HTTP_CSP_WSTYPE
+ - &csp-wstype csp-wstype
+
+optionalHeaderFields:
+ -
+ - &HTTP_CSP_FIRSTNAME HTTP_CSP_FIRSTNAME
+ - &csp-firstname csp-firstname
+ -
+ - &HTTP_CSP_LASTNAME HTTP_CSP_LASTNAME
+ - &csp-lastname csp-lastname
+ -
+ - &HTTP_IV_REMOTE_ADDRESS HTTP_IV_REMOTE_ADDRESS
+ - &iv-remote-address iv-remote-address
+ -
+ - &HTTP_CSP_EMAIL HTTP_CSP_EMAIL
+ - &csp-email csp-email
+
+version: 1.0
+released: 2012-11-30
+
+# Connection parameters
+connection:
+ url: jdbc:mysql://localhost:3306/db
+ poolSize: 17
+
+# Protocols
+protocols:
+ - http
+ - https
+
+
+systemMonitoring:
+ enabled: false
+ isProxy: true
+ probeIntervalInSeconds: 15
+
+kibanaHost: localhost
+kibanaPort: 5601
+kibanaProtocol: http
diff --git a/catalog-fe/src/main/resources/config/ecomp-error-configuration.yaml b/catalog-fe/src/main/resources/config/ecomp-error-configuration.yaml
new file mode 100644
index 0000000000..8982b2424f
--- /dev/null
+++ b/catalog-fe/src/main/resources/config/ecomp-error-configuration.yaml
@@ -0,0 +1,48 @@
+###########################################
+# Note the conventions of the field values:
+# type can be one of: CONFIG_ERROR, SYSTEM_ERROR, DATA_ERROR, CONNECTION_PROBLEM
+# severity can be one of: WARN, ERROR, FATAL
+# alarmSeverity can be one of: CRITICAL,MAJOR,MINOR,INFORMATIONAL,NONE
+# code is a unique integer in range of 3003-9999 (3000-3002 are occupied for internal usage)
+# The above enumeration values are out-of-the-box and can be changed in code.
+# In case of config and code mismatch, the appropriate error will be printed to log
+#
+# Range of FE codes - 8000-9999
+
+
+errors:
+ FeHealthCheckConnectionError: {
+ type: CONNECTION_PROBLEM,
+ code: ASDC_8000,
+ severity: ERROR,
+ description: "Connection error during FE Health Check",
+ alarmSeverity: CRITICAL
+ }
+ FeHttpLoggingError: {
+ type: SYSTEM_ERROR,
+ code: ASDC_8001,
+ severity: ERROR,
+ description: "Error when logging FE HTTP request/response",
+ alarmSeverity: MINOR
+ }
+ FePortalServletError: {
+ type: SYSTEM_ERROR,
+ code: ASDC_8002,
+ severity: ERROR,
+ description: "Error when trying to access FE Portal page",
+ alarmSeverity: MAJOR
+ }
+ FeHealthCheckGeneralError: {
+ type: SYSTEM_ERROR,
+ code: ASDC_8004,
+ severity: ERROR,
+ description: "General error during FE Health Check",
+ alarmSeverity: CRITICAL
+ }
+ FeHealthCheckRecovery: {
+ type: RECOVERY,
+ code: ASDC_8005,
+ severity: INFO,
+ description: "BE Health Check Recovery",
+ alarmSeverity: INFORMATIONAL
+ } \ No newline at end of file
diff --git a/catalog-fe/src/main/resources/config/logback.xml b/catalog-fe/src/main/resources/config/logback.xml
new file mode 100644
index 0000000000..fd2e13ca43
--- /dev/null
+++ b/catalog-fe/src/main/resources/config/logback.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="5 seconds">
+
+ <property scope="system" name="ECOMP-component-name" value="ASDC" />
+ <property scope="system" name="ECOMP-subcomponent-name" value="ASDC-FE" />
+ <property scope="context" name="enable-all-log" value="false" />
+ <property file="${config.home}/catalog-fe/configuration.yaml" />
+ <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)-->
+ <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)-->
+ <property name="default-log-pattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${ECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${feFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=&lt;%M&gt;, Desc=&lt;%msg&gt;%n" />
+
+ <!-- All log -->
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender name="ALL_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log
+ </file>
+
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ALL_ROLLING" />
+ </appender>
+
+ </then>
+ </if>
+
+ <!-- Error log -->
+ <appender name="ERROR_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/error.log
+ </file>
+
+ <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/error.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Debug log -->
+ <appender name="DEBUG_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log
+ </file>
+
+ <!-- accept DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() &lt;= DEBUG.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>NEUTRAL</OnMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Asynchronicity Configurations -->
+ <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="DEBUG_ROLLING" />
+ </appender>
+
+ <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ERROR_ROLLING" />
+ </appender>
+
+ <root level="INFO">
+ <appender-ref ref="ASYNC_ERROR" />
+ <appender-ref ref="ASYNC_DEBUG" />
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender-ref ref="ALL_ROLLING" />
+ </then>
+ </if>
+ </root>
+
+ <logger name="org.openecomp.sdc" level="INFO" />
+</configuration> \ No newline at end of file
diff --git a/catalog-fe/src/main/resources/config/rest-configuration-info.yaml b/catalog-fe/src/main/resources/config/rest-configuration-info.yaml
new file mode 100644
index 0000000000..083adcf7c7
--- /dev/null
+++ b/catalog-fe/src/main/resources/config/rest-configuration-info.yaml
@@ -0,0 +1,12 @@
+# rest read timeout - means no timeout
+readTimeoutInSec: 0
+
+# whether to ignore certificate
+ignoreCertificate: false
+
+# the connection pool size
+connectionPoolSize: 10
+
+# create connection timeout
+connectTimeoutInSec: 10
+
diff --git a/catalog-fe/src/main/resources/jetty-ipaccess.xml b/catalog-fe/src/main/resources/jetty-ipaccess.xml
new file mode 100644
index 0000000000..97db551f02
--- /dev/null
+++ b/catalog-fe/src/main/resources/jetty-ipaccess.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
+
+<!-- =============================================================== -->
+<!-- Mixin the Statistics Handler -->
+<!-- =============================================================== -->
+
+
+<Configure id="Server" class="org.eclipse.jetty.server.Server">
+
+ <Get id="oldhandler" name="handler"/>
+
+ <Set name="handler">
+ <New id="IPAccessHandler" class="org.eclipse.jetty.server.handler.IPAccessHandler">
+ <Set name="handler"><Ref refid="oldhandler"/></Set>
+ <Set name="white">
+ <Array type="String">
+ <Item>0-255.0-255.0-255.0-255</Item>
+ </Array>
+ </Set>
+ <Set name="black">
+ <Array type="String">
+ <Item>127.0.0.1/blacklisted</Item>
+ <Item>127.0.0.2/black.html</Item>
+ </Array>
+ </Set>
+ <Set name="whiteListByPath">false</Set>
+ </New>
+ </Set>
+</Configure>
diff --git a/catalog-fe/src/main/resources/portal.properties b/catalog-fe/src/main/resources/portal.properties
new file mode 100644
index 0000000000..880c4fe9e9
--- /dev/null
+++ b/catalog-fe/src/main/resources/portal.properties
@@ -0,0 +1,28 @@
+# Portal REST URL, ends "/auxapi"
+ecomp_rest_url = https://portal.api.simpledemo.openecomp.org/ecompportal/auxapi
+
+# Java implementation of interface
+portal.api.impl.class = org.openecomp.sdc.be.ecomp.EcompIntImpl
+
+# CSP-SSO URL
+ecomp_redirect_url = http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/login.htm
+
+# Cookie set by CSP-SSO
+csp_cookie_name = attESSec
+# CSP setting, most use PROD; DEV also recognized
+csp_gate_keeper_prod_key = PROD
+
+# Comma-separated list of UEB server names
+ueb_url_list =
+# UEB topic where Portal listens
+ecomp_portal_inbox_name = ECOMP-PORTAL-INBOX-TEST
+# UEB key generated while on-boarding
+ueb_app_key = app_key_here
+# UEB secret generated while on-boarding
+ueb_app_secret = app_secret_here
+# UEB topic where App listens
+ueb_app_mailbox_name = app_topic_name_here
+# Consumer group name; most Apps should use {UUID}
+ueb_app_consumer_group_name = {UUID}
+
+decryption_key = AGLDdG4D04BKm2IxIWEr8o== \ No newline at end of file
diff --git a/catalog-fe/src/main/resources/scripts/install.sh b/catalog-fe/src/main/resources/scripts/install.sh
new file mode 100644
index 0000000000..bed9411795
--- /dev/null
+++ b/catalog-fe/src/main/resources/scripts/install.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+export JETTY_BASE=/home/jetty/base
+
+COMP=$1
+
+function usage() {
+ echo "$0 <fe | be>"
+}
+
+function exitOnError() {
+ if [ $1 -ne 0 ]
+ then
+ echo "Failed running task $2"
+ exit 2
+ fi
+}
+
+if [ $# -ne 1 ]
+then
+ usage
+ exit 1
+
+fi
+
+/opt/app/sdc/catalog-${COMP}/scripts/installJettyBase.sh
+exitOnError $? "installJettyBase"
+
+cd ${JETTY_BASE}
+exitOnError $? "move_to_base_dir"
+
+mkdir -p scripts
+
+cp /opt/app/sdc/catalog-${COMP}/scripts/* scripts
+exitOnError $? "copy_scripts_from_rpm"
+
+cp /opt/app/sdc/catalog-${COMP}/ext/jetty-ipaccess.xml etc
+exitOnError $? "override_jetty-ipaccess_module."
+
+cp /opt/app/sdc/catalog-${COMP}/catalog-${COMP}-*.war webapps
+exitOnError $? "copy_war"
+
+cp /opt/app/sdc/catalog-${COMP}/scripts/startJetty.sh .
+exitOnError $? "copy_startJetty"
+
+cp /opt/app/sdc/catalog-${COMP}/scripts/jvm.properties .
+exitOnError $? "copy_jvm_properties"
+
+./scripts/updateSslParams.sh ${JETTY_BASE}
+exitOnError $? "updateSslParams_script"
+
+#ONLY FOR BE
+#cp /opt/app/sdc/config/catalog-${COMP}/elasticsearch.yml config
+#exitOnError $? "copy_elasticsearch_yaml_to_config"
+
+mkdir -p ${JETTY_BASE}/config/catalog-${COMP}
+cp -r /opt/app/sdc/config/catalog-${COMP}/*.xml ${JETTY_BASE}/config/catalog-${COMP}
+exitOnError $? "copy_xml_files_to_config"
+
+cp -r /opt/app/sdc/config/catalog-${COMP}/*.yaml ${JETTY_BASE}/config/catalog-${COMP}
+exitOnError $? "copy_yaml_files_to_config"
diff --git a/catalog-fe/src/main/resources/scripts/installJettyBase.sh b/catalog-fe/src/main/resources/scripts/installJettyBase.sh
new file mode 100644
index 0000000000..0f8ac7e109
--- /dev/null
+++ b/catalog-fe/src/main/resources/scripts/installJettyBase.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+export JETTY_HOME=/home/jetty/jetty-distribution-9.2.7.v20150116
+export JETTY_BASE=/home/jetty/base
+
+mkdir -p ${JETTY_BASE}
+mkdir -p ${JETTY_BASE}/config
+
+cd ${JETTY_BASE}
+
+java -jar $JETTY_HOME/start.jar --add-to-start=deploy
+java -jar $JETTY_HOME/start.jar --add-to-startd=http,https,logging,ipaccess
+
+cd -
diff --git a/catalog-fe/src/main/resources/scripts/jvm.properties b/catalog-fe/src/main/resources/scripts/jvm.properties
new file mode 100644
index 0000000000..52b5134f34
--- /dev/null
+++ b/catalog-fe/src/main/resources/scripts/jvm.properties
@@ -0,0 +1,5 @@
+-XX:MaxPermSize=256m
+-Xmx1500m
+-Dconfig.home=${JETTY_BASE}/config
+-Dlog.home=${JETTY_BASE}/logs
+-Dlogback.configurationFile=${JETTY_BASE}/config/catalog-fe/logback.xml \ No newline at end of file
diff --git a/catalog-fe/src/main/resources/scripts/startJetty.sh b/catalog-fe/src/main/resources/scripts/startJetty.sh
new file mode 100644
index 0000000000..074d91d6f7
--- /dev/null
+++ b/catalog-fe/src/main/resources/scripts/startJetty.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+export JETTY_HOME=/home/jetty/jetty-distribution-9.2.7.v20150116
+export JETTY_BASE=/home/jetty/base
+
+eval "jvmargs=`sed '/^#/d' jvm.properties | paste -s -d"#"`"
+jvmargs=`echo $jvmargs | sed 's/#/ /g'`
+echo $jvmargs
+
+java -jar $JETTY_HOME/start.jar $jvmargs $@ \ No newline at end of file
diff --git a/catalog-fe/src/main/resources/scripts/updateSslParams.sh b/catalog-fe/src/main/resources/scripts/updateSslParams.sh
new file mode 100644
index 0000000000..d9e955e0f5
--- /dev/null
+++ b/catalog-fe/src/main/resources/scripts/updateSslParams.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+function usage() {
+ echo "$0 <working dir>"
+}
+
+function exitOnError() {
+ if [ $1 -ne 0 ]
+ then
+ echo "Failed running task $2"
+ exit 2
+ fi
+}
+
+if [ $# -ne 1 ]
+then
+ usage
+ if [ ${#OLDPWD} -ne 0 ]
+ then
+ cd -
+ fi
+ exit 1
+
+fi
+
+WORK_DIR=$1
+
+cd $WORK_DIR
+
+sed -i 's/\(^https.port=\)\(.*\)/\1443/g' start.d/https.ini
+exitOnError $? "update_port_in_https_ini"
+
+cd -
diff --git a/catalog-fe/src/main/webapp/META-INF/MANIFEST.MF b/catalog-fe/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c47899c09d
--- /dev/null
+++ b/catalog-fe/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Implementation-Title: catalog-fe
+Implementation-Version: APPLICATION_VERSION
+Implementation-Vendor-Id: org.openecomp.sdc
+Built-By: esofer
+Build-Jdk: 1.7.0_45
+Created-By: Apache Maven 3.2.1
+Archiver-Version: Plexus Archiver
+
diff --git a/catalog-fe/src/main/webapp/WEB-INF/jetty-web.xml b/catalog-fe/src/main/webapp/WEB-INF/jetty-web.xml
new file mode 100644
index 0000000000..adb07b0ec8
--- /dev/null
+++ b/catalog-fe/src/main/webapp/WEB-INF/jetty-web.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Configure PUBLIC
+ "-//Mort Bay Consulting//DTD Configure//EN"
+ "http://www.eclipse.org/jetty/configure_9_0.dtd">
+
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+ <Set name="contextPath">/sdc1</Set>
+</Configure>
diff --git a/catalog-fe/src/main/webapp/WEB-INF/web.xml b/catalog-fe/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..f6d709ef58
--- /dev/null
+++ b/catalog-fe/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+ <servlet>
+ <servlet-name>jersey</servlet-name>
+ <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+ <init-param>
+ <param-name>jersey.config.server.provider.packages</param-name>
+ <param-value>org.openecomp.sdc.fe.servlets</param-value>
+ </init-param>
+
+ <init-param>
+ <param-name>jersey.config.server.provider.classnames</param-name>
+ <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
+ </init-param>
+ <init-param>
+ <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>jersey</servlet-name>
+ <url-pattern>/rest/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ViewStatusMessages</servlet-name>
+ <servlet-class>ch.qos.logback.classic.ViewStatusMessagesServlet</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ViewStatusMessages</servlet-name>
+ <url-pattern>/lbClassicStatus</url-pattern>
+ </servlet-mapping>
+
+ <!-- Proxy Server Only used for tests to simulate webSeal ## Start ## -->
+<!-- <servlet>
+ <servlet-name>ProxyAdmin1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletAdmin1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyAdmin1</servlet-name>
+ <url-pattern>/proxy-admin1</url-pattern>
+ </servlet-mapping>
+ <servlet>
+ <servlet-name>ProxyAdmin2</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletAdmin2</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyAdmin2</servlet-name>
+ <url-pattern>/proxy-admin2</url-pattern>
+ </servlet-mapping>
+ <servlet>
+ <servlet-name>ProxyAdmin3</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletAdmin3</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyAdmin3</servlet-name>
+ <url-pattern>/proxy-admin3</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyDesigner1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletDesigner1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyDesigner1</servlet-name>
+ <url-pattern>/proxy-designer1</url-pattern>
+ </servlet-mapping>
+ <servlet>
+ <servlet-name>ProxyDesigner2</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletDesigner2</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyDesigner2</servlet-name>
+ <url-pattern>/proxy-designer2</url-pattern>
+ </servlet-mapping>
+ <servlet>
+ <servlet-name>ProxyDesigner3</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletDesigner3</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyDesigner3</servlet-name>
+ <url-pattern>/proxy-designer3</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyTester1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletTester1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyTester1</servlet-name>
+ <url-pattern>/proxy-tester1</url-pattern>
+ </servlet-mapping>
+ <servlet>
+ <servlet-name>ProxyTester2</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletTester2</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyTester2</servlet-name>
+ <url-pattern>/proxy-tester2</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyTester3</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletTester3</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyTester3</servlet-name>
+ <url-pattern>/proxy-tester3</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ProxyGovernor1</servlet-name>
+ <url-pattern>/proxy-governor1</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyGovernor1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletGovernor1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyOps1</servlet-name>
+ <url-pattern>/proxy-ops1</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyOps1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletOps1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ProxyPs1</servlet-name>
+ <url-pattern>/proxy-ps1</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyPs1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletProductStrategist1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ProxyPm1</servlet-name>
+ <url-pattern>/proxy-pm1</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>ProxyPm1</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.websealmock.WebSealSimulatorServletProductManger1</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet> -->
+
+ <!-- Proxy Server Only used for tests to simulate webSeal ## End ## -->
+
+ <!-- Fe Proxy Servlet -->
+ <servlet>
+ <servlet-name>FeProxy</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.FeProxyServlet</servlet-class>
+
+ <load-on-startup>1</load-on-startup>
+ <async-supported>true</async-supported>
+
+
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>FeProxy</servlet-name>
+ <url-pattern>/feProxy/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>Portal</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.PortalServlet</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Portal</servlet-name>
+ <url-pattern>/portal</url-pattern>
+ </servlet-mapping>
+
+ <!-- Kibana proxy -->
+ <servlet>
+ <servlet-name>KibanaProxy</servlet-name>
+ <servlet-class>org.openecomp.sdc.fe.servlets.KibanaServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ <async-supported>true</async-supported>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>KibanaProxy</servlet-name>
+ <url-pattern>/kibanaProxy/*</url-pattern>
+ </servlet-mapping>
+
+
+
+ <filter>
+ <filter-name>cross-origin-att</filter-name>
+ <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
+ <async-supported>true</async-supported>
+ <init-param>
+ <param-name>allowedOrigins</param-name>
+ <param-value>*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>allowedMethods</param-name>
+ <param-value>GET,POST,OPTIONS,DELETE,PUT,HEAD</param-value>
+ </init-param>
+ <init-param>
+ <param-name>allowedHeaders</param-name>
+ <param-value>HTTP_CSP_FIRSTNAME, HTTP_CSP_LASTNAME, USER_ID,
+ HTTP_CSP_EMAIL, X-ECOMP-RequestID, origin, content-type, accept, authorization, Content-MD5,X-ECOMP-ServiceID</param-value>
+ </init-param>
+ <init-param>
+ <param-name>allowCredential</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>cross-origin-att</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+<!--
+ <filter>
+ <filter-name>GzipFilter</filter-name>
+ <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
+ <async-supported>true</async-supported>
+ <init-param>
+ <param-name></param-name>
+ <param-value>text/html,text/plain,text/css,application/javascript,application/json</param-value>
+ </init-param>
+ <init-param>
+ <param-name>methods</param-name>
+ <param-value>get,post</param-value>
+ </init-param>
+ </filter>
+
+
+ <filter-mapping>
+ <filter-name>GzipFilter</filter-name>
+ <url-pattern>/sdc2/*</url-pattern>
+ </filter-mapping>
+-->
+
+ <listener>
+ <listener-class>org.openecomp.sdc.fe.listen.FEAppContextListener</listener-class>
+ </listener>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+</web-app>