aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-vfc-adapter/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-vfc-adapter/src/main')
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java9
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java2
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java6
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java5
-rw-r--r--adapters/mso-vfc-adapter/src/main/resources/application-local.yaml2
-rw-r--r--adapters/mso-vfc-adapter/src/main/resources/application.yaml21
6 files changed, 21 insertions, 24 deletions
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
index ea1c3805d1..656a246afc 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
@@ -21,22 +21,20 @@
package org.onap.so.adapters.vfc;
import java.util.Arrays;
-import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
-import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
-import org.onap.so.adapters.vfc.rest.HealthCheckHandler;
import org.onap.so.adapters.vfc.rest.VfcAdapterRest;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@@ -49,9 +47,6 @@ public class CXFConfiguration {
@Autowired
private VfcAdapterRest vfcAdapterRest;
-
- @Autowired
- private HealthCheckHandler healthCheckHandler;
@Autowired
private JaxRsFilterLogging jaxRsFilterLogging;
@@ -68,7 +63,7 @@ public class CXFConfiguration {
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
endpoint.setBus(bus);
- endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest, healthCheckHandler));
+ endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging));
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java
index 2ff66d2c25..8db210f62a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/RequestDBConfig.java
@@ -25,7 +25,7 @@ import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java
index 2dbc444bc3..86aba2f84b 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManager.java
@@ -351,7 +351,8 @@ public class VfcManager {
ValidateUtil.assertObjectNotNull(jobId);
// Step 1: query the current resource operation status
ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
- status = resourceOperationStatusRepository.findOne(Example.of(status));
+ status = resourceOperationStatusRepository.findOne(Example.of(status))
+ .orElseThrow( () -> new ApplicationException(404,"Cannot Find Operation Status"));
// Step 2: start query
LOGGER.info("query ns status -> begin");
String url = getUrl(jobId, CommonConstant.Step.QUERY);
@@ -438,7 +439,8 @@ public class VfcManager {
RestfulResponse scaleRsp = restfulUtil.send(url, methodType, scaleReq);
ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID());
- ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status));
+ ResourceOperationStatus nsOperInfo = resourceOperationStatusRepository.findOne(Example.of(status))
+ .orElseThrow( () -> new ApplicationException(404,"Cannot Find Operation Status"));
ValidateUtil.assertObjectNotNull(scaleRsp);
if(!HttpCode.isSucess(scaleRsp.getStatus())) {
LOGGER.error("update segment operation status : fail to scale ns");
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index f6bf8b9fbf..bb7fa70bda 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -43,7 +43,6 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.vfc.model.RestfulResponse;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
@@ -66,8 +65,6 @@ public class RestfulUtil {
*/
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, RestfulUtil.class);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
-
private static final int DEFAULT_TIME_OUT = 60000;
private static final String ONAP_IP = "ONAP_IP";
@@ -204,12 +201,10 @@ public class RestfulUtil {
private static void logError(String errMsg, Throwable t) {
LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
}
private static void logError(String errMsg) {
LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
}
private static RestfulResponse createResponse(int statusCode, String content) {
diff --git a/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml b/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml
index 0519f50c46..414dabb0a1 100644
--- a/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml
+++ b/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml
@@ -8,7 +8,7 @@ mso:
site-name: localSite
spring:
datasource:
- url: jdbc:mariadb://localhost:3306/requestdb
+ jdbc-url: jdbc:mariadb://localhost:3306/requestdb
username: mso
password: mso123
driver-class-name: org.mariadb.jdbc.Driver
diff --git a/adapters/mso-vfc-adapter/src/main/resources/application.yaml b/adapters/mso-vfc-adapter/src/main/resources/application.yaml
index 2cee9cf7dc..4a500b3a50 100644
--- a/adapters/mso-vfc-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-vfc-adapter/src/main/resources/application.yaml
@@ -10,15 +10,10 @@ mso:
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
- dbcp2:
- initial-size: 5
- max-total: 20
- validation-query: select 1
- test-on-borrow: true
jpa:
show-sql: false
hibernate:
@@ -28,5 +23,15 @@ spring:
enable-lazy-load-no-trans: true
#Actuator
-management:
- context-path: /manage
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file