diff options
Diffstat (limited to 'adapters')
46 files changed, 1436 insertions, 326 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java index 1912cd874a..49c80b44b5 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java @@ -20,14 +20,22 @@ package org.onap.so.cloud.authentication; +import java.util.Collections; + +import org.onap.so.cloud.authentication.models.RackspaceAuthentication; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; -import org.onap.so.cloud.authentication.models.RackspaceAuthentication; import org.onap.so.utils.CryptoUtils; import org.springframework.stereotype.Component; import com.woorea.openstack.keystone.model.Authentication; import com.woorea.openstack.keystone.model.authentication.UsernamePassword; +import com.woorea.openstack.keystone.v3.model.Authentication.Identity; +import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password; +import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User; +import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain; +import com.woorea.openstack.keystone.v3.model.Authentication.Scope; +import com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project; /** * This factory manages all the wrappers associated to authentication types. @@ -50,4 +58,30 @@ public final class AuthenticationMethodFactory { return new UsernamePassword (cloudIdentity.getMsoId (), CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ())); } } + + + public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3(CloudIdentity cloudIdentity, String tenantId) { + Identity identity = new Identity(); + Password password = new Password(); + User user = new User(); + Domain userDomain = new Domain(); + Scope scope = new Scope(); + Project project = new Project(); + Project.Domain projectDomain = new Project.Domain(); + userDomain.setName(cloudIdentity.getUserDomainName()); + projectDomain.setName(cloudIdentity.getProjectDomainName()); + user.setName(cloudIdentity.getMsoId()); + user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass())); + user.setDomain(userDomain); + password.setUser(user); + project.setDomain(projectDomain); + project.setId(tenantId); + scope.setProject(project); + identity.setPassword(password); + identity.setMethods(Collections.singletonList("password")); + com.woorea.openstack.keystone.v3.model.Authentication v3Auth = new com.woorea.openstack.keystone.v3.model.Authentication(); + v3Auth.setIdentity(identity); + v3Auth.setScope(scope); + return v3Auth; + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java new file mode 100644 index 0000000000..1a221a80df --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java @@ -0,0 +1,32 @@ +package org.onap.so.cloud.authentication; + +import java.io.Serializable; +import java.util.Calendar; + +public class KeystoneAuthHolder implements Serializable { + + private static final long serialVersionUID = -9073252905181739224L; + + private String id; + private Calendar expiration; + private String serviceUrl; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public Calendar getexpiration() { + return expiration; + } + public void setexpiration(Calendar expiration) { + this.expiration = expiration; + } + public String getServiceUrl() { + return serviceUrl; + } + public void setHeatUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java new file mode 100644 index 0000000000..05364d0c92 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java @@ -0,0 +1,113 @@ +package org.onap.so.cloud.authentication; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.function.Predicate; + +import org.onap.so.config.beans.PoConfig; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.utils.MsoTenantUtils; +import org.onap.so.openstack.utils.MsoTenantUtilsFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.keystone.v3.Keystone; +import com.woorea.openstack.keystone.v3.model.Authentication; +import com.woorea.openstack.keystone.v3.model.Token; +import com.woorea.openstack.keystone.v3.model.Token.Service; + +import net.jodah.failsafe.Failsafe; +import net.jodah.failsafe.RetryPolicy; + + +@Component +public class KeystoneV3Authentication { + + @Autowired + private AuthenticationMethodFactory authenticationMethodFactory; + + @Autowired + private MsoTenantUtilsFactory tenantUtilsFactory; + + @Autowired + private PoConfig poConfig; + + public KeystoneAuthHolder getToken(CloudSite cloudSite, String tenantId, String type) throws MsoException { + + String cloudId = cloudSite.getId(); + String region = cloudSite.getRegionId(); + + CloudIdentity cloudIdentity = cloudSite.getIdentityService(); + MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType()); + String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity); + Keystone keystoneTenantClient = new Keystone (keystoneUrl); + Authentication v3Credentials = authenticationMethodFactory.getAuthenticationForV3(cloudIdentity, tenantId); + + + OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens () + .authenticate(v3Credentials); + + KeystoneAuthHolder holder = makeRequest(v3Request, type, region); + + return holder; + } + + protected KeystoneAuthHolder makeRequest(OpenStackRequest<Token> v3Request, String type, String region) { + + OpenStackResponse response = Failsafe.with(createRetryPolicy()).get(() -> { + return v3Request.request(); + }); + String id = response.header("X-Subject-Token"); + Token token = response.getEntity(Token.class); + KeystoneAuthHolder result = new KeystoneAuthHolder(); + result.setId(id); + result.setexpiration(token.getExpiresAt()); + result.setHeatUrl(findEndpointURL(token.getCatalog(), type, region, "public")); + return result; + } + + protected RetryPolicy createRetryPolicy() { + RetryPolicy policy = new RetryPolicy(); + List<Predicate<Throwable>> result = new ArrayList<>(); + result.add(e -> { + return e.getCause() instanceof OpenStackResponseException + && Arrays.asList(poConfig.getRetryCodes().split(",")) + .contains(Integer.toString(((OpenStackResponseException)e).getStatus())); + }); + result.add(e -> { + return e.getCause() instanceof OpenStackConnectException; + }); + + Predicate<Throwable> pred = result.stream().reduce(Predicate::or).orElse(x -> false); + + policy.retryOn(error -> pred.test(error)); + + policy.withDelay(poConfig.getRetryDelay(), TimeUnit.SECONDS) + .withMaxRetries(poConfig.getRetryCount()); + + return policy; + } + + protected String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) { + for(Service service : serviceCatalog) { + if(type.equals(service.getType())) { + for(Service.Endpoint endpoint : service.getEndpoints()) { + if(region == null || region.equals(endpoint.getRegion())) { + if(facing.equals(endpoint.getInterface())) { + return endpoint.getUrl(); + } + } + } + } + } + throw new ServiceEndpointNotFoundException("endpoint url not found"); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/ServiceEndpointNotFoundException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/ServiceEndpointNotFoundException.java new file mode 100644 index 0000000000..3bc57a886a --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/ServiceEndpointNotFoundException.java @@ -0,0 +1,10 @@ +package org.onap.so.cloud.authentication; + +public class ServiceEndpointNotFoundException extends RuntimeException { + + private static final long serialVersionUID = -5347215451284361397L; + + public ServiceEndpointNotFoundException(String message) { + super(message); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java index 85abf9403c..4479a7f6c2 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -84,7 +84,7 @@ import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -121,8 +121,8 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoCloudifyUtils.class); // Properties names and variables (with default values) - protected String createPollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; - private String deletePollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; + protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval"; + private String deletePollIntervalProp = "org.onap.so.adapters.po.pollInterval"; protected String createPollIntervalDefault = "15"; private String deletePollIntervalDefault = "15"; @@ -298,7 +298,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ MsoCloudifyException me = new MsoCloudifyException (0, "Workflow Execution Failed", installWorkflow.getError()); me.addContext (CREATE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } } @@ -333,7 +333,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Propagate the original exception from Stack Query. me.addContext (CREATE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } } @@ -711,7 +711,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // leave the deployment in an indeterminate state, as cloud resources may still exist. MsoCloudifyException me = new MsoCloudifyException (0, "Uninstall Workflow Failed", uninstallWorkflow.getError()); me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } } @@ -719,7 +719,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Uninstall workflow has failed. // Must fail the deletion... may leave the deployment in an inconclusive state me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } @@ -738,7 +738,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // deployment in Cloudify DB. MsoCloudifyException me = new MsoCloudifyException (0, "Deployment Delete Failed", ce.getMessage(), ce); me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } catch (CloudifyResponseException re) { @@ -746,14 +746,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // deployment in the Cloudify DB. MsoCloudifyException me = new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getMessage(), re); me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } catch (Exception e) { // Catch-all MsoAdapterException ae = new MsoAdapterException (e.getMessage(), e); ae.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, ae.getContextMessage()); + throw ae; } @@ -1154,7 +1154,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm (CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof CloudifyConnectException) { CloudifyConnectException ce = (CloudifyConnectException) e; @@ -1163,7 +1163,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ me.addContext (context); // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("CloudifyIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY, "Cloudify connection error on " + context + ": " + e, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Cloudify connection error on " + context); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java index 3098a5410a..9995a23668 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java @@ -24,12 +24,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration -@ConfigurationProperties(prefix="adapters.po") +@ConfigurationProperties(prefix="org.onap.so.adapters.po") public class PoConfig { private String retryCodes; private int retryDelay; private int retryCount; + private int pollTimeout; + private int pollInterval; public String getRetryCodes() { return retryCodes; @@ -49,5 +51,17 @@ public class PoConfig { public void setRetryCount(int retryCount) { this.retryCount = retryCount; } + public int getPollTimeout() { + return pollTimeout; + } + public void setPollTimeout(int pollTimeout) { + this.pollTimeout = pollTimeout; + } + public int getPollInterval() { + return pollInterval; + } + public void setPollInterval(int pollInterval) { + this.pollInterval = pollInterval; + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java index da81da91ea..75b9fc94f6 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java @@ -29,7 +29,7 @@ import java.util.Map.Entry; import org.onap.so.config.beans.PoConfig; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoAdapterException; import org.onap.so.openstack.exceptions.MsoException; @@ -54,7 +54,7 @@ import com.woorea.openstack.quantum.model.NeutronError; public class MsoCommonUtils { private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoCommonUtils.class); - protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + @Autowired private PoConfig poConfig; @@ -166,7 +166,7 @@ public class MsoCommonUtils { // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("KeystoneError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; @@ -176,7 +176,7 @@ public class MsoCommonUtils { // Generate an alarm for all connection errors. logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context); - alarmLogger.sendAlarm ("KeystoneIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } return me; @@ -213,7 +213,7 @@ public class MsoCommonUtils { // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("HeatError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; @@ -222,7 +222,7 @@ public class MsoCommonUtils { me.addContext (context); // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("HeatIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context); } @@ -255,7 +255,7 @@ public class MsoCommonUtils { // Generate an alarm for 5XX and higher errors. if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("NeutronError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } } else if (e instanceof OpenStackConnectException) { OpenStackConnectException ce = (OpenStackConnectException) e; @@ -264,7 +264,7 @@ public class MsoCommonUtils { me.addContext (context); // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("NeutronIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context); } @@ -284,7 +284,7 @@ public class MsoCommonUtils { // Always generate an alarm for internal exceptions logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); - alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + return me; } @@ -296,7 +296,7 @@ public class MsoCommonUtils { // Always generate an alarm for internal exceptions logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); - alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + return me; } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index e36d0ff30e..f132f10ebb 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -24,6 +24,7 @@ package org.onap.so.openstack.utils; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,13 +42,17 @@ import org.onap.so.adapters.vdu.VduPlugin; import org.onap.so.adapters.vdu.VduStateType; import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.authentication.AuthenticationMethodFactory; +import org.onap.so.cloud.authentication.KeystoneAuthHolder; +import org.onap.so.cloud.authentication.KeystoneV3Authentication; +import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; -import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatCacheEntry; import org.onap.so.openstack.beans.HeatStatus; @@ -115,13 +120,16 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ @Autowired private MsoTenantUtilsFactory tenantUtilsFactory; - + + @Autowired + private KeystoneV3Authentication keystoneV3Authentication; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatUtils.class); // Properties names and variables (with default values) - protected String createPollIntervalProp = "onap.so.adapters.po.pollInterval"; - private String deletePollIntervalProp = "onap.so.adapters.po.pollInterval"; - private String deletePollTimeoutProp = "onap.so.adapters.po.pollTimeout"; + protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval"; + private String deletePollIntervalProp = "org.onap.so.adapters.po.pollInterval"; + private String deletePollTimeoutProp = "org.onap.so.adapters.po.pollTimeout"; protected static final String createPollIntervalDefault = "15"; private static final String deletePollIntervalDefault = "15"; @@ -524,7 +532,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } // MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); // me.addContext(CREATE_STACK); - // alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + // throw me; } catch (Exception e2) { // shouldn't happen - but handle @@ -533,7 +541,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); me.addContext(CREATE_STACK); - alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; } @@ -708,7 +716,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ me.addContext (DELETE_STACK); // Alarm this condition, stack deletion failed - alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + throw me; } @@ -721,7 +729,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ me.addContext (DELETE_STACK); // Alarm this condition, stack deletion failed - alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + throw me; } @@ -875,7 +883,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ */ public Heat getHeatClient (CloudSite cloudSite, String tenantId) throws MsoException { String cloudId = cloudSite.getId(); - + // For DCP/LCP, the region should be the cloudId. + String region = cloudSite.getRegionId (); + // Check first in the cache of previously authorized clients String cacheKey = cloudId + ":" + tenantId; if (heatClientCache.containsKey (cacheKey)) { @@ -895,20 +905,60 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType()); String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity); LOGGER.debug("keystoneUrl=" + keystoneUrl); - Keystone keystoneTenantClient = new Keystone (keystoneUrl); - Access access = null; - try { - Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); - - OpenStackRequest <Access> request = keystoneTenantClient.tokens () - .authenticate (credentials).withTenantId (tenantId); - - access = executeAndRecordOpenstackRequest (request); - } catch (OpenStackResponseException e) { + String heatUrl = null; + String tokenId = null; + Calendar expiration = null; + try { + if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) { + Keystone keystoneTenantClient = new Keystone (keystoneUrl); + Access access = null; + + Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); + + OpenStackRequest <Access> request = keystoneTenantClient.tokens () + .authenticate (credentials).withTenantId (tenantId); + + access = executeAndRecordOpenstackRequest (request); + + try { + // Isolate trying to printout the region IDs + try { + LOGGER.debug("access=" + access.toString()); + for (Access.Service service : access.getServiceCatalog()) { + List<Access.Service.Endpoint> endpoints = service.getEndpoints(); + for (Access.Service.Endpoint endpoint : endpoints) { + LOGGER.debug("AIC returned region=" + endpoint.getRegion()); + } + } + } catch (Exception e) { + LOGGER.debug("Encountered an error trying to printout Access object returned from AIC. " + e.getMessage()); + } + heatUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "orchestration", region, "public"); + LOGGER.debug("heatUrl=" + heatUrl + ", region=" + region); + } catch (RuntimeException e) { + // This comes back for not found (probably an incorrect region ID) + String error = "AIC did not match an orchestration service for: region=" + region + ",cloud=" + cloudIdentity.getIdentityUrl(); + throw new MsoAdapterException (error, e); + } + tokenId = access.getToken ().getId (); + expiration = access.getToken ().getExpires (); + } else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) { + try { + KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "orchestration"); + tokenId = holder.getId(); + expiration = holder.getexpiration(); + heatUrl = holder.getServiceUrl(); + } catch (ServiceEndpointNotFoundException e) { + // This comes back for not found (probably an incorrect region ID) + String error = "cloud did not match an orchestration service for: region=" + region + ",cloud=" + cloudIdentity.getIdentityUrl(); + throw new MsoAdapterException (error, e); + } + } + } catch (OpenStackResponseException e) { if (e.getStatus () == 401) { // Authentication error. String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error); } else { throw keystoneErrorToMsoException (e, TOKEN_AUTH); @@ -923,38 +973,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ throw runtimeExceptionToMsoException (e, TOKEN_AUTH); } - // For DCP/LCP, the region should be the cloudId. - String region = cloudSite.getRegionId (); - String heatUrl = null; - try { - // Isolate trying to printout the region IDs - try { - LOGGER.debug("access=" + access.toString()); - for (Access.Service service : access.getServiceCatalog()) { - List<Access.Service.Endpoint> endpoints = service.getEndpoints(); - for (Access.Service.Endpoint endpoint : endpoints) { - LOGGER.debug("AIC returned region=" + endpoint.getRegion()); - } - } - } catch (Exception e) { - LOGGER.debug("Encountered an error trying to printout Access object returned from AIC. " + e.getMessage()); - } - heatUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "orchestration", region, "public"); - LOGGER.debug("heatUrl=" + heatUrl + ", region=" + region); - } catch (RuntimeException e) { - // This comes back for not found (probably an incorrect region ID) - String error = "AIC did not match an orchestration service for: region=" + region + ",cloud=" + cloudIdentity.getIdentityUrl(); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException (error, e); - } - Heat heatClient = new Heat (heatUrl); - heatClient.token (access.getToken ().getId ()); + heatClient.token (tokenId); heatClientCache.put (cacheKey, new HeatCacheEntry (heatUrl, - access.getToken ().getId (), - access.getToken ().getExpires ())); + tokenId, + expiration)); LOGGER.debug ("Caching HEAT Client for " + cacheKey); return heatClient; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java index 8c5840074f..3936ae6496 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java @@ -31,7 +31,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.cloud.authentication.AuthenticationMethodFactory; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoAdapterException; @@ -435,7 +435,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { if (e.getStatus () == 401) { // Authentication error. Can't access admin tenant - something is mis-configured String error = "MSO Authentication Failed for " + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error); } else { throw keystoneErrorToMsoException (e, "TokenAuth"); @@ -453,7 +453,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { adminUrl = adminUrl.replaceFirst("5000", "35357"); } catch (RuntimeException e) { String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); + LOGGER.error(MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in findEndpointURL"); throw new MsoAdapterException (error, e); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java new file mode 100644 index 0000000000..da1957f36e --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java @@ -0,0 +1,41 @@ +package org.onap.so.openstack.utils; + +import java.util.Map; + +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.openstack.beans.MsoTenant; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.springframework.stereotype.Component; + +@Component +public class MsoKeystoneV3Utils extends MsoTenantUtils { + + @Override + public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout) + throws MsoException { + throw new UnsupportedOperationException(); + } + + @Override + public MsoTenant queryTenant(String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound { + throw new UnsupportedOperationException(); + } + + @Override + public MsoTenant queryTenantByName(String tenantName, String cloudSiteId) + throws MsoException, MsoCloudSiteNotFound { + throw new UnsupportedOperationException(); + } + + @Override + public boolean deleteTenant(String tenantId, String cloudSiteId) throws MsoException { + throw new UnsupportedOperationException(); + } + + @Override + public String getKeystoneUrl(String regionId, CloudIdentity cloudIdentity) throws MsoException { + return cloudIdentity.getIdentityUrl(); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 8f71af4dfe..829f6c1445 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -52,7 +52,6 @@ import org.onap.so.client.HttpClient; import org.onap.so.client.RestClient; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; import org.springframework.beans.factory.annotation.Autowired; @@ -519,7 +518,6 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); me.addContext(CREATE_STACK); - alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); throw me; } } else { diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java index a9f0a39235..7b82ad62ff 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java @@ -22,16 +22,21 @@ package org.onap.so.openstack.utils; import java.util.ArrayList; +import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.authentication.AuthenticationMethodFactory; +import org.onap.so.cloud.authentication.KeystoneAuthHolder; +import org.onap.so.cloud.authentication.KeystoneV3Authentication; +import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; -import org.onap.so.cloud.authentication.AuthenticationMethodFactory; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.beans.NeutronCacheEntry; @@ -78,6 +83,9 @@ public class MsoNeutronUtils extends MsoCommonUtils @Autowired private MsoTenantUtilsFactory tenantUtilsFactory; + + @Autowired + private KeystoneV3Authentication keystoneV3Authentication; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoNeutronUtils.class); @@ -356,7 +364,8 @@ public class MsoNeutronUtils extends MsoCommonUtils private Quantum getNeutronClient(CloudSite cloudSite, String tenantId) throws MsoException { String cloudId = cloudSite.getId(); - + String region = cloudSite.getRegionId(); + // Check first in the cache of previously authorized clients String cacheKey = cloudId + ":" + tenantId; if (neutronClientCache.containsKey(cacheKey)) { @@ -378,18 +387,52 @@ public class MsoNeutronUtils extends MsoCommonUtils CloudIdentity cloudIdentity = cloudSite.getIdentityService(); MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType()); final String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity); - Keystone keystoneTenantClient = new Keystone(keystoneUrl); - Access access = null; + String neutronUrl = null; + String tokenId = null; + Calendar expiration = null; try { - Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); - OpenStackRequest<Access> request = keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId); - access = executeAndRecordOpenstackRequest(request); + if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) { + Keystone keystoneTenantClient = new Keystone(keystoneUrl); + Access access = null; + + Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); + OpenStackRequest<Access> request = keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId); + access = executeAndRecordOpenstackRequest(request); + + + try { + neutronUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", region, "public"); + if (! neutronUrl.endsWith("/")) { + neutronUrl += "/v2.0/"; + } + } catch (RuntimeException e) { + // This comes back for not found (probably an incorrect region ID) + String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); + throw new MsoAdapterException (error, e); + } + tokenId = access.getToken().getId(); + expiration = access.getToken().getExpires(); + } else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) { + try { + KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "network"); + tokenId = holder.getId(); + expiration = holder.getexpiration(); + neutronUrl = holder.getServiceUrl(); + if (! neutronUrl.endsWith("/")) { + neutronUrl += "/v2.0/"; + } + } catch (ServiceEndpointNotFoundException e) { + // This comes back for not found (probably an incorrect region ID) + String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); + throw new MsoAdapterException (error, e); + } + } } catch (OpenStackResponseException e) { if (e.getStatus() == 401) { // Authentication error. String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId(); - alarmLogger .sendAlarm("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException(error); } else { @@ -409,24 +452,10 @@ public class MsoNeutronUtils extends MsoCommonUtils throw me; } - String region = cloudSite.getRegionId(); - String neutronUrl = null; - try { - neutronUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", region, "public"); - if (! neutronUrl.endsWith("/")) { - neutronUrl += "/v2.0/"; - } - } catch (RuntimeException e) { - // This comes back for not found (probably an incorrect region ID) - String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException (error, e); - } - Quantum neutronClient = new Quantum(neutronUrl); - neutronClient.token(access.getToken().getId()); + neutronClient.token(tokenId); - neutronClientCache.put(cacheKey, new NeutronCacheEntry(neutronUrl, access.getToken().getId(), access.getToken().getExpires())); + neutronClientCache.put(cacheKey, new NeutronCacheEntry(neutronUrl, tokenId, expiration)); LOGGER.debug ("Caching Neutron Client for " + cacheKey); return neutronClient; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java index 79934ccd28..08c98f3167 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java @@ -36,6 +36,8 @@ public class MsoTenantUtilsFactory { protected CloudConfig cloudConfig; @Autowired protected MsoKeystoneUtils keystoneUtils; + @Autowired + protected MsoKeystoneV3Utils keystoneV3Utils; // based on Cloud IdentityServerType returns ORM or KEYSTONE Utils public MsoTenantUtils getTenantUtils(String cloudSiteId) throws MsoCloudSiteNotFound { @@ -50,6 +52,8 @@ public class MsoTenantUtilsFactory { MsoTenantUtils tenantU = null; if (ServerType.KEYSTONE.equals(serverType)) { tenantU = keystoneUtils; + } else if (ServerType.KEYSTONE_V3.equals(serverType)) { + tenantU = keystoneV3Utils; } return tenantU; } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java index 95e4352e05..a5abe75af2 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java @@ -20,19 +20,23 @@ package org.onap.so.cloud.authentication; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.BaseTest; +import org.onap.so.cloud.authentication.models.RackspaceAuthentication; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; -import org.onap.so.cloud.authentication.models.RackspaceAuthentication; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; +import org.onap.so.utils.CryptoUtils; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.keystone.model.Authentication; import com.woorea.openstack.keystone.model.authentication.UsernamePassword; @@ -42,10 +46,9 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword; * only are tested. * */ -public class AuthenticationMethodTest extends BaseTest { +public class AuthenticationMethodTest { - @Autowired - private AuthenticationMethodFactory authenticationMethodFactory; + private AuthenticationMethodFactory authenticationMethodFactory = new AuthenticationMethodFactory(); /** * */ @@ -99,4 +102,20 @@ public class AuthenticationMethodTest extends BaseTest { assertTrue(UsernamePassword.class.equals(auth.getClass())); } + + @Test + public void getAuthenticationForV3Test() throws JsonParseException, JsonMappingException, IOException { + + CloudIdentity identity = new CloudIdentity(); + identity.setMsoId("my-username"); + identity.setMsoPass(CryptoUtils.encryptCloudConfigPassword("my-password")); + identity.setProjectDomainName("test-domain"); + identity.setUserDomainName("user-domain"); + ObjectMapper mapper = new ObjectMapper(); + com.woorea.openstack.keystone.v3.model.Authentication expected = + mapper.readValue(new String(Files.readAllBytes(Paths.get("src/test/resources/__files/KeystoneV3Payload.json"))), com.woorea.openstack.keystone.v3.model.Authentication.class); + com.woorea.openstack.keystone.v3.model.Authentication actual = authenticationMethodFactory.getAuthenticationForV3(identity, "project-x"); + + assertThat(actual, sameBeanAs(expected)); + } } diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/KeystoneV3Payload.json b/adapters/mso-adapter-utils/src/test/resources/__files/KeystoneV3Payload.json new file mode 100644 index 0000000000..dc6588ed36 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/KeystoneV3Payload.json @@ -0,0 +1,24 @@ +{ + "identity": { + "methods": [ + "password" + ], + "password": { + "user": { + "domain": { + "name": "user-domain" + }, + "name": "my-username", + "password": "my-password" + } + } + }, + "scope": { + "project": { + "domain": { + "name": "test-domain" + }, + "id": "project-x" + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml index 011bb1416b..368df847be 100644 --- a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml +++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml @@ -22,11 +22,14 @@ cloud_config: clli: "MTN6" aic_version: "3.0" identity_service_id: "ORDM3" -adapters: - po: - retryCodes: "504" - retryDelay: "5" - retryCount: "3" +org: + onap: + so: + adapters: + po: + retryCodes: "504" + retryDelay: "5" + retryCount: "3" tenant: tenant_description: "ECOMP Tenant" region_type: "single" diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java index 2fc1c3d70a..8c323af71b 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -520,13 +520,20 @@ public class CatalogDbAdapterRest { try { if (smUuid != null && !"".equals(smUuid)) { logger.debug("Query Csar by service model uuid: {}",smUuid); - ToscaCsar toscaCsar = toscaCsarRepo.findById(smUuid).orElseGet(() -> null); - if (toscaCsar != null) { - QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); - entity = serviceCsar.JSON2(false, false); + Service service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(smUuid); + + if (service != null) { + ToscaCsar toscaCsar = service.getCsar(); + if (toscaCsar != null) { + QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); + entity = serviceCsar.JSON2(false, false); + } else { + respStatus = HttpStatus.SC_NOT_FOUND; + } } else { respStatus = HttpStatus.SC_NOT_FOUND; } + } else { throw (new Exception("Incoming parameter is null or blank")); } diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml index ff6f2378fa..749a319372 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -14,7 +14,6 @@ mso: max-pool-size: 50 queue-capacity: 500 -# CatalogDB spring: datasource: jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb @@ -34,7 +33,7 @@ spring: fail-on-empty-beans: false flyway: baseline-on-migrate: false - jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb user: ${DB_ADMIN_USERNAME} password: ${DB_ADMIN_PASSWORD} outOfOrder: true diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql new file mode 100644 index 0000000000..3fdc3c31f9 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -0,0 +1,775 @@ +use catalogdb; + +DELETE FROM northbound_request_ref_lookup; +DELETE FROM orchestration_flow_reference; +DELETE FROM rainy_day_handler_macro; +DELETE FROM building_block_detail; +DELETE FROM orchestration_status_state_transition_directive; + + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE,IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES +('Service-Create', 'createInstance', 'Service', true,true, '7','7', 'cloudOwner'), +('Service-Delete', 'deleteInstance', 'Service', true,true, '7','7', 'cloudOwner'), +('Service-Macro-Assign', 'assignInstance', 'Service', false,true, '7','7', 'cloudOwner'), +('Service-Macro-Activate', 'activateInstance', 'Service', false,true, '7','7', 'cloudOwner'), +('Service-Macro-Unassign', 'unassignInstance', 'Service', false,true, '7','7', 'cloudOwner'), +('Service-Macro-Create', 'createInstance', 'Service', false,true, '7','7', 'cloudOwner'), +('Service-Macro-Delete', 'deleteInstance', 'Service', false,true, '7','7', 'cloudOwner'), +('Network-Create', 'createInstance', 'Network', true,true, '7','7', 'cloudOwner'), +('Network-Delete', 'deleteInstance', 'Network', true,true, '7','7', 'cloudOwner'), +('VNF-Macro-Recreate', 'recreateInstance', 'Vnf', false,true, '7','7', 'cloudOwner'), +('VNF-Macro-Replace', 'replaceInstance', 'Vnf', false,true, '7','7', 'cloudOwner'), +('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'cloudOwner'), +('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'cloudOwner'), +('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'cloudOwner'), +('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'cloudOwner'), +('VFModule-Create', 'createInstance', 'VfModule', true,true, '7','7', 'cloudOwner'), +('VFModule-Delete', 'deleteInstance', 'VfModule', true,true, '7','7', 'cloudOwner'), +('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'cloudOwner'), +('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'cloudOwner'), +('VFModule-ScaleOut', 'createInstance', 'VfModule', true, true, '7','7', 'cloudOwner'); + + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '7', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Activate', '8', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '7', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '8', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '9', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '10', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '11', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '12', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '13', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '14', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Create', '15', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')), +('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')), +('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'cloudOwner')), +('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')), +('Network-Delete', '3', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '6', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '7', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '8', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '9', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Recreate', '10', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '5', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '6', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '7', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '8', 'ChangeModelVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '9', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '10', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '13', 'ChangeModelVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '14', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '15', 'ChangeModelServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '16', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VNF-Macro-Replace', '17', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace' and CLOUD_OWNER = 'cloudOwner')), +('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')), +('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')), +('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create' and CLOUD_OWNER = 'cloudOwner')), +('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-Delete', '3', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-Delete', '4', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-Delete', '5', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Delete', '4', 'DeactivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('NetworkCollection-Macro-Delete', '5', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-ScaleOut', '1', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-ScaleOut', '2', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-ScaleOut', '3', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-ScaleOut', '4', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-ScaleOut', '5', 'ConfigurationScaleOutBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-ScaleOut', '6', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut' and CLOUD_OWNER = 'cloudOwner')); + +INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) +VALUES +('ActivateNetworkBB', '*', '*', '*', '*' , 'Rollback'), +('ActivateNetworkCollectionBB', '*', '*', '*', '*' , 'Rollback'), +('ActivateServiceInstanceBB', '*', '*', '*', '*' , 'Rollback'), +('ActivateVfModuleBB', '*', '*', '*', '*' , 'RollbackToAssigned'), +('ActivateVnfBB', '*', '*', '*', '*' , 'Rollback'), +('ActivateVolumeGroupBB', '*', '*', '*', '*' , 'Rollback'), +('AssignNetworkBB', '*', '*', '*', '*' , 'Rollback'), +('AssignServiceInstanceBB', '*', '*', '*', '*' , 'Rollback'), +('AssignVfModuleBB', '*', '*', '*', '*' , 'Rollback'), +('AssignVnfBB', '*', '*', '*', '*' , 'Rollback'), +('AssignVolumeGroupBB', '*', '*', '*', '*' , 'Rollback'), +('CreateNetworkBB', '*', '*', '*', '*' , 'Retry'), +('CreateNetworkCollectionBB', '*', '*', '*', '*' , 'Retry'), +('CreateVfModuleBB', '*', '*', '*', '*' , 'Retry'), +('CreateVolumeGroupBB', '*', '*', '*', '*' , 'Retry'), +('ChangeModelServiceInstanceBB', '*', '*', '*', '*' , 'Abort'), +('ChangeModelVfModuleBB', '*', '*', '*', '*' , 'Abort'), +('ChangeModelVnfBB', '*', '*', '*', '*' , 'Abort'), +('CreateCustomerBB', '*', '*', '*', '*' , 'Abort'), +('DeactivateNetworkBB', '*', '*', '*', '*' , 'Abort'), +('DeactivateServiceInstanceBB', '*', '*', '*', '*' , 'Abort'), +('DeactivateVfModuleBB', '*', '*', '*', '*' , 'Abort'), +('DeactivateVnfBB', '*', '*', '*', '*' , 'Abort'), +('DeactivateVolumeGroupBB', '*', '*', '*', '*' , 'Abort'), +('DeleteNetworkBB', '*', '*', '*', '*' , 'Retry'), +('DeleteNetworkCollectionBB', '*', '*', '*', '*' , 'Retry'), +('DeleteVfModuleBB', '*', '*', '*', '*' , 'Retry'), +('DeleteVolumeGroupBB', '*', '*', '*', '*' , 'Retry'), +('UnassignNetworkBB', '*', '*', '*', '*' , 'Retry'), +('UnassignServiceInstanceBB', '*', '*', '*', '*' , 'Retry'), +('UnassignVfModuleBB', '*', '*', '*', '*' , 'Retry'), +('UnassignVnfBB', '*', '*', '*', '*' , 'Retry'), +('UnassignVolumeGroupBB', '*', '*', '*', '*' , 'Retry'), +('UpdateNetworkBB', '*', '*', '*', '*' , 'Retry'), +('VnfAdapterBB', '*', '*', '*', '*' , 'Retry'), +('AAICheckVnfInMaintBB', '*', '*', '*', '*' , 'Abort'), +('AAISetVnfInMaintBB', '*', '*', '*', '*' , 'Abort'), +('AAIUnsetVnfInMaintBB', '*', '*', '*', '*' , 'Abort'); + + + +INSERT INTO building_block_detail (building_block_name, resource_type, target_action) +VALUES +('AssignServiceInstanceBB', 'SERVICE', 'ASSIGN'), +('AssignVnfBB', 'VNF', 'ASSIGN'), +('AssignVolumeGroupBB', 'VOLUME_GROUP', 'ASSIGN'), +('AssignVfModuleBB', 'VF_MODULE', 'ASSIGN'), +('AssignNetworkBB', 'NETWORK', 'ASSIGN'), + +('UnassignServiceInstanceBB', 'SERVICE', 'UNASSIGN'), +('UnassignVnfBB', 'VNF', 'UNASSIGN'), +('UnassignVolumeGroup', 'VOLUME_GROUP', 'UNASSIGN'), +('UnassignNetworkBB', 'NETWORK', 'UNASSIGN'), + +('ActivateServiceInstanceBB', 'SERVICE', 'ACTIVATE'), +('ActivateVnfBB', 'VNF', 'ACTIVATE'), +('ActivateVolumeGroupBB', 'VOLUME_GROUP', 'ACTIVATE'), +('ActivateVfModuleBB', 'VF_MODULE', 'ACTIVATE'), +('ActivateNetworkBB', 'NETWORK', 'ACTIVATE'), +('ActivateNetworkCollectionBB', 'NETWORK', 'ACTIVATE'), + +('DeactivateServiceInstanceBB', 'SERVICE', 'DEACTIVATE'), +('DeactivateVnfBB', 'VNF', 'DEACTIVATE'), +('DeactivateVolumeGroupBB', 'VOLUME_GROUP', 'DEACTIVATE'), +('DeactivateVfModuleBB', 'VF_MODULE', 'DEACTIVATE'), +('DeactivateNetworkBB', 'NETWORK', 'DEACTIVATE'), + + +('ChangeModelServiceInstanceBB', 'SERVICE', 'CHANGEMODEL'), +('ChangeModelVnfBB', 'VNF', 'CHANGEMODEL'), +('ChangeModelVfModuleBB', 'VF_MODULE', 'CHANGEMODEL'), + + +('CreateVolumeGroupBB', 'VOLUME_GROUP', 'CREATE'), +('CreateVfModuleBB', 'VF_MODULE', 'CREATE'), +('CreateNetworkBB', 'NETWORK', 'CREATE'), +('CreateNetworkCollectionBB', 'NETWORK', 'CREATE'), + +('DeleteVolumeGroupBB', 'VOLUME_GROUP', 'DELETE'), +('DeleteVfModuleBB', 'VF_MODULE', 'DELETE'), +('DeleteNetworkBB', 'NETWORK', 'DELETE'), +('DeleteNetworkCollectionBB', 'NETWORK', 'DELETE'), + +('ConfigurationScaleOutBB', 'VF_MODULE', 'CREATE'), +('GenericVnfHealthCheckBB', 'VF_MODULE', 'CREATE'); + +INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive) +VALUES + +('SERVICE', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VNF', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VF_MODULE', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'PRECREATED', 'ASSIGN', 'CONTINUE'), + +('SERVICE', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('VNF', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'INVENTORIED', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), + +('SERVICE', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'CREATED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_CREATE', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), + +('SERVICE', 'PENDING', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'ASSIGN', 'FAIL'), +('NETWORK', 'PENDING', 'ASSIGN', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VNF', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'INVENTORIED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'CREATED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'CREATED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'CREATED', 'UNASSIGN', 'FAIL'), +('NETWORK', 'CREATED', 'UNASSIGN', 'FAIL'), + +('SERVICE', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VNF', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('NETWORK', 'ACTIVE', 'UNASSIGN', 'FAIL'), + +('SERVICE', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_CREATE', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('VNF', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), + +('SERVICE', 'PENDING', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'UNASSIGN', 'CONTINUE'), +('VF_MODULE', 'PENDING', 'UNASSIGN', 'FAIL'), +('NETWORK', 'PENDING', 'UNASSIGN', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VNF', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VNF', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'INVENTORIED', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('VNF', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'ASSIGNED', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('VNF', 'CREATED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('VF_MODULE', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('NETWORK', 'CREATED', 'ACTIVATE', 'CONTINUE'), + +('SERVICE', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING_DELETE', 'ACTIVATE', 'CONTINUE'), +('VNF', 'PENDING_DELETE', 'ACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'ACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VNF', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'DEACTIVATE', 'FAIL'), + +('SERVICE', 'INVENTORIED', 'DEACTIVATE', 'FAIL'), +('VNF', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'INVENTORIED', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VNF', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VF_MODULE', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('NETWORK', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), + +('SERVICE', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_CREATE', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'DEACTIVATE', 'FAIL'), +('NETWORK', 'PENDING', 'DEACTIVATE', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'ASSIGNED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'ASSIGNED', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'CREATED', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('VNF', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'PENDING_DELETE', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_DELETE', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'PENDING_DELETE', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PENDING', 'CHANGE_MODEL', 'FAIL'), + + +('VOLUME_GROUP', 'PRECREATED', 'CREATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'CREATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'CREATE', 'FAIL'), + +('VOLUME_GROUP', 'INVENTORIED', 'CREATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'CREATE', 'FAIL'), +('NETWORK', 'INVENTORIED', 'CREATE', 'FAIL'), + +('VOLUME_GROUP', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'CREATE', 'CONTINUE'), + +('VOLUME_GROUP', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING_CREATE', 'CREATE', 'CONTINUE'), + +('VOLUME_GROUP', 'PENDING_DELETE', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'CREATE', 'CONTINUE'), +('NETWORK', 'PENDING_DELETE', 'CREATE', 'CONTINUE'), + +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), + +('VOLUME_GROUP', 'PENDING', 'CREATE', 'CONTINUE'), +('VF_MODULE', 'PENDING', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING', 'CREATE', 'FAIL'), + + +('VOLUME_GROUP', 'PRECREATED', 'DELETE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'DELETE', 'FAIL'), +('NETWORK', 'PRECREATED', 'DELETE', 'FAIL'), + +('VOLUME_GROUP', 'INVENTORIED', 'DELETE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'INVENTORIED', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'ASSIGNED', 'DELETE', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'DELETE', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'DELETE', 'CONTINUE'), + +('VOLUME_GROUP', 'CREATED', 'DELETE', 'CONTINUE'), +('VF_MODULE', 'CREATED', 'DELETE', 'CONTINUE'), +('NETWORK', 'CREATED', 'DELETE', 'CONTINUE'), + +('VOLUME_GROUP', 'ACTIVE', 'DELETE', 'FAIL'), +('VF_MODULE', 'ACTIVE', 'DELETE', 'FAIL'), +('NETWORK', 'ACTIVE', 'DELETE', 'FAIL'), + +('VOLUME_GROUP', 'PENDING_CREATE', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_CREATE', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'PENDING_DELETE', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), + +('VOLUME_GROUP', 'PENDING', 'DELETE', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'DELETE', 'FAIL'), +('NETWORK', 'PENDING', 'DELETE', 'FAIL'); + +UPDATE orchestration_flow_reference SET FLOW_NAME = 'HomingBB' WHERE FLOW_NAME = 'SniroHoming'; + +UPDATE orchestration_flow_reference +SET FLOW_NAME = 'ActivateServiceInstanceBB' +WHERE FLOW_NAME = 'ActivateServiceInstance'; + +DELETE FROM orchestration_flow_reference +WHERE FLOW_NAME = 'DeactivateNetworkCollectionBB'; + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO - 1 +WHERE COMPOSITE_ACTION = 'Service-Macro-Delete' AND SEQ_NO > 8; + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO - 1 +WHERE COMPOSITE_ACTION = 'NetworkCollection-Macro-Delete' AND SEQ_NO > 4; + +UPDATE building_block_detail +SET BUILDING_BLOCK_NAME = 'UnassignVolumeGroupBB' +WHERE BUILDING_BLOCK_NAME = 'UnassignVolumeGroup'; + +UPDATE building_block_detail +SET TARGET_ACTION = 'CHANGE_MODEL' +WHERE TARGET_ACTION = 'CHANGEMODEL'; + +INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) +VALUES +('UnassignVfModuleBB', 'VF_MODULE', 'UNASSIGN'), +('SniroHoming', 'CUSTOM', 'CUSTOM'), +('DeactivateAndUnassignVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), +('DeactivateNetworkCollectionBB', 'CUSTOM', 'CUSTOM'), +('AAICheckVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('AAISetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('AAIUnsetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('SDNOVnfHealthCheckBB', 'CUSTOM', 'CUSTOM'), +('VNF-Macro-Replace', 'CUSTOM', 'CUSTOM'), +('HomingBB', 'CUSTOM', 'CUSTOM'); + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES +('CUSTOM', 'ACTIVE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'CREATED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES +('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true, 'cloudOwner'); + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'cloudOwner')), +('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete' and CLOUD_OWNER = 'cloudOwner')); + +INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) +values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1', 'cloudOwner'); + +INSERT INTO orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) +values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate' and CLOUD_OWNER = 'cloudOwner')); + + +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Create'; +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Activate'; + +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Deactivate'; + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW, CLOUD_OWNER) VALUES +('Network-Update', 'updateInstance', 'Network', true, '7','7','1', 'cloudOwner'); +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update' and CLOUD_OWNER = 'cloudOwner')); + +INSERT INTO building_block_detail(BUILDING_BLOCK_NAME,RESOURCE_TYPE,TARGET_ACTION) VALUES +('UpdateNetworkBB','NETWORK','UPDATE'); + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS,TARGET_ACTION,FLOW_DIRECTIVE) VALUES +('NETWORK','PRECREATED','UPDATE','FAIL'), +('NETWORK','INVENTORIED','UPDATE','FAIL'), +('NETWORK','ASSIGNED','UPDATE','FAIL'), +('NETWORK','CREATED','UPDATE','FAIL'), +('NETWORK','PENDING_CREATE','UPDATE','FAIL'), +('NETWORK','PENDING_DELETE','UPDATE','FAIL'), +('NETWORK','PENDING_ACTIVATION','UPDATE','FAIL'), +('NETWORK','ACTIVE','UPDATE','CONTINUE'); + +UPDATE building_block_detail SET RESOURCE_TYPE = 'NETWORK_COLLECTION' WHERE BUILDING_BLOCK_NAME = 'ActivateNetworkCollectionBB'; +UPDATE building_block_detail SET RESOURCE_TYPE = 'NETWORK_COLLECTION' WHERE BUILDING_BLOCK_NAME = 'CreateNetworkCollectionBB'; +UPDATE building_block_detail SET RESOURCE_TYPE = 'NETWORK_COLLECTION' WHERE BUILDING_BLOCK_NAME = 'DeleteNetworkCollectionBB'; +UPDATE building_block_detail SET RESOURCE_TYPE = 'NETWORK_COLLECTION' WHERE BUILDING_BLOCK_NAME = 'DeactivateNetworkCollectionBB'; +UPDATE building_block_detail SET TARGET_ACTION = 'DEACTIVATE' WHERE BUILDING_BLOCK_NAME = 'DeactivateNetworkCollectionBB'; + +INSERT into orchestration_status_state_transition_directive (RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) values +('NETWORK_COLLECTION', 'PRECREATED', 'CREATE', 'CONTINUE'), +('NETWORK_COLLECTION', 'ASSIGNED', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'CREATED', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'ACTIVE', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_DELETE', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING', 'CREATE', 'FAIL'), +('NETWORK_COLLECTION', 'INVENTORIED', 'CREATE', 'SILENT_SUCCESS'), + +('NETWORK_COLLECTION', 'PRECREATED', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'ASSIGNED', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'CREATED', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'ACTIVE', 'DELETE', 'CONTINUE'), +('NETWORK_COLLECTION', 'PENDING_CREATE', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_DELETE', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING', 'DELETE', 'FAIL'), +('NETWORK_COLLECTION', 'INVENTORIED', 'DELETE', 'CONTINUE'), + +('NETWORK_COLLECTION', 'PRECREATED', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'ASSIGNED', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'CREATED', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'ACTIVE', 'ACTIVE', 'SILENT_SUCCESS'), +('NETWORK_COLLECTION', 'PENDING_CREATE', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_DELETE', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING_ACTIVATION', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'PENDING', 'ACTIVE', 'FAIL'), +('NETWORK_COLLECTION', 'INVENTORIED', 'ACTIVE', 'CONTINUE'); + +UPDATE orchestration_status_state_transition_directive SET TARGET_ACTION = 'ACTIVATE' WHERE TARGET_ACTION = 'ACTIVE'; + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES +('CONFIGURATION', 'PRECREATED', 'UNASSIGN', 'SILENT SUCCESS'), +('CONFIGURATION', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('CONFIGURATION', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('CONFIGURATION', 'CREATED', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING CREATE', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING DELETE', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING ACTIVATION', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING', 'UNASSIGN', 'FAIL'); + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO + 2 WHERE COMPOSITE_ACTION = 'SERVICE-MACRO-DELETE'; + + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES +('CONFIGURATION', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('CONFIGURATION', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('CONFIGURATION', 'ASSIGNED', 'ASSIGN', 'SILENT SUCCESS'), +('CONFIGURATION', 'CREATED', 'ASSIGN', 'SILENT SUCCESS'), +('CONFIGURATION', 'ACTIVE', 'ASSIGN', 'SILENT SUCCESS'), +('CONFIGURATION', 'PENDING CREATE', 'ASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING DELETE', 'ASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING ACTIVATION', 'ASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING', 'ASSIGN', 'FAIL'), + +('CONFIGURATION', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('CONFIGURATION', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('CONFIGURATION', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('CONFIGURATION', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('CONFIGURATION', 'ACTIVE', 'ACTIVATE', 'SILENT SUCCESS'), +('CONFIGURATION', 'PENDING CREATE', 'ACTIVATE', 'FAIL'), +('CONFIGURATION', 'PENDING DELETE', 'ACTIVATE', 'FAIL'), +('CONFIGURATION', 'PENDING ACTIVATION', 'ACTIVATE', 'FAIL'), +('CONFIGURATION', 'PENDING', 'ACTIVATE', 'FAIL'), + +('CONFIGURATION', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('CONFIGURATION', 'INVENTORIED', 'DEACTIVATE', 'SILENT SUCCESS'), +('CONFIGURATION', 'ASSIGNED', 'DEACTIVATE', 'SILENT SUCCESS'), +('CONFIGURATION', 'CREATED', 'DEACTIVATE', 'SILENT SUCCESS'), +('CONFIGURATION', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('CONFIGURATION', 'PENDING CREATE', 'DEACTIVATE', 'FAIL'), +('CONFIGURATION', 'PENDING DELETE', 'DEACTIVATE', 'FAIL'), +('CONFIGURATION', 'PENDING ACTIVATION', 'DEACTIVATE', 'FAIL'), +('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL'); + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO + 2 WHERE COMPOSITE_ACTION = 'Service-Macro-Create' AND SEQ_NO > 12; + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO + 1 WHERE COMPOSITE_ACTION = 'Service-Macro-Activate' AND SEQ_NO > 6; + + + +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE POLICY = 'Rollback'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE POLICY = 'Abort'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Rollback' WHERE FLOW_NAME = 'CreateNetworkBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Rollback' WHERE FLOW_NAME = 'CreateNetworkCollectionBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'RollbackToAssigned' WHERE FLOW_NAME = 'CreateVfModuleBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Rollback' WHERE FLOW_NAME = 'CreateVolumeGroupBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'DeleteNetworkBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'DeleteNetworkCollectionBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'DeleteVfModuleBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'DeleteVolumeGroupBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'UnassignNetworkBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'UnassignServiceInstanceBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'UnassignVfModuleBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'UnassignVnfBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Abort' WHERE FLOW_NAME = 'UnassignVolumeGroupBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Rollback' WHERE FLOW_NAME = 'UpdateNetworkBB'; +UPDATE rainy_day_handler_macro SET Secondary_Policy = 'Rollback' WHERE FLOW_NAME = 'VnfAdapterBB'; + + + + +INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) +VALUES +('GenericVnfHealthCheckBB', '*', '*', '*', "*" , 'Retry'), +('ConfigurationScaleOutBB', '*', '*', '*', "*" , 'Retry');
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.12.2__AddDomainColumnsCloudIdentity.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.12.2__AddDomainColumnsCloudIdentity.sql new file mode 100644 index 0000000000..e2c4dc8d2f --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.12.2__AddDomainColumnsCloudIdentity.sql @@ -0,0 +1,3 @@ +ALTER TABLE identity_services +ADD PROJECT_DOMAIN_NAME VARCHAR(255) DEFAULT NULL, +ADD USER_DOMAIN_NAME VARCHAR(255) DEFAULT NULL; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14.2__AddCloudOwnerColumnToNorthBoundRequest.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14.2__AddCloudOwnerColumnToNorthBoundRequest.sql new file mode 100644 index 0000000000..664a064bfc --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.14.2__AddCloudOwnerColumnToNorthBoundRequest.sql @@ -0,0 +1,7 @@ +use catalogdb; + +ALTER TABLE northbound_request_ref_lookup ADD COLUMN CLOUD_OWNER varchar(200) NOT NULL; +ALTER TABLE northbound_request_ref_lookup + DROP INDEX UK_northbound_request_ref_lookup; +ALTER TABLE northbound_request_ref_lookup +ADD UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC, `MACRO_ACTION` ASC, `CLOUD_OWNER` ASC); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index ec9ad8c29c..e249285867 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -20,9 +20,15 @@ package org.onap.so.db.catalog.client; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + import java.util.List; import java.util.UUID; +import javax.ws.rs.core.UriBuilder; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -44,25 +50,31 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe; import org.onap.so.db.catalog.beans.VnfRecipe; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import com.fasterxml.jackson.databind.ObjectMapper; + @RunWith(SpringRunner.class) @SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public class CatalogDbClientTest { public static final String MTN13 = "mtn13"; + @LocalServerPort private int port; @Value("${mso.db.auth}") private String msoAdaptersAuth; - + @Autowired CatalogDbClientPortChanger client; @@ -446,6 +458,21 @@ public class CatalogDbClientTest { } @Test + public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(){ + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setAction("createService"); + northBoundRequest.setRequestScope("service"); + northBoundRequest.setIsAlacarte(true); + northBoundRequest.setCloudOwner("my-custom-cloud-owner"); + client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, "my-custom-cloud-owner"); + Assert.assertNotNull(northBoundRequest); + Assert.assertEquals("createService",northBoundRequest.getAction()); + Assert.assertEquals("service",northBoundRequest.getRequestScope()); + Assert.assertEquals(true,northBoundRequest.getIsAlacarte() ); + Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner()); + } + + @Test public void testFindServiceRecipeByActionAndServiceModelUUID() { ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" ); Assert.assertNotNull(serviceRecipe); diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql index b4916bd46c..98d1917050 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -4,6 +4,8 @@ CREATE TABLE IF NOT EXISTS `identity_services` ( `IDENTITY_URL` varchar(200) DEFAULT NULL, `MSO_ID` varchar(255) DEFAULT NULL, `MSO_PASS` varchar(255) DEFAULT NULL, + `PROJECT_DOMAIN_NAME` varchar(255) DEFAULT NULL, + `USER_DOMAIN_NAME` varchar(255) DEFAULT NULL, `ADMIN_TENANT` varchar(50) DEFAULT NULL, `MEMBER_ROLE` varchar(50) DEFAULT NULL, `TENANT_METADATA` tinyint(1) DEFAULT 0, @@ -193,7 +195,7 @@ insert into vnf_components(vnf_id, component_type, heat_template_id, heat_enviro INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08'); -INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33'); +INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, NULL, 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33'); INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); @@ -207,3 +209,11 @@ VALUES INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID) VALUES ('volumeGroup', 'createInstance', '1', 'Gr api recipe to create volume-group', '/mso/async/services/WorkflowActionBB', 180, '20c4431c-246d-11e7-93ae-92361f002671'); + + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES +('Service-Create', 'createInstance', 'Service', true, '7','7', 'my-custom-cloud-owner'); + + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner')); diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java index 10dbbf1396..6339616803 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -36,6 +36,7 @@ import org.onap.so.logger.MsoLogger; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Paths; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -68,9 +69,11 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro // Try the override file String configLocation = System.getProperty("spring.config.location"); if (configLocation != null) { - try (InputStream stream = new FileInputStream(configLocation)) { + try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) { cloudConfig = loadCloudConfig(stream); - } + }catch(Exception e){ + LOGGER.warnSimple("Error Loading override.yaml",e); + } } if (cloudConfig == null) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 6578912b9a..608f39adb4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -48,7 +48,7 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; @@ -63,7 +63,7 @@ import org.springframework.stereotype.Component; public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: "; @@ -179,7 +179,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -198,7 +198,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -294,7 +294,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = "Error sending updateNetwork notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -311,7 +311,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending updateNotification request" + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -376,9 +376,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + } return; } @@ -398,9 +398,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { vlans.value, copyQuerySubnetIdMap (subnetIdMap)); } catch (Exception e) { - error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); + } return; } @@ -463,9 +463,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + } return; } @@ -477,7 +477,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending deleteNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -529,7 +529,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -541,7 +541,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending rollbackNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -627,7 +627,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { String error1 = "Unable to set authorization in callback request" + e.getMessage (); LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error1); + } return notifyPort; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 4b6bd09144..45285d0e51 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -49,7 +49,7 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.NetworkInfo; @@ -92,7 +92,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String NEUTRON_MODE = "NEUTRON"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + @Autowired private CloudConfig cloudConfig; @Autowired @@ -404,10 +404,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type = " + networkType; LOGGER.error (MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type = " + networkType); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); // Alarm on this - // error, - // configuration - // must be fixed LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } @@ -514,10 +510,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage (); LOGGER.error (MessageEnum.RA_CONFIG_EXC, e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Create Network, Configuration Error", e); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); // Alarm on this - // error, - // configuration - // must be fixed LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); // Input parameters were not valid throw new NetworkException (error, MsoExceptionCategory.INTERNAL); @@ -953,7 +945,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; LOGGER.error(MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -989,7 +981,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; LOGGER.error(MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error"); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -1177,10 +1169,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.error(MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, mode, "OpenStack", "", MsoLogger.ErrorCode.DataError, "CreateNetwork: Configuration Error"); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); - throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index bd0dc378d2..21b7ea4142 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -45,7 +45,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -60,7 +60,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfAdapterAsyncImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @@ -181,7 +181,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending createVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", ""); return; @@ -200,7 +200,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending createVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "","createVnfA"); return; @@ -255,7 +255,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending updateVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE,"","","UpdateVnfA"); return; @@ -273,7 +273,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending updateVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "","UpdateVnfA"); return; @@ -337,7 +337,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending queryVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); return; @@ -363,7 +363,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending queryVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); @@ -421,7 +421,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending deleteVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "","", "deleteVnfA"); return; @@ -436,7 +436,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending deleteVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "","deleteVnfA"); @@ -458,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { if (rollback == null) { error = "Empty Rollback: No action to perform"; LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "","", "rollbackVnfA"); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return; } @@ -491,7 +491,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending rollbackVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "","", "rollbackVnfA"); return; @@ -505,7 +505,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending rollbackVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "","rollbackVnfA"); @@ -647,7 +647,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, "Unable to set authorization in callback request"); + } return notifyPort; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index 19a41ad7a8..092cefe5f5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -96,7 +96,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoVnfAdapterImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -932,9 +932,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -948,9 +946,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); @@ -1661,8 +1656,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -1672,9 +1665,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 41da3c2988..00e72373dd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.beans.VnfRollback; @@ -81,7 +81,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN."; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfCloudifyAdapterImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final String CLOUDIFY_RESPONSE_SUCCESS="Successfully received response from Cloudify"; @@ -873,9 +873,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -886,7 +884,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 269acb9d6f..e0d7581dcf 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -71,7 +71,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -98,7 +98,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfPluginAdapterImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -919,9 +919,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -931,9 +929,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml index e07492e56c..67c4dd3c22 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml @@ -37,15 +37,12 @@ org: default_orm_url_replace_with_this: 7080 default_quota_value: 10 set_default_quota: false -ecomp: - mso: - adapters: - po: - retryCodes: 504 - retryDelay: 5 - retryCount: 3 - pollTimeout: 7500 - pollInterval: 15 + po: + retryCodes: 504 + retryDelay: 5 + retryCount: 3 + pollTimeout: 7500 + pollInterval: 15 server-port: 8080 ssl-enable: false diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index 88099be07f..bc3bfba418 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -13,8 +13,7 @@ mso: core-pool-size: 50 max-pool-size: 50 queue-capacity: 500 - -# CatalogDB + spring: datasource: jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml index 95b48cd8aa..d1a5bd9fa3 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml @@ -15,6 +15,12 @@ org: retrycount: 5 retryinterval: -15 retrylist: 408,429,500,502,503,504,900 + heat: + create: + pollInterval: 15 + delete: + pollTimeout: 7500 + pollInterval: 15 network: bpelauth: 4771D91C24BB25366730561D630B131818CD9FF8D686AA8807F4CB30E1324C46ED16197C07 sockettimeout: 5 @@ -22,6 +28,12 @@ org: retrycount: 5 retryinterval: -15 retrylist: 408,429,500,502,503,504,900 + heat: + create: + pollInterval: 15 + delete: + pollTimeout: 300 + pollInterval: 15 tenant: default_x_aic_orm_client_string: ONAP-SO default_keystone_url_version: /v2.0 @@ -40,27 +52,10 @@ org: base_url: http://localhost:${wiremock.server.port} base_path: /api/valet/placement/v1/ valet_auth: -ecomp: - mso: - adapters: - po: - retryCodes: 504 - retryDelay: 5 - retryCount: 3 - vnf: - heat: - create: - pollInterval: 15 - delete: - pollTimeout: 7500 - pollInterval: 15 - network: - heat: - create: - pollInterval: 15 - delete: - pollTimeout: 300 - pollInterval: 15 + po: + retryCodes: 504 + retryDelay: 5 + retryCount: 3 server-port: 8080 ssl-enable: false diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml index 58bde2ef14..175b08f747 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -15,6 +15,12 @@ org: retrycount: 5 retryinterval: -15 retrylist: 408,429,500,502,503,504,900 + heat: + create: + pollInterval: 15 + delete: + pollTimeout: 7500 + pollInterval: 15 network: bpelauth: 4771D91C24BB25366730561D630B131818CD9FF8D686AA8807F4CB30E1324C46ED16197C07 sockettimeout: 5 @@ -23,6 +29,12 @@ org: retryinterval: -15 retrylist: 408,429,500,502,503,504,900 encryptionKey: aa3871669d893c7fb8abbcda31b88b4f + heat: + create: + pollInterval: 15 + delete: + pollTimeout: 300 + pollInterval: 15 tenant: default_x_aic_orm_client_string: ONAP-SO default_keystone_url_version: /v2.0 @@ -41,27 +53,10 @@ org: base_url: http://localhost:${wiremock.server.port} base_path: /api/valet/placement/v1/ valet_auth: -ecomp: - mso: - adapters: - po: - retryCodes: 504 - retryDelay: 5 - retryCount: 3 - vnf: - heat: - create: - pollInterval: 15 - delete: - pollTimeout: 7500 - pollInterval: 15 - network: - heat: - create: - pollInterval: 15 - delete: - pollTimeout: 300 - pollInterval: 15 + po: + retryCodes: 504 + retryDelay: 5 + retryCount: 3 server-port: 8080 ssl-enable: false diff --git a/adapters/mso-openstack-adapters/src/test/resources/data.sql b/adapters/mso-openstack-adapters/src/test/resources/data.sql index 0103564b5b..77df06bb92 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/data.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/data.sql @@ -152,7 +152,7 @@ INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08'); -INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm939454', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33'); +INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm939454', '93937EA01B94A10A49279D4572B48369', null, null, 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33'); INSERT INTO `cloud_sites` (`ID`, `region_id`, `identity_service_id`, `cloud_version`, `clli`, `cloudify_id`, `platform`, `orchestrator`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'mtn13', 'MTN13', '3.0', 'MDT13', 'mtn13', null, 'orchestrator', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index a051417cc1..0c67123f56 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -788,6 +788,8 @@ CREATE TABLE IF NOT EXISTS `identity_services` ( `IDENTITY_URL` varchar(200) DEFAULT NULL, `MSO_ID` varchar(255) DEFAULT NULL, `MSO_PASS` varchar(255) DEFAULT NULL, + `PROJECT_DOMAIN_NAME` varchar(255) DEFAULT NULL, + `USER_DOMAIN_NAME` varchar(255) DEFAULT NULL, `ADMIN_TENANT` varchar(50) DEFAULT NULL, `MEMBER_ROLE` varchar(50) DEFAULT NULL, `TENANT_METADATA` tinyint(1) DEFAULT 0, diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index dc6abce759..c8ea1652f7 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -201,7 +201,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId; logger.error(error); - throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError); +// throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError); + operStatus = new OperationStatus(); + operStatus.setOperationId(operationId); + operStatus.setServiceId(serviceId); } operStatus.setUserId(userId); diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml index 4d200d25b8..af99a86e8e 100644 --- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml @@ -46,7 +46,7 @@ spring: role: ACTUATOR flyway: baseline-on-migrate: false - jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb user: ${DB_ADMIN_USERNAME} password: ${DB_ADMIN_PASSWORD} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java index 7c2dd1241f..103e216229 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java @@ -365,35 +365,10 @@ public class MSORequestDBImplTest { updatedOperationStatus.setReason(reason); updatedOperationStatus.setOperationContent(operationContent); - try { - dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId, - result, operationContent, progress, reason); - fail("Expected MsoRequestsDbException to be thrown"); - } catch (Exception e) { - assertEquals("Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId,e.getMessage()); - for(ILoggingEvent logEvent : TestAppender.events) - if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor") && - logEvent.getMarker().getName().equals("ENTRY") - ){ - Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); - assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - }else if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") && - logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ - Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("500",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); - assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); - assertEquals("ERROR",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - } - } - + dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId, + result, operationContent, progress, reason); + OperationStatus dbOpStatus = operationStatusRepository.findOneByServiceIdAndOperationId(serviceId,operationId); + assertThat(dbOpStatus, sameBeanAs(updatedOperationStatus).ignoring("operateAt").ignoring("finishedAt")); } @Test diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java index a0e3a17496..4a6ac9f5e2 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -28,7 +28,7 @@ import org.onap.so.adapters.sdnc.SDNCAdapterPortType; import org.onap.so.adapters.sdnc.SDNCAdapterRequest; import org.onap.so.adapters.sdnc.SDNCAdapterResponse; 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.stereotype.Component; @@ -41,7 +41,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + @Autowired private SDNCRestClient sdncClient; @@ -71,7 +71,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { catch (Exception e){ String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); + SDNCResponse sdncResp = new SDNCResponse(bpelReqId); sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); sdncResp.setRespMsg(respMsg); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java index fd924cad79..4b3181e6e9 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java @@ -52,7 +52,7 @@ import org.onap.so.adapters.sdnc.client.SDNCAdapterCallbackRequest; import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterPortType; import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService; 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; @@ -74,7 +74,7 @@ public class SDNCRestClient{ private MapRequestTunables tunablesMapper; private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + private static final String EXCEPTION_MSG="Exception while evaluate xpath"; private static final String MSO_INTERNAL_ERROR="MsoInternalError"; private static final String CAMUNDA="Camunda"; @@ -257,7 +257,7 @@ public class SDNCRestClient{ sdncResp.setRespMsg(respMsg); msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, respMsg); + return sdncResp; } finally @@ -287,7 +287,7 @@ public class SDNCRestClient{ } catch (MalformedURLException e1) { error = "Caught exception initializing Callback wsdl " + e1.getMessage(); msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, CAMUNDA, "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); + } SDNCCallbackAdapterService cbSvc = new SDNCCallbackAdapterService(); @@ -317,7 +317,7 @@ public class SDNCRestClient{ catch (Exception e2) { error = "Unable to set authorization in callback request " + e2.getMessage(); msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); + } msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl); @@ -328,7 +328,7 @@ public class SDNCRestClient{ { error = "Error sending BpelCallback request" + e.getMessage(); msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); + } msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA, ""); return; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java index 9c4dd5e8a0..aaf6cc7d70 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java @@ -35,7 +35,7 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.onap.so.adapters.sdnc.impl.Constants; 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.stereotype.Component; @@ -48,7 +48,7 @@ import org.springframework.core.env.Environment; @Component public class BPRestCallback { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + private static final String CAMUNDA="Camunda"; private static final String MSO_INTERNAL_ERROR="MsoInternalError"; @Autowired @@ -125,9 +125,7 @@ public class BPRestCallback { method.setHeader("Authorization", authorization); } catch (Exception e) { LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, - "Unable to set authorization in callback request", e); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, - "Unable to set authorization in callback request: " + e.getMessage()); + "Unable to set authorization in callback request", e); error = true; } @@ -144,15 +142,13 @@ public class BPRestCallback { if (httpResponse.getStatusLine().getStatusCode() >= 300) { String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, msg); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, msg); + } } return true; } catch (Exception e) { LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, - "Error sending callback request", e); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, - "Error sending callback request: " + e.getMessage()); + "Error sending callback request", e); return false; } finally { if (httpResponse != null) { 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 da00a6fafa..6f40ba07a9 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 @@ -25,7 +25,7 @@ package org.onap.so.adapters.sdnc.sdncrest; import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; import org.onap.so.adapters.sdnc.impl.Constants; 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; @@ -36,7 +36,7 @@ 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"; @@ -55,7 +55,7 @@ public class MapTypedRequestTunablesData { if ("".equals(value)) { 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); } @@ -64,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(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); } @@ -80,7 +80,7 @@ public class MapTypedRequestTunablesData { if ("".equals(reqTunable.getSdncUrl())) { 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); } @@ -98,7 +98,7 @@ public class MapTypedRequestTunablesData { 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_ERROR_MSG); - alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java index 1c5025a59d..3ecf6337cf 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java @@ -52,7 +52,7 @@ import org.onap.so.adapters.sdnc.impl.Constants; import org.onap.so.adapters.sdncrest.SDNCErrorCommon; import org.onap.so.adapters.sdncrest.SDNCResponseCommon; 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.stereotype.Component; @@ -69,7 +69,7 @@ import org.springframework.core.env.Environment; @Component public abstract class SDNCConnector { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + private static final String MSO_INTERNAL_ERROR="MsoInternalError"; private static final String XPATH_EXCEPTION="XPath Exception"; @Autowired @@ -149,7 +149,7 @@ public abstract class SDNCConnector { } logError(errMsg); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); + return createErrorResponse(statusCode, errMsg, rt); } @@ -199,13 +199,13 @@ public abstract class SDNCConnector { protected void logError(String errMsg) { LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); + } protected void logError(String errMsg, Throwable t) { LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); + } /** diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java index 4c85241f9a..48bc2d84bb 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import org.onap.so.adapters.sdnc.impl.Constants; 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; @@ -48,7 +48,7 @@ import org.springframework.stereotype.Component; @Component public class SNIROResponse { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + @Autowired private Environment env; @@ -71,7 +71,7 @@ public class SNIROResponse { String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); } 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 0536dd3560..1db9d9546d 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,7 @@ 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,7 +66,7 @@ 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; @@ -201,12 +201,12 @@ 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) { |