summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java27
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java26
2 files changed, 31 insertions, 22 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
index f58382f53c..b86681ebfc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -45,12 +47,13 @@ import org.springframework.stereotype.Component;
@WebService(serviceName = "TenantAdapter", endpointInterface = "org.onap.so.adapters.tenant.MsoTenantAdapter", targetNamespace = "http://org.onap.so/tenant")
@Component
public class MsoTenantAdapterImpl implements MsoTenantAdapter {
- public static final String CREATE_TENANT = "CreateTenant";
+ public static final String CREATE_TENANT = "createTenant";
public static final String OPENSTACK = "OpenStack";
public static final String QUERY_TENANT = "QueryTenant";
public static final String DELETE_TENANT = "DeleteTenant";
public static final String ROLLBACK_TENANT = "RollbackTenant";
-
+ private static final String SUCCESS_RESPONSE_OPENSTACK="Successfully received response from Open Stack";
+ private static final String OPENSTACK_COMMUNICATE_EXCEPTION_MSG="Exception while communicate with Open Stack";
@Resource
private WebServiceContext wsContext;
@@ -84,7 +87,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
Boolean backout,
MsoRequest msoRequest,
Holder <String> tenantId,
- Holder <TenantRollback> rollback) throws TenantException, TenantAlreadyExists {
+ Holder <TenantRollback> rollback) throws TenantException {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (CREATE_TENANT);
@@ -104,7 +107,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
try {
tUtils = tFactory.getTenantUtils (cloudSiteId);
} catch (MsoCloudSiteNotFound me) {
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, "createTenant", MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me);
+ logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me);
throw new TenantException (me);
}
@@ -113,11 +116,11 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
long queryTenantStartTime = System.currentTimeMillis ();
try {
newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId);
- logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, QUERY_TENANT, null);
+ logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, QUERY_TENANT, null);
} catch (MsoException me) {
- logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", OPENSTACK, QUERY_TENANT, null);
+ logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, OPENSTACK, QUERY_TENANT, null);
String error = "Create Tenant " + tenantName + ": " + me;
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, "createTenant", MsoLogger.ErrorCode.DataError, "Exception while communicate with Open Stack", me);
+ logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, me);
logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
@@ -127,11 +130,11 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
long createTenantStartTime = System.currentTimeMillis ();
try {
newTenantId = tUtils.createTenant (tenantName, cloudSiteId, metadata, backout.booleanValue ());
- logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, CREATE_TENANT, null);
+ logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, CREATE_TENANT, null);
} catch (MsoException me) {
- logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", OPENSTACK, CREATE_TENANT, null);
+ logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, OPENSTACK, CREATE_TENANT, null);
String error = "Create Tenant " + tenantName + ": " + me;
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, "createTenant", MsoLogger.ErrorCode.DataError, "Exception while communicate with Open Stack", me);
+ logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, me);
logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
@@ -176,7 +179,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
try {
tUtils = tFactory.getTenantUtils (cloudSiteId);
} catch (MsoCloudSiteNotFound me) {
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, "createTenant", MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me);
+ logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me);
throw new TenantException (me);
}
@@ -184,7 +187,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
long subStartTime = System.currentTimeMillis ();
try {
qTenant = tUtils.queryTenant (tenantNameOrId, cloudSiteId);
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, QUERY_TENANT, null);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, QUERY_TENANT, null);
if (qTenant == null) {
// Not found by ID, Try by name.
qTenant = tUtils.queryTenantByName (tenantNameOrId, cloudSiteId);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index 8541889d8e..da00a6fafa 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -35,6 +37,10 @@ public class MapTypedRequestTunablesData {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class);
private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
+ private static final String MISSING_CONFIGURATION_ERROR_MSG= "Missing configuration for: ";
+ private static final String MISSING_CONFIG_PARAM_ERROR_MSG="Missing config param";
+ private static final String MSO_INTERNAL_ERROR="MsoInternalError";
@Autowired
private Environment env;
@@ -47,9 +53,9 @@ public class MapTypedRequestTunablesData {
String value = env.getProperty(reqTunable.getKey().toLowerCase(), "");
if ("".equals(value)) {
- error= "Missing configuration for: " + reqTunable.getKey();
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
+ msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
throw new SDNCAdapterException(error);
}
@@ -58,7 +64,7 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error="Invalid configuration for: " + reqTunable.getKey();
msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
throw new SDNCAdapterException(error);
}
@@ -72,9 +78,9 @@ public class MapTypedRequestTunablesData {
reqTunable.setSdncUrl(env.getProperty(urlPropKey, ""));
if ("".equals(reqTunable.getSdncUrl())) {
- error="Missing configuration for: " + urlPropKey;
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
+ msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
throw new SDNCAdapterException(error);
}
@@ -89,10 +95,10 @@ public class MapTypedRequestTunablesData {
reqTunable.setMyUrl(env.getProperty(Constants.MY_URL_PROP, ""));
if ("".equals(reqTunable.getMyUrl())) {
- error="Missing configuration for: " + Constants.MY_URL_PROP;
+ error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Missing config param");
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
+ alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
throw new SDNCAdapterException(error);
}