summaryrefslogtreecommitdiffstats
path: root/adapters/mso-tenant-adapter/src/main/java/org
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /adapters/mso-tenant-adapter/src/main/java/org
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-tenant-adapter/src/main/java/org')
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java59
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java77
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java290
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/TenantAdapterRest.java307
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java45
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java76
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBean.java64
7 files changed, 0 insertions, 918 deletions
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java
deleted file mode 100644
index 1a4bec4798..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.mso.adapters.tenant;
-
-
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.HealthCheckUtils;
-import org.openecomp.mso.utils.UUIDChecker;
-
-@Path("/")
- public class HealthCheckHandler {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- @HEAD
- @GET
- @Path("/healthcheck")
- @Produces("text/html")
- public Response healthcheck (@QueryParam("requestId") String requestId) {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck(msoLogger)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (!healthCheck.catalogDBCheck (msoLogger, startTime)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
- msoLogger.debug("healthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- }
-
-}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java
deleted file mode 100644
index 4141e8951f..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.mso.adapters.tenant;
-
-
-import java.util.Map;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebParam.Mode;
-import javax.jws.WebService;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.ws.Holder;
-
-import org.openecomp.mso.adapters.tenant.exceptions.TenantAlreadyExists;
-import org.openecomp.mso.adapters.tenant.exceptions.TenantException;
-import org.openecomp.mso.adapters.tenantrest.TenantRollback;
-import org.openecomp.mso.entity.MsoRequest;
-
-@WebService (name="TenantAdapter", targetNamespace="http://org.openecomp.mso/tenant")
-public interface MsoTenantAdapter
-{
- /**
- * This is the "Create Tenant" Web Service Endpoint definition.
- */
- @WebMethod
- public void createTenant (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
- @WebParam(name="tenantName") @XmlElement(required=true) String tenantName,
- @WebParam(name="metadata") Map<String,String> metadata,
- @WebParam(name="failIfExists") Boolean failIfExists,
- @WebParam(name="backout") Boolean backout,
- @WebParam(name="request") MsoRequest msoRequest,
- @WebParam(name="tenantId", mode=Mode.OUT) Holder<String> tenantId,
- @WebParam(name="rollback", mode=Mode.OUT) Holder<TenantRollback> rollback )
- throws TenantException, TenantAlreadyExists;
-
- @WebMethod
- public void queryTenant (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
- @WebParam(name="tenantNameOrId") @XmlElement(required=true) String tenantNameOrId,
- @WebParam(name="request") MsoRequest msoRequest,
- @WebParam(name="tenantId", mode=Mode.OUT) Holder<String> tenantId,
- @WebParam(name="tenantName", mode=Mode.OUT) Holder<String> tenantName,
- @WebParam(name="metadata", mode=Mode.OUT) Holder<Map<String,String>> metadata )
- throws TenantException;
-
- @WebMethod
- public void deleteTenant (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
- @WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
- @WebParam(name="request") MsoRequest msoRequest,
- @WebParam(name="tenantDeleted", mode=Mode.OUT) Holder<Boolean> tenantDeleted)
- throws TenantException;
-
- @WebMethod
- public void rollbackTenant (@WebParam(name="rollback") @XmlElement(required=true) TenantRollback rollback)
- throws TenantException;
-
- @WebMethod
- public void healthCheck ();
-}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
deleted file mode 100644
index 85d50aee47..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.mso.adapters.tenant;
-
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-import javax.jws.WebService;
-import javax.xml.ws.Holder;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.adapters.tenant.exceptions.TenantAlreadyExists;
-import org.openecomp.mso.adapters.tenant.exceptions.TenantException;
-import org.openecomp.mso.adapters.tenantrest.TenantRollback;
-import org.openecomp.mso.entity.MsoRequest;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.openstack.beans.MsoTenant;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-import org.openecomp.mso.openstack.utils.MsoTenantUtils;
-import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory;
-
-@WebService(serviceName = "TenantAdapter", endpointInterface = "org.openecomp.mso.adapters.tenant.MsoTenantAdapter", targetNamespace = "http://org.openecomp.mso/tenant")
-public class MsoTenantAdapterImpl implements MsoTenantAdapter {
-
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- MsoTenantUtilsFactory tFactory = new MsoTenantUtilsFactory(MSO_PROP_TENANT_ADAPTER);
-
- public static final String MSO_PROP_TENANT_ADAPTER="MSO_PROP_TENANT_ADAPTER";
- 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";
-
- @Resource
- WebServiceContext wsContext;
-
- private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-
- protected MsoTenantUtilsFactory getTenantUtilsFactory() {
- return tFactory;
- }
-
- /**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck () {
- logger.debug ("Health check call in Tenant Adapter");
- }
-
- /**
- * This is the "Create Tenant" web service implementation. It will create
- * a new Tenant in the specified cloud. If the tenant already exists, this
- * can be considered a success or failure, depending on the value of the
- * 'failIfExists' parameter.
- *
- * The method returns the tenantId (the Openstack ID), and a TenantRollback
- * object. This last object can be passed as-is to the rollbackTenant method
- * to undo what (if anything) was created. This is useful if a Tenant is
- * successfully created but the orchestrator fails on a subsequent operation.
- */
- @Override
- public void createTenant (String cloudSiteId,
- String tenantName,
- Map <String, String> metadata,
- Boolean failIfExists,
- Boolean backout,
- MsoRequest msoRequest,
- Holder <String> tenantId,
- Holder <TenantRollback> rollback) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (CREATE_TENANT);
-
- logger.debug ("Call to MSO createTenant adapter. Creating Tenant: " + tenantName
- + "in "
- + cloudSiteId);
-
- // Will capture total time for metrics
- long startTime = System.currentTimeMillis ();
-
- // Start building up rollback object
- TenantRollback tenantRollback = new TenantRollback ();
- tenantRollback.setCloudId (cloudSiteId);
- tenantRollback.setMsoRequest (msoRequest);
-
- MsoTenantUtils tUtils;
- MsoTenant newTenant = null;
- String newTenantId;
- long queryTenantStartTime = System.currentTimeMillis ();
- try {
- tUtils = tFactory.getTenantUtils (cloudSiteId);
- newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId);
- logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", 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);
- 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.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new TenantException (me);
- }
- if (newTenant == null) {
- if (backout == null)
- backout = true;
- 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);
- } catch (MsoException me) {
- logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", 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.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new TenantException (me);
- }
- tenantRollback.setTenantId (newTenantId);
- tenantRollback.setTenantCreated (true);
- logger.debug ("Tenant " + tenantName + " successfully created with ID " + newTenantId);
- } else {
- if (failIfExists != null && failIfExists) {
- String error = CREATE_TENANT + ": Tenant " + tenantName + " already exists in " + cloudSiteId;
- logger.error (MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, OPENSTACK, "", MsoLogger.ErrorCode.DataError, CREATE_TENANT + ", Tenant already exists");
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
- throw new TenantAlreadyExists (tenantName, cloudSiteId, newTenant.getTenantId ());
- }
-
- newTenantId = newTenant.getTenantId ();
- tenantRollback.setTenantCreated (false);
- logger.debug ("Tenant " + tenantName + " already exists with ID " + newTenantId);
- }
-
-
- tenantId.value = newTenantId;
- rollback.value = tenantRollback;
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create tenant");
- return;
- }
-
- @Override
- public void queryTenant (String cloudSiteId,
- String tenantNameOrId,
- MsoRequest msoRequest,
- Holder <String> tenantId,
- Holder <String> tenantName,
- Holder <Map <String, String>> metadata) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (QUERY_TENANT);
- logger.debug ("Querying Tenant " + tenantNameOrId + " in " + cloudSiteId);
-
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
-
- MsoTenantUtils tUtils = null;
- MsoTenant qTenant = null;
- long subStartTime = System.currentTimeMillis ();
- try {
- tUtils = tFactory.getTenantUtils (cloudSiteId);
- qTenant = tUtils.queryTenant (tenantNameOrId, cloudSiteId);
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, QUERY_TENANT, null);
- if (qTenant == null) {
- // Not found by ID, Try by name.
- qTenant = tUtils.queryTenantByName (tenantNameOrId, cloudSiteId);
- }
-
- if (qTenant == null) {
- logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " not found");
- tenantId.value = null;
- tenantName.value = null;
- metadata.value = null;
- } else {
- logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " found with ID " + qTenant.getTenantId ());
- tenantId.value = qTenant.getTenantId ();
- tenantName.value = qTenant.getTenantName ();
- metadata.value = qTenant.getMetadata ();
- }
- } catch (MsoException me) {
- String error = "Query Tenant " + tenantNameOrId + ": " + me;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, QUERY_TENANT, null);
- logger.error (MessageEnum.RA_GENERAL_EXCEPTION, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception in queryTenant", me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new TenantException (me);
- }
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query tenant");
- return;
- }
-
- @Override
- public void deleteTenant (String cloudSiteId,
- String tenantId,
- MsoRequest msoRequest,
- Holder <Boolean> tenantDeleted) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (DELETE_TENANT);
-
- logger.debug ("Deleting Tenant " + tenantId + " in " + cloudSiteId);
-
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
-
- // Delete the Tenant.
- long subStartTime = System.currentTimeMillis ();
- try {
-
- MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId);
- boolean deleted = tUtils.deleteTenant (tenantId, cloudSiteId);
- tenantDeleted.value = deleted;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, DELETE_TENANT, null);
- } catch (MsoException me) {
- String error = "Delete Tenant " + tenantId + ": " + me;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, DELETE_TENANT, null);
- logger.error (MessageEnum.RA_DELETE_TEMAMT_ERR, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception - DeleteTenant", me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new TenantException (me);
- }
-
- // On success, nothing is returned.
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete tenant");
- return;
- }
-
- /**
- * This web service endpoint will rollback a previous Create VNF operation.
- * A rollback object is returned to the client in a successful creation
- * response. The client can pass that object as-is back to the rollbackVnf
- * operation to undo the creation.
- *
- * The rollback includes removing the VNF and deleting the tenant if the
- * tenant did not exist prior to the VNF creation.
- */
- @Override
- public void rollbackTenant (TenantRollback rollback) throws TenantException {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName (ROLLBACK_TENANT);
- // rollback may be null (e.g. if stack already existed when Create was called)
- if (rollback == null) {
- logger.warn (MessageEnum.RA_ROLLBACK_NULL, OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "rollbackTenant, rollback is null");
- return;
- }
-
- // Get the elements of the VnfRollback object for easier access
- String cloudSiteId = rollback.getCloudId ();
- String tenantId = rollback.getTenantId ();
-
- MsoLogger.setLogContext (rollback.getMsoRequest ());
- logger.debug ("Rolling Back Tenant " + rollback.getTenantId () + " in " + cloudSiteId);
-
- long subStartTime = System.currentTimeMillis ();
- if (rollback.getTenantCreated ()) {
- try {
-
- MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId);
- tUtils.deleteTenant (tenantId, cloudSiteId);
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, ROLLBACK_TENANT, null);
- } catch (MsoException me) {
- me.addContext (ROLLBACK_TENANT);
- // Failed to delete the tenant.
- String error = "Rollback Tenant " + tenantId + ": " + me;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, ROLLBACK_TENANT, null);
- logger.error (MessageEnum.RA_ROLLBACK_TENANT_ERR, me.getMessage(), OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "Exception - rollbackTenant", me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new TenantException (me);
- }
- }
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back tenant");
- return;
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/TenantAdapterRest.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/TenantAdapterRest.java
deleted file mode 100644
index 63f65ccd25..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/TenantAdapterRest.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.mso.adapters.tenant;
-
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.Holder;
-
-import org.openecomp.mso.adapters.tenant.exceptions.TenantAlreadyExists;
-import org.openecomp.mso.adapters.tenant.exceptions.TenantException;
-import org.openecomp.mso.adapters.tenantrest.CreateTenantError;
-import org.openecomp.mso.adapters.tenantrest.CreateTenantRequest;
-import org.openecomp.mso.adapters.tenantrest.CreateTenantResponse;
-import org.openecomp.mso.adapters.tenantrest.DeleteTenantError;
-import org.openecomp.mso.adapters.tenantrest.DeleteTenantRequest;
-import org.openecomp.mso.adapters.tenantrest.DeleteTenantResponse;
-import org.openecomp.mso.adapters.tenantrest.QueryTenantError;
-import org.openecomp.mso.adapters.tenantrest.QueryTenantResponse;
-import org.openecomp.mso.adapters.tenantrest.RollbackTenantError;
-import org.openecomp.mso.adapters.tenantrest.RollbackTenantRequest;
-import org.openecomp.mso.adapters.tenantrest.RollbackTenantResponse;
-import org.openecomp.mso.adapters.tenantrest.TenantRollback;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.openstack.beans.MsoTenant;
-import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
-
-/**
- * This class services calls to the REST interface for Tenants (http://host:port/vnfs/rest/v1/tenants)
- * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
- */
-@Path("/v1/tenants")
-public class TenantAdapterRest {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-
- //RAA? No logging in wrappers
-
- @HEAD
- @GET
- @Path("/healthcheck")
- @Produces(MediaType.TEXT_HTML)
- public Response healthcheck () {
- String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
- return Response.status (HttpServletResponse.SC_OK).entity (CHECK_HTML).build ();
- }
-
- /*
- URL:
- EP: http://host:8080/tenants/rest
- Resource: v1/tenants
- REQ - metadata?
- {
- "cloudSiteId": "DAN",
- "tenantName": "RAA_1",
- "failIfExists": true,
- "msoRequest": {
- "requestId": "ra1",
- "serviceInstanceId": "sa1"
- }}
- RESP-
- {
- "cloudSiteId": "DAN",
- "tenantId": "128e10b9996d43a7874f19bbc4eb6749",
- "tenantCreated": true,
- "tenantRollback": {
- "tenantId": "128e10b9996d43a7874f19bbc4eb6749",
- "cloudId": "DAN", // RAA? cloudId instead of cloudSiteId
- "tenantCreated": true,
- "msoRequest": {
- "requestId": "ra1",
- "serviceInstanceId": "sa1"
- }
- }
- }
- */
- @POST
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response createTenant(CreateTenantRequest req) {
- LOGGER.debug("createTenant enter: " + req.toJsonString());
-
- String newTenantId = null;
- TenantRollback tenantRollback = new TenantRollback ();
-
- try {
- Holder<String> htenant = new Holder<>();
- Holder<TenantRollback> hrollback = new Holder<>();
- MsoTenantAdapter impl = new MsoTenantAdapterImpl();
- impl.createTenant(
- req.getCloudSiteId(),
- req.getTenantName(),
- req.getMetadata(),
- req.getFailIfExists(),
- req.getBackout(),
- req.getMsoRequest(),
- htenant,
- hrollback);
- newTenantId = htenant.value;
- tenantRollback = hrollback.value;
-// TenantAdapterCore TAImpl = new TenantAdapterCore();
-// newTenantId = TAImpl.createTenant (req.getCloudSiteId(),
-// req.getTenantName(),
-// req.getFailIfExists(),
-// req.getBackout(),
-// req.getMetadata(),
-// req.getMsoRequest(),
-// tenantRollback);
- }
- catch (TenantAlreadyExists tae) {
- LOGGER.debug("Exception :",tae);
- CreateTenantError exc = new CreateTenantError(tae.getMessage(), tae.getFaultInfo().getCategory(), Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_NOT_IMPLEMENTED).entity(exc).build();
- }
- catch (TenantException te) {
- LOGGER.debug("Exception :",te);
- CreateTenantError exc = new CreateTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
- catch (Exception e) {
- LOGGER.debug("Exception :",e);
- CreateTenantError exc = new CreateTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
-
- CreateTenantResponse resp = new CreateTenantResponse (req.getCloudSiteId(), newTenantId, tenantRollback.getTenantCreated(), tenantRollback);
- return Response.status(HttpServletResponse.SC_OK).entity(resp).build();
- }
-
- /*
- URL:
- http://host:8080/tenants/rest
- Resource: v1/tenant/tennatId
- REQ:
- {"cloudSiteId": "DAN",
- "tenantId": "ca84cd3d3df44272845da554656b3ace",
- "msoRequest": {
- "requestId": "ra1",
- "serviceInstanceId": "sa1"
- }
- }
- RESP:
- {"tenantDeleted": true}
- */
- @DELETE
- @Path("{tenantId}")
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response deleteTenant(
- @PathParam("tenantId") String tenantId,
- DeleteTenantRequest req)
- {
- boolean tenantDeleted = false;
-
- try {
- Holder<Boolean> deleted = new Holder<>();
- MsoTenantAdapter impl = new MsoTenantAdapterImpl();
- impl.deleteTenant(
- req.getCloudSiteId(),
- req.getTenantId(),
- req.getMsoRequest(),
- deleted);
- tenantDeleted = deleted.value;
- }
- catch (TenantException te) {
- LOGGER.debug("Exception :",te);
- DeleteTenantError exc = new DeleteTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
- catch (Exception e) {
- LOGGER.debug("Exception :",e);
- DeleteTenantError exc = new DeleteTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
- DeleteTenantResponse resp = new DeleteTenantResponse();
- resp.setTenantDeleted(tenantDeleted);
- return Response.status(HttpServletResponse.SC_OK).entity(resp).build();
- }
-
- /*
- URL
- EP://http://host:8080/tenants/rest
- Resource: /v1/tenants
- Params:?tenantNameOrId=RAA_1&cloudSiteId=DAN
- RESP
- {
- "tenantId": "214b428a1f554c02935e66330f6a5409",
- "tenantName": "RAA_1",
- "metadata": {}
- }
- */
- @GET
- @Path("{tenantId}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response queryTenant(
- @PathParam("tenantId") String tenantId,
-// @QueryParam("tenantNameOrId") String tenantNameOrId, //RAA? diff from doc
- @QueryParam("cloudSiteId") String cloudSiteId,
- @QueryParam("msoRequest.requestId") String requestId,
- @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId)
- {
- MsoTenant tenant = null;
- try {
- Holder<String> htenant = new Holder<>();
- Holder<String> tenantName = new Holder<>();
- Holder<Map<String,String>> metadata = new Holder<>();
- MsoTenantAdapter impl = new MsoTenantAdapterImpl();
- impl.queryTenant(
- cloudSiteId,
- tenantId,
- null,
- htenant,
- tenantName,
- metadata
- );
- tenant = new MsoTenant(htenant.value, tenantName.value, metadata.value);
-// TenantAdapterCore TAImpl = new TenantAdapterCore();
-// MsoRequest msoReq = new MsoRequest();
-// tenant = TAImpl.queryTenant (cloudSiteId, tenantId, msoReq);
- }
- catch (TenantException te) {
- LOGGER.debug("Exception :",te);
- QueryTenantError exc = new QueryTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory());
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
- catch (Exception e) {
- LOGGER.debug("Exception :",e);
- QueryTenantError exc = new QueryTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
- QueryTenantResponse resp = new QueryTenantResponse(tenant.getTenantId(), tenant.getTenantName(), tenant.getMetadata());
- return Response.status(HttpServletResponse.SC_OK).entity(resp).build();
- }
-
- /*
- URL
- EP: //http://host:8080/tenants/rest
- Resource: /v1/tenants/rollback
- REQ
- {"cloudSiteId": "DAN",
- "tenantId": "f58abb05041d4ff384d4d22d1ccd2a6c",
- "msoRequest": {
- "requestId": "ra1",
- "serviceInstanceId": "sa1"
- }
- }
- RESP:
- {"tenantDeleted": true}
- */
- @DELETE
- @Path("")
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- public Response rollbackTenant(
- @QueryParam("rollback") String action, // WTF?
- RollbackTenantRequest req)
- {
- try {
- MsoTenantAdapter impl = new MsoTenantAdapterImpl();
- impl.rollbackTenant(req.getTenantRollback());
- }
- catch (TenantException te) {
- LOGGER.debug("Exception :",te);
- RollbackTenantError exc = new RollbackTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
- catch (Exception e) {
- LOGGER.debug("Exception :",e);
- RollbackTenantError exc = new RollbackTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE);
- return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
- }
-
- RollbackTenantResponse resp = new RollbackTenantResponse ();
- resp.setTenantRolledback(req != null);
- return Response.status(HttpServletResponse.SC_OK).entity(resp).build();
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java
deleted file mode 100644
index e232866126..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.mso.adapters.tenant.exceptions;
-
-
-
-import javax.xml.ws.WebFault;
-
-import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
-
-
-/**
- * This class reports an exception when trying to create a VNF when another
- * VNF of the same name already exists in the target cloud/tenant. Note that
- * the createVnf method suppresses this exception by default.
- *
- *
- */
-@WebFault (name="TenantAlreadyExists", faultBean="org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean", targetNamespace="http://org.openecomp.mso/tenant")
-public class TenantAlreadyExists extends TenantException {
-
- private static final long serialVersionUID = 1L;
-
- public TenantAlreadyExists (String name, String cloudId, String tenantId) {
- super("Tenant " + name + " already exists in " + cloudId + " with ID " + tenantId, MsoExceptionCategory.USERDATA);
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java
deleted file mode 100644
index e868a7e80c..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.mso.adapters.tenant.exceptions;
-
-
-
-import javax.xml.ws.WebFault;
-
-import org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
-
-/**
- * This class simply extends Exception (without addition additional functionality)
- * to provide an identifier for Tenant related exceptions on create, delete, query.
- *
- *
- */
-@WebFault (name="TenantException", faultBean="org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean", targetNamespace="http://org.openecomp.mso/tenant")
-public class TenantException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- private TenantExceptionBean faultInfo;
-
- public TenantException (String msg) {
- super(msg);
- faultInfo = new TenantExceptionBean (msg);
- }
-
- public TenantException (String msg, Throwable e) {
- super (msg, e);
- faultInfo = new TenantExceptionBean (msg);
- }
-
- public TenantException (String msg, MsoExceptionCategory category) {
- super(msg);
- faultInfo = new TenantExceptionBean (msg, category);
- }
-
- public TenantException (String msg, MsoExceptionCategory category, Throwable e) {
- super (msg, e);
- faultInfo = new TenantExceptionBean (msg, category);
- }
-
- public TenantException (MsoException e) {
- super (e);
- faultInfo = new TenantExceptionBean (e.getContextMessage(), e.getCategory());
- }
-
- public TenantExceptionBean getFaultInfo() {
- return faultInfo;
- }
-
- public void setFaultInfo(TenantExceptionBean faultInfo) {
- this.faultInfo = faultInfo;
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBean.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBean.java
deleted file mode 100644
index 5cd9f2fe3e..0000000000
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBean.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.mso.adapters.tenant.exceptions;
-
-
-import java.io.Serializable;
-
-import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
-
-/**
- * Jax-WS Fault Bean for Network Exceptions
- */
-public class TenantExceptionBean implements Serializable {
-
- private static final long serialVersionUID = -9062290006520066109L;
-
- private String message;
- private MsoExceptionCategory category;
-
- public TenantExceptionBean () {}
-
- public TenantExceptionBean (String message) {
- this.message = message;
- }
-
- public TenantExceptionBean (String message, MsoExceptionCategory category) {
- this.message = message;
- this.category = category;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public MsoExceptionCategory getCategory () {
- return category;
- }
-
- public void setCategory (MsoExceptionCategory category) {
- this.category = category;
- }
-}