diff options
482 files changed, 13249 insertions, 20489 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index 093dbb731c..566eef7b2f 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -60,6 +60,16 @@ <dependencies> <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + </dependency> + <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <version>2.2.3</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapters-rest-interface</artifactId> <version>${project.version}</version> diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java index ef5f8232e0..5560282fda 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java @@ -20,22 +20,16 @@ package org.onap.so.cloud; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; import java.util.Optional; -import javax.annotation.PostConstruct; - -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.EqualsBuilder; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CloudifyManager; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /** * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud @@ -52,61 +46,17 @@ import org.apache.commons.lang3.builder.EqualsBuilder; * */ -@Configuration @JsonRootName("cloud_config") -@ConfigurationProperties(prefix="cloud_config") +@Component public class CloudConfig { private static final String CLOUD_SITE_VERSION = "2.5"; private static final String DEFAULT_CLOUD_SITE_ID = "default"; - - @JsonProperty("identity_services") - private Map<String, CloudIdentity> identityServices = new HashMap<>(); - - @JsonProperty("cloud_sites") - private Map <String, CloudSite> cloudSites = new HashMap<>(); - - @JsonProperty("cloudify_managers") - private Map <String, CloudifyManager> cloudifyManagers = new HashMap<>(); - @PostConstruct - private void init() { - for (Entry<String, CloudIdentity> entry : identityServices.entrySet()) { - entry.getValue().setId(entry.getKey()); - } - - for (Entry<String, CloudSite> entry : cloudSites.entrySet()) { - entry.getValue().setId(entry.getKey()); - } - - for (Entry<String, CloudifyManager> entry : cloudifyManagers.entrySet()) { - entry.getValue().setId(entry.getKey()); - } - } - - /** - * Get a map of all identity services that have been loaded. - */ - public Map<String, CloudIdentity> getIdentityServices() { - return identityServices; - } + @Autowired + private CatalogDbClient catalogDbClient; /** - * Get a map of all cloud sites that have been loaded. - */ - public Map<String, CloudSite> getCloudSites() { - return cloudSites; - } - - /** - * Get a Map of all CloudifyManagers that have been loaded. - * @return the Map - */ - public Map<String,CloudifyManager> getCloudifyManagers() { - return cloudifyManagers; - } - - /** * Get a specific CloudSites, based on an ID. The ID is first checked * against the regions, and if no match is found there, then against * individual entries to try and find one with a CLLI that matches the ID @@ -116,39 +66,28 @@ public class CloudConfig { * @return an Optional of CloudSite object. */ public synchronized Optional<CloudSite> getCloudSite(String id) { - if (id == null) { - return Optional.empty(); - } - if (cloudSites.containsKey(id)) { - return Optional.ofNullable(cloudSites.get(id)); - } else { - return getCloudSiteWithClli(id); - } - } - - public String getCloudSiteId(CloudSite cloudSite) { - for(Entry<String, CloudSite> entry : this.getCloudSites().entrySet()){ - if(entry.getValue().equals(cloudSite)) - return entry.getKey(); - } - return null; - } + if (id == null) { + return Optional.empty(); + } + CloudSite cloudSite = catalogDbClient.getCloudSite(id); + if (cloudSite != null) { + return Optional.of(cloudSite); + } else { + return getCloudSiteWithClli(id); + } + } + /** * Get a specific CloudSites, based on a CLLI and (optional) version, which * will be matched against the aic_version field of the CloudSite. * * @param clli * the CLLI to match - * @param version - * the version to match; may be null in which case any version - * matches * @return a CloudSite, or null of no match found */ private Optional<CloudSite> getCloudSiteWithClli(String clli) { - Optional <CloudSite> cloudSiteOptional = cloudSites.values().stream().filter(cs -> - cs.getClli() != null && clli.equals(cs.getClli()) && (CLOUD_SITE_VERSION.equals(cs.getAicVersion()))) - .findAny(); + Optional <CloudSite> cloudSiteOptional = Optional.ofNullable(catalogDbClient.getCloudSiteByClliAndAicVersion(clli,CLOUD_SITE_VERSION)); if (cloudSiteOptional.isPresent()) { return cloudSiteOptional; } else { @@ -157,8 +96,7 @@ public class CloudConfig { } private Optional<CloudSite> getDefaultCloudSite(String clli) { - Optional<CloudSite> cloudSiteOpt = cloudSites.values().stream() - .filter(cs -> cs.getId().equalsIgnoreCase(DEFAULT_CLOUD_SITE_ID)).findAny(); + Optional<CloudSite> cloudSiteOpt = Optional.ofNullable(catalogDbClient.getCloudSite(DEFAULT_CLOUD_SITE_ID)); if (cloudSiteOpt.isPresent()) { CloudSite defaultCloudSite = cloudSiteOpt.get(); CloudSite clone = new CloudSite(defaultCloudSite); @@ -178,7 +116,7 @@ public class CloudConfig { * @return a CloudIdentity, or null of no match found */ public CloudIdentity getIdentityService(String id) { - return identityServices.get(id); + return catalogDbClient.getCloudIdentity(id); } /** @@ -187,30 +125,6 @@ public class CloudConfig { * @return a CloudifyManager, or null of no match found */ public CloudifyManager getCloudifyManager (String id) { - return cloudifyManagers.get(id); - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("identityServices", getIdentityServices()).append("cloudSites", getCloudSites()).toString(); - } - - @Override - public boolean equals(final Object other) { - if (other == null) { - return false; - } - if (!getClass().equals(other.getClass())) { - return false; - } - CloudConfig castOther = (CloudConfig) other; - return new EqualsBuilder().append(getIdentityServices(), castOther.getIdentityServices()) - .append(getCloudSites(), castOther.getCloudSites()).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder(1, 31).append(getIdentityServices()).append(getCloudSites()).toHashCode(); + return catalogDbClient.getCloudifyManager(id); } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java deleted file mode 100644 index f38403d0cd..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java +++ /dev/null @@ -1,196 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.cloud; - - -import java.util.Comparator; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.openpojo.business.annotation.BusinessKey; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * JavaBean JSON class for a CloudSite. This bean represents a cloud location - * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig - * object, of which it is a component (a CloudConfig JSON configuration file - * will contain multiple CloudSite definitions). - * - * Note that this is only used to access Cloud Configurations loaded from a - * JSON config file, so there are no explicit setters. - * - */ -public class CloudSite { - @JsonProperty - @BusinessKey - private String id; - @JsonProperty("region_id") - @BusinessKey - private String regionId; - @JsonProperty("identity_service_id") - @BusinessKey - private String identityServiceId; - @JsonProperty("aic_version") - @BusinessKey - private String aicVersion; - @JsonProperty("clli") - @BusinessKey - private String clli; - @JsonProperty("cloudify_id") - @BusinessKey - private String cloudifyId; - @JsonProperty("platform") - @BusinessKey - private String platform; - @JsonProperty("orchestrator") - @BusinessKey - private String orchestrator; - - // Derived property (set by CloudConfig loader based on identityServiceId) - private CloudIdentity identityService; - // Derived property (set by CloudConfig loader based on cloudifyId) - private CloudifyManager cloudifyManager; - - public CloudSite() { - - } - - public CloudSite(CloudSite site) { - this.aicVersion = site.getAicVersion(); - this.clli = site.getClli(); - this.cloudifyId = this.getCloudifyId(); - this.cloudifyManager = this.getCloudifyManager(); - this.id = site.getId(); - this.identityService = site.getIdentityService(); - this.identityServiceId = site.getIdentityServiceId(); - this.orchestrator = site.getOrchestrator(); - this.platform = site.getPlatform(); - this.regionId = this.getRegionId(); - } - public String getId() { - return this.id; - } - - public void setId(String id) { - this.id = id; - } - - public String getRegionId() { - return regionId; - } - - public void setRegionId(String regionId) { - this.regionId = regionId; - } - - public String getIdentityServiceId() { - return identityServiceId; - } - - public void setIdentityServiceId(String identityServiceId) { - this.identityServiceId = identityServiceId; - } - public String getAicVersion() { - return aicVersion; - } - - public void setAicVersion(String aicVersion) { - this.aicVersion = aicVersion; - } - - public String getClli() { - return clli; - } - - public void setClli(String clli) { - this.clli = clli; - } - - public String getCloudifyId() { - return cloudifyId; - } - - public void setCloudifyId (String id) { - this.cloudifyId = id; - } - - public String getPlatform() { - return platform; - } - - public void setPlatform(String platform) { - this.platform = platform; - } - - public String getOrchestrator() { - return orchestrator; - } - - public void setOrchestrator(String orchestrator) { - this.orchestrator = orchestrator; - } - - public CloudIdentity getIdentityService () { - return identityService; - } - - public void setIdentityService (CloudIdentity identity) { - this.identityService = identity; - } - - public CloudifyManager getCloudifyManager () { - return cloudifyManager; - } - - public void setCloudifyManager (CloudifyManager cloudify) { - this.cloudifyManager = cloudify; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId()) - .append("identityServiceId", getIdentityServiceId()).append("aicVersion", getAicVersion()) - .append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform()) - .append("orchestrator", getOrchestrator()).toString(); - } - - @Override - public boolean equals(final Object other) { - if (other == null) { - return false; - } - if (!getClass().equals(other.getClass())) { - return false; - } - CloudSite castOther = (CloudSite) other; - return new EqualsBuilder().append(getRegionId(), castOther.getRegionId()) - .append(getIdentityServiceId(), castOther.getIdentityServiceId()) - .append(getAicVersion(), castOther.getAicVersion()).append(getClli(), castOther.getClli()).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getAicVersion()) - .append(getClli()).toHashCode(); - } -}
\ No newline at end of file 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 5c648eb5e3..1912cd874a 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,8 +20,8 @@ package org.onap.so.cloud.authentication; -import org.onap.so.cloud.AuthenticationType; -import org.onap.so.cloud.CloudIdentity; +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; 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 aa8e37f12b..59996fa3d1 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 @@ -42,8 +42,8 @@ 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.CloudSite; -import org.onap.so.cloud.CloudifyManager; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.cloudify.base.client.CloudifyBaseException; import org.onap.so.cloudify.base.client.CloudifyClientTokenProvider; import org.onap.so.cloudify.base.client.CloudifyConnectException; @@ -898,7 +898,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ { CloudifyManager cloudifyConfig = cloudConfig.getCloudifyManager(cloudSite.getCloudifyId()); if (cloudifyConfig == null) { - throw new MsoCloudifyManagerNotFound (cloudConfig.getCloudSiteId(cloudSite)); + throw new MsoCloudifyManagerNotFound (cloudSite.getId()); } // Get a Cloudify client 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 e5ece20cb7..1d5b1a006d 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 @@ -41,8 +41,8 @@ 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.CloudIdentity; -import org.onap.so.cloud.CloudSite; +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; @@ -949,7 +949,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ * @return an authenticated Heat object */ public Heat getHeatClient (CloudSite cloudSite, String tenantId) throws MsoException { - String cloudId = cloudConfig.getCloudSiteId(cloudSite); + String cloudId = cloudSite.getId(); // Check first in the cache of previously authorized clients String cacheKey = cloudId + ":" + tenantId; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java index 0b3f9dfe17..e68a8e764a 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java @@ -28,8 +28,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.StackInfo; 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 d3ec74db8d..2f2a457bed 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 @@ -27,8 +27,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import org.onap.so.cloud.CloudIdentity; -import org.onap.so.cloud.CloudSite; +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; @@ -92,7 +92,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { * <p> * * @param tenantName The tenant name to create - * @param cloudId The cloud identifier (may be a region) in which to create the tenant. + * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant. * @return the tenant ID of the newly created tenant * @throws MsoTenantAlreadyExists Thrown if the requested tenant already exists * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception @@ -150,7 +150,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { executeAndRecordOpenstackRequest (request); } - if (cloudIdentity.hasTenantMetadata () && metadata != null && !metadata.isEmpty ()) { + if (cloudIdentity.getTenantMetadata () && metadata != null && !metadata.isEmpty ()) { Metadata tenantMetadata = new Metadata (); tenantMetadata.setMetadata (metadata); @@ -221,7 +221,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { } Map <String, String> metadata = new HashMap <String, String> (); - if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).hasTenantMetadata ()) { + if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getTenantMetadata ()) { OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); Metadata tenantMetadata = executeAndRecordOpenstackRequest (request); if (tenantMetadata != null) { @@ -267,7 +267,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { } Map <String, String> metadata = new HashMap <String, String> (); - if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).hasTenantMetadata ()) { + if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getTenantMetadata ()) { OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); Metadata tenantMetadata = executeAndRecordOpenstackRequest (request); if (tenantMetadata != null) { 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 adeb008ad5..18ed94112c 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 @@ -27,8 +27,8 @@ import java.util.List; import java.util.Map; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudIdentity; -import org.onap.so.cloud.CloudSite; +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; @@ -42,7 +42,6 @@ import org.onap.so.openstack.exceptions.MsoIOException; import org.onap.so.openstack.exceptions.MsoNetworkAlreadyExists; import org.onap.so.openstack.exceptions.MsoNetworkNotFound; import org.onap.so.openstack.exceptions.MsoOpenstackException; -import org.onap.so.openstack.exceptions.MsoTenantNotFound; import org.onap.so.openstack.mappers.NetworkInfoMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java index 28911bc45c..383409f810 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java @@ -24,7 +24,7 @@ package org.onap.so.openstack.utils; import java.util.Map; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; 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 68d0ef2fad..da9f79aa89 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 @@ -21,8 +21,8 @@ package org.onap.so.openstack.utils; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; -import org.onap.so.cloud.ServerType; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java index 36f82e15bd..36a50fd77e 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java @@ -22,14 +22,30 @@ package org.onap.so; import com.github.tomakehurst.wiremock.client.WireMock; +import org.apache.http.HttpHeaders; +import org.apache.http.HttpStatus; import org.junit.After; +import org.junit.Before; import org.junit.runner.RunWith; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import javax.ws.rs.core.MediaType; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; + @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -43,4 +59,68 @@ public abstract class BaseTest extends TestDataSetup { public void after() { WireMock.reset(); } -} + + protected static String getBody(String body, int port, String urlPath) throws IOException { + return body.replaceAll("port", "http://localhost:" + port + urlPath); + } + + @Before + public void init() throws IOException { + CloudIdentity identity = getCloudIdentity(); + CloudSite cloudSite = getCloudSite(identity); + mockCloud(identity, cloudSite); + } + + private void mockCloud(CloudIdentity identity, CloudSite cloudSite) throws IOException { + stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudIdentity/mtn13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) + .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + } + + private CloudIdentity getCloudIdentity() { + CloudIdentity identity = new CloudIdentity(); + identity.setId("mtn13"); + identity.setMsoId("m93945"); + identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setAdminTenant("admin"); + identity.setMemberRole("admin"); + identity.setTenantMetadata(false); + identity.setIdentityUrl("http://localhost:"+wireMockPort+"/v2.0"); + identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + identity.setIdentityServerType(ServerType.KEYSTONE); + return identity; + } + + private CloudSite getCloudSite(CloudIdentity identity) { + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN13"); + cloudSite.setCloudVersion("3.0"); + cloudSite.setClli("MDT13"); + cloudSite.setRegionId("mtn13"); + cloudSite.setIdentityService(identity); + return cloudSite; + } + + private static String readFile(String fileName) throws IOException { + try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + return sb.toString(); + } + } +}
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..d7b30edbe5 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -0,0 +1,42 @@ +package org.onap.so; + +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +import javax.sql.DataSource; + +@Configuration +@Profile({"test","local"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + return new MariaDB4jSpringService(); + } + + @Bean + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + //Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder + .create() + .username(datasourceUsername) + .password(datasourcePassword) + .url(config.getURL(databaseName)) + .driverClassName(datasourceDriver) + .build(); + } +}
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java index 539e7acef0..012805e774 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java @@ -21,39 +21,72 @@ package org.onap.so.adapter_utils.tests; +import org.apache.http.HttpHeaders; +import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.cloud.Application; -import org.onap.so.openstack.utils.MsoCommonUtils; +import org.onap.so.BaseTest; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.utils.MsoHeatUtils; 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 javax.ws.rs.core.MediaType; +import java.io.IOException; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertEquals; -/** +/**PoConfigTest * This class implements test methods of the MsoHeatUtils * * */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles("test") -public class MsoHeatUtilsRefactorTest extends MsoCommonUtils { +public class MsoHeatUtilsRefactorTest extends BaseTest { @Autowired private MsoHeatUtils msoHeatUtils; + + @Before + public void init() throws IOException { + CloudIdentity identity = new CloudIdentity(); + + identity.setId("MTN13"); + identity.setMsoId("m93945"); + identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setAdminTenant("admin"); + identity.setMemberRole("admin"); + identity.setTenantMetadata(true); + identity.setIdentityUrl("http://localhost:28090/v2.0"); + identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN13"); + cloudSite.setCloudVersion("3.0"); + cloudSite.setClli("MDT13"); + cloudSite.setRegionId("MTN13"); + identity.setIdentityServerType(ServerType.KEYSTONE); + cloudSite.setIdentityService(identity); + + + stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) + .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + } @Test - public final void testGetKeystoneUrl() { - try { - String keyUrl = msoHeatUtils.getCloudSiteKeystoneUrl("DAN"); - assertEquals("http://192.168.170.21:5000/v2.0",keyUrl); - } catch (Exception e) { - - } + public final void testGetKeystoneUrl() throws MsoCloudSiteNotFound { + String keyUrl = msoHeatUtils.getCloudSiteKeystoneUrl("DAN"); + assertEquals("http://localhost:28090/v2.0", keyUrl); } - - } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java index 6d9687216d..50fc17511b 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java @@ -23,7 +23,6 @@ package org.onap.so.adapter_utils.tests; import static org.junit.Assert.fail; import static org.mockito.Mockito.when; -import java.security.GeneralSecurityException; import java.util.HashMap; import java.util.Map; @@ -36,9 +35,9 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudIdentity; -import org.onap.so.cloud.CloudSite; -import org.onap.so.cloud.ServerType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoIOException; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java index 668b1806ac..c6db998b2b 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java @@ -22,86 +22,71 @@ package org.onap.so.cloud; import static org.junit.Assert.*; -import java.util.Map; import java.util.Optional; import org.junit.Test; -import org.junit.runner.RunWith; import org.onap.so.BaseTest; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.openstack.exceptions.MsoException; 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; /** * This class implements test methods of the CloudConfig features. * * */ -public class CloudConfigTest extends BaseTest { +public class CloudConfigTest extends BaseTest{ @Autowired private CloudConfig con; - /** - * This method implements a test for the getCloudSites method. - */ - @Test - public final void testGetCloudSites () { - Map<String,CloudSite> siteMap = con.getCloudSites(); - assertNotNull(siteMap); - - CloudSite site1 = siteMap.get("regionOne"); - - assertEquals ("regionOne", site1.getRegionId()); - assertEquals ("MT_KEYSTONE", site1.getIdentityServiceId()); - assertEquals ("MT2", site1.getClli()); - assertEquals ("2.5", site1.getAicVersion()); - } - - - /** - * This method implements a test for the getIdentityServices method. - * @throws MsoException - */ - @Test - public final void testGetIdentityServices () throws MsoException { - Map<String,CloudIdentity> identityMap = con.getIdentityServices (); - assertNotNull(identityMap); - - CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); - - assertEquals("john", identity1.getMsoId()); - assertEquals("313DECE408AF7759D442D7B06DD9A6AA", identity1.getMsoPass()); - assertEquals("admin", identity1.getAdminTenant()); - assertEquals("_member_", identity1.getMemberRole()); - assertEquals(false, identity1.hasTenantMetadata()); - assertEquals("http://localhost:"+wireMockPort+"/v2.0", identity1.getIdentityUrl()); - assertEquals(ServerType.KEYSTONE, identity1.getIdentityServerType()); - assertEquals(AuthenticationType.USERNAME_PASSWORD, identity1.getIdentityAuthenticationType()); - - } - - /** - * This method implements a test for the getCloudSite method. - */ - @Test - public final void testGetDefaultCloudSite () { - Optional<CloudSite> site = con.getCloudSite("NotThere"); - assertTrue(site.isPresent()); - CloudSite site1 = site.get(); - assertEquals ("NotThere", site1.getRegionId()); - assertEquals("MTN6", site1.getClli()); - assertEquals("NotThere", site1.getId()); - assertEquals ("ORDM3", site1.getIdentityServiceId()); - } - - @Test - public void testGetIdentityService() { - CloudIdentity identity = con.getIdentityService("MT_KEYSTONE"); - assertEquals("john", identity.getMsoId()); - assertEquals("MT_KEYSTONE", identity.getId()); - } - + /** + * This method implements a test for the getCloudSite method. + */ + @Test + public final void testGetCloudSite () { + CloudSite site1 = con.getCloudSite("MTN13").get(); + + assertEquals ("mtn13", site1.getRegionId()); + assertEquals ("mtn13", site1.getIdentityServiceId()); + assertEquals ("MDT13", site1.getClli()); + assertEquals ("3.0", site1.getCloudVersion()); + } + + + /** + * This method implements a test for the getIdentityServices method. + * @throws MsoException + */ + @Test + public final void testGetIdentityServices () throws MsoException { + + CloudIdentity identity1 = con.getIdentityService("mtn13"); + + assertEquals("m93945", identity1.getMsoId()); + assertEquals("93937EA01B94A10A49279D4572B48369", identity1.getMsoPass()); + assertEquals("admin", identity1.getAdminTenant()); + assertEquals("admin", identity1.getMemberRole()); + assertTrue(identity1.getIdentityUrl().contains("http://localhost:")); + assertEquals(ServerType.KEYSTONE, identity1.getIdentityServerType()); + assertEquals(AuthenticationType.USERNAME_PASSWORD, identity1.getIdentityAuthenticationType()); + + } + + /** + * This method implements a test for the getCloudSite method. + */ + @Test + public final void testGetDefaultCloudSite () { + Optional<CloudSite> site = con.getCloudSite("NotThere"); + assertTrue(site.isPresent()); + CloudSite site1 = site.get(); + assertEquals ("NotThere", site1.getRegionId()); + assertEquals("MDT13", site1.getClli()); + assertEquals("NotThere", site1.getId()); + } + } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java index 89c15b0deb..096d5dad8b 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java @@ -21,7 +21,9 @@ package org.onap.so.cloud; import org.junit.Test; -import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.openpojo.rules.ToStringTester; import com.openpojo.reflection.PojoClass; @@ -51,7 +53,6 @@ public class CloudPojoTest { .with(new SetterTester()) .with(new GetterTester()) .with(new ToStringTester()) - .with(new EqualsAndHashCodeTester()) .build(); validator.validate(pojoClass); } 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 e1c533757b..d676bcab3a 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 @@ -24,11 +24,11 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.so.BaseTest; import org.onap.so.cloud.Application; -import org.onap.so.cloud.AuthenticationType; -import org.onap.so.cloud.CloudIdentity; +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.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; @@ -43,10 +43,7 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword; * only are tested. * */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles("test") -public class AuthenticationMethodTest { +public class AuthenticationMethodTest extends BaseTest { @Autowired private AuthenticationMethodFactory authenticationMethodFactory; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java index e75a4aecaf..96202c5122 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java @@ -42,13 +42,12 @@ import org.onap.so.adapters.vdu.VduModelInfo; 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.CloudIdentity; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.cloudify.beans.DeploymentInfo; import org.onap.so.cloudify.beans.DeploymentStatus; import org.onap.so.cloudify.v3.client.Cloudify; import org.onap.so.cloudify.v3.model.AzureConfig; -import org.onap.so.cloudify.v3.model.OpenstackConfig; import org.onap.so.openstack.exceptions.MsoException; public class MsoCloudifyUtilsTest2 { diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java index d347dedb4f..f069e9f61f 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.so.BaseTest; import org.onap.so.cloud.Application; import org.onap.so.config.beans.PoConfig; import org.springframework.beans.factory.annotation.Autowired; @@ -31,10 +32,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles("test") -public class PoConfigTest { +public class PoConfigTest extends BaseTest { @Autowired diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java index 4adf6bf5be..b675f4814d 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java @@ -30,7 +30,7 @@ import java.util.GregorianCalendar; import org.junit.Test; import org.onap.so.BaseTest; -public class HeatCacheEntryTest extends BaseTest { +public class HeatCacheEntryTest { private static final String HEAT_URL = "testHeatUrl"; private static final String TOKEN = "testToken"; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java index 3a652042b7..8626e7d177 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java @@ -29,7 +29,7 @@ import java.util.GregorianCalendar; import org.junit.Test; import org.onap.so.BaseTest; -public class NeutronCacheEntryTest extends BaseTest { +public class NeutronCacheEntryTest { private static final String NEUTRON_URL = "testNeutronUrl"; private static final String TOKEN = "testToken"; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java index 522a261fdd..94715f1599 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java @@ -30,7 +30,7 @@ import com.openpojo.validation.ValidatorBuilder; import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; -public class OpenstackBeansPojoTest extends BaseTest { +public class OpenstackBeansPojoTest { @Test public void pojoStructure() { test(PojoClassFactory.getPojoClass(VnfRollback.class)); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index 6bcb209125..b304cba93f 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -47,6 +47,10 @@ import org.onap.so.adapters.vdu.VduInstance; import org.onap.so.adapters.vdu.VduModelInfo; import org.onap.so.adapters.vdu.VduStateType; import org.onap.so.adapters.vdu.VduStatus; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; @@ -67,7 +71,7 @@ public class MsoHeatUtilsTest extends BaseTest{ expected.setStatus(status); CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("regionOne"); + cloudInfo.setCloudSiteId("MTN13"); cloudInfo.setTenantId("tenantId"); VduModelInfo vduModel = new VduModelInfo(); vduModel.setModelCustomizationUUID("blueprintId"); @@ -111,7 +115,7 @@ public class MsoHeatUtilsTest extends BaseTest{ expected.setStatus(status); CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("regionOne"); + cloudInfo.setCloudSiteId("mtn13"); cloudInfo.setTenantId("tenantId"); String instanceId = "instanceId"; @@ -138,7 +142,7 @@ public class MsoHeatUtilsTest extends BaseTest{ expected.setStatus(status); CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("regionOne"); + cloudInfo.setCloudSiteId("mtn13"); cloudInfo.setTenantId("tenantId"); String instanceId = "instanceId"; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java index c252f61e7f..1a8f4fb098 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import java.io.File; @@ -39,13 +38,12 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.mockito.runners.MockitoJUnitRunner; import org.onap.so.TestDataSetup; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoException; @@ -55,10 +53,7 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.woorea.openstack.base.client.OpenStackRequest; import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.StackResource; -import com.woorea.openstack.heat.StackResource.UpdateStack; import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.heat.model.UpdateStackParam; @RunWith(MockitoJUnitRunner.class) public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { @@ -95,7 +90,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { @Test public void updateStackTest() throws MsoException, JsonParseException, JsonMappingException, IOException { - CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class); + CloudSite cloudSite = new CloudSite(); Heat heatClient = new Heat("endpoint"); Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class); Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class); @@ -120,7 +115,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { public void updateStackWithEnvironmentTest() throws JsonParseException, JsonMappingException, IOException, MsoException { String environmentString = "environmentString"; - CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class); + CloudSite cloudSite = new CloudSite(); Heat heatClient = new Heat("endpoint"); Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class); Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class); @@ -147,7 +142,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { Map<String, Object> files = new HashMap<>(); files.put("file1", new Object()); - CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class); + CloudSite cloudSite = new CloudSite(); Heat heatClient = new Heat("endpoint"); Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class); Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java index 706427e985..92f7738c62 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java @@ -48,7 +48,7 @@ public class MsoKeystoneUtilsTest extends BaseTest { StubOpenStack.mockOpenStackGetUserById("john"); StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); - String response = msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true); + String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true); Assert.assertEquals("tenantId", response); } @@ -59,7 +59,7 @@ public class MsoKeystoneUtilsTest extends BaseTest { StubOpenStack.mockOpenStackGetUserByName("john"); StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); - String response = msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true); + String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true); Assert.assertEquals("tenantId", response); } @@ -70,14 +70,14 @@ public class MsoKeystoneUtilsTest extends BaseTest { StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); StubOpenStack.mockOpenStackGetUserByName_500("john"); StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); - msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true); + msoKeystoneUtils.createTenant("tenant", "Test", new HashMap<>(), true); } @Test public void queryTenantTest() throws Exception { StubOpenStack.mockOpenStackGetTenantById("tenantId"); - MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "regionOne"); + MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "MTN13"); Assert.assertEquals("testingTenantName", msoTenant.getTenantName()); } @@ -86,7 +86,7 @@ public class MsoKeystoneUtilsTest extends BaseTest { public void queryTenantByNameTest() throws Exception { StubOpenStack.mockOpenStackGetTenantByName("tenant"); - MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "regionOne"); + MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "MTN13"); Assert.assertEquals("testingTenantName", msoTenant.getTenantName()); } @@ -95,7 +95,7 @@ public class MsoKeystoneUtilsTest extends BaseTest { public void deleteTenantTest() throws Exception { StubOpenStack.mockOpenStackGetTenantById("tenantId"); StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId"); - boolean result = msoKeystoneUtils.deleteTenant("tenantId", "regionOne"); + boolean result = msoKeystoneUtils.deleteTenant("tenantId", "MTN13"); Assert.assertTrue(result); } @@ -104,7 +104,7 @@ public class MsoKeystoneUtilsTest extends BaseTest { public void deleteTenantByNameTest() throws Exception { StubOpenStack.mockOpenStackGetTenantByName("tenant"); StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId"); - boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "regionOne"); + boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "MTN13"); Assert.assertTrue(result); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java index 9f8b51a3b7..0442d4d635 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java @@ -50,14 +50,14 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void createNetworkTest_OpenStackBaseException() throws Exception { expectedException.expect(MsoException.class); - msoNeutronUtils.createNetwork("regionOne", "tenantId", + msoNeutronUtils.createNetwork("MTN13", "tenantId", MsoNeutronUtils.NetworkType.PROVIDER,"networkName", "PROVIDER", vlans); } @Test public void createNetworkTest_NetworkTypeAsMultiProvider() throws Exception { StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json"); - NetworkInfo networkInfo = msoNeutronUtils.createNetwork("regionOne", "tenantId", + NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId", MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"networkName","PROVIDER", vlans); Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); @@ -66,7 +66,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void createNetworkTest() throws Exception { StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json"); - NetworkInfo networkInfo = msoNeutronUtils.createNetwork("regionOne", "tenantId", + NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId", MsoNeutronUtils.NetworkType.PROVIDER,"networkName","PROVIDER", vlans); Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); @@ -75,14 +75,14 @@ public class MsoNeutronUtilsTest extends BaseTest{ @Test public void queryNetworkTest() throws Exception { StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); - NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); Assert.assertEquals("net1",networkInfo.getName()); } @Test public void queryNetworkTest_404() throws Exception { - NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); Assert.assertNull(networkInfo); } @@ -90,7 +90,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ public void queryNetworkTest_500() throws Exception { expectedException.expect(MsoException.class); StubOpenStack.mockOpenStackGetNeutronNetwork_500("43173f6a-d699-414b-888f-ab243dda6dfe"); - msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); } @@ -98,7 +98,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ public void deleteNetworkkTest() throws Exception { StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); StubOpenStack.mockOpenStackDeleteNeutronNetwork("43173f6a-d699-414b-888f-ab243dda6dfe"); - Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13"); Assert.assertTrue(result); } @@ -107,7 +107,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ public void updateNetworkTest() throws Exception { StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); - NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("regionOne", "tenantId", + NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId", "43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.PROVIDER,"PROVIDER", vlans); Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); @@ -117,7 +117,7 @@ public class MsoNeutronUtilsTest extends BaseTest{ public void updateNetworkTest_NetworkTypeAsMultiProvider() throws Exception { StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); - NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("regionOne", "tenantId", + NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId", "43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"PROVIDER", vlans); Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json index 7153f8b672..f1c08cc093 100644 --- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json @@ -12,7 +12,7 @@ "name": null, "endpoints": [ { - "region": "regionOne", + "region": "mtn13", "publicURL": "port", "internalURL": null, "adminURL": null @@ -25,7 +25,7 @@ "name": null, "endpoints": [ { - "region": "regionOne", + "region": "mtn13", "publicURL": "port", "internalURL": null, "adminURL": null @@ -38,7 +38,7 @@ "name": null, "endpoints": [ { - "region": "regionOne", + "region": "mtn13", "publicURL": "port", "internalURL": null, "adminURL": null 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 b584088587..f9467d3c12 100644 --- a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml +++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml @@ -1,12 +1,5 @@ # will be used as entry in DB to say SITE OFF/ON for healthcheck # MSO Properties go here -mso: - catalog: - db: - spring: - endpoint: "http://localhost:" - db: - auth: Basic YnBlbDptc28tZGItMTUwNyE= cloud_config: identity_services: MT_KEYSTONE: @@ -48,3 +41,51 @@ adapters: orm_url_replace_with_this: "7080" quota_value: "10" set_default_quota: "false" + +server-port: 8080 +ssl-enable: false +tomcat: + max-threads: 50 +mso: + logPath: logs + catalog: + db: + spring: + endpoint: http://localhost:${wiremock.server.port} + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + site-name: localDevEnv + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/catalogdb + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + initialization-mode: never + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + +mariaDB4j: + dataDir: + port: 3307 + databaseName: catalogdb + + +#Actuator +management: + endpoints: + enabled-by-default: false + endpoint: + info: + enabled: true
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/data.sql b/adapters/mso-adapter-utils/src/test/resources/data.sql new file mode 100644 index 0000000000..5e0e558291 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/data.sql @@ -0,0 +1,3 @@ +INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, '2018-07-17 14:05:08', '2018-07-17 14:05:08'); + +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');
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java index 6b0d901cb4..63ef8e6dd0 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java @@ -24,13 +24,12 @@ package org.onap.so.adapters.catalogdb.catalogrest; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; - -import org.onap.so.logger.MsoLogger; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.ObjectMapper; public abstract class CatalogQuery { - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogQuery.class); + protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class); private static final boolean IS_EMBED = true; public abstract String JSON2(boolean isArray, boolean isEmbed); @@ -48,21 +47,20 @@ public abstract class CatalogQuery { } protected String setTemplate(String template, Map<String, String> valueMap) { - LOGGER.debug("CatalogQuery setTemplate"); StringBuffer result = new StringBuffer(); String pattern = "<.*>"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(template); - LOGGER.debug("CatalogQuery template:" + template); + logger.debug("CatalogQuery template: {}", template); while (m.find()) { String key = template.substring(m.start() + 1, m.end() - 1); - LOGGER.debug("CatalogQuery key:" + key + " contains key? " + valueMap.containsKey(key)); + logger.debug("CatalogQuery key: {} contains key? {}", key , valueMap.containsKey(key)); m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); } m.appendTail(result); - LOGGER.debug("CatalogQuery return:" + result.toString()); + logger.debug("CatalogQuery return: {}", result.toString()); return result.toString(); } @@ -76,8 +74,7 @@ public abstract class CatalogQuery { jsonString = mapper.writeValueAsString(this); } catch (Exception e) { - LOGGER.debug("Exception:", e); - LOGGER.debug ("jsonString exception:"+e.getMessage()); + logger.error("Error converting to JSON" , e); jsonString = "invalid"; //throws instead? } return jsonString; diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java index 67f337e039..fbaf12b337 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java @@ -27,13 +27,14 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import org.onap.so.logger.MsoLogger; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; public abstract class CatalogQueryExceptionCommon { private String messageId; - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogQueryExceptionCommon.class); + protected static Logger logger = LoggerFactory.getLogger(CatalogQueryExceptionCommon.class); public CatalogQueryExceptionCommon() { messageId = null; } public CatalogQueryExceptionCommon(String messageId) { this.messageId = messageId; } @@ -49,7 +50,7 @@ public abstract class CatalogQueryExceptionCommon { jsonString = mapper.writeValueAsString(this); return jsonString; } catch (Exception e) { - LOGGER.debug ("Exception:", e); + logger.error ("Exception:", e); return ""; } } @@ -63,7 +64,7 @@ public abstract class CatalogQueryExceptionCommon { marshaller.marshal(this, bs); return bs.toString(); } catch (Exception e) { - LOGGER.debug ("Exception:", e); + logger.error ("Exception:", e); return ""; } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java index 2deada5754..3dca6a395c 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java @@ -24,19 +24,17 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.xml.bind.annotation.XmlRootElement; - import org.onap.so.db.catalog.beans.AllottedResourceCustomization; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @XmlRootElement(name = "serviceAllottedResources") public class QueryAllottedResourceCustomization extends CatalogQuery { - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,QueryAllottedResourceCustomization.class); + protected static Logger logger = LoggerFactory.getLogger(QueryAllottedResourceCustomization.class); private List<AllottedResourceCustomization> allottedResourceCustomization; - private final String template = + private static final String TEMPLATE = "\t{\n"+ -// "\t{ \"allottedResource\" : {\n"+ "\t\t\"modelInfo\" : {\n"+ "\t\t\t\"modelName\" : <MODEL_NAME>,\n"+ "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+ @@ -55,14 +53,24 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { "\t\t\"nfType\" : <NF_TYPE>,\n"+ "\t\t\"nfRole\" : <NF_ROLE>,\n"+ "\t\t\"nfNamingCode\" : <NF_NAMING_CODE>\n"+ - "\t}"; -// "\t}}"; + "\t}"; - public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<>(); } - public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) { allottedResourceCustomization = vlist; } + public QueryAllottedResourceCustomization() { + super(); + allottedResourceCustomization = new ArrayList<>(); + } + + public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) { + allottedResourceCustomization = vlist; + } - public List<AllottedResourceCustomization> getServiceAllottedResources(){ return this.allottedResourceCustomization; } - public void setServiceAllottedResources(List<AllottedResourceCustomization> v) { this.allottedResourceCustomization = v; } + public List<AllottedResourceCustomization> getServiceAllottedResources(){ + return this.allottedResourceCustomization; + } + + public void setServiceAllottedResources(List<AllottedResourceCustomization> v) { + this.allottedResourceCustomization = v; + } @Override public String toString () { @@ -72,7 +80,10 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { int i = 1; for (AllottedResourceCustomization o : allottedResourceCustomization) { sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; + if (!first) + sb.append("\n"); + + first = false; sb.append(o); } return sb.toString(); @@ -81,15 +92,20 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { @Override public String JSON2(boolean isArray, boolean isEmbed) { StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"serviceAllottedResources\": ["); + if (!isEmbed && isArray) + sb.append("{ "); + if (isArray) + sb.append("\"serviceAllottedResources\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; if (this.allottedResourceCustomization != null) { for (AllottedResourceCustomization o : allottedResourceCustomization) { - if (first) sb.append("\n"); first = false; + if (first) + sb.append("\n"); + + first = false; boolean arNull = o.getAllottedResource() == null ? true : false; @@ -110,13 +126,19 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID()); put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName()); - sb.append(sep).append(this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap)); sep = ",\n"; } } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); + if (!first) + sb.append("\n"); + + if (isArray) + sb.append("]"); + + if (!isEmbed && isArray) + sb.append("}"); + return sb.toString(); } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java index e0d187500e..8670b78e15 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java @@ -23,7 +23,8 @@ import java.util.HashMap; import java.util.Map; import org.onap.so.db.catalog.beans.Recipe; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -38,6 +39,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; * @version ONAP Beijing Release 2018-02-28 */ public class QueryResourceRecipe extends CatalogQuery{ + protected static Logger logger = LoggerFactory.getLogger(QueryResourceRecipe.class); private Recipe resourceRecipe; @@ -66,8 +68,7 @@ public class QueryResourceRecipe extends CatalogQuery{ try { jsonStr = mapper.writeValueAsString(valueMap); } catch(JsonProcessingException e) { - - e.printStackTrace(); + logger.error("Error creating JSON", e); } return jsonStr; } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java index d49f8965fb..c7ae137759 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java @@ -35,13 +35,7 @@ import org.onap.so.db.catalog.beans.ToscaCsar; */ public class QueryServiceCsar extends CatalogQuery{ - private ToscaCsar toscaCsar; - - public QueryServiceCsar(ToscaCsar toscaCsar){ - this.toscaCsar = toscaCsar; - } - - private final String template = + private static final String TEMPLATE = "\t{\n"+ "\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"+ "\t\t\"name\" : <NAME>,\n"+ @@ -51,9 +45,14 @@ public class QueryServiceCsar extends CatalogQuery{ "\t\t\"description\" : <DESCRIPTION>\n"+ "\t}"; + private ToscaCsar toscaCsar; + + public QueryServiceCsar(ToscaCsar toscaCsar){ + this.toscaCsar = toscaCsar; + } + @Override public String toString() { - return toscaCsar.toString(); } @@ -66,7 +65,7 @@ public class QueryServiceCsar extends CatalogQuery{ put(valueMap, "ARTIFACT_CHECK_SUM", null == toscaCsar ? null : toscaCsar.getArtifactChecksum()); put(valueMap, "URL", null == toscaCsar ? null : toscaCsar.getUrl()); put(valueMap, "DESCRIPTION", null == toscaCsar ? null : toscaCsar.getDescription()); - return this.setTemplate(template, valueMap); + return this.setTemplate(TEMPLATE, valueMap); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java index 12ba4c0598..b89c6275d4 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java @@ -32,7 +32,7 @@ import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder; public class QueryServiceMacroHolder extends CatalogQuery { private ServiceMacroHolder serviceMacroHolder; private static final String LINE_BEGINNING = "(?m)^"; - private static final String template = + private static final String TEMPLATE = "{ \"serviceResources\" : {\n"+ "\t\"modelInfo\" : {\n"+ "\t\t\"modelName\" : <SERVICE_MODEL_NAME>,\n"+ @@ -90,7 +90,7 @@ public class QueryServiceMacroHolder extends CatalogQuery { subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true); valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t")); - buf.append(this.setTemplate(template, valueMap)); + buf.append(this.setTemplate(TEMPLATE, valueMap)); return buf.toString(); } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java index b213d33af0..4afc24ea10 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java @@ -29,14 +29,15 @@ import javax.xml.bind.annotation.XmlRootElement; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @XmlRootElement(name = "serviceNetworks") public class QueryServiceNetworks extends CatalogQuery { - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,QueryServiceNetworks.class); + protected static Logger logger = LoggerFactory.getLogger(QueryServiceNetworks.class); private List<NetworkResourceCustomization> serviceNetworks; - private final String template = + private static final String TEMPLATE = "\t{\n"+ -// "\t{ \"networkResource\" : {\n"+ "\t\t\"modelInfo\" : {\n"+ "\t\t\t\"modelName\" : <MODEL_NAME>,\n"+ "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+ @@ -51,16 +52,19 @@ public class QueryServiceNetworks extends CatalogQuery { "\t\t\"networkRole\" : <NETWORK_ROLE>,\n"+ "\t\t\"networkScope\" : <NETWORK_SCOPE>\n"+ "\t}"; -// "\t}}"; - public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<>(); } + public QueryServiceNetworks() { + super(); + serviceNetworks = new ArrayList<>(); + } + public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) { - LOGGER.debug ("QueryServiceNetworks:"); + logger.debug ("QueryServiceNetworks:"); serviceNetworks = new ArrayList<>(); for (NetworkResourceCustomization o : vlist) { - LOGGER.debug (o.toString()); + if(logger.isDebugEnabled()) + logger.debug (o.toString()); serviceNetworks.add(o); - LOGGER.debug ("-------------------"); } } @@ -75,7 +79,9 @@ public class QueryServiceNetworks extends CatalogQuery { int i = 1; for (NetworkResourceCustomization o : serviceNetworks) { sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; + if (!first) + sb.append("\n"); + first = false; sb.append(o); } return sb.toString(); @@ -84,15 +90,19 @@ public class QueryServiceNetworks extends CatalogQuery { @Override public String JSON2(boolean isArray, boolean isEmbed) { StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"serviceNetworks\": ["); + if (!isEmbed && isArray) + sb.append("{ "); + if (isArray) + sb.append("\"serviceNetworks\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; for (NetworkResourceCustomization o : serviceNetworks) { - if (first) sb.append("\n"); first = false; + if (first) + sb.append("\n"); + first = false; boolean nrNull = o.getNetworkResource() == null ? true : false; put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName()); put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID()); @@ -106,12 +116,15 @@ public class QueryServiceNetworks extends CatalogQuery { put(valueMap, "NETWORK_SCOPE", o.getNetworkScope()); put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology()); - sb.append(sep).append(this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap)); sep = ",\n"; } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); + if (!first) + sb.append("\n"); + if (isArray) + sb.append("]"); + if (!isEmbed && isArray) + sb.append("}"); return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java index ff52daf880..82b6aa2aeb 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -29,11 +29,15 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @XmlRootElement(name = "serviceVnfs") public class QueryServiceVnfs extends CatalogQuery { + protected static Logger logger = LoggerFactory.getLogger(QueryServiceVnfs.class); + private List<VnfResourceCustomization> serviceVnfs; - private final String template = + private static final String TEMPLATE = "\n"+ "\t{ \"modelInfo\" : {\n"+ "\t\t\"modelName\" : <MODEL_NAME>,\n"+ @@ -52,15 +56,17 @@ public class QueryServiceVnfs extends CatalogQuery { "<_VFMODULES_>\n" + "\t}"; - public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<>(); } - public QueryServiceVnfs(List<VnfResourceCustomization> vlist) { - LOGGER.debug ("QueryServiceVnfs:"); + public QueryServiceVnfs() { + super(); + serviceVnfs = new ArrayList<>(); + } + + public QueryServiceVnfs(List<VnfResourceCustomization> vlist) { serviceVnfs = new ArrayList<>(); for (VnfResourceCustomization o : vlist) { - LOGGER.debug ("-- o is a serviceVnfs ----"); - LOGGER.debug (o.toString()); - serviceVnfs.add(o); - LOGGER.debug ("-------------------"); + if(logger.isDebugEnabled()) + logger.debug (o.toString()); + serviceVnfs.add(o); } } @@ -75,7 +81,9 @@ public class QueryServiceVnfs extends CatalogQuery { int i = 1; for (VnfResourceCustomization o : serviceVnfs) { sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; + if (!first) + sb.append("\n"); + first = false; sb.append(o); } return sb.toString(); @@ -84,14 +92,18 @@ public class QueryServiceVnfs extends CatalogQuery { @Override public String JSON2(boolean isArray, boolean isEmbed) { StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"serviceVnfs\": ["); + if (!isEmbed && isArray) + sb.append("{ "); + if (isArray) + sb.append("\"serviceVnfs\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; for (VnfResourceCustomization o : serviceVnfs) { - if (first) sb.append("\n"); first = false; + if (first) + sb.append("\n"); + first = false; boolean vrNull = o.getVnfResources() == null ? true : false; @@ -111,12 +123,15 @@ public class QueryServiceVnfs extends CatalogQuery { String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true); valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t")); - sb.append(sep).append(this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap)); sep = ",\n"; } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); + if (!first) + sb.append("\n"); + if (isArray) + sb.append("]"); + if (!isEmbed && isArray) + sb.append("}"); return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java index e5fa14376b..3680c59dca 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -33,9 +33,8 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; @XmlRootElement(name = "vfModules") public class QueryVfModule extends CatalogQuery { private List<VfModuleCustomization> vfModules; - private final String template = + private static final String TEMPLATE = "\t{\n"+ -// "\t{ \"vfModule\" : { \n"+ "\t\t\"modelInfo\" : { \n"+ "\t\t\t\"modelName\" : <MODEL_NAME>,\n"+ "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"+ @@ -48,20 +47,21 @@ public class QueryVfModule extends CatalogQuery { "\t\t\"initialCount\" : <INITIAL_COUNT>,\n"+ "\t\t\"hasVolumeGroup\" : <HAS_VOLUME_GROUP>\n"+ "\t}"; -// "\t}}"; - public QueryVfModule() { super(); vfModules = new ArrayList<>(); } - public QueryVfModule(List<VfModuleCustomization> vlist) { - LOGGER.debug ("QueryVfModule:"); - vfModules = new ArrayList<>(); - if (vlist != null) { - for (VfModuleCustomization o : vlist) { - LOGGER.debug ("-- o is a vfModules ----"); - LOGGER.debug (o.toString()); - vfModules.add(o); - LOGGER.debug ("-------------------"); - } + public QueryVfModule() { + super(); + vfModules = new ArrayList<>(); } + + public QueryVfModule(List<VfModuleCustomization> vlist) { + vfModules = new ArrayList<>(); + if (vlist != null) { + for (VfModuleCustomization o : vlist) { + if(logger.isDebugEnabled()) + logger.debug (o.toString()); + vfModules.add(o); + } + } } public List<VfModuleCustomization> getVfModule(){ return this.vfModules; } @@ -75,7 +75,9 @@ public class QueryVfModule extends CatalogQuery { int i = 1; for (VfModuleCustomization o : vfModules) { sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; + if (!first) + sb.append("\n"); + first = false; sb.append(o); } return sb.toString(); @@ -84,14 +86,18 @@ public class QueryVfModule extends CatalogQuery { @Override public String JSON2(boolean isArray, boolean isEmbed) { StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"vfModules\": ["); + if (!isEmbed && isArray) + sb.append("{ "); + if (isArray) + sb.append("\"vfModules\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; for (VfModuleCustomization o : vfModules) { - if (first) sb.append("\n"); first = false; + if (first) + sb.append("\n"); + first = false; boolean vfNull = o.getVfModule() == null ? true : false; boolean hasVolumeGroup = false; @@ -110,12 +116,15 @@ public class QueryVfModule extends CatalogQuery { put(valueMap, "INITIAL_COUNT", o.getInitialCount()); put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup)); - sb.append(sep).append(this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap)); sep = ",\n"; } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); + if (!first) + sb.append("\n"); + if (isArray) + sb.append("]"); + if (!isEmbed && isArray) + sb.append("}"); return sb.toString(); } } 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 0eeaa6a72c..a69e66cc69 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 @@ -49,7 +49,7 @@ We might be able to derive it's value from the current vnf-type (using the "midd min and initial counts can be 0. max can be null to indicate no maximum. Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table. -*/ + */ import java.util.ArrayList; import java.util.List; @@ -101,6 +101,8 @@ import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -113,488 +115,481 @@ import org.springframework.transaction.annotation.Transactional; @Path("/{version: v[0-9]+}") @Component public class CatalogDbAdapterRest { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogDbAdapterRest.class); - private static final boolean IS_ARRAY = true; - - @Autowired - private VnfCustomizationRepository vnfCustomizationRepo; - - @Autowired - private ServiceRepository serviceRepo; - - @Autowired - private NetworkResourceCustomizationRepository networkCustomizationRepo; - - @Autowired - private NetworkResourceRepository networkResourceRepo; - - @Autowired - private AllottedResourceCustomizationRepository allottedCustomizationRepo; - - @Autowired - private ToscaCsarRepository toscaCsarRepo; - - @Autowired - private VFModuleRepository vfModuleRepo; - - @Autowired - private VnfRecipeRepository vnfRecipeRepo; - - @Autowired - private NetworkRecipeRepository networkRecipeRepo; - - @Autowired - private ArRecipeRepository arRecipeRepo; - - @Autowired - private VnfResourceRepository vnfResourceRepo; - - @Autowired - private AllottedResourceRepository arResourceRepo; - - private static final String NO_MATCHING_PARAMETERS = "no matching parameters"; - - public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { - return Response - .status(respStatus) - //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {}) - .entity(qryResp.toJsonString(version, isArray)) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } - - @GET - @Path("vnfResources/{vnfModelCustomizationUuid}") - @Transactional( readOnly = true) - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceVnfs ( - @PathParam("version") String version, - @PathParam("vnfModelCustomizationUuid") String vnfUuid - ) { - return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null); - } - - @GET - @Path("serviceVnfs") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional( readOnly = true) - public Response serviceVnfs( - @PathParam("version") String version, - @QueryParam("vnfModelCustomizationUuid") String vnfUuid, - @QueryParam("serviceModelUuid") String smUuid, - @QueryParam("serviceModelInvariantUuid") String smiUuid, - @QueryParam("serviceModelVersion") String smVer, - @QueryParam("serviceModelName") String smName - ) { - return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName); - } - - public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) { - QueryServiceVnfs qryResp = null; - int respStatus = HttpStatus.SC_OK; - List<VnfResourceCustomization> ret = new ArrayList<>(); - Service service = null; - try { - if (vnfUuid != null && !"".equals(vnfUuid)) - ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid); - else if (serviceModelUUID != null && !"".equals(serviceModelUUID)) - service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID); - else if (smiUuid != null && !"".equals(smiUuid)) - if (smVer != null && !"".equals(smVer)) - service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid); - else - service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid); - else if (smName != null && !"".equals(smName)) { - if (smVer != null && !"".equals(smVer)) - service = serviceRepo.findByModelNameAndModelVersion(smName, smVer); - else - service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName); - } - else { - throw(new Exception(NO_MATCHING_PARAMETERS)); - } - - if (service == null && ret.isEmpty()) { - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryServiceVnfs(); - }else if( service == null && !ret.isEmpty()){ - qryResp = new QueryServiceVnfs(ret); - } else if (service != null) { - qryResp = new QueryServiceVnfs(service.getVnfCustomizations()); - } - LOGGER.debug ("serviceVnfs qryResp="+ qryResp); - return respond(version, respStatus, isArray, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, "", "", "queryServiceVnfs", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceVnfs", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) {}) - .build(); - } - } - - @GET - @Path("networkResources/{networkModelCustomizationUuid}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional( readOnly = true) - public Response serviceNetworks ( - @PathParam("version") String version, - @PathParam("networkModelCustomizationUuid") String nUuid - ) { - return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null); - } - - @GET - @Path("serviceNetworks") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional( readOnly = true) - public Response serviceNetworks ( - @PathParam("version") String version, - @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid, - @QueryParam("networkType") String networkType, - @QueryParam("networkModelName") String networkModelName, - @QueryParam("serviceModelUuid") String serviceModelUuid, - @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid, - @QueryParam("serviceModelVersion") String serviceModelVersion, - @QueryParam("networkModelVersion") String networkModelVersion - ) { - if (networkModelName != null && !"".equals(networkModelName)) { - networkType = networkModelName; - } - return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion); - } - - public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) { - QueryServiceNetworks qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - List<NetworkResourceCustomization> ret = new ArrayList<>(); - Service service = null; - - try{ - if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) { - uuid = networkModelCustomizationUuid; - ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid); - }else if (networkType != null && !"".equals(networkType)) { - uuid = networkType; - NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType); - if(networkResources != null) - ret=networkResources.getNetworkResourceCustomization(); - } - else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) { - uuid = serviceModelInvariantUuid; - if (serviceModelVersion != null && !"".equals(serviceModelVersion)) { - service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid); - } - else { - service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); - } - }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) { - uuid = serviceModelUuid; - service = serviceRepo.findOneByModelUUID(serviceModelUuid); - } - else { - throw(new Exception(NO_MATCHING_PARAMETERS)); - } - - if(service != null) - ret = service.getNetworkCustomizations(); - - if (ret == null || ret.isEmpty()) { - LOGGER.debug ("serviceNetworks not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryServiceNetworks(); - } else { - LOGGER.debug ("serviceNetworks found"); - qryResp = new QueryServiceNetworks(ret); - LOGGER.debug ("serviceNetworks qryResp="+ qryResp); - } - LOGGER.debug ("Query serviceNetworks exit"); - return respond(version, respStatus, isArray, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceNetworks", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceNetworks", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) {}) - .build(); - } - } - - @GET - @Path("serviceResources") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional(readOnly = true) - public Response serviceResources( - @PathParam("version") String version, - @QueryParam("serviceModelUuid") String modelUUID, - @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID, - @QueryParam("serviceModelVersion") String modelVersion) { - QueryServiceMacroHolder qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - ServiceMacroHolder ret = new ServiceMacroHolder(); - - try{ - if (modelUUID != null && !"".equals(modelUUID)) { - uuid = modelUUID; - LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: " + uuid); - Service serv =serviceRepo.findOneByModelUUID(uuid); - ret.setService(serv); - } - else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) { - uuid = modelInvariantUUID; - if (modelVersion != null && !"".equals(modelVersion)) { - LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ modelVersion); - Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid); - ret.setService(serv); - } - else { - LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid); - Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); - ret.setService(serv); - } - } - else { - throw(new Exception(NO_MATCHING_PARAMETERS)); - } - - if (ret.getService() == null) { - LOGGER.debug ("serviceMacroHolder not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryServiceMacroHolder(); - } else { - LOGGER.debug ("serviceMacroHolder found"); - qryResp = new QueryServiceMacroHolder(ret); - LOGGER.debug ("serviceMacroHolder qryResp="+ qryResp); - } - LOGGER.debug ("Query serviceMacroHolder exit"); - return respond(version, respStatus, IS_ARRAY, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceMacroHolder", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceMacroHolder", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp){} ) - .build(); - } - } - - - @GET - @Path("allottedResources/{arModelCustomizationUuid}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional( readOnly = true) - public Response serviceAllottedResources ( - @PathParam("version") String version, - @PathParam("arModelCustomizationUuid") String aUuid - ) { - return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null); - } - - @GET - @Path("serviceAllottedResources") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional( readOnly = true) - public Response serviceAllottedResources( - @PathParam("version") String version, - @QueryParam("serviceModelUuid") String smUuid, - @QueryParam("serviceModelInvariantUuid") String smiUuid, - @QueryParam("serviceModelVersion") String smVer, - @QueryParam("arModelCustomizationUuid") String aUuid - ) { - return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer); - } - - public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) { - QueryAllottedResourceCustomization qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - List<AllottedResourceCustomization> ret = new ArrayList<>(); - Service service = null; - try{ - if (smUuid != null && !"".equals(smUuid)) { - uuid = smUuid; - service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid); - } - else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) { - uuid = serviceModelInvariantUuid; - if (smVer != null && !"".equals(smVer)) { - service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid); - } - else { - service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); - } - } - else if (aUuid != null && !"".equals(aUuid)) { - uuid = aUuid; - ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid); - } - else { - throw(new Exception(NO_MATCHING_PARAMETERS)); - } - - if(service != null) - ret=service.getAllottedCustomizations(); - - if (ret == null || ret.isEmpty()) { - LOGGER.debug ("AllottedResourceCustomization not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryAllottedResourceCustomization(); - } else { - qryResp = new QueryAllottedResourceCustomization(ret); - LOGGER.debug ("AllottedResourceCustomization qryResp="+ qryResp); - } - return respond(version, respStatus, isArray, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryAllottedResourceCustomization", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryAllottedResourceCustomization", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) {}) - .build(); - } - } - - @GET - @Path("vfModules") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @Transactional( readOnly = true) - public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) { - QueryVfModule qryResp; - int respStatus = HttpStatus.SC_OK; - List<VfModuleCustomization> ret = null; - try{ - if(vfModuleModelName != null && !"".equals(vfModuleModelName)){ - VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName); - if(vfModule != null) - ret = vfModule.getVfModuleCustomization(); - }else{ - throw(new Exception(NO_MATCHING_PARAMETERS)); - } - - if(ret == null || ret.isEmpty()){ - LOGGER.debug ("vfModules not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryVfModule(); - }else{ - qryResp = new QueryVfModule(ret); - LOGGER.debug ("vfModules tojsonstring is: "+ qryResp.JSON2(false, false)); - } - return Response - .status(respStatus) - .entity(qryResp.JSON2(false, false)) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - }catch(Exception e){ - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleModelName, "", "queryVfModules", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query VfModules by vfModuleModuleName: ", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) {}) - .build(); - } - } - /** - * Get the tosca csar info from catalog - * <br> - * - * @param smUuid service model uuid - * @return the tosca csar information of the serivce. - * @since ONAP Beijing Release - */ - @GET - @Path("serviceToscaCsar") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) { - int respStatus = HttpStatus.SC_OK; - String entity = ""; - try { - if (smUuid != null && !"".equals(smUuid)) { - LOGGER.debug("Query Csar by service model uuid: " + smUuid); - ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid); - if (toscaCsar != null) { - QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); - entity = serviceCsar.JSON2(false, false); - } else { - respStatus = HttpStatus.SC_NOT_FOUND; - } - } else { - throw (new Exception("Incoming parameter is null or blank")); - } - LOGGER.debug("Query Csar exit"); - return Response - .status(respStatus) - .entity(entity) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, smUuid, "", "ServiceToscaCsar", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query csar by service model uuid: ", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), - CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) { - }) - .build(); - } - } - - /** - * Get the resource recipe info from catalog - * <br> - * - * @param rmUuid resource model uuid - * @return the recipe information of the resource. - * @since ONAP Beijing Release - */ - @GET - @Path("resourceRecipe") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) { - int respStatus = HttpStatus.SC_OK; - String entity = ""; - try { - if (rmUuid != null && !"".equals(rmUuid)) { - LOGGER.debug("Query recipe by resource model uuid: " + rmUuid); - //check vnf and network and ar, the resource could be any resource. - VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid); - Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action); - if (null == recipe) { - NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid); - recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action); - } - if (null == recipe) { - AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid); - recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action); - } - if (recipe != null) { - QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); - entity = resourceRecipe.JSON2(false, false); - } else { - respStatus = HttpStatus.SC_NOT_FOUND; - } - } else { - throw (new Exception("Incoming parameter is null or blank")); - } - LOGGER.debug("Query recipe exit"); - return Response - .status(respStatus) - .entity(entity) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), - CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<CatalogQueryException>(excResp) { - }) - .build(); - } - } + protected static Logger logger = LoggerFactory.getLogger(CatalogDbAdapterRest.class); + private static final boolean IS_ARRAY = true; + + @Autowired + private VnfCustomizationRepository vnfCustomizationRepo; + + @Autowired + private ServiceRepository serviceRepo; + + @Autowired + private NetworkResourceCustomizationRepository networkCustomizationRepo; + + @Autowired + private NetworkResourceRepository networkResourceRepo; + + @Autowired + private AllottedResourceCustomizationRepository allottedCustomizationRepo; + + @Autowired + private ToscaCsarRepository toscaCsarRepo; + + @Autowired + private VFModuleRepository vfModuleRepo; + + @Autowired + private VnfRecipeRepository vnfRecipeRepo; + + @Autowired + private NetworkRecipeRepository networkRecipeRepo; + + @Autowired + private ArRecipeRepository arRecipeRepo; + + @Autowired + private VnfResourceRepository vnfResourceRepo; + + @Autowired + private AllottedResourceRepository arResourceRepo; + + private static final String NO_MATCHING_PARAMETERS = "no matching parameters"; + + public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { + return Response + .status(respStatus) + //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {}) + .entity(qryResp.toJsonString(version, isArray)) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } + + @GET + @Path("vnfResources/{vnfModelCustomizationUuid}") + @Transactional( readOnly = true) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceVnfs ( + @PathParam("version") String version, + @PathParam("vnfModelCustomizationUuid") String vnfUuid + ) { + return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null); + } + + @GET + @Path("serviceVnfs") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceVnfs( + @PathParam("version") String version, + @QueryParam("vnfModelCustomizationUuid") String vnfUuid, + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer, + @QueryParam("serviceModelName") String smName + ) { + return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName); + } + + public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) { + QueryServiceVnfs qryResp = null; + int respStatus = HttpStatus.SC_OK; + List<VnfResourceCustomization> ret = new ArrayList<>(); + Service service = null; + try { + if (vnfUuid != null && !"".equals(vnfUuid)) + ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid); + else if (serviceModelUUID != null && !"".equals(serviceModelUUID)) + service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID); + else if (smiUuid != null && !"".equals(smiUuid)) + if (smVer != null && !"".equals(smVer)) + service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid); + else + service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid); + else if (smName != null && !"".equals(smName)) { + if (smVer != null && !"".equals(smVer)) + service = serviceRepo.findByModelNameAndModelVersion(smName, smVer); + else + service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName); + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if (service == null && ret.isEmpty()) { + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceVnfs(); + }else if( service == null && !ret.isEmpty()){ + qryResp = new QueryServiceVnfs(ret); + } else if (service != null) { + qryResp = new QueryServiceVnfs(service.getVnfCustomizations()); + } + logger.debug ("serviceVnfs qryResp= {}", qryResp); + return respond(version, respStatus, isArray, qryResp); + } catch (Exception e) { + logger.error("Exception - queryServiceVnfs", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) {}) + .build(); + } + } + + @GET + @Path("networkResources/{networkModelCustomizationUuid}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceNetworks ( + @PathParam("version") String version, + @PathParam("networkModelCustomizationUuid") String nUuid + ) { + return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null); + } + + @GET + @Path("serviceNetworks") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceNetworks ( + @PathParam("version") String version, + @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid, + @QueryParam("networkType") String networkType, + @QueryParam("networkModelName") String networkModelName, + @QueryParam("serviceModelUuid") String serviceModelUuid, + @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid, + @QueryParam("serviceModelVersion") String serviceModelVersion, + @QueryParam("networkModelVersion") String networkModelVersion + ) { + if (networkModelName != null && !"".equals(networkModelName)) { + networkType = networkModelName; + } + return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion); + } + + public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) { + QueryServiceNetworks qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List<NetworkResourceCustomization> ret = new ArrayList<>(); + Service service = null; + + try{ + if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) { + uuid = networkModelCustomizationUuid; + ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid); + }else if (networkType != null && !"".equals(networkType)) { + uuid = networkType; + NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType); + if(networkResources != null) + ret=networkResources.getNetworkResourceCustomization(); + } + else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) { + uuid = serviceModelInvariantUuid; + if (serviceModelVersion != null && !"".equals(serviceModelVersion)) { + service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid); + } + else { + service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); + } + }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) { + uuid = serviceModelUuid; + service = serviceRepo.findOneByModelUUID(serviceModelUuid); + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if(service != null) + ret = service.getNetworkCustomizations(); + + if (ret == null || ret.isEmpty()) { + logger.debug ("serviceNetworks not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceNetworks(); + } else { + qryResp = new QueryServiceNetworks(ret); + logger.debug ("serviceNetworks found qryResp= {}", qryResp); + } + return respond(version, respStatus, isArray, qryResp); + } catch (Exception e) { + logger.error ("Exception - queryServiceNetworks", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) {}) + .build(); + } + } + + @GET + @Path("serviceResources") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional(readOnly = true) + public Response serviceResources( + @PathParam("version") String version, + @QueryParam("serviceModelUuid") String modelUUID, + @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID, + @QueryParam("serviceModelVersion") String modelVersion) { + QueryServiceMacroHolder qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + ServiceMacroHolder ret = new ServiceMacroHolder(); + + try{ + if (modelUUID != null && !"".equals(modelUUID)) { + uuid = modelUUID; + logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: {}" , uuid); + Service serv =serviceRepo.findOneByModelUUID(uuid); + ret.setService(serv); + } + else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) { + uuid = modelInvariantUUID; + if (modelVersion != null && !"".equals(modelVersion)) { + logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion); + Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid); + ret.setService(serv); + } + else { + logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: {}" , uuid); + Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); + ret.setService(serv); + } + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if (ret.getService() == null) { + logger.debug ("serviceMacroHolder not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceMacroHolder(); + } else { + qryResp = new QueryServiceMacroHolder(ret); + logger.debug ("serviceMacroHolder qryResp= {}", qryResp); + } + return respond(version, respStatus, IS_ARRAY, qryResp); + } catch (Exception e) { + logger.error ("Exception - queryServiceMacroHolder", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp){} ) + .build(); + } + } + + + @GET + @Path("allottedResources/{arModelCustomizationUuid}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceAllottedResources ( + @PathParam("version") String version, + @PathParam("arModelCustomizationUuid") String aUuid + ) { + return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null); + } + + @GET + @Path("serviceAllottedResources") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceAllottedResources( + @PathParam("version") String version, + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer, + @QueryParam("arModelCustomizationUuid") String aUuid + ) { + return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer); + } + + public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) { + QueryAllottedResourceCustomization qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List<AllottedResourceCustomization> ret = new ArrayList<>(); + Service service = null; + try{ + if (smUuid != null && !"".equals(smUuid)) { + uuid = smUuid; + service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid); + } + else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) { + uuid = serviceModelInvariantUuid; + if (smVer != null && !"".equals(smVer)) { + service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid); + } + else { + service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); + } + } + else if (aUuid != null && !"".equals(aUuid)) { + uuid = aUuid; + ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid); + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if(service != null) + ret=service.getAllottedCustomizations(); + + if (ret == null || ret.isEmpty()) { + logger.debug ("AllottedResourceCustomization not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryAllottedResourceCustomization(); + } else { + qryResp = new QueryAllottedResourceCustomization(ret); + logger.debug ("AllottedResourceCustomization qryResp= {}", qryResp); + } + return respond(version, respStatus, isArray, qryResp); + } catch (Exception e) { + logger.error ("Exception - queryAllottedResourceCustomization", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) {}) + .build(); + } + } + + @GET + @Path("vfModules") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) { + QueryVfModule qryResp; + int respStatus = HttpStatus.SC_OK; + List<VfModuleCustomization> ret = null; + try{ + if(vfModuleModelName != null && !"".equals(vfModuleModelName)){ + VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName); + if(vfModule != null) + ret = vfModule.getVfModuleCustomization(); + }else{ + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if(ret == null || ret.isEmpty()){ + logger.debug ("vfModules not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryVfModule(); + }else{ + qryResp = new QueryVfModule(ret); + if(logger.isDebugEnabled()) + logger.debug ("vfModules tojsonstring is: {}", qryResp.JSON2(false, false)); + } + return Response + .status(respStatus) + .entity(qryResp.JSON2(false, false)) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + }catch(Exception e){ + logger.error ("Exception during query VfModules by vfModuleModuleName: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) {}) + .build(); + } + } + /** + * Get the tosca csar info from catalog + * <br> + * + * @param smUuid service model uuid + * @return the tosca csar information of the serivce. + * @since ONAP Beijing Release + */ + @GET + @Path("serviceToscaCsar") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) { + int respStatus = HttpStatus.SC_OK; + String entity = ""; + try { + if (smUuid != null && !"".equals(smUuid)) { + logger.debug("Query Csar by service model uuid: {}",smUuid); + ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid); + if (toscaCsar != null) { + QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); + entity = serviceCsar.JSON2(false, false); + } else { + respStatus = HttpStatus.SC_NOT_FOUND; + } + } else { + throw (new Exception("Incoming parameter is null or blank")); + } + return Response + .status(respStatus) + .entity(entity) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + logger.error("Exception during query csar by service model uuid: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), + CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) { + }) + .build(); + } + } + + /** + * Get the resource recipe info from catalog + * <br> + * + * @param rmUuid resource model uuid + * @return the recipe information of the resource. + * @since ONAP Beijing Release + */ + @GET + @Path("resourceRecipe") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) { + int respStatus = HttpStatus.SC_OK; + String entity = ""; + try { + if (rmUuid != null && !"".equals(rmUuid)) { + logger.debug("Query recipe by resource model uuid: {}", rmUuid); + //check vnf and network and ar, the resource could be any resource. + VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid); + Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action); + if (null == recipe) { + NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid); + recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action); + } + if (null == recipe) { + AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid); + recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action); + } + if (recipe != null) { + QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); + entity = resourceRecipe.JSON2(false, false); + } else { + respStatus = HttpStatus.SC_NOT_FOUND; + } + } else { + throw new Exception("Incoming parameter is null or blank"); + } + return Response + .status(respStatus) + .entity(entity) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + logger.error("Exception during query recipe by resource model uuid: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), + CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) { + }) + .build(); + } + } } diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql new file mode 100644 index 0000000000..5c9e5aae9f --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql @@ -0,0 +1,92 @@ +SET FOREIGN_KEY_CHECKS=0; +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (1,'CONTRAIL_BASIC','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (2,'CONTRAIL_BASIC','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (3,'CONTRAIL_BASIC','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (4,'CONTRAIL_SHARED','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (5,'CONTRAIL_SHARED','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (6,'CONTRAIL_SHARED','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (7,'CONTRAIL_EXTERNAL','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (8,'CONTRAIL_EXTERNAL','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (9,'CONTRAIL_EXTERNAL','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (10,'CONTRAIL30_BASIC','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (11,'CONTRAIL30_BASIC','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (12,'CONTRAIL30_BASIC','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (13,'CONTRAIL30_MPSCE','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (14,'CONTRAIL30_MPSCE','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (15,'CONTRAIL30_MPSCE','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (16,'VID_DEFAULT','createInstance','VID_DEFAULT recipe to create network if no custom BPMN flow is found','/mso/async/services/CreateNetworkInstance',NULL,180,NULL,'2017-10-05 18:52:03','1.0'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (17,'VID_DEFAULT','updateInstance','VID_DEFAULT recipe to update network if no custom BPMN flow is found','/mso/async/services/UpdateNetworkInstance',NULL,180,NULL,'2017-10-05 18:52:03','1.0'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (18,'VID_DEFAULT','deleteInstance','VID_DEFAULT recipe to delete network if no custom BPMN flow is found','/mso/async/services/DeleteNetworkInstance',NULL,180,NULL,'2017-10-05 18:52:03','1.0'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (19,'CONTRAIL30_L2NODHCP','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (20,'CONTRAIL30_L2NODHCP','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (21,'CONTRAIL30_L2NODHCP','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (22,'CONTRAIL30_GNDIRECT','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (23,'CONTRAIL30_GNDIRECT','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (24,'CONTRAIL30_GNDIRECT','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (25,'SDNC_DEFAULT','createInstance','E2E DEFAULT recipe to create network if no custom BPMN flow is found','/mso/async/services/CreateSDNCNetworkResource',NULL,180,NULL,'2017-04-19 18:52:19','1.0'); +INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (26,'SDNC_DEFAULT','deleteInstance','E2E DEFAULT recipe to delete network if no custom BPMN flow is found','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,NULL,'2017-04-19 18:52:19','1.0'); + +INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('48cc36cc-a9fe-11e7-8b4b-0242ac120002','VID_DEFAULT','48cd56c8-a9fe-11e7-8b4b-0242ac120002','1.0','Default service for VID to use for infra APIH orchestration1707MIGRATED1707MIGRATED','2017-10-05 18:52:03',NULL); +INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('48cc3acd-a9fe-11e7-8b4b-0242ac120002','*','48ce2256-a9fe-11e7-8b4b-0242ac120002','1.0','Default service to use for infra APIH orchestration1707MIGRATED1707MIGRATED','2017-10-05 18:52:03',NULL); + +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (1,'createInstance','1','VID_DEFAULT recipe to create service-instance if no custom BPMN flow is found','/mso/async/services/CreateGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc36cc-a9fe-11e7-8b4b-0242ac120002'); +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (2,'deleteInstance','1','VID_DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc36cc-a9fe-11e7-8b4b-0242ac120002'); +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (3,'createInstance','1','DEFAULT recipe to create service-instance if no custom BPMN flow is found','/mso/async/services/CreateGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc3acd-a9fe-11e7-8b4b-0242ac120002'); +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (4,'deleteInstance','1','DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc3acd-a9fe-11e7-8b4b-0242ac120002'); + +-- +-- Custom Reciepe for the VoLTE service added temporarily +-- + +INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('dfcd7471-16c7-444e-8268-d4c50d90593a','UUI_DEFAULT','dfcd7471-16c7-444e-8268-d4c50d90593a','1.0','Default service for UUI to use for infra APIH orchestration1707MIGRATED1707MIGRATED','2017-10-23 18:52:03',NULL); +INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('f2e1dc69-c8ef-47e9-8b64-966cc87f2110','*','f2e1dc69-c8ef-47e9-8b64-966cc87f2110','1.0','Default service to use for infra APIH orchestration','2018-01-19 18:52:03',NULL); + +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (11,'createInstance','1','Custom recipe to create E2E service-instance if no custom BPMN flow is found','/mso/async/services/CreateCustomE2EServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (12,'deleteInstance','1','Custom recipe to delete E2E service-instance if no custom BPMN flow is found','/mso/async/services/DeleteCustomE2EServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); + +-- Recipe for E2E service update (R2 just support adding/deleting network service) +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (15,'updateInstance','1','Custom recipe to update E2E service-instance if no custom BPMN flow is found','/mso/async/services/UpdateCustomE2EServiceInstance',NULL,180,NULL,'2018-03-05 10:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (16,'scaleInstance','1','Custom recipe to scale E2E service-instance if no custom BPMN flow is found','/mso/async/services/ScaleCustomE2EServiceInstance',NULL,180,NULL,'2018-05-15 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); + +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (13,'createInstance','1','DEFAULT recipe to create service-instance if no custom BPMN flow is found','/mso/async/services/CreateGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','f2e1dc69-c8ef-47e9-8b64-966cc87f2110'); +INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (14,'deleteInstance','1','DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','f2e1dc69-c8ef-47e9-8b64-966cc87f2110'); + +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (1,'*','VOLUME_GROUP',NULL,'CREATE',NULL,'1','Recipe Match All for','/mso/async/services/createCinderVolumeV1',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (2,'*','VOLUME_GROUP',NULL,'DELETE',NULL,'1','Recipe Match All for','/mso/async/services/deleteCinderVolumeV1',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (3,'*','VOLUME_GROUP',NULL,'UPDATE',NULL,'1','Recipe Match All for','/mso/async/services/updateCinderVolumeV1',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (4,NULL,'VOLUME_GROUP',NULL,'CREATE_VF_MODULE_VOL',NULL,'1','Recipe Match All for','/mso/async/services/CreateVfModuleVolume',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (5,NULL,'VOLUME_GROUP',NULL,'DELETE_VF_MODULE_VOL',NULL,'1','Recipe Match All for','/mso/async/services/DeleteVfModuleVolume',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (6,NULL,'VOLUME_GROUP',NULL,'UPDATE_VF_MODULE_VOL',NULL,'1','Recipe Match All for','/mso/async/services/UpdateVfModuleVolume',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (7,NULL,'volumeGroup','VID_DEFAULT','createInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/CreateVfModuleVolumeInfraV1',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (8,NULL,'volumeGroup','VID_DEFAULT','deleteInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/DeleteVfModuleVolumeInfraV1',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (9,NULL,'volumeGroup','VID_DEFAULT','updateInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/UpdateVfModuleVolumeInfraV1',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10,NULL,'vfModule','VID_DEFAULT','createInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/CreateVfModuleInfra',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (11,NULL,'vfModule','VID_DEFAULT','deleteInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/DeleteVfModuleInfra',null,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (12,NULL,'vfModule','VID_DEFAULT','updateInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/UpdateVfModuleInfra',null,180,'2017-10-05 18:52:03'); + +-- +-- Default Reciepe for the VNF componnets added start #SO-334, to unblock the VNF operations +-- + +INSERT INTO `vnf_components_recipe` (`VNF_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (NULL,'POLICY_DEFAULT','createInstance','1','Recipe Match POLICY_DEFAULT for VF Modules if no custom flow exists','/mso/async/services/CreateVfModuleInfra','vfModule',NULL,180,NULL); +INSERT INTO `vnf_components_recipe` (`VNF_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (NULL,'POLICY_DEFAULT','updateInstance','1','Recipe Match POLICY_DEFAULT for VF Modules if no custom flow exists','/mso/async/services/UpdateVfModuleInfra','vfModule',NULL,180,NULL); +INSERT INTO `vnf_components_recipe` (`VNF_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (NULL,'POLICY_DEFAULT','deleteInstance','1','Recipe Match POLICY_DEFAULT for VF Modules if no custom flow exists','/mso/async/services/DeleteVfModuleInfra','vfModule',NULL,180,NULL); +-- +-- Default Reciepe for the VNF componnets added End +-- + +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (1,NULL,'CREATE',NULL,'1','*','Recipe Match All for VNFs if no custom flow exists','/mso/workflow/services/CreateGenericVNFV1',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (2,NULL,'DELETE',NULL,'1','*','Recipe Match All for VNFs if no custom flow exists','/mso/async/services//deleteGenericVNFV1',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (3,NULL,'UPDATE',NULL,'1','*','Recipe Match All for VNFs if no custom flow exists','/mso/workflow/services/updateGenericVNFV1',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (4,'*','CREATE_VF_MODULE',NULL,'1',NULL,'Recipe Match All for VNFs if no custom flow exists','/mso/async/services/CreateVfModule',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (5,'*','DELETE_VF_MODULE',NULL,'1',NULL,'Recipe Match All for VNFs if no custom flow exists','/mso/async/services/DeleteVfModule',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (6,'*','UPDATE_VF_MODULE',NULL,'1',NULL,'Recipe Match All for VNFs if no custom flow exists','/mso/async/services/UpdateVfModule',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (7,NULL,'createInstance',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to create VNF if no custom BPMN flow is found','/mso/async/services/CreateVnfInfra',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (8,NULL,'deleteInstance',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found','/mso/async/services/DeleteVnfInfra',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (9,NULL,'createInstance',NULL,'1','RESOURCE_NS_DEFAULT','NS default recipe to create network service if no custom BPMN flow is found','/mso/async/services/CreateVFCNetworkService',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10,NULL,'deleteInstance',NULL,'1','RESOURCE_NS_DEFAULT','NS default recipe to delete network service if no custom BPMN flow is found','/mso/async/services/DeleteVFCNetworkService',NULL,180,'2017-10-05 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (11,NULL,'createInstance',NULL,'1','NS_DEFAULT','default custom E2E recipe to create NS if no custom BPMN flow is found','/mso/async/services/CreateVFCNSResource',NULL,180,'2018-04-18 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (12,NULL,'deleteInstance',NULL,'1','NS_DEFAULT','default custom E2E recipe to delete NS if no custom BPMN flow is found','/mso/async/services/DeleteVFCNSResource',NULL,180,'2018-04-18 18:52:03'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (13,NULL,'inPlaceSoftwareUpdate',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to update VNF software if no custom BPMN flow is found','/mso/async/services/VnfInPlaceUpdate',NULL,180,'2018-05-23 11:00:00'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (14,NULL,'applyUpdatedConfig',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to apply updated VNF config if no custom BPMN flow is found','/mso/async/services/VnfConfigUpdate',NULL,180,'2018-05-23 11:00:00'); +SET FOREIGN_KEY_CHECKS=1; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.0__AddModelAndModelRecipe.sql index 0042888117..0042888117 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.0__AddModelAndModelRecipe.sql diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.1__AddCloudConfig.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.1__AddCloudConfig.sql new file mode 100644 index 0000000000..1028aa61b1 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.1__AddCloudConfig.sql @@ -0,0 +1,47 @@ + +CREATE TABLE IF NOT EXISTS `identity_services` ( + `ID` varchar(50) NOT NULL, + `IDENTITY_URL` varchar(200) DEFAULT NULL, + `MSO_ID` varchar(255) DEFAULT NULL, + `MSO_PASS` varchar(255) DEFAULT NULL, + `ADMIN_TENANT` varchar(50) DEFAULT NULL, + `MEMBER_ROLE` varchar(50) DEFAULT NULL, + `TENANT_METADATA` tinyint(1) DEFAULT 0, + `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, + `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + +CREATE TABLE IF NOT EXISTS `cloudify_managers` ( + `ID` varchar(50) NOT NULL, + `CLOUDIFY_URL` varchar(200) DEFAULT NULL, + `USERNAME` varchar(255) DEFAULT NULL, + `PASSWORD` varchar(255) DEFAULT NULL, + `VERSION` varchar(20) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + +CREATE TABLE IF NOT EXISTS `cloud_sites` ( + `ID` varchar(50) NOT NULL, + `REGION_ID` varchar(11) DEFAULT NULL, + `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, + `CLOUD_VERSION` varchar(20) DEFAULT NULL, + `CLLI` varchar(11) DEFAULT NULL, + `CLOUDIFY_ID` varchar(50) DEFAULT NULL, + `PLATFORM` varchar(50) DEFAULT NULL, + `ORCHESTRATOR` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`), + KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), + CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) +) ;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql new file mode 100644 index 0000000000..b3d8b98176 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql @@ -0,0 +1,5 @@ +use catalogdb; + +INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID) +VALUES +('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT'); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/afterMigrate.sql deleted file mode 100644 index b03c0996b0..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/afterMigrate.sql +++ /dev/null @@ -1,166 +0,0 @@ -# INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','Contrail30-l2nodhcp','1',NULL,'heat_template_version: 2015-04-30\n\ndescription:\n HOT template that creates a Contrail Virtual Network with L2NODHCP\n\nparameters:\n network_name:\n type: string\n description: Name of direct network (e.g. core, dmz)\n default: ECOMPNetwork\n shared:\n type: boolean\n description: Shared amongst tenants\n default: False\n external:\n type: boolean\n description: router_external for the VirtualNetwork\n default: False\n route_targets:\n type: comma_delimited_list\n description: Network route-targets (RT)\n default: \"\"\n subnet_list:\n type: json\n description: Network subnets\n default: []\n policy_refs:\n type: comma_delimited_list\n description: Policies referenced by Network\n default: \"\"\n policy_refsdata:\n type: json\n description: Policies referenced by Network\n default: []\n route_table_refs:\n type: comma_delimited_list\n description: Route Tables referenced by Network\n default: \"\"\n virtual_network_properties_allow_transit:\n type: boolean\n description: allow_transit for the VirtualNetwork\n default: True\n virtual_network_properties_forwarding_mode:\n type: string\n description: forwarding_mode for the VirtualNetwork\n default: l2\n virtual_network_properties_rpf:\n type: string\n description: rpf for the VirtualNetwork\n default: disable\n flood_unknown_unicast:\n type: boolean\n description: flood_unknown_unicast for the VirtualNetwork\n default: True\n\noutputs:\n network_id:\n description: Openstack network identifier\n value: { get_resource: network }\n network_fqdn:\n description: Openstack network identifier\n value: {list_join: [\':\', { get_attr: [network, fq_name] } ] }\n\nresources:\n networkIpam:\n type: OS::ContrailV2::NetworkIpam\n properties:\n name: { get_param: network_name }\n\n network:\n type: OS::ContrailV2::VirtualNetwork\n properties:\n name: { get_param: network_name }\n is_shared: {get_param: shared}\n router_external: { get_param: external }\n route_target_list:\n {\n route_target_list_route_target: { get_param: route_targets }\n }\n network_ipam_refs: [{ get_resource: networkIpam }]\n network_ipam_refs_data:\n [\n {\n network_ipam_refs_data_ipam_subnets: { get_param: subnet_list }\n }\n ]\n network_policy_refs: { get_param: policy_refs }\n network_policy_refs_data: { get_param: policy_refsdata }\n route_table_refs: { get_param: route_table_refs }\n flood_unknown_unicast: { get_param: flood_unknown_unicast } \n virtual_network_properties:\n {\n virtual_network_properties_allow_transit: { get_param: virtual_network_properties_allow_transit },\n virtual_network_properties_forwarding_mode: { get_param: virtual_network_properties_forwarding_mode },\n virtual_network_properties_rpf: { get_param: virtual_network_properties_rpf },\n }\n',10,'MANUAL RECORD','2017-10-05 18:52:03'); -# -# INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','Contrail30-gndirect','1',NULL,'heat_template_version: 2015-04-30\n\ndescription:\n HOT template that creates a Contrail Virtual Network for GNDIRECT\n\nparameters:\n network_name:\n type: string\n description: Name of direct network (e.g. core, dmz)\n default: ECOMPNetwork\n shared:\n type: boolean\n description: Shared amongst tenants\n default: False\n external:\n type: boolean\n description: router_external for the VirtualNetwork\n default: False\n route_targets:\n type: comma_delimited_list\n description: Network route-targets (RT)\n default: \"\"\n subnet_list:\n type: json\n description: Network subnets\n default: []\n policy_refs:\n type: comma_delimited_list\n description: Policies referenced by Network\n default: \"\"\n policy_refsdata:\n type: json\n description: Policies referenced by Network\n default: []\n route_table_refs:\n type: comma_delimited_list\n description: Route Tables referenced by Network\n default: \"\"\n virtual_network_properties_rpf:\n type: string\n description: rpf for the VirtualNetwork\n default: disable\n\noutputs:\n network_id:\n description: Openstack network identifier\n value: { get_resource: network }\n network_fqdn:\n description: Openstack network identifier\n value: {list_join: [\':\', { get_attr: [network, fq_name] } ] }\n\nresources:\n networkIpam:\n type: OS::ContrailV2::NetworkIpam\n properties:\n name: { get_param: network_name }\n\n network:\n type: OS::ContrailV2::VirtualNetwork\n properties:\n name: { get_param: network_name }\n is_shared: {get_param: shared}\n router_external: { get_param: external }\n route_target_list:\n {\n route_target_list_route_target: { get_param: route_targets }\n }\n network_ipam_refs: [{ get_resource: networkIpam }]\n network_ipam_refs_data:\n [\n {\n network_ipam_refs_data_ipam_subnets: { get_param: subnet_list }\n }\n ]\n network_policy_refs: { get_param: policy_refs }\n network_policy_refs_data: { get_param: policy_refsdata }\n route_table_refs: { get_param: route_table_refs }\n virtual_network_properties:\n {\n virtual_network_properties_rpf: { get_param: virtual_network_properties_rpf }\n }\n',10,'MANUAL RECORD','2017-10-05 18:52:03'); -# -# INSERT INTO `heat_template` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`BODY`,`TIMEOUT_MINUTES`,`DESCRIPTION`,`CREATION_TIMESTAMP`,`ARTIFACT_CHECKSUM`) VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a','Generic NeutronNet','1','heat_template_version: 2013-05-23\n\ndescription:\n HOT template that creates a Generic Neutron Network\n\nparameters:\n network_name:\n type: string\n description: Name of direct network (e.g. core, dmz)\n default: ECOMPNetwork\n network_subnet_name:\n type: string\n description: Name of subnet network (e.g. core, dmz)\n default: ECOMPNetwork\n network_subnet_cidr:\n type: string\n description: CIDR of subnet network (e.g. core, dmz)\n default: 10.0.0.0/16\n\noutputs:\n network_id:\n description: Openstack network identifier\n value: { get_resource: network }\n network_fqdn:\n description: Openstack network identifier\n value: {list_join: [\':\', { get_attr: [network, fq_name] } ] }\n\nresources:\n network:\n type: OS::Neutron::Net\n properties:\n name: {get_param: network_name }\n\n subnet:\n type: OS::Neutron::Subnet\n properties:\n name: { get_param: network_subnet_name }\n network_id: { get_resource: network }\n cidr: { get_param: network_subnet_cidr }\n enable_dhcp: false\n',10,'Generic Neutron Template','2017-10-26 14:44:00', 'MANUAL RECORD'); -# -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','external','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','flood_unknown_unicast','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','network_name','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','policy_refs','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','policy_refsdata','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','route_table_refs','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','route_targets','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','shared','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','virtual_network_properties_allow_transit','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','virtual_network_properties_forwarding_mode','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c198-a9fe-11e7-8b4b-0242ac120002','virtual_network_properties_rpf','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','external','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','network_name','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','policy_refs','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','policy_refsdata','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','route_table_refs','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','route_targets','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','shared','\0','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('4885c7a1-a9fe-11e7-8b4b-0242ac120002','virtual_network_properties_rpf','\0','string',NULL); -# -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (1,'CONTRAIL_BASIC','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (2,'CONTRAIL_BASIC','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (3,'CONTRAIL_BASIC','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (4,'CONTRAIL_SHARED','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (5,'CONTRAIL_SHARED','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (6,'CONTRAIL_SHARED','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (7,'CONTRAIL_EXTERNAL','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (8,'CONTRAIL_EXTERNAL','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (9,'CONTRAIL_EXTERNAL','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (10,'CONTRAIL30_BASIC','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (11,'CONTRAIL30_BASIC','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (12,'CONTRAIL30_BASIC','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (13,'CONTRAIL30_MPSCE','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (14,'CONTRAIL30_MPSCE','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (15,'CONTRAIL30_MPSCE','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (16,'VID_DEFAULT','createInstance','VID_DEFAULT recipe to create network if no custom BPMN flow is found','/mso/async/services/CreateNetworkInstance',NULL,180,NULL,'2017-10-05 18:52:03','1.0'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (17,'VID_DEFAULT','updateInstance','VID_DEFAULT recipe to update network if no custom BPMN flow is found','/mso/async/services/UpdateNetworkInstance',NULL,180,NULL,'2017-10-05 18:52:03','1.0'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (18,'VID_DEFAULT','deleteInstance','VID_DEFAULT recipe to delete network if no custom BPMN flow is found','/mso/async/services/DeleteNetworkInstance',NULL,180,NULL,'2017-10-05 18:52:03','1.0'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (19,'CONTRAIL30_L2NODHCP','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (20,'CONTRAIL30_L2NODHCP','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (21,'CONTRAIL30_L2NODHCP','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (22,'CONTRAIL30_GNDIRECT','CREATE',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (23,'CONTRAIL30_GNDIRECT','UPDATE',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (24,'CONTRAIL30_GNDIRECT','DELETE',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL,'2017-10-05 18:52:03','1'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (25,'SDNC_DEFAULT','createInstance','E2E DEFAULT recipe to create network if no custom BPMN flow is found','/mso/async/services/CreateSDNCNetworkResource',NULL,180,NULL,'2017-04-19 18:52:19','1.0'); -# INSERT INTO `network_recipe` (`id`, `MODEL_NAME`, `ACTION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`, `CREATION_TIMESTAMP`, `VERSION_STR`) VALUES (26,'SDNC_DEFAULT','deleteInstance','E2E DEFAULT recipe to delete network if no custom BPMN flow is found','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,NULL,'2017-04-19 18:52:19','1.0'); -# -# INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('48cc36cc-a9fe-11e7-8b4b-0242ac120002','VID_DEFAULT','48cd56c8-a9fe-11e7-8b4b-0242ac120002','1.0','Default service for VID to use for infra APIH orchestration1707MIGRATED1707MIGRATED','2017-10-05 18:52:03',NULL); -# INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('48cc3acd-a9fe-11e7-8b4b-0242ac120002','*','48ce2256-a9fe-11e7-8b4b-0242ac120002','1.0','Default service to use for infra APIH orchestration1707MIGRATED1707MIGRATED','2017-10-05 18:52:03',NULL); -# -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (1,'createInstance','1','VID_DEFAULT recipe to create service-instance if no custom BPMN flow is found','/mso/async/services/CreateGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc36cc-a9fe-11e7-8b4b-0242ac120002'); -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (2,'deleteInstance','1','VID_DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc36cc-a9fe-11e7-8b4b-0242ac120002'); -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (3,'createInstance','1','DEFAULT recipe to create service-instance if no custom BPMN flow is found','/mso/async/services/CreateGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc3acd-a9fe-11e7-8b4b-0242ac120002'); -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (4,'deleteInstance','1','DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc3acd-a9fe-11e7-8b4b-0242ac120002'); -# -# -- -# -- Custom Reciepe for the VoLTE service added temporarily -# -- -# -# INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('dfcd7471-16c7-444e-8268-d4c50d90593a','UUI_DEFAULT','dfcd7471-16c7-444e-8268-d4c50d90593a','1.0','Default service for UUI to use for infra APIH orchestration1707MIGRATED1707MIGRATED','2017-10-23 18:52:03',NULL); -# INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('f2e1dc69-c8ef-47e9-8b64-966cc87f2110','*','f2e1dc69-c8ef-47e9-8b64-966cc87f2110','1.0','Default service to use for infra APIH orchestration','2018-01-19 18:52:03',NULL); -# -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (11,'createInstance','1','Custom recipe to create E2E service-instance if no custom BPMN flow is found','/mso/async/services/CreateCustomE2EServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (12,'deleteInstance','1','Custom recipe to delete E2E service-instance if no custom BPMN flow is found','/mso/async/services/DeleteCustomE2EServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); -# -# -- Recipe for E2E service update (R2 just support adding/deleting network service) -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (15,'updateInstance','1','Custom recipe to update E2E service-instance if no custom BPMN flow is found','/mso/async/services/UpdateCustomE2EServiceInstance',NULL,180,NULL,'2018-03-05 10:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (16,'scaleInstance','1','Custom recipe to scale E2E service-instance if no custom BPMN flow is found','/mso/async/services/ScaleCustomE2EServiceInstance',NULL,180,NULL,'2018-05-15 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a'); -# -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (13,'createInstance','1','DEFAULT recipe to create service-instance if no custom BPMN flow is found','/mso/async/services/CreateGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','f2e1dc69-c8ef-47e9-8b64-966cc87f2110'); -# INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (14,'deleteInstance','1','DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','f2e1dc69-c8ef-47e9-8b64-966cc87f2110'); -# -# INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `AIC_VERSION_MIN`, `AIC_VERSION_MAX`) VALUES ('CONTRAIL30_GNDIRECT','4885c7a1-a9fe-11e7-8b4b-0242ac120002','3.0',NULL); -# INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `AIC_VERSION_MIN`, `AIC_VERSION_MAX`) VALUES ('CONTRAIL30_L2NODHCP','4885c198-a9fe-11e7-8b4b-0242ac120002','3.0',NULL); -# INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` ) VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','NULL'); -# -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (1,'*','VOLUME_GROUP',NULL,'CREATE',NULL,'1','Recipe Match All for','/mso/async/services/createCinderVolumeV1',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (2,'*','VOLUME_GROUP',NULL,'DELETE',NULL,'1','Recipe Match All for','/mso/async/services/deleteCinderVolumeV1',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (3,'*','VOLUME_GROUP',NULL,'UPDATE',NULL,'1','Recipe Match All for','/mso/async/services/updateCinderVolumeV1',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (4,NULL,'VOLUME_GROUP',NULL,'CREATE_VF_MODULE_VOL',NULL,'1','Recipe Match All for','/mso/async/services/CreateVfModuleVolume',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (5,NULL,'VOLUME_GROUP',NULL,'DELETE_VF_MODULE_VOL',NULL,'1','Recipe Match All for','/mso/async/services/DeleteVfModuleVolume',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (6,NULL,'VOLUME_GROUP',NULL,'UPDATE_VF_MODULE_VOL',NULL,'1','Recipe Match All for','/mso/async/services/UpdateVfModuleVolume',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (7,NULL,'volumeGroup','VID_DEFAULT','createInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/CreateVfModuleVolumeInfraV1',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (8,NULL,'volumeGroup','VID_DEFAULT','deleteInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/DeleteVfModuleVolumeInfraV1',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (9,NULL,'volumeGroup','VID_DEFAULT','updateInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/UpdateVfModuleVolumeInfraV1',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10,NULL,'vfModule','VID_DEFAULT','createInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/CreateVfModuleInfra',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (11,NULL,'vfModule','VID_DEFAULT','deleteInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/DeleteVfModuleInfra',null,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_components_recipe` (`id`, `VNF_TYPE`, `VNF_COMPONENT_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `SERVICE_TYPE`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (12,NULL,'vfModule','VID_DEFAULT','updateInstance',NULL,'1','VID_DEFAULT recipe t','/mso/async/services/UpdateVfModuleInfra',null,180,'2017-10-05 18:52:03'); -# -# -- -# -- Default Reciepe for the VNF componnets added start #SO-334, to unblock the VNF operations -# -- -# -# INSERT INTO `vnf_components_recipe` (`VNF_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (NULL,'POLICY_DEFAULT','createInstance','1','Recipe Match POLICY_DEFAULT for VF Modules if no custom flow exists','/mso/async/services/CreateVfModuleInfra','vfModule',NULL,180,NULL); -# INSERT INTO `vnf_components_recipe` (`VNF_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (NULL,'POLICY_DEFAULT','updateInstance','1','Recipe Match POLICY_DEFAULT for VF Modules if no custom flow exists','/mso/async/services/UpdateVfModuleInfra','vfModule',NULL,180,NULL); -# INSERT INTO `vnf_components_recipe` (`VNF_TYPE`, `VF_MODULE_MODEL_UUID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (NULL,'POLICY_DEFAULT','deleteInstance','1','Recipe Match POLICY_DEFAULT for VF Modules if no custom flow exists','/mso/async/services/DeleteVfModuleInfra','vfModule',NULL,180,NULL); -# -- -# -- Default Reciepe for the VNF componnets added End -# -- -# -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (1,NULL,'CREATE',NULL,'1','*','Recipe Match All for VNFs if no custom flow exists','/mso/workflow/services/CreateGenericVNFV1',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (2,NULL,'DELETE',NULL,'1','*','Recipe Match All for VNFs if no custom flow exists','/mso/async/services//deleteGenericVNFV1',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (3,NULL,'UPDATE',NULL,'1','*','Recipe Match All for VNFs if no custom flow exists','/mso/workflow/services/updateGenericVNFV1',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (4,'*','CREATE_VF_MODULE',NULL,'1',NULL,'Recipe Match All for VNFs if no custom flow exists','/mso/async/services/CreateVfModule',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (5,'*','DELETE_VF_MODULE',NULL,'1',NULL,'Recipe Match All for VNFs if no custom flow exists','/mso/async/services/DeleteVfModule',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (6,'*','UPDATE_VF_MODULE',NULL,'1',NULL,'Recipe Match All for VNFs if no custom flow exists','/mso/async/services/UpdateVfModule',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (7,NULL,'createInstance',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to create VNF if no custom BPMN flow is found','/mso/async/services/CreateVnfInfra',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (8,NULL,'deleteInstance',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found','/mso/async/services/DeleteVnfInfra',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (9,NULL,'createInstance',NULL,'1','RESOURCE_NS_DEFAULT','NS default recipe to create network service if no custom BPMN flow is found','/mso/async/services/CreateVFCNetworkService',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10,NULL,'deleteInstance',NULL,'1','RESOURCE_NS_DEFAULT','NS default recipe to delete network service if no custom BPMN flow is found','/mso/async/services/DeleteVFCNetworkService',NULL,180,'2017-10-05 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (11,NULL,'createInstance',NULL,'1','NS_DEFAULT','default custom E2E recipe to create NS if no custom BPMN flow is found','/mso/async/services/CreateVFCNSResource',NULL,180,'2018-04-18 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (12,NULL,'deleteInstance',NULL,'1','NS_DEFAULT','default custom E2E recipe to delete NS if no custom BPMN flow is found','/mso/async/services/DeleteVFCNSResource',NULL,180,'2018-04-18 18:52:03'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (13,NULL,'inPlaceSoftwareUpdate',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to update VNF software if no custom BPMN flow is found','/mso/async/services/VnfInPlaceUpdate',NULL,180,'2018-05-23 11:00:00'); -# INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (14,NULL,'applyUpdatedConfig',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to apply updated VNF config if no custom BPMN flow is found','/mso/async/services/VnfConfigUpdate',NULL,180,'2018-05-23 11:00:00'); -# -# -- -# -- Start Former create_mso_db-demo-vfw.sql -# -- -# -# INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('EnvArtifact-UUID3','base_vfw.env','1.0','base_vfw ENV file','parameters:\n vfw_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)\n vfw_flavor_name: 4 GB General Purpose v1\n public_net_id: 00000000-0000-0000-0000-000000000000\n unprotected_private_net_id: zdfw1fwl01_unprotected\n protected_private_net_id: zdfw1fwl01_protected\n ecomp_private_net_id: oam_ecomp\n unprotected_private_net_cidr: 192.168.10.0/24\n protected_private_net_cidr: 192.168.20.0/24\n ecomp_private_net_cidr: 192.168.9.0/24\n vfw_private_ip_0: 192.168.10.100\n vfw_private_ip_1: 192.168.20.100\n vfw_private_ip_2: 192.168.9.100\n vpg_private_ip_0: 192.168.10.200\n vpg_private_ip_1: 192.168.9.200\n vsn_private_ip_0: 192.168.20.250\n vsn_private_ip_1: 192.168.9.250\n vfw_name_0: zdfw1fwl01fwl01\n vpg_name_0: zdfw1fwl01pgn01\n vsn_name_0: zdfw1fwl01snk01\n vnf_id: vFirewall_demo_app\n vf_module_id: vFirewall\n webserver_ip: 162.242.237.182\n dcae_collector_ip: 192.168.9.1\n key_name: vfw_key\n pub_key: INSERT YOUR PUBLIC KEY HERE','MANUAL RECORD','2016-11-14 13:04:07'); -# -# INSERT INTO `heat_template` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `TIMEOUT_MINUTES`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('Artifact-UUID3','base_vfw.yaml','1.0','Base VFW Heat','heat_template_version: 2013-05-23\n\ndescription: Heat template to deploy vFirewall demo app for OpenECOMP\n\nparameters:\n vfw_image_name:\n type: string\n label: Image name or ID\n description: Image to be used for compute instance\n vfw_flavor_name:\n type: string\n label: Flavor\n description: Type of instance (flavor) to be used\n public_net_id:\n type: string\n label: Public network name or ID\n description: Public network that enables remote connection to VNF\n unprotected_private_net_id:\n type: string\n label: Unprotected private network name or ID\n description: Private network that connects vPacketGenerator with vFirewall\n protected_private_net_id:\n type: string\n label: Protected private network name or ID\n description: Private network that connects vFirewall with vSink\n ecomp_private_net_id:\n type: string\n label: ECOMP management network name or ID\n description: Private network that connects ECOMP component and the VNF\n unprotected_private_net_cidr:\n type: string\n label: Unprotected private network CIDR\n description: The CIDR of the unprotected private network\n protected_private_net_cidr:\n type: string\n label: Protected private network CIDR\n description: The CIDR of the protected private network\n ecomp_private_net_cidr:\n type: string\n label: ECOMP private network CIDR\n description: The CIDR of the protected private network\n vfw_private_ip_0:\n type: string\n label: vFirewall private IP address towards the unprotected network\n description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator\n vfw_private_ip_1:\n type: string\n label: vFirewall private IP address towards the protected network\n description: Private IP address that is assigned to the vFirewall to communicate with the vSink\n vfw_private_ip_2:\n type: string\n label: vFirewall private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vFirewall to communicate with ECOMP components\n vpg_private_ip_0:\n type: string\n label: vPacketGenerator private IP address towards the unprotected network\n description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall\n vpg_private_ip_1:\n type: string\n label: vPacketGenerator private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vPacketGenerator to communicate with ECOMP components\n vsn_private_ip_0:\n type: string\n label: vSink private IP address towards the protected network\n description: Private IP address that is assigned to the vSink to communicate with the vFirewall\n vsn_private_ip_1:\n type: string\n label: vSink private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vSink to communicate with ECOMP components\n vfw_name_0:\n type: string\n label: vFirewall name\n description: Name of the vFirewall\n vpg_name_0:\n type: string\n label: vPacketGenerator name\n description: Name of the vPacketGenerator\n vsn_name_0:\n type: string\n label: vSink name\n description: Name of the vSink\n vnf_id:\n type: string\n label: VNF ID\n description: The VNF ID is provided by ECOMP\n vf_module_id:\n type: string\n label: vFirewall module ID\n description: The vFirewall Module ID is provided by ECOMP\n webserver_ip:\n type: string\n label: Webserver IP address\n description: IP address of the webserver that hosts the source code and binaries\n dcae_collector_ip:\n type: string\n label: DCAE collector IP address\n description: IP address of the DCAE collector\n key_name:\n type: string\n label: Key pair name\n description: Public/Private key pair name\n pub_key:\n type: string\n label: Public key\n description: Public key to be installed on the compute instance\n\nresources:\n my_keypair:\n type: OS::Nova::KeyPair\n properties:\n name: { get_param: key_name }\n public_key: { get_param: pub_key }\n save_private_key: false\n\n unprotected_private_network:\n type: OS::Neutron::Net\n properties:\n name: { get_param: unprotected_private_net_id }\n\n protected_private_network:\n type: OS::Neutron::Net\n properties:\n name: { get_param: protected_private_net_id }\n\n unprotected_private_subnet:\n type: OS::Neutron::Subnet\n properties:\n network_id: { get_resource: unprotected_private_network }\n cidr: { get_param: unprotected_private_net_cidr }\n\n protected_private_subnet:\n type: OS::Neutron::Subnet\n properties:\n network_id: { get_resource: protected_private_network }\n cidr: { get_param: protected_private_net_cidr }\n\n vfw_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vfw_image_name }\n flavor: { get_param: vfw_flavor_name }\n name: { get_param: vfw_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vfw_private_0_port }\n - port: { get_resource: vfw_private_1_port }\n - port: { get_resource: vfw_private_2_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __dcae_collector_ip__ : { get_param: dcae_collector_ip }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n DCAE_COLLECTOR_IP=__dcae_collector_ip__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_firewall_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vfirewall.sh\n chmod +x v_firewall_init.sh\n chmod +x vfirewall.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $DCAE_COLLECTOR_IP > config/dcae_collector_ip.txt\n echo \"no\" > config/install.txt\n mv vfirewall.sh /etc/init.d\n sudo update-rc.d vfirewall.sh defaults\n ./v_firewall_init.sh\n\n vfw_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: unprotected_private_network }\n fixed_ips: [{\"subnet\": { get_resource: unprotected_private_subnet }, \"ip_address\": { get_param: vfw_private_ip_0 }}]\n\n vfw_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: protected_private_network }\n fixed_ips: [{\"subnet\": { get_resource: protected_private_subnet }, \"ip_address\": { get_param: vfw_private_ip_1 }}]\n\n vfw_private_2_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{\"subnet\": { get_param: ecomp_private_net_id }, \"ip_address\": { get_param: vfw_private_ip_2 }}]\n\n vpg_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vfw_image_name }\n flavor: { get_param: vfw_flavor_name }\n name: { get_param: vpg_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vpg_private_0_port }\n - port: { get_resource: vpg_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __fw_ipaddr__: { get_param: vfw_private_ip_0 }\n __protected_net_cidr__: { get_param: protected_private_net_cidr }\n __sink_ipaddr__: { get_param: vsn_private_ip_0 }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n FW_IPADDR=__fw_ipaddr__\n PROTECTED_NET_CIDR=__protected_net_cidr__\n SINK_IPADDR=__sink_ipaddr__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_packetgen_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vpacketgen.sh\n chmod +x v_packetgen_init.sh\n chmod +x vpacketgen.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $FW_IPADDR > config/fw_ipaddr.txt\n echo $PROTECTED_NET_CIDR > config/protected_net_cidr.txt\n echo $SINK_IPADDR > config/sink_ipaddr.txt\n echo \"no\" > config/install.txt\n mv vpacketgen.sh /etc/init.d\n sudo update-rc.d vpacketgen.sh defaults\n ./v_packetgen_init.sh\n\n vpg_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: unprotected_private_network }\n fixed_ips: [{\"subnet\": { get_resource: unprotected_private_subnet }, \"ip_address\": { get_param: vpg_private_ip_0 }}]\n\n vpg_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{\"subnet\": { get_param: ecomp_private_net_id }, \"ip_address\": { get_param: vpg_private_ip_1 }}]\n\n vsn_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vfw_image_name }\n flavor: { get_param: vfw_flavor_name }\n name: { get_param: vsn_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vsn_private_0_port }\n - port: { get_resource: vsn_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __protected_net_gw__: { get_param: vfw_private_ip_1 }\n __unprotected_net__: { get_param: unprotected_private_net_cidr }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n PROTECTED_NET_GW=__protected_net_gw__\n UNPROTECTED_NET=__unprotected_net__\n UNPROTECTED_NET=$(echo $UNPROTECTED_NET | cut -d\'/\' -f1)\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_sink_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vsink.sh\n chmod +x v_sink_init.sh\n chmod +x vsink.sh\n echo $PROTECTED_NET_GW > config/protected_net_gw.txt\n echo $UNPROTECTED_NET > config/unprotected_net.txt\n echo \"no\" > config/install.txt\n mv vsink.sh /etc/init.d\n sudo update-rc.d vsink.sh defaults\n ./v_sink_init.sh\n\n vsn_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: protected_private_network }\n fixed_ips: [{\"subnet\": { get_resource: protected_private_subnet }, \"ip_address\": { get_param: vsn_private_ip_0 }}]\n\n vsn_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{\"subnet\": { get_param: ecomp_private_net_id }, \"ip_address\": { get_param: vsn_private_ip_1 }}]\n \n',300,'MANUAL RECORD','2016-11-14 13:04:07'); -# -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','dcae_collector_ip','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','ecomp_private_net_cidr','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','ecomp_private_net_id','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','key_name','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','protected_private_net_cidr','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','protected_private_net_id','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','public_net_id','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','pub_key','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','unprotected_private_net_cidr','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','unprotected_private_net_id','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vfw_flavor_name','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vfw_image_name','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vfw_name_0','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vfw_private_ip_0','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vfw_private_ip_1','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vfw_private_ip_2','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vf_module_id','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vnf_id','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vpg_name_0','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vpg_private_ip_0','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vpg_private_ip_1','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vsn_name_0','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vsn_private_ip_0','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','vsn_private_ip_1','','string',NULL); -# INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`) VALUES ('Artifact-UUID3','webserver_ip','','string',NULL); -# -# INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('2e34774e-715e-4fd5-bd09-7b654622f35i','vfw-service','585822c7-4027-4f84-ba50-e9248606f112','1.0','VFW service','2016-11-14 13:04:07',NULL); -# -# INSERT INTO `vf_module` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `DESCRIPTION`, `IS_BASE`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `VOL_HEAT_TEMPLATE_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`) VALUES ('1e34774e-715e-4fd5-bd08-7b654622f33f.VF_RI1_VFW::module-1::module-1.group','585822c7-4027-4f84-ba50-e9248606f134','1.0','VF_RI1_VFW::module-1',NULL,1,'Artifact-UUID3',NULL,'2016-11-14 13:04:07','685822c7-4027-4f84-ba50-e9248606f132'); -# -# INSERT INTO `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`, `LABEL`, `INITIAL_COUNT`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_COUNT`, `HEAT_ENVIRONMENT_ARTIFACT_UUID`, `VOL_ENVIRONMENT_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VF_MODULE_MODEL_UUID`) VALUES ('5aa23938-a9fe-11e7-8b4b-0242ac120002',NULL,1,0,NULL,NULL,'EnvArtifact-UUID3',NULL,'2017-10-05 18:52:03','1e34774e-715e-4fd5-bd08-7b654622f33f.VF_RI1_VFW::module-1::module-1.group'); -# -# INSERT INTO `vnf_res_custom_to_vf_module_custom` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`, `CREATION_TIMESTAMP`) VALUES ('5a9bd247-a9fe-11e7-8b4b-0242ac120002','5aa23938-a9fe-11e7-8b4b-0242ac120002','2017-10-05 18:52:03'); -# -# INSERT INTO `vnf_resource` (`ORCHESTRATION_MODE`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `MODEL_UUID`, `AIC_VERSION_MIN`, `AIC_VERSION_MAX`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `TOSCA_NODE_TYPE`, `HEAT_TEMPLATE_ARTIFACT_UUID`) VALUES ('HEAT','VFW service1707MIGRATED','2016-11-14 13:04:07','685822c7-4027-4f84-ba50-e9248606f132',NULL,NULL,'585822c7-4027-4f84-ba50-e9248606f113','1.0','VFWResource',NULL,NULL); -# -# INSERT INTO `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`, `MODEL_INSTANCE_NAME`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_MAX_COUNT`, `NF_TYPE`, `NF_ROLE`, `NF_FUNCTION`, `NF_NAMING_CODE`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`) VALUES ('5a9bd247-a9fe-11e7-8b4b-0242ac120002','VFWResource-1',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2017-10-05 18:52:03','685822c7-4027-4f84-ba50-e9248606f132'); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index f3315b57eb..c3159f0e3b 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -58,7 +58,6 @@ import ch.qos.logback.classic.spi.ILoggingEvent; @RunWith(SpringRunner.class) @SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") - public class CatalogDBRestTest { private static final String ECOMP_MSO_CATALOG_V2_VF_MODULES = "ecomp/mso/catalog/v2/vfModules"; @@ -748,32 +747,45 @@ public class CatalogDBRestTest { @Test public void testGetVFModulesBadQueryParam() throws JSONException, IOException { - TestAppender.events.clear(); - HttpEntity<String> entity = new HttpEntity<String>(null, headers); - headers.set("Accept", MediaType.APPLICATION_JSON); - - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES)) - .queryParam("ADASD", "NEUTRON_BASIC"); - - ResponseEntity<String> response = restTemplate.exchange( - builder.toUriString(), - HttpMethod.GET, entity, String.class); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value()); - JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false); - - - ILoggingEvent logEvent = TestAppender.events.get(0); - Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); - assertNotNull(mdc.get(MsoLogger.ENDTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.TIMER)); - assertEquals("500",mdc.get(MsoLogger.RESPONSECODE)); - assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE)); - assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + TestAppender.events.clear(); + HttpEntity<String> entity = new HttpEntity<String>(null, headers); + headers.set("Accept", MediaType.APPLICATION_JSON); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_VF_MODULES)) + .queryParam("ADASD", "NEUTRON_BASIC"); + + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),response.getStatusCode().value()); + JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false); + + + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); + assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && + logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(MsoLogger.ENDTIME)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); + assertEquals("500",mdc.get(MsoLogger.RESPONSECODE)); + assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME)); + assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE)); + assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + } } private String createURLWithPort(String uri) { diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java new file mode 100644 index 0000000000..9ed61b33a3 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import java.net.URI; +import java.util.List; + +import javax.transaction.Transactional; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.catalogdb.CatalogDBApplication; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.ServerType; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.util.UriComponentsBuilder; +import uk.co.blackpepper.bowman.Client; +import uk.co.blackpepper.bowman.ClientFactory; +import uk.co.blackpepper.bowman.Configuration; +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class CloudConfigTest { + + protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); + + protected HttpHeaders headers = new HttpHeaders(); + + @LocalServerPort + private int port; + + @Test + @Transactional + public void createCloudSiteRest_TEST() { + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type",MediaType.APPLICATION_JSON); + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN6"); + cloudSite.setClli("TESTCLLI"); + cloudSite.setRegionId("regionId"); + cloudSite.setCloudVersion("VERSION"); + cloudSite.setPlatform("PLATFORM"); + + CloudIdentity cloudIdentity = new CloudIdentity(); + cloudIdentity.setId("RANDOMID"); + cloudIdentity.setIdentityUrl("URL"); + cloudIdentity.setMsoId("MSO_ID"); + cloudIdentity.setMsoPass("MSO_PASS"); + cloudIdentity.setAdminTenant("ADMIN_TENANT"); + cloudIdentity.setMemberRole("ROLE"); + cloudIdentity.setIdentityServerType(ServerType.KEYSTONE); + cloudIdentity.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY); + cloudSite.setIdentityService(cloudIdentity); + String uri = "/cloudSite"; + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri); + HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers); + ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), + HttpMethod.POST, request, String.class); + assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value()); + + builder = UriComponentsBuilder.fromHttpUrl("http://localhost:"+ port + uri +"/" + cloudSite.getId()); + HttpEntity<String> entity = new HttpEntity<String>(null, headers); + ResponseEntity<CloudSite> actualCloudSite = restTemplate.exchange(builder.toUriString(),HttpMethod.GET, entity, CloudSite.class); + + assertEquals(Response.Status.OK.getStatusCode(), actualCloudSite.getStatusCode().value()); + assertThat(actualCloudSite.getBody(), sameBeanAs(cloudSite).ignoring("created").ignoring("updated") + .ignoring("identityService.created").ignoring("identityService.updated")); + + } + +} 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 1b71d16e57..4106e8ac6d 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 @@ -1,4 +1,54 @@ +CREATE TABLE IF NOT EXISTS `identity_services` ( + `ID` varchar(50) NOT NULL, + `IDENTITY_URL` varchar(200) DEFAULT NULL, + `MSO_ID` varchar(255) DEFAULT NULL, + `MSO_PASS` varchar(255) DEFAULT NULL, + `ADMIN_TENANT` varchar(50) DEFAULT NULL, + `MEMBER_ROLE` varchar(50) DEFAULT NULL, + `TENANT_METADATA` tinyint(1) DEFAULT 0, + `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, + `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + + +CREATE TABLE IF NOT EXISTS `cloudify_managers` ( + `ID` varchar(50) NOT NULL, + `CLOUDIFY_URL` varchar(200) DEFAULT NULL, + `USERNAME` varchar(255) DEFAULT NULL, + `PASSWORD` varchar(255) DEFAULT NULL, + `VERSION` varchar(20) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + + + +CREATE TABLE IF NOT EXISTS `cloud_sites` ( + `ID` varchar(50) NOT NULL, + `REGION_ID` varchar(11) DEFAULT NULL, + `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, + `CLOUD_VERSION` varchar(20) DEFAULT NULL, + `CLLI` varchar(11) DEFAULT NULL, + `CLOUDIFY_ID` varchar(50) DEFAULT NULL, + `PLATFORM` varchar(50) DEFAULT NULL, + `ORCHESTRATOR` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`), + KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), + CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) +) ; + insert into heat_files(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values ('00535bdd-0878-4478-b95a-c575c742bfb0', 'nimbus-ethernet-gw', '1', 'created from csar', 'DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n', 'MANUAL RECORD', '2017-01-21 23:56:43'); @@ -29,9 +79,6 @@ insert into collection_resource_instance_group_customization(COLLECTION_RESOURCE insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values ('5df8b6de-2083-11e7-93ae-92361f002672', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '2.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', null, 'NA', 'NA', 'Luna', 'Oxygen'); -insert into service_recipe(id, action, version_str, description, orchestration_uri, service_param_xsd, recipe_timeout, service_timeout_interim, creation_timestamp, service_model_uuid) values -('1', 'createInstance', '1', 'MSOTADevInfra aLaCarte', '/mso/async/services/CreateGenericALaCarteServiceInstance', null, '180', '0', '2017-04-14 19:18:20', '5df8b6de-2083-11e7-93ae-92361f002671'); - insert into heat_template(artifact_uuid, name, version, description, body, timeout_minutes, artifact_checksum, creation_timestamp) values ('ff874603-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', '60', 'MANUAL RECORD', '2017-01-21 23:26:56'), ('ff87482f-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', '60', 'MANUAL RECORD', '2017-01-21 23:26:56'), @@ -134,65 +181,5 @@ insert into allotted_resource_customization_to_service(service_model_uuid, resou ('5df8b6de-2083-11e7-93ae-92361f002671', '367a8ba9-057a-4506-b106-fbae818597c6' ), ('5df8b6de-2083-11e7-93ae-92361f002672', '367a8ba9-057a-4506-b106-fbae818597c6'); - - -insert into vnf_recipe(id, nf_role, action, service_type, version_str, description, orchestration_uri, vnf_param_xsd, recipe_timeout, creation_timestamp, vf_module_id) values -('61', '*', 'CREATE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/workflow/services/CreateGenericVNFV1', '', '180', '2016-06-03 10:14:10', ''), -('63', '*', 'DELETE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/deleteGenericVNFV1', '', '180', '2016-06-03 10:14:10', ''), -('65', '*', 'UPDATE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/workflow/services/updateGenericVNFV1', '', '180', '2016-06-03 10:14:10', ''), -('67', '*', 'CREATE_VF_MODULE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/CreateVfModule', '', '180', '2016-06-03 10:14:10', '*'), -('69', '*', 'DELETE_VF_MODULE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/DeleteVfModule', '', '180', '2016-06-03 10:14:10', '*'), -('71', '*', 'UPDATE_VF_MODULE', '', '1', 'Recipe Match All for VNFs if no custom flow exists', '/mso/async/services/UpdateVfModule', '', '180', '2016-06-03 10:14:10', '*'), -('77', 'VID_DEFAULT', 'createInstance', '', '1', 'VID_DEFAULT recipe to create VNF if no custom BPMN flow is found', '/mso/async/services/CreateVnfInfra', '', '180', '2016-09-14 19:18:20', ''), -('78', 'VID_DEFAULT', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found', '/mso/async/services/DeleteVnfInfra', '', '180', '2016-09-14 19:18:20', ''), -('81', 'VID_DEFAULT', 'updateInstance', '', '1', 'VID_DEFAULT update', '/mso/async/services/UpdateVnfInfra', '', '180', '2017-07-28 18:19:39', ''), -('85', 'VID_DEFAULT', 'replaceInstance', '', '1', 'VID_DEFAULT replace', '/mso/async/services/ReplaceVnfInfra', '', '180', '2017-07-28 18:19:45', ''), -('10000', 'VID_DEFAULT', 'inPlaceSoftwareUpdate', '', '1', 'VID_DEFAULT inPlaceSoftwareUpdate', '/mso/async/services/VnfInPlaceUpdate', '', '180', '2017-10-25 18:19:45', ''), -('10001', 'VID_DEFAULT', 'applyUpdatedConfig', '', '1', 'VID_DEFAULT applyUpdatedConfig', '/mso/async/services/VnfConfigUpdate', '', '180', '2017-10-25 18:19:45', ''); - - insert into vnf_components(vnf_id, component_type, heat_template_id, heat_environment_id, creation_timestamp) values ('13961', 'VOLUME', '13843', '13961', '2016-05-19 20:22:02'); - -insert into vnf_components_recipe(id, vnf_type, vnf_component_type, action, service_type, version, description, orchestration_uri, vnf_component_param_xsd, recipe_timeout, creation_timestamp, vf_module_model_uuid) values -('5', '*', 'VOLUME_GROUP', 'CREATE', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/createCinderVolumeV1', '', '180', '2016-06-03 10:15:11', ''), -('7', '*', 'VOLUME_GROUP', 'DELETE', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/deleteCinderVolumeV1', '', '180', '2016-06-03 10:15:11', ''), -('9', '*', 'VOLUME_GROUP', 'UPDATE', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/updateCinderVolumeV1', '', '180', '2016-06-03 10:15:11', ''), -('13', '', 'VOLUME_GROUP', 'DELETE_VF_MODULE_VOL', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/DeleteVfModuleVolume', '', '180', '2016-06-03 10:15:11', '*'), -('15', '', 'VOLUME_GROUP', 'UPDATE_VF_MODULE_VOL', '', '1', 'Recipe Match All for VF Modules if no custom flow exists', '/mso/async/services/UpdateVfModuleVolume', '', '180', '2016-06-03 10:15:11', '*'), -('16', '', 'volumeGroup', 'createInstance', '', '1', 'VID_DEFAULT recipe to create volume-group if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleVolumeInfraV1', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('17', '', 'volumeGroup', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete volume-group if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleVolumeInfraV1', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('18', '', 'volumeGroup', 'updateInstance', '', '1', 'VID_DEFAULT recipe to update volume-group if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleVolumeInfraV1', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('19', '', 'vfModule', 'createInstance', '', '1', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('20', '', 'vfModule', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('21', '', 'vfModule', 'updateInstance', '', '1', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('25', '', 'vfModule', 'replaceInstance', '', '1', 'VID_DEFAULT vfModule replace', '/mso/async/services/ReplaceVfModuleInfra', '', '180', '2017-07-28 18:25:06', 'VID_DEFAULT'); - -insert into network_recipe(id, model_name, action, description, orchestration_uri, network_param_xsd, recipe_timeout, service_type, creation_timestamp, version_str) values -('1', 'CONTRAIL_BASIC', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('2', 'CONTRAIL_BASIC', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('3', 'CONTRAIL_BASIC', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('4', 'CONTRAIL_SHARED', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('5', 'CONTRAIL_SHARED', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('6', 'CONTRAIL_SHARED', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('7', 'CONTRAIL_EXTERNAL', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('8', 'CONTRAIL_EXTERNAL', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('9', 'CONTRAIL_EXTERNAL', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-09-14 19:00:57', '1'), -('10', 'CONTRAIL30_BASIC', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-05-26 14:48:13', '1'), -('11', 'CONTRAIL30_BASIC', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-05-26 14:48:13', '1'), -('12', 'CONTRAIL30_BASIC', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-05-26 14:48:13', '1'), -('13', 'NEUTRON_BASIC', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-06-01 19:54:51', '1'), -('17', 'VID_DEFAULT', 'createInstance', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), -('18', 'VID_DEFAULT', 'updateInstance', 'VID_DEFAULT recipe to update network if no custom BPMN flow is found', '/mso/async/services/UpdateNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), -('19', 'VID_DEFAULT', 'deleteInstance', 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found', '/mso/async/services/DeleteNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), -('124', 'CONTRAIL30_MPSCE', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2016-10-18 18:47:52', '1'), -('126', 'CONTRAIL30_MPSCE', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2016-10-18 18:47:52', '1'), -('128', 'CONTRAIL30_MPSCE', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2016-10-18 18:47:52', '1'), -('141', 'CONTRAIL30_L2NODHCP', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2017-01-03 20:12:46', '1'), -('144', 'CONTRAIL30_L2NODHCP', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2017-01-03 20:12:46', '1'), -('147', 'CONTRAIL30_L2NODHCP', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2017-01-03 20:12:46', '1'), -('169', 'CONTRAIL30_GNDIRECT', 'CREATE', '', '/mso/async/services/CreateNetworkV2', '', '180', '', '2017-01-17 20:25:34', '1'), -('172', 'CONTRAIL30_GNDIRECT', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2017-01-17 20:25:34', '1'), -('175', 'CONTRAIL30_GNDIRECT', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2017-01-17 20:25:34', '1'), -('176', 'NEUTRON_BASIC', 'DELETE', '', '/mso/async/services/DeleteNetworkV2', '', '180', '', '2017-09-22 18:47:31', '1'), -('177', 'NEUTRON_BASIC', 'UPDATE', '', '/mso/async/services/UpdateNetworkV2', '', '180', '', '2017-09-22 18:47:31', '1'); diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml index aceeda408b..715cef8db1 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml @@ -1,12 +1,18 @@ <configuration> - + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level - %logger{1024} - %msg%n - </pattern> + <pattern>${pattern}</pattern> </encoder> </appender> @@ -27,6 +33,7 @@ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> </logger> <logger name="org.flywaydb" level="DEBUG" additivity="false"> @@ -38,12 +45,10 @@ <appender-ref ref="STDOUT" /> </logger> - <logger name="AUDIT" level="info" additivity="true"> - <appender-ref ref="test" /> - </logger> <root level="WARN"> <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> </root> diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index 5f5da85a88..01c1df304e 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -194,17 +194,17 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.1.11</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.webjars</groupId> @@ -218,6 +218,10 @@ <scope>test</scope> </dependency> <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> <groupId>janino</groupId> <artifactId>janino</artifactId> <version>2.5.15</version> @@ -264,5 +268,9 @@ <version>1.2.4.RELEASE</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.flywaydb</groupId> + <artifactId>flyway-core</artifactId> + </dependency> </dependencies> </project> diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java new file mode 100644 index 0000000000..0309c88dac --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java @@ -0,0 +1,67 @@ +package db.migration; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CloudifyManager; + +import java.util.HashMap; +import java.util.Map; + +/** + * @deprecated + * This class is introduced as deprecated as its only purpose is for migration of cloud config data. It shouldnt be used elsewhere. + */ + +@Deprecated +@JsonIgnoreProperties(ignoreUnknown = true) +public class CloudConfig { + @JsonProperty("identity_services") + private Map<String, CloudIdentity> identityServices = new HashMap<>(); + + @JsonProperty("cloud_sites") + private Map<String, CloudSite> cloudSites = new HashMap<>(); + + @JsonProperty("cloudify_managers") + private Map<String, CloudifyManager> cloudifyManagers = new HashMap<>(); + + + public Map<String, CloudIdentity> getIdentityServices() { + return identityServices; + } + + public void setIdentityServices(Map<String, CloudIdentity> identityServices) { + this.identityServices = identityServices; + } + + public Map<String, CloudSite> getCloudSites() { + return cloudSites; + } + + public void setCloudSites(Map<String, CloudSite> cloudSites) { + this.cloudSites = cloudSites; + } + + public Map<String, CloudifyManager> getCloudifyManagers() { + return cloudifyManagers; + } + + public void setCloudifyManagers(Map<String, CloudifyManager> cloudifyManagers) { + this.cloudifyManagers = cloudifyManagers; + } + + public void populateId(){ + for (Map.Entry<String, CloudIdentity> entry : identityServices.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + + for (Map.Entry <String, CloudSite> entry : cloudSites.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + + for (Map.Entry<String, CloudifyManager> entry : cloudifyManagers.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + } +} 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 new file mode 100644 index 0000000000..ed64abd982 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -0,0 +1,191 @@ +package db.migration; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import org.flywaydb.core.api.MigrationVersion; +import org.flywaydb.core.api.migration.MigrationChecksumProvider; +import org.flywaydb.core.api.migration.MigrationInfoProvider; +import org.flywaydb.core.api.migration.jdbc.JdbcMigration; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CloudifyManager; +import org.onap.so.logger.MsoLogger; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.Collection; + +/** + * Performs migration using JDBC Connection from the cloud config provided in the environment (application-{profile}.yaml) and persist data (when not already present) to the catalod database. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoProvider, MigrationChecksumProvider { + public static final String FLYWAY = "FLYWAY"; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, R__CloudConfigMigration.class); + @JsonProperty("cloud_config") + private CloudConfig cloudConfig; + + @Override + public void migrate(Connection connection) throws Exception { + LOGGER.debug("Starting migration for CloudConfig"); + + CloudConfig cloudConfig = null; + + // Try the override file + String configLocation = System.getProperty("spring.config.location"); + if (configLocation != null) { + try (InputStream stream = new FileInputStream(configLocation)) { + cloudConfig = loadCloudConfig(stream); + } + } + + if (cloudConfig == null) { + LOGGER.debug("No CloudConfig defined in " + configLocation); + + // Try the application.yaml file + try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) { + cloudConfig = loadCloudConfig(stream); + } + + if (cloudConfig == null) { + LOGGER.debug("No CloudConfig defined in " + getApplicationYamlName()); + } + } + + if(cloudConfig != null){ + migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection); + migrateCloudSite(cloudConfig.getCloudSites().values(), connection); + migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection); + } + } + + public CloudConfig getCloudConfig() { + return cloudConfig; + } + + public void setCloudConfig(CloudConfig cloudConfig) { + this.cloudConfig = cloudConfig; + } + + private CloudConfig loadCloudConfig(InputStream stream) throws Exception { + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + R__CloudConfigMigration cloudConfigMigration = + mapper.readValue(stream, R__CloudConfigMigration.class); + CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig(); + + if(cloudConfig != null){ + cloudConfig.populateId(); + } + + return cloudConfig; + } + + private String getApplicationYamlName() { + String profile = System.getProperty("spring.profiles.active") == null ? "" : "-" + System.getProperty("spring.profiles.active"); + return "/application" + profile + ".yaml"; + } + + private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws Exception { + LOGGER.debug("Starting migration for CloudConfig-->IdentityService"); + String insert = "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`) " + + "VALUES (?,?,?,?,?,?,?,?,?,?);"; + + try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) { + for (CloudIdentity cloudIdentity : entities) { + try (ResultSet rows = stmt.executeQuery("Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) { + int count = 0; + while (rows.next()) { + count = rows.getInt(1); + } + if (count == 0) { + ps.setString(1, cloudIdentity.getId()); + ps.setString(2, cloudIdentity.getIdentityUrl()); + ps.setString(3, cloudIdentity.getMsoId()); + ps.setString(4, cloudIdentity.getMsoPass()); + ps.setString(5, cloudIdentity.getAdminTenant()); + ps.setString(6, cloudIdentity.getMemberRole()); + ps.setBoolean(7, cloudIdentity.getTenantMetadata()); + ps.setString(8, cloudIdentity.getIdentityServerType() != null ? cloudIdentity.getIdentityServerType().name() : null); + ps.setString(9, cloudIdentity.getIdentityAuthenticationType() != null ? cloudIdentity.getIdentityAuthenticationType().name() : null); + ps.setString(10, FLYWAY); + ps.executeUpdate(); + } + } + } + } + } + + private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws Exception { + LOGGER.debug("Starting migration for CloudConfig-->CloudSite"); + String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " + + "VALUES (?,?,?,?,?,?,?,?,?);"; + + try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) { + for (CloudSite cloudSite : entities) { + try (ResultSet rows = stmt.executeQuery("Select count(1) from cloud_sites where id='" + cloudSite.getId() + "'")) { + int count = 0; + while (rows.next()) { + count = rows.getInt(1); + } + if (count == 0) { + ps.setString(1, cloudSite.getId()); + ps.setString(2, cloudSite.getRegionId()); + ps.setString(3, cloudSite.getIdentityServiceId()); + ps.setString(4, cloudSite.getCloudVersion()); + ps.setString(5, cloudSite.getClli()); + ps.setString(6, cloudSite.getCloudifyId()); + ps.setString(7, cloudSite.getPlatform()); + ps.setString(8, cloudSite.getOrchestrator()); + ps.setString(9, FLYWAY); + ps.executeUpdate(); + } + } + } + } + } + + private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws Exception { + String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" + + " VALUES (?,?,?,?,?,?);"; + + try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) { + for (CloudifyManager cloudifyManager : entities) { + try (ResultSet rows = stmt.executeQuery("Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) { + int count = 0; + while (rows.next()) { + count = rows.getInt(1); + } + if (count == 0) { + ps.setString(1, cloudifyManager.getId()); + ps.setString(2, cloudifyManager.getCloudifyUrl()); + ps.setString(3, cloudifyManager.getUsername()); + ps.setString(4, cloudifyManager.getPassword()); + ps.setString(5, cloudifyManager.getVersion()); + ps.setString(6, FLYWAY); + ps.executeUpdate(); + } + } + } + } + } + + public MigrationVersion getVersion() { + return null; + } + + public String getDescription() { + return "R_CloudConfigMigration"; + } + + public Integer getChecksum() { + return Math.toIntExact(System.currentTimeMillis() / 1000); + } +} + diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java new file mode 100644 index 0000000000..6530b7ba7c --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java @@ -0,0 +1,12 @@ +package db.migration; + +import org.flywaydb.core.api.migration.jdbc.JdbcMigration; + +import java.sql.Connection; + +public class V4_2__DummyMigration implements JdbcMigration { + @Override + public void migrate(Connection connection) throws Exception { + + } +} 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 f5a05b7333..e5a8d3faa1 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 @@ -36,7 +36,7 @@ import org.onap.so.adapters.network.beans.ContrailSubnet; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.adapters.network.mappers.ContrailSubnetMapper; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; @@ -1167,7 +1167,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } MavenLikeVersioning aicV = new MavenLikeVersioning(); - aicV.setVersion(cloudSite.getAicVersion()); + aicV.setVersion(cloudSite.getCloudVersion()); if ((aicV.isMoreRecentThan(networkResource.getAicVersionMin()) || aicV .isTheSameVersion(networkResource.getAicVersionMin())) // aic // >= @@ -1181,13 +1181,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { + networkResource.getAicVersionMin() + " VersionMax:" + networkResource.getAicVersionMax() + " supported on Cloud:" + cloudSiteId - + " with AIC_Version:" + cloudSite.getAicVersion()); + + " with AIC_Version:" + cloudSite.getCloudVersion()); } else { String error = "Network Type:" + networkType + " Version_Min:" + networkResource.getAicVersionMin() + " Version_Max:" + networkResource.getAicVersionMax() + " not supported on Cloud:" + cloudSiteId - + " with AIC_Version:" + cloudSite.getAicVersion(); + + " with AIC_Version:" + cloudSite.getCloudVersion(); LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network Type not supported on Cloud"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java index d67a4b684c..02aa0843ae 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java @@ -34,8 +34,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @SpringBootApplication(scanBasePackages = { "org.onap.so" }) @EnableAsync @EnableJpaRepositories({ "org.onap.so.db.catalog.data.repository", - "org.onap.so.db.request.data.repository" }) -@EntityScan({ "org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans" }) + "org.onap.so.db.request.data.repository"}) +@EntityScan({ "org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans"}) public class MsoOpenstackAdaptersApplication { @Value("${mso.async.core-pool-size}") diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java index ef66d6876c..37a84c1a56 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java @@ -50,7 +50,7 @@ public interface MsoTenantAdapter @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="tenantId", mode=Mode.OUT) Holder<String> tenantId, @WebParam(name="rollback", mode=Mode.OUT) Holder<TenantRollback> rollback ) - throws TenantException, TenantAlreadyExists; + throws TenantException; @WebMethod public void queryTenant (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, 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 8a55e0717e..29d8f297bf 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 @@ -39,7 +39,7 @@ import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.adapters.vnf.exceptions.VnfNotFound; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.HeatEnvironment; import org.onap.so.db.catalog.beans.HeatFiles; import org.onap.so.db.catalog.beans.HeatTemplate; @@ -859,7 +859,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (this.cloudConfig != null) { Optional<CloudSite> cloudSiteOpt = this.cloudConfig.getCloudSite(cloudSiteId); if (cloudSiteOpt.isPresent()) { - aicV.setVersion(cloudSiteOpt.get().getAicVersion()); + aicV.setVersion(cloudSiteOpt.get().getCloudVersion()); // Add code to handle unexpected values in here boolean moreThanMin = true; boolean equalToMin = true; @@ -878,10 +878,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (!doNotTest) { if ((moreThanMin || equalToMin) // aic >= min && (equalToMax || !(moreThanMax))) { //aic <= max - LOGGER.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getAicVersion()); + LOGGER.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion()); } else { // ERROR - String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getAicVersion(); + String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion(); LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion"); LOGGER.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1606,7 +1606,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (this.cloudConfig != null) { Optional<CloudSite> cloudSiteOpt = this.cloudConfig.getCloudSite(cloudSiteId); if (cloudSiteOpt.isPresent()) { - aicV.setVersion(cloudSiteOpt.get().getAicVersion()); + aicV.setVersion(cloudSiteOpt.get().getCloudVersion()); boolean moreThanMin = true; boolean equalToMin = true; boolean moreThanMax = true; 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 0266e87523..1cf65cb6fc 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 @@ -34,7 +34,7 @@ import javax.xml.ws.Holder; import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.cloudify.beans.DeploymentInfo; import org.onap.so.cloudify.beans.DeploymentStatus; import org.onap.so.cloudify.exceptions.MsoCloudifyManagerNotFound; @@ -663,7 +663,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } CloudSite cloudSite = cloudSiteOp.get(); MavenLikeVersioning aicV = new MavenLikeVersioning(); - aicV.setVersion(cloudSite.getAicVersion()); + aicV.setVersion(cloudSite.getCloudVersion()); String vnfMin = vnfResource.getAicVersionMin(); String vnfMax = vnfResource.getAicVersionMax(); @@ -672,7 +672,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) { // ERROR - String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getAicVersion(); + String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion"); LOGGER.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); 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 0a7b30f9ca..b440f7d521 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 @@ -59,7 +59,7 @@ import org.onap.so.adapters.vdu.mapper.VfModuleCustomizationToVduMapper; import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.cloudify.utils.MsoCloudifyUtils; import org.onap.so.db.catalog.beans.HeatEnvironment; import org.onap.so.db.catalog.beans.HeatTemplate; @@ -705,7 +705,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } CloudSite cloudSite = cloudSiteOp.get(); MavenLikeVersioning aicV = new MavenLikeVersioning(); - aicV.setVersion(cloudSite.getAicVersion()); + aicV.setVersion(cloudSite.getCloudVersion()); String vnfMin = vnfResource.getAicVersionMin(); String vnfMax = vnfResource.getAicVersionMax(); @@ -714,7 +714,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) { // ERROR - String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getAicVersion(); + String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion"); LOGGER.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java index 876aae8a37..4da026f454 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java @@ -23,7 +23,7 @@ package org.onap.so.adapters.vnf; import java.util.Optional; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudSite; +import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; 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 fa6078689e..469744d2de 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml @@ -114,21 +114,7 @@ spring: management: context-path: /manage -cloud_config: - identity_services: - MTN13: - identity_url: "http://localhost:5000/v2.0" - mso_id: "m93945" - mso_pass: "93937EA01B94A10A49279D4572B48369" - admin_tenant: "admin" - member_role: "admin" - tenant_metadata: true - identity_server_type: "KEYSTONE" - identity_authentication_type: "USERNAME_PASSWORD" - cloud_sites: - mtn13: - region_id: "mtn13" - clli: "MDT13" - aic_version: "3.0" - identity_service_id: "MTN13" +flyway: + outOfOrder: true + ignoreMissingMigrations: true diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index faca1a3056..4b2cf8eb60 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -38,3 +38,9 @@ spring: #Actuator management: context-path: /manage + +flyway: + outOfOrder: true + ignoreMissingMigrations: true + baseline-on-migrate: true + validate-on-migrate: false diff --git a/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java new file mode 100644 index 0000000000..b29e1f57a7 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java @@ -0,0 +1,107 @@ +package db.migration; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.vnf.BaseRestTestUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +public class CloudConfigMigrationTest extends BaseRestTestUtils { + + @Qualifier("dataSource") + @Autowired + DataSource dataSource; + + R__CloudConfigMigration cloudConfigMigration; + + @Before + public void setup() { + cloudConfigMigration = new R__CloudConfigMigration(); + } + + @Test + public void testMigrate() throws Exception { + System.setProperty("spring.profiles.active", "test"); + cloudConfigMigration.migrate(dataSource.getConnection()); + assertMigratedIdentityServiceData(); + assertMigratedCloudSiteData(); + assertMigratedCloudManagerData(); + } + + @Test + public void testMigrateNoData() throws Exception { + System.setProperty("spring.profiles.active", "nomigrate"); + int identityCount = getDataCount("identity_services"); + int cloudSiteCount = getDataCount("cloud_sites"); + int cloudManagerCount = getDataCount("cloudify_managers"); + + cloudConfigMigration.migrate(dataSource.getConnection()); + + Assert.assertEquals(identityCount, getDataCount("identity_services")); + Assert.assertEquals(cloudSiteCount, getDataCount("cloud_sites")); + Assert.assertEquals(cloudManagerCount, getDataCount("cloudify_managers")); + } + + + private int getDataCount(String tableName) throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select count(1) from " + tableName)) { + while (rs.next()) { + return rs.getInt(1); + } + } + return 0; + } + + private void assertMigratedIdentityServiceData() throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from identity_services where id='MTKEYSTONE'")) { + boolean dataAvailable = false; + while (rs.next()) { + dataAvailable = true; + Assert.assertEquals("MTKEYSTONE", rs.getString("id")); + Assert.assertEquals("http://localhost:5000/v2.0", rs.getString("identity_url")); + Assert.assertEquals("john", rs.getString("mso_id")); + Assert.assertEquals("313DECE408AF7759D442D7B06DD9A6AA", rs.getString("mso_pass")); + Assert.assertEquals("admin", rs.getString("admin_tenant")); + Assert.assertEquals("_member_", rs.getString("member_role")); + Assert.assertEquals("KEYSTONE", rs.getString("identity_server_type")); + Assert.assertEquals("USERNAME_PASSWORD", rs.getString("identity_authentication_type")); + } + Assert.assertTrue("Expected data in identity_services table post migration but didnt find any!!!", dataAvailable); + } + } + + private void assertMigratedCloudSiteData() throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from cloud_sites where id='regionOne'")) { + boolean dataAvailable = false; + while (rs.next()) { + dataAvailable = true; + Assert.assertEquals("regionOne", rs.getString("id")); + Assert.assertEquals("regionOne", rs.getString("region_id")); + Assert.assertEquals("MT2", rs.getString("clli")); + Assert.assertEquals("2.5", rs.getString("cloud_version")); + Assert.assertEquals("MTKEYSTONE", rs.getString("identity_service_id")); + } + Assert.assertTrue("Expected data in identity_services table post migration but didnt find any!!!", dataAvailable); + } + } + + private void assertMigratedCloudManagerData() throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from cloudify_managers where id='manager'")) { + boolean dataAvailable = false; + while (rs.next()) { + dataAvailable = true; + Assert.assertEquals("http://localhost:8080", rs.getString("cloudify_url")); + Assert.assertEquals("user", rs.getString("username")); + Assert.assertEquals("password", rs.getString("password")); + Assert.assertEquals("2.0", rs.getString("version")); + } + Assert.assertTrue("Expected data in identity_services table post migration but didnt find any!!!", dataAvailable); + } + } +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java index acfe6568af..ea21687bc5 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java @@ -75,7 +75,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0"); CreateTenantRequest request = new CreateTenantRequest(); - String cloudSiteId = "mtn13"; + String cloudSiteId = "MTN13"; String requestId = "62265093-277d-4388-9ba6-449838ade586"; String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; String tenantName = "testingTenantName"; @@ -127,7 +127,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0"); CreateTenantRequest request = new CreateTenantRequest(); - String cloudSiteId = "mtn13"; + String cloudSiteId = "MTN13"; String requestId = "62265093-277d-4388-9ba6-449838ade586"; String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; String tenantName = "testingTenantName"; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java new file mode 100644 index 0000000000..c982f8beb1 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vdu.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.common.collect.Lists; +import java.util.List; +import org.junit.Test; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.HeatFiles; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VfModuleCustomization; + +public class VfModuleCustomizationToVduMapperTest { + + private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID"; + private static final String HEAT_ENV_NAME = "heatEnvName"; + private static final String HEAT_ENV_CONTENT = "heatEnvContent"; + private static final String MODULE_HEAT_TEMPLATE_NAME = "moduleHeatTemplateName"; + private static final String MODULE_HEAT_TEMPLATE_BODY = "moduleHeatTemplateBody"; + private static final String NESTED_TEMPLATE_NAME = "nestedTemplateName"; + private static final String NESTED_TEMPLATE_BODY = "nestedTemplateBody"; + private static final int TIMEOUT_IN_MIN = 66; + private static final String VF_MODULE_MODEL_INVARIANT_UUID = "vfModuleModelInvariantUUID"; + private static final String CLOUD_FILE_NAME = "cloudFileName"; + private static final String CLOUD_FILE_BODY = "cloudFileBody"; + + + @Test + public void mapVfModuleCustomizationToVdu_successful() { + // GIVEN + VfModuleCustomization vfModuleCustomization = createVfModuleCustomization(); + vfModuleCustomization.setHeatEnvironment(createHeatEnvironment(HEAT_ENV_NAME, HEAT_ENV_CONTENT)); + VfModule vfModule = createVfModule(); + vfModule.setModuleHeatTemplate(createHeatTemplate( + MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, + NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); + vfModuleCustomization.setVfModule(vfModule); + + // WHEN + VduModelInfo vduModelInfo = new VfModuleCustomizationToVduMapper() + .mapVfModuleCustomizationToVdu(vfModuleCustomization); + + // THEN + assertThat(vduModelInfo.getModelCustomizationUUID()).isEqualTo(MODEL_CUSTOMIZATION_UUID); + assertThat(vduModelInfo.getTimeoutMinutes()).isEqualTo(TIMEOUT_IN_MIN); + assertThat(vduModelInfo.getArtifacts()).containsExactlyElementsOf(createExpectedVduArtifacts()); + } + + @Test + public void mapVfModuleCustVolumeToVdu_successful() { + // GIVEN + VfModuleCustomization vfModuleCustomization = createVfModuleCustomization(); + vfModuleCustomization.setVolumeHeatEnv(createHeatEnvironment(HEAT_ENV_NAME, HEAT_ENV_CONTENT)); + VfModule vfModule = createVfModule(); + vfModule.setVolumeHeatTemplate(createHeatTemplate( + MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, + NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); + vfModuleCustomization.setVfModule(vfModule); + + // WHEN + VduModelInfo vduModelInfo = new VfModuleCustomizationToVduMapper() + .mapVfModuleCustVolumeToVdu(vfModuleCustomization); + + // THEN + assertThat(vduModelInfo.getModelCustomizationUUID()).isEqualTo(MODEL_CUSTOMIZATION_UUID); + assertThat(vduModelInfo.getTimeoutMinutes()).isEqualTo(TIMEOUT_IN_MIN); + assertThat(vduModelInfo.getArtifacts()).containsExactlyElementsOf(createExpectedVduArtifacts()); + } + + private VfModuleCustomization createVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vfModuleCustomization; + } + + private HeatEnvironment createHeatEnvironment(String volHeatEnvName, String volHeatEnvContent) { + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setName(volHeatEnvName); + heatEnvironment.setEnvironment(volHeatEnvContent); + return heatEnvironment; + } + + private VfModule createVfModule() { + VfModule vfModule = new VfModule(); + vfModule.setModelInvariantUUID(VF_MODULE_MODEL_INVARIANT_UUID); + vfModule.setHeatFiles(createHeatFiles(CLOUD_FILE_NAME, CLOUD_FILE_BODY)); + return vfModule; + } + + private List<HeatFiles> createHeatFiles(String fileName, String fileBody) { + HeatFiles heatFiles = new HeatFiles(); + heatFiles.setFileName(fileName); + heatFiles.setFileBody(fileBody); + return Lists.newArrayList(heatFiles); + } + + private HeatTemplate createHeatTemplate(String moduleHeatTemplateName, String moduleHeatTemplateBody, + String childTemplateName, String childTemplateBody) { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateName(moduleHeatTemplateName); + heatTemplate.setTemplateBody(moduleHeatTemplateBody); + heatTemplate.setTimeoutMinutes(TIMEOUT_IN_MIN); + heatTemplate.setChildTemplates(createChildHeatTemplate(childTemplateName, childTemplateBody)); + return heatTemplate; + } + + private List<HeatTemplate> createChildHeatTemplate(String moduleHeatTemplateName, String moduleHeatTemplateBody) { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateName(moduleHeatTemplateName); + heatTemplate.setTemplateBody(moduleHeatTemplateBody); + return Lists.newArrayList(heatTemplate); + } + + private List<VduArtifact> createExpectedVduArtifacts() { + return Lists.newArrayList( + new VduArtifact(MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY.getBytes(), + ArtifactType.MAIN_TEMPLATE), + new VduArtifact(NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY.getBytes(), ArtifactType.NESTED_TEMPLATE), + new VduArtifact(CLOUD_FILE_NAME, CLOUD_FILE_BODY.getBytes(), ArtifactType.TEXT_FILE), + new VduArtifact(HEAT_ENV_NAME, HEAT_ENV_CONTENT.getBytes(), ArtifactType.ENVIRONMENT)); + } +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java index a2faaaff78..d2b6d4f633 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java @@ -24,10 +24,15 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.ServerType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; @@ -36,16 +41,20 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.http.HttpHeaders; -import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import javax.ws.rs.core.MediaType; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.reset; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; @RunWith(SpringRunner.class) @SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -63,6 +72,9 @@ public class BaseRestTestUtils { @LocalServerPort private int port; + + public ObjectMapper mapper; + protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ ObjectMapper mapper = new ObjectMapper(); @@ -87,10 +99,53 @@ public class BaseRestTestUtils { return sb.toString(); } } - + + /*** + * Before each test execution, updating IdentityUrl port value to the ramdom wireMockPort + * Since URL will be used as a rest call and required to be mocked in unit tests + */ @Before - public void setUp(){ + public void setUp() throws Exception { reset(); + mapper = new ObjectMapper(); + + CloudIdentity identity = new CloudIdentity(); + identity.setId("MTN13"); + identity.setMsoId("m93945"); + identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setAdminTenant("admin"); + identity.setMemberRole("admin"); + identity.setTenantMetadata(new Boolean(true)); + identity.setIdentityUrl("http://localhost:"+wireMockPort+"/v2.0"); + identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN13"); + cloudSite.setCloudVersion("3.0"); + cloudSite.setClli("MDT13"); + cloudSite.setRegionId("mtn13"); + cloudSite.setOrchestrator("orchestrator" + + ""); + identity.setIdentityServerType(ServerType.KEYSTONE); + cloudSite.setIdentityService(identity); + + + stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse() + .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + } + + protected static String getBody(String body, int port, String urlPath) throws IOException { + return body.replaceAll("port", "http://localhost:" + port + urlPath); } @Test diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index 0ce3683a1e..005586e3ad 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -81,9 +81,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; @Before - public void before() { + public void before() throws Exception { MockitoAnnotations.initMocks(this); WireMock.reset(); + setUp(); } @Test @@ -105,7 +106,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -510,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index 6f2c6cf86d..6674c7171f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -22,14 +22,13 @@ package org.onap.so.adapters.vnf; import org.apache.http.HttpStatus; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudifyManager; +import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.springframework.beans.factory.annotation.Autowired; @@ -38,11 +37,7 @@ import javax.xml.ws.Holder; import java.util.HashMap; import java.util.Map; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.*; public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { @@ -56,23 +51,18 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { private CloudConfig cloudConfig; @Before - public void before(){ + public void before() throws Exception { super.setUp(); CloudifyManager cloudifyManager = new CloudifyManager(); cloudifyManager.setId("mtn13"); cloudifyManager.setCloudifyUrl("http://localhost:"+wireMockPort+"/v2.0"); cloudifyManager.setUsername("m93945"); cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369"); - cloudConfig.getCloudifyManagers().put("mtn13",cloudifyManager); } - @After - public void after(){ - cloudConfig.getCloudifyManagers().clear(); - } - - @Test - public void queryVnfNullPointerExceptionTest() throws Exception { + @Test + public void queryVnfExceptionTest() throws Exception { + reset(); expectedException.expect(VnfException.class); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json index 934e075220..b78f700fd9 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json @@ -1,11 +1,11 @@ { "createTenantResponse": { - "cloudSiteId": "mtn13", + "cloudSiteId": "MTN13", "tenantId": "tenantId", "tenantCreated": true, "tenantRollback": { "tenantId": "tenantId", - "cloudId": "mtn13", + "cloudId": "MTN13", "tenantCreated": true, "msoRequest": { "requestId": "62265093-277d-4388-9ba6-449838ade586", diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json index 6f81ebcd36..977aa542b3 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json @@ -1,10 +1,10 @@ { "createTenantResponse": { - "cloudSiteId": "mtn13", + "cloudSiteId": "MTN13", "tenantId": "tenantId", "tenantCreated": false, "tenantRollback": { - "cloudId": "mtn13", + "cloudId": "MTN13", "tenantCreated": false, "msoRequest": { "requestId": "62265093-277d-4388-9ba6-449838ade586", diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml new file mode 100644 index 0000000000..c508b6e2d6 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml @@ -0,0 +1,122 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck +# MSO Properties go here +org: + onap: + so: + adapters: + default_keystone_url_version: /v2.0 + default_keystone_reg_ex: "/[vV][0-9]" + vnf: + bpelauth: 481E6A95CE97E393A53363750D5E1E75 + checkRequiredParameters: true + addGetFilesOnVolumeReq: false + sockettimeout: 30 + connecttimeout: 30 + retrycount: 5 + retryinterval: -15 + retrylist: 408,429,500,502,503,504,900 + network: + bpelauth: 481E6A95CE97E393A53363750D5E1E75 + sockettimeout: 5 + connecttimeout: 5 + retrycount: 5 + retryinterval: -15 + retrylist: 408,429,500,502,503,504,900 + tenant: + default_x_aic_orm_client_string: ONAP-SO + default_keystone_url_version: /v2.0 + default_keystone_reg_ex: "/[vV][0-9]" + default_tenant_description: ECOMP Tenant + default_region_type: single + default_user_role: admin + default_success_status_string: Success + default_no_regions_status_string: no regions + default_orm_request_path: /v1/orm/customers/ + default_orm_url_replace_this: 8080 + default_orm_url_replace_with_this: 7080 + default_quota_value: 10 + set_default_quota: false + valet: + 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 + +server-port: 8080 +ssl-enable: false +tomcat: + max-threads: 50 +mso: + logPath: logs + catalog: + db: + spring: + endpoint: http://localhost:${wiremock.server.port} + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + site-name: localDevEnv + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/catalogdb + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + initialization-mode: never + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: MSO-Client + +mariaDB4j: + dataDir: + port: 3307 + databaseName: catalogdb + + +#Actuator +management: + endpoints: + enabled-by-default: false + endpoint: + info: + enabled: true + +flyway: + baseline-on-migrate: true + outOfOrder: true + ignoreMissingMigrations: true
\ No newline at end of file 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 97eecc2423..d15978357a 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -71,7 +71,7 @@ mso: catalog: db: spring: - endpoint: "http://localhost:" + endpoint: http://localhost:${wiremock.server.port} db: auth: Basic YnBlbDptc28tZGItMTUwNyE= site-name: localDevEnv @@ -118,13 +118,13 @@ management: cloud_config: identity_services: - MTN13: - identity_url: "http://localhost:${wiremock.server.port}/v2.0" - mso_id: "m93945" - mso_pass: "93937EA01B94A10A49279D4572B48369" + MTKEYSTONE: + identity_url: "http://localhost:5000/v2.0" + mso_id: "john" + mso_pass: "313DECE408AF7759D442D7B06DD9A6AA" admin_tenant: "admin" - member_role: "admin" - tenant_metadata: true + member_role: "_member_" + tenant_metadata: false identity_server_type: "KEYSTONE" identity_authentication_type: "USERNAME_PASSWORD" cloud_sites: @@ -135,3 +135,20 @@ cloud_config: identity_service_id: "MTN13" orchestrator: "orchestrator" cloudify_id: "mtn13" + regionOne: + region_id: "regionOne" + clli: "MT2" + aic_version: "2.5" + identity_service_id: "MTKEYSTONE" + cloudify_managers: + manager: + cloudify_url: "http://localhost:8080" + username: "user" + password: "password" + version: "2.0" + + +flyway: + baseline-on-migrate: true + outOfOrder: true + ignoreMissingMigrations: true
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/data.sql b/adapters/mso-openstack-adapters/src/test/resources/data.sql index 5fabec6c8a..d16ca4528c 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/data.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/data.sql @@ -136,7 +136,11 @@ INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION INSERT INTO `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`, `LABEL`, `INITIAL_COUNT`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_COUNT`, `HEAT_ENVIRONMENT_ARTIFACT_UUID`, `VOL_ENVIRONMENT_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VF_MODULE_MODEL_UUID`) VALUES ('9b339a61-69ca-465f-86b8-1c72c582b8e8', 'base_vmme', 1, 1, 1, NULL, 'f4a21b58-5654-4cf6-9c50-de42004fe2b4', '3375f64b-4709-4802-8713-7a164763f9cd', '2018-05-13 12:12:09', '207fe0dc-4c89-4e5d-9a78-345e99ef7fbe'); +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 `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 d24d16d577..a051417cc1 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -781,4 +781,53 @@ create table if not exists model ( PRIMARY KEY (`ID`), CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`), FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1;
\ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `identity_services` ( + `ID` varchar(50) NOT NULL, + `IDENTITY_URL` varchar(200) DEFAULT NULL, + `MSO_ID` varchar(255) DEFAULT NULL, + `MSO_PASS` varchar(255) DEFAULT NULL, + `ADMIN_TENANT` varchar(50) DEFAULT NULL, + `MEMBER_ROLE` varchar(50) DEFAULT NULL, + `TENANT_METADATA` tinyint(1) DEFAULT 0, + `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, + `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + + +CREATE TABLE IF NOT EXISTS `cloudify_managers` ( + `ID` varchar(50) NOT NULL, + `CLOUDIFY_URL` varchar(200) DEFAULT NULL, + `USERNAME` varchar(255) DEFAULT NULL, + `PASSWORD` varchar(255) DEFAULT NULL, + `VERSION` varchar(20) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + + +CREATE TABLE IF NOT EXISTS `cloud_sites` ( + `ID` varchar(50) NOT NULL, + `REGION_ID` varchar(11) DEFAULT NULL, + `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, + `CLOUD_VERSION` varchar(20) DEFAULT NULL, + `CLLI` varchar(11) DEFAULT NULL, + `CLOUDIFY_ID` varchar(50) DEFAULT NULL, + `PLATFORM` varchar(50) DEFAULT NULL, + `ORCHESTRATOR` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`), + KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), + CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) +) ;
\ No newline at end of file diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml index 175e7fbd19..934e2a544f 100644 --- a/adapters/mso-requests-db-adapter/pom.xml +++ b/adapters/mso-requests-db-adapter/pom.xml @@ -35,17 +35,17 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.1.11</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -118,17 +118,17 @@ <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-java2ws-plugin</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-simple</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> </dependencies> <executions> @@ -213,7 +213,7 @@ cxf-java2ws-plugin </artifactId> <versionRange> - [3.1.12,) + [3.2.5,) </versionRange> <goals> <goal>java2ws</goal> diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml index 7a051990bf..0337c2613e 100644 --- a/adapters/mso-sdnc-adapter/pom.xml +++ b/adapters/mso-sdnc-adapter/pom.xml @@ -121,17 +121,17 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.1.11</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml index 9392db2a2a..d416c8e1e2 100644 --- a/adapters/mso-vfc-adapter/pom.xml +++ b/adapters/mso-vfc-adapter/pom.xml @@ -70,17 +70,17 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.1.11</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java deleted file mode 100644 index c3d9cca0e9..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.vdu.mapper; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -import java.util.Map; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.adapters.vdu.VduArtifact; -import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; -import org.onap.so.adapters.vdu.VduModelInfo; -import org.onap.so.db.catalog.CatalogDatabase; -import org.onap.so.db.catalog.beans.HeatEnvironment; -import org.onap.so.db.catalog.beans.HeatFiles; -import org.onap.so.db.catalog.beans.HeatTemplate; -import org.onap.so.db.catalog.beans.VfModule; -import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({CatalogDatabase.class}) -public class VfModuleCustomizationToVduMapperTest { - - private static final String HEAT_TEMPLATE_ARTIFACT_UUID = "testHeatTemplate"; - private static final String VF_MODULE_MODEL_UUID = "vfModuleUuid"; - private static final String HEAT_ENV_ARTIFACT_UUID = "heatEnvArtifactUuid"; - private static final String MAIN_TEMPLATE_NAME = "testTempName"; - private static final String MAIN_TEMPLATE_BODY = "testTempBody"; - private static final String NESTED_TEMPLATE_KEY = "testKey"; - private static final String NESTED_TEMPLATE_VALUE = "nestedTemplateTest"; - private static final String HEAT_FILE_NAME = "heatFileName"; - private static final String HEAT_FILE_BODY = "heatFileBodyTest"; - private static final String HEAT_ENV_NAME = "heatEnvName"; - private static final String HEAT_ENV = "heatEnv"; - private static final String VOL_HEAT_TEMPLATE_ARTIFACT = "volEnvArtifact"; - private static final String VOL_ENV_ARTIFACT_UUID = "volEnvArtifactUuid"; - - private VfModuleCustomizationToVduMapper testedObject; - private CatalogDatabase catalogDatabaseMock; - - @Before - public void init() { - PowerMockito.mockStatic(CatalogDatabase.class); - catalogDatabaseMock = mock(CatalogDatabase.class); - testedObject = new VfModuleCustomizationToVduMapper(); - PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(catalogDatabaseMock); - when(catalogDatabaseMock.getNestedTemplates(HEAT_TEMPLATE_ARTIFACT_UUID)).thenReturn(createNestedTemplates()); - when(catalogDatabaseMock.getHeatFilesForVfModule(VF_MODULE_MODEL_UUID)).thenReturn(createHeatFileMap()); - } - - @Test - public void mapVfModuleCustomizationToVdu_successful() { - when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID)) - .thenReturn(createHeatTemplate()); - when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(HEAT_ENV_ARTIFACT_UUID)) - .thenReturn(createHeatEnvironment()); - VduModelInfo result = testedObject.mapVfModuleCustomizationToVdu(createVfModuleCustomization()); - assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); - } - - @Test - public void mapVfModuleCustVolumeToVdu_successful() { - when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(VOL_HEAT_TEMPLATE_ARTIFACT)) - .thenReturn(createHeatTemplate()); - when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(VOL_ENV_ARTIFACT_UUID)) - .thenReturn(createHeatEnvironment()); - VduModelInfo result = testedObject.mapVfModuleCustVolumeToVdu(createVfModuleCustomization()); - assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); - } - - private VfModuleCustomization createVfModuleCustomization() { - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - VfModule vfModule = new VfModule(); - vfModule.setHeatTemplateArtifactUUId(HEAT_TEMPLATE_ARTIFACT_UUID); - vfModule.setVolHeatTemplateArtifactUUId(VOL_HEAT_TEMPLATE_ARTIFACT); - vfModuleCustomization.setVfModule(vfModule); - vfModuleCustomization.setVfModuleModelUuid(VF_MODULE_MODEL_UUID); - vfModuleCustomization.setHeatEnvironmentArtifactUuid(HEAT_ENV_ARTIFACT_UUID); - vfModuleCustomization.setVolEnvironmentArtifactUuid(VOL_ENV_ARTIFACT_UUID); - return vfModuleCustomization; - } - - private HeatTemplate createHeatTemplate() { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setTemplateName(MAIN_TEMPLATE_NAME); - heatTemplate.setTemplateBody(MAIN_TEMPLATE_BODY); - heatTemplate.setArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID); - return heatTemplate; - } - - private Map<String, Object> createNestedTemplates() { - Map<String, Object> map = new HashMap<>(); - map.put(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE); - return map; - } - - private Map<String, HeatFiles> createHeatFileMap() { - HeatFiles heatFiles = new HeatFiles(); - heatFiles.setFileName(HEAT_FILE_NAME); - heatFiles.setFileBody(HEAT_FILE_BODY); - Map<String, HeatFiles> map = new HashMap<>(); - map.put("heatFileKey", heatFiles); - return map; - } - - private HeatEnvironment createHeatEnvironment() { - HeatEnvironment heatEnvironment = new HeatEnvironment(); - heatEnvironment.setName(HEAT_ENV_NAME); - heatEnvironment.setEnvironment(HEAT_ENV); - return heatEnvironment; - } - - - private VduArtifact[] createExpectedResultArray() { - VduArtifact[] vduArtifactsArray = new VduArtifact[4]; - vduArtifactsArray[0] = new VduArtifact(MAIN_TEMPLATE_NAME, MAIN_TEMPLATE_BODY.getBytes(), - ArtifactType.MAIN_TEMPLATE); - vduArtifactsArray[1] = new VduArtifact(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE.getBytes(), - ArtifactType.NESTED_TEMPLATE); - vduArtifactsArray[2] = createVduArtifact(HEAT_FILE_NAME, HEAT_FILE_BODY, ArtifactType.TEXT_FILE); - vduArtifactsArray[3] = createVduArtifact(HEAT_ENV_NAME, HEAT_ENV, ArtifactType.ENVIRONMENT); - return vduArtifactsArray; - } - - private VduArtifact createVduArtifact(String name, String content, ArtifactType artifactType) { - VduArtifact vduArtifact = new VduArtifact(); - vduArtifact.setName(name); - vduArtifact.setContent(content.getBytes()); - vduArtifact.setType(artifactType); - return vduArtifact; - } - -} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java index bbd7cc06e3..2383e7d810 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java @@ -36,7 +36,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { http.csrf().disable() .authorizeRequests() .antMatchers("/manage/health","/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",")) .and() .httpBasic(); } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 7423a7a197..55a437f2c0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -25,6 +25,7 @@ package org.onap.so.asdc.client; import java.io.FileOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.util.ArrayList; import java.util.List; import org.onap.sdc.api.IDistributionClient; @@ -44,6 +45,7 @@ import org.onap.so.asdc.client.exceptions.ASDCParametersException; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.installer.IVfResourceInstaller; import org.onap.so.asdc.installer.ToscaResourceStructure; +import org.onap.so.asdc.installer.VfModuleStructure; import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.asdc.tenantIsolation.DistributionStatus; @@ -671,7 +673,23 @@ public class ASDCController { try { - this.processCsarServiceArtifacts(iNotif, toscaResourceStructure); + this.processCsarServiceArtifacts(iNotif, toscaResourceStructure); + + // Install a service with no resources, only the service itself + if (iNotif.getResources() == null || iNotif.getResources().size() < 1) { + + LOGGER.debug("No resources found for Service: " + iNotif.getServiceUUID()); + + try{ + resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance()); + + this.deployResourceStructure(resourceStructure, toscaResourceStructure); + + } catch(ArtifactInstallerException e){ + deploySuccessful = false; + errorMessage = e.getMessage(); + } + } else { // Services with resources for (IResourceInstance resource : iNotif.getResources()){ @@ -695,23 +713,21 @@ public class ASDCController { resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact); } } - } - } - try{ - + } + //Deploy All resources and artifacts LOGGER.debug("Preparing to deploy Service: " + iNotif.getServiceUUID()); - if(resourceStructure == null){ - resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance()); - } - this.deployResourceStructure(resourceStructure, toscaResourceStructure); - - - } catch(ArtifactInstallerException e){ - deploySuccessful = false; - errorMessage = e.getMessage(); - } - + try{ + + this.deployResourceStructure(resourceStructure, toscaResourceStructure); + + } catch(ArtifactInstallerException e){ + deploySuccessful = false; + errorMessage = e.getMessage(); + } + + } + } this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage); } catch (ASDCDownloadException | UnsupportedEncodingException e) { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index 565ddf42b5..8353f708a9 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -65,7 +65,6 @@ public class ToscaResourceStructure { String envHeatTemplateUUID; String heatFilesUUID; String workloadPerformance; - boolean isVnfAlreadyInstalled = false; String serviceVersion; private boolean isDeployedSuccessfully=false; @@ -314,14 +313,6 @@ public class ToscaResourceStructure { this.toscaCsar = toscaCsar; } - public boolean isVnfAlreadyInstalled() { - return isVnfAlreadyInstalled; - } - - public void setVnfAlreadyInstalled(boolean isVnfAlreadyInstalled) { - this.isVnfAlreadyInstalled = isVnfAlreadyInstalled; - } - public String getVolHeatTemplateUUID() { return volHeatTemplateUUID; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index ea952f6daf..7dfb1bae3e 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -33,6 +33,7 @@ import java.util.Set; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.LockAcquisitionException; import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.sdc.api.notification.IResourceInstance; import org.onap.sdc.api.notification.IStatusData; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.tosca.parser.impl.SdcTypes; @@ -424,46 +425,35 @@ public class ToscaResourceInstaller { String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper() .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - logger.debug("vfCustomizationUUID=" + vfCustomizationUUID); + logger.debug("vfCustomizationUUID=" + vfCustomizationUUID); - VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); + IResourceInstance vfMetaDataResource = vfResourceStructure.getResourceInstance(); - for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { - logger.debug("vfModuleStructure:" + vfModuleStructure.toString()); - List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct - .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); - IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); - Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream(). - filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())). - findFirst(); - if(matchingObject.isPresent()){ - VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource); - vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); - }else - throw (new Exception("Cannot find matching VFModule Customization")); + // Make sure the vfMetadata and tosca customizations match before comparing their VF Modules UUID's + if(vfCustomizationUUID.equals(vfMetaDataResource.getResourceCustomizationUUID())){ - } - service.getVnfCustomizations().add(vnfResource); - } - } - - protected void processFlexware(ToscaResourceStructure toscaResourceStruct, Service service, NodeTemplate nodeTemplate, - String serviceType) { - if (serviceType != null && serviceType.equalsIgnoreCase("Flexware")) { - - createVnfResource(nodeTemplate, toscaResourceStruct, service); - String modelName = toscaResourceStruct.getVnfResourceCustomization().getVnfResources().getModelName(); + logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfMetaData CustomizationUUID"); + + VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); - String modelVersion = BigDecimalVersion.castAndCheckNotificationVersionToString( - toscaResourceStruct.getCatalogVnfResourceCustomization().getVnfResources().getModelVersion()); - // check for duplicate record already in the database - VnfResource vnfResource = vnfRepo.findByModelNameAndModelVersion(modelName, modelVersion); - - if (vnfResource != null) { - toscaResourceStruct.setVnfAlreadyInstalled(true); - } - - vnfCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogVnfResourceCustomization()); + for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { + logger.debug("vfModuleStructure ModelUUID: " + vfModuleStructure.toString()); + List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct + .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); + IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); + + Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream(). + filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())). + findFirst(); + if(matchingObject.isPresent()){ + VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource); + vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); + }else + throw new Exception("Cannot find matching VFModule Customization for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID()); + + } + service.getVnfCustomizations().add(vnfResource); + } } } @@ -1263,12 +1253,20 @@ public class ToscaResourceInstaller { // Set all Child Templates related to HEAT_VOLUME if(!volumeHeatChildTemplates.isEmpty()){ - vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates); + if(vfModule.getVolumeHeatTemplate() != null){ + vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates); + }else{ + logger.debug("VolumeHeatTemplate not set in setHeatInformationForVfModule()"); + } } // Set all Child Templates related to HEAT if(!heatChildTemplates.isEmpty()){ - vfModule.getVolumeHeatTemplate().setChildTemplates(heatChildTemplates); + if(vfModule.getModuleHeatTemplate() != null){ + vfModule.getModuleHeatTemplate().setChildTemplates(heatChildTemplates); + }else{ + logger.debug("ModuleHeatTemplate not set in setHeatInformationForVfModule()"); + } } } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java index ef5b889d09..54977104ff 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java @@ -209,9 +209,16 @@ public class ASDCNotificationLogging { List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList(); for (NodeTemplate vfNodeTemplate : vfNodeTemplatesList) { + buffer.append(System.lineSeparator()); + buffer.append("VNF Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("Model Name:"); buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); buffer.append("Description:"); buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java index de0d2e08a1..1e8b72d145 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java @@ -83,7 +83,6 @@ public class ToscaResourceStructureTest { toscaResourceStructure.setHeatFilesUUID("heatFilesUUID"); toscaResourceStructure.setToscaArtifact(artifactInfo); toscaResourceStructure.setToscaCsar(new ToscaCsar()); - toscaResourceStructure.setVnfAlreadyInstalled(true); toscaResourceStructure.setVolHeatTemplateUUID("volHeatTemplateUUID"); toscaResourceStructure.setEnvHeatTemplateUUID("envHeatTemplateUUID"); toscaResourceStructure.setServiceVersion("serviceVersion"); @@ -111,7 +110,6 @@ public class ToscaResourceStructureTest { assertEquals("heatFilesUUID", toscaResourceStructure.getHeatFilesUUID()); assertEquals(artifactInfo, toscaResourceStructure.getToscaArtifact()); assertThat(toscaResourceStructure.getToscaCsar(), sameBeanAs(new ToscaCsar())); - assertEquals(true, toscaResourceStructure.isVnfAlreadyInstalled()); assertEquals("volHeatTemplateUUID", toscaResourceStructure.getVolHeatTemplateUUID()); assertEquals("envHeatTemplateUUID", toscaResourceStructure.getEnvHeatTemplateUUID()); assertEquals("serviceVersion", toscaResourceStructure.getServiceVersion()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index d96e480945..89bfe07374 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -102,8 +102,6 @@ public class ToscaResourceInstallerTest extends BaseTest { private AllottedResourceCustomizationRepository allottedCustomizationRepo; @Autowired private ServiceRepository serviceRepo; - @Autowired - private ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository; @Mock private SdcCsarHelperImpl sdcCsarHelper; @Mock @@ -121,10 +119,6 @@ public class ToscaResourceInstallerTest extends BaseTest { private JsonStatusData statusData; private static final String MSO = "SO"; - private AllottedResource allottedResource; - private AllottedResourceCustomization allottedResourceCustomization; - private Service catalogService; - @Before public void before() { MockitoAnnotations.initMocks(this); @@ -343,7 +337,6 @@ public class ToscaResourceInstallerTest extends BaseTest { doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources(); doReturn(metadata).when(nodeTemplate).getMetaData(); doReturn("model_instance_name").when(nodeTemplate).getName(); - doReturn(false).when(toscaResourceStruct).isVnfAlreadyInstalled(); doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization(); doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource(); doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization(); @@ -381,7 +374,6 @@ public class ToscaResourceInstallerTest extends BaseTest { .ignoring("createTime") .ignoring("modifyTime")); } - @Test public void installTheResourceExceptionTest() throws Exception { @@ -473,7 +465,4 @@ public class ToscaResourceInstallerTest extends BaseTest { } return actualWatchdogComponentDistributionStatus; } - - - } diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt b/asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt deleted file mode 100644 index 5b6d9e4eaf..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt +++ /dev/null @@ -1,302 +0,0 @@ -DistributionID:a2872f55-8628-4486-8548-7b132c9a47db -ServiceName:Vf zrdm5bpxmc02092017-Service -ServiceVersion:1.0 -ServiceUUID:bad955c3-29b2-4a27-932e-28e942cc6480 -ServiceInvariantUUID:b16a9398-ffa3-4041-b78c-2956b8ad9c7b -ServiceDescription:Demo - - - -Service Artifacts List: -{ -Service Artifacts Info: -ArtifactName:service-VfZrdm5bpxmc02092017Service-csar.csar -ArtifactVersion:1 -ArtifactType:TOSCA_CSAR -ArtifactDescription:TOSCA definition package of the asset -ArtifactTimeout:0 -ArtifactURL:service-VfZrdm5bpxmc02092017Service-csar.csar -ArtifactUUID:396cfd49-0f4b-4fec-9f33-0fd7e90d5a22 -ArtifactChecksum:MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - - -} - -Resource Instances List: -{ -Resource Instance Info: -ResourceInstanceName:Vf zrdm5bpxmc02092017-VF 0 -ResourceCustomizationUUID:96c23a4a-6887-4b2c-9cce-1e4ea35eaade -ResourceInvariantUUID:23122c9b-dd7f-483f-bf0a-e069303db2f7 -ResourceName:Vf zrdm5bpxmc02092017-VF -ResourceType:VF -ResourceUUID:14ba5d1e-3862-407c-a236-1cbaebccce77 -ResourceVersion:1.0 -Category:Generic -SubCategory:Network Elements -Resource Artifacts List: -{ -Service Artifacts Info: -ArtifactName:pxmc_mmn_volume.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.env -ArtifactUUID:c1ae6284-48d9-4437-a195-b2cf2ba23070 -ArtifactChecksum:NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} -, -Service Artifacts Info: -ArtifactName:pxmc_base.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.env -ArtifactUUID:6dd99c31-c52e-4c45-b99b-d223c877a296 -ArtifactChecksum:OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -, -Service Artifacts Info: -ArtifactName:vfzrdm5bpxmc02092017vf0_modules.json -ArtifactVersion:1 -ArtifactType:VF_MODULES_METADATA -ArtifactDescription:Auto-generated VF Modules information artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/vfzrdm5bpxmc02092017vf0_modules.json -ArtifactUUID:e3b82cd6-485e-4d56-8d2c-17ccf6a59533 -ArtifactChecksum:MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -, -Service Artifacts Info: -ArtifactName:pxmc_vmt.yaml -ArtifactVersion:1 -ArtifactType:HEAT -ArtifactDescription:created from csar -ArtifactTimeout:120 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.yaml -ArtifactUUID:ad12ab80-5419-4346-a5d7-dac2fc15575f -ArtifactChecksum:ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE= -GeneratedArtifact:{Service Artifacts Info: -ArtifactName:pxmc_vmt.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.env -ArtifactUUID:bc1640f1-69f0-4760-8fc3-3318ec2ff129 -ArtifactChecksum:MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} -} -RelatedArtifacts:{ -Service Artifacts Info: -ArtifactName:user_data_zrdm5bpxmc02vmt001.txt -ArtifactVersion:1 -ArtifactType:HEAT_ARTIFACT -ArtifactDescription:created from csar -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02vmt001.txt -ArtifactUUID:53acdabe-689f-45e5-8578-f1514d3529da -ArtifactChecksum:MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - - -} - - -, -Service Artifacts Info: -ArtifactName:pxmc_mmn.yaml -ArtifactVersion:1 -ArtifactType:HEAT -ArtifactDescription:created from csar -ArtifactTimeout:120 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.yaml -ArtifactUUID:b8bca13b-811f-44ab-9d27-45b842c664d8 -ArtifactChecksum:YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE= -GeneratedArtifact:{Service Artifacts Info: -ArtifactName:pxmc_mmn.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.env -ArtifactUUID:e88ce0b9-1496-4d03-ab1d-6d8d79bfc737 -ArtifactChecksum:ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} -} -RelatedArtifacts:{ -Service Artifacts Info: -ArtifactName:user_data_zrdm5bpxmc02mmn001.txt -ArtifactVersion:1 -ArtifactType:HEAT_ARTIFACT -ArtifactDescription:created from csar -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02mmn001.txt -ArtifactUUID:5bc62c72-5f7a-40bc-a167-1a4fed9afdef -ArtifactChecksum:OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - - -} - - -, -Service Artifacts Info: -ArtifactName:pxmc_mmn.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.env -ArtifactUUID:e88ce0b9-1496-4d03-ab1d-6d8d79bfc737 -ArtifactChecksum:ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -, -Service Artifacts Info: -ArtifactName:pxmc_vmt.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.env -ArtifactUUID:bc1640f1-69f0-4760-8fc3-3318ec2ff129 -ArtifactChecksum:MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} -, -Service Artifacts Info: -ArtifactName:user_data_zrdm5bpxmc02mmn001.txt -ArtifactVersion:1 -ArtifactType:HEAT_ARTIFACT -ArtifactDescription:created from csar -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02mmn001.txt -ArtifactUUID:5bc62c72-5f7a-40bc-a167-1a4fed9afdef -ArtifactChecksum:OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -, -Service Artifacts Info: -ArtifactName:pxmc_base.yaml -ArtifactVersion:1 -ArtifactType:HEAT -ArtifactDescription:created from csar -ArtifactTimeout:120 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.yaml -ArtifactUUID:7e7f7356-11bd-4f2f-bbbc-5c10954e3189 -ArtifactChecksum:YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM= -GeneratedArtifact:{Service Artifacts Info: -ArtifactName:pxmc_base.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.env -ArtifactUUID:6dd99c31-c52e-4c45-b99b-d223c877a296 -ArtifactChecksum:OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -} -RelatedArtifacts:{ -} -, -Service Artifacts Info: -ArtifactName:user_data_zrdm5bpxmc02vmt001.txt -ArtifactVersion:1 -ArtifactType:HEAT_ARTIFACT -ArtifactDescription:created from csar -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02vmt001.txt -ArtifactUUID:53acdabe-689f-45e5-8578-f1514d3529da -ArtifactChecksum:MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -, -Service Artifacts Info: -ArtifactName:pxmc_mmn_volume.yaml -ArtifactVersion:2 -ArtifactType:HEAT_VOL -ArtifactDescription:created from csar -ArtifactTimeout:120 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.yaml -ArtifactUUID:2f372a02-df1b-46ca-b81e-822e3f406965 -ArtifactChecksum:MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI= -GeneratedArtifact:{Service Artifacts Info: -ArtifactName:pxmc_mmn_volume.env -ArtifactVersion:2 -ArtifactType:HEAT_ENV -ArtifactDescription:Auto-generated HEAT Environment deployment artifact -ArtifactTimeout:0 -ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.env -ArtifactUUID:c1ae6284-48d9-4437-a195-b2cf2ba23070 -ArtifactChecksum:NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU= -GeneratedArtifact:{NULL -} -RelatedArtifacts:{ -} - - -} -RelatedArtifacts:{ -} - - - -} - - - -} diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json deleted file mode 100644 index 37b7987f46..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json +++ /dev/null @@ -1,458 +0,0 @@ -{ - "modelName": "Vf zrdm5bpxmc02092017-Service", - "description": "Demo", - "modelUUID": "bad955c3-29b2-4a27-932e-28e942cc6480", - "modelInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", - "serviceType": "", - "serviceRole": "", - "environmentContext": "General_Revenue-Bearing", - "networkCustomizations": [], - "vnfCustomizations": [ - { - "modelCustomizationUuid": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade", - "modelInstanceName": "Vf zrdm5bpxmc02092017-VF 0", - "multiStageDesign": "false", - "vnfResources": { - "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", - "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "modelName": "Vf zrdm5bpxmc02092017-VF", - "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", - "description": "Demo", - "orchestrationMode": "HEAT", - "modelVersion": "1.0", - "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" - }, - "vfModuleCustomizations": [ - { - "modelCustomizationUuid": "074c64d0-7e13-4bcc-8bdb-ea922331102d", - "label": "pxmc_base", - "minInstances": 1, - "maxInstances": 1, - "initialCount": 1, - "heatEnvironment": { - "artifactUuid": "6dd99c31-c52e-4c45-b99b-d223c877a296", - "name": "pxmc_base.env", - "description": "Auto-generated HEAT Environment deployment artifact", - "environment": "parameters:\n vnf_name: \n", - "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=", - "version": "2" - }, - "vfModule": { - "modelUUID": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46", - "modelInvariantUUID": "f7a867f2-596b-4f4a-a128-421e825a6190", - "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_base..module-0", - "modelVersion": "1", - "isBase": 1, - "moduleHeatTemplate": { - "artifactUuid": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189", - "templateName": "pxmc_base.yaml", - "templateBody": "heat_template_version: 2015-04-30\n\nparameters:\n\n## GLOBAL//Basic Parameters\n vnf_name:\n type: string\n description: Unique name for this VF instance\n# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC\n\nresources:\n\n## MSP RSG//Resource:SecurityGroup\n sec_grp_msp_0:\n type: OS::Neutron::SecurityGroup\n properties:\n description: Security Group for PXMC\n name:\n str_replace:\n template: VF_NAME_sec_grp_msp\n params:\n VF_NAME: { get_param: vnf_name }\n rules:\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n\noutputs:\n\n sec_grp_msp_id:\n description: uuid of the security group\n value: {get_resource: sec_grp_msp_0 }\n", - "timeoutMinutes": 120, - "version": "1", - "description": "created from csar", - "artifactChecksum": "YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM=", - "parameters": [ - { - "heatTemplateArtifactUuid": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189", - "paramName": "vnf_name", - "required": true, - "paramType": "string" - } - ], - "childTemplates": [], - "heatTemplate": "heat_template_version: 2015-04-30\n\nparameters:\n\n## GLOBAL//Basic Parameters\n vnf_name:\n type: string\n description: Unique name for this VF instance\n# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC\n\nresources:\n\n## MSP RSG//Resource:SecurityGroup\n sec_grp_msp_0:\n type: OS::Neutron::SecurityGroup\n properties:\n description: Security Group for PXMC\n name:\n str_replace:\n template: VF_NAME_sec_grp_msp\n params:\n VF_NAME: { get_param: vnf_name }\n rules:\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n\noutputs:\n\n sec_grp_msp_id:\n description: uuid of the security group\n value: {get_resource: sec_grp_msp_0 }\n" - }, - "heatFiles": [], - "vnfResources": { - "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", - "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "modelName": "Vf zrdm5bpxmc02092017-VF", - "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", - "description": "Demo", - "orchestrationMode": "HEAT", - "modelVersion": "1.0", - "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" - }, - "modelInvariantUuid": "f7a867f2-596b-4f4a-a128-421e825a6190", - "base": true - } - }, - { - "modelCustomizationUuid": "5336a98e-0966-4e59-b6e6-c8162804a024", - "label": "pxmc_vmt", - "minInstances": 0, - "initialCount": 0, - "heatEnvironment": { - "artifactUuid": "bc1640f1-69f0-4760-8fc3-3318ec2ff129", - "name": "pxmc_vmt.env", - "description": "Auto-generated HEAT Environment deployment artifact", - "environment": "parameters:\n cinder_delete_on_termination_false: \n cinder_delete_on_termination_true: \n oam_protected_net_name: \n sec_grp_msp_id: \n vf_module_id: \n vmt_block_device_names: \n vmt_flavor_name: \n vmt_name_0: \n vmt_oam_protected_ip_0: \n vmt_volume_image_name_0: \n vmt_volume_image_name_1: \n vmt_volume_name_0: \n vmt_volume_name_1: \n vmt_volume_size_0: \n vmt_volume_size_1: \n vnf_id: \n", - "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=", - "version": "2" - }, - "vfModule": { - "modelUUID": "4d4423e2-17e8-455a-b9ae-7e4ab71b9cdc", - "modelInvariantUUID": "1e099992-6222-41a9-acde-5a8abb690775", - "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_vmt..module-1", - "modelVersion": "1", - "isBase": 0, - "moduleHeatTemplate": { - "artifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "templateName": "pxmc_vmt.yaml", - "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant\n\nparameters:\n vmt_name_0:\n type: string\n label: MSP VMT server names\n description: name of the MSP VMT instances\n# vmt_image_name:\n# type: string\n# label: MSP VMT image name\n# description: MSP VMT image name\n vmt_flavor_name:\n type: string\n label: MSP VMT flavor name\n description: MSP VMT flavor name\n# availability_zone_0:\n# type: string\n# label: MSP VMT availability zones\n# description: MSP VMT availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n vmt_oam_protected_ip_0:\n type: string\n label: MSP VMT OAM IP Addresses\n description: MSP VMT OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP VMT OAM net name\n description: MSP VMT OAM net name\n vmt_block_device_names:\n type: comma_delimited_list\n label: MSP VMT Block Device Names\n description: MSP VMT Block Device Names\n vmt_volume_name_0:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_name_1:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_size_0:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_size_1:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_image_name_0:\n type: string\n label: Mobisupport MSP VMT VDA Cinder Volume image name\n description: Mobisupport MSP VMT VDA Cinder Volume image name\n vmt_volume_image_name_1:\n type: string\n label: Mobisupport MSP VMT VDB Cinder Volume image name\n description: Mobisupport MSP VMT VDB Cinder Volume image name\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP VMT VNF ID\n description: MSP VMT VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF Module instance\n\nresources:\n################ Cinder Volumes ##############################\n vmt_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_0}\n size: {get_param: vmt_volume_size_0}\n image: {get_param: vmt_volume_image_name_0}\n\n vmt_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_1}\n size: {get_param: vmt_volume_size_1}\n image: {get_param: vmt_volume_image_name_1}\n\n################ Ports ##############################\n vmt_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: vmt_oam_protected_ip_0}}]\n security_groups: [{get_param: sec_grp_msp_id}]\n replacement_policy: AUTO\n\n################### Servers #########################\n vmt_zrdm5bpxmc02vmt_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: vmt_name_0}\n# image: {get_param: vmt_image_name}\n flavor: {get_param: vmt_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2: \n - device_name: {get_param: [vmt_block_device_names, 0]}\n volume_id: {get_resource: vmt_volume_0}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: 0\n - device_name: {get_param: [vmt_block_device_names, 1]}\n volume_id: {get_resource: vmt_volume_1}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: -1\n networks:\n - port: {get_resource: vmt_oam_protected_0_port}\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02vmt001.txt\n\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n", - "timeoutMinutes": 120, - "version": "1", - "description": "created from csar", - "artifactChecksum": "ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE=", - "parameters": [ - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_name_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vf_module_id", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "sec_grp_msp_id", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_volume_name_1", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_volume_name_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_block_device_names", - "required": true, - "paramType": "comma_delimited_list" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_flavor_name", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vnf_id", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "oam_protected_net_name", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_volume_image_name_1", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_volume_image_name_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_oam_protected_ip_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_volume_size_0", - "required": true, - "paramType": "number" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "cinder_delete_on_termination_false", - "required": true, - "paramType": "boolean" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "vmt_volume_size_1", - "required": true, - "paramType": "number" - }, - { - "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "paramName": "cinder_delete_on_termination_true", - "required": true, - "paramType": "boolean" - } - ], - "childTemplates": [], - "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant\n\nparameters:\n vmt_name_0:\n type: string\n label: MSP VMT server names\n description: name of the MSP VMT instances\n# vmt_image_name:\n# type: string\n# label: MSP VMT image name\n# description: MSP VMT image name\n vmt_flavor_name:\n type: string\n label: MSP VMT flavor name\n description: MSP VMT flavor name\n# availability_zone_0:\n# type: string\n# label: MSP VMT availability zones\n# description: MSP VMT availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n vmt_oam_protected_ip_0:\n type: string\n label: MSP VMT OAM IP Addresses\n description: MSP VMT OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP VMT OAM net name\n description: MSP VMT OAM net name\n vmt_block_device_names:\n type: comma_delimited_list\n label: MSP VMT Block Device Names\n description: MSP VMT Block Device Names\n vmt_volume_name_0:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_name_1:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_size_0:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_size_1:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_image_name_0:\n type: string\n label: Mobisupport MSP VMT VDA Cinder Volume image name\n description: Mobisupport MSP VMT VDA Cinder Volume image name\n vmt_volume_image_name_1:\n type: string\n label: Mobisupport MSP VMT VDB Cinder Volume image name\n description: Mobisupport MSP VMT VDB Cinder Volume image name\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP VMT VNF ID\n description: MSP VMT VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF Module instance\n\nresources:\n################ Cinder Volumes ##############################\n vmt_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_0}\n size: {get_param: vmt_volume_size_0}\n image: {get_param: vmt_volume_image_name_0}\n\n vmt_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_1}\n size: {get_param: vmt_volume_size_1}\n image: {get_param: vmt_volume_image_name_1}\n\n################ Ports ##############################\n vmt_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: vmt_oam_protected_ip_0}}]\n security_groups: [{get_param: sec_grp_msp_id}]\n replacement_policy: AUTO\n\n################### Servers #########################\n vmt_zrdm5bpxmc02vmt_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: vmt_name_0}\n# image: {get_param: vmt_image_name}\n flavor: {get_param: vmt_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2: \n - device_name: {get_param: [vmt_block_device_names, 0]}\n volume_id: {get_resource: vmt_volume_0}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: 0\n - device_name: {get_param: [vmt_block_device_names, 1]}\n volume_id: {get_resource: vmt_volume_1}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: -1\n networks:\n - port: {get_resource: vmt_oam_protected_0_port}\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02vmt001.txt\n\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n" - }, - "heatFiles": [], - "vnfResources": { - "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", - "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "modelName": "Vf zrdm5bpxmc02092017-VF", - "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", - "description": "Demo", - "orchestrationMode": "HEAT", - "modelVersion": "1.0", - "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" - }, - "modelInvariantUuid": "1e099992-6222-41a9-acde-5a8abb690775", - "base": false - } - }, - { - "modelCustomizationUuid": "e38906fa-717c-49b0-b391-e6ec12b50c4a", - "label": "pxmc_mmn", - "minInstances": 0, - "initialCount": 0, - "heatEnvironment": { - "artifactUuid": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737", - "name": "pxmc_mmn.env", - "description": "Auto-generated HEAT Environment deployment artifact", - "environment": "parameters:\n cinder_delete_on_termination_false: \n cinder_delete_on_termination_true: \n mmn_arch_volume_id_2: \n mmn_backup_volume_id_3: \n mmn_block_device_names: \n mmn_data_volume_id_1: \n mmn_flavor_name: \n mmn_misc_volume_id_4: \n mmn_name_0: \n mmn_oam_protected_ip_0: \n mmn_volume_image_name_0: \n mmn_volume_name_0: \n mmn_volume_size_0: \n oam_protected_net_name: \n sec_grp_msp_id: \n vf_module_id: \n vnf_id: \n", - "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=", - "version": "2" - }, - "vfModule": { - "modelUUID": "a8cb1182-9b6d-46f8-b06b-ded4fe69e10d", - "modelInvariantUUID": "8e53c069-b2f0-437a-9c00-21cbc5c8f081", - "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_mmn..module-2", - "modelVersion": "1", - "isBase": 0, - "volumeHeatTemplate": { - "artifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "templateName": "pxmc_mmn_volume.yaml", - "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant\n\nparameters:\n mmn_volume_name_1:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_2:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_3:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_4:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_size_1:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_2:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_3:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_4:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\nresources:\n mmn_data_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_1}\n size: {get_param: mmn_volume_size_1}\n \n mmn_arch_volume_2:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_2}\n size: {get_param: mmn_volume_size_2}\n \n mmn_backup_volume_3:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_3}\n size: {get_param: mmn_volume_size_3}\n \n mmn_misc_volume_4:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_4}\n size: {get_param: mmn_volume_size_4}\n\noutputs:\n mmn_data_volume_id_1:\n description: msp mmn data volume 1\n value: {get_resource: mmn_data_volume_1}\n \n mmn_arch_volume_id_2:\n description: msp mn arch volume 2\n value: {get_resource: mmn_arch_volume_2}\n \n mmn_backup_volume_id_3:\n description: msp mn backup volume 3\n value: {get_resource: mmn_backup_volume_3}\n \n mmn_misc_volume_id_4:\n description: msp mn volume 4\n value: {get_resource: mmn_misc_volume_4}\n", - "timeoutMinutes": 120, - "version": "2", - "description": "created from csar", - "artifactChecksum": "MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI=", - "parameters": [ - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_name_2", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_size_2", - "required": true, - "paramType": "number" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_name_1", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_size_1", - "required": true, - "paramType": "number" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_name_4", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_name_3", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_size_4", - "required": true, - "paramType": "number" - }, - { - "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965", - "paramName": "mmn_volume_size_3", - "required": true, - "paramType": "number" - } - ], - "childTemplates": [], - "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant\n\nparameters:\n mmn_volume_name_1:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_2:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_3:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_4:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_size_1:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_2:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_3:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_4:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\nresources:\n mmn_data_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_1}\n size: {get_param: mmn_volume_size_1}\n \n mmn_arch_volume_2:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_2}\n size: {get_param: mmn_volume_size_2}\n \n mmn_backup_volume_3:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_3}\n size: {get_param: mmn_volume_size_3}\n \n mmn_misc_volume_4:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_4}\n size: {get_param: mmn_volume_size_4}\n\noutputs:\n mmn_data_volume_id_1:\n description: msp mmn data volume 1\n value: {get_resource: mmn_data_volume_1}\n \n mmn_arch_volume_id_2:\n description: msp mn arch volume 2\n value: {get_resource: mmn_arch_volume_2}\n \n mmn_backup_volume_id_3:\n description: msp mn backup volume 3\n value: {get_resource: mmn_backup_volume_3}\n \n mmn_misc_volume_id_4:\n description: msp mn volume 4\n value: {get_resource: mmn_misc_volume_4}\n" - }, - "moduleHeatTemplate": { - "artifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "templateName": "pxmc_mmn.yaml", - "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus vMSP MMN stack.\n\nparameters:\n mmn_name_0:\n type: string\n label: MSP MMN server names\n description: name of the MSP MMN instances\n mmn_flavor_name:\n type: string\n label: MSP MMN flavor name\n description: MSP MMN flavor name\n# mmn_image_name:\n# type: string\n# label: MSP MMN image name\n# description: MSP MMN image name\n# availability_zone_0:\n# type: string\n# label: MSP MMN availability zones\n# description: MSP MMN availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n mmn_oam_protected_ip_0:\n type: string\n label: MSP MMN OAM IP Addresses\n description: MSP MMN OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP MMN OAM net name\n description: MSP MMN OAM net name\n mmn_volume_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n mmn_volume_size_0:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n mmn_volume_image_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume image name\n description: Mobisupport MSP MMN Cinder Volume image name\n mmn_data_volume_id_1:\n type: string\n label: MSP MMN Volume id 1\n description: MSP MMN Volume id 1\n mmn_arch_volume_id_2:\n type: string\n label: MSP MMN Volume id 2\n description: MSP MMN Volume id 2\n mmn_backup_volume_id_3:\n type: string\n label: MSP MMN Volume id 3\n description: MSP MMN Volume id 3\n mmn_misc_volume_id_4:\n type: string\n label: MSP MMN Volume id 4\n description: MSP MMN Volume id 4\n mmn_block_device_names:\n type: comma_delimited_list\n label: MSP MMN Block Device Names\n description: MSP MMN Block Device Names\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP MMN VNF ID\n description: MSP MMN VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF module instance\n\nresources:\n################ Cinder Volume ########################\n mmn_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_0}\n size: {get_param: mmn_volume_size_0}\n image: {get_param: mmn_volume_image_name_0}\n\n################ Server ##############################\n mmn_zrdm5bpxmc02mmn_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: mmn_name_0}\n# image: {get_param: mmn_image_name}\n flavor: {get_param: mmn_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2:\n - device_name: { get_param: [mmn_block_device_names, 0] }\n volume_id: { get_resource: mmn_volume_0 }\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n networks:\n - port: { get_resource: mmn_oam_protected_0_port }\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02mmn001.txt\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n\n################ Ports ##############################\n mmn_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: mmn_oam_protected_ip_0}}]\n security_groups: [{ get_param: sec_grp_msp_id }]\n replacement_policy: AUTO\n\n################ Volume Attachment ##############################\n volume_attachment_vdb:\n type: OS::Cinder::VolumeAttachment\n depends_on: mmn_zrdm5bpxmc02mmn_0\n properties:\n volume_id: { get_param: mmn_data_volume_id_1 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdb\n\n volume_attachment_vdc:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdb\n properties:\n volume_id: { get_param: mmn_arch_volume_id_2 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdc\n\n volume_attachment_vdd:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdc\n properties:\n volume_id: { get_param: mmn_backup_volume_id_3 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdd\n\n volume_attachment_vde:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdd\n properties:\n volume_id: { get_param: mmn_misc_volume_id_4 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vde\n", - "timeoutMinutes": 120, - "version": "1", - "description": "created from csar", - "artifactChecksum": "YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE=", - "parameters": [ - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "vnf_id", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_block_device_names", - "required": true, - "paramType": "comma_delimited_list" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_name_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_arch_volume_id_2", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_volume_image_name_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "cinder_delete_on_termination_false", - "required": true, - "paramType": "boolean" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_oam_protected_ip_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_data_volume_id_1", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_backup_volume_id_3", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "vf_module_id", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "sec_grp_msp_id", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_volume_size_0", - "required": true, - "paramType": "number" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "cinder_delete_on_termination_true", - "required": true, - "paramType": "boolean" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_volume_name_0", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "oam_protected_net_name", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_misc_volume_id_4", - "required": true, - "paramType": "string" - }, - { - "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "paramName": "mmn_flavor_name", - "required": true, - "paramType": "string" - } - ], - "childTemplates": [], - "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus vMSP MMN stack.\n\nparameters:\n mmn_name_0:\n type: string\n label: MSP MMN server names\n description: name of the MSP MMN instances\n mmn_flavor_name:\n type: string\n label: MSP MMN flavor name\n description: MSP MMN flavor name\n# mmn_image_name:\n# type: string\n# label: MSP MMN image name\n# description: MSP MMN image name\n# availability_zone_0:\n# type: string\n# label: MSP MMN availability zones\n# description: MSP MMN availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n mmn_oam_protected_ip_0:\n type: string\n label: MSP MMN OAM IP Addresses\n description: MSP MMN OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP MMN OAM net name\n description: MSP MMN OAM net name\n mmn_volume_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n mmn_volume_size_0:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n mmn_volume_image_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume image name\n description: Mobisupport MSP MMN Cinder Volume image name\n mmn_data_volume_id_1:\n type: string\n label: MSP MMN Volume id 1\n description: MSP MMN Volume id 1\n mmn_arch_volume_id_2:\n type: string\n label: MSP MMN Volume id 2\n description: MSP MMN Volume id 2\n mmn_backup_volume_id_3:\n type: string\n label: MSP MMN Volume id 3\n description: MSP MMN Volume id 3\n mmn_misc_volume_id_4:\n type: string\n label: MSP MMN Volume id 4\n description: MSP MMN Volume id 4\n mmn_block_device_names:\n type: comma_delimited_list\n label: MSP MMN Block Device Names\n description: MSP MMN Block Device Names\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP MMN VNF ID\n description: MSP MMN VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF module instance\n\nresources:\n################ Cinder Volume ########################\n mmn_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_0}\n size: {get_param: mmn_volume_size_0}\n image: {get_param: mmn_volume_image_name_0}\n\n################ Server ##############################\n mmn_zrdm5bpxmc02mmn_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: mmn_name_0}\n# image: {get_param: mmn_image_name}\n flavor: {get_param: mmn_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2:\n - device_name: { get_param: [mmn_block_device_names, 0] }\n volume_id: { get_resource: mmn_volume_0 }\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n networks:\n - port: { get_resource: mmn_oam_protected_0_port }\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02mmn001.txt\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n\n################ Ports ##############################\n mmn_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: mmn_oam_protected_ip_0}}]\n security_groups: [{ get_param: sec_grp_msp_id }]\n replacement_policy: AUTO\n\n################ Volume Attachment ##############################\n volume_attachment_vdb:\n type: OS::Cinder::VolumeAttachment\n depends_on: mmn_zrdm5bpxmc02mmn_0\n properties:\n volume_id: { get_param: mmn_data_volume_id_1 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdb\n\n volume_attachment_vdc:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdb\n properties:\n volume_id: { get_param: mmn_arch_volume_id_2 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdc\n\n volume_attachment_vdd:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdc\n properties:\n volume_id: { get_param: mmn_backup_volume_id_3 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdd\n\n volume_attachment_vde:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdd\n properties:\n volume_id: { get_param: mmn_misc_volume_id_4 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vde\n" - }, - "heatFiles": [], - "vnfResources": { - "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", - "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "modelName": "Vf zrdm5bpxmc02092017-VF", - "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", - "description": "Demo", - "orchestrationMode": "HEAT", - "modelVersion": "1.0", - "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" - }, - "modelInvariantUuid": "8e53c069-b2f0-437a-9c00-21cbc5c8f081", - "base": false - } - } - ], - "vnfResource": { - "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5", - "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "modelName": "Vf zrdm5bpxmc02092017-VF", - "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf", - "description": "Demo", - "orchestrationMode": "HEAT", - "modelVersion": "1.0", - "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7" - } - } - ], - "allotedCustomizations": [], - "recipes": { - - }, - "csar": { - "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22", - "name": "service-VfZrdm5bpxmc02092017Service-csar.csar", - "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=", - "url": "service-VfZrdm5bpxmc02092017Service-csar.csar", - "description": "TOSCA definition package of the asset", - "version": "1" - } -} diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json deleted file mode 100644 index 3a7b361f89..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "serviceName": "Vf zrdm5bpxmc02092017-Service", - "serviceInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", - "serviceUUID": "bad955c3-29b2-4a27-932e-28e942cc6480", - "serviceVersion": "1.0", - "serviceArtifacts": - [{ - "artifactName": "service-VfZrdm5bpxmc02092017Service-csar.csar", - "artifactType": "TOSCA_CSAR", - "artifactURL": "service-VfZrdm5bpxmc02092017Service-csar.csar", - "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=", - "artifactDescription": "TOSCA definition package of the asset", - "artifactTimeout": 0, - "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22", - "artifactVersion": "1" - }], - "resources": - [ - { - "resourceInstanceName": "Vf zrdm5bpxmc02092017-VF 0", - "resourceInvariantUUID": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "resourceCustomizationUUID": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade", - "resourceName": "Vf zrdm5bpxmc02092017-VF", - "resourceType": "VF", - "resourceUUID": "14ba5d1e-3862-407c-a236-1cbaebccce77", - "resourceVersion": "1.0", - "category": "Generic", - "subcategory": "Network Elements", - "artifacts": - [ - { - "artifactChecksum": "NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU=", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactName": "pxmc_mmn_volume.env", - "artifactType": "HEAT_ENV", - "artifactURL": "pxmc_mmn_volume.env", - "artifactUUID": "c1ae6284-48d9-4437-a195-b2cf2ba23070", - "artifactTimeout": 0, - "artifactVersion": "2" - }, - { - "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg==", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactName": "pxmc_base.env", - "artifactTimeout": 0, - "artifactType": "HEAT_ENV", - "artifactURL": "pxmc_base.env", - "artifactUUID": "6dd99c31-c52e-4c45-b99b-d223c877a296", - "artifactVersion": "2.0" - }, - { - "artifactChecksum": "MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ=", - "artifactDescription": "created from csar", - "artifactName": "user_data_zrdm5bpxmc02vmt001.txt", - "artifactTimeout": 0, - "artifactType": "HEAT_ARTIFACT", - "artifactURL": "user_data_zrdm5bpxmc02vmt001.txt", - "artifactUUID": "53acdabe-689f-45e5-8578-f1514d3529da", - "artifactVersion": "1" - }, - { - "artifactChecksum": "MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU=", - "artifactDescription": "Auto-generated VF Modules information artifact", - "artifactName": "vfzrdm5bpxmc02092017vf0_modules.json", - "artifactTimeout": 0, - "artifactType": "VF_MODULES_METADATA", - "artifactURL": "vfzrdm5bpxmc02092017vf0_modules.json", - "artifactUUID": "e3b82cd6-485e-4d56-8d2c-17ccf6a59533", - "artifactVersion": "1" - }, - { - "artifactChecksum": "YWQ2MmE0Y2NjNGE4YmJlOTk0YmZhYmIxYTc1YWZkY2M=", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactName": "base_TEST.env", - "artifactTimeout": 0, - "artifactType": "HEAT_ENV", - "artifactURL": "base_TEST.env", - "artifactUUID": "57f6520b-fa65-4544-90de-95c8190c2e6c", - "artifactVersion": "1.0" - }, - { - "artifactChecksum": "YWQ2MmE0Y2NjNGE4YmJlOTk0YmZhYmIxYTc1YWZkY2M=", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactName": "base_TEST.env", - "artifactTimeout": 0, - "artifactType": "HEAT_ENV", - "artifactURL": "base_TEST.env", - "artifactUUID": "57f6520b-fa65-4544-90de-95c8190c2e6c", - "artifactVersion": "1.0" - } - ] - } - ], - "serviceDescription": "Demo", - "distributionID": "a2872f55-8628-4486-8548-7b132c9a47db" -}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env deleted file mode 100644 index 42d736ef59..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env +++ /dev/null @@ -1,2 +0,0 @@ -parameters: - vnf_name: diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml deleted file mode 100644 index 3e98047ffd..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml +++ /dev/null @@ -1,45 +0,0 @@ -heat_template_version: 2015-04-30 - -parameters: - -## GLOBAL//Basic Parameters - vnf_name: - type: string - description: Unique name for this VF instance -# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC - -resources: - -## MSP RSG//Resource:SecurityGroup - sec_grp_msp_0: - type: OS::Neutron::SecurityGroup - properties: - description: Security Group for PXMC - name: - str_replace: - template: VF_NAME_sec_grp_msp - params: - VF_NAME: { get_param: vnf_name } - rules: - - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "udp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "132", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "icmp", "ethertype": "IPv4"} - - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "tcp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "udp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "132", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "58", "ethertype": "IPv6"} - - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "udp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "132", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "icmp", "ethertype": "IPv4"} - - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "tcp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "udp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "132", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0} - - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "58", "ethertype": "IPv6"} - -outputs: - - sec_grp_msp_id: - description: uuid of the security group - value: {get_resource: sec_grp_msp_0 } diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env deleted file mode 100644 index 42599e6034..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env +++ /dev/null @@ -1,18 +0,0 @@ -parameters: - cinder_delete_on_termination_false: - cinder_delete_on_termination_true: - mmn_arch_volume_id_2: - mmn_backup_volume_id_3: - mmn_block_device_names: - mmn_data_volume_id_1: - mmn_flavor_name: - mmn_misc_volume_id_4: - mmn_name_0: - mmn_oam_protected_ip_0: - mmn_volume_image_name_0: - mmn_volume_name_0: - mmn_volume_size_0: - oam_protected_net_name: - sec_grp_msp_id: - vf_module_id: - vnf_id: diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml deleted file mode 100644 index d1b0ce883b..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml +++ /dev/null @@ -1,152 +0,0 @@ -heat_template_version: 2015-04-30 - -description: HOT creates Nimbus vMSP MMN stack. - -parameters: - mmn_name_0: - type: string - label: MSP MMN server names - description: name of the MSP MMN instances - mmn_flavor_name: - type: string - label: MSP MMN flavor name - description: MSP MMN flavor name -# mmn_image_name: -# type: string -# label: MSP MMN image name -# description: MSP MMN image name -# availability_zone_0: -# type: string -# label: MSP MMN availability zones -# description: MSP MMN availability zones - sec_grp_msp_id: - type: string - label: security group id - description: the id of security group - mmn_oam_protected_ip_0: - type: string - label: MSP MMN OAM IP Addresses - description: MSP MMN OAM IP Addresses - oam_protected_net_name: - type: string - label: MSP MMN OAM net name - description: MSP MMN OAM net name - mmn_volume_name_0: - type: string - label: Mobisupport MSP MMN Cinder Volume names - description: Mobisupport MSP MMN Cinder Volume names - mmn_volume_size_0: - type: number - label: Mobisupport MSP MMN Cinder Volume sizes - description: Mobisupport MSP MMN Cinder Volume sizes - mmn_volume_image_name_0: - type: string - label: Mobisupport MSP MMN Cinder Volume image name - description: Mobisupport MSP MMN Cinder Volume image name - mmn_data_volume_id_1: - type: string - label: MSP MMN Volume id 1 - description: MSP MMN Volume id 1 - mmn_arch_volume_id_2: - type: string - label: MSP MMN Volume id 2 - description: MSP MMN Volume id 2 - mmn_backup_volume_id_3: - type: string - label: MSP MMN Volume id 3 - description: MSP MMN Volume id 3 - mmn_misc_volume_id_4: - type: string - label: MSP MMN Volume id 4 - description: MSP MMN Volume id 4 - mmn_block_device_names: - type: comma_delimited_list - label: MSP MMN Block Device Names - description: MSP MMN Block Device Names - cinder_delete_on_termination_true: - type: boolean - description: delete cinder volume upon instances termination - cinder_delete_on_termination_false: - type: boolean - description: keep cinder volume upon instances termination - vnf_id: - type: string - label: MSP MMN VNF ID - description: MSP MMN VNF ID - vf_module_id: - type: string - description: Unique ID for this VF module instance - -resources: -################ Cinder Volume ######################## - mmn_volume_0: - type: OS::Cinder::Volume - properties: - name: {get_param: mmn_volume_name_0} - size: {get_param: mmn_volume_size_0} - image: {get_param: mmn_volume_image_name_0} - -################ Server ############################## - mmn_zrdm5bpxmc02mmn_0: - type: OS::Nova::Server - properties: - name: {get_param: mmn_name_0} -# image: {get_param: mmn_image_name} - flavor: {get_param: mmn_flavor_name} -# availability_zone: {get_param: availability_zone_0} - block_device_mapping_v2: - - device_name: { get_param: [mmn_block_device_names, 0] } - volume_id: { get_resource: mmn_volume_0 } - delete_on_termination: {get_param: cinder_delete_on_termination_true} - networks: - - port: { get_resource: mmn_oam_protected_0_port } - config_drive: "True" - user_data_format: RAW - user_data: - get_file: user_data_zrdm5bpxmc02mmn001.txt - metadata: - vnf_id: {get_param: vnf_id} - vf_module_id {get_param: vf_module_id} - "evacuation_policy": "Evacuation" - -################ Ports ############################## - mmn_oam_protected_0_port: - type: OS::Neutron::Port - properties: - network: {get_param: oam_protected_net_name} - fixed_ips: [{"ip_address": {get_param: mmn_oam_protected_ip_0}}] - security_groups: [{ get_param: sec_grp_msp_id }] - replacement_policy: AUTO - -################ Volume Attachment ############################## - volume_attachment_vdb: - type: OS::Cinder::VolumeAttachment - depends_on: mmn_zrdm5bpxmc02mmn_0 - properties: - volume_id: { get_param: mmn_data_volume_id_1 } - instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0} - mountpoint: /dev/vdb - - volume_attachment_vdc: - type: OS::Cinder::VolumeAttachment - depends_on: volume_attachment_vdb - properties: - volume_id: { get_param: mmn_arch_volume_id_2 } - instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0} - mountpoint: /dev/vdc - - volume_attachment_vdd: - type: OS::Cinder::VolumeAttachment - depends_on: volume_attachment_vdc - properties: - volume_id: { get_param: mmn_backup_volume_id_3 } - instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0} - mountpoint: /dev/vdd - - volume_attachment_vde: - type: OS::Cinder::VolumeAttachment - depends_on: volume_attachment_vdd - properties: - volume_id: { get_param: mmn_misc_volume_id_4 } - instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0} - mountpoint: /dev/vde diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env deleted file mode 100644 index d5f16289b1..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env +++ /dev/null @@ -1,9 +0,0 @@ -parameters: - mmn_volume_name_1: "data-mn-v-vdb" - mmn_volume_name_2: "arch-mn-v-vdc" - mmn_volume_name_3: "backup-mn-v-vdd" - mmn_volume_name_4: "misc-mn-v-vde" - mmn_volume_size_1: 20 - mmn_volume_size_2: 20 - mmn_volume_size_3: 50 - mmn_volume_size_4: 20 diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml deleted file mode 100644 index debb8a96db..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml +++ /dev/null @@ -1,86 +0,0 @@ -heat_template_version: 2015-04-30 - -description: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant - -parameters: - mmn_volume_name_1: - type: string - label: Mobisupport MSP MMN Cinder Volume names - description: Mobisupport MSP MMN Cinder Volume names - - mmn_volume_name_2: - type: string - label: Mobisupport MSP MMN Cinder Volume names - description: Mobisupport MSP MMN Cinder Volume names - - mmn_volume_name_3: - type: string - label: Mobisupport MSP MMN Cinder Volume names - description: Mobisupport MSP MMN Cinder Volume names - - mmn_volume_name_4: - type: string - label: Mobisupport MSP MMN Cinder Volume names - description: Mobisupport MSP MMN Cinder Volume names - - mmn_volume_size_1: - type: number - label: Mobisupport MSP MMN Cinder Volume sizes - description: Mobisupport MSP MMN Cinder Volume sizes - - mmn_volume_size_2: - type: number - label: Mobisupport MSP MMN Cinder Volume sizes - description: Mobisupport MSP MMN Cinder Volume sizes - - mmn_volume_size_3: - type: number - label: Mobisupport MSP MMN Cinder Volume sizes - description: Mobisupport MSP MMN Cinder Volume sizes - - mmn_volume_size_4: - type: number - label: Mobisupport MSP MMN Cinder Volume sizes - description: Mobisupport MSP MMN Cinder Volume sizes - -resources: - mmn_data_volume_1: - type: OS::Cinder::Volume - properties: - name: {get_param: mmn_volume_name_1} - size: {get_param: mmn_volume_size_1} - - mmn_arch_volume_2: - type: OS::Cinder::Volume - properties: - name: {get_param: mmn_volume_name_2} - size: {get_param: mmn_volume_size_2} - - mmn_backup_volume_3: - type: OS::Cinder::Volume - properties: - name: {get_param: mmn_volume_name_3} - size: {get_param: mmn_volume_size_3} - - mmn_misc_volume_4: - type: OS::Cinder::Volume - properties: - name: {get_param: mmn_volume_name_4} - size: {get_param: mmn_volume_size_4} - -outputs: - mmn_data_volume_id_1: - description: msp mmn data volume 1 - value: {get_resource: mmn_data_volume_1} - - mmn_arch_volume_id_2: - description: msp mn arch volume 2 - value: {get_resource: mmn_arch_volume_2} - - mmn_backup_volume_id_3: - description: msp mn backup volume 3 - value: {get_resource: mmn_backup_volume_3} - - mmn_misc_volume_id_4: - description: msp mn volume 4 - value: {get_resource: mmn_misc_volume_4} diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env deleted file mode 100644 index 0f0e6daac0..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env +++ /dev/null @@ -1,17 +0,0 @@ -parameters: - cinder_delete_on_termination_false: - cinder_delete_on_termination_true: - oam_protected_net_name: - sec_grp_msp_id: - vf_module_id: - vmt_block_device_names: - vmt_flavor_name: - vmt_name_0: - vmt_oam_protected_ip_0: - vmt_volume_image_name_0: - vmt_volume_image_name_1: - vmt_volume_name_0: - vmt_volume_name_1: - vmt_volume_size_0: - vmt_volume_size_1: - vnf_id: diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml deleted file mode 100644 index 2e04c6130e..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml +++ /dev/null @@ -1,128 +0,0 @@ -heat_template_version: 2015-04-30 - -description: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant - -parameters: - vmt_name_0: - type: string - label: MSP VMT server names - description: name of the MSP VMT instances -# vmt_image_name: -# type: string -# label: MSP VMT image name -# description: MSP VMT image name - vmt_flavor_name: - type: string - label: MSP VMT flavor name - description: MSP VMT flavor name -# availability_zone_0: -# type: string -# label: MSP VMT availability zones -# description: MSP VMT availability zones - sec_grp_msp_id: - type: string - label: security group id - description: the id of security group - vmt_oam_protected_ip_0: - type: string - label: MSP VMT OAM IP Addresses - description: MSP VMT OAM IP Addresses - oam_protected_net_name: - type: string - label: MSP VMT OAM net name - description: MSP VMT OAM net name - vmt_block_device_names: - type: comma_delimited_list - label: MSP VMT Block Device Names - description: MSP VMT Block Device Names - vmt_volume_name_0: - type: string - label: Mobisupport MSP VMT Cinder Volume names - description: Mobisupport MSP VMT Cinder Volume names - vmt_volume_name_1: - type: string - label: Mobisupport MSP VMT Cinder Volume names - description: Mobisupport MSP VMT Cinder Volume names - vmt_volume_size_0: - type: number - label: Mobisupport MSP VMT Cinder Volume sizes - description: Mobisupport MSP VMT Cinder Volume sizes - vmt_volume_size_1: - type: number - label: Mobisupport MSP VMT Cinder Volume sizes - description: Mobisupport MSP VMT Cinder Volume sizes - vmt_volume_image_name_0: - type: string - label: Mobisupport MSP VMT VDA Cinder Volume image name - description: Mobisupport MSP VMT VDA Cinder Volume image name - vmt_volume_image_name_1: - type: string - label: Mobisupport MSP VMT VDB Cinder Volume image name - description: Mobisupport MSP VMT VDB Cinder Volume image name - cinder_delete_on_termination_true: - type: boolean - description: delete cinder volume upon instances termination - cinder_delete_on_termination_false: - type: boolean - description: keep cinder volume upon instances termination - vnf_id: - type: string - label: MSP VMT VNF ID - description: MSP VMT VNF ID - vf_module_id: - type: string - description: Unique ID for this VF Module instance - -resources: -################ Cinder Volumes ############################## - vmt_volume_0: - type: OS::Cinder::Volume - properties: - name: {get_param: vmt_volume_name_0} - size: {get_param: vmt_volume_size_0} - image: {get_param: vmt_volume_image_name_0} - - vmt_volume_1: - type: OS::Cinder::Volume - properties: - name: {get_param: vmt_volume_name_1} - size: {get_param: vmt_volume_size_1} - image: {get_param: vmt_volume_image_name_1} - -################ Ports ############################## - vmt_oam_protected_0_port: - type: OS::Neutron::Port - properties: - network: {get_param: oam_protected_net_name} - fixed_ips: [{"ip_address": {get_param: vmt_oam_protected_ip_0}}] - security_groups: [{get_param: sec_grp_msp_id}] - replacement_policy: AUTO - -################### Servers ######################### - vmt_zrdm5bpxmc02vmt_0: - type: OS::Nova::Server - properties: - name: {get_param: vmt_name_0} -# image: {get_param: vmt_image_name} - flavor: {get_param: vmt_flavor_name} -# availability_zone: {get_param: availability_zone_0} - block_device_mapping_v2: - - device_name: {get_param: [vmt_block_device_names, 0]} - volume_id: {get_resource: vmt_volume_0} - delete_on_termination: {get_param: cinder_delete_on_termination_true} - boot_index: 0 - - device_name: {get_param: [vmt_block_device_names, 1]} - volume_id: {get_resource: vmt_volume_1} - delete_on_termination: {get_param: cinder_delete_on_termination_true} - boot_index: -1 - networks: - - port: {get_resource: vmt_oam_protected_0_port} - config_drive: "True" - user_data_format: RAW - user_data: - get_file: user_data_zrdm5bpxmc02vmt001.txt - - metadata: - vnf_id: {get_param: vnf_id} - vf_module_id {get_param: vf_module_id} - "evacuation_policy": "Evacuation" diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar b/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar Binary files differdeleted file mode 100644 index 69b1c23404..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar +++ /dev/null diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json deleted file mode 100644 index 0dd1193e67..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "distributionID": "a2872f55-8628-4486-8548-7b132c9a47db", - "serviceName": "Vf zrdm5bpxmc02092017-Service", - "serviceVersion": "1.0", - "serviceUUID": "bad955c3-29b2-4a27-932e-28e942cc6480", - "serviceInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", - "serviceDescription": "Demo", - "serviceArtifacts": [ - { - "artifactName": "service-VfZrdm5bpxmc02092017Service-csar.csar", - "artifactVersion": "1", - "artifactType": "TOSCA_CSAR", - "artifactDescription": "TOSCA definition package of the asset", - "artifactTimeout": "0", - "artifactURL": "service-VfZrdm5bpxmc02092017Service-csar.csar", - "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22", - "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=" - } - ], - "resources": [ - { - "resourceInstanceName": "Vf zrdm5bpxmc02092017-VF 0", - "resourceCustomizationUUID": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade", - "resourceInvariantUUID": "23122c9b-dd7f-483f-bf0a-e069303db2f7", - "resourceName": "Vf zrdm5bpxmc02092017-VF", - "resourceType": "VF", - "resourceUUID": "14ba5d1e-3862-407c-a236-1cbaebccce77", - "resourceVersion": "1.0", - "category": "Generic", - "subCategory": "Network Elements", - "artifacts": [ - { - "artifactName": "pxmc_mmn_volume.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_mmn_volume.env", - "artifactUUID": "c1ae6284-48d9-4437-a195-b2cf2ba23070", - "artifactChecksum": "NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU=" - }, - { - "artifactName": "pxmc_base.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_base.env", - "artifactUUID": "6dd99c31-c52e-4c45-b99b-d223c877a296", - "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=" - }, - { - "artifactName": "vfzrdm5bpxmc02092017vf0_modules.json", - "artifactVersion": "1", - "artifactType": "VF_MODULES_METADATA", - "artifactDescription": "Auto-generated VF Modules information artifact", - "artifactTimeout": "0", - "artifactURL": "vfzrdm5bpxmc02092017vf0_modules.json", - "artifactUUID": "e3b82cd6-485e-4d56-8d2c-17ccf6a59533", - "artifactChecksum": "MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU=" - }, - { - "artifactName": "pxmc_vmt.yaml", - "artifactVersion": "1", - "artifactType": "HEAT", - "artifactDescription": "created from csar", - "artifactTimeout": "120", - "artifactURL": "pxmc_vmt.yaml", - "artifactUUID": "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "artifactChecksum": "ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE=", - "generatedArtifact": { - "artifactInfo": { - "artifactName": "pxmc_vmt.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_vmt.env", - "artifactUUID": "bc1640f1-69f0-4760-8fc3-3318ec2ff129", - "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=" - } - }, - "relatedArtifacts": [{ - "artifactInfo": { - "artifactName": "user_data_zrdm5bpxmc02vmt001.txt", - "artifactVersion": "1", - "artifactType": "HEAT_ARTIFACT", - "artifactDescription": "created from csar", - "artifactTimeout": "0", - "artifactURL": "user_data_zrdm5bpxmc02vmt001.txt", - "artifactUUID": "53acdabe-689f-45e5-8578-f1514d3529da", - "artifactChecksum": "MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ=" - } - }] - }, - { - "artifactName": "pxmc_mmn.yaml", - "artifactVersion": "1", - "artifactType": "HEAT", - "artifactDescription": "created from csar", - "artifactTimeout": "120", - "artifactURL": "pxmc_mmn.yaml", - "artifactUUID": "b8bca13b-811f-44ab-9d27-45b842c664d8", - "artifactChecksum": "YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE=", - "generatedArtifact": { - "artifactInfo": { - "artifactName": "pxmc_mmn.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_mmn.env", - "artifactUUID": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737", - "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=" - } - }, - "relatedArtifacts": [{ - "artifactInfo": { - "artifactName": "user_data_zrdm5bpxmc02mmn001.txt", - "artifactVersion": "1", - "artifactType": "HEAT_ARTIFACT", - "artifactDescription": "created from csar", - "artifactTimeout": "0", - "artifactURL": "user_data_zrdm5bpxmc02mmn001.txt", - "artifactUUID": "5bc62c72-5f7a-40bc-a167-1a4fed9afdef", - "artifactChecksum": "OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU=" - } - }] - }, - { - "artifactName": "pxmc_mmn.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_mmn.env", - "artifactUUID": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737", - "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=" - }, - { - "artifactName": "pxmc_vmt.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_vmt.env", - "artifactUUID": "bc1640f1-69f0-4760-8fc3-3318ec2ff129", - "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=" - }, - { - "artifactName": "user_data_zrdm5bpxmc02mmn001.txt", - "artifactVersion": "1", - "artifactType": "HEAT_ARTIFACT", - "artifactDescription": "created from csar", - "artifactTimeout": "0", - "artifactURL": "user_data_zrdm5bpxmc02mmn001.txt", - "artifactUUID": "5bc62c72-5f7a-40bc-a167-1a4fed9afdef", - "artifactChecksum": "OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU=" - }, - { - "artifactName": "pxmc_base.yaml", - "artifactVersion": "1", - "artifactType": "HEAT", - "artifactDescription": "created from csar", - "artifactTimeout": "120", - "artifactURL": "pxmc_base.yaml", - "artifactUUID": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189", - "artifactChecksum": "YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM=", - "generatedArtifact": { - "artifactInfo": { - "artifactName": "pxmc_base.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_base.env", - "artifactUUID": "6dd99c31-c52e-4c45-b99b-d223c877a296", - "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=" - } - } - }, - { - "artifactName": "user_data_zrdm5bpxmc02vmt001.txt", - "artifactVersion": "1", - "artifactType": "HEAT_ARTIFACT", - "artifactDescription": "created from csar", - "artifactTimeout": "0", - "artifactURL": "user_data_zrdm5bpxmc02vmt001.txt", - "artifactUUID": "53acdabe-689f-45e5-8578-f1514d3529da", - "artifactChecksum": "MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ=" - }, - { - "artifactName": "pxmc_mmn_volume.yaml", - "artifactVersion": "2", - "artifactType": "HEAT_VOL", - "artifactDescription": "created from csar", - "artifactTimeout": "120", - "artifactURL": "pxmc_mmn_volume.yaml", - "artifactUUID": "2f372a02-df1b-46ca-b81e-822e3f406965", - "artifactChecksum": "MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI=", - "generatedArtifact": { - "artifactInfo": { - "artifactName": "pxmc_mmn_volume.env", - "artifactVersion": "2", - "artifactType": "HEAT_ENV", - "artifactDescription": "Auto-generated HEAT Environment deployment artifact", - "artifactTimeout": "0", - "artifactURL": "pxmc_mmn_volume.env", - "artifactUUID": "c1ae6284-48d9-4437-a195-b2cf2ba23070", - "artifactChecksum": "NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU=" - } - } - } - ] - } - ] -} diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt b/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt deleted file mode 100644 index 93a8ab9ae3..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt +++ /dev/null @@ -1,412 +0,0 @@ -#cloud-config -# \hbrief cloud-init main template for MSP config -# \hversion 0.0.11 -# \hdate 2016-05-09 -# \brief cloud-init template for MSP config -# \version 0.2.57 -# \date 2016-09-19 -# Configuration created for MSP SLES_12 MMN - -chpasswd: - list: | - root:Ericsson - miepadm:miep1234 - - expire: False - -users: - -bootcmd: - - - [ sh, -xc, "echo \"#################################################################\" > /etc/issue.ci" ] - - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# * * * Cloud-init configuration is in progress * * * #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# The system will reboot shortly and then be accessible #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"#################################################################\" >> /etc/issue.ci" ] - - [ sh, -xc, "if [ -f /etc/issue.orig ]; then cp /etc/issue.orig /etc/issue; fi" ] - - [ sh, -xc, "if [ ! -f /etc/issue.orig ]; then cp /etc/issue /etc/issue.orig; cp /etc/issue.ci /etc/issue; fi" ] - - [ sh, -xc, "/bin/sed -i 's/^DHCLIENT_SET_DEFAULT_ROUTE=\"yes\".*/DHCLIENT_SET_DEFAULT_ROUTE=\"no\"/' /etc/sysconfig/network/dhcp" ] - - [ sh, -xc, "/bin/sed -i 's/^NETCONFIG_DNS_POLICY=.*/NETCONFIG_DNS_POLICY=\"STATIC\"/' /etc/sysconfig/network/config" ] - -runcmd: - - [ sh, -xc, "chage -M 99999 root;rm -f /etc/shadow-" ] - - [ sh, -xc, "chage -M 99999 miepadm;rm -f /etc/shadow-" ] - - [ sh, -xc, "sed -i 's/^GRUB_TIMEOUT.*/GRUB_TIMEOUT=0/' /etc/default/grub" ] - - [ sh, -xc, "echo GRUB_FORCE_HIDDEN_MENU=true >> /etc/default/grub" ] - - [ sh, -xc, "/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg" ] - - [ sh, -xc, "sed -i 's/^.*:.*/admin:6041A28W2rLq6/' /opt/miep/tools/lighttpd/lighttpd_auth.properties" ] - - [ sh, -xc, "sed -i 's/^.*=.*/admin=709e17d2a62751a051fa2072f0976334/' /opt/miep/register/conf/auth.properties" ] - - [ sh, -xc, "sed -i 's/kernel\\.unknown_nmi_panic.*//' /etc/sysctl.conf" ] - - [ sh, -xc, "sed -i 's/kernel\\.panic_on_unrecovered_nmi.*//' /etc/sysctl.conf" ] - - [ sh, -xc, "echo \" kernel.unknown_nmi_panic=1\n kernel.panic_on_unrecovered_nmi=1\n\n\" >> /etc/sysctl.conf" ] - - [ sh, -xc, "sed -i 's/^\\(IRQBALANCE_ARGS=\\).*$/\\1\"--hintpolicy ignore\"/' /etc/sysconfig/irqbalance" ] - - [ sh, -xc, "sed -i 's/^ListenAddress.*/ListenAddress 107.112.138.70/' /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i 's/^ClientAliveCountMax.*/ClientAliveCountMax '0'/g' /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i 's/^PermitRootLogin.*/PermitRootLogin 'no'/g' /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i 's/^#UseDNS.*/UseDNS 'no'/g' /etc/ssh/sshd_config" ] - - [ sh, -xc, "echo auth optional pam_faildelay.so delay=5000000 >> /etc/pam.d/sshd" ] - - [ sh, -xc, "echo trap2sink 127.0.0.1 >> /etc/snmp/snmpd.conf" ] - - [ sh, -xc, "sed -i 's/^agentaddress.*/agentaddress 107.112.138.70/' /etc/snmp/snmpd.conf" ] - - [ sh, -xc, "sed -i 's/^ IP=.*/ IP=\"107.112.138.70\"/' /opt/miep/snmp/tools/agentmonitor.sh" ] - - [ sh, -xc, "sed -i 's/^ SNMPCOMMUNITY=.*/ SNMPCOMMUNITY=\"SNOS-PE\"/' /opt/miep/snmp/tools/agentmonitor.sh" ] - - [ sh, -xc, "sed -i 's/^ IP=.*/ IP=\"107.112.138.70\"/' /opt/miep/snmp/tools/agentmonitor_sle12.sh" ] - - [ sh, -xc, "sed -i 's/^ SNMPCOMMUNITY=.*/ SNMPCOMMUNITY=\"SNOS-PE\"/' /opt/miep/snmp/tools/agentmonitor_sle12.sh" ] - - [ sh, -xc, "/sbin/yast2 dns edit nameserver1=155.165.194.100" ] - - [ sh, -xc, "/usr/sbin/wicked ifdown all; /usr/sbin/wicked ifup --timeout 60 eth0; /usr/sbin/wicked ifup --timeout 60 all" ] - - [ sh, -xc, "mkdir -p /opt/miep/tools" ] - - [ sh, -xc, "wget --directory-prefix=/opt/miep/tools http://107.112.138.71/miit/zrdm5bpxtc02/custom-files/zrdm5bpxtc02/AttMspCust.tgz" ] - - [ sh, -xc, "export TERM=vt220 ; yast keyboard set layout=english-us" ] - - [ sh, -xc, "sed -i 's/YPSAddress.*/YPSAddress\"\tvalue=\"https:\\/\\/yps.ericsson.net\\/YPServer\" \\/>/' /opt/miep/etc/license/SentinelCloudRuntime.properties" ] - - - [ sh, -xc, "umask 027 ; /opt/miep/tools/mnsetup/initmn.sh firstinstall 2>&1 | tee /opt/miep/tools/mnsetup/firstinstall.log" ] - - [ sh, -xc, "chown root:root /opt/miep/tools/AttMspCust.tgz" ] - - [ sh, -xc, "chmod 440 /opt/miep/tools/AttMspCust.tgz" ] - - [ sh, -xc, "mkdir -p /opt/miep/tools/AttMspCust" ] - - [ sh, -xc, "chown root:root /opt/miep/tools/AttMspCust" ] - - [ sh, -xc, "tar xfz /opt/miep/tools/AttMspCust.tgz -C /opt/miep/tools/AttMspCust" ] - - [ sh, -xc, "/opt/miep/tools/AttMspCust/CloudInit/cloudCron.sh 107.112.138.71" ] - - [ sh, -xc, "mkdir -p /opt/miep/etc/certs/manifest/ca/" ] - - [ sh, -xc, "chown -R miepadm:miepgrp /opt/miep/etc/certs/manifest/" ] - - [ sh, -xc, "mkdir -p /opt/miep/etc/certs/origin_server_ssl/server_cert" ] - - [ sh, -xc, "chown -R miepadm:miepgrp /opt/miep/etc/certs/origin_server_ssl/server_cert" ] - - [ sh, -xc, "sed -i 's/KexAlgorithms/#KexAlgorithms/g' /etc/ssh/sshd_config" ] - - [ sh, -xc, "wget --directory-prefix=/opt/miep/tools/AttMspCust/CloudInit/msacerts -e robots=off -r -l1 --no-parent -R '*html*' http://107.112.138.71/miit/zrdm5bpxtc02/custom-files/zrdm5bpxtc02/msacerts" ] - - [ sh, -xc, "mv /opt/miep/tools/AttMspCust/CloudInit/msacerts/107.112.138.71/miit/zrdm5bpxtc02/custom-files/zrdm5bpxtc02/msacerts/* /opt/miep/tools/AttMspCust/CloudInit/msacerts/" ] - - [ sh, -xc, "mv /opt/miep/tools/AttMspCust/CloudInit/msacerts/keystore* /opt/miep/tools/AttMspCust/CloudInit/msacerts/.keystore_`hostname`_gno" ] - - [ sh, -xc, "rm -rf /opt/miep/tools/AttMspCust/CloudInit/msacerts/107.112.138.71" ] - - [ sh, -xc, "sed -i 's/PASS_MAX_DAYS 60/PASS_MAX_DAYS 99999/' /etc/login.defs" ] - - [ sh, -xc, "sleep 61s" ] - - [ sh, -xc, "mkdir -p /usr/java/default/bin/ && ln -s /usr/bin/java /usr/java/default/bin/" ] - -timezone: 'PST8PDT' - -write_files: - - content: | - H4sIANk1vFkAA41Sy27bMBC88ysW8TViKaWNC92MAkV9KOIi+QFKWllE+RBIyo9+fZeW7DqxDHR10c4OZ3aXXEDnQgxwjrdOBWiVRmgw1F5VGECCHUyFHlx7YltpMIsuk03jMQS2gPdhZN8ruyUd5yF2CG/fNp/WGwhDFY4houEA6whkZEhNH28EhoANyAiVcxGiMvgI+w4tWAfJGwL6HXpqzCP4wVoy4zciLxaCkVrD6BkeqZXzbLW0UOHooyyVZZOGkzciD8mvebi2TU6vRxvloWQL+l9vstW4CIDvg9bZr0Fq1Spssh/TsgBeO+fjJadzLC+WXNCXT07a1VKn7V7ybcoYOYQeayU1Oe2eYVo6BlaW+exJ1e+esytwyl1fyfo3Yy0KUZbiimaRbNr2Cja1DLH32KpDKhTJ6lSgfVpHL2NCiwvq3RDpSib86YKfXhdLU2QzAS+rn2msz7A6jzXLo3WJJc/zgudPX/lSAPzxjflS9QdTi8IYK0TO97Lf7rlxFd1w3zmLnAabY85hmZPmHn5PeWS8b+2D+M7E/2xtZM5ht639w+8pjwzG/gJrL8X/3wMAAA== - path: /etc/hosts - owner: root:root - permissions: '0644' - encoding: 'gzip+base64' - - content: | - ################################################################################ - ## /etc/ntp.conf - ## - ## Sample NTP configuration file. - ## See package 'ntp-doc' for documentation, Mini-HOWTO and FAQ. - ## Copyright (c) 1998 S.u.S.E. GmbH Fuerth, Germany. - ## - ## Author: Michael Andres, <ma@suse.de> - ## Michael Skibbe, <mskibbe@suse.de> - ## - ################################################################################ - - ## - ## Radio and modem clocks by convention have addresses in the - ## form 127.127.t.u, where t is the clock type and u is a unit - ## number in the range 0-3. - ## - ## Most of these clocks require support in the form of a - ## serial port or special bus peripheral. The particular - ## device is normally specified by adding a soft link - ## /dev/device-u to the particular hardware device involved, - ## where u correspond to the unit number above. - ## - ## Generic DCF77 clock on serial port (Conrad DCF77) - ## Address: 127.127.8.u - ## Serial Port: /dev/refclock-u - ## - ## (create soft link /dev/refclock-0 to the particular ttyS?) - ## - # server 127.127.8.0 mode 5 prefer - server 135.144.38.211 prefer - server 155.165.201.253 prefer - - ## - ## Undisciplined Local Clock. This is a fake driver intended for backup - ## and when no outside source of synchronized time is available. - ## - server 127.127.1.0 # local clock (LCL) - fudge 127.127.1.0 stratum 10 # LCL is unsynchronized - - ## - ## Add external Servers using - ## # rcntp addserver <yourserver> - ## - - ## - ## Miscellaneous stuff - ## - - driftfile /var/lib/ntp/drift/ntp.drift # path for drift file - - logfile /var/log/ntp # alternate log file - # logconfig =syncstatus + sysevents - # logconfig =all - - # statsdir /tmp/ # directory for statistics files - # filegen peerstats file peerstats type day enable - # filegen loopstats file loopstats type day enable - # filegen clockstats file clockstats type day enable - - # - # Authentication stuff - # - keys /etc/ntp.keys # path for keys file - trustedkey 1 # define trusted keys - requestkey 1 # key (7) for accessing server variables - controlkey 1 - - # by default act only as a basic NTP client - restrict default kod nomodify notrap nopeer noquery - restrict -6 default kod nomodify notrap nopeer noquery - # - # allow NTP messages only from the loopback - restrict 127.0.0.1 - restrict ::1 - path: /etc/ntp.conf - owner: root:root - permissions: '0644' - - content: | - # default <OAM GW> - - - default 107.112.136.1 - - - path: /etc/sysconfig/network/routes - owner: root:root - permissions: '0644' - - content: | - <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - <trapDestCfg xmlns="http://www.ericsson.com/esa"> - <managerDefinition snmpVersion="v2c" active="yes"> - <ip>107.239.72.10</ip> - <port>162</port> - <securityName>v1v2ReadWriteSecName</securityName> - <securityLevel>noAuthNoPriv</securityLevel> - </managerDefinition> - <managerDefinition snmpVersion="v2c" active="yes"> - <ip>135.207.171.152</ip> - <port>162</port> - <securityName>v1v2ReadWriteSecName</securityName> - <securityLevel>noAuthNoPriv</securityLevel> - </managerDefinition> - </trapDestCfg> - path: /opt/miep/tools/AttMspCust/CloudInit/trapDestCfg.xml - owner: root:root - permissions: '0755' - - content: | - [ - { - "networkname": "OAM" - }, - { - "networkname": "Internal" - }, - { - "networkname": "Access" - }, - { - "networkname": "dmz_untrust" - }, - { - "networkname": "dmz_trust" - }, - { - "networkname": "dmz_trust1" - }, - { - "networkname": "dmz_untrust1" - }, - { - "networkname": "Internet" - }, - { - "networkname": "ControlPlaneSig" - }, - { - "networkname": "AccessIngress" - }, - { - "networkname": "InternetIngress" - } - ] - path: /opt/miep/init/networknames.json - owner: miepadm:miepgrp - permissions: '0644' - - content: | - BOOTPROTO='static' - IPADDR='107.112.138.70' - BROADCAST='107.112.143.255' - NETMASK='255.255.248.0' - NETWORK='107.112.136.0' - STARTMODE='onboot' - DEVICE='eth0' - USERCONTROL='no' - NAME='OAM' - DEFROUTE='yes' - CHECK_DUPLICATE_IP='yes' - SEND_GRATUITOUS_ARP='yes' - path: /etc/sysconfig/network/ifcfg-eth0 - owner: root:root - permissions: '0644' - - content: | - path: /etc/udev/rules.d/10-local.rules - encoding: b64 - owner: root:root - permissions: '0640' - - content: | - # - # VERSION: <Auto generated by 1.0.2.3> - # - # This file contains the variable definitions to pull RMS Input Files from the PCRF. - - # The PCRF_PRIMARY variable specifies the Primary IP the MSP should use to connect to the PCRF. - - PCRF_PRIMARY=107.122.136.120 - - # The PCRF_SECONDARY variable specifies the Secondary IP the MSP should use to connect to the PCRF. - - PCRF_SECONDARY=107.122.136.121 - - # The PCRF_USER variable specifies the user value to use when performing the secure ftp transfer. - - PCRF_USER=msp - - # The PCRF_PASS variable specifies the password value to use when performing the secure ftp transfer. - - PCRF_PASS=@TTmsp123 - - # The PCRF_DIR variable specifies the directory on the PCRF server where the RMS Input Files are located. - # This is the directory the secure ftp transfer will change to before pulling the RPM Input File. - - PCRF_DIR=/home/msp/downloads - - # The PCRF_PROMPT variable specifies the sftp prompt string that MSP can expect the PCRF server to - # display as a prompt when remotely connecting to the PCRF server using sftp. - - PCRF_PROMPT=sftp> - MSA_GROUP_NAME= - path: /appl/rms/cfg/pcrf.cfg - owner: root:root - permissions: '0755' - - content: | - # - # reserved values - # - 255 local - 254 main - 253 default - 0 unspec - # - # local - # - #1 inr.ruhep - path: /etc/iproute2/rt_tables - owner: root:root - permissions: '0644' - - content: | - ### /etc/resolv.conf file autogenerated by netconfig! - # - # Before you change this file manually, consider to define the - # static DNS configuration using the following variables in the - # /etc/sysconfig/network/config file: - # NETCONFIG_DNS_STATIC_SEARCHLIST - # NETCONFIG_DNS_STATIC_SERVERS - # NETCONFIG_DNS_FORWARDER - # or disable DNS configuration updates via netconfig by setting: - # NETCONFIG_DNS_POLICY='' - # - # See also the netconfig(8) manual page and other documentation. - # - # Note: Manual change of this file disables netconfig too, but - # may get lost when this file contains comments or empty lines - # only, the netconfig settings are same with settings in this - # file and in case of a "netconfig update -f" call. - # - ### Please remove (at least) this line when you modify the file! - nameserver 155.165.194.100 - nameserver 155.165.201.100 - search wapgw.mobilephone.net - options attempts:1 - options timeout:6 - path: /etc/resolv.conf - owner: root:root - permissions: '0644' - - content: | - MN_OAM_IPADDR=107.112.138.70 - SNMP_IPADDR=107.239.72.10 - SNMP_PORT=162 - MN_SERVER_GROUPNAME=rdm5b - STORAGE_TYPE=CINDER - SUPPORT_LANG_LIST={"en":"English"} - AUTOSTART=Y - AUTODBPATCH=Y - PRODUCT=MSP - MN_TO_OTHER_NODE_NETWORK=OAM - path: /opt/miep/tools/mnsetup/init.properties - owner: root:root - permissions: '0640' - - content: | - CAE_PASSWORD=wapwap12 - MSA_PASSWORD=wapwap12 - CAPLOG_PASSWORD=wapwap12 - TRACELOG_PASSWORD=wapwap12 - path: /opt/miep/tools/mnsetup/init.properties.sec - owner: root:root - permissions: '0640' - - content: | - 107.112.138.59 zrdm5bpxtc02adm001 zrdm5bpxtc02adm001-oam - path: /var/tmp/adm_hosts - owner: root:root - permissions: '0644' - - content: WwogewogICJwYXJlbnQiIDogInJkbTViIiwKICAiZ3JvdXBzIiA6IFsKICAgewogICAgImdyb3VwbmFtZSIgOiAienJkbTVicHh0YzAyIiwKICAgICJkaXNwbGF5bmFtZSIgOiAienJkbTVicHh0YzAyIiwKICAgICJkZXNjcmlwdGlvbiIgOiAienJkbTVicHh0YzAyIgogICB9CiAgXQogfSwKIHsKICAicGFyZW50IiA6ICJ6cmRtNWJweHRjMDIiLAogICJncm91cHMiIDogWwogICB7CiAgICAiZ3JvdXBuYW1lIiA6ICJ6cmRtNWJweHRjMDItVFMiLAogICAgImRpc3BsYXluYW1lIiA6ICJ6cmRtNWJweHRjMDItVFMiLAogICAgImRlc2NyaXB0aW9uIiA6ICJ6cmRtNWJweHRjMDItVFMiCiAgIH0KICBdCiB9Cl0K - path: /opt/miep/msaapp/apps/clusteradmin/clusters.json - encoding: b64 - owner: msausr:msagrp - permissions: '0640' - - content: | - . /opt/miep/tools/AttMspCust/CloudInit/helpers.sh - cd /opt/miep/tools/msa - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set apsLicenseCustomerId '946935' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set apsLicenseUserId 'AT&T_Customer_Test_Lab2_vMSP_Nimbus' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set prsPrefixLookupTable '2606:ae00:af00::/41=64' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set prsDiamRealm 'zrdm5bpxtc02.msp.sd' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set htsHttpClientIpRangesBlacklist '172.26.14.0/25,172.26.17.0/24,107.103.114.0/25,107.103.113.0/25,107.103.112.160/29,107.103.121.0/24,107.103.122.0/24,fd00:2600:2600:100::/64,2606:ae00:b800:3441::/64,2606:ae00:b800:3442::/64' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_host '172.21.196.7' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_user 'cn=virNimbusV2L,ou=Users,ou=Administration,o=Cingular' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_pwd 'MSPLab' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_secondhost '155.165.172.23' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_seconduser 'cn=virNimbusV2L,ou=Users,ou=Administration,o=Cingular' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_secondpwd 'MSPLab' - ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set idfMspIpAddr '' - ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set prsDiamMessageTimeout 16000 - ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set prsDiamSlowPeerAlarmLimit 16000 - ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set prsDiameterServerListenerAddressList '0.0.0.0:3868' - ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set ltmi.keyServerUpdateHostList 'zrdm5bpxtc02mts001,zrdm5bpxtc02mts002' - ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set omsNsIntrusionDetection 1 - ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set telGroup1FTPTargetServerName zrdm5bpxtc02adm001.wapgw.mobilephone.net - $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set externalnodeip='172.26.39.6' where servergrpid= '0' and vgindex= 'VG011'\"" - $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set servingdestaddrranges='172.26.39.6/32' where servergrpid= '0' and vgindex= 'VG011'\"" - $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set externalnodeip='fc00:a:a::700' where servergrpid= '0' and vgindex= 'VG013'\"" - $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set servingdestaddrranges='fc00:a:a::700/128' where servergrpid= '0' and vgindex= 'VG013'\"" - path: /opt/miep/tools/AttMspCust/CloudInit/install_msa_zone.sh - owner: root:root - permissions: '0755' - - content: | - H4sIAJ4ywFkAA6ScTWOiyNPA7/VVclgwshMPz0EEjExAge5GuUUdNUIy2d0kvnz6f1WDCAjo5DlkNpF+Kbrr5VfV7ao/ujAb/VL2xsNGffHfp4Nw9ZfK/vr3ofv813I27mrdv7ebF6G8JY/x0uhNvG53ok+Wyu+76K+v/ifjv1QG//y34cqD4SjDKQ9/dNb3wf5pbLjvX6+92e6d/dCMhx/P64/p9u0/4y3++WPTs9XJrKd2+X77sHs6/Ibjr+G/xtu/P939X8v5z39f4rH9a6Wqm+k6Oq7DXd/V9Z3y9Luz/j+YmCrzj113sI4fuGVPuOXcGd5ve8D2KxZbrs803VN9W8QWD3hvPBn0ss/TPk+g6gFTdTZZKz+xExPcdrmyTP/24gcm3Mfsd3tiFdri3+kkIGcZ+dwyfTF6eFJ7Y4+rVqFRSYKpkpiT7ezoHPnOZbGCEsFlg8bOmmCsux8bnjY2zJ3Ddl8edzkEItKFmUxY0hsLrqRrQCKbloGfh57wbaZoK2qcDuROfJPfyb+pL5j84Ulpb9w0qLASzxfQM5jiW5NEt3isXAyWNsranF/P84TLhNILfKsH3OfuiMU9hynL6DQrEz3L47Swus5Vd8pU25yqvuUpmzFT9hNfTVae0jNpSwH31JbbZlpjXxW6r4jsoSb4cfd1+bnUA9knMHtMgJVtH664nfgr714cl8PeRzS1V2KIv1s9ZxaODtP7yOWqvmKvycfsTRxxG0dMdflUAU1nvHaxLHzHQSh6uEEiSPUAt9Do7x2DHxwjPq0Z1Deu0Qmfo4RJshLCtXjSGwq+d0i9Ad93Mh8uNyMzeZuj2M+hRSJe7ZivB+CC5MphCnOq2NFUFcwX9srHFw/47m7e2b/NAu096uyTRSfZLBQ9Wbwm28W9+zV/AW0775T0oPJKwvV44hRfiysfKz/u4bPNhKs+rALu3T0xkwZhgdob4t6v5DZZPds3zluHSvQ0VaIJvkrgmxqfqvRakQU4wZ1joJE0NKDn551KGC702FNti3ExFqblTGDbx9lrHpR3I5yqFsdXC3Ahrdy4cNLJAHqNDc4zy/eVr+sJ7xVfz1hOXWXeUZNFgnYR4R9TZb+Zbe3VMlYZRy19DtWX5dRB6c6dKwPauOA4qW5BbkyGido2O3XKG1xIZOkO7hgtuCufAXXmew+VyEMj4rRN7NKcba72nnyRrBhPGMc1Q+e8wz74OVw8yLcP38cITPxMyG3du2yhOlsH/SNa7PkZlPeca+gjNugbfFJhxxeRxaweOhRbR8l030SFM7ofqY9M28KVxmdfINyVh3aCTgYlln4iVQNQbLQHdzRV1OKCkXcqxYaJ5QoPd8pXiwpGwQryWS4Divzs5IBoMf0VU6KVbyX0me2pPY/HPUBHaqNnFqwSztIBBrKRx4/FicrSQDZbKbydPHK1c0kqMgeKcFAMcafB0oAr/SIu7NTLTD3gpJ0aWq0tyAExhRaz4iez2eUsU1QqrrhBIPQ0apPKD3Sx6IgDerQYfz4X9z4clqGrPIe9T3zn+o4VCdH1OQIn/fny+x/6gdMvbT8o4T8jU/taDvl6OdxslgNdecbfce28EVjiGE1H6yD01qNBH39+u4OX3+vnqbNevAp0gepHFPpJhJ3mB/0lCvT3aCg+l8NkOwt3659rUH7+fJEP5aiBtQxwts085J8jy/+NHc7vPein0gzdzfxlqYyGdoK/w+9ZqL1FKMEMZ32eeutlJ/lvXpRmaHVo5vmbq2Bb7CheI5QOX0W+DtDMJP7PtZTm7H1edPY89ZOnl372eqUfKY1cJ7hhIfEHlSfSmSUudIcrgMoSuxR4A4rUXMn+rjaMxRDV32L0bGsex6x/cLfYPhZwflBSaXxYREOv3iboM8gMqIqBJ8PCzxbnQWhgVQzIhnJ7obj5pORQWmdkDzXSPCDZSXNgJiQU3iZ+QhjkPqHhPFL4pzU5NSpJUB2M7aFefLMkVZMkkmohM2XHYeaOVvdi5rRhScISMsFtzFQeoLTVgOZaZMZ4h9P1O9ipNmJlEoXM9E/ACnfIkmMfF0nEexPRuBytTj5BuEVM1LmlE+WEBPPwhMjj8WXTbBTuAl9YIkDFOwUbih2ojb7gSeBDISo3eWe5E1VFyj5/UuFSTQeXSkbSlLXzHF+AVd851zYDDYjAs5q0nDy62TMCDNbgqxSZNV0MIkRcV0Xv+zUPxQFBPMHfV2xovThJr0M+EQd/n4e2upC8nQ7gg1oitkw8P+JmvvKobE53TLtVlyqgPmQuvLCVsTZhMSen4iDVVYk+myTfQcioTPcoKolYBLgbGKGsx8vZzhiQbyXuJKQwihyAKMgFRuFYmH/kbEB1qvrwh84GSkryHWcDBW+TOxvUShFizBSo0lcdDzR4nrpXwd2pQSGovF/VO7WiUYLGppCfNEUgMxkFB8PMLmS1nuohf57yJeZaHNV+B1+VB0VjQn1QvZQb0wElmA90lym2jevGw0B3gJkE4O6ECV1nmE9VYQwHMlGJCJlxIIQPlJhR/iUVDieAwgypcvnoVAi+Mavle2xojyl1mjZOAim14co7ONOIErTQQq/EoxVLcGpS822suNv46MpdQyXCbQ9Qkqm6Wcm4KesKHFV6WxKdiM3yhbefbEe78UBnI9N6QrIzR5bLsaMlDNJKPwCfC+6U39sIhB9NYl9nJmZ2qESegotWbvOMoJZaLbDuvctGOweDTRgnXo3DpW0ULPGD8GStCZo20b38HAoPSmHPnQiucZ7EdyLU3pdDEaP4ygypZnE8dca+rAtF0SglQNfuMpk2xqouDA1tw+W+2f/hZD9+rGHajL9TiolPABeF8TRRdVFhrkXqS3uBJoO52V6gyWDO9iKz/vqoTuEQKEUqGspXViao2kiWyKeD+K/JAUPB5yxUExiZ+83pj9TJnhsWZ/PjJJBZTsobw+epfVwOkX4hpHpUZPOEaiqXHdGgyHOdUqXiZGg7NXUYOVtWuCiK+lTo7A0tZTk41S3Q05YKFHLVG6wzq4xklkkZrzR7qLH75rVAq+RoK6jFpo+mzhPfRX7QuEy6Cn7BNwUlrlzWIso7gtu7TGt3aUw1kCfRVFM+fqwr5qXwgaqeWjBu+XrND7oeKFbgo8mjCwDyAaSVmc2bFasks9ZMXA+UTrpDW1hxqQ0UTdo9UrWLCnrvNrfaLDY51+5AMaWjLT+oeGwV18OyI/QLn5S0YM7FlrilkaySwNkPlMRHs61araCapOn3x0c9/VGiMTM1wD9oJyzTR7+IvkAWqxi3eDncXUSunO6glJTXhX6qeBQjeJXqoC5BPxe75f7jdloEJlMVd4LquiW6g/Mqk9+jIl/B/WuuMdOcI0+j2uVzmhQKMRIXNLYMtEQWyChFRc3RYWzMMDGrDCKlEbJOBRW3TttGVTL50NmOuu7W0dzUtZeeFdbh/wkgAyg51MtG5Z2oOwiAyklAmjIF0vv0hlnERkAlrXQuGJsyAShtZZ341f2vbj+UZu8e3e1CcbbOFyeH04BDXPkQ5y0FbeiJ33uHjhO2sfp0NNWxNdqTdgaqODNECcTw/RVfZLsCd64x6owN75hlN6aQSlPO6KTC5eshY8lJWsyzlIuHFzCGymahMq04cgUuLnKFe/IPrgD0xjj7lYZtgwLSytZ8qEjiV11ZioyYVnKqIuvCS3ozqknggoJgjBbTw8VEG2D9HS7m3knVuKkTnefkUkFVrFNcvBg00Mfzjp9klbDN/NVN5OvDRefmd8Y4wjzVRicsa3J37LUXRwHodlYm2kZV0VvKa4XtBVo4zJ9tlhbvLIcZ1TWg0rsrZy1pJkZ1ri4naBdIKaYwAhMzPLP3mJNdrK58bg1I0QonR5cHR3DJjhhUH/aTOEKSI1UfaY7R/3KQTlO9Qe91LEY2yDsdJ7H73/xexOeGTt3gyiS2ERGdNR/2jstHHTbPobdmw2QbhdoxCnSXtmyerkXaobKAuCMr96hJP+FjO8ga3pcb0nEEOVZXsGwnKB/1ZC3ClOcdsn6NvpODiu7ISo/gUOMMmbiWdUJnmEYL0yofDB77XWfrUdy0xriyPD8UvDQkcusuundqI/hR4x6FBCmFj5TWA0ajC1FeNIZUMVX9yVSxMW4UDomMLqo6xdk99ulxpvYGgNxUOLvyagbS8d0jGxGAMStZFY+uJD5BOto5y1X2UWXW4is5yDmogPjaiIsOGh3Fi9KHJbUVAhMzlA5nFrznTl4TJQqRIVVLYArJKRNCRIQJKy8crpY1FpRLIhaiZaYWedRsTFI+UNkunkPaoJykkZe+MGWqTVvR++LNV6nMzEJr+zxMPiMIdmtcSOfk3qsdL+NEhPEjcc4GCLbpGrIOlw6ATibg+6iWK8sDoCa7Bhog6CEdfLI+ujOOFsi7fGuuG0WuSkznm+mM5I2cCuGTl8JMJ0nLbHRQEkrLrBznwvXapPSRaEjhNCU69Fi4jceT8kHrjOgz0DMHpMrxbsxmKlllpS2cG5fMOw2BXI1WknAwkpNiOduu4jKTDsbUMcZbkhDqRRzdsiaY1DuqgyS2xyiM2EelpIaZy1pbWRc4zWru0E8aI1MIfuhj2PtNZ9sH90UXPu+2DN6HW8TVcAvjeZh8jsysvHjoH0YmZogxX4N7XGhUOmzsfG2BAUUZG10UmQ5IGwfqNg8E53dyj92dy2a7sRHfu0ez26xMpXotyHdHZ+Fgopp2IBxm/Q5CeXfM1vK+R12b4vnFxSBZkc9OHetMcbdrbWz095lU6L336bE2mkIAoo7cWq5yXFz3gJb7HmkllFPySiUlhy0+HIN/OGy9Rl35O/uBT/xnJ9Mj0woqGa4VWjrueXadBxNbX2y8QNjp9ZesfgVn3KFoze/Okfvq6UnK4HBTDtFWk4ErRcyt03GP3sF5kcrl1hzlQu7ecwhHein7TnPPt5RbuE8Y3cZIHwNfjMr6QO/oY9qe6QAC96zrGmaaqJ4pvp5yIbUDMxd3W0XCVspHfAZK1i0H6SQLIJEdUlS+HdahNgX4E1iHevCu4eoLUM36QA2t3wzrA539moJLTLAOEAWXQ+tz1uFV8S+OYCqLCTKA8jjxUl3XcNSrg5b6ANs2i08HIlyRA+Mu7KoDpUAPVey3rt3K0typInSPSlCS7mE5aaT7Ghx2LhcUTtuUEn1dp6NmzIc9NTq3K8VYyGHb0AZU7RmZ7hfmUOrizU7mbx4SPJ2477+iDgWc/fusIz4XHY5QgilSuCOePA1QXVByMos7qQvck4uYUn0Zmek+DJVP0NuoXnZzL8AsRh43TfJLR82Uj2oOhSIWRj/VP10BzAzNwQA0oguGtYRfugeSkXoO6sKkmguJnyBvqytOg1uicqCMSA0ZoVcBnSJVC+EX1gJS2EYvZYk4meBuECuWBzNOg9VSPqSYXxVNSubrDMMeVYXb4B1K9P7maot7r0rv7fAOZ3o/WeXlACcELodD8tz4OZRMG2G0v/ZeLUobvVno/jsLl5jtu5xS6ZSrL3JxqI46pEtDcqFSSxz4FP6PpwEqZI9SQdMA2atVK0W4daPjyJS3cwazqZuMwNI3s87HJkJjqVL7bdAOLdR+G7RDC7XfBu3QQu23QTu0UPtt0A4t1H4btEMLtd8G7dBC7bdBO7RQ+23QDg0rnEmSQntfadkpaKH226AdWqj9CrTTLqFk0ELtt0E7rDX3KO+LX1L7bdAOLdR+G7RDC7XfBu3QQu0ZU1+5vQgtt69uuw8BjbevnCNdKDO1JzVbn5p7MeQaoQjb6Nqecb+JUDQ3eEAjigLC5HKZvbQeHvJkoUq+9Q6YlCmyUxnWG2Et4ODl4lZZupHmJdHKe8iGx/dgnO/YC0dcoG/e0Gg4jXeh1Jh193VU30K0mC1yuq5gW372xQVcTE7ZDQaYnTN4yC4rVzqV+oDS/K6no+nLQYnkPqOp//7r1YLTHdIamr+teg6y5nYesXbAtlKbBw3VcTpVrQ50BvUyR7VXxK9/lQJK36W4pFqzcXdSUD9//6LQybnzMB0QBRR2jnWDe3degqYCB92b37vKYmi9RwPdeQ5dBHIEC1P9iobiv3Mif6HiaaE8luf+p/wyhfFiw7wyXl8YJw8GdK2vGc7LTramOK4ZyA/rgysvhdSAebmWX+brxB8Q1dL9qEpZvbY+vfJiUSl2m2qKy3ALfLeyN9wC363sDUze5i8W8yWQtxTBlbuoY+/oZo6sqkMRzEteuIGt4+V71DHXs9dEGT3qyeIF9GMUUnZXQ/StQJ7zOORAXjXxK0BeyDcbgdyT33JoAvJcKrgRyNFSDhmQu/OOliyHyd8zlHjege43gfzMUd8F8pw74btAnvM4fBfIcx6H7wJ5Pil8F8hL57zfAvJ8cPgukOc8Dt8F8nyBoQ3ItVuq6PBdIM/XDL4B5ONSFR2+C+SSx4m94LtAnrM2fBfIcx6H7wJ5zuPwXSDPeRy+C+Q5j+f1qAqQd68Bec7jUAvkInDYFSDPeRxksVt1DbNLVx9vB/Kcx6H7TSDPORu+C+R5W/gukOdsDU1AflFirgB5zuPwB0DO18J0vZFpbWeH7tp+0SeLR/8d0FVl4av7p9XyNILDuaTGPSqphe726aX/OjJ7O4yNH8/T9w3+92t+ca5xiubQetfllqsu0HrX5ZarLnCN7K9edQF516Wv1t91KV11cZDwCvh8MnEoNazedbnlqgtc1OmLd11uueoCrXddbrnqAq13XW656gKtd11uueoCpbsuiMe76n2Xa9dd4Op9l2vXXaD1vgvfZbGjpWoO1Tsvy5fFo/MnVXMo3nl5fA6Xm9HQfl8O9B19o3LRoW9PanHdPZjTNZhivtlyD8Y3EIf1WcfJHQv5FQnvcAO9N8E7upeuc4Qb6L0d3uFM72K0z+g991ajwWzN7nXMN9T3Xy86buHudN6bD1h3L6jx+krNN8x5BK3fMG8AtMo5TsOMzl0QavunrYkE39fcLd81MDdE1Yt1Dfx4mGw9FbX04BxxB7azXEKouTRzSxH8Tv7fOAyz48IxVloQeH89x4AUxj3FWftCsJFh7sdbMvFRZ2QJi22bB3eM8v3qBnHjOy/0P57D7vqUZ42M/7V3Js2JJEkUvr+/0hcWYdY6zEGIpZApQUACgpuEppAAqcusplqIXz8RmWRm7OER2dY2NtaHOhViJ/35889fjHZ8lWI2v2lzUQp7V3OgvMFXPPeAPWXrR8XuaOe5I2T31GZXo+Z4f8OFd5sJVPuXSf/2QtTUqvBuGoxwVaANYBXme77XOm3x3iIH1ZfZBSbtL8f5S8m37+dQlVt5oc0MHWkVtWCu5dvAuq/K9y66iyMn3m9O46/G53jeOE1u+Rv/R/7vNmulkO1eZHJf/vatF/3jPK9WVxxxkVW9oLHhWkog7STAtZTg3Em4OmcrBSm2AVC6amyMTklzhBAo/bcxa5tZa9QWmXSQoPTs6W5VvZl/uRACpRuZdIRA6UbMBSFQugFzGX0iBEo3Yi4w3Gsy73aXg+lu0e4e163j+9OKXQLfl68v35ZfOkpu2M9ysubsa7287abb4XL/tNr8WH91MdysBo2Xx7tjkNUuPAjirHbBaUec1S447SBZ7V9Jry9Z7cLfoLLaW6c/X1ZEq11w2hFntQtOO+KsdsFpR5zVLjjtiLPaBacdgVa7LtpRB1LP7gyxkHoJ3OBBSigyueVp58wpFV1bN2QfRiXbC7d40T6ebZB69uMDGVIff25W4x858S2667j+dX8ryV0FfzM8gMyi47fpgWnqc6LpZcOF12iKQ7GSWEEZz9llLhsGXC5zr8+a1X71sxwMwITAU2iEMmwB9LQFu29PccbPnbvnj/4v9nI7Se/Qysc2Nl1N6jVGrAgvWIM7Oo+R7rKYFquip+lqVp3Tm0aSrplqm3bs4rRvEqcwCO5Ob/rVHbCGfZekfe6aMsGx3i2ZXDTdOUqPnvCGTtJOdzNs/nh+6xat1C7BW3fIw0JGvS17CfZpwcTK3EMW4Xl+3I39jnq6rjaC6Eztt9jFlGnr7Wli9+7bMifWV3WzpK2vymem3gbqG2gS3yr93jP49oIvLzk9UmxiUwoaKXhrOG6k5CDkDjovwu379KZ5n/avRuy7At7Z8X/3WbuUhSFkil769smoC38/KuEOUZ1E7bQiJiRA4tFRAOmn5HxgjYgVSLfy6BCA9MaC10ULkH6r8+jsFz09TdDb0oD0ikfPn+250JWgAukqj86q8SCTTHDf0Hmnh6wAQ/PrXep+sLx9bL6WSR2ZXwtpN/GmofUP6h9pzwqKQ64tPN40RoPun8/D4/7frJKtV53XTWv5n82qUzwYojdIF8Prn0xGdsA05Ovz++Bjs2pyntoJpRuZdIRA6UYmHSFQutGGRwiU/jk2MOmQ/ujM4xiulzMLlK4x6exT2qI9+1yveOSdAUInMehwQegkBh0uCF1wRuwMOlwQetUuOBh0uCB0K4O+EDxsGBS8fkcu7Y3y3lywusn4z/T4vs+u1b0KiyeI9I/1R/csaWwIKt0n0met48d63n3jiYBbvtDwbcwEK9PVfC3C9ke6J6NlMYL709PnFvtGtg98T/MXh9OZQP31QhTssCj236b7Kacy/IIdFsWuz35nlWC/XJ3yixPKq1MsF4O6oPp31AXVE9QF1fuoC6p3UBdUl+Y4cVwM6oLqB9QF1S++vQdUv3JxMagLqj+iBqieq37UBdV34P78lcGfJ3MxqAuqP6AuqL5AXVC92M+KB9Uf4ADV2+Nev+HlYmAH1XMzw8vFQALVmY5kj3wO4mJQPt1YLqbMr54djutirS5IrMOg1sPEOgxqXdbVGoeviHUY1LpXrLNqNfj5wqo3k9MNPD1ujqPB3XHTOp5fvt3l6MpbTluQAHY41Pt0dWqwyvWLm1gv74vd4n358fQ4bmxL2pUbw3CvmBI2TBGh5mUxjwg1L38v4FHzk9S3YYoINS+LeUSoeVnMI0LNy2IeEWpeFvOIUPOymAdRzds3ShFAtZuhdgRQ7eaNUtgFOXGjFLY8GPJGKcrrvia+OzTPug4PM0377b+Sh8mGvgUPcxn8DX7yq9Dz+7JRkntv/+TD/JMP8zfmw3z+D+fD9P66fJhPo4D/P8qHCSDb//qcf3adzFjxFpls1wU8TjQFLwr4HGwfXzZNEUi2tzQBr/FRHmBdB9sRSLbrYDsCyXYdbEcOoSeqILWR7fqzgpVsT3bp8Pq85WcktZPd8v3I1N7vFdFZLosifv00G6YPr0F4FDcno+ayhq+kwgbKkDkZ2I/3oq2kJrCBMuSVVNhAGTInAxsoQ+ZkYANlyJwMbKAMmZOBDZQhczKQdlJjVlIRnAejindo6j10JRXSTmrMSiqkndSYlVSYFb3t4mJYTUU43a6spiJCzVdZMVzMI1fzCftBnfnBdNuv7uppNTs+f3Ewn2LFu3U1xYpHoJLXHxCBSl4X8ghU8vozRKCS14U8ApW8LuQRqOT1Z4tAJa8LeQQq+cqKb18+KeP8IigzBoFKXhfyUENjzm4lr98JrDuqbaIVj0Alb9pjDVPyupBHoJLXhTzKR6cpeV3II1DJZ9K4KQp5BCp59hu6k4U8qEo+tVnxcCr5JsGKR6CS12+HQCWvC/nCp6Uq+VwCjgQhj0Alrwt5FPe6W7aWb/7NUR1sl7kg1Vo7vhzXwl6acd8V4Ta74rIj3GZXXHaE2+yKyw7VZr/EiTqDHCWXHeE2u+Kyo25wY8YF1QpurPjq2ODG/NyHOsGNTE8SoBknMwMKNONkZkCBZpzMDCjQjJOZAQWacTIzsj9pgWa46n3crEZaT86FOighMk6hXvn2sbY7BKV+LG1361NO9QdEBN0uw+2IoNtluB0RdLvOmYfS7TLcrnHmBLpdhtsRQbfLD4oIul2G2325iya6XYbbEUG3y3A7+FMe74PodnM+TAjdLn1SfVjpdvYa12a6XcvJ8dLtTPHvdcVfCHp1vkmh2+XbIIJul+F2RNDtMtyOmic28bzBeic2pdXegenEpoo/10/WLtn8irc3bdCGnb/JSxtpGXbxeUr2068kTbgsSGFfgrXPfsdfV6f725sdE27jEYbHw/1bZWaSzgMRjl5+bMC5+cF+G3wLgOntAz9zsNNjOkPtQaGOHbIO55F9rItB92HBv//NriR9ivN8846HvQ+sIE+ZYuUf39RuaFaChImT9LH5MmLKdvDwxuQthB8Kl0JM3j3O+9fJTI2t0Ef5F12h5E+aD0256yd5H27eU7OsRyTzRadcHJ/ydjGVY/vZ9WHCe2/or5ldI85Xp3Fj+cQ37ycpj6qYsY58cztdJK3kvG1OUj7vyG4n991BwRFlbgRigyPKB0RscESZG1Hq6tDgCFNuc1hwRJkbYcttJkmALDcCscER5bO1zP39wRHlG4zY4IjsGfez85IigyPK3AjEBEdkP7CiA+bnHbTvq30kc+frQnug5N74GFr9hBbo3gof+LCr1t2scZxMF6fvWROXVqeHK/+HgQgKxYytUfPE6N/L+WZCim+4at7zS2Cv/zXujU7ZcZJNODbCrC3TDf/0im1aEFokZ8HJdJTojPI2kdOZ/LjMybTBrswey3WBS+WxFp7ySPLsKs36b9ae9q/n/JTtvKbCGCxlK0LZd0Lov79P2XXy+7Lx+pCqYSKm3W7jmCrPrzZkkeZnbvrbSPbSoFSg/LXzk2my8/QEr/J0lx5MuhOnhFUi9oV6Gaz23D0/NCe9pDFLl0OeqTXeJ+1xmn1C2e0o+7zBexiOnBziHgZihj9SCUDM8Eea/cD1FEl7GIgZ/kizH8QMfwx5QYHDH3nPPWT4czZ9UogZ/kizHxCGP9kPTAAquDAvpOHyAGPiiC3rQXfE9H5TFeaJt2lFHrx3PZ/z46QPg+QxsxMblyPqzf8nFR7U7PQWDQTvMV/WmEcFS4XAEcxgnpxllgoLU8qEKcaif/fKbebFcLB/ag0+NvPLIhz80RWeAgT9NAm5EfP4D4MuLJWoZEMmfHJQXLVN/ReMVJZclcqilH9HlJ4LRdMlAxOlN7vlgSKZxWpEo9kbD8O24GHK3pctJd4j42kNFanTzU78k6doUt8lzXFS1kuyH1N7tvyDW0msXu7O4/6iOTvcsT5qfR6fFx3+JcpuZ7qGqLnNNifUboSC6ITajVAQnVC7EQqiE2o3Qp38AynmA0Qn1G6EguiE2t9QEJ1Qu38JohOaGaHGmA8QnVC7EWrkH9qGa6cYdPvzuRgAsEoGU8CtMsdxAVeDPOffnvZnOvbmTj1HjM/mHthF9hv7+XbTQU6rZS5Pzs/p/ycVIn6drBORx/us2Ii80m4EIW1DCNs462EboPZWVggL9BOCLYUIZuGx9TmC1UeKSEew6ssQ6QjeiudfUBzBKvhWmzTi1uoIjpjK350sjqDMkcY4gtVLLuc4gY6gsJcU6QhWhiAiHUF1jhPuCFalwezL+R3Bqi8jnadmcATN3GCII1gZgoh0BC35UQGOYPVSEeEIbqVPCpGOYGUIItIR5EzM8/Cz9KNIjqAFF5Zyel3VywTgZZc6dX8zvHqhKl+R1QtV+YqsXmiEZEUJ1au12OdRHwh3BpX9RbSualYt2NrlA7VqQXyzoqoWoudYRdUCdY5lrVoQ33l9jsVEaNNTtVDayLFVC8IvMa5qIXqOVVQtRM+x1OtkfNVC9ByrqB+InmOZ+eqYqoXoOZalXkRULUTNsQ7CJ4XoOVZRtRA9xyqqFkLmWMaqpcx5XVWrY65acl5xTNWC2HRFVS2ITVdU1WJ9VjOyal0CDqPmWVJsFoJzs1S3EJRIH6dbCN0uDHQLYS9zRLcQul3ocQurdazcLYRuFwZmi0G3CwPdQuivOdAthH/k4HELEc1N2vxJOjdZuIXwFRuvW4hobrJwCy38Q4BbiGhusni2iOYm7ftZVG6SP+NJ78Z+fjfZLUQMNym5hdDtQoJbKFLfhjxzd+wwexN30owLxslIyIwLpiFX0IwLpiFX0IwLwpBrHRMY8AVCYIA7qh3GrPaQqHb4Bl56pIVSwQzzzcAKBt/Ay1vB4Bt4eedd8A28TPMuKc4evoGXt4LBN/DyVjD4Bl7eCoboXPuigrlzFykVDNG59kUFQ3SufVHBEJ1rr9XNaPKflD/prGCIzrWX5npRufbFHSE617546fANvLwVDL6Bl6P3ysN34D3eytd7wTfw8vZeMFuGAb0XzJZhm957QWq+mt50eb33QtF8Uc7UM1YumJovX++VsXRF5QIN1XBULtBQDUflAg3VcFQumJoveu+VlDxMjcoFGqrhqFygoRqOyoWaJ7I09PMvgiuXyg2GVy7UPJHl+B01T2RJl6h5IkvBgcSfyPLWRc0TWaRz7S+ohqNNNlYunbcPrVxV7kFs5YLQfOXHmTggQ2P/BfeZioT+CyGQobH/QghkaOy/YGvAhP5r5+y/YIMMx+krrf+CsQHb/Nh+zJp5/zXYPw2PvzbzT8vcC3Rcw3xyD/flqLiGcOUWixLouIZl7pVzYiRcwzL3ynMwhMHXsYhSNS+G63MvFIOvlhfXsMy9QMc1Si9fnnuBjmtYLsCg4xqWuRfouIZl7uXg7YkH/4KOa1D4BzeuYZl7gY5rWOZeoOMalrkX6LiGZe5l5mHywVfapxz869w7IB38CzquYZl75dcHefAln6bu672gNV8nP2wo9V6IgQ2l2gJT8xXUe4GOa3TMvRe8g68vT++FqOwLMfoCsYtd5SeIfHbZCl7sKgsSYhe7yr0uiRMLWewq+zIph3NhijaxLHaVrRXUgBBSPohYmBC72FXudSF2sUvbx4k+YMegqwMP2Omh7gE7S9Q9YCc7t7rWATuE/W5fPLdlnkU/YGeAugfsFOepORe7Ws54bkrf7Y7nhtykuRa7pqvTz2qxq9zrkq4PymKXFL50OVlA3z6G1XMyhIgYt49BXz+2bB8LHEhk1h6MNxIbM7X8Cf/3L/wXSFgwha/GAAA= - path: /opt/miep/etc/license/Cloud_Entitlement.combine - owner: msausr:msagrp - permissions: '0755' - encoding: 'gzip+base64' - - content: | - *.* @135.207.171.57:1538 - *.* @155.165.162.48:1532 - path: /etc/rsyslog.d/remote.conf - owner: root:root - permissions: '0600' - -scripts_per_once: - -power_state: - mode: reboot - message: Server will reboot now - timeout: 5 diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt b/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt deleted file mode 100644 index 4c8f7c06ea..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt +++ /dev/null @@ -1,289 +0,0 @@ -#cloud-config -# \hbrief cloud-init main template for MSP config -# \hversion 0.0.11 -# \hdate 2016-05-09 -# \brief cloud-init template for MSP config -# \version 0.2.57 -# \date 2016-09-19 -# Configuration created for MSP SLES_12 VMT - -chpasswd: - list: | - root:Ericsson - miepadm:miep1234 - - expire: False - -users: - -bootcmd: - - - [ sh, -xc, "echo \"#################################################################\" > /etc/issue.ci" ] - - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# * * * Cloud-init configuration is in progress * * * #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# The system will reboot shortly and then be accessible #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ] - - [ sh, -xc, "echo \"#################################################################\" >> /etc/issue.ci" ] - - [ sh, -xc, "if [ -f /etc/issue.orig ]; then cp /etc/issue.orig /etc/issue; fi" ] - - [ sh, -xc, "if [ ! -f /etc/issue.orig ]; then cp /etc/issue /etc/issue.orig; cp /etc/issue.ci /etc/issue; fi" ] - - [ sh, -xc, "/bin/sed -i 's/^DHCLIENT_SET_DEFAULT_ROUTE=\"yes\".*/DHCLIENT_SET_DEFAULT_ROUTE=\"no\"/' /etc/sysconfig/network/dhcp" ] - - [ sh, -xc, "/bin/sed -i 's/^NETCONFIG_DNS_POLICY=.*/NETCONFIG_DNS_POLICY=\"STATIC\"/' /etc/sysconfig/network/config" ] - -runcmd: - - [ sh, -xc, "chage -M 99999 root;rm -f /etc/shadow-" ] - - [ sh, -xc, "chage -M 99999 miepadm;rm -f /etc/shadow-" ] - - [ sh, -xc, "sed -i 's/^ListenAddress.*/ListenAddress 107.112.138.71/' /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i 's/^ClientAliveCountMax.*/ClientAliveCountMax 300/g' /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i 's/^ClientAliveInterval.*/ClientAliveInterval 10/g' /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config" ] - - [ sh, -xc, "echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config" ] - - [ sh, -xc, "sed -i '/KexAlgorithms/s/^/# /' /etc/ssh/sshd_config" ] - - [ sh, -xc, "mkdir /opt/miep/tools/miit/www/sles" ] - - [ sh, -xc, "rm -f /etc/sysconfig/network/ifcfg-eth1" ] - - [ sh, -xc, "mkdir /shared_nfs_datastore" ] - - [ sh, -xc, "mount -t ext4 /dev/vdb /shared_nfs_datastore" ] - - [ sh, -xc, "mkdir -p /shared_nfs_datastore/miit" ] - - [ sh, -xc, "cp -pr /opt/miep/tools/miit/* /shared_nfs_datastore/miit" ] - - [ sh, -xc, "rm -rf /opt/miep/tools/miit" ] - - [ sh, -xc, "rm -f /etc/udev/rules.d/70-persistent-net.rules" ] - - [ sh, -xc, "ln -s /shared_nfs_datastore/miit /opt/miep/tools/miit" ] - - [ sh, -xc, "chown -R miepadm:miepgrp /shared_nfs_datastore/miit" ] - - [ sh, -xc, "chown -R miepadm:miepgrp /opt/miep/tools/miit" ] - - [ sh, -xc, "mkdir -p /opt/miep/tools/miit/www/sles" ] - - [ sh, -xc, "mount -o loop /shared_nfs_datastore/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso /opt/miep/tools/miit/www/sles" ] - - [ sh, -xc, "/usr/bin/zypper ar /opt/miep/tools/miit/www/sles nfsrpms" ] - - [ sh, -xc, "/usr/bin/zypper lr" ] - - [ sh, -xc, "/usr/bin/zypper --non-interactive install -y nfs-kernel-server" ] - - [ sh, -xc, "/usr/bin/zypper --non-interactive install -y expect" ] - - [ sh, -xc, "/usr/bin/zypper --non-interactive install -y dos2unix" ] - - [ sh, -xc, "echo '//shared_nfs_datastore 107.112.136.0/21(rw,no_root_squash,sync,subtree_check)' >> /etc/exports" ] - - [ sh, -xc, "echo '/dev/vdb /shared_nfs_datastore ext4 acl 1 1' >> /etc/fstab" ] - - [ sh, -xc, "echo '@reboot /var/tmp/hostnamefix.sh > /var/tmp/hostnamefix.log' | /usr/bin/crontab -u root -" ] - - [ sh, -xc, "systemctl enable nfsserver.service" ] - - [ sh, -xc, "systemctl enable rpcbind.service" ] - - [ sh, -xc, "systemctl enable apache2.service" ] - - [ sh, -xc, "chkconfig mount_sles on" ] - - [ sh, -xc, "resize2fs /dev/vdb 200G" ] - - [ sh, -xc, "sed -i 's/PASS_MAX_DAYS 60/PASS_MAX_DAYS 99999/' /etc/login.defs" ] - - [ sh, -xc, "sleep 61s" ] - - [ sh, -xc, "su - miepadm -c \"ssh-keygen -t rsa -q -N '' -f ~/.ssh/id_rsa\"" ] - -timezone: 'PST8PDT' - -write_files: - - content: | - H4sIANk1vFkAA41Sy27bMBC88ysW8TViKaWNC92MAkV9KOIi+QFKWllE+RBIyo9+fZeW7DqxDHR10c4OZ3aXXEDnQgxwjrdOBWiVRmgw1F5VGECCHUyFHlx7YltpMIsuk03jMQS2gPdhZN8ruyUd5yF2CG/fNp/WGwhDFY4houEA6whkZEhNH28EhoANyAiVcxGiMvgI+w4tWAfJGwL6HXpqzCP4wVoy4zciLxaCkVrD6BkeqZXzbLW0UOHooyyVZZOGkzciD8mvebi2TU6vRxvloWQL+l9vstW4CIDvg9bZr0Fq1Spssh/TsgBeO+fjJadzLC+WXNCXT07a1VKn7V7ybcoYOYQeayU1Oe2eYVo6BlaW+exJ1e+esytwyl1fyfo3Yy0KUZbiimaRbNr2Cja1DLH32KpDKhTJ6lSgfVpHL2NCiwvq3RDpSib86YKfXhdLU2QzAS+rn2msz7A6jzXLo3WJJc/zgudPX/lSAPzxjflS9QdTi8IYK0TO97Lf7rlxFd1w3zmLnAabY85hmZPmHn5PeWS8b+2D+M7E/2xtZM5ht639w+8pjwzG/gJrL8X/3wMAAA== - path: /etc/hosts - owner: root:root - permissions: '0644' - encoding: 'gzip+base64' - - content: | - ################################################################################ - ## /etc/ntp.conf - ## - ## Sample NTP configuration file. - ## See package 'ntp-doc' for documentation, Mini-HOWTO and FAQ. - ## Copyright (c) 1998 S.u.S.E. GmbH Fuerth, Germany. - ## - ## Author: Michael Andres, <ma@suse.de> - ## Michael Skibbe, <mskibbe@suse.de> - ## - ################################################################################ - - ## - ## Radio and modem clocks by convention have addresses in the - ## form 127.127.t.u, where t is the clock type and u is a unit - ## number in the range 0-3. - ## - ## Most of these clocks require support in the form of a - ## serial port or special bus peripheral. The particular - ## device is normally specified by adding a soft link - ## /dev/device-u to the particular hardware device involved, - ## where u correspond to the unit number above. - ## - ## Generic DCF77 clock on serial port (Conrad DCF77) - ## Address: 127.127.8.u - ## Serial Port: /dev/refclock-u - ## - ## (create soft link /dev/refclock-0 to the particular ttyS?) - ## - # server 127.127.8.0 mode 5 prefer - server 135.144.38.211 prefer - server 155.165.201.253 prefer - - ## - ## Undisciplined Local Clock. This is a fake driver intended for backup - ## and when no outside source of synchronized time is available. - ## - server 127.127.1.0 # local clock (LCL) - fudge 127.127.1.0 stratum 10 # LCL is unsynchronized - - ## - ## Add external Servers using - ## # rcntp addserver <yourserver> - ## - - ## - ## Miscellaneous stuff - ## - - driftfile /var/lib/ntp/drift/ntp.drift # path for drift file - - logfile /var/log/ntp # alternate log file - # logconfig =syncstatus + sysevents - # logconfig =all - - # statsdir /tmp/ # directory for statistics files - # filegen peerstats file peerstats type day enable - # filegen loopstats file loopstats type day enable - # filegen clockstats file clockstats type day enable - - # - # Authentication stuff - # - keys /etc/ntp.keys # path for keys file - trustedkey 1 # define trusted keys - requestkey 1 # key (7) for accessing server variables - controlkey 1 - - # by default act only as a basic NTP client - restrict default kod nomodify notrap nopeer noquery - restrict -6 default kod nomodify notrap nopeer noquery - # - # allow NTP messages only from the loopback - restrict 127.0.0.1 - restrict ::1 - path: /etc/ntp.conf - owner: root:root - permissions: '0640' - - content: | - default 107.112.136.1 - - - path: /etc/sysconfig/network/routes - owner: root:root - permissions: '0644' - - content: | - <?xml version="1.0" encoding="UTF-8" standalone="yes"?> - <trapDestCfg xmlns="http://www.ericsson.com/esa"> - <managerDefinition snmpVersion="v2c" active="yes"> - <ip>107.239.72.10</ip> - <port>162</port> - <securityName>v1v2ReadWriteSecName</securityName> - <securityLevel>noAuthNoPriv</securityLevel> - </managerDefinition> - <managerDefinition snmpVersion="v2c" active="yes"> - <ip>135.207.171.152</ip> - <port>162</port> - <securityName>v1v2ReadWriteSecName</securityName> - <securityLevel>noAuthNoPriv</securityLevel> - </managerDefinition> - </trapDestCfg> - path: /opt/miep/tools/AttMspCust/CloudInit/trapDestCfg.xml - owner: root:root - permissions: '0755' - - content: | - BOOTPROTO='static' - IPADDR='107.112.138.71' - BROADCAST='107.112.143.255' - NETMASK='255.255.248.0' - NETWORK='107.112.136.0' - STARTMODE='onboot' - DEVICE='eth0' - USERCONTROL='no' - NAME='OAM' - DEFROUTE='yes' - CHECK_DUPLICATE_IP='yes' - SEND_GRATUITOUS_ARP='yes' - path: /etc/sysconfig/network/ifcfg-eth0 - owner: root:root - permissions: '0644' - - content: | - path: /etc/udev/rules.d/10-local.rules - encoding: b64 - owner: root:root - permissions: '0640' - - content: | - #!/bin/bash - ### BEGIN INIT INFO - # Provides: mount_sles - # Required-Start: network - # Required-Stop: network - # Should-Start: - # Should-Stop: - # Default-Start: 3 5 - # Default-Stop: 0 1 2 6 - # Short-Description: Mount SLES iso file - ### END INIT INFO - echo Mount SLES ISO image - mount -o loop /shared_nfs_datastore/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso /opt/miep/tools/miit/www/sles - path: /etc/init.d/mount_sles - owner: root:root - permissions: '0755' - - content: | - grep -qs preserve_hostname /etc/cloud/cloud.cfg - if [ $? -eq 0 ] ; then - sed -i 's/preserve_hostname: .*/preserve_hostname: true/' /etc/cloud/cloud.cfg - fi - - /bin/hostname | grep -qs novalocal - if [ $? -eq 0 ] ; then - newHostname=$(/bin/hostname | sed -e 's/.novalocal//') - hostnamectl set-hostname $newHostname - fi - /usr/bin/crontab -u root -l | grep -v hostnamefix.sh | /usr/bin/crontab -u root - - path: /var/tmp/hostnamefix.sh - owner: root:root - permissions: '0755' - - content: | - ### /etc/resolv.conf file autogenerated by netconfig! - # - # Before you change this file manually, consider to define the - # static DNS configuration using the following variables in the - # /etc/sysconfig/network/config file: - # NETCONFIG_DNS_STATIC_SEARCHLIST - # NETCONFIG_DNS_STATIC_SERVERS - # NETCONFIG_DNS_FORWARDER - # or disable DNS configuration updates via netconfig by setting: - # NETCONFIG_DNS_POLICY='' - # - # See also the netconfig(8) manual page and other documentation. - # - # Note: Manual change of this file disables netconfig too, but - # may get lost when this file contains comments or empty lines - # only, the netconfig settings are same with settings in this - # file and in case of a "netconfig update -f" call. - # - ### Please remove (at least) this line when you modify the file! - nameserver 155.165.194.100 - nameserver 155.165.201.100 - search wapgw.mobilephone.net - options attempts:1 - options timeout:6 - path: /etc/resolv.conf - owner: root:root - permissions: '0644' - - content: | - *.* @135.207.171.57:1538 - *.* @155.165.162.48:1532 - path: /etc/rsyslog.d/remote.conf - owner: root:root - permissions: '0600' - - content: | - H4sIANjbQlkAA5WUUW/aMBSF3/0rjqKgtEyUlodNYmonSulaCQqCqnsYE0kTByyCHcWGjAH/fU5CWqJB1PEC5J6c+/n42qTb/37/2O1cG1I5aindGXXnE9tzFIX1qbKoeJV1rfJQ6VVGln0RiKlBCHVnwmMyDJz12TnZpP9R0/qxsswr0xpzC8ieGqmT3YR5ZeDmBuZm329HdoRkLdtJyzejvTGMavJJa4xP4YsIK+8VujxPK5ojZX25u722PR+12XYa0TARbZ14DmsTRowrmJ93VlaRMyei3oT7cqKhHKlERG1CmI+fML+hxiku8QtfoWaUEwAFnLw54AkquaVAfzOppEFoIGki14qJZH9oOU5jZ9mnzTNPONxLKOAEgXB1gB4SYwj/LQMwCTPvaID4jByJr+oe5vd0P4LPAirXUtFFdR9jKtGlAnYgRHh5IkfjWJDj+oIxNa7HcTyuS93DsHE62gJpEetUvGWv5NITIVTDSLhUSozSeSsu3JeSRivm6m3b/wDPntEI2YDul91yFVvRJpz0G2e6q96Z848vtDMc9ofNA3u9h56I+fE1FmTLMFtdyjwctG8fn+7egaPQfWV6ZEpxoyXnehI0b8nMH+PN3UtpD0QF1tag1X7oNN5ZndDRhcbHWf8PNrcvhT0Q5bBlZ+el9wy9D5IJns9OQQ8jUYx+5KLE19bHFnURKn0uaFjvjQZfLq4mz/1+d1TFFtmFFO9f2OKfK8IgO5DCDUnIX5FnXVGsBQAA - path: /opt/miep/tools/miit/vmtTools/statusCheck.sh - owner: miepadm:miepgrp - permissions: '0755' - encoding: 'gzip+base64' - - content: | - H4sIAKm9hFkAA9VWbW/aMBD+3PyKUxSUrVPiUama1CmdEOsLEqxodPvSVmAlBqwmcRQfUKj632c7EKCMDrVVtX6AxM69PM/d2XfNi7N27fI8sInIkCScZQSFiKV65UjGCV7qlW31eczaFIdKcExzgklGHMmRpTRhtpUzOYoxsFNxkuciV/JMUp5KpHFMkYs0sPs0lkrSAt6HK/BmYDtVG27gK+CQpRYAsHAowNZGOwxHGfySdMCOfFLu+HIIVwunN3BVQ2x12uFIYkbDWyV8Y4MxdMcRqhYw5VGvFyqBU11ddodCogxKGm6x4RobzYuz00bzJLDLz57UGLxeRJGB+6mSVKLK1KucV1qVjtvzYzEovJ90aqXy79alp9ZPKlnQ52thOXijsFAjV1/KBc4BFGgsS3uNuMxiOv3w0bo3a/AUh2t0narjXqcuQLFrG3a9I9AJPT4G575ZFNUDMa86FA/Ww6pJVR3brO5gcxlhbdaaibQIhDEJyW3Ec/Ay+GtFTyaTZeESHSSReLq45XL7+ZokkTRkOUpLBTJUEDbOCnE2wv4CdzrVMtO2fBzM5kXkfAMvZfB5pYpWQq8KbBNBJJhMXdQlok5AUZIQRi9ApvgjzeFu3J+9Gj/wSVud0EbK8flUuYRUIFAY05hHBqT2qjgvLjGmr7B5DKxtadz3dZ5fpVJ2YQJ2q1MD49IY2szYOnqYp3ALdp4iy0Na/W/xPw0/FwJD+i7B37KpQpSz/XeJ3lnvnc/nsCv0xw53KnuFfigmKXg/QWOjUXKkn4N8l56glRMRaeUvh4c7KRgqtlNAsSGABZott1JHaULRzEORZDFDFsGE4xDYfHoyPXpPPR5PUZiP9FX1b3NyFIZMyv4ojqdFWED3SmWwsWLQdEyrZPDInaFiPK4NJOr3otawuMOJMqQcl/1aDUvd+sWP08YZHByTiI1JqtAXfmFvOQrNCfB0oGctEKnWBMWbSgYTytH3i4En3Mz3sqGQeixGkcGBOc2+M4n1/sC/S+LXoLbkolkWrVB1QjVPd8OyW4NqaPN4d/UXFX49yz0x7kAZhR5SHoNX3Sra07I668XfW54I1TXX5rLHVWf9AdB7+rd1DAAA - path: /opt/miep/tools/miit/vmtTools/siteSetup.sh - owner: miepadm:miepgrp - permissions: '0755' - encoding: 'gzip+base64' - -scripts_per_once: - -power_state: - mode: reboot - message: Server will reboot now - timeout: 5 diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json deleted file mode 100644 index c8a8508190..0000000000 --- a/asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json +++ /dev/null @@ -1,75 +0,0 @@ -[ - { - "vfModuleModelName": "VfZrdm5bpxmc02092017Vf..pxmc_base..module-0", - "vfModuleModelInvariantUUID": "f7a867f2-596b-4f4a-a128-421e825a6190", - "vfModuleModelVersion": "1", - "vfModuleModelUUID": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46", - "vfModuleModelCustomizationUUID": "074c64d0-7e13-4bcc-8bdb-ea922331102d", - "isBase": true, - "artifacts": [ - "7e7f7356-11bd-4f2f-bbbc-5c10954e3189", - "6dd99c31-c52e-4c45-b99b-d223c877a296" - ], - "properties": { - "min_vf_module_instances": "1", - "vf_module_label": "pxmc_base", - "max_vf_module_instances": "1", - "vfc_list": "", - "vf_module_description": "", - "vf_module_type": "Base", - "availability_zone_count": "", - "volume_group": "false", - "initial_count": "1" - } - }, - { - "vfModuleModelName": "VfZrdm5bpxmc02092017Vf..pxmc_vmt..module-1", - "vfModuleModelInvariantUUID": "1e099992-6222-41a9-acde-5a8abb690775", - "vfModuleModelVersion": "1", - "vfModuleModelUUID": "4d4423e2-17e8-455a-b9ae-7e4ab71b9cdc", - "vfModuleModelCustomizationUUID": "5336a98e-0966-4e59-b6e6-c8162804a024", - "isBase": false, - "artifacts": [ - "ad12ab80-5419-4346-a5d7-dac2fc15575f", - "53acdabe-689f-45e5-8578-f1514d3529da", - "bc1640f1-69f0-4760-8fc3-3318ec2ff129" - ], - "properties": { - "min_vf_module_instances": "0", - "vf_module_label": "pxmc_vmt", - "max_vf_module_instances": "", - "vfc_list": "", - "vf_module_description": "", - "vf_module_type": "Expansion", - "availability_zone_count": "", - "volume_group": "false", - "initial_count": "0" - } - }, - { - "vfModuleModelName": "VfZrdm5bpxmc02092017Vf..pxmc_mmn..module-2", - "vfModuleModelInvariantUUID": "8e53c069-b2f0-437a-9c00-21cbc5c8f081", - "vfModuleModelVersion": "1", - "vfModuleModelUUID": "a8cb1182-9b6d-46f8-b06b-ded4fe69e10d", - "vfModuleModelCustomizationUUID": "e38906fa-717c-49b0-b391-e6ec12b50c4a", - "isBase": false, - "artifacts": [ - "2f372a02-df1b-46ca-b81e-822e3f406965", - "5bc62c72-5f7a-40bc-a167-1a4fed9afdef", - "b8bca13b-811f-44ab-9d27-45b842c664d8", - "c1ae6284-48d9-4437-a195-b2cf2ba23070", - "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737" - ], - "properties": { - "min_vf_module_instances": "0", - "vf_module_label": "pxmc_mmn", - "max_vf_module_instances": "", - "vfc_list": "", - "vf_module_description": "", - "vf_module_type": "Expansion", - "availability_zone_count": "", - "volume_group": "true", - "initial_count": "0" - } - } -]
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 005e7a3374..dfb6af793c 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -14,9 +14,7 @@ <properties> <camunda.version>7.8.0</camunda.version> - <httpclient.version>4.5.5</httpclient.version> - <jax.ws.rs>2.0.1</jax.ws.rs> <jackson.version>1.1.1</jackson.version> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index 81e2b40bb2..cae80e9137 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,8 +28,6 @@ import org.onap.so.rest.RESTConfig import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - - class AaiUtil { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class); @@ -101,6 +99,15 @@ class AaiUtil { return uri } + public String getAAIServiceInstanceUri(DelegateExecution execution) { + String uri = getBusinessCustomerUri(execution) + + uri = uri +"/" + execution.getVariable("globalSubscriberId") + "/service-subscriptions/service-subscription/" + UriUtils.encode(execution.getVariable("serviceType"),"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(execution.getVariable("serviceInstanceId"),"UTF-8") + + msoLogger.debug('AaiUtil.getAAIRequestInputUri() - AAI URI: ' + uri) + return uri + } + //public String getBusinessCustomerUriv7(DelegateExecution execution) { // // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) // def uri = getUri(execution, 'Customer') @@ -646,4 +653,85 @@ class AaiUtil { return 0 } } + + private def getPInterface(DelegateExecution execution, String aai_uri) { + + String namespace = getNamespaceFromUri(aai_uri) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = ${aai_endpoint}${aai_uri} + + APIResponse response = executeAAIGetCall(execution, serviceAaiPath) + return new XmlParser().parseText(response.getResponseBodyAsString()) + } + + // This method checks if interface is remote + private def isPInterfaceRemote(DelegateExecution execution, String uri) { + if(uri.contains("ext-aai-network")) { + return true + } else { + return false + } + } + + // This method returns Local and remote TPs information from AAI + public Map getTPsfromAAI(DelegateExecution execution) { + Map tpInfo = [:] + + String aai_uri = '/aai/v14/network/logical-links' + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = ${aai_endpoint}${aai_uri} + + APIResponse response = executeAAIGetCall(execution, serviceAaiPath) + + def logicalLinks = new XmlParser().parseText(response.getResponseBodyAsString()) + + logicalLinks."logical-links".find { link -> + def pInterface = [] + def relationship = link."relationship-list"."relationship" + relationship.each { + if ("p-interface".compareToIgnoreCase(it."related-to")) { + pInterface.add(it) + } + } + if (pInterface.size() == 2) { + def localTP = null + def remoteTP = null + + if (pInterface[0]."related-link".contains("ext-aai-networks")) { + remoteTP = pInterface[0] + localTP = pInterface[1] + } + + if (pInterface[1]."related-link".contains("ext-aai-networks")) { + localTP = pInterface[0] + remoteTP = pInterface[1] + } + + if (localTP != null && remoteTP != null) { + + // give local tp + var intfLocal = getPInterface(execution, localTP."related-link") + tpInfotpInfo.put("local-access-node-id", localTP."related-link".split("/")[6]) + + def networkRef = intfLocal."network-ref".split("/") + tpInfo.put("local-access-provider-id", networkRef[1]) + tpInfo.put("local-access-client-id", networkRef[3]) + tpInfo.put("local-access-topology-id", networkRef[5]) + tpInfo.put("local-access-ltp-id", localTP."interface-name") + + // give local tp + var intfRemote = getPInterface(execution, remoteTP."related-link") + tpInfo.put("remote-access-node-id", remoteTP."related-link".split("/")[6]) + def networkRefRemote = intfRemote."network-ref".split("/") + tpInfo.put("remote-access-provider-id", networkRefRemote[1]) + tpInfo.put("remote-access-client-id", networkRefRemote[3]) + tpInfo.put("remote-access-topology-id", networkRefRemote[5]) + tpInfo.put("remote-access-ltp-id", remoteTP."interface-name") + } + } + + } + return tpInfo + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy deleted file mode 100644 index 5aef1d6ea5..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetService.groovy +++ /dev/null @@ -1,440 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import static org.apache.commons.lang3.StringUtils.* - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - - -/** - * This class supports the GenericGetService Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Service-Instance or Service-Subscription (from AAI). - * The calling flow must set the GENGS_type variable as "service-instance" - * or "service-subscription". - * - * When using to Get a Service-Instance: - * If the global-customer-id and service-type are not provided - * this flow executes a query to get the service- Url using the - * Service Id or Name (whichever is provided). - * - * When using to Get a Service-Subscription: - * The global-customer-id and service-type must be - * provided. - * - * Upon successful completion of this sub flow the - * GENGS_SuccessIndicator will be true and the query response payload - * will be set to GENGS_service. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - If this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGS_FoundIndicator - * will be set to false. This variable will allow the calling flow - * to distinguish between the two Success scenarios, - * "Success where service- is found" and - * "Success where service- is NOT found". - * - * - * Variable Mapping Below: - * - * In Mapping Variables: - * For Allotted-Resource: - * @param - GENGS_allottedResourceId - * @param - GENGS_type - * @param (Optional) - GENGS_serviceInstanceId - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Instance: - * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName - * @param - GENGS_type - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Subscription: - * @param - GENGS_type - * @param - GENGS_serviceType - * @param - GENGS_globalCustomerId - * - * - * Out Mapping Variables: - * @param - GENGS_service - * @param - GENGS_FoundIndicator - * @param - WorkflowException - */ -class CustomE2EGetService extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EGetService.class); - - String Prefix = "GENGS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") - - execution.setVariable("GENGS_obtainObjectsUrl", false) - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) - execution.setVariable("GENGS_SuccessIndicator", false) - execution.setVariable("GENGS_FoundIndicator", false) - execution.setVariable("GENGS_resourceLink", null) - execution.setVariable("GENGS_siResourceLink", null) - - try{ - // Get Variables - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - String serviceType = execution.getVariable("GENGS_serviceType") - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String type = execution.getVariable("GENGS_type") - - if(type != null){ - msoLogger.debug("Incoming GENGS_type is: " + type) - if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(allottedResourceId)){ - msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - }else{ - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - } - }else if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ - msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - if(isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) - } - }else{ - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - } - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalCustomerId)){ - msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Id. - * - * @param - execution - */ - public void obtainServiceInstanceUrlById(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - - String type = execution.getVariable("GENGS_type") - String path = "" - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) - path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" - msoLogger.debug("Service Instance Node Query Url is: " + path) - msoLogger.debug("Service Instance Node Query Url is: " + path) - }else if(type.equalsIgnoreCase("allotted-resource")){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) - path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - } - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_genericQueryPath", url) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_genericQueryResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) - msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) - execution.setVariable("GENGS_genericQueryResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - - //Process Response - if(responseCode == 200){ - msoLogger.debug("Generic Query Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Generic Query Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Generic Query Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug("Generic Query Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Name. - * - * @param - execution - */ - public void obtainServiceInstanceUrlByName(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") - try { - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_obtainSIUrlPath", url) - - msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200){ - msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") - } - - - /** - * This method executes a GET call to AAI to obtain the - * service-instance or service-subscription - * - * @param - execution - */ - public void getServiceObject(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService GetServiceObject Process") - try { - String type = execution.getVariable("GENGS_type") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String serviceEndpoint = "" - - msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) - if(type.equalsIgnoreCase("service-instance")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("service-subscription")){ - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String serviceType = execution.getVariable("GENGS_serviceType") - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String serviceUrl = "${aai_endpoint}" + serviceEndpoint - - execution.setVariable("GENGS_getServiceUrl", serviceUrl) - msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_getServiceResponseCode", responseCode) - msoLogger.debug(" GET Service response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_getServiceResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - msoLogger.debug("GET Service Received a Good Response Code") - if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ - msoLogger.debug("GET Service Response Contains a service-instance" ) - execution.setVariable("GENGS_FoundIndicator", true) - execution.setVariable("GENGS_service", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - - }else{ - msoLogger.debug("GET Service Response Does NOT Contain Data" ) - } - }else if(responseCode == 404){ - msoLogger.debug("GET Service Received a Not Found (404) Response") - execution.setVariable("WorkflowResponse", " ") //for junits - } - else{ - msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") - } - msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") - } - -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index de5408fac5..4b701e6a58 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -381,15 +381,22 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { msoLogger.debug("Started processJavaException Method") // if the BPMN flow java error handler sets "BPMN_javaExpMsg", append it to the WFE String javaExpMsg = execution.getVariable("BPMN_javaExpMsg") + String errorMessage = execution.getVariable("gUnknownError") String wfeExpMsg = "Catch a Java Lang Exception in " + processKey if (javaExpMsg != null && !javaExpMsg.empty) { wfeExpMsg = wfeExpMsg + ": " + javaExpMsg } + if (errorMessage != null && !errorMessage.empty) { + msoLogger.error("Unknown Error: " + errorMessage); + } + msoLogger.error("Java Error: " + wfeExpMsg); buildWorkflowException(execution, 2500, wfeExpMsg) }catch(BpmnError b){ + msoLogger.error(b); throw b }catch(Exception e){ + msoLogger.error(e); msoLogger.debug("Caught Exception during processJavaException Method: " + e) buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception") } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 3646f26fb6..2c2cd8269c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig @@ -36,8 +37,8 @@ class ExternalAPIUtil { public MsoUtils utils = new MsoUtils() ExceptionUtil exceptionUtil = new ExceptionUtil() - - private AbstractServiceTaskProcessor taskProcessor + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class) public static final String PostServiceOrderRequestsTemplate = "{\n" + @@ -62,6 +63,7 @@ class ExternalAPIUtil { "\t\t\"action\": <action>,\n" + "\t\t\"service\": {\n" + "\t\t\t\"serviceState\": <serviceState>,\n" + + "\t\t\t\"id\": <serviceId>,\n" + "\t\t\t\"name\": <serviceName>,\n" + "\t\t\t\"serviceSpecification\": { \n" + "\t\t\t\t\"id\": <serviceUuId> \n" + @@ -81,16 +83,12 @@ class ExternalAPIUtil { "\t} \n" + "}" - public ExternalAPIUtil(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } // public String getUri(DelegateExecution execution, resourceName) { // -// def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') // def uri = execution.getVariable("ExternalAPIURi") // if(uri) { -// taskProcessor.logDebug("ExternalAPIUtil.getUri: " + uri, isDebugLogEnabled) +// msoLogger.debug("ExternalAPIUtil.getUri: " + uri) // return uri // } // @@ -98,21 +96,21 @@ class ExternalAPIUtil { // } public String setTemplate(String template, Map<String, String> valueMap) { - taskProcessor.logDebug("ExternalAPIUtil setTemplate", true); + msoLogger.debug("ExternalAPIUtil setTemplate", true); StringBuffer result = new StringBuffer(); String pattern = "<.*>"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(template); - taskProcessor.logDebug("ExternalAPIUtil template:" + template, true); + msoLogger.debug("ExternalAPIUtil template:" + template, true); while (m.find()) { String key = template.substring(m.start() + 1, m.end() - 1); - taskProcessor.logDebug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true); + msoLogger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true); m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); } m.appendTail(result); - taskProcessor.logDebug("ExternalAPIUtil return:" + result.toString(), true); + msoLogger.debug("ExternalAPIUtil return:" + result.toString(), true); return result.toString(); } @@ -128,13 +126,12 @@ class ExternalAPIUtil { * */ public APIResponse executeExternalAPIGetCall(DelegateExecution execution, String url){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug(" ======== STARTED Execute ExternalAPI Get Process ======== ", isDebugEnabled) + msoLogger.debug(" ======== STARTED Execute ExternalAPI Get Process ======== ") APIResponse apiResponse = null try{ String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + msoLogger.debug( "Generated uuid is: " + uuid) + msoLogger.debug( "URL to be used is: " + url) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_externalapi_auth"),execution.getVariable("URN_mso_msoKey")) @@ -146,9 +143,9 @@ class ExternalAPIUtil { } apiResponse = client.get() - taskProcessor.logDebug( "======== COMPLETED Execute ExternalAPI Get Process ======== ", isDebugEnabled) + msoLogger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ") }catch(Exception e){ - taskProcessor.logDebug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e, isDebugEnabled) + msoLogger.debug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return apiResponse @@ -167,13 +164,12 @@ class ExternalAPIUtil { * */ public APIResponse executeExternalAPIPostCall(DelegateExecution execution, String url, String payload){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ") APIResponse apiResponse = null try{ String uuid = utils.getRequestID() - taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + msoLogger.debug( "Generated uuid is: " + uuid) + msoLogger.debug( "URL to be used is: " + url) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_externalapi_auth"),execution.getVariable("URN_mso_msoKey")) RESTConfig config = new RESTConfig(url); @@ -184,9 +180,9 @@ class ExternalAPIUtil { } apiResponse = client.httpPost(payload) - taskProcessor.logDebug( "======== Completed Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( "======== Completed Execute ExternalAPI Post Process ======== ") }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e, isDebugEnabled) + msoLogger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return apiResponse @@ -208,11 +204,10 @@ class ExternalAPIUtil { * */ public APIResponse executeExternalAPIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - taskProcessor.logDebug( " ======== Started Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ") APIResponse apiResponse = null try{ - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + msoLogger.debug( "URL to be used is: " + url) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_externalapi_auth"),execution.getVariable("URN_mso_msoKey")) @@ -223,9 +218,9 @@ class ExternalAPIUtil { } apiResponse = client.httpPost(payload) - taskProcessor.logDebug( "======== Completed Execute ExternalAPI Post Process ======== ", isDebugEnabled) + msoLogger.debug( "======== Completed Execute ExternalAPI Post Process ======== ") }catch(Exception e){ - taskProcessor.utils.log("ERROR", "Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e, isDebugEnabled) + msoLogger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e) exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage()) } return apiResponse diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy deleted file mode 100644 index 857df16772..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetService.groovy +++ /dev/null @@ -1,470 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import org.onap.so.bpmn.core.UrnPropertiesReader - -import org.apache.commons.lang3.StringEscapeUtils -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - -import static org.apache.commons.lang3.StringUtils.isBlank - - - -/** - * This class supports the GenericGetService Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Service-Instance or Service-Subscription (from AAI). - * The calling flow must set the GENGS_type variable as "service-instance" - * or "service-subscription". - * - * When using to Get a Service-Instance: - * If the global-customer-id and service-type are not provided - * this flow executes a query to get the service- Url using the - * Service Id or Name (whichever is provided). - * - * When using to Get a Service-Subscription: - * The global-customer-id and service-type must be - * provided. - * - * Upon successful completion of this sub flow the - * GENGS_SuccessIndicator will be true and the query response payload - * will be set to GENGS_service. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - If this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGS_FoundIndicator - * will be set to false. This variable will allow the calling flow - * to distinguish between the two Success scenarios, - * "Success where service- is found" and - * "Success where service- is NOT found". - * - * - * Variable Mapping Below: - * - * In Mapping Variables: - * For Allotted-Resource: - * @param - GENGS_allottedResourceId - * @param - GENGS_type - * @param (Optional) - GENGS_serviceInstanceId - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Instance: - * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName - * @param - GENGS_type - * @param (Optional) - GENGS_serviceType - * @param (Optional) - GENGS_globalCustomerId - * - * For Service-Subscription: - * @param - GENGS_type - * @param - GENGS_serviceType - * @param - GENGS_globalCustomerId - * - * - * Out Mapping Variables: - * @param - GENGS_service - * @param - GENGS_FoundIndicator - * @param - WorkflowException - */ -class GenericGetService extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetService.class); - - - String Prefix = "GENGS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService PreProcessRequest Process") - - execution.setVariable("GENGS_obtainObjectsUrl", false) - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false) - execution.setVariable("GENGS_SuccessIndicator", false) - execution.setVariable("GENGS_FoundIndicator", false) - execution.setVariable("GENGS_resourceLink", null) - execution.setVariable("GENGS_siResourceLink", null) - - try{ - // Get Variables - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - String serviceType = execution.getVariable("GENGS_serviceType") - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String type = execution.getVariable("GENGS_type") - - if(type != null){ - msoLogger.debug("Incoming GENGS_type is: " + type) - if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(allottedResourceId)){ - msoLogger.debug("Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.") - }else{ - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - } - }else if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){ - msoLogger.debug("Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.") - }else{ - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Instance Name is: " + serviceInstanceName) - if(isBlank(globalCustomerId) || isBlank(serviceType)){ - execution.setVariable("GENGS_obtainObjectsUrl", true) - if(isBlank(serviceInstanceId)){ - execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true) - } - }else{ - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - } - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalCustomerId)){ - msoLogger.debug("Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug("Internal Error encountered within GenericGetService PreProcessRequest method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericGetService PreProcessRequest Process ") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Id. - * - * @param - execution - */ - public void obtainServiceInstanceUrlById(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlById Process") - try { - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - - String type = execution.getVariable("GENGS_type") - String path = "" - if(type.equalsIgnoreCase("service-instance")){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId) - path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" - msoLogger.debug("Service Instance Node Query Url is: " + path) - msoLogger.debug("Service Instance Node Query Url is: " + path) - }else if(type.equalsIgnoreCase("allotted-resource")){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId) - path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - msoLogger.debug("Allotted Resource Node Query Url is: " + path) - } - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_genericQueryPath", url) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_genericQueryResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI GET Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse) - msoLogger.debug("GenericGetService AAI Response before unescaping: " + aaiResponse) - execution.setVariable("GENGS_genericQueryResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - - //Process Response - if(responseCode == 200){ - msoLogger.debug("Generic Query Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Generic Query Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Generic Query Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug("Generic Query Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Generic Query Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlById Process") - } - - /** - * This method obtains the Url to the provided service instance - * using the Service Instance Name. - * - * @param - execution - */ - public void obtainServiceInstanceUrlByName(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService ObtainServiceInstanceUrlByName Process") - try { - String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName") - msoLogger.debug(" Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - - //String url = "${aai_endpoint}${path}" host name needs to be removed from property - String url = "${path}" - execution.setVariable("GENGS_obtainSIUrlPath", url) - - msoLogger.debug("GenericGetService AAI Endpoint: " + aai_endpoint) - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - msoLogger.debug(" GET Service Instance response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200){ - msoLogger.debug(" Query for Service Instance Url Received a Good Response Code") - execution.setVariable("GENGS_SuccessIndicator", true) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - boolean nodeExists = isBlank(globalCustomerId) ? utils.nodeExists(aaiResponse, "result-data") : hasCustomerServiceInstance(aaiResponse, globalCustomerId) - if(nodeExists){ - msoLogger.debug("Query for Service Instance Url Response Does Contain Data" ) - execution.setVariable("GENGS_FoundIndicator", true) - String resourceLink = utils.getNodeText(aaiResponse, "resource-link") - execution.setVariable("GENGS_resourceLink", resourceLink) - execution.setVariable("GENGS_siResourceLink", resourceLink) - }else{ - msoLogger.debug("Query for Service Instance Url Response Does NOT Contains Data" ) - execution.setVariable("WorkflowResponse", " ") //for junits - } - }else if(responseCode == 404){ - msoLogger.debug(" Query for Service Instance Received a Not Found (404) Response") - execution.setVariable("GENGS_SuccessIndicator", true) - execution.setVariable("WorkflowResponse", " ") //for junits - }else{ - msoLogger.debug("Query for Service Instance Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName") - } - msoLogger.trace("COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process") - } - - - /** - * This method executes a GET call to AAI to obtain the - * service-instance or service-subscription - * - * @param - execution - */ - public void getServiceObject(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetService GetServiceObject Process") - try { - String type = execution.getVariable("GENGS_type") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String serviceEndpoint = "" - - msoLogger.debug("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) - if(type.equalsIgnoreCase("service-instance")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Service Instance Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - String siResourceLink = execution.getVariable("GENGS_resourceLink") - if(isBlank(siResourceLink)){ - String allottedResourceId = execution.getVariable("GENGS_allottedResourceId") - msoLogger.debug(" Incoming GENGS_allottedResourceId is: " + allottedResourceId) - String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId") - msoLogger.debug(" Incoming GENGS_serviceInstanceId is: " + serviceInstanceId) - String serviceType = execution.getVariable("GENGS_serviceType") - msoLogger.debug(" Incoming GENGS_serviceType is: " + serviceType) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - msoLogger.debug("Incoming Global Customer Id is: " + globalCustomerId) - - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else{ - msoLogger.debug("Incoming Allotted-Resource Url is: " + siResourceLink) - String[] split = siResourceLink.split("/aai/") - serviceEndpoint = "/aai/" + split[1] - } - }else if(type.equalsIgnoreCase("service-subscription")){ - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String globalCustomerId = execution.getVariable("GENGS_globalCustomerId") - String serviceType = execution.getVariable("GENGS_serviceType") - serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - } - - String serviceUrl = "${aai_endpoint}" + serviceEndpoint - - execution.setVariable("GENGS_getServiceUrl", serviceUrl) - msoLogger.debug("GET Service AAI Path is: \n" + serviceUrl) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl) - int responseCode = response.getStatusCode() - execution.setVariable("GENGS_getServiceResponseCode", responseCode) - msoLogger.debug(" GET Service response code is: " + responseCode) - msoLogger.debug("GenericGetService AAI Response Code: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGS_getServiceResponse", aaiResponse) - msoLogger.debug("GenericGetService AAI Response: " + aaiResponse) - //Process Response - if(responseCode == 200 || responseCode == 202){ - msoLogger.debug("GET Service Received a Good Response Code") - if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){ - msoLogger.debug("GET Service Response Contains a service-instance" ) - execution.setVariable("GENGS_FoundIndicator", true) - execution.setVariable("GENGS_service", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - - }else{ - msoLogger.debug("GET Service Response Does NOT Contain Data" ) - } - }else if(responseCode == 404){ - msoLogger.debug("GET Service Received a Not Found (404) Response") - execution.setVariable("WorkflowResponse", " ") //for junits - } - else{ - msoLogger.debug(" GET Service Received a Bad Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug(" Error encountered within GenericGetService GetServiceObject method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService") - } - msoLogger.trace("COMPLETED GenericGetService GetServiceObject Process") - } - - /** - * An utility method which check whether a service(by name) is already present within a globalCustomerId or not. - * @param jsonResponse raw response received from AAI by searching ServiceInstance by Name. - * @param globalCustomerId - * @return {@code true} if globalCustomerId is found at 6th position within "resource-link", {@code false} in any other cases. - */ - public boolean hasCustomerServiceInstance(String aaiResponse, final String globalCustomerId) { - if (isBlank(aaiResponse)) { - return false - } - aaiResponse = utils.removeXmlNamespaces(aaiResponse) - ArrayList<String> linksArray = utils.getMultNodeObjects(aaiResponse, "resource-link") - if (linksArray == null || linksArray.size() == 0) { - return false - } - for (String resourceLink : linksArray) { - int custStart = resourceLink.indexOf("customer/") - int custEnd = resourceLink.indexOf("/service-subscriptions/") - String receivedCustomerId = resourceLink.substring(custStart + 9, custEnd) - if (globalCustomerId.equals(receivedCustomerId)) { - return true - } - } - return false - } - -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy index d41134be91..8cc756d412 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -67,7 +67,7 @@ import org.onap.so.logger.MsoLogger * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. * * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows - * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * should check if a service-instance or servic-subscription exists by calling the subflow. if it exists then resourceversion should be * obtained from aai and sent as an input parameter. * * Outgoing Variables: @@ -104,7 +104,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{ String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") String type = execution.getVariable("GENPS_type") - + if(type != null){ msoLogger.debug("Incoming GENPS_type is: " + type) if(type.equalsIgnoreCase("service-instance")){ @@ -201,7 +201,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{ String serviceType = execution.getVariable("GENPS_serviceType") msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) - + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index d3ddc60d3e..ca1acc5963 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -48,8 +48,8 @@ public class PayloadClient { UpgradeAction payloadResult = new UpgradeAction(); ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); String payloadString = payload.isPresent() ? payload.get() : ""; - String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); - String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); + String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing_software_version"); + String newSoftware = JsonUtils.getJsonValue(payloadString, "new_software_version"); configParams.setExistingSoftwareVersion(existingSoftware); configParams.setNewSoftwareVersion(newSoftware); configParams.setVnfName(vnfName); @@ -69,7 +69,7 @@ public class PayloadClient { QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); String payloadString = payload.isPresent() ? payload.get() : ""; - String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); + String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations_timeout"); configParams.setOperationsTimeout(operationsTimeout); configParams.setVnfName(vnfName); payloadResult.setConfigurationParameters(configParams); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java index ff51b06dbe..6bd397a63a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java @@ -27,15 +27,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "vnf_name", -"existing-software-version", -"new-software-version" +"existing_software_version", +"new_software_version" }) public class ConfigurationParametersUpgrade { @JsonProperty("vnf_name") private String vnfName; -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") private String existingSoftwareVersion; -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") private String newSoftwareVersion; @JsonProperty("vnf_name") @@ -48,22 +48,22 @@ public void setVnfName(String vnfName) { this.vnfName = vnfName; } -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") public String getExistingSoftwareVersion() { return existingSoftwareVersion; } -@JsonProperty("existing-software-version") +@JsonProperty("existing_software_version") public void setExistingSoftwareVersion(String existingSoftwareVersion) { this.existingSoftwareVersion = existingSoftwareVersion; } -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") public String getNewSoftwareVersion() { return newSoftwareVersion; } -@JsonProperty("new-software-version") +@JsonProperty("new_software_version") public void setNewSoftwareVersion(String newSoftwareVersion) { this.newSoftwareVersion = newSoftwareVersion; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java index 5746dcd586..38f974168e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -38,6 +38,8 @@ public class BuildingBlock implements Serializable{ private String key; @JsonProperty("is-virtual-link") private boolean isVirtualLink; + @JsonProperty("virtual-link-key") + private String virtualLinkKey; public String getBpmnFlowName() { return bpmnFlowName; @@ -63,4 +65,10 @@ public class BuildingBlock implements Serializable{ public void setIsVirtualLink(boolean isVirtualLink) { this.isVirtualLink = isVirtualLink; } + public String getVirtualLinkKey() { + return virtualLinkKey; + } + public void setVirtualLinkKey(String virtualLinkKey) { + this.virtualLinkKey = virtualLinkKey; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java index 6ceac935f1..349010781d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -27,7 +27,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoCollection implements Serializable { private static final long serialVersionUID = 8380534468706675508L; - + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUUID; @JsonProperty("model-version-id") private String modelVersionId; @JsonProperty("model-invariant-uuid") @@ -43,6 +45,12 @@ public class ModelInfoCollection implements Serializable { @JsonProperty("quantity") private int quantity; + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } public String getModelVersionId() { return modelVersionId; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index aa68114011..b5203c676a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -65,6 +65,7 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; @@ -246,14 +247,18 @@ public class BBInputSetup implements JavaDelegate { org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); if (modelType.equals(ModelType.network)) { + lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId); this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); } else if (modelType.equals(ModelType.vnf)) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId); this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); } else if (modelType.equals(ModelType.volumeGroup)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId); this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); } else if (modelType.equals(ModelType.vfModule)) { + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId); this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); } else { @@ -320,8 +325,6 @@ public class BBInputSetup implements JavaDelegate { protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams, CloudConfiguration cloudConfiguration) throws Exception { - boolean foundByName = false; - boolean foundById = false; String vnfModelCustomizationUUID = null; if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { @@ -349,29 +352,31 @@ public class BBInputSetup implements JavaDelegate { cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + break; } } break; } } if (vnf != null) { - for (VfModule vfModule : vnf.getVfModules()) { + VfModule vfModule = null; + for (VfModule vfModuleTemp : vnf.getVfModules()) { if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null - && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { - foundById = true; - this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); - } else if (instanceName != null && vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); - this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + vfModule = vfModuleTemp; + String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); + modelInfo.setModelCustomizationId(vfModuleCustId); + break; } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { - VfModule vfModule = this.createVfModule(lookupKeyMap, + if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { + vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams); - this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); vnf.getVfModules().add(vfModule); } + if(vfModule != null) { + mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } } else { msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); @@ -422,48 +427,47 @@ public class BBInputSetup implements JavaDelegate { protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List<Map<String, String>> instanceParams) throws Exception { - boolean foundByName = false; - boolean foundById = false; + VolumeGroup volumeGroup = null; + GenericVnf vnf = null; String vnfModelCustomizationUUID = null; + String generatedVnfType = vnfType; + if (generatedVnfType == null || generatedVnfType.isEmpty()) { + generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + break; } } } - GenericVnf vnf = null; for (GenericVnf tempVnf : serviceInstance.getVnfs()) { if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { vnf = tempVnf; - vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) + vnfModelCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) .getModelCustomizationId(); ModelInfo vnfModelInfo = new ModelInfo(); vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + mapCatalogVnf(tempVnf, vnfModelInfo, service); break; } } if (vnf != null && vnfModelCustomizationUUID != null) { - for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId() .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { - foundById = true; - this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); - } else if (instanceName != null && volumeGroup.getVolumeGroupName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + volumeGroup = volumeGroupTemp; + break; } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { - if (vnfType == null || vnfType.isEmpty()) { - vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); - } - VolumeGroup volumeGroup = this.createVolumeGroup(lookupKeyMap, resourceId, instanceName, vnfType, instanceParams); + if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { + volumeGroup = createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams); vnf.getVolumeGroups().add(volumeGroup); - this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + if(volumeGroup != null) { + mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); } } else { msoLogger.debug("Related VNF instance Id not found: " + lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); @@ -521,10 +525,13 @@ public class BBInputSetup implements JavaDelegate { org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams) { - boolean foundByName = false; - boolean foundById = false; + GenericVnf vnf = null; ModelInfo instanceGroupModelInfo = null; String instanceGroupId = null; + String generatedVnfType = vnfType; + if (generatedVnfType == null || generatedVnfType.isEmpty()) { + generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } if (relatedInstanceList != null) { for (RelatedInstanceList relatedInstList : relatedInstanceList) { RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); @@ -534,36 +541,26 @@ public class BBInputSetup implements JavaDelegate { } } } - for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + for (GenericVnf vnfTemp : serviceInstance.getVnfs()) { if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null - && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - foundById = true; - org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); - if(vnf!=null){ - modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); - } - this.mapCatalogVnf(genericVnf, modelInfo, service); - } else if (instanceName != null && genericVnf.getVnfName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); - org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); - if(vnf!=null){ - modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); - } - this.mapCatalogVnf(genericVnf, modelInfo, service); + && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + String vnfModelCustId = bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId(); + modelInfo.setModelCustomizationUuid(vnfModelCustId); + vnf = vnfTemp; + break; } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { - if(vnfType == null || vnfType.isEmpty()) { - vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { + vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, generatedVnfType, instanceParams); + serviceInstance.getVnfs().add(vnf); + } + if(vnf != null) { + mapCatalogVnf(vnf, modelInfo, service); + mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); + if (instanceGroupId != null && instanceGroupModelInfo != null) { + mapNetworkCollectionInstanceGroup(vnf, instanceGroupId); } - GenericVnf genericVnf = this.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, vnfType, instanceParams); - serviceInstance.getVnfs().add(genericVnf); - this.mapCatalogVnf(genericVnf, modelInfo, service); - this.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); - if (instanceGroupId != null && instanceGroupModelInfo != null) - this.mapNetworkCollectionInstanceGroup(genericVnf, instanceGroupId); } } @@ -584,7 +581,7 @@ public class BBInputSetup implements JavaDelegate { } protected void mapNetworkCollectionInstanceGroup(GenericVnf genericVnf, String instanceGroupId) { - org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = this.bbInputSetupUtils + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = bbInputSetupUtils .getAAIInstanceGroup(instanceGroupId); InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup( @@ -635,25 +632,22 @@ public class BBInputSetup implements JavaDelegate { protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, List<Map<String, String>> instanceParams) { - boolean foundByName = false; - boolean foundById = false; - for (L3Network network : serviceInstance.getNetworks()) { + L3Network network = null; + for (L3Network networkTemp : serviceInstance.getNetworks()) { if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null - && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { - foundById = true; - this.mapCatalogNetwork(network, modelInfo, service); - } else if (instanceName != null && network.getNetworkName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); - this.mapCatalogNetwork(network, modelInfo, service); + && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + network = networkTemp; + break; } } - if (!foundByName && !foundById + if (network == null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - L3Network l3Network = this.createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); - serviceInstance.getNetworks().add(l3Network); - this.mapCatalogNetwork(l3Network, modelInfo, service); + network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); + serviceInstance.getNetworks().add(network); + } + if(network != null) { + mapCatalogNetwork(network, modelInfo, service); } } @@ -1452,7 +1446,9 @@ public class BBInputSetup implements JavaDelegate { aaiCollection = aaiCollectionOp.get(); Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); - + NetworkCollectionResourceCustomization collectionResourceCust = + bbInputSetupUtils.getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, collectionResourceCust.getCollectionResource())); Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); Relationships relationships = null; if (relationshipsOp.isPresent()) { @@ -1493,7 +1489,7 @@ public class BBInputSetup implements JavaDelegate { Relationships relationships = relationshipsOp.get(); this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY), network.getNetworkPolicies()); - this.mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), + mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), network.getContrailNetworkRouteTableReferences()); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 04f9cdcb86..c2161a4fee 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -142,6 +142,10 @@ public class BBInputSetupMapperLayer { protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) { VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class); vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus())); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule()); + vfModule.setModelInfoVfModule(modelInfoVfModule); return vfModule; } @@ -175,7 +179,7 @@ public class BBInputSetupMapperLayer { protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); - if(instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) + if(instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); else modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); @@ -201,6 +205,7 @@ public class BBInputSetupMapperLayer { modelInfoCollection.setDescription(collectionResource.getDescription()); modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); + modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID()); return modelInfoCollection; } @@ -461,4 +466,4 @@ public class BBInputSetupMapperLayer { CollectionNetworkResourceCustomization collectionNetworkResourceCust) { return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 14c162935a..4b85538428 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -49,6 +49,7 @@ import org.onap.so.client.db.request.RequestsDbClient; import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -127,6 +128,11 @@ public class BBInputSetupUtils { return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); } + public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID( + String collectionCustomizationId) { + return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId); + } + public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) { return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); } @@ -389,8 +395,8 @@ public class BBInputSetupUtils { } } - public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vfModuleId, String volumeGroupName) throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vfModuleId); + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); VolumeGroup volumeGroup = null; @@ -406,4 +412,4 @@ public class BBInputSetupUtils { return Optional.of(volumeGroup); } } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn deleted file mode 100644 index 90722a95f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn +++ /dev/null @@ -1,321 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_D5VzAHElEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="CustomE2EGetService" name="CustomE2EGetService" isExecutable="true"> - <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" /> - <bpmn2:exclusiveGateway id="getUrl" name="Need Object's Url?" default="getUrlNo"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>getUrlYes</bpmn2:outgoing> - <bpmn2:outgoing>getUrlNo</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" /> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" /> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" /> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> - </bpmn2:endEvent> - </bpmn2:subProcess> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.setSuccessIndicator(execution, true) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> - <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.getServiceObject(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> - <bpmn2:incoming>getUrlNo</bpmn2:incoming> - <bpmn2:incoming>foundYes</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" /> - <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> - <bpmn2:incoming>obtainById</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" /> - <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> - <bpmn2:incoming>obtainByName</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -CustomE2EGetService getService = new CustomE2EGetService() -getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" /> - <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById"> - <bpmn2:incoming>getUrlYes</bpmn2:incoming> - <bpmn2:outgoing>obtainById</bpmn2:outgoing> - <bpmn2:outgoing>obtainByName</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" /> - <bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:exclusiveGateway id="serviceFoundCheck" name="Service Exist?" default="notFound"> - <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> - <bpmn2:outgoing>foundYes</bpmn2:outgoing> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" /> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" /> - </bpmn2:endEvent> - <bpmn2:exclusiveGateway id="ExclusiveGateway_3"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" /> - </bpmn2:endEvent> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" /> - </bpmn2:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1"> - <dc:Bounds x="108" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="126" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization"> - <dc:Bounds x="228" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288"> - <di:waypoint xsi:type="dc:Point" x="144" y="282" /> - <di:waypoint xsi:type="dc:Point" x="228" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="177" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true"> - <dc:Bounds x="372" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="420" y="282" width="72" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227"> - <di:waypoint xsi:type="dc:Point" x="328" y="282" /> - <di:waypoint xsi:type="dc:Point" x="372" y="281" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="350" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById"> - <dc:Bounds x="528" y="197" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> - <dc:Bounds x="738" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="763" y="311" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance"> - <dc:Bounds x="820" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233"> - <di:waypoint xsi:type="dc:Point" x="397" y="256" /> - <di:waypoint xsi:type="dc:Point" x="397" y="170" /> - <di:waypoint xsi:type="dc:Point" x="446" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="397" y="213" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="195" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="668" y="221" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290"> - <di:waypoint xsi:type="dc:Point" x="788" y="281" /> - <di:waypoint xsi:type="dc:Point" x="820" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="397" y="306" /> - <di:waypoint xsi:type="dc:Point" x="397" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="306" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="400" y="324" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess"> - <dc:Bounds x="960" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291"> - <di:waypoint xsi:type="dc:Point" x="920" y="282" /> - <di:waypoint xsi:type="dc:Point" x="960" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="937" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1"> - <dc:Bounds x="1133" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1151" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223"> - <di:waypoint xsi:type="dc:Point" x="1060" y="282" /> - <di:waypoint xsi:type="dc:Point" x="1133" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1100" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="152" y="468" width="325" height="169" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2"> - <dc:Bounds x="176" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="194" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2"> - <dc:Bounds x="416" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="434" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException"> - <dc:Bounds x="265" y="513" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292"> - <di:waypoint xsi:type="dc:Point" x="212" y="553" /> - <di:waypoint xsi:type="dc:Point" x="265" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="233" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224"> - <di:waypoint xsi:type="dc:Point" x="365" y="553" /> - <di:waypoint xsi:type="dc:Point" x="416" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="385" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName"> - <dc:Bounds x="528" y="59" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true"> - <dc:Bounds x="446" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="501" y="164" width="53" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> - <dc:Bounds x="646" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="671" y="200" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289"> - <di:waypoint xsi:type="dc:Point" x="471" y="195" /> - <di:waypoint xsi:type="dc:Point" x="471" y="236" /> - <di:waypoint xsi:type="dc:Point" x="528" y="237" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="476" y="207" width="16" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301"> - <di:waypoint xsi:type="dc:Point" x="471" y="145" /> - <di:waypoint xsi:type="dc:Point" x="471" y="99" /> - <di:waypoint xsi:type="dc:Point" x="528" y="99" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="471" y="115" width="40" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="145" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="665" y="99" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true"> - <dc:Bounds x="738" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="735" y="125" width="59" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235"> - <di:waypoint xsi:type="dc:Point" x="696" y="170" /> - <di:waypoint xsi:type="dc:Point" x="738" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="704" y="170" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="763" y="195" /> - <di:waypoint xsi:type="dc:Point" x="763" y="256" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="762" y="205" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229"> - <di:waypoint xsi:type="dc:Point" x="788" y="170" /> - <di:waypoint xsi:type="dc:Point" x="877" y="171" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="170" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3"> - <dc:Bounds x="877" y="153" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="895" y="194" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn deleted file mode 100644 index 2015526874..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn +++ /dev/null @@ -1,321 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_D5VzAHElEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="GenericGetService" name="GenericGetService" isExecutable="true"> - <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" /> - <bpmn2:exclusiveGateway id="getUrl" name="Need Object's Url?" default="getUrlNo"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>getUrlYes</bpmn2:outgoing> - <bpmn2:outgoing>getUrlNo</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" /> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" /> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" /> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> - </bpmn2:endEvent> - </bpmn2:subProcess> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.setSuccessIndicator(execution, true) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> - <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.getServiceObject(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> - <bpmn2:incoming>getUrlNo</bpmn2:incoming> - <bpmn2:incoming>foundYes</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" /> - <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> - <bpmn2:incoming>obtainById</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" /> - <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> - <bpmn2:incoming>obtainByName</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetService getService = new GenericGetService() -getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" /> - <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById"> - <bpmn2:incoming>getUrlYes</bpmn2:incoming> - <bpmn2:outgoing>obtainById</bpmn2:outgoing> - <bpmn2:outgoing>obtainByName</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" /> - <bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:exclusiveGateway id="serviceFoundCheck" name="Service Exist?" default="notFound"> - <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> - <bpmn2:outgoing>foundYes</bpmn2:outgoing> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" /> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" /> - </bpmn2:endEvent> - <bpmn2:exclusiveGateway id="ExclusiveGateway_3"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" /> - </bpmn2:endEvent> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" /> - </bpmn2:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1"> - <dc:Bounds x="108" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="126" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization"> - <dc:Bounds x="228" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288"> - <di:waypoint xsi:type="dc:Point" x="144" y="282" /> - <di:waypoint xsi:type="dc:Point" x="228" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="177" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true"> - <dc:Bounds x="372" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="420" y="282" width="72" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227"> - <di:waypoint xsi:type="dc:Point" x="328" y="282" /> - <di:waypoint xsi:type="dc:Point" x="372" y="281" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="350" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById"> - <dc:Bounds x="528" y="197" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> - <dc:Bounds x="738" y="256" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="763" y="311" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance"> - <dc:Bounds x="820" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233"> - <di:waypoint xsi:type="dc:Point" x="397" y="256" /> - <di:waypoint xsi:type="dc:Point" x="397" y="170" /> - <di:waypoint xsi:type="dc:Point" x="446" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="397" y="213" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="237" /> - <di:waypoint xsi:type="dc:Point" x="671" y="195" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="668" y="221" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290"> - <di:waypoint xsi:type="dc:Point" x="788" y="281" /> - <di:waypoint xsi:type="dc:Point" x="820" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="281" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="397" y="306" /> - <di:waypoint xsi:type="dc:Point" x="397" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="370" /> - <di:waypoint xsi:type="dc:Point" x="763" y="306" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="400" y="324" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess"> - <dc:Bounds x="960" y="242" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291"> - <di:waypoint xsi:type="dc:Point" x="920" y="282" /> - <di:waypoint xsi:type="dc:Point" x="960" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="937" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1"> - <dc:Bounds x="1133" y="264" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1151" y="305" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223"> - <di:waypoint xsi:type="dc:Point" x="1060" y="282" /> - <di:waypoint xsi:type="dc:Point" x="1133" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1100" y="282" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="152" y="468" width="325" height="169" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2"> - <dc:Bounds x="176" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="194" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2"> - <dc:Bounds x="416" y="535" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="434" y="576" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException"> - <dc:Bounds x="265" y="513" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292"> - <di:waypoint xsi:type="dc:Point" x="212" y="553" /> - <di:waypoint xsi:type="dc:Point" x="265" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="233" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224"> - <di:waypoint xsi:type="dc:Point" x="365" y="553" /> - <di:waypoint xsi:type="dc:Point" x="416" y="553" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="385" y="553" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName"> - <dc:Bounds x="528" y="59" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true"> - <dc:Bounds x="446" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="501" y="164" width="53" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> - <dc:Bounds x="646" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="671" y="200" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289"> - <di:waypoint xsi:type="dc:Point" x="471" y="195" /> - <di:waypoint xsi:type="dc:Point" x="471" y="236" /> - <di:waypoint xsi:type="dc:Point" x="528" y="237" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="476" y="207" width="16" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301"> - <di:waypoint xsi:type="dc:Point" x="471" y="145" /> - <di:waypoint xsi:type="dc:Point" x="471" y="99" /> - <di:waypoint xsi:type="dc:Point" x="528" y="99" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="471" y="115" width="40" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234"> - <di:waypoint xsi:type="dc:Point" x="628" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="99" /> - <di:waypoint xsi:type="dc:Point" x="671" y="145" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="665" y="99" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true"> - <dc:Bounds x="738" y="145" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="735" y="125" width="59" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235"> - <di:waypoint xsi:type="dc:Point" x="696" y="170" /> - <di:waypoint xsi:type="dc:Point" x="738" y="170" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="704" y="170" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228"> - <di:waypoint xsi:type="dc:Point" x="763" y="195" /> - <di:waypoint xsi:type="dc:Point" x="763" y="256" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="762" y="205" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229"> - <di:waypoint xsi:type="dc:Point" x="788" y="170" /> - <di:waypoint xsi:type="dc:Point" x="877" y="171" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="798" y="170" width="22" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3"> - <dc:Bounds x="877" y="153" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="895" y="194" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy deleted file mode 100644 index a8c10b1e81..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EGetServiceTest.groovy +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.runners.MockitoJUnitRunner - -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName - -/** - * @author sushilma - * @since January 10, 2018 - */ -@RunWith(MockitoJUnitRunner.class) -@Ignore -class CustomE2EGetServiceTest extends MsoGroovyTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Captor - static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - - @Test - public void testObtainServiceInstanceUrlById (){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - CustomE2EGetService customE2EGetService = new CustomE2EGetService(); - customE2EGetService.obtainServiceInstanceUrlById(mockExecution) - Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(5)) - } - - @Test - public void testObtainServiceInstanceUrlByName (){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENGS_serviceInstanceName")).thenReturn("1604-MVM-26") - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); - CustomE2EGetService customE2EGetService = new CustomE2EGetService(); - customE2EGetService.obtainServiceInstanceUrlByName(mockExecution) - Mockito.verify(mockExecution, times(8)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(5)) - } - - @Test - public void testServiceObject (){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EGetService','GENGS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - when(mockExecution.getVariable("GENGS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENGS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENGS_resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/1234453") - MockGetServiceInstance("MSO_1610_dev", "MSO-dev-service-type", "1234453", "GenericFlows/getServiceInstance.xml"); - CustomE2EGetService customE2EGetService = new CustomE2EGetService(); - customE2EGetService.getServiceObject(mockExecution) - Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(5)) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy deleted file mode 100644 index 49edd813f7..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetServiceTest.groovy +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.core.WorkflowException - -import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.* - -@RunWith(MockitoJUnitRunner.class) -@Ignore -class GenericGetServiceTest { - - def prefix = "GENGS_" - @Captor - ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class); - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - @Test - public void testGetServiceObject() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') - when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') - when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') - when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - mockData() - GenericGetService obj = new GenericGetService() - obj.getServiceObject(mockExecution) - - Mockito.verify(mockExecution).setVariable("prefix", prefix) - Mockito.verify(mockExecution).setVariable(prefix + "getServiceUrl", "http://localhost:8090/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") - Mockito.verify(mockExecution).setVariable(prefix + "getServiceResponseCode", 200) - } - - @Test - public void testGetServiceObjectEndpointNull() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable(prefix + "type")).thenReturn('service-instance') - when(mockExecution.getVariable(prefix + "serviceInstanceId")).thenReturn('12345') - when(mockExecution.getVariable(prefix + "resourceLink")).thenReturn("/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - mockData() - try { - GenericGetService obj = new GenericGetService() - obj.getServiceObject(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) - Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) - } - - private void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/.*")) - .willReturn(aResponse() - .withStatus(200).withHeader("Content-Type", "text/xml") - .withBodyFile(""))) - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("GenericGetService") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("GenericGetService") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("GenericGetService") - when(mockExecution.getProcessInstanceId()).thenReturn("GenericGetService") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - return mockExecution - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy deleted file mode 100644 index 1aef78f0d5..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnfTest.groovy +++ /dev/null @@ -1,180 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.core.WorkflowException - -import static com.github.tomakehurst.wiremock.client.WireMock.* -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when - -@RunWith(MockitoJUnitRunner.class) -@Ignore -class GenericGetVnfTest { - - def prefix = "GENGV_" - - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Captor - static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - @Test - public void testGetVnfByName() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfByName(mockExecution) - - Mockito.verify(mockExecution).setVariable("prefix","GENGV_") - Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf?vnf-name=genricVnf_test&depth=1") - } - - @Test - public void testGetVnfByNameEndpointNull() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable(prefix+"vnfName")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - try{ - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfByName(mockExecution) - }catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) - Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) - } - - @Test - public void testGetVnfById() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfById(mockExecution) - - Mockito.verify(mockExecution).setVariable("prefix","GENGV_") - Mockito.verify(mockExecution).setVariable(prefix+"getVnfPath","http://localhost:28090/aai/v9/network/generic-vnfs/generic-vnf/genricVnf_test?depth=1") - } - - @Test - public void testGetVnfByIdEndpointNull() { - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable(prefix+"vnfId")).thenReturn("genricVnf_test") - when(mockExecution.getVariable(prefix+"type")).thenReturn("generic-vnf") - when(mockExecution.getVariable("mso.workflow.DoCreateVfModule.aai.generic-vnf.uri")).thenReturn("/aai/v9/network/generic-vnfs/generic-vnf") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - - mockData() - try{ - GenericGetVnf obj = new GenericGetVnf() - obj.getVnfById(mockExecution) - }catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) - Assert.assertEquals("org.apache.http.client.ClientProtocolException", workflowException.getErrorMessage()) - } - - private static ExecutionEntity setupMock() { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoCreateVfModule") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVfModule") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVfModule") - when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVfModule") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - - private static void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/network/generic-vnfs/generic-vnf.*")) - .willReturn(aResponse() - .withStatus(200).withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy deleted file mode 100644 index d4ea8ce71f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenericPutServiceTest.groovy +++ /dev/null @@ -1,235 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import static org.mockito.Mockito.* -import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance; - -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - -@RunWith(MockitoJUnitRunner.class) -@Ignore -class GenericPutServiceTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - - } - - @Test - public void preProcessRequest() { - - - println "************ preProcessRequest ************* " - - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") - - GenericPutService putServiceInstance= new GenericPutService() - putServiceInstance.preProcessRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) - // verify(mockExecution).setVariable("globalSubscriberId", "1604-MVM-26") - // verify(mockExecution).setVariable("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET") - // verify(mockExecution).setVariable("serviceType", "SDN-ETHERNET-INTERNET") - // verify(mockExecution).setVariable("ServiceInstanceData", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - - } - - - @Test - @Ignore - public void putServiceInstance() { - println "************ putServiceInstance ************* " - - WireMock.reset(); - - MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"); - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer.uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("GENPS_serviceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("GENPS_type")).thenReturn("service-instance") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("7") - when(mockExecution.getVariable("mso.workflow.default.aai.v7.customer.uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - GenericPutService serviceInstance= new GenericPutService() - serviceInstance.putServiceInstance(mockExecution) - - // check the sequence of variable invocation - MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - // verify(mockExecution).setVariable("GENPSI_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - String servicePayload = """<service-instance xmlns="http://org.openecomp.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance>""" as String - verify(mockExecution).setVariable("GENPS_serviceInstancePayload",servicePayload) - - String serviceAaiPath = "http://localhost:28090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" - verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - - int responseCode = 200 - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - - String aaiResponse = """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Content-Length" value="0"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> -</rest:RESTResponse>""" - - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", true) - } - - @Test - @Ignore - public void putServiceInstance_404() { - - - println "************ putServiceInstance ************* " - - WireMock.reset(); - - ExecutionEntity mockExecution = setupMock() - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn("MIS%2F1604%2F0026%2FSW_INTERNET") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.PutServiceInstance.aai.business.customer_uri")).thenReturn("/aai/v7/business/customers/customer") - when(mockExecution.getVariable("GENPS_ServiceInstanceData")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - GenericPutService serviceInstance= new GenericPutService() - serviceInstance.putServiceInstance(mockExecution) - - // check the sequence of variable invocation - MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", "GENPS_") - - // execution.getVariable("isDebugLogEnabled") - - - verify(mockExecution).setVariable("GENPS_serviceInstanceData","f70e927b-6087-4974-9ef8-c5e4d5847ca4") - - String serviceInstancepayload = """<service-instance xmlns="http://org.onap.so.aai.inventory/v7">f70e927b-6087-4974-9ef8-c5e4d5847ca4 - </service-instance>""" as String - verify(mockExecution).setVariable("GENPS_serviceInstancePayload",serviceInstancepayload) - - String serviceInstanceAaiPath = "http://localhost:8090/aai/v7/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET" - verify(mockExecution).setVariable("GENPS_putServiceInstanceAaiPath", serviceInstanceAaiPath) - - int responseCode = 404 - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - - String aaiResponse = "" - verify(mockExecution).setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - verify(mockExecution).setVariable("GENPS_SuccessIndicator", false) - - - } - - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("PutServiceInstance") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("PutServiceInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("PutServiceInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("PutServiceInstance") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - - return mockExecution - } - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java index 8d681d721c..80b978e4fd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -31,10 +31,10 @@ public class PayloadClientTest { @Test public void upgradeFormatTest() throws Exception { - String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}"; + String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing_software_version\":\"existingVersion\",\"new_software_version\":\"newVersion\"}}"; JSONObject jsonObject = new JSONObject(); - jsonObject.put("existing-software-version", "existingVersion"); - jsonObject.put("new-software-version", "newVersion"); + jsonObject.put("existing_software_version", "existingVersion"); + jsonObject.put("new_software_version", "newVersion"); Optional<String> payload = Optional.of(jsonObject.toString()); Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); assertEquals(payloadResult, payloadClient.get()); @@ -51,7 +51,7 @@ public class PayloadClientTest { public void quiesceTrafficFormatTest() throws Exception { String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}"; JSONObject jsonObject = new JSONObject(); - jsonObject.put("operations-timeout", "operationTimeout"); + jsonObject.put("operations_timeout", "operationTimeout"); Optional<String> payload = Optional.of(jsonObject.toString()); Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); assertEquals(payloadResult, payloadClient.get()); @@ -78,4 +78,4 @@ public class PayloadClientTest { assertEquals(payloadResult, payloadClient.get()); } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 355dc15bbf..a821d69754 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -658,8 +658,8 @@ public class BBInputSetupTest { public void testPopulateObjectsOnAssignAndCreateFlows() throws Exception { String bbName = AssignFlows.SERVICE_INSTANCE.toString(); String instanceName = "instanceName"; - String resourceId = "123"; String vnfType = "vnfType"; + String resourceId = "networkId"; Service service = Mockito.mock(Service.class); ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class); RequestDetails requestDetails = Mockito.mock(RequestDetails.class); @@ -675,12 +675,6 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, - service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); - doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, - lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); - doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); doReturn(modelInfo).when(requestDetails).getModelInfo(); doReturn(requestInfo).when(requestDetails).getRequestInfo(); doReturn(instanceName).when(requestInfo).getInstanceName(); @@ -690,36 +684,41 @@ public class BBInputSetupTest { doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration(); doReturn(ModelType.network).when(modelInfo).getModelType(); - SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); + assertEquals("NetworkId populated", true, lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.vnf).when(modelInfo).getModelType(); - + resourceId = "vnfId"; + doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, + service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + assertEquals("VnfId populated", true, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.volumeGroup).when(modelInfo).getModelType(); - + resourceId = "volumeGroupId"; + doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); + assertEquals("VolumeGroupId populated", true, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.vfModule).when(modelInfo).getModelType(); - + resourceId = "vfModuleId"; + doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + assertEquals("VfModuleId populated", true, lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId)); } @Test @@ -946,7 +945,6 @@ public class BBInputSetupTest { vg.setVolumeGroupName("volumeGroupName"); vg.setVolumeGroupId("volumeGroupId"); vnf.getVolumeGroups().add(vg); - vnf.getVolumeGroups().add(vg); serviceInstance.getVnfs().add(vnf); Service service = mapper.readValue( @@ -962,9 +960,10 @@ public class BBInputSetupTest { aaiGenericVnf.setModelCustomizationId("vnfModelCustomizationUUID"); doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); + verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); vnf.getVolumeGroups().clear(); SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); @@ -1023,14 +1022,14 @@ public class BBInputSetupTest { SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service); instanceName = "networkName2"; L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); doReturn(network2).when(SPY_bbInputSetup).createNetwork(lookupKeyMap, instanceName, resourceId, null); SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network2, modelInfo, service); + verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service); } @Test @@ -1148,8 +1147,15 @@ public class BBInputSetupTest { String resourceId = "123"; doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId"); + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); - doReturn(null).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); + org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup(); + doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any()); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); @@ -1157,7 +1163,7 @@ public class BBInputSetupTest { SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, @@ -1166,11 +1172,14 @@ public class BBInputSetupTest { resourceId, vnfType, null); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2"); + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); - verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); } @Test @@ -1202,7 +1211,14 @@ public class BBInputSetupTest { String resourceId = "123"; doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId"); + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup(); + doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any()); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup(); + doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); @@ -1211,20 +1227,24 @@ public class BBInputSetupTest { SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf, modelInfo, service); + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, vnfType, null); doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, vnfType, null); + org.onap.aai.domain.yang.GenericVnf vnf2AAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId2"); + doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null); - verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf2, modelInfo, service); - verify(SPY_bbInputSetup, times(1)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); + verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); + verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); } @Test @@ -1459,14 +1479,20 @@ public class BBInputSetupTest { new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection))); Collection collection = new Collection(); + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); List<InstanceGroup> instanceGroupsList = new ArrayList<>(); InstanceGroup instanceGroup = new InstanceGroup(); instanceGroupsList.add(instanceGroup); - + NetworkCollectionResourceCustomization networkCollectionCust = Mockito.mock(NetworkCollectionResourceCustomization.class); + CollectionResource collectionResource = new CollectionResource(); doReturn(collection).when(bbInputSetupMapperLayer) .mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class)); doReturn(instanceGroup).when(SPY_bbInputSetup).mapInstanceGroup(isA(AAIResultWrapper.class)); doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any()); + doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils).getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + doReturn(collectionResource).when(networkCollectionCust).getCollectionResource(); + doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(networkCollectionCust, collectionResource); + SPY_bbInputSetup.mapCollection(collections, serviceInstance); assertEquals(collection, serviceInstance.getCollection()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index d576242318..aa883b67a2 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -736,7 +736,7 @@ public class BBInputSetupUtilsTest { volumeGroup.setVolumeGroupName("name123"); expected.get().getVolumeGroup().add(volumeGroup); doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "name123"); + Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "name123"); assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); } @@ -745,6 +745,7 @@ public class BBInputSetupUtilsTest { expectedException.expect(Exception.class); String vnfId = "vnfId"; + String volumeGroupId = "volumeGroupId"; String volumeGroupName = "volumeGroupName"; VolumeGroup volumeGroup = new VolumeGroup(); @@ -757,18 +758,19 @@ public class BBInputSetupUtilsTest { doReturn(expectedVolumeGroup).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); } @Test public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception { String vnfId = "vnfId"; + String volumeGroupId = "volumeGroupId"; String volumeGroupName = "volumeGroupName"; doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupName); + Optional<VolumeGroup> actualVolumeGroup = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); assertEquals(actualVolumeGroup, Optional.empty()); } -} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json index a500e0ba88..4a72cde73a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResource.json @@ -1,5 +1,5 @@ { - "modelUUID":null, + "modelUUID":"modelVersionId", "modelName":null, "modelInvariantUUID":"modelInvariantUUID", "modelVersion":null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json index d87875da81..fc2ade75fb 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/CollectionResourceCustomization.json @@ -1,5 +1,5 @@ { - "modelCustomizationUUID":null, + "modelCustomizationUUID":"modelCustomizationUUID", "modelInstanceName":null, "type":"type", "role":"role", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json index 0d00e4d007..e4c8a8f59b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json @@ -12,7 +12,9 @@ "heat-stack-id":"heatStackId", "contrail-service-instance-fqdn":"contrailServiceInstanceFqdn", "module-index":1,"selflink":"selflink", - "model-info-vf-module":null + "model-info-vf-module": { + "is-base-boolean":false + } }], "volume-groups":[], "line-of-business":null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json index 45ca00bd32..a7e2ade10b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json @@ -1,4 +1,6 @@ { + "model-customization-uuid":"modelCustomizationUUID", + "model-version-id":"modelVersionId", "model-invariant-uuid":"modelInvariantUUID", "collection-function":"function", "collection-role":"role", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml deleted file mode 100644 index 7c879879ef..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml +++ /dev/null @@ -1,23 +0,0 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3"> - <generic-vnf> - <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <resource-version>testReVer123</resource-version> - <relationship-list> - <relationship> - <related-to>nothing</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml deleted file mode 100644 index 0b5a822b68..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml +++ /dev/null @@ -1,90 +0,0 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3"> - <generic-vnf> - <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - <generic-vnf> - <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id> - <vnf-name>ZRDM1MMSC03</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml deleted file mode 100644 index 0b5a822b68..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml +++ /dev/null @@ -1,90 +0,0 @@ -<generic-vnfs xmlns="http://com.aai.inventory/v3"> - <generic-vnf> - <vnf-id>2f1cc940-455f-4ee2-9411-a7899cd4f124</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - <generic-vnf> - <vnf-id>802767b3-18a6-4432-96db-25522786aee0</vnf-id> - <vnf-name>ZRDM1MMSC03</vnf-name> - <vnf-type>mmsc-capacity</vnf-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <equipment-role>vMMSC</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>c597ab81-fece-49f4-a4f5-710cebb13c29</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>53956c91-6e5e-49aa-88dd-535f57e66e70</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>44e0d9e0-9334-4ec6-9344-07a96dac629f</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>ac49d99b-5daf-4624-9f8e-188b126ea166</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - <l-interfaces/> - <lag-interfaces/> - </generic-vnf> - </generic-vnfs>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml deleted file mode 100644 index d0fccd80c9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml +++ /dev/null @@ -1,6 +0,0 @@ - <search-results xmlns="http://com.aai.inventory"> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> - </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml deleted file mode 100644 index d0fccd80c9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml +++ /dev/null @@ -1,6 +0,0 @@ - <search-results xmlns="http://com.aai.inventory"> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> - </search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml deleted file mode 100644 index fce47fcd0d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<search-results xmlns="http://org.openecomp.aai.inventory/v11"> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>/aai/v11/business/customers/customer/AbcBank/service-subscriptions/service-subscription/ABC-ST/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> - <result-data> - <resource-type>service-instance</resource-type> - <resource-link>/aai/v11/business/customers/customer/XyCorporation/service-subscriptions/service-subscription/XY-ST/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET</resource-link> - </result-data> -</search-results>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml deleted file mode 100644 index e377c70474..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml +++ /dev/null @@ -1,30 +0,0 @@ -<service-instance> - <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> - <resource-version>123456789</resource-version> - <relationship-list> - <relationship> - <related-to>cvlan-tag</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> - <relationship-data> - <relationship-key>cvlan-tag.cvlan-tag</relationship-key> - <relationship-value>2003</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>port-group.interface-id</relationship-key> - <relationship-value>slcp1447vbc.ipag</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vce</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </service-instance>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml deleted file mode 100644 index 52e75d970a..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml +++ /dev/null @@ -1,34 +0,0 @@ -<service-subscription xmlns="http://com.aai.inventory"> - <service-type>SDN-ETHERNET-INTERNET</service-type> - <resource-version>1234</resource-version> - <service-instance> - <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id> - <resource-version>123456789</resource-version> - <relationship-list> - <relationship> - <related-to>cvlan-tag</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link> - <relationship-data> - <relationship-key>cvlan-tag.cvlan-tag</relationship-key> - <relationship-value>2003</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>port-group.interface-id</relationship-key> - <relationship-value>slcp1447vbc.ipag</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vce</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link> - <relationship-data> - <relationship-key>vce.vnf-id</relationship-key> - <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </service-instance> - </service-subscription>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml deleted file mode 100644 index b55d51971d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml +++ /dev/null @@ -1,97 +0,0 @@ -<vce xmlns="http://com.aai.inventory"> - <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-name2>US0112SLCP1VBRT076</vnf-name2> - <vnf-type>esx-vce</vnf-type> - <prov-status>NVTPROV</prov-status> - <orchestration-status>created</orchestration-status> - <resource-version>0000020</resource-version> - <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id> - <mso-catalog-key/> - <vpe-id>VPESAT-mtanjrsv126</vpe-id> - <ipv4-oam-address>135.21.249.160</ipv4-oam-address> - <port-groups> - <port-group> - <interface-id>slcp1476vbc.vpe</interface-id> - <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id> - <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name> - <interface-role>Internet</interface-role> - <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name> - <resource-version>0000020</resource-version> - <switch-name>dvs-slcp1-01</switch-name> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>3012</cvlan-tag> - <resource-version>0000020</resource-version> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - <port-group> - <interface-id>slcp1476vbc.ipag</interface-id> - <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id> - <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name> - <interface-role>Customer</interface-role> - <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name> - <switch-name>dvs-slcp1-01</switch-name> - <resource-version>0000020</resource-version> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>2003</cvlan-tag> - <resource-version>0000020</resource-version> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - </port-groups> - <relationship-list> - <relationship> - <related-to>service-instance</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>SDN-ETHERNET-INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>011216-1602-SDNC001</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vserver</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link> - <relationship-data> - <relationship-key>vserver.vserver-id</relationship-key> - <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>complex</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link> - <relationship-data> - <relationship-key>complex.physical-location-id</relationship-key> - <relationship-value>MDTWNJ21A4</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>availability-zone</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link> - <relationship-data> - <relationship-key>availability-zone.availability-zone-name</relationship-key> - <relationship-value>slcp1-esx-az01</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </vce>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml deleted file mode 100644 index e5f98bfe33..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml +++ /dev/null @@ -1,92 +0,0 @@ -<vce xmlns="http://com.aai.inventory"> - <vnf-id>1936628a-d22f-4943-8587-a57bab2ece7a</vnf-id> - <vnf-name>testVnfName123</vnf-name> - <vnf-name2>US0112SLCP1VBRT076</vnf-name2> - <vnf-type>esx-vce</vnf-type> - <prov-status>NVTPROV</prov-status> - <orchestration-status>created</orchestration-status> - <heat-stack-id>slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d</heat-stack-id> - <mso-catalog-key/> - <vpe-id>VPESAT-mtanjrsv126</vpe-id> - <ipv4-oam-address>135.21.249.160</ipv4-oam-address> - <port-groups> - <port-group> - <interface-id>slcp1476vbc.vpe</interface-id> - <neutron-network-id>e7568706-a2a9-45f8-aef8-95a0e2910953</neutron-network-id> - <neutron-network-name>dvspg-VCE_VPE-slcp1476vbc</neutron-network-name> - <interface-role>Internet</interface-role> - <port-group-name>dvspg-VCE_VPE-slcp1476vbc</port-group-name> - <switch-name>dvs-slcp1-01</switch-name> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>3012</cvlan-tag> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - <port-group> - <interface-id>slcp1476vbc.ipag</interface-id> - <neutron-network-id>3477ddb6-b925-4971-ab62-c84b69634c49</neutron-network-id> - <neutron-network-name>dvspg-IPAG_VCE-slcp1476vbc</neutron-network-name> - <interface-role>Customer</interface-role> - <port-group-name>dvspg-IPAG_VCE-slcp1476vbc</port-group-name> - <switch-name>dvs-slcp1-01</switch-name> - <orchestration-status>created</orchestration-status> - <heat-stack-id>dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7</heat-stack-id> - <mso-catalog-key/> - <cvlan-tags> - <cvlan-tag-entry> - <cvlan-tag>2003</cvlan-tag> - </cvlan-tag-entry> - </cvlan-tags> - </port-group> - </port-groups> - <relationship-list> - <relationship> - <related-to>service-instance</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/</related-link> - <relationship-data> - <relationship-key>service-instance.service-instance-id</relationship-key> - <relationship-value>SDNC/VLXM/0112001//SW_INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>service-subscription.service-type</relationship-key> - <relationship-value>SDN-ETHERNET-INTERNET</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>customer.global-customer-id</relationship-key> - <relationship-value>011216-1602-SDNC001</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vserver</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/</related-link> - <relationship-data> - <relationship-key>vserver.vserver-id</relationship-key> - <relationship-value>ecab47d5-3450-4507-ada9-2b3c58485c51</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>3d5f3fe23821416fac2b69af65248c74</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>complex</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/</related-link> - <relationship-data> - <relationship-key>complex.physical-location-id</relationship-key> - <relationship-value>MDTWNJ21A4</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>availability-zone</related-to> - <related-link>https://aai-ext1.test..com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/</related-link> - <relationship-data> - <relationship-key>availability-zone.availability-zone-name</relationship-key> - <relationship-value>slcp1-esx-az01</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </vce>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml deleted file mode 100644 index eedbda9343..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml +++ /dev/null @@ -1,11 +0,0 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Content-Length" value="0"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> -</rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml deleted file mode 100644 index 66ed8f5758..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<Fault> -<requestError> -<serviceException> -<messageId>SVC3002</messageId> -<text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> -<variables> -<variable>PUTcustomer</variable> -<variable>SubName01</variable> -<variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]</variable> -<variable>ERR.5.4.5105</variable> -</variables> -</serviceException> -</requestError> -</Fault>
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 57bfb4ed30..151ba2c3aa 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -135,12 +135,6 @@ <version>2.3.0</version> </dependency> <dependency> - <groupId>org.camunda.bpm.extension</groupId> - <artifactId>camunda-bpm-assert</artifactId> - <version>2.0-alpha2</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId> <version>2.3.0</version> @@ -202,5 +196,10 @@ <artifactId>micrometer-registry-prometheus</artifactId> <version>1.0.5</version> </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>so-bpmn-tasks</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy deleted file mode 100644 index bb58030683..0000000000 --- a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy +++ /dev/null @@ -1,425 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.scripts - -import org.json.JSONObject -import org.json.XML; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.onap.so.rest.APIResponse -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory -import java.util.UUID; - -import org.camunda.bpm.engine.runtime.Execution -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - -/** - * This groovy class supports the <class>CreateActivateSDNCResource.bpmn</class> process. - * flow for SDNC Network Resource Create - */ -public class CreateActivateSDNCResource extends AbstractServiceTaskProcessor { - - String Prefix="CRESDNCRES_" - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - JsonUtils jsonUtil = new JsonUtils() - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - public void preProcessRequest(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) - try { - - //get bpmn inputs from resource request. - String requestId = execution.getVariable("mso-request-id") - String requestAction = execution.getVariable("requestAction") - utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) - String recipeParamsFromRequest = execution.getVariable("recipeParams") - utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) - String resourceInput = execution.getVariable("resourceInput") - utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) - //Get ResourceInput Object - ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) - execution.setVariable(Prefix + "resourceInput", resourceInputObj) - - //Deal with recipeParams - String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() - //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" - String apiType = "network" - if(!StringUtils.isBlank(recipeParamsFromRequest)){ - //the operationType from worflow(first node) is second priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") - apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") - } - if(!StringUtils.isBlank(recipeParamsFromWf)){ - //the operationType from worflow(first node) is highest priority. - operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") - apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType") - } - - execution.setVariable(Prefix + "operationType", operationType) - execution.setVariable(Prefix + "apiType", apiType) - execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) - execution.setVariable("mso-request-id", requestId) - execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) - //TODO Here build networkrequest - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - String msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - - String customizeResourceParam(String netowrkInputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(netowrkInputParametersJson); - Iterator iterator = jsonObject.keys(); - while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); - hashMap.put("name", key); - hashMap.put("value", jsonObject.get(key)) - paramList.add(hashMap) - } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); - - return new JSONObject(paramMap).toString(); - } - - public void prepareSDNCRequest (DelegateExecution execution) { - String svcAction = "create" - prepareSDNCRequestReq(execution, svcAction, "") - } - - - public void prepareSDNCActivateRequest (DelegateExecution execution) { - String svcAction = "activate" - String sndcResourceId = execution.getVariable(Prefix + "sdncResourceId") - prepareSDNCRequestReq(execution, svcAction, sndcResourceId) - } - /** - * Pre Process the BPMN Flow Request - * Inclouds: - * generate the nsOperationKey - * generate the nsParameters - */ - public void prepareSDNCRequestReq (DelegateExecution execution, String svcAction, String sdncResourceId) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - - try { - // get variables - String operationType = execution.getVariable(Prefix + "operationType") - String sdnc_apiType = execution.getVariable(Prefix + "apiType") - String sdnc_svcAction = svcAction - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable(Prefix + "networkRequest") - - String hdrRequestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - String source = execution.getVariable("source") - String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String serviceType = resourceInputObj.getServiceType() - String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() - String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() - String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() - String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() - String globalCustomerId = resourceInputObj.getGlobalSubscriberId() - String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); - String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() - String resourceInputPrameters = resourceInputObj.getResourceParameters() - String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") - //here convert json string to xml string - String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson))) - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" - xmlns:sdncadapter="http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1" - xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> - <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${sdnc_svcAction}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>${sdnc_apiType}-topology-operation</sdncadapter:SvcOperation> - <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> - <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> - </sdncadapter:RequestHeader> - <sdncadapterworkflow:SDNCRequestData> - <request-information> - <request-id>${hdrRequestId}</request-id> - <request-action>${sdnc_requestAction}</request-action> - <source>${source}</source> - <notification-url></notification-url> - <order-number></order-number> - <order-version></order-version> - </request-information> - <service-information> - <service-id>${serviceInstanceId}</service-id> - <subscription-service-type>${serviceType}</subscription-service-type> - <onap-model-information> - <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid> - <model-uuid>${serviceModelUuid}</model-uuid> - <model-version>${serviceModelVersion}</model-version> - <model-name>${serviceModelName}</model-name> - </onap-model-information> - <service-instance-id>${serviceInstanceId}</service-instance-id> - <global-customer-id>${globalCustomerId}</global-customer-id> - </service-information> - <${sdnc_apiType}-information> - <${sdnc_apiType}-id>${sdncResourceId}</${sdnc_apiType}-id> - <onap-model-information> - <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid> - <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid> - <model-uuid>${modelUuid}</model-uuid> - <model-version>${modelVersion}</model-version> - <model-name>${modelName}</model-name> - </onap-model-information> - </${sdnc_apiType}-information> - <${sdnc_apiType}-request-input> - <${sdnc_apiType}-input-parameters>${netowrkInputParameters}</${sdnc_apiType}-input-parameters> - </${sdnc_apiType}-request-input> - </sdncadapterworkflow:SDNCRequestData> - </aetgt:SDNCAdapterWorkflowRequest>""".trim() - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) - utils.log("INFO","sdncAdapterWorkflowRequest :" + sndcTopologyCreateRequesAsString, isDebugEnabled) - utils.log("DEBUG","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - private void setProgressUpdateVariables(DelegateExecution execution, String body) { - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - execution.setVariable("CVFMI_updateResOperStatusRequest", body) - } - - public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) - - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String operationId = resourceInputObj.getOperationId() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String progress = "20" - String status = "processing" - String statusDescription = "Create " + modelName - - execution.getVariable("operationId") - - String body = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <ns:updateResourceOperationStatus> - <operType>${operType}</operType> - <operationId>${operationId}</operationId> - <progress>${progress}</progress> - <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> - <serviceId>${ServiceInstanceId}</serviceId> - <status>${status}</status> - <statusDescription>${statusDescription}</statusDescription> - </ns:updateResourceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>"""; - - setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled) - } - - public void postCreateSDNC(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - ServicePluginFactory.getInstance().test() - utils.log("INFO"," ***** Started postCreateSDNC *****", isDebugEnabled) - String sdnc_apiType = execution.getVariable(Prefix + "apiType") - String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") - utils.log("INFO","sdncAdapterResponse for create:" + sdncAdapterResponse , isDebugEnabled) - sdncAdapterResponse = sdncAdapterResponse.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "") - sdncAdapterResponse = sdncAdapterResponse.replaceAll('tag0:', '').replaceAll(':tag0', '') - utils.log("INFO","sdncAdapterResponse for create after replace:" + sdncAdapterResponse , isDebugEnabled) - //if it is vnf we need to query the vnf-id,if it is network , we need to query the network-id - String sdncRespData = utils.getNodeText1(sdncAdapterResponse, "RequestData") - utils.log("INFO","sdncRespData:" + sdncRespData , isDebugEnabled) - String objectKey = "/" + sdnc_apiType + "/" - String objectDataKey = "/" + sdnc_apiType + "-data/" - String objectPath = utils.getNodeText1(sdncRespData, "object-path") - - String resourceObjId = objectPath.substring(objectPath.indexOf(objectKey) + objectKey.length(), objectPath.indexOf(objectDataKey)) - utils.log("INFO", "resourceObjId:" + resourceObjId, isDebugEnabled) - execution.setVariable(Prefix + "sdncResourceId", resourceObjId) - - utils.log("INFO"," ***** End postCreateSDNC *****", isDebugEnabled) - - } - - public void postActivateSDNC(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started postActivateSDNC *****", isDebugEnabled) - String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse") - utils.log("INFO","sdncAdapterResponse for activate:" + sdncAdapterResponse , isDebugEnabled) - utils.log("INFO"," ***** End postActivateSDNC *****", isDebugEnabled) - } - - public void prepareUpdateAfterCreateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String operationId = resourceInputObj.getOperationId() - String progress = "50" - String status = "processing" - String statusDescription = "Instantiate " + modelName - - execution.getVariable("operationId") - - String body = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <ns:updateResourceOperationStatus> - <operType>${operType}</operType> - <operationId>${operationId}</operationId> - <progress>${progress}</progress> - <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> - <serviceId>${ServiceInstanceId}</serviceId> - <status>${status}</status> - <statusDescription>${statusDescription}</statusDescription> - </ns:updateResourceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>"""; - - setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled) - } - - public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") - String operType = resourceInputObj.getOperationType() - String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() - String ServiceInstanceId = resourceInputObj.getServiceInstanceId() - String modelName = resourceInputObj.getResourceModelInfo().getModelName() - String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "Instantiate " + modelName + " finished" - - execution.getVariable("operationId") - - String body = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <ns:updateResourceOperationStatus> - <operType>${operType}</operType> - <operationId>${operationId}</operationId> - <progress>${progress}</progress> - <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> - <serviceId>${ServiceInstanceId}</serviceId> - <status>${status}</status> - <statusDescription>${statusDescription}</statusDescription> - </ns:updateResourceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>"""; - - setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled) - } - - public void postCreateSDNCCall(DelegateExecution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) - String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") - String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - - utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) - utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } -} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java deleted file mode 100644 index 38d05fe28e..0000000000 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java +++ /dev/null @@ -1,560 +0,0 @@ -/* - * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. - */ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.junit.Test; -import org.onap.so.BaseIntegrationTest; - - -/** - * Unit Test for the GenericGetService Sub Flow - */ - -public class GenericGetServiceIT extends BaseIntegrationTest { - - - @Test - public void testGenericGetService_success_serviceInstance() throws Exception{ - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); - String processId = invokeSubProcess( "GenericGetService", variables); - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals(null, workflowException); - } - - - @Test - - public void testGenericGetService_success_serviceSubscription() throws Exception{ - - MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET"); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstance_byName() throws Exception{ - - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertNotNull(response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstance_byId() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstance_404Response() throws Exception{ - - MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceSubscription404() throws Exception{ - MockGetServiceSubscription("SDN-ETHERNET-INTERNET", "1604-MVM-26", 404); - - Map<String, Object> variables = new HashMap<>(); - setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26"); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertNotNull(response); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstanceByName404() throws Exception{ - - MockNodeQueryServiceInstanceByName_404("1604-MVM-26"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "", "1604-MVM-26", null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertEquals("404", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstanceById404() throws Exception{ - - MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertEquals("404", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{ - - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{ - MockNodeQueryServiceInstanceByName("1604-MVM-26", ""); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "", "1604-MVM-26", null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{ - - MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", ""); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - - @Test - - public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{ - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.,workStep=*]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{ - - Map<String, Object> variables = new HashMap<>(); - setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.,workStep=*]"; - - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - - public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{ - - MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789"); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("false", obtainUrl); - assertEquals("false", byName); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - - public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{ - - MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("false", byName); - assertEquals("500", siUrlResponseCode); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - - public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{ - - MockNodeQueryServiceInstanceByName_500("1604-MVM-26"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", null, null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId); - String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); - - String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]"; - - assertEquals("false", successIndicator); - assertEquals("false", found); - assertEquals("true", obtainUrl); - assertEquals("true", byName); - assertEquals("500", siUrlResponseCode); - assertEquals(expectedWorkflowException, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{ - - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); - MockGetServiceInstance("AbcBank", "ABC-ST", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("true", found); - assertNotNull(resourceLink); - assertNotNull(response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - @Test - - public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{ - - MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); - MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - Map<String, Object> variables = new HashMap<>(); - setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null); - - String processId = invokeSubProcess( "GenericGetService", variables); - - - String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId); - String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId); - String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId); - String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId); - String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId); - String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId); - - assertEquals("true", successIndicator); - assertEquals("false", found); - assertEquals(null, resourceLink); - assertEquals(" ", response); - assertEquals("200", siUrlResponseCode); - assertEquals(null, workflowException); - } - - private void setVariablesInstance(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENGS_serviceInstanceId", siId); - variables.put("GENGS_serviceInstanceName", siName); - variables.put("GENGS_globalCustomerId",globalCustId); - variables.put("GENGS_serviceType", serviceType); - variables.put("GENGS_type", "service-instance"); - variables.put("mso-request-id", UUID.randomUUID().toString()); - } - - private void setVariablesSubscription(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) { - variables.put("isDebugLogEnabled", "true"); - variables.put("GENGS_serviceInstanceId", siId); - variables.put("GENGS_serviceInstanceName", siName); - variables.put("GENGS_globalCustomerId",globalCustId); - variables.put("GENGS_serviceType", serviceType); - variables.put("GENGS_type", "service-subscription"); - variables.put("mso-request-id", UUID.randomUUID().toString()); - } - - -} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java index 7c4c8201ea..b514c38d47 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java @@ -30,25 +30,23 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import java.util.HashMap; import java.util.List; import java.util.Map; - import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.history.HistoricVariableInstance; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.test.Deployment; import org.camunda.bpm.engine.test.ProcessEngineRule; import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl; +import org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml") -@Ignore public class CreateAndActivatePnfResourceTest { private static final String TIMEOUT_10_S = "PT10S"; @@ -62,6 +60,9 @@ public class CreateAndActivatePnfResourceTest { @Autowired private AaiConnectionTestImpl aaiConnection; + @Autowired + private DmaapClientTestImpl dmaapClientTestImpl; + @Test @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception { @@ -97,9 +98,8 @@ public class CreateAndActivatePnfResourceTest { ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); - runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey("businessKey") - .correlateWithResult(); + dmaapClientTestImpl.sendMessage(); + // then assertThat(instance).isEnded().hasPassedInOrder( "CreateAndActivatePnf_StartEvent", @@ -126,9 +126,8 @@ public class CreateAndActivatePnfResourceTest { ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); - runtimeService.createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey("businessKey") - .correlateWithResult(); + dmaapClientTestImpl.sendMessage(); + // then assertThat(instance).isEnded().hasPassedInOrder( "CreateAndActivatePnf_StartEvent", diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml index 72462bd092..72462bd092 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/applicationContext_forPnfTesting.xml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index cc6e19d446..a8a6441740 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -9,7 +9,6 @@ <artifactId>so-bpmn-building-blocks</artifactId> <packaging>jar</packaging> <properties> - <jax.ws.rs>2.0.1</jax.ws.rs> <httpclient.version>3.1</httpclient.version> <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version> <h2.version>1.4.196</h2.version> @@ -142,11 +141,6 @@ <version>3.4</version> </dependency> <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>javax.ws.rs-api</artifactId> - <version>2.0</version> - </dependency> - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </dependency> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn index 7691498bd0..abc017c957 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="CreateVfModuleBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -23,21 +23,27 @@ <bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_16g4dz0" sourceRef="CreateVfModule" targetRef="VnfAdapter" /> - <bpmn:sequenceFlow id="SequenceFlow_0ecr393" sourceRef="VnfAdapter" targetRef="UpdateVfModuleStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_0ecr393" sourceRef="VnfAdapter" targetRef="UpdateVfModuleHeatStackId" /> <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter"> <bpmn:extensionElements> <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" /> + <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> + <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing> </bpmn:callActivity> <bpmn:sequenceFlow id="SequenceFlow_1stomxq" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" /> <bpmn:serviceTask id="UpdateVfModuleStatus" name="Update VfModule Ostatus to Created (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0qqsilv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1stomxq</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0qqsilv" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" /> + <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name="Update VfModule HeatStackId (AAI)" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0ecr393</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0qqsilv</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVfModuleBB"> @@ -58,9 +64,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="CreateVfModuleBB_End"> - <dc:Bounds x="1259" y="-3" width="36" height="36" /> + <dc:Bounds x="1391" y="-3" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1267" y="37" width="19" height="12" /> + <dc:Bounds x="1399" y="37" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="CreateVfModule"> @@ -92,23 +98,33 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ecr393_di" bpmnElement="SequenceFlow_0ecr393"> <di:waypoint xsi:type="dc:Point" x="990" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1065" y="15" /> + <di:waypoint xsi:type="dc:Point" x="1063" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1028" y="0" width="0" height="0" /> + <dc:Bounds x="1027" y="0" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1i1pfzb_di" bpmnElement="VnfAdapter"> <dc:Bounds x="890" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1stomxq_di" bpmnElement="SequenceFlow_1stomxq"> - <di:waypoint xsi:type="dc:Point" x="1165" y="15" /> - <di:waypoint xsi:type="dc:Point" x="1259" y="15" /> + <di:waypoint xsi:type="dc:Point" x="1327" y="15" /> + <di:waypoint xsi:type="dc:Point" x="1391" y="15" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1212" y="0" width="0" height="0" /> + <dc:Bounds x="1359" y="0" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0fpfn71_di" bpmnElement="UpdateVfModuleStatus"> - <dc:Bounds x="1065" y="-25" width="100" height="80" /> + <dc:Bounds x="1227" y="-25" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0qqsilv_di" bpmnElement="SequenceFlow_0qqsilv"> + <di:waypoint xsi:type="dc:Point" x="1163" y="15" /> + <di:waypoint xsi:type="dc:Point" x="1227" y="15" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1195" y="0" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_04k1b85_di" bpmnElement="UpdateVfModuleHeatStackId"> + <dc:Bounds x="1063" y="-25" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn index 58a429dcc5..a95dc9ce73 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="CreateVolumeGroupBB" name="CreateVolumeGroupBB" isExecutable="true"> <bpmn:startEvent id="CreateVolumeGroupBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing> @@ -14,7 +14,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0kfkpbh" sourceRef="CreateVolumeGroupVnfAdapter" targetRef="Vnf_Adapter" /> <bpmn:serviceTask id="UpdateVolumeGroupAAI" name="UpdateVolumeGroupAAI" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_06flg6h</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1d5nux2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mh0v9h" sourceRef="UpdateVolumeGroupAAI" targetRef="CreateVolumeGroupBB_End" /> @@ -28,11 +28,17 @@ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> + <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0kfkpbh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_06flg6h</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_06flg6h" sourceRef="Vnf_Adapter" targetRef="UpdateVolumeGroupAAI" /> + <bpmn:sequenceFlow id="SequenceFlow_06flg6h" sourceRef="Vnf_Adapter" targetRef="UpdateVolumeGroupHeatStackId" /> + <bpmn:sequenceFlow id="SequenceFlow_1d5nux2" sourceRef="UpdateVolumeGroupHeatStackId" targetRef="UpdateVolumeGroupAAI" /> + <bpmn:serviceTask id="UpdateVolumeGroupHeatStackId" name="Update VolumeGroup HeatStackId (AAI)" camunda:expression="${AAIUpdateTasks.updateHeatStackIdVolumeGroup(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06flg6h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1d5nux2</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" /> <bpmn:escalation id="Escalation_1hjulni" name="Escalation_2cgup2p" /> @@ -52,9 +58,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1k6463v_di" bpmnElement="CreateVolumeGroupBB_End"> - <dc:Bounds x="928" y="102" width="36" height="36" /> + <dc:Bounds x="1063" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="901" y="142" width="90" height="12" /> + <dc:Bounds x="1081" y="142" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_01zmebl_di" bpmnElement="CreateVolumeGroupVnfAdapter"> @@ -68,13 +74,13 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0rytcj0_di" bpmnElement="UpdateVolumeGroupAAI"> - <dc:Bounds x="776" y="80" width="100" height="80" /> + <dc:Bounds x="929" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mh0v9h_di" bpmnElement="SequenceFlow_0mh0v9h"> - <di:waypoint xsi:type="dc:Point" x="876" y="120" /> - <di:waypoint xsi:type="dc:Point" x="928" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1029" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1063" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="857" y="98.5" width="90" height="13" /> + <dc:Bounds x="1046" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1wythmn_di" bpmnElement="QueryVfModuleSDNC"> @@ -92,11 +98,21 @@ </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_06flg6h_di" bpmnElement="SequenceFlow_06flg6h"> <di:waypoint xsi:type="dc:Point" x="729" y="120" /> - <di:waypoint xsi:type="dc:Point" x="776" y="120" /> + <di:waypoint xsi:type="dc:Point" x="774" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="752.5" y="99" width="0" height="12" /> + <dc:Bounds x="752" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1d5nux2_di" bpmnElement="SequenceFlow_1d5nux2"> + <di:waypoint xsi:type="dc:Point" x="874" y="120" /> + <di:waypoint xsi:type="dc:Point" x="929" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="902" y="105" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0m035ns_di" bpmnElement="UpdateVolumeGroupHeatStackId"> + <dc:Bounds x="774" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index 408e378bcf..07d0b18938 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="DeleteVfModuleBB" name="Start" isExecutable="true"> <bpmn:startEvent id="DeleteVfModuleBB_Start" name="Start"> <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing> @@ -23,6 +23,8 @@ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" /> + <camunda:in source="VNFREST_Request" target="VNFREST_Request" /> + <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn index bd6b124175..212e735dd1 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn @@ -11,18 +11,13 @@ <bpmn:endEvent id="End_UnassignNetworkBB" name="end"> <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_GetL3NetworkById" /> + <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_VfModuleRelatioship" /> <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SNDCUnAssign" targetRef="End_UnassignNetworkBB" /> <bpmn:serviceTask id="Task_VfModuleRelatioship" name="Veriyf 'vf-module' relationship exists" camunda:expression="${UnassignNetworkBB.checkRelationshipRelatedTo(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), "vf-module")}"> - <bpmn:incoming>SequenceFlow_1gd5h4c</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mxe1a7</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0mxe1a7" sourceRef="Task_VfModuleRelatioship" targetRef="Task_GetCloudRegionVersion" /> - <bpmn:sequenceFlow id="SequenceFlow_1gd5h4c" sourceRef="Task_GetL3NetworkById" targetRef="Task_VfModuleRelatioship" /> - <bpmn:serviceTask id="Task_GetL3NetworkById" name="Get L3Network by networkId (AAI)" camunda:expression="${AAIQueryTasks.getNetworkWrapperById(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1gd5h4c</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0le4vrj" sourceRef="Task_GetCloudRegionVersion" targetRef="Task_SNDCUnAssign" /> <bpmn:serviceTask id="Task_GetCloudRegionVersion" name="Get Sdnc Cloud Region Version" camunda:expression="${UnassignNetworkBB.getCloudSdncRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_0mxe1a7</bpmn:incoming> @@ -32,9 +27,9 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignNetwork1802BB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_UnassignNetworkBB"> - <dc:Bounds x="145" y="119" width="36" height="36" /> + <dc:Bounds x="288" y="119" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="152" y="155" width="22" height="12" /> + <dc:Bounds x="295" y="155" width="22" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0m0ikey_di" bpmnElement="Task_SNDCUnAssign"> @@ -47,10 +42,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="181" y="137" /> - <di:waypoint xsi:type="dc:Point" x="232" y="137" /> + <di:waypoint xsi:type="dc:Point" x="324" y="137" /> + <di:waypoint xsi:type="dc:Point" x="375" y="137" /> <bpmndi:BPMNLabel> - <dc:Bounds x="207" y="122" width="0" height="0" /> + <dc:Bounds x="304.5" y="122" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt"> @@ -70,16 +65,6 @@ <dc:Bounds x="500" y="122" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1gd5h4c_di" bpmnElement="SequenceFlow_1gd5h4c"> - <di:waypoint xsi:type="dc:Point" x="332" y="137" /> - <di:waypoint xsi:type="dc:Point" x="375" y="137" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="354" y="122" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1scptd7_di" bpmnElement="Task_GetL3NetworkById"> - <dc:Bounds x="232" y="97" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0le4vrj_di" bpmnElement="SequenceFlow_0le4vrj"> <di:waypoint xsi:type="dc:Point" x="624" y="137" /> <di:waypoint xsi:type="dc:Point" x="665" y="137" /> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java index a3c6a820bd..a94a4bb89a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java @@ -42,6 +42,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ "QueryVfModule", "CreateVfModule", "VnfAdapter", + "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); @@ -54,7 +55,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf") - .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -65,7 +66,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule") - .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -76,18 +77,32 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule") - .hasNotPassed("VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @Test + public void rainyDayCreateVfModuleUpdateVfModuleHeatStackIdError_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId") + .hasNotPassed("UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + + } + + @Test public void rainyDayCreateVfModuleUpdateVfModuleStatusError_Test() throws Exception { mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusCreatedVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus") + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus") .hasNotPassed("CreateVfModuleBB_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java index 980e609e97..eb372fb6a7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java @@ -36,7 +36,7 @@ public class CreateVolumeGroupBBTest extends BaseBPMNTest{ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); assertThat(pi).isEnded(); assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter","UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); } @@ -46,7 +46,20 @@ public class CreateVolumeGroupBBTest extends BaseBPMNTest{ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks).createVolumeGroupRequest(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") + .hasNotPassed("UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVolumeGroupUpdateHeatStackIdError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter") + .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); assertThat(pi).isEnded(); assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") .hasNotPassed("Vnf_Adapter", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java index ad374e3304..2c5381de09 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java @@ -36,7 +36,7 @@ public class UnassignNetwork1802BBTest extends BaseBPMNTest { public void sunnyDayAssignNetwork_Test() throws InterruptedException { ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_GetL3NetworkById","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB"); assertThat(pi).isEnded(); } @@ -46,8 +46,8 @@ public class UnassignNetwork1802BBTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("Start_UnassignNetworkBB", "Task_GetL3NetworkById", "Task_VfModuleRelatioship") + .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship") .hasNotPassed("End_UnassignNetworkBB"); assertThat(pi).isEnded(); } -} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index aa7f118673..ab0ac25a99 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -20,6 +20,51 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <version>2.8</version> + <configuration> + <additionalProjectnatures> + <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature> + </additionalProjectnatures> + <sourceIncludes> + <sourceInclude>**/*.groovy</sourceInclude> + </sourceIncludes> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.5</version> + <dependencies> + <dependency> + <groupId>org.codehaus.gmaven.runtime</groupId> + <artifactId>gmaven-runtime-2.0</artifactId> + <version>1.5</version> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy</artifactId> + <version>${groovy.version}</version> + </dependency> + </dependencies> + <configuration> + <debug>false</debug> + <verbose>true</verbose> + <stacktrace>true</stacktrace> + <defaultScriptExtension>.groovy</defaultScriptExtension> + <providerSelection>2.0</providerSelection> + </configuration> + <executions> + <execution> + <goals> + <goal>testCompile</goal> + <goal>compile</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> <plugin> @@ -134,17 +179,17 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.1.11</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>com.h2database</groupId> @@ -189,7 +234,7 @@ <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> - <version>2.0</version> + <version>${jax.ws.rs}</version> </dependency> <dependency> <groupId>org.onap.so</groupId> @@ -265,5 +310,12 @@ <version>2.2.3</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>MSOCommonBPMN</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index 69e973d7c3..545cba7f8c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.infrastructure.scripts +package org.onap.so.bpmn.infrastructure.scripts import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.BpmnError @@ -162,8 +162,131 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { //here convert json string to xml string String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson))) // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String sdncTopologyActivateRequest = "" + + switch (modelName) { + case ~/^Site$/: + sdncTopologyActivateRequest = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <vnf-information> + <vnf-id></vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </vnf-information> + <vnf-input-parameters> + <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + </vnf-input-parameters> + <vnf-request-input> + <request-version></request-version> + <vnf-name></vnf-name> + <neutron-id></neutron-id> + <contrail-network-fqdn></contrail-network-fqdn> + <subnets-data> + <subnet-data> + <element> + <ip-version></ip-version> + <subnet-id></subnet-id> + </subnet-data> + </subnets-data> + </vnf-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + case ~/^SOTNAttachment$/: + sdncTopologyActivateRequest = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <allotted-resource-information> + <!-- TODO: to be filled as per the request input --> + <allotted-resource-input></allotted-resource-input> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id><parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + default: + sdncTopologyActivateRequest = + """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> @@ -196,6 +319,8 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> + <!-- TODO: to be filled by response from create --> + <network-id></network-id> <onap-model-information> <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> @@ -210,10 +335,12 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - msoLogger.debug(sndcTopologyCreateRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) - msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) + } + + String sdncTopologyActivateRequesAsString = utils.formatXml(sdncTopologyActivateRequest) + msoLogger.debug(sdncTopologyActivateRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyActivateRequesAsString) + msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyActivateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy index 880a44c1b2..880a44c1b2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index a2f4e35df1..f11022dc08 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -18,12 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.scripts; +package org.onap.so.bpmn.infrastructure.scripts import org.json.JSONObject -import org.json.XML; +import org.json.XML -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* import groovy.xml.XmlUtil import groovy.json.* import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.recipe.ResourceInput import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils @@ -39,13 +39,14 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.Abstr import org.onap.so.rest.APIResponse import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory -import java.util.UUID; +import java.util.UUID +import org.onap.so.logger.MsoLogger import org.camunda.bpm.engine.runtime.Execution import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.Base64 import org.springframework.web.util.UriUtils import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig @@ -56,24 +57,25 @@ import org.onap.so.rest.RESTConfig */ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRE3rdONAPESI_" + String Prefix = "CRE3rdONAPESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Create3rdONAPE2EServiceInstance.class) public void checkSPPartnerInfo (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started checkSPPartnerInfo *****", isDebugEnabled) + msoLogger.info(" ***** Started checkSPPartnerInfo *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) + msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) + msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) + msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String resourceInputPrameters = resourceInputObj.getResourceParameters() @@ -81,175 +83,172 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) // set local resourceInput - execution.setVariable(Prefix + "resourceInput", resourceInputObj) + execution.setVariable(Prefix + "ResourceInput", resourceInputObj) boolean is3rdONAPExist = false - if(inputParameters.has("id")) - { - String sppartnerId = inputParameters.get("id") - } if(inputParameters.has("url")) { String sppartnerUrl = inputParameters.get("url") if(!isBlank(sppartnerUrl)) { - execution.setVariable(Prefix + "sppartnerUrl", sppartnerUrl) + execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) is3rdONAPExist = true } else { is3rdONAPExist = false String msg = "sppartner Url is blank." - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) } } if(inputParameters.has("providingServiceInvarianteUuid")) { String sppartnerInvarianteUUID = inputParameters.get("providingServiceInvarianteUuid") - execution.setVariable(Prefix + "sppartnerInvarianteUUID", sppartnerInvarianteUUID) + execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID) is3rdONAPExist = true } else { is3rdONAPExist = false String msg = "sppartner providingServiceInvarianteUuid is blank." - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) } if(inputParameters.has("providingServiceUuid")) { String sppartnerUUID = inputParameters.get("providingServiceUuid") - execution.setVariable(Prefix + "sppartnerUUID", sppartnerUUID) + execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID) is3rdONAPExist = true } else { is3rdONAPExist = false String msg = "sppartner providingServiceUuid is blank." - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) } if(inputParameters.has("handoverMode")) { String handoverMode = inputParameters.get("handoverMode") - execution.setVariable(Prefix + "handoverMode", handoverMode) + execution.setVariable(Prefix + "HandoverMode", handoverMode) is3rdONAPExist = true } else { is3rdONAPExist = false String msg = "sppartner handoverMode is blank." - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) } execution.setVariable("Is3rdONAPExist", is3rdONAPExist) - execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) } catch (BpmnError e) { - throw e; + throw e } catch (Exception ex){ String msg = "Exception in checkSPPartnerInfo " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void checkLocallCall (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started checkLocallCall *****", isDebugEnabled) + msoLogger.info(" ***** Started checkLocallCall *****") try { //Get ResourceInput Object - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") //uuiRequest String incomingRequest = resourceInputObj.getRequestsInputs() String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - JSONObject inputParameters = new JSONObject(customizeResourceParam(serviceParameters)) - execution.setVariable(Prefix + "serviceParameters", inputParameters) + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(customizeResourceParam(requestInputs)) + execution.setVariable(Prefix + "ServiceParameters", inputParameters) - // CallSource is added only when ONAP SO calling 3rdONAP SO(Remote call) + // CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call) boolean isLocalCall = true + String callSource = "UUI" if(inputParameters.has("CallSource")) { - String callSource = inputParameters.get("CallSource") - if("3rdONAP".equalsIgnoreCase(callSource)) { + callSource = inputParameters.get("CallSource") + if("ExternalAPI".equalsIgnoreCase(callSource)) { + String sppartnerId = inputParameters.get("SppartnerServiceId") + execution.setVariable(Prefix + "SppartnerServiceId", sppartnerId) isLocalCall = false - } - execution.setVariable(Prefix + "CallSource", callSource) - utils.log("DEBUG", "callSource is: " + callSource , isDebugEnabled) - isLocalCall = true + } } + execution.setVariable(Prefix + "CallSource", callSource) + msoLogger.debug("callSource is: " + callSource ) execution.setVariable("IsLocalCall", isLocalCall) - } catch (BpmnError e) { - throw e; } catch (Exception ex){ String msg = "Exception in checkLocallCall " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void preProcessRequest(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + msoLogger.info(" ***** Started preProcessRequest *****") try { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String msg = "" String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } //set local variable - execution.setVariable("globalSubscriberId", globalSubscriberId); - utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled) + execution.setVariable("globalSubscriberId", globalSubscriberId) + msoLogger.info("globalSubscriberId:" + globalSubscriberId) String serviceType = resourceInputObj.getServiceType() if (isBlank(serviceType)) { msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("serviceType", serviceType) - utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled) + msoLogger.info("serviceType:" + serviceType) - String resourceName = resourceInputObj.getResourceInstanceName(); + String resourceName = resourceInputObj.getResourceInstanceName() if (isBlank(resourceName)) { msg = "Input resourceName is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("resourceName", resourceName) - utils.log("INFO", "resourceName:" + resourceName, isDebugEnabled) + msoLogger.info("resourceName:" + resourceName) int beginIndex = resourceName.indexOf("_") + 1 String serviceInstanceName = resourceName.substring(beginIndex) execution.setVariable("serviceInstanceName", serviceInstanceName) - String serviceInstanceId = resourceInputObj.getServiceInstanceId(); + String serviceInstanceId = resourceInputObj.getServiceInstanceId() if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId is null" - utils.log("INFO", msg, isDebugEnabled) + msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - execution.setVariable("serviceInstanceId", serviceInstanceId) - utils.log("INFO", "serviceInstanceId:" + serviceInstanceId, isDebugEnabled) + execution.setVariable(Prefix + "ServiceInstanceId", serviceInstanceId) + msoLogger.info("serviceInstanceId:" + serviceInstanceId) } catch (BpmnError e) { - throw e; + throw e } catch (Exception ex){ String msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateProgress(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepareUpdateProgress *****", isDebugEnabled) - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + msoLogger.info(" ***** Started prepareUpdateProgress *****") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String ServiceInstanceId = resourceInputObj.getServiceInstanceId() @@ -274,51 +273,62 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso <statusDescription>${statusDescription}</statusDescription> </ns:updateResourceOperationStatus> </soapenv:Body> - </soapenv:Envelope>"""; + </soapenv:Envelope>""" setProgressUpdateVariables(execution, body) - utils.log("INFO"," ***** End prepareUpdateProgress *****", isDebugEnabled) + msoLogger.info(" ***** Exit prepareUpdateProgress *****") } public void allocateCrossONAPResource(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started allocateCrossONAPResource *****", isDebugEnabled) + msoLogger.info(" ***** Started allocateCrossONAPResource *****") //get TP links from AAI for SOTN handoverMode only - String handoverMode = execution.getVariable(Prefix + "handoverMode") + String handoverMode = execution.getVariable(Prefix + "HandoverMode") if("SOTN".equalsIgnoreCase(handoverMode)) { - //to do get tp link in AAI - - // Put TP Link info into serviceParameters - String accessProviderId = "" - String accessClientId = "" - String accessTopologyId = "" - String accessNodeId = "" - String accessLtpId = "" - JSONObject inputParameters = execution.getVariable(Prefix + "serviceParameters") - inputParameters.put("access-provider-id", accessProviderId) - inputParameters.put("access-client-id", accessClientId) - inputParameters.put("access-topology-id", accessTopologyId) - inputParameters.put("access-node-id", accessNodeId) - inputParameters.put("access-ltp-id", accessLtpId) - execution.setVariable(Prefix + "serviceParameters", inputParameters) + JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") + + Map<String, Object> crossTPs = new HashMap<String, Object>(); + crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")); + crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")); + crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")); + crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")); + crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")); + crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")); + crossTPs.put("remote-access-client-id", inputParameters.get("local-client-id")); + crossTPs.put("remote-access-topology-id", inputParameters.get("local-topology-id")); + crossTPs.put("remote-access-node-id", inputParameters.get("local-node-id")); + crossTPs.put("remote-access-ltp-id", inputParameters.get("local-ltp-id")); + + inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); + inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); + inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); + inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")); + inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); + inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); + inputParameters.put("remote-access-client-id", crossTPs.get("remote-client-id")); + inputParameters.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); + inputParameters.put("remote-access-node-id", crossTPs.get("remote-node-id")); + inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); + + execution.setVariable(Prefix + "ServiceParameters", inputParameters) } - utils.log("INFO", "Exited " + allocateCrossONAPResource, isDebugEnabled) + msoLogger.info("Exit " + allocateCrossONAPResource) } public void prepare3rdONAPRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started prepare3rdONAPRequest *****", isDebugEnabled) + msoLogger.info(" ***** Started prepare3rdONAPRequest *****") - String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl") + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String extAPIPath = sppartnerUrl + 'serviceOrder' execution.setVariable("ExternalAPIURL", extAPIPath) // ExternalAPI message format String externalId = execution.getVariable("resourceName") - String category = "Network Service" + String category = "E2E Service" String description = "Service Order from SPPartner" String requestedStartDate = utils.generateCurrentTimeInUtc() String requestedCompletionDate = utils.generateCurrentTimeInUtc() @@ -326,12 +336,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String subscriberId = execution.getVariable("globalSubscriberId") String customerRole = "" String subscriberName = "" - String referredType = execution.getVariable("serviceType") + String referredType = "Consumer" String orderItemId = "1" String action = "add" //for create String serviceState = "active" String serviceName = execution.getVariable("serviceInstanceName") - String serviceId = execution.getVariable("serviceInstanceId") + String serviceUuId = execution.setVariable(Prefix + "SppartnerUUID") Map<String, String> valueMap = new HashMap<>() valueMap.put("externalId", '"' + externalId + '"') @@ -347,23 +357,36 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("orderItemId", '"' + orderItemId + '"') valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') + valueMap.put("serviceId", '""')//To be confirmed valueMap.put("serviceName", '"' + serviceName + '"') - valueMap.put("serviceId", '"' + serviceId + '"') + valueMap.put("serviceUuId", '"' + serviceUuId + '"') ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) - // insert CallSource='3rdONAP' to uuiRequest - Map<String, String> callSourceMap = new HashMap<>() - callSourceMap.put("inputName", "CallSource") - callSourceMap.put("inputValue", "3rdONAP") - String _requestInputs_ = externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, callSourceMap) + // insert CallSource='ExternalAPI' to uuiRequest + Map<String, String> requestInputsMap = new HashMap<>() + requestInputsMap.put("inputName", "CallSource") + requestInputsMap.put("inputValue", "ExternalAPI") + String _requestInputs_ = externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) + + requestInputsMap.clear() + String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") + requestInputsMap.put("inputName", "SppartnerServiceId") + requestInputsMap.put("inputValue", serviceInstanceId) + _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) + + requestInputsMap.clear() + String serviceType = execution.getVariable("serviceType") + requestInputsMap.put("inputName", "serviceType") + requestInputsMap.put("inputValue", serviceType) + _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) // Transfer all uuiRequest incomeParameters to ExternalAPI format - JSONObject inputParameters = execution.getVariable(Prefix + "serviceParameters") + JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") for(String key : inputParameters.keySet()) { - String inputName = key; - String inputValue = inputParameters.opt(key); - Map<String, String> requestInputsMap = new HashMap<>() + String inputName = key + String inputValue = inputParameters.opt(key) + requestInputsMap.clear() requestInputsMap.put("inputName", '"' + inputName+ '"') requestInputsMap.put("inputValue", '"' + inputValue + '"') _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) @@ -371,49 +394,49 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("_requestInputs_", _requestInputs_) String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) - execution.setVariable(Prefix + "payload", payload) - utils.log("INFO", "Exited " + prepare3rdONAPRequest, isDebugEnabled) + execution.setVariable(Prefix + "Payload", payload) + msoLogger.info("Exit " + prepare3rdONAPRequest) } public void doCreateE2ESIin3rdONAP(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started doCreateE2ESIin3rdONAP *****", isDebugEnabled) + msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****") String extAPIPath = execution.getVariable("ExternalAPIURL") - String payload = execution.getVariable(Prefix + "payload") + String payload = execution.getVariable(Prefix + "Payload") ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode) - utils.log("DEBUG", "Post ServiceOrder response code is: " + responseCode, isDebugEnabled) + execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode) + msoLogger.debug("Post ServiceOrder response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse) + execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse) //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - utils.log("DEBUG", "Post ServiceOrder Received a Good Response", isDebugEnabled) + msoLogger.debug("Post ServiceOrder Received a Good Response") String serviceOrderId = responseObj.get("ServiceOrderId") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable("serviceOrderId", serviceOrderId) } else{ - utils.log("DEBUG", "Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") } - utils.log("INFO", "Exited " + doCreateE2ESIin3rdONAP, isDebugEnabled) + msoLogger.info("Exit " + doCreateE2ESIin3rdONAP) } public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started getE2ESIProgressin3rdONAP *****", isDebugEnabled) + msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") String extAPIPath = execution.getVariable("ExternalAPIURL") extAPIPath += "/" + execution.getVariable("ServiceOrderId") @@ -423,18 +446,22 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode) - utils.log("DEBUG", "Get ServiceOrder response code is: " + responseCode, isDebugEnabled) + execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode) + msoLogger.debug("Get ServiceOrder response code is: " + responseCode) String extApiResponse = response.getResponseBodyAsString() JSONObject responseObj = new JSONObject(extApiResponse) - execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse) + execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse) //Process Response //200 OK 201 CREATED 202 ACCEPTED if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { - utils.log("DEBUG", "Get ServiceOrder Received a Good Response", isDebugEnabled) - String serviceOrderState = responseObj.get("State") + msoLogger.debug("Get ServiceOrder Received a Good Response") + + String sppartnerServiceId = responseObj.get("orderIterm.service.id") + execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId) + + String serviceOrderState = responseObj.get("orderIterm.state") execution.setVariable(Prefix + "SuccessIndicator", true) execution.setVariable("serviceOrderState", serviceOrderState) @@ -463,14 +490,14 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso execution.setVariable("statusDescription", "Create Service Order Status is " + serviceOrderState) } else{ - utils.log("DEBUG", "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) execution.setVariable("progress", 100) execution.setVariable("status", "error") execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response") exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API") } - utils.log("INFO", "Exited " + getE2ESIProgressin3rdONAP, isDebugEnabled) + msoLogger.info("Exit " + getE2ESIProgressin3rdONAP) } /** @@ -479,19 +506,22 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void timeDelay(DelegateExecution execution) { def isDebugEnabled= execution.getVariable("isDebugLogEnabled") try { - Thread.sleep(5000); + Thread.sleep(5000) } catch(InterruptedException e) { - utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled) + utils.log("ERROR", "Time Delay exception" + e ) } } public void saveSPPartnerInAAI(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started postCreateE2ESIin3rdONAP *****", isDebugEnabled) + msoLogger.info(" ***** Started postCreateE2ESIin3rdONAP *****") - String sppartnerId = UUID.randomUUID().toString() - String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl") - String serviceInstanceId = execution.getVariable("serviceInstanceId") + String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId") + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") + String callSource = execution.getVariable(Prefix + "CallSource") + String serviceInstanceId = execution.getVariable(Prefix + "ServiceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) @@ -501,10 +531,18 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso """<sp-partner xmlns=\"${namespace}\"> <id>${sppartnerId}</id> <url>${sppartnerUrl}</url> - <service-instance> - <service-instance-id>${serviceInstanceId}</service-instance-id> - </service-instance> - </sp-partner>""".trim() + <callsource>${callSource}</callsource> + <relationship-list> + <relationship> + <related-to>service-instance</related-to> + <related-link>/aai/v14/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}</related-link> + <relationship-data> + <relationship-key>service-instance.service-instance-id</relationship-key> + <relationship-value>${serviceInstanceId}</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </sp-partner>""".trim() utils.logAudit(payload) String aai_endpoint = execution.getVariable("URN_aai_endpoint") @@ -512,28 +550,28 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) int responseCode = response.getStatusCode() - execution.setVariable(Prefix + "putSppartnerResponseCode", responseCode) - utils.log("DEBUG", " Put sppartner response code is: " + responseCode, isDebugEnabled) + execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode) + msoLogger.debug(" Put sppartner response code is: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) - execution.setVariable(Prefix + "putSppartnerResponse", aaiResponse) + execution.setVariable(Prefix + "PutSppartnerResponse", aaiResponse) //Process Response if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) //200 OK 201 CREATED 202 ACCEPTED { - utils.log("DEBUG", "PUT sppartner Received a Good Response", isDebugEnabled) + msoLogger.debug("PUT sppartner Received a Good Response") execution.setVariable(Prefix + "SuccessIndicator", true) } else { - utils.log("DEBUG", "Put sppartner Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + msoLogger.debug("Put sppartner Received a Bad Response Code. Response Code is: " + responseCode) exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) throw new BpmnError("MSOWorkflowException") } - utils.log("INFO", "Exited " + saveSPPartnerInAAI, isDebugEnabled) + msoLogger.info("Exit " + saveSPPartnerInAAI) } private void setProgressUpdateVariables(DelegateExecution execution, String body) { @@ -544,48 +582,48 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso public void postProcess(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** Started postProcess *****", isDebugEnabled) - String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode") - String responseObj = execution.getVariable(Prefix + "putSppartnerResponse") + msoLogger.info(" ***** Started postProcess *****") + String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode") + String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse") - utils.log("INFO","response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) - utils.log("INFO"," ***** Exit postProcess *****", isDebugEnabled) + msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) + msoLogger.info(" ***** Exit postProcess *****") } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + msoLogger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + msoLogger.debug(" ***** Exit sendSyncResopnse *****") } String customizeResourceParam(String inputParametersJson) { - List<Map<String, Object>> paramList = new ArrayList(); - JSONObject jsonObject = new JSONObject(inputParametersJson); - Iterator iterator = jsonObject.keys(); + List<Map<String, Object>> paramList = new ArrayList() + JSONObject jsonObject = new JSONObject(inputParametersJson) + Iterator iterator = jsonObject.keys() while (iterator.hasNext()) { - String key = iterator.next(); - HashMap<String, String> hashMap = new HashMap(); - hashMap.put("name", key); + String key = iterator.next() + HashMap<String, String> hashMap = new HashMap() + hashMap.put("name", key) hashMap.put("value", jsonObject.get(key)) paramList.add(hashMap) } - Map<String, List<Map<String, Object>>> paramMap = new HashMap(); - paramMap.put("param", paramList); + Map<String, List<Map<String, Object>>> paramMap = new HashMap() + paramMap.put("param", paramList) - return new JSONObject(paramMap).toString(); + return new JSONObject(paramMap).toString() } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 1034fa2d4d..1034fa2d4d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy new file mode 100644 index 0000000000..15b63fb5ab --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy @@ -0,0 +1,194 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.json.JSONObject +import org.json.XML; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.rest.APIResponse; +import org.onap.so.bpmn.common.scripts.AaiUtil + +/** + * This groovy class supports the <class>CreateDeviceResource.bpmn</class> process. + * flow for Device Resource Create + */ +public class CreateDeviceResource extends AbstractServiceTaskProcessor { + + String Prefix="CREDEVRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateDeviceResource.class) + + public void preProcessRequest(DelegateExecution execution){ + msoLogger.info(" ***** Started preProcessRequest *****") + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + msoLogger.info("The requestAction is: " + requestAction) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + String resourceInput = execution.getVariable("resourceInput") + msoLogger.info("The resourceInput is: " + resourceInput) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) + execution.setVariable(Prefix + "resourceRequestInputs", inputParameters) + + //Deal with recipeParams + String recipeParamsFromWf = execution.getVariable("recipeParamXsd") + String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "createNetworkInstance" + String operationType = "Network" + if(!StringUtils.isBlank(recipeParamsFromRequest)){ + //the operationType from worflow(first node) is second priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + } + if(!StringUtils.isBlank(recipeParamsFromWf)){ + //the operationType from worflow(first node) is highest priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + } + + execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + String customizeResourceParam(String networkInputParametersJson) { + List<Map<String, Object>> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(networkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap<String, String> hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map<String, List<Map<String, Object>>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + + public void checkDevType(DelegateExecution execution){ + msoLogger.info(" ***** Started checkDevType *****") + try { + + JSONObject inputParameters = execution.getVariable(Prefix + "resourceRequestInputs") + + String devType = inputParameters.get("device_class") + + if(StringUtils.isBlank(devType)) { + devType = "OTHER" + } + + execution.setVariable("device_class", devType) + + } catch (Exception ex){ + String msg = "Exception in checkDevType " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void getVNFTemplatefromSDC(DelegateExecution execution){ + msoLogger.info(" ***** Started getVNFTemplatefromSDC *****") + try { + // To do + + + } catch (Exception ex){ + String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void postVNFInfoProcess(DelegateExecution execution){ + msoLogger.info(" ***** Started postVNFInfoProcess *****") + try { + // To do + + + } catch (Exception ex){ + String msg = "Exception in postVNFInfoProcess " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void sendSyncResponse (DelegateExecution execution) { + msoLogger.debug(" *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 4405718c57..4405718c57 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy index d665de2ba7..d665de2ba7 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index cc0f9bb5f4..c819da4be4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -163,8 +163,130 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //here convert json string to xml string String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson))) // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String sdncTopologyCreateRequest = "" + + switch (modelName) { + case ~/^Site$/: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + <vnf-information> + <!-- TODO: to be filled as per the request input --> + <vnf-id></vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </network-information> + <vnf-input-parameters> + <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters> + </vnf-input-parameters> + <vnf-request-input> + <request-version></request-version> + <vnf-name></vnf-name> + <neutron-id></neutron-id> + <contrail-network-fqdn></contrail-network-fqdn> + <subnets-data> + <subnet-data> + <element> + <ip-version></ip-version> + <subnet-id></subnet-id> + </subnet-data> + </subnets-data> + </vnf-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + case ~/^SOTNAttachment$/: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + </service-information> + <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name> + <allotted-resource-information> + <!-- TODO: to be filled as per the request input --> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id><parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + default: + sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> @@ -210,8 +332,9 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) msoLogger.debug(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 26f12831bd..26f12831bd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index 308c93540f..6acabe14a0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -36,7 +36,9 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.aai.AAICreateResources; import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - +import org.w3c.dom.* +import javax.xml.parsers.* +import org.xml.sax.InputSource import groovy.json.JsonOutput import groovy.json.JsonSlurper diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index aa569655f4..aa569655f4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index 9c25a57adc..9c25a57adc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index 31bda63a49..a63aad14a2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -18,20 +18,20 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.infrastructure.scripts +package org.onap.so.bpmn.infrastructure.scripts import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.BpmnError import org.json.JSONObject import org.json.XML import org.onap.so.logger.MsoLogger -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.camunda.bpm.engine.delegate.DelegateExecution -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils /** * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process. @@ -128,8 +128,136 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String sdncTopologyDeleteRequest = "" + + switch (modelName) { + case ~/^Site$/: + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name></subscriber-name> + </service-information> + <vnf-information> + <!-- TODO: to be filled as per the request input --> + <vnf-id></vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </network-information> + <vnf-request-input> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + <vnf-network> + <network-role></network-role> + <network-name></network-name> + <neutron-id></neutron-id> + <network-id></network-id> + <contrail-network-fqdn></contrail-network-fqdn> + <subnets-data> + <subnet-data> + <ip-version></ip-version> + <subnet-id></subnet-id> + </subnet-data> + </subnets-data> + </vnf-network> + </vnf-networks> + </vnf-request-input> + <vnf-input-parameters> + <param></param> + </vnf-input-parameters> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + case ~/^SOTNAttachment$/: + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name></subscriber-name> + </service-information> + <allotted-resource-information> + <!-- TODO: to be filled as per the request input --> + <allotted-resource-id></allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id></parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + <param></param> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + default: + sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> @@ -175,8 +303,9 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() + } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) utils.logAudit(sndcTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy new file mode 100644 index 0000000000..63fd20eb2d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -0,0 +1,542 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.json.JSONObject +import org.json.XML + +import static org.apache.commons.lang3.StringUtils.* +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.ExternalAPIUtil +import org.onap.so.bpmn.common.scripts.AaiUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory +import java.util.UUID +import org.onap.so.logger.MsoLogger + +import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64 +import org.springframework.web.util.UriUtils +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig + +/** + * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process. + * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP + */ +public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix = "CRE3rdONAPESI_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Delete3rdONAPE2EServiceInstance.class) + + public void checkSPPartnerInfoFromAAI (DelegateExecution execution) { + msoLogger.info(" ***** Started checkSPPartnerInfo *****") + try { + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + msoLogger.info("The requestAction is: " + requestAction) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + String resourceInput = execution.getVariable("resourceInput") + msoLogger.info("The resourceInput is: " + resourceInput) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + // set local resourceInput + execution.setVariable(Prefix + "ResourceInput", resourceInputObj) + + String resourceInstanceId = resourceInputObj.getResourceInstancenUuid() + + // Get Sppartner from AAI + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8") + execution.setVariable(Prefix + "serviceAaiPath", serviceAaiPath) + + getSPPartnerInAAI(execution) + + String callSource = "UUI" + String sppartnerUrl = "" + if(execution.getVariable(Prefix + "SuccessIndicator")) { + callSource = execution.getVariable(Prefix + "CallSource") + } + + boolean is3rdONAPExist = false + if(!isBlank(sppartnerUrl)) { + is3rdONAPExist = true + } + + execution.setVariable("Is3rdONAPExist", is3rdONAPExist) + execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) + + } catch (BpmnError e) { + throw e + } catch (Exception ex){ + String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void checkLocallCall (DelegateExecution execution) { + msoLogger.info(" ***** Started checkLocallCall *****") + + boolean isLocalCall = true + String callSource = execution.getVariable(Prefix + "CallSource") + if("ExternalAPI".equalsIgnoreCase(callSource)) { + isLocalCall = false + } + execution.setVariable("IsLocalCall", isLocalCall) + } + + public void preProcessRequest(DelegateExecution execution){ + msoLogger.info(" ***** Started preProcessRequest *****") + try { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String msg = "" + + String globalSubscriberId = resourceInputObj.getGlobalSubscriberId() + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + msoLogger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + //set local variable + execution.setVariable("globalSubscriberId", globalSubscriberId) + msoLogger.info( "globalSubscriberId:" + globalSubscriberId) + + String serviceType = resourceInputObj.getServiceType() + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + msoLogger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("serviceType", serviceType) + msoLogger.info( "serviceType:" + serviceType) + + String operationId = resourceInputObj.getOperationId() + if (isBlank(operationId)) { + msg = "Input operationId is null" + msoLogger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("operationId", operationId) + msoLogger.info( "operationId:" + operationId) + + String resourceName = resourceInputObj.getResourceInstanceName() + if (isBlank(resourceName)) { + msg = "Input resourceName is null" + msoLogger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("resourceName", resourceName) + msoLogger.info( "resourceInstanceId:" + resourceName) + + String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + if (isBlank(resourceTemplateId)) { + msg = "Input resourceTemplateId is null" + msoLogger.info( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("resourceTemplateId", resourceTemplateId) + msoLogger.info( "resourceTemplateId:" + resourceTemplateId) + + } catch (BpmnError e) { + throw e + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void prepareUpdateProgress(DelegateExecution execution) { + msoLogger.info(" ***** Started prepareUpdateProgress *****") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput") + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String ServiceInstanceId = resourceInputObj.getServiceInstanceId() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String operationId = resourceInputObj.getOperationId() + String progress = execution.getVariable("progress") + String status = execution.getVariable("status") + String statusDescription = execution.getVariable("statusDescription") + + String body = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateResourceOperationStatus> + <operType>${operType}</operType> + <operationId>${operationId}</operationId> + <progress>${progress}</progress> + <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID> + <serviceId>${ServiceInstanceId}</serviceId> + <status>${status}</status> + <statusDescription>${statusDescription}</statusDescription> + </ns:updateResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + setProgressUpdateVariables(execution, body) + msoLogger.info(" ***** End prepareUpdateProgress *****") + } + + public void prepare3rdONAPRequest(DelegateExecution execution) { + msoLogger.info(" ***** Started prepare3rdONAPRequest *****") + + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") + String extAPIPath = sppartnerUrl + 'serviceOrder' + execution.setVariable("ExternalAPIURL", extAPIPath) + + // ExternalAPI message format + String externalId = execution.getVariable("resourceName") + String category = "E2E Service" + String description = "Service Order from SPPartner" + String requestedStartDate = utils.generateCurrentTimeInUtc() + String requestedCompletionDate = utils.generateCurrentTimeInUtc() + String priority = "1" // 0-4 0:highest + String subscriberId = execution.getVariable("globalSubscriberId") + String customerRole = "" + String subscriberName = "" + String referredType = "Consumer" + String orderItemId = "1" + String action = "delete" //for delete + String serviceState = "active" + String serviceName = "" + String serviceType = execution.getVariable("serviceType") + String serviceId = execution.getVariable(Prefix + "SppartnerId") + + queryServicefrom3rdONAP(execution) + String serviceUuId = execution.getVariable(Prefix + "serviceSpecificationId") + + Map<String, String> valueMap = new HashMap<>() + valueMap.put("externalId", '"' + externalId + '"') + valueMap.put("category", '"' + category + '"') + valueMap.put("description", '"' + description + '"') + valueMap.put("requestedStartDate", '"' + requestedStartDate + '"') + valueMap.put("requestedCompletionDate", '"' + requestedCompletionDate + '"') + valueMap.put("priority", '"'+ priority + '"') + valueMap.put("subscriberId", '"' + subscriberId + '"') + valueMap.put("customerRole", '"' + customerRole + '"') + valueMap.put("subscriberName", '"' + subscriberName + '"') + valueMap.put("referredType", '"' + referredType + '"') + valueMap.put("orderItemId", '"' + orderItemId + '"') + valueMap.put("action", '"' + action + '"') + valueMap.put("serviceState", '"' + serviceState + '"') + valueMap.put("serviceId", '"' + serviceId + '"') + valueMap.put("serviceName", '"' + serviceName + '"') + valueMap.put("serviceType", '"' + serviceType + '"') + valueMap.put("serviceUuId", '"' + serviceUuId + '"') + + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + + valueMap.put("_requestInputs_", "") + + String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap) + execution.setVariable(Prefix + "Payload", payload) + msoLogger.info( "Exit " + prepare3rdONAPRequest) + } + + private void queryServicefrom3rdONAP(DelegateExecution execution) + { + msoLogger.info(" ***** Started queryServicefrom3rdONAP *****") + + //https://{api_url}/nbi/api/v1/service/{serviceinstanceid} + String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") + String extAPIPath = sppartnerUrl + "service/" + execution.setVariable(Prefix + "SppartnerId") + + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + + APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "getServiceResponseCode", responseCode) + utils.log("DEBUG", "Get Service response code is: " + responseCode) + + String extApiResponse = response.getResponseBodyAsString() + JSONObject responseObj = new JSONObject(extApiResponse) + execution.setVariable(Prefix + "getServiceResponse", extApiResponse) + + //Process Response //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + utils.log("DEBUG", "Get Service Received a Good Response") + String serviceUuid = responseObj.get("serviceSpecification.id") + execution.setVariable(Prefix + "serviceSpecificationId", serviceUuid) + } + else{ + utils.log("DEBUG", "Get Service Received a Bad Response Code. Response Code is: " + responseCode) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API") + } + + msoLogger.info( "Exit " + queryServicefrom3rdONAP) + } + + public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) { + msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****") + + String extAPIPath = execution.getVariable("ExternalAPIURL") + String payload = execution.getVariable(Prefix + "Payload") + + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + + APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) + + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode) + msoLogger.debug("Post ServiceOrder response code is: " + responseCode) + + String extApiResponse = response.getResponseBodyAsString() + JSONObject responseObj = new JSONObject(extApiResponse) + execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse) + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("Post ServiceOrder Received a Good Response") + String serviceOrderId = responseObj.get("ServiceOrderId") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable("serviceOrderId", serviceOrderId) + } + else{ + msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API") + } + + msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP) + } + + + public void getE2ESIProgressin3rdONAP(DelegateExecution execution) { + msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****") + + String extAPIPath = execution.getVariable("ExternalAPIURL") + extAPIPath += "/" + execution.getVariable("ServiceOrderId") + + ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) + + APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode) + msoLogger.debug("Get ServiceOrder response code is: " + responseCode) + + String extApiResponse = response.getResponseBodyAsString() + JSONObject responseObj = new JSONObject(extApiResponse) + execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse) + + //Process Response //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + msoLogger.debug("Get ServiceOrder Received a Good Response") + String serviceOrderState = responseObj.get("State") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable("serviceOrderState", serviceOrderState) + + // Get serviceOrder State and process progress + if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { + execution.setVariable("progress", 15) + execution.setVariable("status", "processing") + } + if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { + execution.setVariable("progress", 40) + execution.setVariable("status", "processing") + } + if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { + execution.setVariable("progress", 100) + execution.setVariable("status", "finished") + } + if("FAILED".equalsIgnoreCase(serviceOrderState)) { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + } + else { + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Delete Service Order Status is unknown") + } + execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState) + } + else{ + msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode) + execution.setVariable("progress", 100) + execution.setVariable("status", "error") + execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API") + } + + msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP) + } + + /** + * delay 5 sec + */ + public void timeDelay(DelegateExecution execution) { + try { + Thread.sleep(5000) + } catch(InterruptedException e) { + utils.log("ERROR", "Time Delay exception" + e ) + } + } + + private void getSPPartnerInAAI(DelegateExecution execution) { + msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode) + msoLogger.debug(" Get sppartner response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + aaiResponse = aaiResponse.replaceAll("&", "&") + execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("GET sppartner Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + execution.setVariable(Prefix + "FoundIndicator", true) + + String sppartnerId = utils.getNodeText1(aaiResponse, "sppartner-id") + execution.setVariable(Prefix + "SppartnerId", sppartnerId) + msoLogger.debug(" SppartnerId is: " + sppartnerId) + String sppartnerUrl = utils.getNodeText1(aaiResponse, "sppartner-url") + execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) + msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl) + String callSource = utils.getNodeText1(aaiResponse, "sppartner-callsource") + execution.setVariable(Prefix + "CallSource", callSource) + msoLogger.debug(" CallSource is: " + callSource) + String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version") + execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion) + msoLogger.debug(" Resource Version is: " + sppartnerVersion) + } + else + { + msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + + msoLogger.info( "Exit " + deleteSPPartnerInAAI) + } + + public void deleteSPPartnerInAAI(DelegateExecution execution) { + msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****") + + String sppartnerId = execution.getVariable(Prefix + "SppartnerId") + String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl") + String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "?resource-version=${sppartnerVersion}" + APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) + int responseCode = response.getStatusCode() + execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode) + msoLogger.debug(" Get sppartner response code is: " + responseCode) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + msoLogger.debug("Delete sppartner Received a Good Response") + execution.setVariable(Prefix + "SuccessIndicator", true) + } + else if(responseCode == 404){ + msoLogger.debug(" Delete sppartner Received a Not Found (404) Response") + execution.setVariable(Prefix + "FoundIndicator", false) + } + else + { + msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + + msoLogger.info( "Exit " + deleteSPPartnerInAAI) + } + + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + public void postProcess(DelegateExecution execution){ + msoLogger.info(" ***** Started postProcess *****") + String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode") + String responseObj = execution.getVariable(Prefix + "putSppartnerResponse") + + msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj) + msoLogger.info(" ***** Exit postProcess *****") + } + + public void sendSyncResponse (DelegateExecution execution) { + msoLogger.debug(" *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index cbbc5189f4..cbbc5189f4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy new file mode 100644 index 0000000000..5a21fd7396 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -0,0 +1,194 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.json.JSONObject +import org.json.XML; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.logger.MsoLogger +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils +import org.onap.so.rest.RESTClient +import org.onap.so.rest.RESTConfig +import org.onap.so.rest.APIResponse; +import org.onap.so.bpmn.common.scripts.AaiUtil + +/** + * This groovy class supports the <class>CreateDeviceResource.bpmn</class> process. + * flow for Device Resource Create + */ +public class DeleteDeviceResource extends AbstractServiceTaskProcessor { + + String Prefix="DELDEVRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteDeviceResource.class) + + public void preProcessRequest(DelegateExecution execution){ + msoLogger.info(" ***** Started preProcessRequest *****") + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("mso-request-id") + String requestAction = execution.getVariable("requestAction") + msoLogger.info("The requestAction is: " + requestAction) + String recipeParamsFromRequest = execution.getVariable("recipeParams") + msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) + String resourceInput = execution.getVariable("resourceInput") + msoLogger.info("The resourceInput is: " + resourceInput) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + String resourceInputPrameters = resourceInputObj.getResourceParameters() + String inputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs") + JSONObject inputParameters = new JSONObject(customizeResourceParam(inputParametersJson)) + execution.setVariable(Prefix + "resourceRequestInputs", inputParameters) + + //Deal with recipeParams + String recipeParamsFromWf = execution.getVariable("recipeParamXsd") + String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "createNetworkInstance" + String operationType = "Network" + if(!StringUtils.isBlank(recipeParamsFromRequest)){ + //the operationType from worflow(first node) is second priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") + } + if(!StringUtils.isBlank(recipeParamsFromWf)){ + //the operationType from worflow(first node) is highest priority. + operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") + } + + execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) + execution.setVariable("mso-request-id", requestId) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + String customizeResourceParam(String networkInputParametersJson) { + List<Map<String, Object>> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(networkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap<String, String> hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map<String, List<Map<String, Object>>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + + public void checkDevType(DelegateExecution execution){ + utils.log("INFO"," ***** Started checkDevType *****") + try { + + JSONObject inputParameters = execution.getVariable(Prefix + "resourceRequestInputs") + + String devType = inputParameters.get("device_class") + + if(StringUtils.isBlank(devType)) { + devType = "OTHER" + } + + execution.setVariable("device_class", devType) + + } catch (Exception ex){ + String msg = "Exception in checkDevType " + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void getVNFTemplatefromSDC(DelegateExecution execution){ + utils.log("INFO"," ***** Started getVNFTemplatefromSDC *****") + try { + // To do + + + } catch (Exception ex){ + String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void postVNFInfoProcess(DelegateExecution execution){ + utils.log("INFO"," ***** Started postVNFInfoProcess *****") + try { + // To do + + + } catch (Exception ex){ + String msg = "Exception in postVNFInfoProcess " + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void sendSyncResponse (DelegateExecution execution) { + msoLogger.debug( " *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy index b43a96bdb0..b43a96bdb0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index 816ba859ee..816ba859ee 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index a18cee253e..04b62d7f73 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -145,8 +145,136 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = - """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + String sndcTopologyDeleteRequest = "" + + switch (modelName) { + case ~/^Site$/: + sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name></subscriber-name> + </service-information> + <vnf-information> + <!-- TODO: to be filled as per the request input --> + <vnf-id></vnf-id> + <vnf-type></vnf-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </vnf-information> + <vnf-request-input> + <request-version></request-version> + <vnf-name></vnf-name> + <vnf-networks> + <vnf-network> + <network-role></network-role> + <network-name></network-name> + <neutron-id></neutron-id> + <network-id></network-id> + <contrail-network-fqdn></contrail-network-fqdn> + <subnets-data> + <subnet-data> + <ip-version></ip-version> + <subnet-id></subnet-id> + </subnet-data> + </subnets-data> + </vnf-network> + </vnf-networks> + </vnf-request-input> + <vnf-input-parameters> + <param></param> + </vnf-input-parameters> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + case ~/^SOTNAttachment$/: + sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url></notification-url> + <order-number></order-number> + <order-version></order-version> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid> + <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name> + </onap-model-information> + <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> + <subscriber-name></subscriber-name> + </service-information> + <allotted-resource-information> + <allotted-resource-id></allotted-resource-id> + <allotted-resource-type></allotted-resource-type> + <parent-service-instance-id></parent-service-instance-id> + <onap-model-information> + <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> + <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> + <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid> + <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version> + <model-name>${MsoUtils.xmlEscape(modelName)}</model-name> + </onap-model-information> + </allotted-resource-information> + <connection-attachment-request-input> + <param></param> + </connection-attachment-request-input> + </sdncadapterworkflow:SDNCRequestData> + </aetgt:SDNCAdapterWorkflowRequest>""".trim() + break + + default: + sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"> <sdncadapter:RequestHeader> @@ -179,6 +307,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <network-information> + <!-- TODO: to be filled as per the request input --> + <network-id></network-id> <onap-model-information> <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid> <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid> @@ -192,7 +322,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </network-request-input> </sdncadapterworkflow:SDNCRequestData> </aetgt:SDNCAdapterWorkflowRequest>""".trim() - + } + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) utils.logAudit(sndcTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy index 536783bc33..536783bc33 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index 682421e806..682421e806 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index 2cbfeac239..2cbfeac239 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy index 9dfb9107b2..9dfb9107b2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 98605fea8b..98605fea8b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index eceba5abe3..3702862a04 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,47 +20,29 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.domain.ServiceInstance +import javax.ws.rs.NotFoundException + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.CompareModelsResult import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.Resource -import org.onap.so.bpmn.core.domain.CompareModelsResult import org.onap.so.bpmn.core.domain.ResourceModelInfo import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.common.scripts.AaiUtil -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.core.RollbackData -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import groovy.json.* -import java.util.List -import java.util.Map -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; - -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource /** * This groovy class supports the <class>DoCompareModelofE2EServiceInstance.bpmn</class> process. * @@ -80,7 +62,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce String Prefix="DCMPMDSI_" private static final String DebugFlag = "isDebugEnabled" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -94,11 +76,11 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce execution.setVariable("prefix", Prefix) //Inputs - + //subscriberInfo. for AAI GET String globalSubscriberId = execution.getVariable("globalSubscriberId") utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - + String serviceType = execution.getVariable("serviceType") utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) @@ -142,85 +124,48 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" + /** + * Gets the service instance from aai + * + * @author cb645j + */ + public void getServiceInstance(DelegateExecution execution) { try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled) - - def modelInvariantId = utils.getNodeText(siData, "model-invariant-id") - def modelVersionId = utils.getNodeText(siData, "model-version-id") - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("model-invariant-id-original", si.getModelInvariantId()) + execution.setVariable("model-version-id-original", si.getModelVersionId()) + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + }catch(NotFoundException e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service-instance does not exist AAI") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET ") } public void postCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - + List<Resource> addResourceList = execution.getVariable("addResourceList") List<Resource> delResourceList = execution.getVariable("delResourceList") - + CompareModelsResult cmpResult = new CompareModelsResult() List<ResourceModelInfo> addedResourceList = new ArrayList<ResourceModelInfo>() List<ResourceModelInfo> deletedResourceList = new ArrayList<ResourceModelInfo>() - - + + String serviceModelUuid = execution.getVariable("model-version-id-target") List<String> requestInputs = new ArrayList<String>() ModelInfo mi = null; @@ -233,11 +178,11 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce rmodel.setResourceUuid(mi.getModelUuid()) rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) addedResourceList.add(rmodel) - + Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) - requestInputs.addAll(resourceParameters.keySet()) + requestInputs.addAll(resourceParameters.keySet()) } - + for(Resource rc : delResourceList) { mi = rc.getModelInfo() String resourceCustomizationUuid = mi.getModelCustomizationUuid() @@ -246,15 +191,15 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) rmodel.setResourceUuid(mi.getModelUuid()) rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) - deletedResourceList.add(rmodel) + deletedResourceList.add(rmodel) } - + cmpResult.setAddedResourceList(addedResourceList) cmpResult.setDeletedResourceList(deletedResourceList) - cmpResult.setRequestInputs(requestInputs) + cmpResult.setRequestInputs(requestInputs) execution.setVariable("compareModelsResult", cmpResult) } - + } - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index bb48671e73..4939173d65 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -3,14 +3,14 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,9 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.NotFoundException + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.CatalogDbUtils; @@ -35,6 +38,11 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils; @@ -58,7 +66,7 @@ import groovy.json.* * @param - failExists - TODO * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) * @param - sdncVersion ("1610") - * @param - serviceDecomposition - Decomposition for R1710 + * @param - serviceDecomposition - Decomposition for R1710 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) * * Outputs: @@ -98,17 +106,17 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (isBlank(serviceType)) { msg = "Input serviceType is null" msoLogger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (productFamilyId == null) { execution.setVariable("productFamilyId", "") } - + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" @@ -118,8 +126,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl) - //requestDetails.modelInfo.for AAI PUT servieInstanceData - //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData + //requestDetails.modelInfo.for AAI PUT servieInstanceData + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData String serviceInstanceName = execution.getVariable("serviceInstanceName") String serviceInstanceId = execution.getVariable("serviceInstanceId") String uuiRequest = execution.getVariable("uuiRequest") @@ -130,7 +138,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { //aai serviceType and Role can be setted as fixed value now. String aaiServiceType = "E2E Service" String aaiServiceRole = "E2E Service" - + execution.setVariable("modelInvariantUuid", modelInvariantUuid) execution.setVariable("modelUuid", modelUuid) @@ -142,7 +150,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${MsoUtils.xmlEscape(oStatus)}</orchestration-status>" - + AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -155,7 +163,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { ${statusLine} <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id> <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id> - </service-instance>""".trim() + </service-instance>""".trim() execution.setVariable("serviceInstanceData", serviceInstanceData) msoLogger.debug(serviceInstanceData) msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace) @@ -170,7 +178,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit preProcessRequest ") } - + public void prepareDecomposeService(DelegateExecution execution) { try { msoLogger.trace("Inside prepareDecomposeService of create generic e2e service ") @@ -193,7 +201,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } public void processDecomposition(DelegateExecution execution) { - msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ") + msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") } catch (Exception ex) { @@ -202,23 +210,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } - + public void doServicePreOperation(DelegateExecution execution){ - //we need a service plugin platform here. + //we need a service plugin platform here. ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") + String uuiRequest = execution.getVariable("uuiRequest") String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest); - execution.setVariable("uuiRequest", newUuiRequest) + execution.setVariable("uuiRequest", newUuiRequest) } - + public void doServiceHoming(DelegateExecution execution) { - //we need a service plugin platform here. + //we need a service plugin platform here. ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String uuiRequest = execution.getVariable("uuiRequest") + String uuiRequest = execution.getVariable("uuiRequest") String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest); - execution.setVariable("uuiRequest", newUuiRequest) + execution.setVariable("uuiRequest", newUuiRequest) } - + public void postProcessAAIGET(DelegateExecution execution) { msoLogger.trace("postProcessAAIGET ") String msg = "" @@ -260,6 +268,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Exit postProcessAAIGET ") } + //TODO use create if not exist public void postProcessAAIPUT(DelegateExecution execution) { msoLogger.trace("postProcessAAIPUT ") String msg = "" @@ -296,7 +305,32 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit postProcessAAIPUT ") } - + + /** + * Gets the service instance and its relationships from aai + */ + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('subscriptionServiceType') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("serviceInstanceName", si.getServiceInstanceName()) + + }catch(BpmnError e) { + throw e; + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void postProcessAAIGET2(DelegateExecution execution) { msoLogger.trace("postProcessAAIGET2 ") String msg = "" @@ -342,7 +376,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { public void preProcessRollback (DelegateExecution execution) { msoLogger.trace("preProcessRollback ") try { - + Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { @@ -397,10 +431,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("operationType", operationType) ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List<Resource> resourceList = serviceDecomposition.getServiceResources() - + for(Resource resource : resourceList){ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" - } + } def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) @@ -429,23 +463,36 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e); execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") + } + + // if site location is in local Operator, create all resources in local ONAP; + // if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP + public void doProcessSiteLocation(DelegateExecution execution){ + + msoLogger.trace("======== Start doProcessSiteLocation Process ======== ") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + ServiceDecomposition serviceDecompositionforLocal = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); + execution.setVariable("serviceDecomposition", serviceDecompositionforLocal) + + msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") } // prepare input param for using DoCreateResources.bpmn public void preProcessForAddResource(DelegateExecution execution) { msoLogger.trace("STARTED preProcessForAddResource Process ") - + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List<Resource> addResourceList = serviceDecomposition.getServiceResources() execution.setVariable("addResourceList", addResourceList) - + msoLogger.trace("COMPLETED preProcessForAddResource Process ") } public void postProcessForAddResource(DelegateExecution execution) { // do nothing now - + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index 05a0ea86d3..82355beed2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -37,7 +37,7 @@ import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig import org.onap.so.logger.MsoLogger import org.onap.so.logger.MessageEnum - +import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.aai.AAIObjectType diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 4bbaef8ecb..a376e581fe 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -36,6 +36,14 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse; import org.springframework.web.util.UriUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException import groovy.json.* import groovy.xml.XmlUtil @@ -47,7 +55,7 @@ import groovy.xml.XmlUtil */ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstance.class); - + String Prefix="CRENWKI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -56,7 +64,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() def className = getClass().getSimpleName() - + /** * This method is executed during the preProcessRequest task of the <class>DoCreateNetworkInstance.bpmn</class> process. * @param execution @@ -78,7 +86,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "networkOutputs", "") execution.setVariable(Prefix + "networkId","") execution.setVariable(Prefix + "networkName","") - + // AAI query Name execution.setVariable(Prefix + "queryNameAAIRequest","") execution.setVariable(Prefix + "queryNameAAIResponse", "") @@ -149,7 +157,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { //execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") execution.setVariable(Prefix + "isSdncRollbackNeeded", false) execution.setVariable(Prefix + "sdncResponseSuccess", false) - + execution.setVariable(Prefix + "activateSDNCRequest", "") execution.setVariable(Prefix + "activateSDNCResponse", "") execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") @@ -164,7 +172,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "Success", false) execution.setVariable(Prefix + "isException", false) - + } // ************************************************** @@ -175,25 +183,25 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { * @param execution */ public void preProcessRequest (DelegateExecution execution) { - - execution.setVariable("prefix",Prefix) + + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy") - + try { // initialize flow variables InitializeProcessVariables(execution) - + // GET Incoming request & validate 3 kinds of format. execution.setVariable("action", "CREATE") String networkRequest = execution.getVariable("bpmnRequest") if (networkRequest != null) { if (networkRequest.contains("requestDetails")) { - // JSON format request is sent, create xml + // JSON format request is sent, create xml try { def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) - + } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() msoLogger.debug(dataErrorMessage) @@ -201,26 +209,26 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } else { // XML format request is sent - + } } else { // vIPR format request is sent, create xml from individual variables networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) } - + networkRequest = utils.formatXml(networkRequest) execution.setVariable(Prefix + "networkRequest", networkRequest) msoLogger.debug(Prefix + "networkRequest - " + '\n' + networkRequest) - + // validate 'backout-on-failure' to override 'mso.rollback' boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) - + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) - + // prepare messageId String messageId = execution.getVariable("testMessageId") // for testing if (messageId == null || messageId == "") { @@ -230,12 +238,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) - + String source = utils.getNodeText(networkRequest, "source") execution.setVariable(Prefix + "source", source) msoLogger.debug(Prefix + "source - " + source) - - // validate cloud region + + // validate cloud region String lcpCloudRegionId = utils.getNodeText(networkRequest, "aic-cloud-region") if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) { String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'." @@ -244,7 +252,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } // validate service instance id - String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") + String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) { String dataErrorMessage = "Missing value/element: 'serviceInstanceId'." msoLogger.debug(" Invalid Request - " + dataErrorMessage) @@ -253,12 +261,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) - + try { def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey",execution)) execution.setVariable("BasicAuthHeaderValuePO",encodedString) execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - + } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() @@ -273,11 +281,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("GENGS_type", "service-instance") msoLogger.debug("GENGS_type - " + "service-instance") msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) - + String sdncVersion = execution.getVariable("sdncVersion") msoLogger.debug("sdncVersion? : " + sdncVersion) - - // build 'networkOutputs' + + // build 'networkOutputs' String networkId = utils.getNodeText(networkRequest, "network-id") if ((networkId == null) || (networkId == "null")) { networkId = "" @@ -295,25 +303,49 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) execution.setVariable(Prefix + "networkId", networkId) execution.setVariable(Prefix + "networkName", networkName) - + } catch (BpmnError e) { throw e; - + } catch (Exception ex) { sendSyncError(execution) // caught exception String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - + } } - + + /** + * Gets the service instance uri from aai + */ + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('CRENWKI_serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(!resourceClient.exists(uri)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + public void callRESTQueryAAINetworkName (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " ) // get variables @@ -348,7 +380,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase()) msoLogger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase()) execution.setVariable("orchestrationStatus", orchestrationStatus) - + } catch (Exception ex) { // response is empty execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) @@ -385,9 +417,9 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAICloudRegion (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " ) try { @@ -434,7 +466,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkId(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) @@ -445,15 +477,15 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") if (execution.getVariable("sdncVersion") != "1610") { String networkResponseInformation = "" - try { + try { networkResponseInformation = utils.getNodeXml(assignSDNCResponse, "network-response-information", false).replace("tag0:","").replace(":tag0","") networkId = utils.getNodeText(networkResponseInformation, "instance-id") } catch (Exception ex) { String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty <network-response-information>" msoLogger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - + } + } else { networkId = utils.getNodeText(assignSDNCResponse, "network-id") } @@ -465,11 +497,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId) } - + execution.setVariable(Prefix + "networkId", networkId) String networkName = utils.getNodeText(assignSDNCResponse, "network-name") execution.setVariable(Prefix + "networkName", networkName) - + networkId = UriUtils.encode(networkId,"UTF-8") // Prepare AA&I url @@ -491,7 +523,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if (returnCode=='200') { execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) msoLogger.debug(" QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString) - + String netId = utils.getNodeText(aaiResponseAsString, "network-id") execution.setVariable(Prefix + "networkId", netId) String netName = utils.getNodeText(aaiResponseAsString, "network-name") @@ -532,7 +564,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTReQueryAAINetworkId(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " ) @@ -540,7 +572,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { try { // get variables String networkId = execution.getVariable(Prefix + "networkId") - String netId = networkId + String netId = networkId networkId = UriUtils.encode(networkId,"UTF-8") // Prepare AA&I url @@ -606,7 +638,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " ) @@ -748,7 +780,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " ) @@ -882,7 +914,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " ) @@ -1017,7 +1049,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) @@ -1046,7 +1078,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(" 'payload' to Update Contrail - " + "\n" + payloadXml) APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payloadXml) - + String returnCode = response.getStatusCode() execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) msoLogger.debug(" ***** AAI Update Contrail Response Code : " + returnCode) @@ -1060,7 +1092,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "isPONR", false) } else { execution.setVariable(Prefix + "isPONR", true) - } + } msoLogger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR")) } else { if (returnCode=='404') { @@ -1096,7 +1128,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareCreateNetworkRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance") @@ -1106,7 +1138,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // get variables String requestId = execution.getVariable("msoRequestId") if (requestId == null) { - requestId = execution.getVariable("mso-request-id") + requestId = execution.getVariable("mso-request-id") } String messageId = execution.getVariable(Prefix + "messageId") String source = execution.getVariable(Prefix + "source") @@ -1115,7 +1147,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - + // Prepare Network request String routeCollection = execution.getVariable(Prefix + "routeCollection") String policyCollection = execution.getVariable(Prefix + "networkCollection") @@ -1138,7 +1170,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareSDNCRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance") @@ -1158,9 +1190,9 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("mso-request-id", requestId) } else { requestId = execution.getVariable("mso-request-id") - } + } execution.setVariable(Prefix + "requestId", requestId) - + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) @@ -1179,21 +1211,21 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareRpcSDNCRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance") try { // get variables - + String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) String createNetworkInput = execution.getVariable(Prefix + "networkRequest") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") String networkId = execution.getVariable(Prefix + "networkId") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) @@ -1209,11 +1241,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void prepareRpcSDNCActivateRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance") try { @@ -1223,7 +1255,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") String networkId = execution.getVariable(Prefix + "networkId") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null) @@ -1240,7 +1272,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + @@ -1249,7 +1281,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // ************************************************** public void validateCreateNetworkResponse (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance") @@ -1321,7 +1353,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void validateSDNCResponse (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance") @@ -1329,7 +1361,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String response = execution.getVariable(Prefix + "assignSDNCResponse") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") WorkflowException workflowException = execution.getVariable("WorkflowException") - + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) // reset variable @@ -1349,7 +1381,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void validateRpcSDNCActivateResponse (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance") @@ -1373,12 +1405,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response") throw new BpmnError("MSOWorkflowException") } - + } public void prepareSDNCRollbackRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance") @@ -1392,7 +1424,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String networkId = execution.getVariable(Prefix + "networkId") if (networkId == 'null') {networkId = ""} String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") - + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) @@ -1410,7 +1442,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } public void prepareRpcSDNCRollbackRequest (DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance") @@ -1440,15 +1472,15 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void prepareRpcSDNCActivateRollback(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) msoLogger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance") try { - + // get variables String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) String createNetworkInput = execution.getVariable(Prefix + "networkRequest") @@ -1473,76 +1505,76 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void prepareRollbackData(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance") - + try { - + Map<String, String> rollbackData = new HashMap<String, String>(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") - if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != null) { if (rollbackSDNCRequest != "") { rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) } - } + } String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") if (rollbackNetworkRequest != null) { - if (rollbackNetworkRequest != "") { + if (rollbackNetworkRequest != "") { rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) - } + } } String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") if (rollbackActivateSDNCRequest != null) { - if (rollbackActivateSDNCRequest != "") { + if (rollbackActivateSDNCRequest != "") { rollbackData.put("rollbackActivateSDNCRequest", execution.getVariable(Prefix + "rollbackActivateSDNCRequest")) - } + } } execution.setVariable("rollbackData", rollbackData) msoLogger.debug("** rollbackData : " + rollbackData) - + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } - + public void postProcessResponse(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside postProcessResponse() of DoCreateNetworkInstance") - + try { - + //Conditions: - // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" + // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" // 2. Success: execution.getVariable("WorkflowException") == null (NULL) - // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) - + // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) + msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException")) // successful flow - if (execution.getVariable(Prefix + "isException") == false) { + if (execution.getVariable(Prefix + "isException") == false) { // set rollback data execution.setVariable("orchestrationStatus", "") execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) - prepareSuccessRollbackData(execution) // populate rollbackData + prepareSuccessRollbackData(execution) // populate rollbackData execution.setVariable("WorkflowException", null) execution.setVariable(Prefix + "Success", true) msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") } else { // inside sub-flow logic - execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "Success", false) execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. @@ -1553,45 +1585,45 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "WorkflowException") != null) { WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") exceptionMessage = pwfex.getErrorMessage() - } + } } // going to the Main flow: a-la-carte or macro msoLogger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } - + } catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") - + } - - - + + + } - + public void prepareSuccessRollbackData(DelegateExecution execution) { - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance") - + try { - + if (execution.getVariable("sdncVersion") != '1610') { prepareRpcSDNCRollbackRequest(execution) prepareRpcSDNCActivateRollback(execution) } else { prepareSDNCRollbackRequest(execution) - } - + } + Map<String, String> rollbackData = new HashMap<String, String>(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") if (rollbackSDNCRequest != null) { @@ -1612,63 +1644,63 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - + msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) execution.setVariable("WorkflowException", null) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } public void setExceptionFlag(DelegateExecution execution){ - + execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance") - + try { - + execution.setVariable(Prefix + "isException", true) - + if (execution.getVariable("SavedWorkflowException1") != null) { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) - + } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - } - + } + } - - + + // ******************************* // Build Error Section // ******************************* - + public void processJavaException(DelegateExecution execution){ - + execution.setVariable("prefix",Prefix) - + try{ msoLogger.debug( "Caught a Java Exception in " + Prefix) msoLogger.debug("Started processJavaException Method") msoLogger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - + }catch(Exception e){ msoLogger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy index 7e00f05b90..7e00f05b90 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index 9da8a90ca7..d571c00f47 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -183,9 +183,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ def currentIndex = execution.getVariable("currentResourceIndex") List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") Resource currentResource = sequencedResourceList.get(currentIndex) - execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) + execution.setVariable("resourceType", currentResource.getModelInfo().getModelName()) msoLogger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName()) - msoLogger.trace("COMPLETED getCurrentResoure Process ") + msoLogger.trace("COMPLETED getCurrentResoure Process ") } public void parseNextResource(DelegateExecution execution){ @@ -226,6 +226,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ resourceInput.setResourceModelInfo(currentResource.getModelInfo()); ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + def String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid(); String incomingRequest = execution.getVariable("uuiRequest") //set the requestInputs from tempalte To Be Done @@ -260,7 +261,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{ } else { String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceInput.getResourceModelInfo().getModelUuid() - utils.log("ERROR", exceptionMessage, isDebugEnabled) + msoLogger.trace(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 93a260a544..b44940eb20 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -62,7 +62,7 @@ import groovy.json.* * @param - failExists - TODO * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) * @param - sdncVersion ("1610") - * @param - serviceDecomposition - Decomposition for R1710 + * @param - serviceDecomposition - Decomposition for R1710 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) * * Outputs: @@ -71,7 +71,7 @@ import groovy.json.* * @param - WorkflowException * @param - serviceInstanceName - (GET from AAI if null in input) * - * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) + * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) */ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { @@ -89,7 +89,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { try { String requestId = execution.getVariable("msoRequestId") execution.setVariable("prefix", Prefix) - + setBasicDBAuthHeader(execution, isDebugEnabled) //Inputs //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology @@ -106,17 +106,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (isBlank(subscriptionServiceType)) { msg = "Input subscriptionServiceType is null" msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (productFamilyId == null) { execution.setVariable("productFamilyId", "") } - + String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" @@ -131,19 +131,19 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String modelVersion = "" String modelUuid = "" String modelName = "" - String serviceInstanceName = "" + String serviceInstanceName = "" //Generated in parent.for AAI PUT String serviceInstanceId = "" String serviceType = "" String serviceRole = "" - + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") if (serviceDecomp != null) { serviceType = serviceDecomp.getServiceType() ?: "" msoLogger.debug("serviceType:" + serviceType) serviceRole = serviceDecomp.getServiceRole() ?: "" - + ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() if (serviceInstance != null) { @@ -152,7 +152,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceInstanceId) execution.setVariable("serviceInstanceName", serviceInstanceName) } - + ModelInfo modelInfo = serviceDecomp.getModelInfo() if (modelInfo != null) { @@ -161,7 +161,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { modelUuid = modelInfo.getModelUuid() ?: "" modelName = modelInfo.getModelName() ?: "" } - else + else { msg = "Input serviceModelInfo is null" msoLogger.debug(msg) @@ -173,21 +173,21 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" - + String serviceModelInfo = execution.getVariable("serviceModelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } + } modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" //modelCustomizationUuid NA for SI - + } - + execution.setVariable("serviceType", serviceType) execution.setVariable("serviceRole", serviceRole) execution.setVariable("serviceInstanceName", serviceInstanceName) @@ -196,7 +196,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("modelVersion", modelVersion) execution.setVariable("modelUuid", modelUuid) execution.setVariable("modelName", modelName) - + //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) @@ -208,13 +208,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { break; } } - + //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW //Alacartes are sent to SDNC if they are listed in config variable above execution.setVariable("sendToSDNC", true) if(execution.getVariable("sdncVersion").equals("1610")) //alacarte { - if(!isSdncService){ + if(!isSdncService){ execution.setVariable("sendToSDNC", false) //alacarte non-sdnc svcs must provide name (sdnc provides name for rest) if (isBlank(execution.getVariable("serviceInstanceName" ))) @@ -225,25 +225,25 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } } } - + msoLogger.debug("isSdncService: " + isSdncService) msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) - + //macro may provide name and alacarte-portm may provide name execution.setVariable("checkAAI", false) if (!isBlank(execution.getVariable("serviceInstanceName" ))) { execution.setVariable("checkAAI", true) } - + if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - - + + StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("serviceInputParams") if (paramsMap != null) @@ -278,16 +278,16 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${MsoUtils.xmlEscape(oStatus)}</orchestration-status>" String serviceTypeLine = isBlank(serviceType) ? "" : "<service-type>${MsoUtils.xmlEscape(serviceType)}</service-type>" String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${MsoUtils.xmlEscape(serviceRole)}</service-role>" - + //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT String environmentContext = "" String workloadContext ="" - + try{ String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) - + msoLogger.debug("JSON IS: "+json) - + environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: "" workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: "" msoLogger.debug("Env Context is: "+ environmentContext) @@ -299,7 +299,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - + //Create AAI Payload AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) @@ -318,7 +318,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceData", serviceInstanceData) msoLogger.debug(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData) - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -329,7 +329,6 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Exit preProcessRequest") } - //TODO: Will be able to replace with call to GenericGetService public void getAAICustomerById (DelegateExecution execution) { // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -400,47 +399,6 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - msoLogger.trace("postProcessAAIGET") - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - msoLogger.debug("Error getting Service-instance from AAI", + serviceInstanceName) - WorkflowException workflowException = execution.getVariable("WorkflowException") - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - msoLogger.debug("Found Service-instance in AAI") - msg = "ServiceInstance already exists in AAI:" + serviceInstanceName - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit postProcessAAIGET") - } - public void postProcessAAIPUT(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("postProcessAAIPUT") @@ -498,17 +456,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def modelVersion = execution.getVariable("modelVersion") def modelUuid = execution.getVariable("modelUuid") def modelName = execution.getVariable("modelName") - + def sdncRequestId = UUID.randomUUID().toString() - + def siParamsXml = execution.getVariable("siParamsXml") - + // special URL for SDNW, msoAction helps set diff url in SDNCA if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) { msoAction = "TRANSPORT" } - + String sdncAssignRequest = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" @@ -563,7 +521,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) execution.setVariable("rollbackData", rollbackData) - + msoLogger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { @@ -575,7 +533,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit preProcessSDNCAssignRequest") } - + public void postProcessSDNCAssign (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("postProcessSDNCAssign") @@ -612,7 +570,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit postProcessSDNCAssign") } - + public void postProcessAAIGET2(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("postProcessAAIGET2") @@ -660,7 +618,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("preProcessRollback") try { - + Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { @@ -697,19 +655,19 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit postProcessRollback") } - + public void createProject(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("createProject") - String bpmnRequest = execution.getVariable("requestJson") - String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName") + String bpmnRequest = execution.getVariable("requestJson") + String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName") String serviceInstance = execution.getVariable("serviceInstanceId") - + msoLogger.debug("BPMN REQUEST IS: "+ bpmnRequest) msoLogger.debug("PROJECT NAME: " + projectName) msoLogger.debug("Service Instance: " + serviceInstance) - + if(projectName == null||projectName.equals("")){ msoLogger.debug("Project Name was not found in input. Skipping task...") }else{ @@ -722,27 +680,27 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { msoLogger.error(ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - } + } msoLogger.trace("Exit createProject") } - + public void createOwningEntity(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") msoLogger.trace("createOwningEntity") String msg = ""; - String bpmnRequest = execution.getVariable("requestJson") - String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId") + String bpmnRequest = execution.getVariable("requestJson") + String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId") String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName"); String serviceInstance = execution.getVariable("serviceInstanceId") - + msoLogger.debug("owningEntity: " + owningEntityId) msoLogger.debug("OwningEntityName: "+ owningEntityName) msoLogger.debug("Service Instance: " + serviceInstance) - + try{ AAICreateResources aaiCR = new AAICreateResources() if(owningEntityId==null||owningEntityId.equals("")){ - msg = "Exception in createOwningEntity. OwningEntityId is null in input."; + msg = "Exception in createOwningEntity. OwningEntityId is null in input."; throw new IllegalStateException(); }else{ if(aaiCR.existsOwningEntity(owningEntityId)){ @@ -769,21 +727,21 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } msoLogger.trace("Exit createOwningEntity") } - + // ******************************* // Build Error Section // ******************************* public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - + try{ msoLogger.debug("Caught a Java Exception in DoCreateServiceInstance") msoLogger.debug("Started processJavaException Method") msoLogger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance") - + }catch(Exception e){ msoLogger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException") // Adding this line temporarily until this flows error handling gets updated diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy index dd56b8f2cc..dd56b8f2cc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 10f6acd403..10f6acd403 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 59d38bfe86..59d38bfe86 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index a0b7dabb32..a0b7dabb32 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy index 5995b6b099..5995b6b099 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index f734ffb3ff..f87f32c610 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,6 +35,14 @@ import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse import org.springframework.web.util.UriUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException class DoCreateVfModuleVolumeV2 extends VfModuleBase { @@ -53,16 +61,16 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { } public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { - + execution.setVariable("prefix",prefix) execution.setVariable(prefix+'SuccessIndicator', false) execution.setVariable(prefix+'isPONR', false) displayInput(execution, isDebugLogEnabled) setRollbackData(execution, isDebugLogEnabled) - setRollbackEnabled(execution, isDebugLogEnabled) - - + setRollbackEnabled(execution, isDebugLogEnabled) + + def tenantId = execution.getVariable("tenantId") if (tenantId == null) { String cloudConfiguration = execution.getVariable("cloudConfiguration") @@ -84,17 +92,17 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid") execution.setVariable("modelCustomizationId", modelCustomizationUuid) msoLogger.debug("modelCustomizationId: " + modelCustomizationUuid) - + //modelName def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") execution.setVariable("modelName", modelName) msoLogger.debug("modelName: " + modelName) - + // The following is used on the get Generic Service Instance call execution.setVariable('GENGS_type', 'service-instance') } - + /** * Display input variables * @param execution @@ -111,10 +119,10 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { } msoLogger.debug('End input.') } - - + + /** - * Define and set rollbackdata object + * Define and set rollbackdata object * @param execution * @param isDebugEnabled */ @@ -127,25 +135,29 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName) execution.setVariable("rollbackData", rollbackData) } - - + + /** - * validate getServiceInstance response - * @param execution - * @param isDebugEnabled + * Gets the service instance uri from aai */ - public void validateGetServiceInstanceCall(DelegateExecution execution, isDebugEnabled) { - def found = execution.getVariable('GENGS_FoundIndicator') - def success = execution.getVariable('GENGS_SuccessIndicator') - def serviceInstanceId = execution.getVariable('serviceInstanceId') - msoLogger.debug("getServiceInstance success: " + success) - msoLogger.debug("getServiceInstance found: " + found) - if(!found || !success) { - String errorMessage = "Service instance id not found in AAI: ${serviceInstanceId}." - msoLogger.debug(errorMessage) - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(!resourceClient.exists(uri)){ + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg) } - } /** @@ -175,7 +187,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { msoLogger.debug(errorMessage) (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) } - + def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) if ((poCloudRegion != "ERROR")) { execution.setVariable("poLcpCloudRegionId", poCloudRegion) @@ -185,7 +197,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { msoLogger.debug(errorMessage) (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage) } - + def rollbackData = execution.getVariable("rollbackData") rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion) } @@ -242,7 +254,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { /** - * Create a WorkflowException + * Create a WorkflowException * @param execution * @param isDebugEnabled */ @@ -265,7 +277,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { throw new BpmnError("MSOWorkflowException") } - + /** * Create volume group in AAI * @param execution @@ -280,7 +292,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def vnfType = execution.getVariable("vnfType") def tenantId = execution.getVariable("tenantId") def cloudRegion = execution.getVariable('lcpCloudRegionId') - + msoLogger.debug("volumeGroupId: " + volumeGroupId) def testGroupId = execution.getVariable('test-volume-group-id') @@ -316,7 +328,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { execution.setVariable(prefix+"createAAIVolumeGrpNameReturnCode", returnCode) execution.setVariable(prefix+"createAAIVolumeGrpNameResponse", aaiResponseAsString) - + ExceptionUtil exceptionUtil = new ExceptionUtil() if (returnCode =='201') { @@ -333,7 +345,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { } } } - + /** * Prepare VNF adapter create request XML @@ -345,7 +357,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def vnfId = utils.getNodeText(aaiGenericVnfResponse, 'vnf-id') def vnfName = utils.getNodeText(aaiGenericVnfResponse, 'vnf-name') def vnfType = utils.getNodeText(aaiGenericVnfResponse, "vnf-type") - + def requestId = execution.getVariable('msoRequestId') def serviceId = execution.getVariable('serviceInstanceId') def cloudSiteId = execution.getVariable('poLcpCloudRegionId') @@ -353,11 +365,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { def volumeGroupId = execution.getVariable('volumeGroupId') def volumeGroupnName = execution.getVariable('volumeGroupName') - def vnfVersion = execution.getVariable("asdcServiceModelVersion") + def vnfVersion = execution.getVariable("asdcServiceModelVersion") def vnfModuleType = execution.getVariable("modelName") def modelCustomizationId = execution.getVariable("modelCustomizationId") - + // for testing msoLogger.debug("volumeGroupId: " + volumeGroupId) def testGroupId = execution.getVariable('test-volume-group-id') @@ -367,9 +379,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0") } msoLogger.debug("volumeGroupId to be used: " + volumeGroupId) - + // volume group parameters - + String volumeGroupParams = '' StringBuilder sbParams = new StringBuilder() Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams") @@ -396,17 +408,17 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { if(failIfExists == null) { failIfExists = 'true' } - + String messageId = UUID.randomUUID() msoLogger.debug("messageId to be used is generated: " + messageId) - + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution) if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) } msoLogger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl) - + // build request String vnfSubCreateWorkflowRequest = """ @@ -465,9 +477,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest) execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString) } - + public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) { - + def request = """ <rollbackVolumeGroupRequest> <volumeGroupRollback> @@ -485,16 +497,16 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { <skipAAI>true</skipAAI> <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl> </rollbackVolumeGroupRequest> - """ - - return request + """ + + return request } public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) { String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId) return newRequest } - + /** * Validate VNF adapter response * @param execution @@ -513,10 +525,10 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true") } } - + /** - * Update voulume group in AAI + * Update voulume group in AAI * @TODO: Can we re-use the create method?? * @param execution * @param isDebugEnabled @@ -525,7 +537,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse") String volumeGroupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") - String modelCustomizationId = execution.getVariable("modelCustomizationId") + String modelCustomizationId = execution.getVariable("modelCustomizationId") String cloudRegion = execution.getVariable("lcpCloudRegionId") AaiUtil aaiUtil = new AaiUtil(this) @@ -538,7 +550,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId") - + execution.setVariable(prefix+"heatStackId", heatStackID) NetworkUtils networkUtils = new NetworkUtils() diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 46a502e124..7fa8b4409b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -43,6 +43,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.springframework.web.util.UriUtils +import org.json.JSONObject /** @@ -247,6 +248,32 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { msoLogger.trace("COMPLETED DoCreateVnf PreProcessRequest Process") } + /** + * Gets the service instance from aai + */ + public void getServiceInstance(DelegateExecution execution) { + try { + String serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + execution.setVariable("GENGS_siResourceLink", uri.build().toString()) + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch(Exception ex) { + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + private Object getVariableEnforced(DelegateExecution execution, String name){ Object enforced = execution.getVariable(name) if(!enforced){ diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index d3dbd9107e..d3dbd9107e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index eafc39b1dd..eafc39b1dd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 238ac82c01..238ac82c01 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index 20a7f43de7..21bf0f2c5c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -37,7 +37,14 @@ import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse; import org.springframework.web.util.UriUtils; - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException import groovy.json.* @@ -149,63 +156,32 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce msoLogger.info("Exited " + method) } - - - public void postProcessAAIGET(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')' - msoLogger.info("Entered " + method) - - String msg = "" - + /** + * Gets the service instance and its relationships from aai + * + * @author cb645j + */ + public void getServiceInstance(DelegateExecution execution) { try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - msoLogger.info("serviceInstanceId: "+serviceInstanceId) - - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - msoLogger.info("foundInAAI: "+foundInAAI) - - String serviceType = "" - - - if(foundInAAI){ - msoLogger.info("Found Service-instance in AAI") + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') - String siData = execution.getVariable("GENGS_service") - msoLogger.info("SI Data") - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + String json = wrapper.getJson() - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceId) - WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } + execution.setVariable("serviceInstance", json) - msoLogger.info("Service-instance NOT found in AAI. Silent Success") - } - }catch (BpmnError e) { + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Bpmn error encountered in " + method + "--" + ex.getMessage() - msoLogger.info(msg) + }catch(NotFoundException e) { + msoLogger.info("SI not found in aai. Silent Success ") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.info("Exited " + method) } private void loadResourcesProperties(DelegateExecution execution) { @@ -334,23 +310,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce String serviceInstanceId = execution.getVariable("serviceInstanceId") - // confirm if ServiceInstance was found - if ( !execution.getVariable("GENGS_FoundIndicator") ) - { - String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } execution.setVariable(Prefix+"resourceList", "") execution.setVariable(Prefix+"resourceCount", 0) execution.setVariable(Prefix+"nextResource", 0) execution.setVariable(Prefix+"resourceFinish", true) - // get SI extracted by GenericGetService - String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); - msoLogger.info("serviceInstanceAaiRecord: " +serviceInstanceAaiRecord) - - String aaiJsonRecord = jsonUtil.xml2json(serviceInstanceAaiRecord) + String aaiJsonRecord = execution.getVariable("serviceInstance"); + msoLogger.info("serviceInstanceAaiRecord: " +aaiJsonRecord) msoLogger.info("aaiJsonRecord: " +aaiJsonRecord) def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 54dfae3760..76dba27890 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -192,76 +192,93 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { //Confirm there are no related service instances (vnf/network or volume) if (utils.nodeExists(siData, "relationship-list")) { utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - //test(siData) - NodeList nodeList = serviceXml.getElementsByTagName("relationship") JSONArray jArray = new JSONArray() - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns - if(e.equals("service-instance")){ - def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled) - NodeList dataList = node.getChildNodes() - if(null != dataList) { - JSONObject jObj = new JSONObject() - for (int i = 0; i < dataList.getLength(); i++) { - Node dNode = dataList.item(i) - if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-id")){ - jObj.put("resourceInstanceId", eValue) - } - - } - else if(dNode.getNodeName() == "related-to-property"){ - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() - if(eKey.equals("service-instance.service-instance-name")){ - jObj.put("resourceType", eValue) - } - } - } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - jArray.put(jObj) - } - //for overlay/underlay - }else if (e.equals("configuration")){ - def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() - utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled) - NodeList dataList = node.getChildNodes() - if(null != dataList) { - JSONObject jObj = new JSONObject() - for (int i = 0; i < dataList.getLength(); i++) { - Node dNode = dataList.item(i) - if(dNode.getNodeName() == "relationship-data") { - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() - if(eKey.equals("configuration.configuration-id")){ - jObj.put("resourceInstanceId", eValue) - } - } - else if(dNode.getNodeName() == "related-to-property"){ - Element rDataEle = (Element)dNode - def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() - def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() - if(eKey.equals("configuration.configuration-type")){ - jObj.put("resourceType", eValue) - } - } - } - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - jArray.put(jObj) - } - } - } + + XmlParser xmlParser = new XmlParser() + Node root = xmlParser.parseText(siData) + def relation_list = utils.getChildNode(root, 'relationship-list') + def relationships = utils.getIdenticalChildren(relation_list, 'relationship') + + for (def relation: relationships) { + def jObj = getRelationShipData(relation, isDebugEnabled) + jArray.put(jObj) } + execution.setVariable("serviceRelationShip", jArray.toString()) + +// //test(siData) +// NodeList nodeList = serviceXml.getElementsByTagName("relationship") +// JSONArray jArray = new JSONArray() +// for (int x = 0; x < nodeList.getLength(); x++) { +// Node node = nodeList.item(x) +// if (node.getNodeType() == Node.ELEMENT_NODE) { +// Element eElement = (Element) node +// def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns +// if(e.equals("service-instance")){ +// def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() +// utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled) +// NodeList dataList = node.getChildNodes() +// if(null != dataList) { +// JSONObject jObj = new JSONObject() +// for (int i = 0; i < dataList.getLength(); i++) { +// Node dNode = dataList.item(i) +// if(dNode.getNodeName() == "relationship-data") { +// Element rDataEle = (Element)dNode +// def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() +// def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() +// if(eKey.equals("service-instance.service-instance-id")){ +// jObj.put("resourceInstanceId", eValue) +// } +// +// } +// else if(dNode.getNodeName() == "related-to-property"){ +// Element rDataEle = (Element)dNode +// def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() +// def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() +// if(eKey.equals("service-instance.service-instance-name")){ +// jObj.put("resourceType", eValue) +// } +// } +// } +// utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) +// jArray.put(jObj) +// } +// //for overlay/underlay +// }else if (e.equals("configuration")){ +// def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent() +// utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled) +// NodeList dataList = node.getChildNodes() +// if(null != dataList) { +// JSONObject jObj = new JSONObject() +// for (int i = 0; i < dataList.getLength(); i++) { +// Node dNode = dataList.item(i) +// if(dNode.getNodeName() == "relationship-data") { +// Element rDataEle = (Element)dNode +// def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent() +// def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent() +// if(eKey.equals("configuration.configuration-id")){ +// jObj.put("resourceInstanceId", eValue) +// } +// } +// else if(dNode.getNodeName() == "related-to-property"){ +// Element rDataEle = (Element)dNode +// def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent() +// def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent() +// if(eKey.equals("configuration.configuration-type")){ +// jObj.put("resourceType", eValue) +// } +// } +// } +// utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) +// jArray.put(jObj) +// } +// // for SP-Partner +// }else if (e.equals("sp-partner")){ +// +// } +// } +// } +// execution.setVariable("serviceRelationShip", jArray.toString()) } } }else{ @@ -292,6 +309,55 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } + + private JSONObject getRelationShipData(node, isDebugEnabled){ + JSONObject jObj = new JSONObject() + + def relation = utils.nodeToString(node) + def rt = utils.getNodeText1(relation, "related-to") + + def rl = utils.getNodeText1(relation, "related-link") + utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) + + def rl_datas = utils.getIdenticalChildren(node, "relationship-data") + for(def rl_data : rl_datas) { + def eKey = utils.getChildNodeText(rl_data, "relationship-key") + def eValue = utils.getChildNodeText(rl_data, "relationship-value") + + if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) + //for overlay/underlay + || (rt == "configuration" && eKey.equals("configuration.configuration-id") + )){ + jObj.put("resourceInstanceId", eValue) + } + // for sp-partner and others + else if(eKey.equals(rt + ".id")){ + jObj.put("resourceInstanceId", eValue) + String resourceName = rt + eValue; + jObj.put("resourceType", resourceName) + } + else if(eKey.equals(rt + ".id")){ + jObj.put("resourceInstanceId", eValue) + String resourceName = rt + eValue; + jObj.put("resourceType", resourceName) + } + } + + def rl_props = utils.getIdenticalChildren(node, "related-to-property") + for(def rl_prop : rl_props) { + def eKey = utils.getChildNodeText(rl_prop, "property-key") + def eValue = utils.getChildNodeText(rl_prop, "property-value") + if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) + //for overlay/underlay + || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ + jObj.put("resourceType", eValue) + } + } + + utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) + + return jObj + } public void getCurrentNS(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -351,6 +417,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (serviceRelationShip != null) { relationShipList = jsonSlurper.parseText(serviceRelationShip) } + + List<Resource> deleteRealResourceList = new ArrayList<Resource>(); //Set the real resource instance id to the decomosed resource list for (Resource resource: deleteResourceList) { @@ -360,13 +428,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (relationShipList != null) { relationShipList.each { if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { - resource.setResourceId(it.resourceInstanceId); + resource.setResourceId(it.resourceInstanceId) + deleteRealResourceList.add(resource) } } } } - execution.setVariable("deleteResourceList", deleteResourceList) - utils.log("DEBUG", "delete resource list : " + deleteResourceList, isDebugEnabled) + + // only delete real existing resources + execution.setVariable("deleteResourceList", deleteRealResourceList) + + utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 3ee059cb02..3ee059cb02 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy index ca6e21eedc..ca6e21eedc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index a5a96f3bd3..a5a96f3bd3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index 198144ad34..c7e3eb437c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -22,12 +22,10 @@ package org.onap.so.bpmn.infrastructure.scripts import static org.apache.commons.lang3.StringUtils.*; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -35,17 +33,13 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.logger.MsoLogger -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.logger.MsoLogger import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource import groovy.json.* @@ -282,170 +276,86 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Exit postProcessSDNC " + method + " ") } - public void postProcessAAIGET(DelegateExecution execution) { - - msoLogger.trace("postProcessAAIGET ") - String msg = "" - + /** + * Gets the service instance uri from aai + */ + public void getServiceInstance(DelegateExecution execution) { + msoLogger.trace("getServiceInstance ") try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI == true){ - msoLogger.debug("Found Service-instance in AAI") - - //Extract GlobalSubscriberId - String siRelatedLink = execution.getVariable("GENGS_siResourceLink") - if (isBlank(siRelatedLink)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + execution.setVariable("GENGS_siResourceLink", uri.build().toString()) + Map<String, String> keys = uri.getURIKeys() + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if(isBlank(globalSubscriberId)){ + globalSubscriberId = keys.get("global-customer-id") + execution.setVariable("globalSubscriberId", globalSubscriberId) } - else - { - msoLogger.debug("Found Service-instance in AAI. link: " + siRelatedLink) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - if(isBlank(globalSubscriberId)){ - int custStart = siRelatedLink.indexOf("customer/") - int custEnd = siRelatedLink.indexOf("/service-subscriptions") - globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd) - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //Extract Service Type if not provided on request - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - if(isBlank(subscriptionServiceType)){ - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd) - subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - if (isBlank(globalSubscriberId) || isBlank(subscriptionServiceType)) - { - msg = "Could not retrive global-customer-id & subscription-service-type from AAI to delete id:" + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } + //Extract Service Type if not provided on request + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if(isBlank(subscriptionServiceType)){ + String serviceTypeEncoded = keys.get("service-type") //TODO will this produce as already decoded? + subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) } - String siData = execution.getVariable("GENGS_service") - msoLogger.debug("SI Data") - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - msoLogger.debug("SI Data" + siData) - serviceType = utils.getNodeText(siData,"service-type") + AAIResultWrapper wrapper = resourceClient.get(uri) + List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) + uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)) + uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK)) + + if(uriList.isEmpty){ + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + String orchestrationStatus = si.getOrchestrationStatus() + String serviceType = si.getServiceType() execution.setVariable("serviceType", serviceType) - execution.setVariable("serviceRole", utils.getNodeText(siData,"service-role")) - String orchestrationStatus = utils.getNodeText(siData,"orchestration-status") - - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - msoLogger.debug("SI Data relationship-list exists:") - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - - NodeList nodeList = serviceXml.getElementsByTagName("relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() - if(e.equals("generic-vnf") || e.equals("l3-network") || e.equals("allotted-resource") ){ - msoLogger.debug("ServiceInstance still has relationship(s) to generic-vnfs, l3-networks or allotted-resources") - execution.setVariable("siInUse", true) - //there are relationship dependencies to this Service Instance - msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - }else{ - msoLogger.debug("Relationship NOT related to OpenStack") - } - } - } - } + execution.setVariable("serviceRole", si.getServiceRole()) - if ("TRANSPORT".equalsIgnoreCase(serviceType)) - { - if ("PendingDelete".equals(orchestrationStatus)) - { + if("TRANSPORT".equalsIgnoreCase(serviceType)){ + if("PendingDelete".equals(orchestrationStatus)){ execution.setVariable("skipDeactivate", true) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status: " + orchestrationStatus) } - else - { - msg = "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status:" + orchestrationStatus - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - } - //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: "" - msoLogger.debug("SDNC SI serviceTypes:" + svcTypes) List<String> svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); boolean isSdncService= false - for (String listEntry : svcList){ - if (listEntry.equalsIgnoreCase(serviceType)){ + for(String listEntry : svcList){ + if(listEntry.equalsIgnoreCase(serviceType)){ isSdncService = true break; } } - - //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW - //Alacartes are sent to SDNC if they are listed in config variable above execution.setVariable("sendToSDNC", true) - if(execution.getVariable("sdncVersion").equals("1610")) //alacarte - { + if(execution.getVariable("sdncVersion").equals("1610")){ if(!isSdncService){ execution.setVariable("sendToSDNC", false) } } - msoLogger.debug("isSdncService: " + isSdncService) - msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC")) - msoLogger.debug("Service Type: " + execution.getVariable("serviceType")) - + }else{ + execution.setVariable("siInUse", true) + msoLogger.debug("Stopped deleting Service Instance, it has dependencies") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Stopped deleting Service Instance, it has dependencies") } }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(succInAAI != true){ - msoLogger.debug("Error getting Service-instance from AAI", + serviceInstanceId) - WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - msoLogger.debug("Service-instance NOT found in AAI. Silent Success") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "ServiceInstance not found in aai") } - } catch (BpmnError e) { + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteServiceInstance.postProcessAAIGET. " + ex.getMessage() + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit postProcessAAIGET ") } /** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 0069bf4f0a..0069bf4f0a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index b41b74e509..b41b74e509 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 1024fc57da..1024fc57da 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index b1cef477be..b1cef477be 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy index 699e9bf40a..699e9bf40a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index d448dd3e79..d448dd3e79 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy index 41d9384f52..41d9384f52 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index e06e5238c6..e06e5238c6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 5fb6a9df9a..cb50fbbee6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -53,7 +53,7 @@ import groovy.json.* * @param - serviceDecomposition_Original * @param - addResourceList * @param - delResourceList - * + * * Outputs: * @param - rollbackData (localRB->null) * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) @@ -63,15 +63,15 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DUPDSI_" private static final String DebugFlag = "isDebugEnabled" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled) - - String msg = "" + + String msg = "" try { execution.setVariable("prefix", Prefix) @@ -79,11 +79,11 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { //for AAI GET & PUT & SDNC assignToplology String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) - + //for AAI PUT & SDNC assignTopology String serviceType = execution.getVariable("serviceType") utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) - + //for SDNC assignTopology String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId @@ -92,14 +92,14 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + if (isBlank(serviceType)) { msg = "Input serviceType is null" utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - - //Generated in parent for AAI + + //Generated in parent for AAI String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" @@ -108,21 +108,21 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { } String serviceInstanceName = execution.getVariable("serviceInstanceName") - + // user params String uuiRequest = execution.getVariable("uuiRequest") - + // target model Invariant uuid String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) - + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) + // target model uuid String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") execution.setVariable("modelUuid", modelUuid) - + utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -130,10 +130,10 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) + utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled) } - + public void preInitResourcesOperStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -161,7 +161,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { for(Resource resource : resourceList){ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } - + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) @@ -189,34 +189,34 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) } - utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } - + public void preProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "create") - + execution.setVariable("hasResourcetoAdd", false) List<Resource> addResourceList = execution.getVariable("addResourceList") if(addResourceList != null && !addResourceList.isEmpty()) { - execution.setVariable("hasResourcetoAdd", true) + execution.setVariable("hasResourcetoAdd", true) } - + utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled) } public void postProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "update") utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled) } - + public void preProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled) @@ -232,7 +232,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { if(hasResourcetoDelete) { def jsonSlurper = new JsonSlurper() - String serviceRelationShip = execution.getVariable("serviceRelationShip") + String serviceRelationShip = execution.getVariable("serviceRelationShip") List relationShipList = jsonSlurper.parseText(serviceRelationShip) //Set the real resource instance id to the decomosed resource list @@ -249,7 +249,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { } } } - + execution.setVariable("deleteResourceList", delResourceList) utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) @@ -258,60 +258,13 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { public void postProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "update") utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled) - } - - public void preProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - } - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { - execution.setVariable("serviceInstanceVersion", utils.getNodeText(aaiService, "resource-version")) - utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoUpdateE2EServiceInstance.postProcessAAIGET " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) - } + } - public void preProcessAAIPUT(DelegateExecution execution) { + public void preProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -321,7 +274,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion") //execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) - + //requestDetails.modelInfo.for AAI PUT servieInstanceData //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData String serviceInstanceName = execution.getVariable("serviceInstanceName") @@ -334,7 +287,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { AaiUtil aaiUriUtil = new AaiUtil(this) - utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) + utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -349,7 +302,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { <service-role>${MsoUtils.xmlEscape(aaiServiceRole)}</service-role> <resource-version>${MsoUtils.xmlEscape(serviceInstanceVersion)}</resource-version> <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id> - <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id> + <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id> </service-instance>""".trim() execution.setVariable("serviceInstanceData", serviceInstanceData) @@ -357,10 +310,10 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.logAudit(serviceInstanceData) utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled) utils.log("INFO", " 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - + utils.log("INFO", "Exited " + method, isDebugEnabled) - } - + } + public void postProcessAAIPUT(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) @@ -397,13 +350,13 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) - } + } public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) try { - + Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { @@ -441,11 +394,11 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) } - + public void postConfigRequest(execution){ //now do noting } - + } - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy index a2d94baaed..257142e8bd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,9 +29,9 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MsoLogger - +import org.onap.so.bpmn.common.scripts.ExceptionUtil; import groovy.json.* - +import org.onap.so.bpmn.common.scripts.AaiUtil; /** * This groovy class supports the <class>DoUpdateE2EServiceInstanceRollback.bpmn</class> process. @@ -67,13 +67,13 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce execution.setVariable("rollbackAAI",false) execution.setVariable("rollbackAdded",false) execution.setVariable("rollbackDeleted",false) - + List addResourceList = execution.getVariable("addResourceList") List delResourceList = execution.getVariable("delResourceList") execution.setVariable("addResourceList_o", addResourceList) execution.setVariable("delResourceList_o", delResourceList) //exchange add and delete resource list - execution.setVariable("addResourceList", delResourceList) + execution.setVariable("addResourceList", delResourceList) execution.setVariable("delResourceList", addResourceList) try { @@ -103,14 +103,14 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce { execution.setVariable("rollbackAdded", true) } - + def rollbackDeleted = rollbackData.get("SERVICEINSTANCE", "rollbackDeleted") if ("true".equals(rollbackDeleted)) { execution.setVariable("rollbackDeleted", true) - } + } - if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackAdded") != true + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackAdded") != true && execution.getVariable("rollbackDeleted") != true) { execution.setVariable("skipRollback", true) @@ -148,7 +148,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce boolean rollbackAAI = execution.getVariable("rollbackAAI") boolean rollbackAdded = execution.getVariable("rollbackAdded") boolean rollbackDeleted = execution.getVariable("rollbackDeleted") - + List addResourceList = execution.getVariable("addResourceList_o") List delResourceList = execution.getVariable("delResourceList_o") execution.setVariable("addResourceList", addResourceList) @@ -177,66 +177,21 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce msoLogger.debug(msg) } } - - + + public void preProcessForAddResource(DelegateExecution execution) { } public void postProcessForAddResource(DelegateExecution execution) { } - + public void preProcessForDeleteResource(DelegateExecution execution) { } public void postProcessForDeleteResource(DelegateExecution execution) { - } - - public void preProcessAAIGET(DelegateExecution execution) { - } - - public void postProcessAAIGET(DelegateExecution execution) { - msoLogger.trace("postProcessAAIGET ") - String msg = "" - - try { - String serviceInstanceName = execution.getVariable("serviceInstanceName") - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET", + serviceInstanceName) - WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - else - { - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - if(foundInAAI){ - String aaiService = execution.getVariable("GENGS_service") - if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "resource-version"))) { - execution.setVariable("serviceInstanceVersion_n", utils.getNodeText(aaiService, "resource-version")) - msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName")) - } - } - } - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - msg = "Exception in DoCreateServiceInstance.postProcessAAIGET " + ex.getMessage() - msoLogger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.trace("Exit postProcessAAIGET ") - } + } - public void preProcessAAIPUT(DelegateExecution execution) { + public void preProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' msoLogger.info("Entered " + method) String msg = "" @@ -244,7 +199,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n") // execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) - + //requestDetails.modelInfo.for AAI PUT servieInstanceData //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData String serviceInstanceName = execution.getVariable("serviceInstanceName") @@ -255,7 +210,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("model-version-id-original") - //AAI PUT + //AAI PUT AaiUtil aaiUriUtil = new AaiUtil(this) utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) @@ -271,7 +226,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce <service-role>${MsoUtils.xmlEscape(aaiServiceRole)}</service-role> <resource-version>${MsoUtils.xmlEscape(serviceInstanceVersion)}</resource-version> <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id> - <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id> + <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id> </service-instance>""".trim() execution.setVariable("serviceInstanceData", serviceInstanceData) @@ -279,10 +234,10 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce msoLogger.debug(serviceInstanceData) msoLogger.info(" aai_uri " + aai_uri + " namespace:" + namespace) msoLogger.info(" 'payload' to update Service Instance in AAI - " + "\n" + serviceInstanceData) - + msoLogger.info("Exited " + method) - } - + } + public void postProcessAAIPUT(DelegateExecution execution) { msoLogger.trace("postProcessAAIPUT ") String msg = "" @@ -299,7 +254,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce } else { - + } } catch (BpmnError e) { @@ -310,7 +265,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } msoLogger.trace("Exit postProcessAAIPUT ") - } + } public void processRollbackException(DelegateExecution execution){ msoLogger.trace("processRollbackException ") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 7272f421fc..4f6fbf9966 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,6 +37,15 @@ import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse import org.springframework.web.util.UriUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException + import groovy.json.* import groovy.xml.XmlUtil @@ -46,7 +55,7 @@ import groovy.xml.XmlUtil */ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstance.class); - + String Prefix="UPDNETI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() @@ -109,7 +118,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "networkTableRefUriList", null) execution.setVariable(Prefix + "networkTableRefCount", 0) execution.setVariable(Prefix + "tableRefCollection", "") - + // AAI requery Id execution.setVariable(Prefix + "requeryIdAAIRequest","") execution.setVariable(Prefix + "requeryIdAAIResponse", "") @@ -137,9 +146,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "isVnfBindingPresent", false) execution.setVariable(Prefix + "Success", false) execution.setVariable(Prefix + "serviceInstanceId", "") - + execution.setVariable(Prefix + "isException", false) - + } // ************************************************** @@ -158,7 +167,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { try { // initialize flow variables InitializeProcessVariables(execution) - + // GET Incoming request & validate 3 kinds of format. execution.setVariable("action", "UPDATE") String networkRequest = execution.getVariable("bpmnRequest") @@ -169,7 +178,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson) networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) - + } catch (Exception ex) { String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() msoLogger.debug(dataErrorMessage) @@ -177,27 +186,27 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } else { // XML format request is sent - + } } else { // vIPR format request is sent, create xml from individual variables networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) } - + networkRequest = utils.formatXml(networkRequest) msoLogger.debug(networkRequest) execution.setVariable(Prefix + "networkRequest", networkRequest) msoLogger.debug(" network-request - " + '\n' + networkRequest) - + // validate 'disableRollback' (aka, 'suppressRollback') boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled) - + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") execution.setVariable(Prefix + "networkInputs", networkInputs) msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs) - + // prepare messageId String messageId = execution.getVariable(Prefix + "messageId") // for testing if (messageId == null || messageId == "") { @@ -207,11 +216,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(" UPDNETI_messageId, pre-assigned: " + messageId) } execution.setVariable(Prefix + "messageId", messageId) - + String source = utils.getNodeText(networkRequest, "source") execution.setVariable(Prefix + "source", source) msoLogger.debug(Prefix + "source - " + source) - + String networkId = "" if (utils.nodeExists(networkRequest, "network-id")) { networkId = utils.getNodeText(networkRequest, "network-id") @@ -221,10 +230,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String dataErrorMessage = "Variable 'network-id' value/element is missing." msoLogger.debug(" Invalid Request - " + dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - + } } - + String lcpCloudRegion = "" if (utils.nodeExists(networkRequest, "aic-cloud-region")) { lcpCloudRegion = utils.getNodeText(networkRequest, "aic-cloud-region") @@ -235,7 +244,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } - + String serviceInstanceId = "" if (utils.nodeExists(networkRequest, "service-instance-id")) { serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id") @@ -246,35 +255,33 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } - + // PO Authorization Info / headers Authorization= String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution) - + try { def encodedString = utils.getBasicAuth(basicAuthValuePO, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValuePO",encodedString) execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - + } catch (IOException ex) { String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() msoLogger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - + // Set variables for Generic Get Sub Flow use execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId) - - execution.setVariable("GENGS_type", "service-instance") - msoLogger.debug("GENGS_type - " + "service-instance") + msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution)) - + String sdncVersion = execution.getVariable("sdncVersion") msoLogger.debug("sdncVersion? : " + sdncVersion) - - // build 'networkOutputs' + + // build 'networkOutputs' networkId = utils.getNodeText(networkRequest, "network-id") if ((networkId == null) || (networkId == "null")) { networkId = "" @@ -292,7 +299,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs) execution.setVariable(Prefix + "networkId", networkId) execution.setVariable(Prefix + "networkName", networkName) - + } catch (BpmnError e) { throw e; @@ -307,6 +314,31 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } + /** + * Gets the service instance uri from aai + * + */ + public void getServiceInstance(DelegateExecution execution) { + msoLogger.trace("getServiceInstance ") + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(!resourceClient.exists(uri)){ + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Service Instance not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { execution.setVariable("prefix", Prefix) @@ -383,7 +415,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String returnCode = response.getStatusCode() execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) msoLogger.debug(" ***** AAI Response Code : " + returnCode) - + String aaiResponseAsString = response.getResponseBodyAsString() if (returnCode=='200') { @@ -462,12 +494,12 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String netName = utils.getNodeText(aaiResponseAsString, "network-name") String networkOutputs = """<network-outputs> - <network-id>${MsoUtils.xmlEscape(netId)}</network-id> + <network-id>${MsoUtils.xmlEscape(netId)}</network-id> <network-name>${MsoUtils.xmlEscape(netName)}</network-name> </network-outputs>""" execution.setVariable(Prefix + "networkOutputs", networkOutputs) msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs) - + } else { if (returnCode=='404') { String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." @@ -866,13 +898,13 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." msoLogger.debug(dataErrorMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - + } else { if (aaiResponseAsString.contains("RESTFault")) { WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) execution.setVariable("WorkflowException", exceptionObject) throw new BpmnError("MSOWorkflowException") - + } else { // aai all errors String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode @@ -908,7 +940,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } catch (BpmnError e) { throw e; - + } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() msoLogger.debug(exceptionMessage) @@ -917,7 +949,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } - + public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { execution.setVariable("prefix", Prefix) @@ -953,7 +985,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payload) String returnCode = response.getStatusCode() String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() - + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) msoLogger.debug(" ***** AAI Update Contrail Response Code : " + returnCode) @@ -1015,7 +1047,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String queryIdResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") - + // Prepare Network request String routeCollection = execution.getVariable(Prefix + "routeCollection") String policyCollection = execution.getVariable(Prefix + "networkCollection") @@ -1057,7 +1089,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if (networkId == null) {networkId = ""} String serviceInstanceId = utils.getNodeText(updateNetworkInput, "service-instance-id") - + String queryAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse") // 1. prepare assign topology via SDNC Adapter SUBFLOW call @@ -1078,7 +1110,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - + // ************************************************** @@ -1212,7 +1244,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "Success", true) msoLogger.debug(" ***** postProcessResponse(), GOOD !!!") } else { - execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "Success", false) execution.setVariable("rollbackData", null) String exceptionMessage = " Exception encountered in MSO Bpmn. " if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. @@ -1223,18 +1255,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { if (execution.getVariable(Prefix + "WorkflowException") != null) { WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") exceptionMessage = pwfex.getErrorMessage() - } + } } // going to the Main flow: a-la-carte or macro msoLogger.debug(" ***** postProcessResponse(), BAD !!!") exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) throw new BpmnError("MSOWorkflowException") } - + } catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() @@ -1253,7 +1285,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ") try { - // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. + // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) // get variables String sdncCallback = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) @@ -1282,11 +1314,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { public void prepareRollbackData(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ") - + try { - + Map<String, String> rollbackData = new HashMap<String, String>(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") if (rollbackSDNCRequest != null) { @@ -1302,33 +1334,33 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } execution.setVariable("rollbackData", rollbackData) msoLogger.debug("** rollbackData : " + rollbackData) - + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException")) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } - + public void prepareSuccessRollbackData(DelegateExecution execution) { execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ") - + try { - + if (execution.getVariable("sdncVersion") != '1610') { // skip: 1702 for 'changeassign' or equivalent not yet defined in SNDC, so no rollback. } else { prepareSDNCRollbackRequest(execution) } - + Map<String, String> rollbackData = new HashMap<String, String>(); String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") if (rollbackSDNCRequest != null) { @@ -1343,43 +1375,43 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } execution.setVariable("rollbackData", rollbackData) - + msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData) execution.setVariable("WorkflowException", null) - + } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - + } - + } - + public void setExceptionFlag(DelegateExecution execution){ execution.setVariable("prefix",Prefix) - + msoLogger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ") - + try { - + execution.setVariable(Prefix + "isException", true) - + if (execution.getVariable("SavedWorkflowException1") != null) { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) } else { execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) } msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException")) - + } catch(Exception ex){ String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() msoLogger.debug(exceptionMessage) exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } - + } @@ -1396,7 +1428,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { msoLogger.debug("Variables List: " + execution.getVariables()) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") - + }catch(Exception e){ msoLogger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy index 8a13b3c392..8a13b3c392 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index 451e0293ef..451e0293ef 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 34a73bd35c..6b42406883 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -304,19 +304,22 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") List<ModuleResource> moduleResources = vnfResource.getVfModules() - for (j in 0..moduleResources.size()-1) { - ModelInfo modelInfo = moduleResources[j].getModelInfo() - String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() - msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) - - if (modelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { - String vfModuleModelInfo = modelInfo.toJsonString() - String vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo") - execution.setVariable("DUVAM_vfModuleModelInfo", vfModuleModelInfoValue) - msoLogger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue) - break + if (moduleResources != null && !moduleResources.isEmpty()) { + + for (j in 0..moduleResources.size()-1) { + ModelInfo modelInfo = moduleResources[j].getModelInfo() + String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() + msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition) + + if (modelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { + String vfModuleModelInfo = modelInfo.toJsonString() + String vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo") + execution.setVariable("DUVAM_vfModuleModelInfo", vfModuleModelInfoValue) + msoLogger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue) + break + } + } - } }catch(Exception e){ diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy index 4deb53f0ce..4deb53f0ce 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 8673ee7662..8673ee7662 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy index d729c770ca..d729c770ca 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 3a309cf5a2..3a309cf5a2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 538f882c2b..ac8e506e1f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,17 +22,25 @@ package org.onap.so.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.NotFoundException + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.springframework.web.util.UriUtils import groovy.json.* @@ -68,7 +76,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor msg = "Input serviceInstanceId' is null" exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - + //subscriberInfo for aai String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") if (isBlank(globalSubscriberId)) { @@ -86,16 +94,16 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor if (isBlank(productFamilyId)) { msg = "Input productFamilyId is null" - utils.log("INFO", msg, isDebugEnabled) + utils.log("INFO", msg, isDebugEnabled) } else { execution.setVariable("productFamilyId", productFamilyId) } - + //user params - String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") + String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") utils.log("INFO", "userParams:" + userParams, isDebugEnabled) List<String> paramList = jsonUtil.StringArrayToList(execution, userParams) - String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") + String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") if (isBlank(uuiRequest)) { msg = "Input uuiRequest is null" utils.log("INFO", msg, isDebugEnabled) @@ -116,34 +124,34 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } else { execution.setVariable("serviceType", serviceType) } - + // target model info String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled) execution.setVariable("modelInvariantUuid", modelInvariantUuid) execution.setVariable("model-invariant-id-target", modelInvariantUuid) - + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled) execution.setVariable("modelUuid", modelUuid) execution.setVariable("model-version-id-target", modelUuid) - + String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName") utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled) if(serviceModelName == null) { serviceModelName = "" } - execution.setVariable("serviceModelName", serviceModelName) - + execution.setVariable("serviceModelName", serviceModelName) + //operationId String operationId = jsonUtil.getJsonValue(siRequest, "operationId") if (isBlank(operationId)) { operationId = UUID.randomUUID().toString() - } - execution.setVariable("operationId", operationId) + } + execution.setVariable("operationId", operationId) execution.setVariable("operationType", "update") execution.setVariable("hasResourcetoUpdate", false) - + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") } catch (BpmnError e) { @@ -155,164 +163,69 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } - - - public void postProcessAAIGET(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) - String msg = "" + /** + * Gets the service instance and its relationships from aai + */ + public void getServiceInstance(DelegateExecution execution) { try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ - utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) - - String siData = execution.getVariable("GENGS_service") - utils.log("INFO", "SI Data", isDebugEnabled) - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - utils.log("INFO", "SI Data" + siData, isDebugEnabled) - - // serviceInstanceName - String serviceInstanceName = execution.getVariable("serviceInstanceName") - if(isBlank(serviceInstanceName) && utils.nodeExists(siData, "service-instance-name")) { - serviceInstanceName = utils.getNodeText(siData, "service-instance-name") - execution.setVariable("serviceInstanceName", serviceInstanceName) - } - - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled) - - def modelInvariantId = utils.getNodeText(siData, "model-invariant-id") - def modelVersionId = utils.getNodeText(siData, "model-version-id") - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - - //get related service instances (vnf/network or volume) for delete - if (utils.nodeExists(siData, "relationship-list")) { - utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled) - - JSONArray jArray = new JSONArray() - - XmlParser xmlParser = new XmlParser() - Node root = xmlParser.parseText(siData) - def relation_list = utils.getChildNode(root, 'relationship-list') - def relationships = utils.getIdenticalChildren(relation_list, 'relationship') - - for (def relation: relationships) { - def jObj = getRelationShipData(relation, isDebugEnabled) - jArray.put(jObj) - } - - execution.setVariable("serviceRelationShip", jArray.toString()) - } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) - WorkflowException workflowException = execution.getVariable("WorkflowException") - utils.logAudit("workflowException: " + workflowException) - if(workflowException != null){ - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else - { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) - } - } - - utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) - } - }catch (BpmnError e) { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + + ServiceInstance si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("serviceInstanceName", si.getServiceInstanceName()) + execution.setVariable("model-invariant-id-original", si.getModelInvariantId()) + execution.setVariable("model-version-id-original", si.getModelVersionId()) + + JSONObject ob = new JSONObject(wrapper.getJson()) + JSONArray ar = ob.getJSONObject("relationship-list").getJSONArray("relationship") + + execution.setVariable("serviceRelationShip", ar.toString()) + + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) + }catch(NotFoundException e) { + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service-instance does not exist AAI") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - - private JSONObject getRelationShipData(node, isDebugEnabled){ - JSONObject jObj = new JSONObject() - - def relation = utils.nodeToString(node) - def rt = utils.getNodeText(relation, "related-to") - - def rl = utils.getNodeText(relation, "related-link") - utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled) - - def rl_datas = utils.getIdenticalChildren(node, "relationship-data") - for(def rl_data : rl_datas) { - def eKey = utils.getChildNodeText(rl_data, "relationship-key") - def eValue = utils.getChildNodeText(rl_data, "relationship-value") - - if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-id"))){ - jObj.put("resourceInstanceId", eValue) - } - } - - def rl_props = utils.getIdenticalChildren(node, "related-to-property") - for(def rl_prop : rl_props) { - def eKey = utils.getChildNodeText(rl_prop, "property-key") - def eValue = utils.getChildNodeText(rl_prop, "property-value") - if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ - jObj.put("resourceType", eValue) - } - } - - utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled) - return jObj - } - - public void preCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void postCompareModelVersions(DelegateExecution execution) { + public void postCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " ======== STARTED postCompareModelVersions Process ======== ", isDebugEnabled) - + def hasResourcetoUpdate = false def hasResourcetoAdd = false def hasResourcetoDelete = false List<Resource> addResourceList = execution.getVariable("addResourceList") List<Resource> delResourceList = execution.getVariable("delResourceList") - + if(addResourceList != null && !addResourceList.isEmpty()) { hasResourcetoAdd = true } - + if(delResourceList != null && !delResourceList.isEmpty()) { hasResourcetoDelete = true } - + hasResourcetoUpdate = hasResourcetoAdd || hasResourcetoDelete execution.setVariable("hasResourcetoUpdate", hasResourcetoUpdate) - - utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) + + utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled) } - + /** * Init the service Operation Status */ @@ -367,28 +280,28 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) } - + /** * Update the service Operation Status */ - public void preUpdateServiceOperationStatus(DelegateExecution execution){ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) - + try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") String operationType = execution.getVariable("operationType") String serviceName = execution.getVariable("serviceInstanceName") - String result = execution.getVariable("operationResult") + String result = execution.getVariable("operationResult") String progress = execution.getVariable("progress") String reason = execution.getVariable("operationReason") String userId = "" utils.log("INFO", "progress: " + progress , isDebugEnabled) String operationContent = "Prepare service : " + execution.getVariable("operationStatus") - + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) @@ -421,7 +334,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled) - + }catch(Exception e){ utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) @@ -429,7 +342,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled) utils.log("INFO", "Exited " + method, isDebugEnabled) - } + } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -438,7 +351,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor try { String operationId = execution.getVariable("operationId") def hasResourcetoUpdate = execution.getVariable("hasResourcetoUpdate") - + String updateServiceResp = "" if(hasResourcetoUpdate) { // RESTResponse for API Handler (APIH) Reply Task @@ -447,7 +360,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor else { updateServiceResp = """{"OperationResult":"No Resource to Add or Delete or Service Instance not found in AAI."}""" } - + utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled) sendWorkflowResponse(execution, 202, updateServiceResp) execution.setVariable("sentSyncResponse", true) @@ -498,7 +411,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor String requestId = execution.getVariable("msoRequestId") String serviceInstanceId = execution.getVariable("serviceInstanceId") String source = execution.getVariable("source") - + String msoCompletionRequest = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns="http://org.onap/so/request/types/v1"> @@ -566,5 +479,5 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("falloutRequest", falloutRequest) } utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy index 329d58aa58..329d58aa58 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy index b1aaf5ea5f..b1aaf5ea5f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy index 416d0d6e60..416d0d6e60 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy index a926030924..a926030924 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index b7f31d7823..b7f31d7823 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 7b2d1b78e4..7b2d1b78e4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy index f251dc46f8..f251dc46f8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index fd9d9cc8a3..fd9d9cc8a3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy index 8ca2871916..8ca2871916 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index 68d5c19b80..68d5c19b80 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 86c5f65e8c..86c5f65e8c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index eaf3631441..85993d6c92 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,6 +33,14 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import javax.ws.rs.NotFoundException +import org.json.JSONObject import static org.apache.commons.lang3.StringUtils.isBlank @@ -100,7 +108,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String dataErrorMessage = " Element 'serviceInstanceId' is missing. " exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - + String requestAction = execution.getVariable("requestAction") execution.setVariable("requestAction", requestAction) @@ -117,20 +125,20 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("globalSubscriberId", globalSubscriberId) execution.setVariable("globalCustomerId", globalSubscriberId) - + String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("disableRollback", suppressRollback) msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) - + String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) - + // extract subscriptionServiceType String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") execution.setVariable("subscriptionServiceType", subscriptionServiceType) msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) - + // extract cloud configuration String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration") execution.setVariable("cloudConfiguration", cloudConfiguration) @@ -145,7 +153,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String sdncVersion = "1707" execution.setVariable("sdncVersion", sdncVersion) msoLogger.debug("sdncVersion: "+ sdncVersion) - + //For Completion Handler & Fallout Handler String requestInfo = """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> @@ -155,10 +163,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { </request-info>""" execution.setVariable(Prefix+"requestInfo", requestInfo) - - //Setting for Generic Sub Flows - execution.setVariable("GENGS_type", "service-instance") - + msoLogger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") } catch (BpmnError e) { @@ -189,120 +194,87 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - public void prepareServiceDelete(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside prepareServiceDelete() of DeleteVcpeResCustService ") - + /** + * Gets the service instance and its related resources from aai + * + * @author cb645j + */ + public void getServiceInstance(DelegateExecution execution) { try { - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // confirm if ServiceInstance was found - if ( !execution.getVariable("GENGS_FoundIndicator") ) - { - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - // get variable within incoming json - String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest"); - - // get SI extracted by GenericGetService - String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); - - msoLogger.debug("serviceInstanceAaiRecord: "+serviceInstanceAaiRecord) - serviceInstanceAaiRecord = utils.removeXmlNamespaces(serviceInstanceAaiRecord) - - def (TXC_found, TXC_id) = new Tuple(false, null) - def (BRG_found, BRG_id) = new Tuple(false, null) - List relatedVnfIdList = [] - - for(Node rel: utils.getMultNodeObjects(serviceInstanceAaiRecord, "relationship")) { - def relto = utils.getChildNodeText(rel, "related-to") - def relink = utils.getChildNodeText(rel, "related-link") - msoLogger.debug("check: "+relto+" link: "+relink) - - if(isBlank(relto) || isBlank(relink)) { - - } else if(relto == "generic-vnf") { - def id = relink.substring(relink.indexOf("/generic-vnf/")+13) - if(id.endsWith("/")) { - id = id.substring(0, id.length()-1) + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + AAIResultWrapper wrapper = resourceClient.get(uri, NotFoundException.class) + Optional<Relationships> relationships = wrapper.getRelationships() + + def (TXC_found, TXC_id) = new Tuple(false, null) + def (BRG_found, BRG_id) = new Tuple(false, null) + List relatedVnfIdList = [] + + if(relationships.isPresent()){ + + List<AAIResourceUri> vnfUris = relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF) + for(AAIResourceUri u:vnfUris){ + Map<String, String> keys = u.getURIKeys() + String vnfId = keys.get("vnf-id") + relatedVnfIdList.add(vnfId) } - - relatedVnfIdList.add(id) - - } else if(relto == "allotted-resource") { - def (type, id) = getAaiAr(execution, relink) - - if(isBlank(type) || isBlank(id)) { - - } else if(type == "TunnelXConn" || type == "Tunnel XConn") { - msoLogger.debug("TunnelXConn AR found") - TXC_found = true - TXC_id = id - - } else if(type == "BRG") { - msoLogger.debug("BRG AR found") - BRG_found = true - BRG_id = id + List<AAIResourceUri> arUris = relationships.get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) + for(AAIResourceUri u:arUris){ + String ar = resourceClient.get(u).getJson() + + def type = jsonUtil.getJsonValue(ar, "type") + def id = jsonUtil.getJsonValue(ar, "id") + + if(type == "TunnelXConn" || type == "Tunnel XConn") { + msoLogger.debug("TunnelXConn AR found") + TXC_found = true + TXC_id = id + + }else if(type == "BRG") { + msoLogger.debug("BRG AR found") + BRG_found = true + BRG_id = id + } + + execution.setVariable(Prefix+"TunnelXConn", TXC_found) + execution.setVariable("TXC_allottedResourceId", TXC_id) + msoLogger.debug("TXC_allottedResourceId: " + TXC_id) + + execution.setVariable(Prefix+"BRG", BRG_found) + execution.setVariable("BRG_allottedResourceId", BRG_id) + msoLogger.debug("BRG_allottedResourceId: " + BRG_id) + } } + + execution.setVariable(Prefix+"vnfsCount", relatedVnfIdList.size()) + if(relatedVnfIdList.size() > 0) { + execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList) + } + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } - - execution.setVariable(Prefix+"TunnelXConn", TXC_found) - execution.setVariable("TXC_allottedResourceId", TXC_id) - msoLogger.debug("TXC_allottedResourceId: " + TXC_id) - - execution.setVariable(Prefix+"BRG", BRG_found) - execution.setVariable("BRG_allottedResourceId", BRG_id) - msoLogger.debug("BRG_allottedResourceId: " + BRG_id) - - int vnfsCount = relatedVnfIdList.size() - execution.setVariable(Prefix+"vnfsCount", vnfsCount) - msoLogger.debug(" "+Prefix+"vnfsCount : " + vnfsCount) - if(vnfsCount > 0) { - execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList) - } - - msoLogger.trace("Completed prepareServiceDelete() of DeleteVcpeResCustService ") - } catch (BpmnError e){ + + }catch(BpmnError e) { throw e; - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceDelete() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - private getAaiAr(DelegateExecution execution, String relink) { - def isDebugEnabled = execution.getVariable(DebugFlag) - AaiUtil aaiUtil = new AaiUtil(this) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint",execution) + relink - - msoLogger.debug("get AR info " + aaiEndpoint) - APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint) - - int responseCode = response.getStatusCode() - msoLogger.debug("get AR info responseCode:" + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - msoLogger.debug("get AR info " + aaiResponse) - - if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) { - return new Tuple2(null, null) + }catch(NotFoundException e) { + msoLogger.debug("Service Instance does not exist AAI") + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai") + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - - def type = utils.getNodeText(aaiResponse, "type") - def id = utils.getNodeText(aaiResponse, "id") - - return new Tuple2(type, id) } - - + + // ******************************* - // + // // ******************************* public void prepareVnfAndModulesDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) @@ -316,7 +288,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { if (vnfList.size() > 0 ) { vnfId = vnfList.get(vnfsDeletedCount.intValue()) } - + execution.setVariable("vnfId", vnfId) msoLogger.debug("need to delete vnfId:" + vnfId) @@ -327,7 +299,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } - + // ******************************* // Validate Vnf request Section -> increment count // ******************************* @@ -338,9 +310,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { try { int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") vnfsDeletedCount++ - + execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount) - + msoLogger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) } catch (Exception ex) { // try error in method block @@ -349,7 +321,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - + // ***************************************** // Prepare Completion request Section // ***************************************** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 8a8aa2b2ad..3c08779513 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,12 +37,19 @@ import static org.apache.commons.lang3.StringUtils.* import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.Relationships +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.json.JSONObject +import javax.ws.rs.NotFoundException /** * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process. * * @author - * + * * Inputs: * @param - msoRequestId * @param - isDEbugLogEnabled @@ -57,15 +64,15 @@ import org.onap.so.logger.MsoLogger * @param - allottedResourceRole * @param - allottedResourceType * @param - brgWanMacAddress - * @param - vni - * @param - vgmuxBearerIP + * @param - vni + * @param - vgmuxBearerIP * * Outputs: * @param - rollbackData (localRB->null) * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) * @param - WorkflowException - O * @param - allottedResourceId - * @param - allottedResourceName + * @param - allottedResourceName * */ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ @@ -155,6 +162,33 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ msoLogger.trace("end preProcessRequest") } + /** + * Gets the service instance uri from aai + */ + public void getServiceInstance(DelegateExecution execution) { + msoLogger.trace("getServiceInstance ") + try { + String serviceInstanceId = execution.getVariable('serviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + + if(resourceClient.exists(uri)){ + execution.setVariable("CSI_resourceLink", uri.build().toString()) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit getServiceInstance ") + } + public void getAaiAR (DelegateExecution execution) { @@ -193,6 +227,39 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ msoLogger.trace("end getAaiAR") } + public void getParentServiceInstance(DelegateExecution execution) { + msoLogger.trace("getParentServiceInstance ") + try { + String serviceInstanceId = execution.getVariable('parentServiceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.NODES_QUERY, "").queryParam("search-node-type", "service-instance").queryParam("filter", "service-instance-id:EQUALS:" + serviceInstanceId) + String json = resourceClient.get(uri).getJson() + + JSONObject obj = new JSONObject(json) + if(obj.has("result-data")){ + JSONObject ob = obj.getJSONArray("result-data").getJSONObject(0) + String resourceLink = ob.getString("resource-link") + + String[] split = resourceLink.split("/aai/") + String siRelatedLink = "/aai/" + split[1] + + execution.setVariable("PSI_resourceLink", resourceLink) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") + } + + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "Exception in getParentServiceInstance. " + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.trace("Exit getParentServiceInstance ") + } + + public void createAaiAR(DelegateExecution execution) { @@ -387,9 +454,9 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id> </service-information> <allotted-resource-information> - <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id> + <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id> <allotted-resource-type>brg</allotted-resource-type> - <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id> + <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id> <onap-model-information> <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid> <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid> @@ -575,7 +642,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String sdncRequestId = UUID.randomUUID().toString() - + //neeed the same url as used by vfmodules String SDNCGetRequest = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" @@ -600,7 +667,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ } msoLogger.trace("end preProcessSDNCGet") } - + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ msoLogger.trace("start updateAaiAROrchStatus") @@ -609,7 +676,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) msoLogger.trace("end updateAaiAROrchStatus") } - + public void generateOutputs(DelegateExecution execution) { @@ -619,7 +686,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ msoLogger.debug("resp:" + sdncGetResponse) String arData = utils.getNodeXml(sdncGetResponse, "brg-topology") arData = utils.removeXmlNamespaces(arData) - + String brga = utils.getNodeXml(arData, "brg-assignments") String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) @@ -630,7 +697,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ msoLogger.debug(msg) } msoLogger.trace("end generateOutputs") - + } public void preProcessRollback (DelegateExecution execution) { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index 4d4f11c3e5..4d4f11c3e5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 5f9b4b8ecd..5f9b4b8ecd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index 24b919524f..24b919524f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index a5125fea73..a5125fea73 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index 7ce606e685..7ce606e685 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index bb490a06e4..61b1ca4cae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; @@ -30,12 +31,15 @@ public class InformDmaapClient implements JavaDelegate { private DmaapClient dmaapClient; @Override - public void execute(DelegateExecution execution) throws Exception { + public void execute(DelegateExecution execution) { String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); - dmaapClient.registerForUpdate(correlationId, () -> execution.getProcessEngineServices().getRuntimeService() + RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); + dmaapClient.registerForUpdate(correlationId, () -> + runtimeService .createMessageCorrelation("WorkflowMessage") .processInstanceBusinessKey(execution.getProcessBusinessKey()) - .correlateWithResult()); + .correlateWithResult() + ); } @Autowired diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index bd781756a5..7226feb552 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.workflow.service; +import org.json.JSONObject; import java.io.IOException; import java.net.SocketTimeoutException; import java.util.ArrayList; @@ -27,7 +28,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; - +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.ParseException; import org.apache.http.client.HttpClient; @@ -45,6 +46,7 @@ import org.apache.http.util.EntityUtils; import org.camunda.bpm.engine.runtime.Execution; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.domain.ServiceDecomposition; +import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; @@ -61,6 +63,8 @@ public class ServicePluginFactory { public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc"; public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; + + public static final String Inventory_OSS_Default_EndPoint = "http://192.168.1.199:8443/oss/inventory"; private static final int DEFAULT_TIME_OUT = 60000; @@ -77,7 +81,15 @@ public class ServicePluginFactory { } return instance; } + + private ServicePluginFactory() { + + } + + private String getInventoryOSSEndPoint(){ + return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", Inventory_OSS_Default_EndPoint); + } private String getThirdSPEndPoint(){ return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint); } @@ -86,6 +98,60 @@ public class ServicePluginFactory { return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint); } + public ServiceDecomposition doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) { + ServiceDecomposition serviceDecompositionforLocal = serviceDecomposition; + + if (isSiteLocationLocal(serviceDecomposition, uuiRequest)) { + return serviceDecomposition; + } + + List<Resource> addResourceList = serviceDecomposition.getServiceResources(); + for (Resource resource : addResourceList) { + String resourcemodelName = resource.getModelInfo().getModelName(); + if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")) { + serviceDecompositionforLocal.deleteResource(resource); + break; + } + if (!StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { + serviceDecompositionforLocal.deleteResource(resource); + break; + } + } + + return serviceDecompositionforLocal; + } + + public boolean isSiteLocationLocal(ServiceDecomposition serviceDecomposition, String uuiRequest) { + boolean isSiteLocationLocal = true; + + String serviceModelName = serviceDecomposition.getModelInfo().getModelName(); + String serviceParameters = JsonUtils.getJsonValue(uuiRequest, "service.parameters"); + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs"); + JSONObject inputParameters = new JSONObject(requestInputs); + + if(StringUtils.containsIgnoreCase(serviceModelName, "site") && inputParameters.has("location")) + { + Object location = inputParameters.get("location"); + JSONObject locationObj = new JSONObject(location); + String locationONAP = queryLocationFromInventoryOSS(locationObj); + if(StringUtils.containsIgnoreCase(locationONAP, "remote")) { + isSiteLocationLocal = false; + } + } + + return isSiteLocationLocal; + } + + private String queryLocationFromInventoryOSS(JSONObject locationObj) { + String reqContent = getJsonString(locationObj); + String url = getInventoryOSSEndPoint(); + String responseContent = sendRequest(url, "POST", reqContent); + String locationONAP = ""; + if (null != responseContent) { + locationONAP = getJsonObject(responseContent, String.class); + } + return locationONAP; + } public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy index ae40e9d7c6..ae40e9d7c6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy index da0990910a..da0990910a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericAlaCarteServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy index 4d5f506599..4d5f506599 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy index 77220da94f..77220da94f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy index 2b437d875e..2b437d875e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy index 95259e9ec0..95259e9ec0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy index b459710479..b459710479 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericAlaCarteServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy index 9b7d7ee21f..9b7d7ee21f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy index 0bce32716f..0bce32716f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy index 72f79c80d9..72f79c80d9 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy index 5ee10bc931..5ee10bc931 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 0a1f8f2859..0a1f8f2859 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy index cc6f89865f..cc6f89865f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy index 6d9d5e5356..6d9d5e5356 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy index c5c6187648..c5c6187648 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy index 30e3779b53..30e3779b53 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy index 91e7086bd3..91e7086bd3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy index 9b421d8b63..9b421d8b63 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy index bbbb82b5aa..bbbb82b5aa 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy index 5e264c0af4..5e264c0af4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollbackTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index 1a2d16d9d0..1a2d16d9d0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy index a8bdfb0633..a8bdfb0633 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy index fcb0fb0940..fcb0fb0940 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy index 3390b1a6f0..3390b1a6f0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy index 730be14df0..730be14df0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy index 0b95ffc053..0b95ffc053 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy index 4e993525f9..4e993525f9 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy index 0189d065df..0189d065df 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index de3db5b5a8..de3db5b5a8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy index beaebceaf7..beaebceaf7 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy index ba54787dc1..ba54787dc1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy index e196a62e1f..e196a62e1f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy index fd3c1e352f..fd3c1e352f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstanceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy index 620b0b787d..620b0b787d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index 523c791efc..523c791efc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy index b7c754938a..b7c754938a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy index 1e8842e68f..1e8842e68f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy index 543bb1db05..543bb1db05 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy index 66cfdb635d..66cfdb635d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy index fa40c17e63..fa40c17e63 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy index e8004d3d2b..e8004d3d2b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy index 6719be17a1..6719be17a1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy index 764e6244d4..764e6244d4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy index fa5dcec4bc..fa5dcec4bc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy index 7b50c616ea..7b50c616ea 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json index eb2d9faa2a..0a211e6b08 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json @@ -10,7 +10,7 @@ }, "requestParameters": { "payload": -"{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" +"{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index ee51ecd66e..1a3a64bcc8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -73,15 +73,15 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <executions> - <execution> + <execution> <id>default-test</id> <goals> <goal>test</goal> </goals> - <configuration> - <includes> - <include>**/AllTestsTestSuite.java</include> - </includes> + <configuration> + <includes> + <include>**/AllTestsTestSuite.java</include> + </includes> </configuration> </execution> <execution> @@ -89,23 +89,23 @@ <goals> <goal>test</goal> </goals> - <configuration> - <includes> - <include>**/AllTasksTestsTestSuite.java</include> - </includes> + <configuration> + <includes> + <include>**/AllTasksTestsTestSuite.java</include> + </includes> </configuration> </execution> <execution> - <id>bpmn-test</id> - <goals> - <goal>test</goal> - </goals> - <configuration> - <includes> - <include>**/AllBPMNTestSuites.java</include> - </includes> - </configuration> - </execution> + <id>bpmn-test</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/AllBPMNTestSuites.java</include> + </includes> + </configuration> + </execution> </executions> </plugin> </plugins> @@ -134,9 +134,14 @@ </dependency> <dependency> <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <scope>test</scope> - </dependency> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> @@ -145,18 +150,18 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> - <version>3.1.12</version> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> - <version>3.1.11</version> - </dependency> + <version>${cxf.version}</version> + </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -206,10 +211,10 @@ <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> - <version>2.0</version> + <version>${jax.ws.rs}</version> </dependency> <dependency> - <groupId>org.onap.so</groupId> + <groupId>org.onap.so</groupId> <artifactId>MSORESTClient</artifactId> <version>${project.version}</version> </dependency> @@ -243,17 +248,17 @@ <artifactId>javax.annotation-api</artifactId> <version>1.3</version> </dependency> - <dependency> - <groupId>org.onap.msb.java-sdk</groupId> - <artifactId>msb-java-sdk</artifactId> - <version>1.0.0</version> - <exclusions> - <exclusion> - <groupId>com.eclipsesource.jaxrs</groupId> - <artifactId>jersey-all</artifactId> - </exclusion> - </exclusions> - </dependency> + <dependency> + <groupId>org.onap.msb.java-sdk</groupId> + <artifactId>msb-java-sdk</artifactId> + <version>1.0.0</version> + <exclusions> + <exclusion> + <groupId>com.eclipsesource.jaxrs</groupId> + <artifactId>jersey-all</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -271,16 +276,16 @@ <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> </dependency> <dependency> - <groupId>ch.vorburger.mariaDB4j</groupId> - <artifactId>mariaDB4j</artifactId> - <version>2.2.3</version> - <scope>test</scope> - </dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <version>2.2.3</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy deleted file mode 100644 index 6e1a5dcb55..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.scripts - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.camunda.bpm.engine.runtime.Execution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.client.orchestration.AAIServiceInstanceResources -import org.onap.so.logger.MsoLogger - - -public class DoCreateServiceInstanceRollbackV2 extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceRollbackV2.class); - - @Override - public void preProcessRequest(DelegateExecution execution) { - - } - - public void aaiServiceInstanceRollback (DelegateExecution execution) { - def aaiServiceInstanceRollback = execution.getVariable("aaiServiceInstanceRollback") - if(aaiServiceInstanceRollback){ - msoLogger.trace("Started aaiServiceInstanceRollback") - try{ - ServiceDecomposition serviceDecomp = execution.getVariable("ServiceDecomposition") - AAIServiceInstanceResources aaiO = new AAIServiceInstanceResources() - aaiO.deleteServiceInstance(serviceDecomp) - }catch (Exception ex) { - String msg = "Error Response from AAI for aaiServiceInstanceRollback" - execution.setVariable("rollbackError", msg) - msoLogger.debug(msg) - throw new BpmnError("MSOWorkflowException") - } - msoLogger.trace("Completed aaiServiceInstanceRollback") - }else{ - msoLogger.trace("SKIPPING A&AI ROLLBACK") - } - } - - public void rollbackError (DelegateExecution execution) { - msoLogger.trace("rollbackError") - try{ - msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollbackV2") - }catch(BpmnError b){ - msoLogger.debug("BPMN Error during rollbackError: " + b.getMessage()) - }catch(Exception e){ - msoLogger.debug("Caught Exception during rollbackError: " + e.getMessage()) - } - msoLogger.debug(" Exit processRollbackException") - } - -} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy deleted file mode 100644 index 8af8e6ba1b..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.client.orchestration.AAIServiceInstanceResources -import org.onap.so.client.orchestration.SDNCServiceInstanceResources -import org.onap.so.logger.MsoLogger -import org.onap.so.logger.MessageEnum - -import groovy.json.* - -/** - * This groovy class supports the <class>DoCreateServiceInstanceV2.bpmn</class> process. - * -*/ - -public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceV2.class); - AAIServiceInstanceResources aaiO = new AAIServiceInstanceResources() - SDNCServiceInstanceResources sdncO = new SDNCServiceInstanceResources() - - @Override - public void preProcessRequest(DelegateExecution execution) { - } - - public void createServiceInstance(DelegateExecution execution) { - execution.setVariable("callSDNC",true) - if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){ - if(execution.getVariable("sdncVersion").equals("1610")){ - execution.setVariable("callSDNC",false); - } - } - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - try{ - aaiO.createServiceInstance(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - - public void createProject(DelegateExecution execution) { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) { - try{ - aaiO.createProjectandConnectServiceInstance(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - } - - public void createOwningEntity(DelegateExecution execution) { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) { - try{ - aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - } - - public void sdncAssignRequest(DelegateExecution execution) { - ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") - if (serviceDecomp != null) { - try { - sdncO.sendSyncResponse(serviceDecomp) - } catch (BpmnError e) { - throw e - } - } - - } - - public void rollback(DelegateExecution execution) { - //TODO - } - -} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn index 5cf17d24fe..21f18e9fa2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn @@ -1,41 +1,41 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> - <bpmn:process id="Create3rdONAPE2EServiceInstance" name="Create3rdONAPE2EServiceInstance " isExecutable="true"> - <bpmn:startEvent id="StartEvent_0hj12gh" name="Delete3rdONAPRES_Start"> + <bpmn:process id="Create3rdONAPE2EServiceInstance" name="Create3rdONAPE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_0hj12gh" name="Create3rdONAPRES_Start"> <bpmn:outgoing>SequenceFlow_190fewc</bpmn:outgoing> </bpmn:startEvent> - <bpmn:scriptTask id="ScriptTask_0rs5t7w" name="prepare 3rdONAP Delete Request" scriptFormat="groovy"> + <bpmn:scriptTask id="ScriptTask_0rs5t7w" name="prepare 3rdONAP Create Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0mmu3kz</bpmn:incoming> <bpmn:outgoing>SequenceFlow_15mvx68</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.prepare3rdONAPRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_013449q" name="Delete3rdONAPRES_End"> + <bpmn:endEvent id="EndEvent_013449q" name="Create3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_0a8k9xi</bpmn:incoming> </bpmn:endEvent> <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Save SPPartner In AAI"> <bpmn:incoming>SequenceFlow_0y2g8mr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0znwu8z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.saveSPPartnerInAAI(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_16rcjl3" name="Pre Process Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1ttrqml</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0brxjic</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_10n1tb6" name="Init Delete resource progress" scriptFormat="groovy"> + <bpmn:scriptTask id="ScriptTask_10n1tb6" name="Init Create resource progress" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0brxjic</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ezt5f0</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "5") execution.setVariable("status", "processing") execution.setVariable("statusDescription", "Start Creating") -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:serviceTask id="ServiceTask_039ju3f" name="resource progress update"> @@ -64,15 +64,15 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_0znwu8z</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04hwfll</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new Delete3rdONAPE2EServiceInstance() +def csi = new Create3rdONAPE2EServiceInstance() csi.postProcess(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0r2cxvb" name="Delete E2ESI in 3rdONAP" scriptFormat="groovy"> + <bpmn:scriptTask id="ScriptTask_0r2cxvb" name="Create E2ESI in 3rdONAP" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_15mvx68</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0wp73cw</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> +def dcsi = new Create3rdONAPE2EServiceInstance() +dcsi.doCreateE2ESIin3rdONAP(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:serviceTask id="ServiceTask_0p5029r" name="resource progress update"> <bpmn:extensionElements> @@ -100,7 +100,7 @@ dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_1suwdgi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mmu3kz</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.allocateCrossONAPResource(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_190fewc" sourceRef="StartEvent_0hj12gh" targetRef="ScriptTask_160sboy" /> @@ -111,7 +111,7 @@ dcsi.allocateCrossONAPResource(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_190fewc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1f71u71</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.checkSPPartnerInfo(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:exclusiveGateway id="ExclusiveGateway_01c0nhq" name="Is 3rdONAP SPPartner Existing" default="SequenceFlow_0h1rnsw"> @@ -123,22 +123,22 @@ dcsi.checkSPPartnerInfo(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_1msw3xo" name="yes" sourceRef="ExclusiveGateway_01c0nhq" targetRef="ScriptTask_1y8kdt3"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("Is3rdONAPExist" ) == "true" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0cql41g" name="Start3rdONAPDeleteE2ESI"> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0cql41g" name="Start3rdONAPCreateE2ESI"> <bpmn:outgoing>SequenceFlow_1ttrqml</bpmn:outgoing> - <bpmn:linkEventDefinition name="Start3rdONAPDeleteE2ESI" /> + <bpmn:linkEventDefinition name="Start3rdONAPCreateE2ESI" /> </bpmn:intermediateCatchEvent> <bpmn:sequenceFlow id="SequenceFlow_1f71u71" sourceRef="ScriptTask_160sboy" targetRef="ExclusiveGateway_01c0nhq" /> <bpmn:sequenceFlow id="SequenceFlow_1ttrqml" sourceRef="IntermediateCatchEvent_0cql41g" targetRef="ScriptTask_16rcjl3" /> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0wbo4nq" name="GoTo Start3rdONAPDeleteE2ESI"> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0wbo4nq" name="GoTo Start3rdONAPCreateE2ESI"> <bpmn:incoming>SequenceFlow_0o376do</bpmn:incoming> - <bpmn:linkEventDefinition name="Start3rdONAPDeleteE2ESI" /> + <bpmn:linkEventDefinition name="Start3rdONAPCreateE2ESI" /> </bpmn:intermediateThrowEvent> <bpmn:scriptTask id="ScriptTask_0yz8d8c" name="Query E2ESI progress in 3rdONAP" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_13s0mg5</bpmn:incoming> <bpmn:incoming>SequenceFlow_0kkou66</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0fkfn70</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.getE2ESIProgressin3rdONAP(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_04hwfll" sourceRef="ScriptTask_1aj6okk" targetRef="ScriptTask_18auy29" /> @@ -146,7 +146,7 @@ dcsi.getE2ESIProgressin3rdONAP(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_1msw3xo</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1kcu53z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.checkLocallCall(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1kcu53z" sourceRef="ScriptTask_1y8kdt3" targetRef="ExclusiveGateway_0pj14lp" /> @@ -159,36 +159,36 @@ dcsi.checkLocallCall(execution)]]></bpmn:script> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("IsLocalCall" ) == "true" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1y8xkzy" name="no" sourceRef="ExclusiveGateway_0pj14lp" targetRef="IntermediateThrowEvent_1y4vypx" /> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1y4vypx" name="GoTo StartLocalONAPDeleteE2ESI"> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1y4vypx" name="GoTo StartLocalONAPCreateE2ESI"> <bpmn:incoming>SequenceFlow_1y8xkzy</bpmn:incoming> <bpmn:incoming>SequenceFlow_0h1rnsw</bpmn:incoming> - <bpmn:linkEventDefinition name="StartLocalONAPDeleteE2ESI" /> + <bpmn:linkEventDefinition name="StartLocalONAPCreateE2ESI" /> </bpmn:intermediateThrowEvent> - <bpmn:endEvent id="EndEvent_0o0n3fa" name="Delete3rdONAPRES_End"> + <bpmn:endEvent id="EndEvent_0o0n3fa" name="Create3rdONAPRES_End"> <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> </bpmn:endEvent> <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Save SPPartner In AAI"> <bpmn:incoming>SequenceFlow_1wq9f5k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18gb81f</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.saveSPPartnerInAAI(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_0buj724" name="Pre Process Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0wnyy50</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0z9axn6</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0rixvgj" name="Prepare Delete resource progress" scriptFormat="groovy"> + <bpmn:scriptTask id="ScriptTask_0rixvgj" name="Prepare Create resource progress" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0z9axn6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04l4to1</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("status", "finished") execution.setVariable("statusDescription", "Local Creation Only") -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="update progress update"> @@ -218,18 +218,18 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_0dkbe3r</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1wn6y9u</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new Delete3rdONAPE2EServiceInstance() +def csi = new Create3rdONAPE2EServiceInstance() csi.postProcess(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_18h4prx" name="StartLocalONAPDeleteE2ESI"> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_18h4prx" name="StartLocalONAPCreateE2ESI"> <bpmn:outgoing>SequenceFlow_0wnyy50</bpmn:outgoing> - <bpmn:linkEventDefinition name="StartLocalONAPDeleteE2ESI" /> + <bpmn:linkEventDefinition name="StartLocalONAPCreateE2ESI" /> </bpmn:intermediateCatchEvent> <bpmn:scriptTask id="ScriptTask_03gddkg" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1wn6y9u</bpmn:incoming> <bpmn:outgoing>SequenceFlow_131f1jj</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new Delete3rdONAPE2EServiceInstance() +def csi = new Create3rdONAPE2EServiceInstance() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0z9axn6" sourceRef="ScriptTask_0buj724" targetRef="ScriptTask_0rixvgj" /> @@ -252,15 +252,15 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_1udji9x</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kkou66</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.timeDelay(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1662gjm" name="Delete SI in 3rdONAP Success?" default="SequenceFlow_12seu6n"> + <bpmn:exclusiveGateway id="ExclusiveGateway_1662gjm" name="Create SI in 3rdONAP Success?" default="SequenceFlow_12seu6n"> <bpmn:incoming>SequenceFlow_0wp73cw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_13s0mg5</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_12seu6n</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:exclusiveGateway id="ExclusiveGateway_1we7izu" name="Delete SI in 3rdONAP Finished?"> + <bpmn:exclusiveGateway id="ExclusiveGateway_1we7izu" name="Create SI in 3rdONAP Finished?"> <bpmn:incoming>SequenceFlow_1luhljs</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1udji9x</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0y2g8mr</bpmn:outgoing> @@ -269,7 +269,7 @@ dcsi.timeDelay(execution)]]></bpmn:script> <bpmn:incoming>SequenceFlow_04hwfll</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0a8k9xi</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new Delete3rdONAPE2EServiceInstance() +def csi = new Create3rdONAPE2EServiceInstance() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0a8k9xi" sourceRef="ScriptTask_18auy29" targetRef="EndEvent_013449q" /> @@ -299,8 +299,8 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("status", "error") -execution.setVariable("statusDescription", "Delete Service Order failed ") -def dcsi = new Delete3rdONAPE2EServiceInstance() +execution.setVariable("statusDescription", "Create Service Order failed ") +def dcsi = new Create3rdONAPE2EServiceInstance() dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:serviceTask id="ServiceTask_1ixmamy" name="resource progress update"> @@ -330,7 +330,7 @@ dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Delete3rdONAPE2EServiceInstance"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Create3rdONAPE2EServiceInstance"> <bpmndi:BPMNShape id="StartEvent_0hj12gh_di" bpmnElement="StartEvent_0hj12gh"> <dc:Bounds x="-9" y="-418" width="36" height="36" /> <bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn new file mode 100644 index 0000000000..3e2c316ffc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> + <bpmn:process id="CreateDeviceResource.bpmn" name="CreateDeviceResource.bpmn" isExecutable="true"> + <bpmn:endEvent id="EndEvent_1x6k78c" name="create Dev end"> + <bpmn:incoming>SequenceFlow_0auvfvm</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new CreateDeviceResource.bpmn() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:sequenceFlow id="SequenceFlow_0auvfvm" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> + <bpmn:callActivity id="Task_0bga3e8" name="call Create SDNC Network Resource" calledElement="CreateSDNCNetworkResource"> + <bpmn:extensionElements> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="recipeParams" target="recipeParams" /> + <camunda:in source="resourceInput" target="resourceInput" /> + <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="svcAction" target="svcAction" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> + <camunda:in source="networkRequest" target="networkRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1gu13by</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:startEvent id="StartEvent_1vjxae6" name="createDev_StartEvent"> + <bpmn:outgoing>SequenceFlow_1rwaeun</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1caax8u" name="GoTo StartCreateDevinSDNC"> + <bpmn:incoming>SequenceFlow_1ylvnxq</bpmn:incoming> + <bpmn:linkEventDefinition name="StartCreateDevinSDNC" /> + </bpmn:intermediateThrowEvent> + <bpmn:scriptTask id="ScriptTask_00y93jj" name="Check DevType" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0rq2jb1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1hp2h5t</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateDeviceResource() +dcsi.checkDevType(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_076ma0v"> + <bpmn:incoming>SequenceFlow_1hp2h5t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ss02ik</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0h4378g</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_076ma0v</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1chnlq6" name="GoTo StartCreateDevinSDNC"> + <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> + <bpmn:linkEventDefinition name="StartCreateDevinSDNC" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_02rli65"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "VNF" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1hp2h5t" sourceRef="ScriptTask_00y93jj" targetRef="ExclusiveGateway_0kba700" /> + <bpmn:sequenceFlow id="SequenceFlow_0h4378g" name="PNF" sourceRef="ExclusiveGateway_0kba700" targetRef="IntermediateThrowEvent_1chnlq6"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "PNF" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1rwaeun" sourceRef="StartEvent_1vjxae6" targetRef="ScriptTask_14dav1d" /> + <bpmn:scriptTask id="ScriptTask_14dav1d" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1rwaeun</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rq2jb1</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateDeviceResource() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0rq2jb1" sourceRef="ScriptTask_14dav1d" targetRef="ScriptTask_00y93jj" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0slgrxw" name="StartCreateDevinSDNC"> + <bpmn:outgoing>SequenceFlow_1gu13by</bpmn:outgoing> + <bpmn:linkEventDefinition name="StartCreateDevinSDNC" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_1gu13by" sourceRef="IntermediateCatchEvent_0slgrxw" targetRef="Task_0bga3e8" /> + <bpmn:callActivity id="CallActivity_0pyrfca" name="call CreateVNF" calledElement="DoCreateVNF"> + <bpmn:extensionElements> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="recipeParams" target="recipeParams" /> + <camunda:in source="resourceInput" target="resourceInput" /> + <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="svcAction" target="svcAction" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> + <camunda:in source="networkRequest" target="networkRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0pg3072</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> + <bpmn:endEvent id="EndEvent_0ymfq61"> + <bpmn:incoming>SequenceFlow_076ma0v</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_076ma0v" sourceRef="ExclusiveGateway_0kba700" targetRef="EndEvent_0ymfq61" /> + <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF Template fom SDC" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateDeviceResource() +dcsi.getVNFTemplatefromSDC(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0pg3072" sourceRef="ScriptTask_02rli65" targetRef="CallActivity_0pyrfca" /> + <bpmn:scriptTask id="ScriptTask_0u1piih" name="Post VNF info process " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0pkp4ce</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ylvnxq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateDeviceResource() +dcsi.postVNFInfoProcess(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateDeviceResource.bpmn"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1026" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="994" y="153" width="75" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> + <dc:Bounds x="494" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05niqbf_di" bpmnElement="SequenceFlow_05niqbf"> + <di:waypoint xsi:type="dc:Point" x="191" y="129" /> + <di:waypoint xsi:type="dc:Point" x="494" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="297.5" y="104" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0auvfvm_di" bpmnElement="SequenceFlow_0auvfvm"> + <di:waypoint xsi:type="dc:Point" x="594" y="129" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="765" y="104" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0aywvn3_di" bpmnElement="Task_0bga3e8"> + <dc:Bounds x="91" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1vjxae6_di" bpmnElement="StartEvent_1vjxae6"> + <dc:Bounds x="-188" y="-145" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-211" y="-109" width="88" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1caax8u_di" bpmnElement="IntermediateThrowEvent_1caax8u"> + <dc:Bounds x="1026" y="-145" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1009" y="-104" width="78" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_00y93jj_di" bpmnElement="ScriptTask_00y93jj"> + <dc:Bounds x="141" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0kba700_di" bpmnElement="ExclusiveGateway_0kba700" isMarkerVisible="true"> + <dc:Bounds x="334" y="-152" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="309" y="-166" width="34" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1chnlq6_di" bpmnElement="IntermediateThrowEvent_1chnlq6"> + <dc:Bounds x="341" y="-28" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="325" y="13" width="78" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ss02ik_di" bpmnElement="SequenceFlow_1ss02ik"> + <di:waypoint xsi:type="dc:Point" x="384" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="480" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420.94444444444446" y="-148" width="23" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1hp2h5t_di" bpmnElement="SequenceFlow_1hp2h5t"> + <di:waypoint xsi:type="dc:Point" x="241" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="334" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="242.5" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0h4378g_di" bpmnElement="SequenceFlow_0h4378g"> + <di:waypoint xsi:type="dc:Point" x="359" y="-102" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-28" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="365" y="-67.27272727272728" width="22" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rwaeun_di" bpmnElement="SequenceFlow_1rwaeun"> + <di:waypoint xsi:type="dc:Point" x="-152" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="-53" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-147.5" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14dav1d_di" bpmnElement="ScriptTask_14dav1d"> + <dc:Bounds x="-53" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rq2jb1_di" bpmnElement="SequenceFlow_0rq2jb1"> + <di:waypoint xsi:type="dc:Point" x="47" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="141" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="49" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0slgrxw_di" bpmnElement="IntermediateCatchEvent_0slgrxw"> + <dc:Bounds x="-188" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-203" y="147" width="79" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1gu13by_di" bpmnElement="SequenceFlow_1gu13by"> + <di:waypoint xsi:type="dc:Point" x="-152" y="129" /> + <di:waypoint xsi:type="dc:Point" x="91" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-75.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0pyrfca_di" bpmnElement="CallActivity_0pyrfca"> + <dc:Bounds x="662" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0pkp4ce_di" bpmnElement="SequenceFlow_0pkp4ce"> + <di:waypoint xsi:type="dc:Point" x="762" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="849" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="760.5" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0ymfq61_di" bpmnElement="EndEvent_0ymfq61"> + <dc:Bounds x="341" y="-251" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="359" y="-211" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_076ma0v_di" bpmnElement="SequenceFlow_076ma0v"> + <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-215" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="374" y="-189.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> + <dc:Bounds x="480" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0pg3072_di" bpmnElement="SequenceFlow_0pg3072"> + <di:waypoint xsi:type="dc:Point" x="580" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="662" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="621" y="-148" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u1piih_di" bpmnElement="ScriptTask_0u1piih"> + <dc:Bounds x="849" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ylvnxq_di" bpmnElement="SequenceFlow_1ylvnxq"> + <di:waypoint xsi:type="dc:Point" x="949" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987.5" y="-148" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn index 3d08fdb1d4..50e65dcaad 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateGenericALaCarteServiceInstance" name="CreateGenericALaCarteServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Create SI Start Flow"> <bpmn2:outgoing>SequenceFlow_0lp2z7l</bpmn2:outgoing> @@ -15,7 +15,7 @@ ex.processJavaException(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_1" targetRef="EndEvent_1" /> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_1" /> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_1" camunda:errorMessageVariable="gUnknownError" /> </bpmn2:startEvent> <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1" /> <bpmn2:endEvent id="EndEvent_1"> @@ -197,35 +197,35 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="unexpectedErrors_SubProcess" isExpanded="true"> - <dc:Bounds x="300" y="880" width="394" height="188" /> + <dc:Bounds x="187" y="926" width="394" height="188" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> - <dc:Bounds x="333" y="957" width="36" height="36" /> + <dc:Bounds x="220" y="1003" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="351" y="998" width="0" height="0" /> + <dc:Bounds x="193" y="1044" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_270" bpmnElement="ScriptTask_1"> - <dc:Bounds x="448" y="935" width="100" height="80" /> + <dc:Bounds x="335" y="981" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_220" bpmnElement="EndEvent_1"> - <dc:Bounds x="609" y="957" width="36" height="36" /> + <dc:Bounds x="496" y="1003" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="627" y="998" width="0" height="0" /> + <dc:Bounds x="469" y="1044" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_270"> - <di:waypoint xsi:type="dc:Point" x="369" y="975" /> - <di:waypoint xsi:type="dc:Point" x="448" y="975" /> + <di:waypoint xsi:type="dc:Point" x="256" y="1021" /> + <di:waypoint xsi:type="dc:Point" x="335" y="1021" /> <bpmndi:BPMNLabel> - <dc:Bounds x="411" y="975" width="0" height="0" /> + <dc:Bounds x="253" y="1021" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_270" targetElement="_BPMNShape_EndEvent_220"> - <di:waypoint xsi:type="dc:Point" x="548" y="975" /> - <di:waypoint xsi:type="dc:Point" x="609" y="975" /> + <di:waypoint xsi:type="dc:Point" x="435" y="1021" /> + <di:waypoint xsi:type="dc:Point" x="496" y="1021" /> <bpmndi:BPMNLabel> - <dc:Bounds x="583" y="975" width="0" height="0" /> + <dc:Bounds x="425" y="1021" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_CallActivity_72" bpmnElement="doCreateServiceInstance_CallActivity"> @@ -449,4 +449,4 @@ csi.prepareCreateServiceInstance(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file +</bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn index 116a8a6fb6..4b6f8d9b26 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn @@ -1,41 +1,44 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> <bpmn:process id="Delete3rdONAPE2EServiceInstance" name="Delete3rdONAPE2EServiceInstance" isExecutable="true"> - <bpmn:startEvent id="StartEvent_01a6g9a" name="Delete3rdONAPRES_Start"> - <bpmn:outgoing>SequenceFlow_0ecyqjf</bpmn:outgoing> + <bpmn:startEvent id="StartEvent_0hj12gh" name="Delete3rdONAPRES_Start"> + <bpmn:outgoing>SequenceFlow_190fewc</bpmn:outgoing> </bpmn:startEvent> - <bpmn:scriptTask id="ScriptTask_0viqs1u" name="prepare 3rdONAP Delete Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1sql6c3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1soxbjk</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0rs5t7w" name="prepare 3rdONAP Delete Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1suwdgi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15mvx68</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.prepareSDNCRequest(execution)]]></bpmn:script> +dcsi.prepare3rdONAPRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1993lyd" name="Delete3rdONAPRES_End"> - <bpmn:incoming>SequenceFlow_170nvzi</bpmn:incoming> + <bpmn:endEvent id="EndEvent_013449q" name="Delete3rdONAPRES_End"> + <bpmn:incoming>SequenceFlow_0a8k9xi</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_093lzuq" name="Save SPPartner In AAI"> - <bpmn:incoming>SequenceFlow_1tlym3z</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0z0u7x1</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_1b88nnk" name="Delete SPPartner In AAI"> + <bpmn:incoming>SequenceFlow_0y2g8mr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0znwu8z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.saveSPPartnerInAAI(execution)]]></bpmn:script> +dcsi.deleteSPPartnerInAAI(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_02oc89f" name="Pre Process Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_114wjuf</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1sql6c3</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_16rcjl3" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ttrqml</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0brxjic</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1e4pgbj" name="Delete progress update parameters before delete" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1soxbjk</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_000q9m3</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_10n1tb6" name="Init Delete resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0brxjic</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ezt5f0</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "5") +execution.setVariable("status", "processing") +execution.setVariable("statusDescription", "Start Creating") def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)]]></bpmn:script> +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_0r6g690" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_039ju3f" name="resource progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -54,24 +57,24 @@ dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_000q9m3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1lhdwv6</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0ezt5f0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1suwdgi</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="ScriptTask_1e5o8dz" name="Post process" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0z0u7x1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1bo3fu4</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_1aj6okk" name="Post process" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0znwu8z</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04hwfll</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi = new Delete3rdONAPE2EServiceInstance() csi.postProcess(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0ombt1l" name="Delete E2ESI in 3rdONAP" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0t0jlzs</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_06fak6j</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0r2cxvb" name="Delete E2ESI in 3rdONAP" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_15mvx68</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0wp73cw</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_0lgqtdm" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_0p5029r" name="resource progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -90,99 +93,98 @@ dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0lpbqkc</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1tlym3z</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0fkfn70</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1luhljs</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="ScriptTask_0blh9n0" name="Allocate connection resources for cross ONAP" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1lhdwv6</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0t0jlzs</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.postActivateSDNC(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1vlm2lw" name="Check SPPartner Info" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ecyqjf</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jgurvk</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_190fewc" sourceRef="StartEvent_0hj12gh" targetRef="ScriptTask_160sboy" /> + <bpmn:sequenceFlow id="SequenceFlow_0brxjic" sourceRef="ScriptTask_16rcjl3" targetRef="ScriptTask_10n1tb6" /> + <bpmn:sequenceFlow id="SequenceFlow_0znwu8z" sourceRef="ScriptTask_1b88nnk" targetRef="ScriptTask_1aj6okk" /> + <bpmn:sequenceFlow id="SequenceFlow_0ezt5f0" sourceRef="ScriptTask_10n1tb6" targetRef="ServiceTask_039ju3f" /> + <bpmn:scriptTask id="ScriptTask_160sboy" name="Check SPPartner Info from AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_190fewc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1f71u71</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.checkSPPartnerand LocallCall(execution)]]></bpmn:script> +dcsi.checkSPPartnerInfoFromAAI(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0d7a4pw" name="Is 3rdONAP Existing" default="SequenceFlow_0u3tca8"> - <bpmn:incoming>SequenceFlow_1jgurvk</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0u3tca8</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_11pvz8i</bpmn:outgoing> + <bpmn:exclusiveGateway id="ExclusiveGateway_01c0nhq" name="Is 3rdONAP SPPartner Existing" default="SequenceFlow_0h1rnsw"> + <bpmn:incoming>SequenceFlow_1f71u71</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0h1rnsw</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1msw3xo</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_14mk5it" name="Start3rdONAPDeleteE2ESI"> - <bpmn:outgoing>SequenceFlow_114wjuf</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0h1rnsw" name="no" sourceRef="ExclusiveGateway_01c0nhq" targetRef="IntermediateThrowEvent_1y4vypx" /> + <bpmn:sequenceFlow id="SequenceFlow_1msw3xo" name="yes" sourceRef="ExclusiveGateway_01c0nhq" targetRef="ScriptTask_1y8kdt3"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("Is3rdONAPExist" ) == "true" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0cql41g" name="Start3rdONAPDeleteE2ESI"> + <bpmn:outgoing>SequenceFlow_1ttrqml</bpmn:outgoing> <bpmn:linkEventDefinition name="Start3rdONAPDeleteE2ESI" /> </bpmn:intermediateCatchEvent> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0bqnalt" name="GoTo Start3rdONAPDeleteE2ESI"> - <bpmn:incoming>SequenceFlow_06avdut</bpmn:incoming> + <bpmn:sequenceFlow id="SequenceFlow_1f71u71" sourceRef="ScriptTask_160sboy" targetRef="ExclusiveGateway_01c0nhq" /> + <bpmn:sequenceFlow id="SequenceFlow_1ttrqml" sourceRef="IntermediateCatchEvent_0cql41g" targetRef="ScriptTask_16rcjl3" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0wbo4nq" name="GoTo Start3rdONAPDeleteE2ESI"> + <bpmn:incoming>SequenceFlow_0o376do</bpmn:incoming> <bpmn:linkEventDefinition name="Start3rdONAPDeleteE2ESI" /> </bpmn:intermediateThrowEvent> - <bpmn:scriptTask id="ScriptTask_1trt7oc" name="post Delete E2ESI in 3rdONAP" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_06fak6j</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0cuvrsr</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.doDeleteE2ESIin3rdONAP(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_01s6c7j" name="Query E2ESI progress in 3rdONAP" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0cuvrsr</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0lpbqkc</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0yz8d8c" name="Query E2ESI progress in 3rdONAP" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13s0mg5</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0kkou66</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0fkfn70</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.getE2ESIProgressin3rdONAP(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1ri59nm" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1bo3fu4</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_170nvzi</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new Delete3rdONAPE2EServiceInstance() -csi.sendSyncResponse(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0d7cawc" name="Check Locall Call" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_11pvz8i</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1lqmzex</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_04hwfll" sourceRef="ScriptTask_1aj6okk" targetRef="ScriptTask_18auy29" /> + <bpmn:scriptTask id="ScriptTask_1y8kdt3" name="Check Locall Call" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1msw3xo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kcu53z</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.checkSPPartnerand LocallCall(execution)]]></bpmn:script> +dcsi.checkLocallCall(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0j2ccax" name="Is Called from Local"> - <bpmn:incoming>SequenceFlow_1lqmzex</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_06avdut</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1pwflny</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_1kcu53z" sourceRef="ScriptTask_1y8kdt3" targetRef="ExclusiveGateway_0pj14lp" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0pj14lp" name="Is Called from Local"> + <bpmn:incoming>SequenceFlow_1kcu53z</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0o376do</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1y8xkzy</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0bmqdpg" name="GoTo StartLocalONAPDeleteE2ESI"> - <bpmn:incoming>SequenceFlow_0u3tca8</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1pwflny</bpmn:incoming> + <bpmn:sequenceFlow id="SequenceFlow_0o376do" name="yes" sourceRef="ExclusiveGateway_0pj14lp" targetRef="IntermediateThrowEvent_0wbo4nq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("IsLocalCall" ) == "true" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1y8xkzy" name="no" sourceRef="ExclusiveGateway_0pj14lp" targetRef="IntermediateThrowEvent_1y4vypx" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1y4vypx" name="GoTo StartLocalONAPDeleteE2ESI"> + <bpmn:incoming>SequenceFlow_1y8xkzy</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0h1rnsw</bpmn:incoming> <bpmn:linkEventDefinition name="StartLocalONAPDeleteE2ESI" /> </bpmn:intermediateThrowEvent> - <bpmn:endEvent id="EndEvent_1itzq8n" name="Delete3rdONAPRES_End"> - <bpmn:incoming>SequenceFlow_0vhbw8y</bpmn:incoming> + <bpmn:endEvent id="EndEvent_0o0n3fa" name="Delete3rdONAPRES_End"> + <bpmn:incoming>SequenceFlow_131f1jj</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1aigzk8" name="Delete SPPartner In AAI"> - <bpmn:incoming>SequenceFlow_03mc2qq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_03ngo7h</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_1lazb8l" name="Delete SPPartner In AAI"> + <bpmn:incoming>SequenceFlow_1wq9f5k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18gb81f</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.deleteSPPartnerInAAI(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0cpsjwl" name="Pre Process Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1x1sk3t</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_02l74nc</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0buj724" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wnyy50</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0z9axn6</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new Delete3rdONAPE2EServiceInstance() dcsi.preProcessRequest(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_01cer09" name="Delete progress update parameters before delete" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_02l74nc</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ff0jf2</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_0rixvgj" name="Prepare Delete resource progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0z9axn6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04l4to1</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("status", "finished") +execution.setVariable("statusDescription", "Local Creation Only") def dcsi = new Delete3rdONAPE2EServiceInstance() -dcsi.prepareUpdate(execution)]]></bpmn:script> +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1go9g1i" name="update progress update"> + <bpmn:serviceTask id="ServiceTask_1kgvq5e" name="update progress update"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -201,411 +203,519 @@ dcsi.prepareUpdate(execution)]]></bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_03ngo7h</bpmn:incoming> - <bpmn:incoming>SequenceFlow_177yb27</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1784pcx</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_18gb81f</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1swgag2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dkbe3r</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="ScriptTask_0ywn2ec" name="Post process" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1784pcx</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1xhcwoo</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_17s3yrn" name="Post process" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0dkbe3r</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wn6y9u</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi = new Delete3rdONAPE2EServiceInstance() csi.postProcess(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0ui7e2m" name="StartLocalONAPDeleteE2ESI"> - <bpmn:outgoing>SequenceFlow_1x1sk3t</bpmn:outgoing> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_18h4prx" name="StartLocalONAPDeleteE2ESI"> + <bpmn:outgoing>SequenceFlow_0wnyy50</bpmn:outgoing> <bpmn:linkEventDefinition name="StartLocalONAPDeleteE2ESI" /> </bpmn:intermediateCatchEvent> - <bpmn:scriptTask id="ScriptTask_0y6ox5c" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1xhcwoo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0vhbw8y</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_03gddkg" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1wn6y9u</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_131f1jj</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi = new Delete3rdONAPE2EServiceInstance() csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_02l57i8" name="Is 3rdONAP Existing" default="SequenceFlow_177yb27"> - <bpmn:incoming>SequenceFlow_0ff0jf2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_03mc2qq</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_177yb27</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0z9axn6" sourceRef="ScriptTask_0buj724" targetRef="ScriptTask_0rixvgj" /> + <bpmn:sequenceFlow id="SequenceFlow_131f1jj" sourceRef="ScriptTask_03gddkg" targetRef="EndEvent_0o0n3fa" /> + <bpmn:sequenceFlow id="SequenceFlow_18gb81f" sourceRef="ScriptTask_1lazb8l" targetRef="ServiceTask_1kgvq5e" /> + <bpmn:sequenceFlow id="SequenceFlow_0wnyy50" sourceRef="IntermediateCatchEvent_18h4prx" targetRef="ScriptTask_0buj724" /> + <bpmn:sequenceFlow id="SequenceFlow_04l4to1" sourceRef="ScriptTask_0rixvgj" targetRef="ExclusiveGateway_1cz6dwq" /> + <bpmn:sequenceFlow id="SequenceFlow_1wn6y9u" sourceRef="ScriptTask_17s3yrn" targetRef="ScriptTask_03gddkg" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1cz6dwq" name="Is 3rdONAP SPPartner Existing" default="SequenceFlow_1swgag2"> + <bpmn:incoming>SequenceFlow_04l4to1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wq9f5k</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1swgag2</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0ecyqjf" sourceRef="StartEvent_01a6g9a" targetRef="ScriptTask_1vlm2lw" /> - <bpmn:sequenceFlow id="SequenceFlow_1sql6c3" sourceRef="ScriptTask_02oc89f" targetRef="ScriptTask_0viqs1u" /> - <bpmn:sequenceFlow id="SequenceFlow_1soxbjk" sourceRef="ScriptTask_0viqs1u" targetRef="ScriptTask_1e4pgbj" /> - <bpmn:sequenceFlow id="SequenceFlow_170nvzi" sourceRef="ScriptTask_1ri59nm" targetRef="EndEvent_1993lyd" /> - <bpmn:sequenceFlow id="SequenceFlow_1tlym3z" sourceRef="ServiceTask_0lgqtdm" targetRef="ScriptTask_093lzuq" /> - <bpmn:sequenceFlow id="SequenceFlow_0z0u7x1" sourceRef="ScriptTask_093lzuq" targetRef="ScriptTask_1e5o8dz" /> - <bpmn:sequenceFlow id="SequenceFlow_114wjuf" sourceRef="IntermediateCatchEvent_14mk5it" targetRef="ScriptTask_02oc89f" /> - <bpmn:sequenceFlow id="SequenceFlow_000q9m3" sourceRef="ScriptTask_1e4pgbj" targetRef="ServiceTask_0r6g690" /> - <bpmn:sequenceFlow id="SequenceFlow_1lhdwv6" sourceRef="ServiceTask_0r6g690" targetRef="ScriptTask_0blh9n0" /> - <bpmn:sequenceFlow id="SequenceFlow_1bo3fu4" sourceRef="ScriptTask_1e5o8dz" targetRef="ScriptTask_1ri59nm" /> - <bpmn:sequenceFlow id="SequenceFlow_0t0jlzs" sourceRef="ScriptTask_0blh9n0" targetRef="ScriptTask_0ombt1l" /> - <bpmn:sequenceFlow id="SequenceFlow_06fak6j" sourceRef="ScriptTask_0ombt1l" targetRef="ScriptTask_1trt7oc" /> - <bpmn:sequenceFlow id="SequenceFlow_0lpbqkc" sourceRef="ScriptTask_01s6c7j" targetRef="ServiceTask_0lgqtdm" /> - <bpmn:sequenceFlow id="SequenceFlow_1jgurvk" sourceRef="ScriptTask_1vlm2lw" targetRef="ExclusiveGateway_0d7a4pw" /> - <bpmn:sequenceFlow id="SequenceFlow_0u3tca8" name="no" sourceRef="ExclusiveGateway_0d7a4pw" targetRef="IntermediateThrowEvent_0bmqdpg" /> - <bpmn:sequenceFlow id="SequenceFlow_11pvz8i" name="yes" sourceRef="ExclusiveGateway_0d7a4pw" targetRef="ScriptTask_0d7cawc"> + <bpmn:sequenceFlow id="SequenceFlow_0dkbe3r" sourceRef="ServiceTask_1kgvq5e" targetRef="ScriptTask_17s3yrn" /> + <bpmn:sequenceFlow id="SequenceFlow_1wq9f5k" name="yes" sourceRef="ExclusiveGateway_1cz6dwq" targetRef="ScriptTask_1lazb8l"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("Is3rdONAPExist" ) == "true" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_06avdut" name="yes" sourceRef="ExclusiveGateway_0j2ccax" targetRef="IntermediateThrowEvent_0bqnalt"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("IsLocalCall" ) == "true" )}]]></bpmn:conditionExpression> + <bpmn:sequenceFlow id="SequenceFlow_1swgag2" name="No" sourceRef="ExclusiveGateway_1cz6dwq" targetRef="ServiceTask_1kgvq5e" /> + <bpmn:scriptTask id="ScriptTask_1pdhttw" name="timeDelay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1udji9x</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kkou66</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new Delete3rdONAPE2EServiceInstance() +dcsi.timeDelay(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1662gjm" name="Delete SI in 3rdONAP Success?" default="SequenceFlow_12seu6n"> + <bpmn:incoming>SequenceFlow_0wp73cw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_13s0mg5</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_12seu6n</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:exclusiveGateway id="ExclusiveGateway_1we7izu" name="Delete SI in 3rdONAP Finished?"> + <bpmn:incoming>SequenceFlow_1luhljs</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1udji9x</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0y2g8mr</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_18auy29" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_04hwfll</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0a8k9xi</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new Delete3rdONAPE2EServiceInstance() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0a8k9xi" sourceRef="ScriptTask_18auy29" targetRef="EndEvent_013449q" /> + <bpmn:sequenceFlow id="SequenceFlow_15mvx68" sourceRef="ScriptTask_0rs5t7w" targetRef="ScriptTask_0r2cxvb" /> + <bpmn:sequenceFlow id="SequenceFlow_0wp73cw" sourceRef="ScriptTask_0r2cxvb" targetRef="ExclusiveGateway_1662gjm" /> + <bpmn:sequenceFlow id="SequenceFlow_13s0mg5" name="yes" sourceRef="ExclusiveGateway_1662gjm" targetRef="ScriptTask_0yz8d8c"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceOrderId" ) != null && execution.getVariable("serviceOrderId" ) != "" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0cuvrsr" sourceRef="ScriptTask_1trt7oc" targetRef="ScriptTask_01s6c7j" /> - <bpmn:sequenceFlow id="SequenceFlow_1lqmzex" sourceRef="ScriptTask_0d7cawc" targetRef="ExclusiveGateway_0j2ccax" /> - <bpmn:sequenceFlow id="SequenceFlow_1pwflny" name="no" sourceRef="ExclusiveGateway_0j2ccax" targetRef="IntermediateThrowEvent_0bmqdpg" /> - <bpmn:sequenceFlow id="SequenceFlow_0vhbw8y" sourceRef="ScriptTask_0y6ox5c" targetRef="EndEvent_1itzq8n" /> - <bpmn:sequenceFlow id="SequenceFlow_03mc2qq" name="yes" sourceRef="ExclusiveGateway_02l57i8" targetRef="ScriptTask_1aigzk8"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("Is3rdONAPExist" ) == "true" )}]]></bpmn:conditionExpression> + <bpmn:sequenceFlow id="SequenceFlow_0fkfn70" sourceRef="ScriptTask_0yz8d8c" targetRef="ServiceTask_0p5029r" /> + <bpmn:sequenceFlow id="SequenceFlow_1suwdgi" sourceRef="ServiceTask_039ju3f" targetRef="ScriptTask_0rs5t7w" /> + <bpmn:sequenceFlow id="SequenceFlow_0kkou66" sourceRef="ScriptTask_1pdhttw" targetRef="ScriptTask_0yz8d8c" /> + <bpmn:sequenceFlow id="SequenceFlow_1luhljs" sourceRef="ServiceTask_0p5029r" targetRef="ExclusiveGateway_1we7izu" /> + <bpmn:sequenceFlow id="SequenceFlow_1udji9x" name="no" sourceRef="ExclusiveGateway_1we7izu" targetRef="ScriptTask_1pdhttw"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[ #{(execution.getVariable("status" ) == "processing" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_19joonf"> + <bpmn:incoming>SequenceFlow_1mei7hu</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_12seu6n" name="no" sourceRef="ExclusiveGateway_1662gjm" targetRef="ScriptTask_07cq0pw" /> + <bpmn:sequenceFlow id="SequenceFlow_0y2g8mr" name="yes" sourceRef="ExclusiveGateway_1we7izu" targetRef="ScriptTask_1b88nnk"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[ #{(execution.getVariable("status" ) != "processing" )}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_03ngo7h" sourceRef="ScriptTask_1aigzk8" targetRef="ServiceTask_1go9g1i" /> - <bpmn:sequenceFlow id="SequenceFlow_1x1sk3t" sourceRef="IntermediateCatchEvent_0ui7e2m" targetRef="ScriptTask_0cpsjwl" /> - <bpmn:sequenceFlow id="SequenceFlow_02l74nc" sourceRef="ScriptTask_0cpsjwl" targetRef="ScriptTask_01cer09" /> - <bpmn:sequenceFlow id="SequenceFlow_0ff0jf2" sourceRef="ScriptTask_01cer09" targetRef="ExclusiveGateway_02l57i8" /> - <bpmn:sequenceFlow id="SequenceFlow_177yb27" name="No" sourceRef="ExclusiveGateway_02l57i8" targetRef="ServiceTask_1go9g1i" /> - <bpmn:sequenceFlow id="SequenceFlow_1784pcx" sourceRef="ServiceTask_1go9g1i" targetRef="ScriptTask_0ywn2ec" /> - <bpmn:sequenceFlow id="SequenceFlow_1xhcwoo" sourceRef="ScriptTask_0ywn2ec" targetRef="ScriptTask_0y6ox5c" /> + <bpmn:scriptTask id="ScriptTask_07cq0pw" name="update resource progress failed" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_12seu6n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0i9iiuo</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("status", "error") +execution.setVariable("statusDescription", "Delete Service Order failed ") +def dcsi = new Delete3rdONAPE2EServiceInstance() +dcsi.prepareUpdateProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_1ixmamy" name="resource progress update"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0i9iiuo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1mei7hu</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0i9iiuo" sourceRef="ScriptTask_07cq0pw" targetRef="ServiceTask_1ixmamy" /> + <bpmn:sequenceFlow id="SequenceFlow_1mei7hu" sourceRef="ServiceTask_1ixmamy" targetRef="EndEvent_19joonf" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Delete3rdONAPE2EServiceInstance"> - <bpmndi:BPMNShape id="StartEvent_01a6g9a_di" bpmnElement="StartEvent_01a6g9a"> - <dc:Bounds x="870" y="-707" width="36" height="36" /> + <bpmndi:BPMNShape id="StartEvent_0hj12gh_di" bpmnElement="StartEvent_0hj12gh"> + <dc:Bounds x="-9" y="-418" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="849" y="-671" width="84" height="28" /> + <dc:Bounds x="-30" y="-382" width="84" height="28" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0viqs1u_di" bpmnElement="ScriptTask_0viqs1u"> - <dc:Bounds x="1245" y="-442" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0rs5t7w_di" bpmnElement="ScriptTask_0rs5t7w"> + <dc:Bounds x="-41" y="12" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1993lyd_di" bpmnElement="EndEvent_1993lyd"> - <dc:Bounds x="1848" y="-46" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_013449q_di" bpmnElement="EndEvent_013449q"> + <dc:Bounds x="799" y="393" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1812" y="-4" width="84" height="28" /> + <dc:Bounds x="763" y="435" width="84" height="28" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_093lzuq_di" bpmnElement="ScriptTask_093lzuq"> - <dc:Bounds x="1245" y="-68" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_02oc89f_di" bpmnElement="ScriptTask_02oc89f"> - <dc:Bounds x="1042" y="-442" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1e4pgbj_di" bpmnElement="ScriptTask_1e4pgbj"> - <dc:Bounds x="1442" y="-442" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_1b88nnk_di" bpmnElement="ScriptTask_1b88nnk"> + <dc:Bounds x="-41" y="371" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0r6g690_di" bpmnElement="ServiceTask_0r6g690"> - <dc:Bounds x="1678" y="-442" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_16rcjl3_di" bpmnElement="ScriptTask_16rcjl3"> + <dc:Bounds x="163" y="-153" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1e5o8dz_di" bpmnElement="ScriptTask_1e5o8dz"> - <dc:Bounds x="1442" y="-68" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_10n1tb6_di" bpmnElement="ScriptTask_10n1tb6"> + <dc:Bounds x="366" y="-153" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0ombt1l_di" bpmnElement="ScriptTask_0ombt1l"> - <dc:Bounds x="1245" y="-271" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_039ju3f_di" bpmnElement="ServiceTask_039ju3f"> + <dc:Bounds x="573" y="-153" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0lgqtdm_di" bpmnElement="ServiceTask_0lgqtdm"> - <dc:Bounds x="1042" y="-68" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_1aj6okk_di" bpmnElement="ScriptTask_1aj6okk"> + <dc:Bounds x="231" y="371" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0blh9n0_di" bpmnElement="ScriptTask_0blh9n0"> - <dc:Bounds x="1042" y="-271" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0r2cxvb_di" bpmnElement="ScriptTask_0r2cxvb"> + <dc:Bounds x="163" y="12" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1vlm2lw_di" bpmnElement="ScriptTask_1vlm2lw"> - <dc:Bounds x="1042" y="-729" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_0p5029r_di" bpmnElement="ServiceTask_0p5029r"> + <dc:Bounds x="798" y="12" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0d7a4pw_di" bpmnElement="ExclusiveGateway_0d7a4pw" isMarkerVisible="true"> - <dc:Bounds x="1259" y="-715" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_190fewc_di" bpmnElement="SequenceFlow_190fewc"> + <di:waypoint xsi:type="dc:Point" x="27" y="-400" /> + <di:waypoint xsi:type="dc:Point" x="163" y="-400" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1243" y="-747" width="56" height="28" /> + <dc:Bounds x="95" y="-422" width="0" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateCatchEvent_14mk5it_di" bpmnElement="IntermediateCatchEvent_14mk5it"> - <dc:Bounds x="870" y="-420" width="36" height="36" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0brxjic_di" bpmnElement="SequenceFlow_0brxjic"> + <di:waypoint xsi:type="dc:Point" x="263" y="-113" /> + <di:waypoint xsi:type="dc:Point" x="366" y="-113" /> <bpmndi:BPMNLabel> - <dc:Bounds x="850" y="-384" width="85" height="28" /> + <dc:Bounds x="269.5" y="-135" width="90" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0bqnalt_di" bpmnElement="IntermediateThrowEvent_0bqnalt"> - <dc:Bounds x="1835" y="-707" width="36" height="36" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0znwu8z_di" bpmnElement="SequenceFlow_0znwu8z"> + <di:waypoint xsi:type="dc:Point" x="59" y="411" /> + <di:waypoint xsi:type="dc:Point" x="231" y="411" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1813" y="-666" width="85" height="42" /> + <dc:Bounds x="100" y="389" width="90" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1trt7oc_di" bpmnElement="ScriptTask_1trt7oc"> - <dc:Bounds x="1442" y="-271" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_01s6c7j_di" bpmnElement="ScriptTask_01s6c7j"> - <dc:Bounds x="1678" y="-271" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1ri59nm_di" bpmnElement="ScriptTask_1ri59nm"> - <dc:Bounds x="1678" y="-68" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0d7cawc_di" bpmnElement="ScriptTask_0d7cawc"> - <dc:Bounds x="1442" y="-729" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0j2ccax_di" bpmnElement="ExclusiveGateway_0j2ccax" isMarkerVisible="true"> - <dc:Bounds x="1671" y="-715" width="50" height="50" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ezt5f0_di" bpmnElement="SequenceFlow_0ezt5f0"> + <di:waypoint xsi:type="dc:Point" x="466" y="-113" /> + <di:waypoint xsi:type="dc:Point" x="573" y="-113" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1655" y="-747" width="65" height="28" /> + <dc:Bounds x="474.5" y="-135" width="90" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_160sboy_di" bpmnElement="ScriptTask_160sboy"> + <dc:Bounds x="163" y="-440" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0bmqdpg_di" bpmnElement="IntermediateThrowEvent_0bmqdpg"> - <dc:Bounds x="1678" y="-589" width="36" height="36" /> + <bpmndi:BPMNShape id="ExclusiveGateway_01c0nhq_di" bpmnElement="ExclusiveGateway_01c0nhq" isMarkerVisible="true"> + <dc:Bounds x="380" y="-426" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1656" y="-548" width="85" height="42" /> + <dc:Bounds x="378" y="-458" width="56" height="28" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1itzq8n_di" bpmnElement="EndEvent_1itzq8n"> - <dc:Bounds x="1848" y="288" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_0h1rnsw_di" bpmnElement="SequenceFlow_0h1rnsw"> + <di:waypoint xsi:type="dc:Point" x="405" y="-376" /> + <di:waypoint xsi:type="dc:Point" x="405" y="-282" /> + <di:waypoint xsi:type="dc:Point" x="525" y="-282" /> + <di:waypoint xsi:type="dc:Point" x="525" y="-282" /> + <di:waypoint xsi:type="dc:Point" x="799" y="-282" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1812" y="330" width="84" height="28" /> + <dc:Bounds x="389" y="-368.53991291727147" width="12" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1aigzk8_di" bpmnElement="ScriptTask_1aigzk8"> - <dc:Bounds x="1665" y="67" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0cpsjwl_di" bpmnElement="ScriptTask_0cpsjwl"> - <dc:Bounds x="1042" y="67" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_01cer09_di" bpmnElement="ScriptTask_01cer09"> - <dc:Bounds x="1245" y="67" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1go9g1i_di" bpmnElement="ServiceTask_1go9g1i"> - <dc:Bounds x="1042" y="266" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0ywn2ec_di" bpmnElement="ScriptTask_0ywn2ec"> - <dc:Bounds x="1245" y="266" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateCatchEvent_0ui7e2m_di" bpmnElement="IntermediateCatchEvent_0ui7e2m"> - <dc:Bounds x="870" y="89" width="36" height="36" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1msw3xo_di" bpmnElement="SequenceFlow_1msw3xo"> + <di:waypoint xsi:type="dc:Point" x="430" y="-401" /> + <di:waypoint xsi:type="dc:Point" x="563" y="-400" /> <bpmndi:BPMNLabel> - <dc:Bounds x="850" y="125" width="85" height="28" /> + <dc:Bounds x="499.95320010152244" y="-422.3646305622811" width="18" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0y6ox5c_di" bpmnElement="ScriptTask_0y6ox5c"> - <dc:Bounds x="1442" y="266" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_02l57i8_di" bpmnElement="ExclusiveGateway_02l57i8" isMarkerVisible="true"> - <dc:Bounds x="1467" y="82" width="50" height="50" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0cql41g_di" bpmnElement="IntermediateCatchEvent_0cql41g"> + <dc:Bounds x="-9" y="-131" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1461" y="50" width="56" height="28" /> + <dc:Bounds x="-29" y="-95" width="85" height="28" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ecyqjf_di" bpmnElement="SequenceFlow_0ecyqjf"> - <di:waypoint xsi:type="dc:Point" x="906" y="-689" /> - <di:waypoint xsi:type="dc:Point" x="1042" y="-689" /> + <bpmndi:BPMNEdge id="SequenceFlow_1f71u71_di" bpmnElement="SequenceFlow_1f71u71"> + <di:waypoint xsi:type="dc:Point" x="263" y="-400" /> + <di:waypoint xsi:type="dc:Point" x="380" y="-401" /> <bpmndi:BPMNLabel> - <dc:Bounds x="929" y="-711" width="0" height="14" /> + <dc:Bounds x="321.5" y="-422.5" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1sql6c3_di" bpmnElement="SequenceFlow_1sql6c3"> - <di:waypoint xsi:type="dc:Point" x="1142" y="-402" /> - <di:waypoint xsi:type="dc:Point" x="1245" y="-402" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ttrqml_di" bpmnElement="SequenceFlow_1ttrqml"> + <di:waypoint xsi:type="dc:Point" x="27" y="-113" /> + <di:waypoint xsi:type="dc:Point" x="163" y="-113" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1149.5" y="-424" width="0" height="14" /> + <dc:Bounds x="50" y="-135" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1soxbjk_di" bpmnElement="SequenceFlow_1soxbjk"> - <di:waypoint xsi:type="dc:Point" x="1345" y="-402" /> - <di:waypoint xsi:type="dc:Point" x="1442" y="-402" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0wbo4nq_di" bpmnElement="IntermediateThrowEvent_0wbo4nq"> + <dc:Bounds x="1026" y="-418" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1349.5" y="-424" width="0" height="14" /> + <dc:Bounds x="1004" y="-377" width="85" height="42" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_170nvzi_di" bpmnElement="SequenceFlow_170nvzi"> - <di:waypoint xsi:type="dc:Point" x="1778" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1848" y="-28" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0yz8d8c_di" bpmnElement="ScriptTask_0yz8d8c"> + <dc:Bounds x="573" y="12" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04hwfll_di" bpmnElement="SequenceFlow_04hwfll"> + <di:waypoint xsi:type="dc:Point" x="331" y="411" /> + <di:waypoint xsi:type="dc:Point" x="509" y="411" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1768" y="-50" width="0" height="14" /> + <dc:Bounds x="375" y="389" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tlym3z_di" bpmnElement="SequenceFlow_1tlym3z"> - <di:waypoint xsi:type="dc:Point" x="1142" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1194" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1194" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1245" y="-28" /> + <bpmndi:BPMNShape id="ScriptTask_1y8kdt3_di" bpmnElement="ScriptTask_1y8kdt3"> + <dc:Bounds x="563" y="-440" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kcu53z_di" bpmnElement="SequenceFlow_1kcu53z"> + <di:waypoint xsi:type="dc:Point" x="663" y="-400" /> + <di:waypoint xsi:type="dc:Point" x="792" y="-401" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1164" y="-35" width="0" height="14" /> + <dc:Bounds x="727.5" y="-422.5" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0z0u7x1_di" bpmnElement="SequenceFlow_0z0u7x1"> - <di:waypoint xsi:type="dc:Point" x="1345" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1394" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1394" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1442" y="-28" /> + <bpmndi:BPMNShape id="ExclusiveGateway_0pj14lp_di" bpmnElement="ExclusiveGateway_0pj14lp" isMarkerVisible="true"> + <dc:Bounds x="792" y="-426" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="776" y="-458" width="83" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0o376do_di" bpmnElement="SequenceFlow_0o376do"> + <di:waypoint xsi:type="dc:Point" x="842" y="-401" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="-400" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1364" y="-35" width="0" height="14" /> + <dc:Bounds x="924.8735220112762" y="-422.0003436810377" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_114wjuf_di" bpmnElement="SequenceFlow_114wjuf"> - <di:waypoint xsi:type="dc:Point" x="906" y="-402" /> - <di:waypoint xsi:type="dc:Point" x="1042" y="-402" /> + <bpmndi:BPMNEdge id="SequenceFlow_1y8xkzy_di" bpmnElement="SequenceFlow_1y8xkzy"> + <di:waypoint xsi:type="dc:Point" x="817" y="-376" /> + <di:waypoint xsi:type="dc:Point" x="817" y="-300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="929" y="-424" width="0" height="14" /> + <dc:Bounds x="827" y="-357" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_000q9m3_di" bpmnElement="SequenceFlow_000q9m3"> - <di:waypoint xsi:type="dc:Point" x="1545" y="-402" /> - <di:waypoint xsi:type="dc:Point" x="1678" y="-402" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1y4vypx_di" bpmnElement="IntermediateThrowEvent_1y4vypx"> + <dc:Bounds x="799" y="-300" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="777" y="-259" width="85" height="42" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0o0n3fa_di" bpmnElement="EndEvent_0o0n3fa"> + <dc:Bounds x="794" y="733" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1567.5" y="-424" width="0" height="14" /> + <dc:Bounds x="758" y="775" width="84" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1lazb8l_di" bpmnElement="ScriptTask_1lazb8l"> + <dc:Bounds x="762" y="512" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0buj724_di" bpmnElement="ScriptTask_0buj724"> + <dc:Bounds x="139" y="512" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0rixvgj_di" bpmnElement="ScriptTask_0rixvgj"> + <dc:Bounds x="342" y="512" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1kgvq5e_di" bpmnElement="ServiceTask_1kgvq5e"> + <dc:Bounds x="-41" y="711" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_17s3yrn_di" bpmnElement="ScriptTask_17s3yrn"> + <dc:Bounds x="231" y="711" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_18h4prx_di" bpmnElement="IntermediateCatchEvent_18h4prx"> + <dc:Bounds x="-9" y="534" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-29" y="570" width="85" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03gddkg_di" bpmnElement="ScriptTask_03gddkg"> + <dc:Bounds x="496" y="711" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0z9axn6_di" bpmnElement="SequenceFlow_0z9axn6"> + <di:waypoint xsi:type="dc:Point" x="239" y="552" /> + <di:waypoint xsi:type="dc:Point" x="342" y="552" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="246" y="530" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1lhdwv6_di" bpmnElement="SequenceFlow_1lhdwv6"> - <di:waypoint xsi:type="dc:Point" x="1728" y="-362" /> - <di:waypoint xsi:type="dc:Point" x="1728" y="-316" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="-316" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="-271" /> + <bpmndi:BPMNEdge id="SequenceFlow_131f1jj_di" bpmnElement="SequenceFlow_131f1jj"> + <di:waypoint xsi:type="dc:Point" x="596" y="751" /> + <di:waypoint xsi:type="dc:Point" x="794" y="751" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1365" y="-338" width="0" height="14" /> + <dc:Bounds x="650" y="729" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1bo3fu4_di" bpmnElement="SequenceFlow_1bo3fu4"> - <di:waypoint xsi:type="dc:Point" x="1542" y="-28" /> - <di:waypoint xsi:type="dc:Point" x="1678" y="-28" /> + <bpmndi:BPMNEdge id="SequenceFlow_18gb81f_di" bpmnElement="SequenceFlow_18gb81f"> + <di:waypoint xsi:type="dc:Point" x="812" y="592" /> + <di:waypoint xsi:type="dc:Point" x="812" y="641" /> + <di:waypoint xsi:type="dc:Point" x="9" y="641" /> + <di:waypoint xsi:type="dc:Point" x="9" y="711" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1565" y="-50" width="0" height="14" /> + <dc:Bounds x="365.5" y="619" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0t0jlzs_di" bpmnElement="SequenceFlow_0t0jlzs"> - <di:waypoint xsi:type="dc:Point" x="1142" y="-231" /> - <di:waypoint xsi:type="dc:Point" x="1245" y="-231" /> + <bpmndi:BPMNEdge id="SequenceFlow_0wnyy50_di" bpmnElement="SequenceFlow_0wnyy50"> + <di:waypoint xsi:type="dc:Point" x="27" y="552" /> + <di:waypoint xsi:type="dc:Point" x="139" y="552" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1148.5" y="-253" width="0" height="14" /> + <dc:Bounds x="38" y="530" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_06fak6j_di" bpmnElement="SequenceFlow_06fak6j"> - <di:waypoint xsi:type="dc:Point" x="1345" y="-231" /> - <di:waypoint xsi:type="dc:Point" x="1442" y="-231" /> + <bpmndi:BPMNEdge id="SequenceFlow_04l4to1_di" bpmnElement="SequenceFlow_04l4to1"> + <di:waypoint xsi:type="dc:Point" x="442" y="552" /> + <di:waypoint xsi:type="dc:Point" x="564" y="552" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1348.5" y="-253" width="0" height="14" /> + <dc:Bounds x="458" y="530" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0lpbqkc_di" bpmnElement="SequenceFlow_0lpbqkc"> - <di:waypoint xsi:type="dc:Point" x="1728" y="-191" /> - <di:waypoint xsi:type="dc:Point" x="1728" y="-137" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="-137" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="-68" /> + <bpmndi:BPMNEdge id="SequenceFlow_1wn6y9u_di" bpmnElement="SequenceFlow_1wn6y9u"> + <di:waypoint xsi:type="dc:Point" x="331" y="751" /> + <di:waypoint xsi:type="dc:Point" x="496" y="751" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1365" y="-159" width="0" height="14" /> + <dc:Bounds x="368.5" y="729" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1jgurvk_di" bpmnElement="SequenceFlow_1jgurvk"> - <di:waypoint xsi:type="dc:Point" x="1142" y="-689" /> - <di:waypoint xsi:type="dc:Point" x="1259" y="-690" /> + <bpmndi:BPMNShape id="ExclusiveGateway_1cz6dwq_di" bpmnElement="ExclusiveGateway_1cz6dwq" isMarkerVisible="true"> + <dc:Bounds x="564" y="527" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="558" y="495" width="56" height="28" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0dkbe3r_di" bpmnElement="SequenceFlow_0dkbe3r"> + <di:waypoint xsi:type="dc:Point" x="59" y="751" /> + <di:waypoint xsi:type="dc:Point" x="231" y="751" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1156.5" y="-710.5" width="0" height="14" /> + <dc:Bounds x="100" y="729" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0u3tca8_di" bpmnElement="SequenceFlow_0u3tca8"> - <di:waypoint xsi:type="dc:Point" x="1284" y="-665" /> - <di:waypoint xsi:type="dc:Point" x="1284" y="-571" /> - <di:waypoint xsi:type="dc:Point" x="1404" y="-571" /> - <di:waypoint xsi:type="dc:Point" x="1404" y="-571" /> - <di:waypoint xsi:type="dc:Point" x="1678" y="-571" /> + <bpmndi:BPMNEdge id="SequenceFlow_1wq9f5k_di" bpmnElement="SequenceFlow_1wq9f5k"> + <di:waypoint xsi:type="dc:Point" x="614" y="552" /> + <di:waypoint xsi:type="dc:Point" x="762" y="552" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1268" y="-658" width="12" height="14" /> + <dc:Bounds x="679" y="530" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_11pvz8i_di" bpmnElement="SequenceFlow_11pvz8i"> - <di:waypoint xsi:type="dc:Point" x="1309" y="-690" /> - <di:waypoint xsi:type="dc:Point" x="1442" y="-689" /> + <bpmndi:BPMNEdge id="SequenceFlow_1swgag2_di" bpmnElement="SequenceFlow_1swgag2"> + <di:waypoint xsi:type="dc:Point" x="589" y="577" /> + <di:waypoint xsi:type="dc:Point" x="589" y="641" /> + <di:waypoint xsi:type="dc:Point" x="9" y="641" /> + <di:waypoint xsi:type="dc:Point" x="9" y="711" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1378.5" y="-711.5" width="18" height="14" /> + <dc:Bounds x="293.22499999999997" y="619" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_06avdut_di" bpmnElement="SequenceFlow_06avdut"> - <di:waypoint xsi:type="dc:Point" x="1721" y="-690" /> - <di:waypoint xsi:type="dc:Point" x="1835" y="-689" /> + <bpmndi:BPMNShape id="ScriptTask_1pdhttw_di" bpmnElement="ScriptTask_1pdhttw"> + <dc:Bounds x="573" y="187" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1662gjm_di" bpmnElement="ExclusiveGateway_1662gjm" isMarkerVisible="true"> + <dc:Bounds x="386" y="27" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="384" y="-25" width="55" height="42" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1we7izu_di" bpmnElement="ExclusiveGateway_1we7izu" isMarkerVisible="true"> + <dc:Bounds x="823" y="202" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="880" y="206" width="68" height="42" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_18auy29_di" bpmnElement="ScriptTask_18auy29"> + <dc:Bounds x="509" y="371" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0a8k9xi_di" bpmnElement="SequenceFlow_0a8k9xi"> + <di:waypoint xsi:type="dc:Point" x="609" y="411" /> + <di:waypoint xsi:type="dc:Point" x="704" y="411" /> + <di:waypoint xsi:type="dc:Point" x="704" y="411" /> + <di:waypoint xsi:type="dc:Point" x="799" y="411" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1769" y="-710.5" width="18" height="14" /> + <dc:Bounds x="674" y="404" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0cuvrsr_di" bpmnElement="SequenceFlow_0cuvrsr"> - <di:waypoint xsi:type="dc:Point" x="1542" y="-231" /> - <di:waypoint xsi:type="dc:Point" x="1678" y="-231" /> + <bpmndi:BPMNEdge id="SequenceFlow_15mvx68_di" bpmnElement="SequenceFlow_15mvx68"> + <di:waypoint xsi:type="dc:Point" x="59" y="52" /> + <di:waypoint xsi:type="dc:Point" x="163" y="52" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1565" y="-253" width="0" height="14" /> + <dc:Bounds x="66" y="30" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1lqmzex_di" bpmnElement="SequenceFlow_1lqmzex"> - <di:waypoint xsi:type="dc:Point" x="1542" y="-689" /> - <di:waypoint xsi:type="dc:Point" x="1671" y="-690" /> + <bpmndi:BPMNEdge id="SequenceFlow_0wp73cw_di" bpmnElement="SequenceFlow_0wp73cw"> + <di:waypoint xsi:type="dc:Point" x="263" y="52" /> + <di:waypoint xsi:type="dc:Point" x="386" y="52" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1606.5" y="-711.5" width="0" height="14" /> + <dc:Bounds x="279.5" y="30" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1pwflny_di" bpmnElement="SequenceFlow_1pwflny"> - <di:waypoint xsi:type="dc:Point" x="1696" y="-665" /> - <di:waypoint xsi:type="dc:Point" x="1696" y="-589" /> + <bpmndi:BPMNEdge id="SequenceFlow_13s0mg5_di" bpmnElement="SequenceFlow_13s0mg5"> + <di:waypoint xsi:type="dc:Point" x="436" y="52" /> + <di:waypoint xsi:type="dc:Point" x="573" y="52" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1706" y="-646" width="12" height="14" /> + <dc:Bounds x="496" y="30" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0vhbw8y_di" bpmnElement="SequenceFlow_0vhbw8y"> - <di:waypoint xsi:type="dc:Point" x="1542" y="306" /> - <di:waypoint xsi:type="dc:Point" x="1848" y="306" /> + <bpmndi:BPMNEdge id="SequenceFlow_0fkfn70_di" bpmnElement="SequenceFlow_0fkfn70"> + <di:waypoint xsi:type="dc:Point" x="673" y="52" /> + <di:waypoint xsi:type="dc:Point" x="798" y="52" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1695" y="284" width="0" height="14" /> + <dc:Bounds x="690.5" y="30" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_03mc2qq_di" bpmnElement="SequenceFlow_03mc2qq"> - <di:waypoint xsi:type="dc:Point" x="1517" y="107" /> - <di:waypoint xsi:type="dc:Point" x="1665" y="107" /> + <bpmndi:BPMNEdge id="SequenceFlow_1suwdgi_di" bpmnElement="SequenceFlow_1suwdgi"> + <di:waypoint xsi:type="dc:Point" x="673" y="-113" /> + <di:waypoint xsi:type="dc:Point" x="848" y="-113" /> + <di:waypoint xsi:type="dc:Point" x="848" y="-39" /> + <di:waypoint xsi:type="dc:Point" x="9" y="-39" /> + <di:waypoint xsi:type="dc:Point" x="9" y="12" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1582" y="85" width="18" height="14" /> + <dc:Bounds x="818" y="-83" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_03ngo7h_di" bpmnElement="SequenceFlow_03ngo7h"> - <di:waypoint xsi:type="dc:Point" x="1715" y="147" /> - <di:waypoint xsi:type="dc:Point" x="1715" y="196" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="196" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="266" /> + <bpmndi:BPMNEdge id="SequenceFlow_0kkou66_di" bpmnElement="SequenceFlow_0kkou66"> + <di:waypoint xsi:type="dc:Point" x="623" y="187" /> + <di:waypoint xsi:type="dc:Point" x="623" y="92" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1403.5" y="174" width="0" height="14" /> + <dc:Bounds x="593" y="132.5" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1x1sk3t_di" bpmnElement="SequenceFlow_1x1sk3t"> - <di:waypoint xsi:type="dc:Point" x="906" y="107" /> - <di:waypoint xsi:type="dc:Point" x="1042" y="107" /> + <bpmndi:BPMNEdge id="SequenceFlow_1luhljs_di" bpmnElement="SequenceFlow_1luhljs"> + <di:waypoint xsi:type="dc:Point" x="848" y="92" /> + <di:waypoint xsi:type="dc:Point" x="848" y="202" /> <bpmndi:BPMNLabel> - <dc:Bounds x="929" y="85" width="0" height="14" /> + <dc:Bounds x="818" y="140" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_02l74nc_di" bpmnElement="SequenceFlow_02l74nc"> - <di:waypoint xsi:type="dc:Point" x="1142" y="107" /> - <di:waypoint xsi:type="dc:Point" x="1245" y="107" /> + <bpmndi:BPMNEdge id="SequenceFlow_1udji9x_di" bpmnElement="SequenceFlow_1udji9x"> + <di:waypoint xsi:type="dc:Point" x="823" y="227" /> + <di:waypoint xsi:type="dc:Point" x="673" y="227" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1193.5" y="85" width="0" height="14" /> + <dc:Bounds x="746" y="208" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ff0jf2_di" bpmnElement="SequenceFlow_0ff0jf2"> - <di:waypoint xsi:type="dc:Point" x="1345" y="107" /> - <di:waypoint xsi:type="dc:Point" x="1467" y="107" /> + <bpmndi:BPMNShape id="EndEvent_19joonf_di" bpmnElement="EndEvent_19joonf"> + <dc:Bounds x="387" y="197" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1406" y="85" width="0" height="14" /> + <dc:Bounds x="360" y="236" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_12seu6n_di" bpmnElement="SequenceFlow_12seu6n"> + <di:waypoint xsi:type="dc:Point" x="411" y="77" /> + <di:waypoint xsi:type="dc:Point" x="411" y="137" /> + <di:waypoint xsi:type="dc:Point" x="9" y="137" /> + <di:waypoint xsi:type="dc:Point" x="9" y="175" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="183.26272082138004" y="113.00000000000001" width="12" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_177yb27_di" bpmnElement="SequenceFlow_177yb27"> - <di:waypoint xsi:type="dc:Point" x="1492" y="132" /> - <di:waypoint xsi:type="dc:Point" x="1492" y="196" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="196" /> - <di:waypoint xsi:type="dc:Point" x="1092" y="266" /> + <bpmndi:BPMNEdge id="SequenceFlow_0y2g8mr_di" bpmnElement="SequenceFlow_0y2g8mr"> + <di:waypoint xsi:type="dc:Point" x="848" y="252" /> + <di:waypoint xsi:type="dc:Point" x="848" y="324" /> + <di:waypoint xsi:type="dc:Point" x="9" y="324" /> + <di:waypoint xsi:type="dc:Point" x="9" y="371" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1286" y="174" width="13" height="14" /> + <dc:Bounds x="419.8991436726927" y="302" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1784pcx_di" bpmnElement="SequenceFlow_1784pcx"> - <di:waypoint xsi:type="dc:Point" x="1142" y="306" /> - <di:waypoint xsi:type="dc:Point" x="1176" y="306" /> - <di:waypoint xsi:type="dc:Point" x="1241" y="306" /> + <bpmndi:BPMNShape id="ScriptTask_07cq0pw_di" bpmnElement="ScriptTask_07cq0pw"> + <dc:Bounds x="-41" y="175" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1ixmamy_di" bpmnElement="ServiceTask_1ixmamy"> + <dc:Bounds x="166" y="175" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0i9iiuo_di" bpmnElement="SequenceFlow_0i9iiuo"> + <di:waypoint xsi:type="dc:Point" x="59" y="215" /> + <di:waypoint xsi:type="dc:Point" x="166" y="215" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1159" y="284" width="0" height="14" /> + <dc:Bounds x="68.5" y="193" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1xhcwoo_di" bpmnElement="SequenceFlow_1xhcwoo"> - <di:waypoint xsi:type="dc:Point" x="1345" y="306" /> - <di:waypoint xsi:type="dc:Point" x="1400" y="306" /> - <di:waypoint xsi:type="dc:Point" x="1400" y="306" /> - <di:waypoint xsi:type="dc:Point" x="1442" y="306" /> + <bpmndi:BPMNEdge id="SequenceFlow_1mei7hu_di" bpmnElement="SequenceFlow_1mei7hu"> + <di:waypoint xsi:type="dc:Point" x="266" y="215" /> + <di:waypoint xsi:type="dc:Point" x="387" y="215" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1415" y="299" width="0" height="14" /> + <dc:Bounds x="326.5" y="193" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn new file mode 100644 index 0000000000..be15908697 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> + <bpmn:process id="DeleteDeviceResource.bpmn" name="DeleteDeviceResource.bpmn" isExecutable="true"> + <bpmn:endEvent id="EndEvent_1x6k78c" name="delete Dev end"> + <bpmn:incoming>SequenceFlow_0auvfvm</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_05niqbf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0auvfvm</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeleteDeviceResource.bpmn() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_05niqbf" sourceRef="Task_0bga3e8" targetRef="ScriptTask_1g5zyi6" /> + <bpmn:sequenceFlow id="SequenceFlow_0auvfvm" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" /> + <bpmn:callActivity id="Task_0bga3e8" name="call Delete SDNC Network Resource" calledElement="DeleteSDNCNetworkResource"> + <bpmn:extensionElements> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="recipeParams" target="recipeParams" /> + <camunda:in source="resourceInput" target="resourceInput" /> + <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="svcAction" target="svcAction" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> + <camunda:in source="networkRequest" target="networkRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1gu13by</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:startEvent id="StartEvent_1vjxae6" name="deleteDev_StartEvent"> + <bpmn:outgoing>SequenceFlow_1rwaeun</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1caax8u" name="GoTo StartDeleteDevinSDNC"> + <bpmn:incoming>SequenceFlow_1ylvnxq</bpmn:incoming> + <bpmn:linkEventDefinition name="StartDeleteDevinSDNC" /> + </bpmn:intermediateThrowEvent> + <bpmn:scriptTask id="ScriptTask_00y93jj" name="Check DevType from AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0rq2jb1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1hp2h5t</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteDeviceResource() +dcsi.checkDevType(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0kba700" name="Dev Type" default="SequenceFlow_076ma0v"> + <bpmn:incoming>SequenceFlow_1hp2h5t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ss02ik</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0h4378g</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_076ma0v</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1chnlq6" name="GoTo StartDeleteDevinSDNC"> + <bpmn:incoming>SequenceFlow_0h4378g</bpmn:incoming> + <bpmn:linkEventDefinition name="StartDeleteDevinSDNC" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_1ss02ik" name="VNF" sourceRef="ExclusiveGateway_0kba700" targetRef="ScriptTask_02rli65"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "VNF" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1hp2h5t" sourceRef="ScriptTask_00y93jj" targetRef="ExclusiveGateway_0kba700" /> + <bpmn:sequenceFlow id="SequenceFlow_0h4378g" name="PNF" sourceRef="ExclusiveGateway_0kba700" targetRef="IntermediateThrowEvent_1chnlq6"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("device_class" ) == "PNF" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1rwaeun" sourceRef="StartEvent_1vjxae6" targetRef="ScriptTask_14dav1d" /> + <bpmn:scriptTask id="ScriptTask_14dav1d" name="Pre Process Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1rwaeun</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rq2jb1</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteDeviceResource() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0rq2jb1" sourceRef="ScriptTask_14dav1d" targetRef="ScriptTask_00y93jj" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0slgrxw" name="StartDeleteDevinSDNC"> + <bpmn:outgoing>SequenceFlow_1gu13by</bpmn:outgoing> + <bpmn:linkEventDefinition name="StartDeleteDevinSDNC" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_1gu13by" sourceRef="IntermediateCatchEvent_0slgrxw" targetRef="Task_0bga3e8" /> + <bpmn:callActivity id="CallActivity_0pyrfca" name="call DeleteVNF" calledElement="DoDeleteVNF"> + <bpmn:extensionElements> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="recipeParams" target="recipeParams" /> + <camunda:in source="resourceInput" target="resourceInput" /> + <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="svcAction" target="svcAction" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> + <camunda:in source="networkRequest" target="networkRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0pg3072</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0pkp4ce</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0pkp4ce" sourceRef="CallActivity_0pyrfca" targetRef="ScriptTask_0u1piih" /> + <bpmn:endEvent id="EndEvent_0ymfq61"> + <bpmn:incoming>SequenceFlow_076ma0v</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_076ma0v" sourceRef="ExclusiveGateway_0kba700" targetRef="EndEvent_0ymfq61" /> + <bpmn:scriptTask id="ScriptTask_02rli65" name="Get VNF ID" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ss02ik</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0pg3072</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteDeviceResource() +dcsi.getVNFTemplatefromSDC(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0pg3072" sourceRef="ScriptTask_02rli65" targetRef="CallActivity_0pyrfca" /> + <bpmn:scriptTask id="ScriptTask_0u1piih" name="Post VNF info process " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0pkp4ce</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ylvnxq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteDeviceResource() +dcsi.postVNFInfoProcess(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1ylvnxq" sourceRef="ScriptTask_0u1piih" targetRef="IntermediateThrowEvent_1caax8u" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteDeviceResource.bpmn"> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1026" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="994" y="153" width="75" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6"> + <dc:Bounds x="494" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_05niqbf_di" bpmnElement="SequenceFlow_05niqbf"> + <di:waypoint xsi:type="dc:Point" x="191" y="129" /> + <di:waypoint xsi:type="dc:Point" x="494" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="297.5" y="104" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0auvfvm_di" bpmnElement="SequenceFlow_0auvfvm"> + <di:waypoint xsi:type="dc:Point" x="594" y="129" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="765" y="104" width="90" height="20" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0aywvn3_di" bpmnElement="Task_0bga3e8"> + <dc:Bounds x="91" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1vjxae6_di" bpmnElement="StartEvent_1vjxae6"> + <dc:Bounds x="-188" y="-145" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-211" y="-109" width="88" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1caax8u_di" bpmnElement="IntermediateThrowEvent_1caax8u"> + <dc:Bounds x="1026" y="-145" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1010" y="-104" width="77" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_00y93jj_di" bpmnElement="ScriptTask_00y93jj"> + <dc:Bounds x="141" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0kba700_di" bpmnElement="ExclusiveGateway_0kba700" isMarkerVisible="true"> + <dc:Bounds x="334" y="-152" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="309" y="-166" width="34" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1chnlq6_di" bpmnElement="IntermediateThrowEvent_1chnlq6"> + <dc:Bounds x="341" y="-28" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="325" y="13" width="78" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ss02ik_di" bpmnElement="SequenceFlow_1ss02ik"> + <di:waypoint xsi:type="dc:Point" x="384" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="480" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420.94444444444446" y="-148" width="23" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1hp2h5t_di" bpmnElement="SequenceFlow_1hp2h5t"> + <di:waypoint xsi:type="dc:Point" x="241" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="334" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="242.5" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0h4378g_di" bpmnElement="SequenceFlow_0h4378g"> + <di:waypoint xsi:type="dc:Point" x="359" y="-102" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-28" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="365" y="-67.27272727272728" width="22" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rwaeun_di" bpmnElement="SequenceFlow_1rwaeun"> + <di:waypoint xsi:type="dc:Point" x="-152" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="-53" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-147.5" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_14dav1d_di" bpmnElement="ScriptTask_14dav1d"> + <dc:Bounds x="-53" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rq2jb1_di" bpmnElement="SequenceFlow_0rq2jb1"> + <di:waypoint xsi:type="dc:Point" x="47" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="141" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="49" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0slgrxw_di" bpmnElement="IntermediateCatchEvent_0slgrxw"> + <dc:Bounds x="-188" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-203" y="147" width="78" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1gu13by_di" bpmnElement="SequenceFlow_1gu13by"> + <di:waypoint xsi:type="dc:Point" x="-152" y="129" /> + <di:waypoint xsi:type="dc:Point" x="91" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-75.5" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0pyrfca_di" bpmnElement="CallActivity_0pyrfca"> + <dc:Bounds x="662" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0pkp4ce_di" bpmnElement="SequenceFlow_0pkp4ce"> + <di:waypoint xsi:type="dc:Point" x="762" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="849" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="760.5" y="-148" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0ymfq61_di" bpmnElement="EndEvent_0ymfq61"> + <dc:Bounds x="341" y="-251" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="359" y="-211" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_076ma0v_di" bpmnElement="SequenceFlow_076ma0v"> + <di:waypoint xsi:type="dc:Point" x="359" y="-152" /> + <di:waypoint xsi:type="dc:Point" x="359" y="-215" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="374" y="-189.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_02rli65_di" bpmnElement="ScriptTask_02rli65"> + <dc:Bounds x="480" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0pg3072_di" bpmnElement="SequenceFlow_0pg3072"> + <di:waypoint xsi:type="dc:Point" x="580" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="662" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="621" y="-148" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u1piih_di" bpmnElement="ScriptTask_0u1piih"> + <dc:Bounds x="849" y="-167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ylvnxq_di" bpmnElement="SequenceFlow_1ylvnxq"> + <di:waypoint xsi:type="dc:Point" x="949" y="-127" /> + <di:waypoint xsi:type="dc:Point" x="1026" y="-127" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987.5" y="-148" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 781a54be80..00c0288246 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -137,6 +137,15 @@ csi.sendSyncResponse(execution)</bpmn:script> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_00vqgvt" sourceRef="Task_1xychp0" targetRef="PreprocessIncomingRequest_task" /> <bpmn:callActivity id="Task_1xychp0" name="Call Deactivate SDNC Network Resource" calledElement="DeActivateSDNCNetworkResource"> + <bpmn:extensionElements> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="requestAction" target="requestAction" /> + <camunda:in source="recipeParams" target="recipeParams" /> + <camunda:in source="recipeParams" target="recipeParams" /> + <camunda:in source="recipeParamXsd" target="recipeParamXsd" /> + <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" /> + <camunda:in source="resourceInput" target="resourceInput" /> + </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0h3klf0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_00vqgvt</bpmn:outgoing> </bpmn:callActivity> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn index a835946d1d..0d287ebca4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVcpeResCustService.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DeleteVcpeResCustService" name="DeleteVcpeResCustService" isExecutable="true"> <bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> @@ -138,26 +138,12 @@ DeleteVcpeResCustService.prepareFalloutRequest(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_04ao07f</bpmn2:incoming> <bpmn2:linkEventDefinition name="FinishProcess" /> </bpmn2:intermediateThrowEvent> - <bpmn2:callActivity id="callGetServiceInstance" name="Get Service Instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:in source="GENGS_type" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - </bpmn2:extensionElements> + <bpmn2:scriptTask id="ScriptTask_05m3m2e" name=" AAI Query (svc instance) " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0jek18q</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1ttswdr</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:scriptTask id="ScriptTask_05m3m2e" name="Process Response & ready data for subflows" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1ttswdr</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_18103ca</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* def DeleteVcpeResCustService = new DeleteVcpeResCustService() -DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script> +DeleteVcpeResCustService.getServiceInstance(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_112zjtp" name="QueryServiceInstance"> <bpmn2:outgoing>SequenceFlow_0jek18q</bpmn2:outgoing> @@ -167,10 +153,9 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_18103ca</bpmn2:incoming> <bpmn2:linkEventDefinition name="DeleteBRG" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0jek18q" sourceRef="IntermediateCatchEvent_112zjtp" targetRef="callGetServiceInstance" /> + <bpmn2:sequenceFlow id="SequenceFlow_0jek18q" sourceRef="IntermediateCatchEvent_112zjtp" targetRef="ScriptTask_05m3m2e" /> <bpmn2:sequenceFlow id="SequenceFlow_18103ca" sourceRef="ScriptTask_05m3m2e" targetRef="IntermediateThrowEvent_162gs5w" /> <bpmn2:sequenceFlow id="SequenceFlow_04ao07f" sourceRef="doDeleteServiceInstance_CallActivity" targetRef="IntermediateThrowEvent_0prlju0" /> - <bpmn2:sequenceFlow id="SequenceFlow_1ttswdr" sourceRef="callGetServiceInstance" targetRef="ScriptTask_05m3m2e" /> <bpmn2:callActivity id="CallActivity_1yap348" name="Delete BRG Resources " calledElement="DoDeleteAllottedResourceBRG"> <bpmn2:extensionElements> <camunda:in source="msoRequestId" target="msoRequestId" /> @@ -508,11 +493,8 @@ DeleteVcpeResCustService.validateVnfDelete(execution)]]></bpmn2:script> <dc:Bounds x="491" y="1072" width="70" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0nmoax4_di" bpmnElement="callGetServiceInstance"> - <dc:Bounds x="285" y="254" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_05m3m2e_di" bpmnElement="ScriptTask_05m3m2e"> - <dc:Bounds x="476" y="254" width="100" height="80" /> + <dc:Bounds x="382" y="254" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_112zjtp_di" bpmnElement="IntermediateCatchEvent_112zjtp"> <dc:Bounds x="96" y="276" width="36" height="36" /> @@ -528,16 +510,16 @@ DeleteVcpeResCustService.validateVnfDelete(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0jek18q_di" bpmnElement="SequenceFlow_0jek18q"> <di:waypoint xsi:type="dc:Point" x="132" y="294" /> - <di:waypoint xsi:type="dc:Point" x="285" y="294" /> + <di:waypoint xsi:type="dc:Point" x="382" y="294" /> <bpmndi:BPMNLabel> - <dc:Bounds x="209" y="279" width="0" height="0" /> + <dc:Bounds x="212" y="279" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18103ca_di" bpmnElement="SequenceFlow_18103ca"> - <di:waypoint xsi:type="dc:Point" x="576" y="294" /> + <di:waypoint xsi:type="dc:Point" x="482" y="294" /> <di:waypoint xsi:type="dc:Point" x="732" y="294" /> <bpmndi:BPMNLabel> - <dc:Bounds x="654" y="279" width="0" height="0" /> + <dc:Bounds x="562" y="279" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04ao07f_di" bpmnElement="SequenceFlow_04ao07f"> @@ -547,15 +529,6 @@ DeleteVcpeResCustService.validateVnfDelete(execution)]]></bpmn2:script> <dc:Bounds x="447" y="1034" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ttswdr_di" bpmnElement="SequenceFlow_1ttswdr"> - <di:waypoint xsi:type="dc:Point" x="385" y="294" /> - <di:waypoint xsi:type="dc:Point" x="422" y="294" /> - <di:waypoint xsi:type="dc:Point" x="422" y="294" /> - <di:waypoint xsi:type="dc:Point" x="476" y="294" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="437" y="294" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_06llof4_di" bpmnElement="SequenceFlow_06llof4"> <di:waypoint xsi:type="dc:Point" x="159" y="1466" /> <di:waypoint xsi:type="dc:Point" x="237" y="1466" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index 28bd3f76ea..1be30d62e4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="UpdateCustomE2EServiceInstance" name="UpdateCustomE2EServiceInstance" isExecutable="true"> <bpmn:startEvent id="StartEvent_00qj6ro" name="Update SI Start Flow"> <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> @@ -176,29 +176,13 @@ csi.sendSyncResponse(execution)]]></bpmn:script> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" /> <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy" /> - <bpmn:callActivity id="CallActivity_1vejucv" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn:extensionElements> + <bpmn:scriptTask id="ScriptTask_0cx1y0g" name="AAI Query (svc instance)" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0az1n4y</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1bd4711</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0cx1y0g" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1bd4711</bpmn:incoming> <bpmn:outgoing>SequenceFlow_03i6zhx</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new UpdateCustomE2EServiceInstance() -dcsi.postProcessAAIGET(execution)]]></bpmn:script> +dcsi.getServiceInstance(execution)]]></bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1bd4711" sourceRef="CallActivity_1vejucv" targetRef="ScriptTask_0cx1y0g" /> <bpmn:scriptTask id="ScriptTask_11y3uq6" name="Post for Compare Model Versions" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0xhbobd</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0t7zinj</bpmn:outgoing> @@ -237,7 +221,7 @@ ddsi.preCompareModelVersions(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_0zmd4rt</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1n8h3zt</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0az1n4y" sourceRef="ScriptTask_1s09c7d" targetRef="CallActivity_1vejucv" /> + <bpmn:sequenceFlow id="SequenceFlow_0az1n4y" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_0cx1y0g" /> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0m01dm3" name="StartDoUpdate"> <bpmn:outgoing>SequenceFlow_04qwbbf</bpmn:outgoing> <bpmn:linkEventDefinition name="StartDoUpdate" /> @@ -354,7 +338,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> - <dc:Bounds x="105" y="158" width="100" height="80" /> + <dc:Bounds x="147" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r"> <dc:Bounds x="782" y="585" width="100" height="80" /> @@ -382,9 +366,9 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> <di:waypoint xsi:type="dc:Point" x="30" y="198" /> - <di:waypoint xsi:type="dc:Point" x="105" y="198" /> + <di:waypoint xsi:type="dc:Point" x="147" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="22.5" y="177" width="90" height="12" /> + <dc:Bounds x="43.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> @@ -500,40 +484,30 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> <dc:Bounds x="875" y="991" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1vejucv_di" bpmnElement="CallActivity_1vejucv"> - <dc:Bounds x="274" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0cx1y0g_di" bpmnElement="ScriptTask_0cx1y0g"> - <dc:Bounds x="451" y="158" width="100" height="80" /> + <dc:Bounds x="364" y="158" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1bd4711_di" bpmnElement="SequenceFlow_1bd4711"> - <di:waypoint xsi:type="dc:Point" x="374" y="198" /> - <di:waypoint xsi:type="dc:Point" x="451" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="367.5" y="177" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_11y3uq6_di" bpmnElement="ScriptTask_11y3uq6"> <dc:Bounds x="959" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0hixtxc_di" bpmnElement="ScriptTask_0hixtxc"> - <dc:Bounds x="614" y="158" width="100" height="80" /> + <dc:Bounds x="563" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1rkoyc5_di" bpmnElement="CallActivity_1rkoyc5"> <dc:Bounds x="782" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_03i6zhx_di" bpmnElement="SequenceFlow_03i6zhx"> - <di:waypoint xsi:type="dc:Point" x="551" y="198" /> - <di:waypoint xsi:type="dc:Point" x="614" y="198" /> + <di:waypoint xsi:type="dc:Point" x="464" y="198" /> + <di:waypoint xsi:type="dc:Point" x="563" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="537.5" y="177" width="90" height="12" /> + <dc:Bounds x="468.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1pdv4qj_di" bpmnElement="SequenceFlow_1pdv4qj"> - <di:waypoint xsi:type="dc:Point" x="714" y="198" /> + <di:waypoint xsi:type="dc:Point" x="663" y="198" /> <di:waypoint xsi:type="dc:Point" x="782" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="703" y="177" width="90" height="12" /> + <dc:Bounds x="677.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0xhbobd_di" bpmnElement="SequenceFlow_0xhbobd"> @@ -550,10 +524,10 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0az1n4y_di" bpmnElement="SequenceFlow_0az1n4y"> - <di:waypoint xsi:type="dc:Point" x="205" y="198" /> - <di:waypoint xsi:type="dc:Point" x="274" y="198" /> + <di:waypoint xsi:type="dc:Point" x="247" y="198" /> + <di:waypoint xsi:type="dc:Point" x="364" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="239.5" y="177" width="0" height="12" /> + <dc:Bounds x="260.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_0m01dm3_di" bpmnElement="IntermediateCatchEvent_0m01dm3"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn index c04c2d97ea..73d3687bfa 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCompareModelofE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCompareModelofE2EServiceInstance" name="DoCompareModelofE2EServiceInstance" isExecutable="true"> <bpmn2:sequenceFlow id="SequenceFlow_1rebkae" sourceRef="StartEvent_0jhv664" targetRef="CallActivity_1va14ul" /> <bpmn2:intermediateCatchEvent id="StartEvent_0jhv664" name="StartCompare"> @@ -70,30 +70,14 @@ def dcsi = new DoCompareModelofE2EServiceInstance() dcsi.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:callActivity id="CallActivity_1a3n88w" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn2:extensionElements> + <bpmn2:scriptTask id="ScriptTask_18k4xnm" name=" AAI Query (svc instance) " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1xzphe4</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0b6eqin</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:scriptTask id="ScriptTask_18k4xnm" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0b6eqin</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1cpg3ku</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCompareModelofE2EServiceInstance() -dcsi.postProcessAAIGET(execution)]]></bpmn2:script> +dcsi.getServiceInstance(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1xzphe4" name="" sourceRef="ScriptTask_0ba0el1" targetRef="CallActivity_1a3n88w" /> - <bpmn2:sequenceFlow id="SequenceFlow_0b6eqin" sourceRef="CallActivity_1a3n88w" targetRef="ScriptTask_18k4xnm" /> + <bpmn2:sequenceFlow id="SequenceFlow_1xzphe4" name="" sourceRef="ScriptTask_0ba0el1" targetRef="ScriptTask_18k4xnm" /> <bpmn2:sequenceFlow id="SequenceFlow_1cpg3ku" sourceRef="ScriptTask_18k4xnm" targetRef="IntermediateThrowEvent_1dhdmdy" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -102,9 +86,9 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCompareModelofE2EServiceInstance"> <bpmndi:BPMNEdge id="SequenceFlow_1rebkae_di" bpmnElement="SequenceFlow_1rebkae"> <di:waypoint xsi:type="dc:Point" x="6" y="259" /> - <di:waypoint xsi:type="dc:Point" x="363" y="259" /> + <di:waypoint xsi:type="dc:Point" x="211" y="259" /> <bpmndi:BPMNLabel> - <dc:Bounds x="139.5" y="238" width="90" height="12" /> + <dc:Bounds x="63.5" y="238" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05z1jyy_di" bpmnElement="StartEvent_0jhv664"> @@ -114,16 +98,16 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0x8im5g_di" bpmnElement="EndEvent_0x8im5g"> - <dc:Bounds x="1038" y="241" width="36" height="36" /> + <dc:Bounds x="912" y="241" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1011" y="281" width="90" height="12" /> + <dc:Bounds x="885" y="281" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1lkpfe2_di" bpmnElement="SequenceFlow_1lkpfe2"> - <di:waypoint xsi:type="dc:Point" x="801" y="259" /> - <di:waypoint xsi:type="dc:Point" x="1038" y="259" /> + <di:waypoint xsi:type="dc:Point" x="607" y="259" /> + <di:waypoint xsi:type="dc:Point" x="912" y="259" /> <bpmndi:BPMNLabel> - <dc:Bounds x="874.5" y="238" width="90" height="12" /> + <dc:Bounds x="714.5" y="238" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0roysbg_di" bpmnElement="SubProcess_0roysbg" isExpanded="true"> @@ -165,9 +149,9 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1dhdmdy_di" bpmnElement="IntermediateThrowEvent_1dhdmdy"> - <dc:Bounds x="1048" y="83" width="36" height="36" /> + <dc:Bounds x="853" y="83" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1023" y="123" width="88" height="36" /> + <dc:Bounds x="838" y="123" width="68" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1chfao3_di" bpmnElement="SequenceFlow_1chfao3"> @@ -178,48 +162,36 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1va14ul_di" bpmnElement="CallActivity_1va14ul"> - <dc:Bounds x="363" y="219" width="100" height="80" /> + <dc:Bounds x="211" y="219" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1odhh8p_di" bpmnElement="ScriptTask_1odhh8p"> - <dc:Bounds x="701" y="219" width="100" height="80" /> + <dc:Bounds x="507" y="219" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1pe6r93_di" bpmnElement="SequenceFlow_1pe6r93"> - <di:waypoint xsi:type="dc:Point" x="463" y="259" /> - <di:waypoint xsi:type="dc:Point" x="701" y="259" /> + <di:waypoint xsi:type="dc:Point" x="311" y="259" /> + <di:waypoint xsi:type="dc:Point" x="507" y="259" /> <bpmndi:BPMNLabel> - <dc:Bounds x="537" y="238" width="90" height="12" /> + <dc:Bounds x="364" y="238" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0ba0el1_di" bpmnElement="ScriptTask_0ba0el1"> <dc:Bounds x="211" y="61" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1a3n88w_di" bpmnElement="CallActivity_1a3n88w"> - <dc:Bounds x="499" y="59" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_18k4xnm_di" bpmnElement="ScriptTask_18k4xnm"> - <dc:Bounds x="776" y="61" width="100" height="80" /> + <dc:Bounds x="507" y="61" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1xzphe4_di" bpmnElement="SequenceFlow_1xzphe4"> - <di:waypoint xsi:type="dc:Point" x="311" y="101" /> - <di:waypoint xsi:type="dc:Point" x="499" y="99" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="360" y="85" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0b6eqin_di" bpmnElement="SequenceFlow_0b6eqin"> - <di:waypoint xsi:type="dc:Point" x="599" y="99" /> - <di:waypoint xsi:type="dc:Point" x="776" y="101" /> + <di:waypoint xsi:type="dc:Point" x="311" y="102" /> + <di:waypoint xsi:type="dc:Point" x="507" y="101" /> <bpmndi:BPMNLabel> - <dc:Bounds x="643.5" y="79" width="0" height="12" /> + <dc:Bounds x="364" y="80.5" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1cpg3ku_di" bpmnElement="SequenceFlow_1cpg3ku"> - <di:waypoint xsi:type="dc:Point" x="876" y="101" /> - <di:waypoint xsi:type="dc:Point" x="968" y="101" /> - <di:waypoint xsi:type="dc:Point" x="968" y="101" /> - <di:waypoint xsi:type="dc:Point" x="1048" y="101" /> + <di:waypoint xsi:type="dc:Point" x="607" y="101" /> + <di:waypoint xsi:type="dc:Point" x="853" y="101" /> <bpmndi:BPMNLabel> - <dc:Bounds x="983" y="95" width="0" height="12" /> + <dc:Bounds x="685" y="80" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn index d7bd54cc4e..6f1609c566 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateAllottedResourceBRG" name="DoCreateAllottedResourceBRG" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -13,49 +13,16 @@ DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() dcar.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="initialization" targetRef="GetAAIServiceInstance" /> - <bpmn2:scriptTask id="buildWorkflowException" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 404, "Input Service Instance Id Not Found in AAI")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="buildWorkflowException" targetRef="EndEvent_1" /> - <bpmn2:callActivity id="GetAAIServiceInstance" name="Get AAI Service Instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:out source="GENGS_FoundIndicator" target="CSI_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="CSI_SuccessIndicator" /> - <camunda:out source="GENGS_serviceInstance" target="CSI_serviceInstance" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_resourceLink" target="CSI_resourceLink" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_service" target="CSI_service" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="GetAAIServiceInstance" targetRef="ServiceInstanceExists" /> - <bpmn2:exclusiveGateway id="ServiceInstanceExists" name="Service Instance Exists in AAI?" default="notFound"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - <bpmn2:outgoing>found</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="ServiceInstanceExists" targetRef="buildWorkflowException" /> <bpmn2:scriptTask id="GetAAIAR" name="Get AAI AR" scriptFormat="groovy"> - <bpmn2:incoming>found</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1a2mcyk</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0gbsa12</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() dcar.getAaiAR(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_2" /> - </bpmn2:endEvent> <bpmn2:scriptTask id="CreateAAIAR" name="Create AAI AR " scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_17p4ohs</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1vg5rfa</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() @@ -181,45 +148,7 @@ dcar.validateSDNCResp(execution, response, "activate" )]]></bpmn2:script> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1iy3cqb" sourceRef="postProcessSDNCGetResponse" targetRef="generateOutputs" /> <bpmn2:sequenceFlow id="SequenceFlow_1dgzhsm" sourceRef="UpdateAAIARActive" targetRef="IntermediateCatchEvent_1f4tse6" /> - <bpmn2:callActivity id="GetAAIParentSI" name="Get AAI Parent ServiceInstance " calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="parentServiceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_SuccessIndicator" target="PSI_SuccessIndicator" /> - <camunda:out source="GENGS_FoundIndicator" target="PSI_FoundIndicator" /> - <camunda:out source="GENGS_serviceInstance" target="PSI_serviceInstance" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_resourceLink" target="PSI_resourceLink" /> - <camunda:out source="GENGS_service" target="PSI_service" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1m8u8dl</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1vg5rfa</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_1vg5rfa" sourceRef="GetAAIParentSI" targetRef="ParentSIExists" /> - <bpmn2:exclusiveGateway id="ParentSIExists" name="Parent Service Instance Exists in AAI?" default="SequenceFlow_0f7u5pu"> - <bpmn2:incoming>SequenceFlow_1vg5rfa</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_17p4ohs</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_0f7u5pu</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_17p4ohs" name="Yes" sourceRef="ParentSIExists" targetRef="CreateAAIAR"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PSI_FoundIndicator" ) == true && execution.getVariable("PSI_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_1hzsbck" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0f7u5pu</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_16o7col</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 404, "BRG alloted resource Parent ServiceInstance:" + -execution.getVariable("parentServiceInstanceId") + - " was not found in AAI")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_0x4moh8"> - <bpmn2:incoming>SequenceFlow_16o7col</bpmn2:incoming> - <bpmn2:errorEventDefinition errorRef="Error_2" /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0f7u5pu" name="No" sourceRef="ParentSIExists" targetRef="ScriptTask_1hzsbck" /> - <bpmn2:sequenceFlow id="SequenceFlow_16o7col" sourceRef="ScriptTask_1hzsbck" targetRef="EndEvent_0x4moh8" /> + <bpmn2:sequenceFlow id="SequenceFlow_1vg5rfa" sourceRef="GetAAIParentSI" targetRef="CreateAAIAR" /> <bpmn2:subProcess id="SubProcess_161pl4g" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_1ibe7qx"> <bpmn2:outgoing>SequenceFlow_1h61pqs</bpmn2:outgoing> @@ -314,9 +243,6 @@ dcar.validateSDNCResp(execution, response, "get" )]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming> <bpmn2:linkEventDefinition name="SDNCTasks" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="found" name="Yes" sourceRef="ServiceInstanceExists" targetRef="GetAAIAR"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CSI_FoundIndicator" ) == true && execution.getVariable("CSI_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0gbsa12" sourceRef="GetAAIAR" targetRef="ActiveARinAAI" /> <bpmn2:scriptTask id="generateOutputs" name="Generate Outputs" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1iy3cqb</bpmn2:incoming> @@ -334,6 +260,22 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmn2:timerEventDefinition> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_0ec9eiq" sourceRef="IntermediateCatchEvent_1f4tse6" targetRef="PreProcessSDNCGet" /> + <bpmn2:sequenceFlow id="SequenceFlow_1a2mcyk" sourceRef="GetAAIServiceInstance" targetRef="GetAAIAR" /> + <bpmn2:scriptTask id="GetAAIServiceInstance" name=" AAI Query (svc instance) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1a2mcyk</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* +DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() +dcar.getServiceInstance(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="GetAAIParentSI" name=" AAI Query (svc instance) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1m8u8dl</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1vg5rfa</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* +DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() +dcar.getParentServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> </bpmn2:process> <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -357,57 +299,16 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_285"> <di:waypoint xsi:type="dc:Point" x="119" y="239" /> - <di:waypoint xsi:type="dc:Point" x="195" y="239" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="157" y="224" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_59" bpmnElement="GetAAIServiceInstance"> - <dc:Bounds x="195" y="199" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_229" bpmnElement="ServiceInstanceExists" isMarkerVisible="true"> - <dc:Bounds x="367" y="217" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="349" y="270" width="83" height="25" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_CallActivity_59" targetElement="_BPMNShape_ExclusiveGateway_229"> - <di:waypoint xsi:type="dc:Point" x="295" y="239" /> - <di:waypoint xsi:type="dc:Point" x="369" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="332" y="224.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_293" bpmnElement="buildWorkflowException"> - <dc:Bounds x="342" y="85" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_229" targetElement="_BPMNShape_ScriptTask_293"> - <di:waypoint xsi:type="dc:Point" x="392" y="217" /> - <di:waypoint xsi:type="dc:Point" x="392" y="165" /> + <di:waypoint xsi:type="dc:Point" x="241" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="371" y="192.6917250252067" width="14" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_225" bpmnElement="EndEvent_1"> - <dc:Bounds x="374" y="-11" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="392" y="30" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_293" targetElement="_BPMNShape_EndEvent_225"> - <di:waypoint xsi:type="dc:Point" x="392" y="85" /> - <di:waypoint xsi:type="dc:Point" x="392" y="58" /> - <di:waypoint xsi:type="dc:Point" x="392" y="58" /> - <di:waypoint xsi:type="dc:Point" x="392" y="25" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="407" y="58" width="0" height="0" /> + <dc:Bounds x="135" y="224.5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_299" bpmnElement="GetAAIAR"> <dc:Bounds x="506" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_300" bpmnElement="CreateAAIAR"> - <dc:Bounds x="1206" y="200" width="100" height="80" /> + <dc:Bounds x="1086" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_228" bpmnElement="EndEvent_3"> <dc:Bounds x="1527" y="776" width="36" height="36" /> @@ -416,11 +317,10 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ScriptTask_300"> - <di:waypoint xsi:type="dc:Point" x="1306" y="240" /> - <di:waypoint xsi:type="dc:Point" x="1338" y="240" /> - <di:waypoint xsi:type="dc:Point" x="1408" y="240" /> + <di:waypoint xsi:type="dc:Point" x="1186" y="240" /> + <di:waypoint xsi:type="dc:Point" x="1311" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1322" y="225" width="0" height="0" /> + <dc:Bounds x="1203.5" y="225" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1q6udwm_di" bpmnElement="SequenceFlow_1q6udwm"> @@ -545,51 +445,12 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="934" y="593.5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0e73um9_di" bpmnElement="GetAAIParentSI"> - <dc:Bounds x="843" y="199" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1vg5rfa_di" bpmnElement="SequenceFlow_1vg5rfa"> <di:waypoint xsi:type="dc:Point" x="943" y="239" /> - <di:waypoint xsi:type="dc:Point" x="1033" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="988" y="224.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1q51t9m_di" bpmnElement="ParentSIExists" isMarkerVisible="true"> - <dc:Bounds x="1033" y="215" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1012" y="265" width="92" height="36" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_17p4ohs_di" bpmnElement="SequenceFlow_17p4ohs"> - <di:waypoint xsi:type="dc:Point" x="1083" y="240" /> - <di:waypoint xsi:type="dc:Point" x="1206" y="241" /> + <di:waypoint xsi:type="dc:Point" x="1058" y="241" /> + <di:waypoint xsi:type="dc:Point" x="1086" y="241" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1127" y="222" width="19" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1hzsbck_di" bpmnElement="ScriptTask_1hzsbck"> - <dc:Bounds x="1008" y="77" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0x4moh8_di" bpmnElement="EndEvent_0x4moh8"> - <dc:Bounds x="1040" y="6" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1058" y="47" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0f7u5pu_di" bpmnElement="SequenceFlow_0f7u5pu"> - <di:waypoint xsi:type="dc:Point" x="1058" y="215" /> - <di:waypoint xsi:type="dc:Point" x="1058" y="186" /> - <di:waypoint xsi:type="dc:Point" x="1058" y="157" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1034" y="173.413457125764" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_16o7col_di" bpmnElement="SequenceFlow_16o7col"> - <di:waypoint xsi:type="dc:Point" x="1059" y="77" /> - <di:waypoint xsi:type="dc:Point" x="1059" y="42" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1074" y="59.5" width="0" height="0" /> + <dc:Bounds x="955.5" y="225" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_161pl4g_di" bpmnElement="SubProcess_161pl4g" isExpanded="true"> @@ -672,7 +533,7 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <di:waypoint xsi:type="dc:Point" x="750" y="240" /> <di:waypoint xsi:type="dc:Point" x="843" y="239" /> <bpmndi:BPMNLabel> - <dc:Bounds x="777" y="224" width="14" height="14" /> + <dc:Bounds x="777" y="223.99999999999994" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0z8luou_di" bpmnElement="SequenceFlow_0z8luou"> @@ -698,18 +559,11 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0sb45m9_di" bpmnElement="IntermediateThrowEvent_1lqaeh8"> - <dc:Bounds x="1408" y="222" width="36" height="36" /> + <dc:Bounds x="1311" y="222" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1456" y="234" width="76" height="12" /> + <dc:Bounds x="1359" y="234" width="77" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="found" sourceElement="_BPMNShape_ExclusiveGateway_229"> - <di:waypoint xsi:type="dc:Point" x="416" y="241" /> - <di:waypoint xsi:type="dc:Point" x="506" y="242" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="432" y="220.27119611047112" width="17" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0gbsa12_di" bpmnElement="SequenceFlow_0gbsa12"> <di:waypoint xsi:type="dc:Point" x="606" y="240" /> <di:waypoint xsi:type="dc:Point" x="700" y="240" /> @@ -750,6 +604,19 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="1061" y="524" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1a2mcyk_di" bpmnElement="SequenceFlow_1a2mcyk"> + <di:waypoint xsi:type="dc:Point" x="341" y="240" /> + <di:waypoint xsi:type="dc:Point" x="506" y="240" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="423.5" y="219" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0m6hxaw_di" bpmnElement="GetAAIServiceInstance"> + <dc:Bounds x="241" y="200" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0m8m8j1_di" bpmnElement="GetAAIParentSI"> + <dc:Bounds x="843" y="199" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn index f26bae0b39..3deaae4e0d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateAllottedResourceTXC" name="DoCreateAllottedResourceTXC" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -12,50 +12,17 @@ DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() dcar.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="initialization" targetRef="GetAAIServiceInstance" /> - <bpmn2:scriptTask id="buildWorkflowException" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 404, "Input Service Instance Id Not Found in AAI")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="buildWorkflowException" targetRef="EndEvent_1" /> - <bpmn2:callActivity id="GetAAIServiceInstance" name="Get AAI Service Instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:out source="GENGS_FoundIndicator" target="CSI_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="CSI_SuccessIndicator" /> - <camunda:out source="GENGS_serviceInstance" target="CSI_serviceInstance" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_resourceLink" target="CSI_resourceLink" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_service" target="CSI_service" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="GetAAIServiceInstance" targetRef="ServiceInstanceExists" /> - <bpmn2:exclusiveGateway id="ServiceInstanceExists" name="Service Instance Exists in AAI?" default="notFound"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - <bpmn2:outgoing>found</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="ServiceInstanceExists" targetRef="buildWorkflowException" /> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="initialization" targetRef="ScriptTask_0n6wvp0" /> <bpmn2:scriptTask id="GetAAIAR" name="Get AAI AR" scriptFormat="groovy"> - <bpmn2:incoming>found</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_01zb7a0</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0gbsa12</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() dcar.getAaiAR(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_2" /> - </bpmn2:endEvent> <bpmn2:scriptTask id="CreateAAIAR" name="Create AAI AR " scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_17p4ohs</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0vrw9a9</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* DoCreateAllottedResourceTXC dcar = new DoCreateAllottedResourceTXC() @@ -180,45 +147,6 @@ dcar.validateSDNCResp(execution, response, "activate" )]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0q1hz2p</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1iy3cqb" sourceRef="postProcessSDNCGetResponse" targetRef="generateOutputs" /> - <bpmn2:callActivity id="GetAAIParentSI" name="Get AAI Parent ServiceInstance " calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="parentServiceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_SuccessIndicator" target="PSI_SuccessIndicator" /> - <camunda:out source="GENGS_FoundIndicator" target="PSI_FoundIndicator" /> - <camunda:out source="GENGS_serviceInstance" target="PSI_serviceInstance" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_resourceLink" target="PSI_resourceLink" /> - <camunda:out source="GENGS_service" target="PSI_service" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1m8u8dl</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1vg5rfa</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_1vg5rfa" sourceRef="GetAAIParentSI" targetRef="ParentSIExists" /> - <bpmn2:exclusiveGateway id="ParentSIExists" name="Parent Service Instance Exists in AAI?" default="SequenceFlow_0f7u5pu"> - <bpmn2:incoming>SequenceFlow_1vg5rfa</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_17p4ohs</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_0f7u5pu</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_17p4ohs" name="Yes" sourceRef="ParentSIExists" targetRef="CreateAAIAR"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PSI_FoundIndicator" ) == true && execution.getVariable("PSI_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_1hzsbck" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0f7u5pu</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_16o7col</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 404, "TunnelXConn alloted resource Parent ServiceInstance:" + -execution.getVariable("parentServiceInstanceId") + - " was not found in AAI")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_0x4moh8"> - <bpmn2:incoming>SequenceFlow_16o7col</bpmn2:incoming> - <bpmn2:errorEventDefinition errorRef="Error_2" /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0f7u5pu" name="No" sourceRef="ParentSIExists" targetRef="ScriptTask_1hzsbck" /> - <bpmn2:sequenceFlow id="SequenceFlow_16o7col" sourceRef="ScriptTask_1hzsbck" targetRef="EndEvent_0x4moh8" /> <bpmn2:subProcess id="SubProcess_161pl4g" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_1ibe7qx"> <bpmn2:outgoing>SequenceFlow_1h61pqs</bpmn2:outgoing> @@ -300,7 +228,7 @@ dcar.validateSDNCResp(execution, response, "get" )]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1m8u8dl</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_0z8luou</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_1m8u8dl" name="No" sourceRef="ActiveARinAAI" targetRef="GetAAIParentSI" /> + <bpmn2:sequenceFlow id="SequenceFlow_1m8u8dl" name="No" sourceRef="ActiveARinAAI" targetRef="ScriptTask_10d76y6" /> <bpmn2:sequenceFlow id="SequenceFlow_0z8luou" name="yes" sourceRef="ActiveARinAAI" targetRef="PreProcessSDNCGet"> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("foundActiveAR" ) == true}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> @@ -313,9 +241,6 @@ dcar.validateSDNCResp(execution, response, "get" )]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming> <bpmn2:linkEventDefinition name="SDNCTasks" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="found" name="Yes" sourceRef="ServiceInstanceExists" targetRef="GetAAIAR"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CSI_FoundIndicator" ) == true && execution.getVariable("CSI_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0gbsa12" sourceRef="GetAAIAR" targetRef="ActiveARinAAI" /> <bpmn2:scriptTask id="generateOutputs" name="Generate Outputs" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1iy3cqb</bpmn2:incoming> @@ -334,6 +259,23 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmn2:timerEventDefinition> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_08hhqb2" sourceRef="IntermediateThrowEvent_0ti2fv8" targetRef="PreProcessSDNCGet" /> + <bpmn2:scriptTask id="ScriptTask_0n6wvp0" name=" AAI Query (svc instance) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01zb7a0</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* +DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() +dcar.getServiceInstance(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_10d76y6" name=" AAI Query (svc instance) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1m8u8dl</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0vrw9a9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.vcpe.scripts.* +DoCreateAllottedResourceBRG dcar = new DoCreateAllottedResourceBRG() +dcar.getParentServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_01zb7a0" sourceRef="ScriptTask_0n6wvp0" targetRef="GetAAIAR" /> + <bpmn2:sequenceFlow id="SequenceFlow_0vrw9a9" sourceRef="ScriptTask_10d76y6" targetRef="CreateAAIAR" /> </bpmn2:process> <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -357,57 +299,16 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_285"> <di:waypoint xsi:type="dc:Point" x="119" y="239" /> - <di:waypoint xsi:type="dc:Point" x="195" y="239" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="157" y="224" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_59" bpmnElement="GetAAIServiceInstance"> - <dc:Bounds x="195" y="199" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_229" bpmnElement="ServiceInstanceExists" isMarkerVisible="true"> - <dc:Bounds x="367" y="217" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="349" y="270" width="83" height="25" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_CallActivity_59" targetElement="_BPMNShape_ExclusiveGateway_229"> - <di:waypoint xsi:type="dc:Point" x="295" y="239" /> - <di:waypoint xsi:type="dc:Point" x="369" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="332" y="224.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_293" bpmnElement="buildWorkflowException"> - <dc:Bounds x="342" y="85" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_229" targetElement="_BPMNShape_ScriptTask_293"> - <di:waypoint xsi:type="dc:Point" x="392" y="217" /> - <di:waypoint xsi:type="dc:Point" x="392" y="165" /> + <di:waypoint xsi:type="dc:Point" x="261" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="371" y="192.6917250252067" width="14" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_225" bpmnElement="EndEvent_1"> - <dc:Bounds x="374" y="-11" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="392" y="30" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_293" targetElement="_BPMNShape_EndEvent_225"> - <di:waypoint xsi:type="dc:Point" x="392" y="85" /> - <di:waypoint xsi:type="dc:Point" x="392" y="58" /> - <di:waypoint xsi:type="dc:Point" x="392" y="58" /> - <di:waypoint xsi:type="dc:Point" x="392" y="25" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="407" y="58" width="0" height="0" /> + <dc:Bounds x="145" y="224.5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_299" bpmnElement="GetAAIAR"> - <dc:Bounds x="506" y="200" width="100" height="80" /> + <dc:Bounds x="478" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_300" bpmnElement="CreateAAIAR"> - <dc:Bounds x="1206" y="200" width="100" height="80" /> + <dc:Bounds x="1099" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_228" bpmnElement="EndEvent_3"> <dc:Bounds x="1527" y="776" width="36" height="36" /> @@ -416,11 +317,10 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ScriptTask_300"> - <di:waypoint xsi:type="dc:Point" x="1306" y="240" /> - <di:waypoint xsi:type="dc:Point" x="1338" y="240" /> - <di:waypoint xsi:type="dc:Point" x="1408" y="240" /> + <di:waypoint xsi:type="dc:Point" x="1199" y="240" /> + <di:waypoint xsi:type="dc:Point" x="1309" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1322" y="225" width="0" height="0" /> + <dc:Bounds x="1209" y="225" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1q6udwm_di" bpmnElement="SequenceFlow_1q6udwm"> @@ -538,53 +438,6 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="1277" y="779" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0e73um9_di" bpmnElement="GetAAIParentSI"> - <dc:Bounds x="843" y="199" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vg5rfa_di" bpmnElement="SequenceFlow_1vg5rfa"> - <di:waypoint xsi:type="dc:Point" x="943" y="239" /> - <di:waypoint xsi:type="dc:Point" x="1033" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="988" y="224.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1q51t9m_di" bpmnElement="ParentSIExists" isMarkerVisible="true"> - <dc:Bounds x="1033" y="215" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1012" y="265" width="92" height="36" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_17p4ohs_di" bpmnElement="SequenceFlow_17p4ohs"> - <di:waypoint xsi:type="dc:Point" x="1083" y="240" /> - <di:waypoint xsi:type="dc:Point" x="1206" y="241" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1127" y="222" width="19" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1hzsbck_di" bpmnElement="ScriptTask_1hzsbck"> - <dc:Bounds x="1008" y="77" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0x4moh8_di" bpmnElement="EndEvent_0x4moh8"> - <dc:Bounds x="1040" y="6" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1058" y="47" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0f7u5pu_di" bpmnElement="SequenceFlow_0f7u5pu"> - <di:waypoint xsi:type="dc:Point" x="1058" y="215" /> - <di:waypoint xsi:type="dc:Point" x="1058" y="186" /> - <di:waypoint xsi:type="dc:Point" x="1058" y="157" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1034" y="173.413457125764" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_16o7col_di" bpmnElement="SequenceFlow_16o7col"> - <di:waypoint xsi:type="dc:Point" x="1059" y="77" /> - <di:waypoint xsi:type="dc:Point" x="1059" y="42" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1074" y="59.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_161pl4g_di" bpmnElement="SubProcess_161pl4g" isExpanded="true"> <dc:Bounds x="53" y="910" width="783" height="195" /> </bpmndi:BPMNShape> @@ -663,9 +516,9 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1m8u8dl_di" bpmnElement="SequenceFlow_1m8u8dl"> <di:waypoint xsi:type="dc:Point" x="750" y="240" /> - <di:waypoint xsi:type="dc:Point" x="843" y="239" /> + <di:waypoint xsi:type="dc:Point" x="893" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="777" y="224" width="14" height="14" /> + <dc:Bounds x="795.4388439306359" y="224.36614831617715" width="14" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0z8luou_di" bpmnElement="SequenceFlow_0z8luou"> @@ -691,23 +544,16 @@ dcar.generateOutputs(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0sb45m9_di" bpmnElement="IntermediateThrowEvent_1lqaeh8"> - <dc:Bounds x="1408" y="222" width="36" height="36" /> + <dc:Bounds x="1309" y="222" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1456" y="234" width="76" height="12" /> + <dc:Bounds x="1357" y="234" width="77" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="found" sourceElement="_BPMNShape_ExclusiveGateway_229"> - <di:waypoint xsi:type="dc:Point" x="416" y="241" /> - <di:waypoint xsi:type="dc:Point" x="506" y="242" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="432" y="220.27119611047112" width="17" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0gbsa12_di" bpmnElement="SequenceFlow_0gbsa12"> - <di:waypoint xsi:type="dc:Point" x="606" y="240" /> + <di:waypoint xsi:type="dc:Point" x="578" y="240" /> <di:waypoint xsi:type="dc:Point" x="700" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="653" y="225" width="0" height="0" /> + <dc:Bounds x="594" y="225" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0pjzuns_di" bpmnElement="generateOutputs"> @@ -750,6 +596,26 @@ dcar.generateOutputs(execution)]]></bpmn2:script> <dc:Bounds x="1061" y="524" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0n6wvp0_di" bpmnElement="ScriptTask_0n6wvp0"> + <dc:Bounds x="261" y="200" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_10d76y6_di" bpmnElement="ScriptTask_10d76y6"> + <dc:Bounds x="893" y="200" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01zb7a0_di" bpmnElement="SequenceFlow_01zb7a0"> + <di:waypoint xsi:type="dc:Point" x="361" y="240" /> + <di:waypoint xsi:type="dc:Point" x="478" y="240" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="419.5" y="219" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0vrw9a9_di" bpmnElement="SequenceFlow_0vrw9a9"> + <di:waypoint xsi:type="dc:Point" x="993" y="240" /> + <di:waypoint xsi:type="dc:Point" x="1099" y="240" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1046" y="219" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn index 07de3fc0b1..3fea7467c5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2ENetworkInstance.bpmn @@ -33,32 +33,17 @@ dcsi.postProcessSDNCAssign(execution)]]></bpmn:script> <bpmn:endEvent id="EndEvent_0tpifgl"> <bpmn:incoming>SequenceFlow_0o6bjmn</bpmn:incoming> </bpmn:endEvent> - <bpmn:callActivity id="CallActivity_11yzhx1" name="Call CustomE2EGetService2" calledElement="CustomE2EGetService"> - <bpmn:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="subscriptionServiceType" target="GENGS_serviceType" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - </bpmn:extensionElements> + <bpmn:scriptTask id="ScriptTask_0yz4lym" name=" AAI Query (svc instance) " scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0k06cqp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1oql7zl</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0yz4lym" name="Post Process AAI GET2" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1oql7zl</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0o6bjmn</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateE2EServiceInstance() -dcsi.postProcessAAIGET2(execution)]]></bpmn:script> +dcsi.getServiceInstance(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0s7w7gp" name="" sourceRef="ScriptTask_16gvaru" targetRef="CallActivity_0ao684p" /> <bpmn:sequenceFlow id="SequenceFlow_1wtx8gj" name="" sourceRef="CallActivity_0ao684p" targetRef="ScriptTask_0dp0qqq" /> - <bpmn:sequenceFlow id="SequenceFlow_0k06cqp" name="" sourceRef="ScriptTask_0dp0qqq" targetRef="CallActivity_11yzhx1" /> + <bpmn:sequenceFlow id="SequenceFlow_0k06cqp" name="" sourceRef="ScriptTask_0dp0qqq" targetRef="ScriptTask_0yz4lym" /> <bpmn:sequenceFlow id="SequenceFlow_0o6bjmn" sourceRef="ScriptTask_0yz4lym" targetRef="EndEvent_0tpifgl" /> - <bpmn:sequenceFlow id="SequenceFlow_1oql7zl" sourceRef="CallActivity_11yzhx1" targetRef="ScriptTask_0yz4lym" /> <bpmn:sequenceFlow id="SequenceFlow_1gomb9n" sourceRef="StartEvent_1" targetRef="ScriptTask_16gvaru" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -81,9 +66,6 @@ dcsi.postProcessAAIGET2(execution)]]></bpmn:script> <dc:Bounds x="1405" y="143" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_11yzhx1_di" bpmnElement="CallActivity_11yzhx1"> - <dc:Bounds x="983" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0yz4lym_di" bpmnElement="ScriptTask_0yz4lym"> <dc:Bounds x="1219" y="80" width="100" height="80" /> </bpmndi:BPMNShape> @@ -102,26 +84,17 @@ dcsi.postProcessAAIGET2(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0k06cqp_di" bpmnElement="SequenceFlow_0k06cqp"> - <di:waypoint xsi:type="dc:Point" x="854" y="120" /> - <di:waypoint xsi:type="dc:Point" x="891" y="120" /> - <di:waypoint xsi:type="dc:Point" x="983" y="120" /> + <di:waypoint xsi:type="dc:Point" x="854" y="119" /> + <di:waypoint xsi:type="dc:Point" x="1219" y="116" /> <bpmndi:BPMNLabel> - <dc:Bounds x="872.5" y="99" width="0" height="12" /> + <dc:Bounds x="991.5" y="96.5" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0o6bjmn_di" bpmnElement="SequenceFlow_0o6bjmn"> <di:waypoint xsi:type="dc:Point" x="1319" y="120" /> <di:waypoint xsi:type="dc:Point" x="1432" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1375.5" y="99" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1oql7zl_di" bpmnElement="SequenceFlow_1oql7zl"> - <di:waypoint xsi:type="dc:Point" x="1083" y="115" /> - <di:waypoint xsi:type="dc:Point" x="1151" y="115" /> - <di:waypoint xsi:type="dc:Point" x="1219" y="115" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1117" y="94" width="0" height="12" /> + <dc:Bounds x="1331" y="99" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1gomb9n_di" bpmnElement="SequenceFlow_1gomb9n"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index a5fadcf14b..0b890d8573 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -12,21 +12,6 @@ def dcsi = new DoCreateE2EServiceInstance() dcsi.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="CustomE2EGetService" targetRef="ScriptTask_0i8cqdy" /> - <bpmn2:callActivity id="CustomE2EGetService" name="Call Custom E2E Get Service" calledElement="CustomE2EGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceName" target="GENGS_serviceInstanceName" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1i7t9hq</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - </bpmn2:callActivity> <bpmn2:callActivity id="CustomE2EPutService" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService"> <bpmn2:extensionElements> <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> @@ -38,7 +23,7 @@ dcsi.preProcessRequest(execution) <camunda:in source="msoRequestId" target="GENPS_requesId" /> <camunda:out source="WorkflowException" target="WorkflowException" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1w01tqs</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1i7t9hq</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_129ih1g</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_129ih1g" sourceRef="CustomE2EPutService" targetRef="ScriptTask_0q37vn9" /> @@ -82,14 +67,6 @@ dcsi.postProcessRollback(execution) </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" /> </bpmn2:subProcess> - <bpmn2:scriptTask id="ScriptTask_0i8cqdy" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1w01tqs</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateE2EServiceInstance() -dcsi.postProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1w01tqs" sourceRef="ScriptTask_0i8cqdy" targetRef="CustomE2EPutService" /> <bpmn2:scriptTask id="ScriptTask_0q37vn9" name="Post Process AAI PUT" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_129ih1g</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1tkgqu3</bpmn2:outgoing> @@ -99,7 +76,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" /> <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_03ebqhf</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1m2tm19</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1qctzm0</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCreateE2EServiceInstance() @@ -179,18 +156,17 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1i7t9hq</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartService" /> </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EGetService" /> + <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EPutService" /> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> - <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1m2tm19</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0dqjp43" /> - <bpmn2:scriptTask id="Task_0ush1g4" name="Call Service OOF" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_01s0ef2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_03ebqhf</bpmn2:outgoing> + <bpmn2:scriptTask id="Task_0ush1g4" name="Process Site Location" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0y3i2k7</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoCreateE2EServiceInstance() -dcsi.doServiceHoming(execution)]]></bpmn2:script> +dcsi.doProcessSiteLocation(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResourcesV3"> <bpmn2:extensionElements> @@ -214,7 +190,7 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0y3i2k7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -227,23 +203,16 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script> def csi = new DoCreateE2EServiceInstance() csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="ScriptTask_04b21gb" /> + <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="Task_0ush1g4" /> <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" /> <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" /> <bpmn2:endEvent id="EndEvent_0hzmoug"> <bpmn2:incoming>SequenceFlow_0a6vgsu</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" /> - <bpmn2:sequenceFlow id="SequenceFlow_03ebqhf" sourceRef="Task_0ush1g4" targetRef="Task_0uiekmn" /> <bpmn2:sequenceFlow id="SequenceFlow_012h7yx" sourceRef="ScriptTask_1o01d7d" targetRef="IntermediateThrowEvent_1mlbhmt" /> - <bpmn2:sequenceFlow id="SequenceFlow_01s0ef2" sourceRef="Task_0dqjp43" targetRef="Task_0ush1g4" /> - <bpmn2:scriptTask id="Task_0dqjp43" name="Call Service Pre Operation" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_01s0ef2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi= new DoCreateE2EServiceInstance() -dcsi.doServicePreOperation(execution)]]></bpmn2:script> - </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1m2tm19" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" /> + <bpmn2:sequenceFlow id="SequenceFlow_0y3i2k7" sourceRef="Task_0ush1g4" targetRef="ScriptTask_04b21gb" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -258,18 +227,6 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> <dc:Bounds x="126" y="-229" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_4"> - <di:waypoint xsi:type="dc:Point" x="296" y="94" /> - <di:waypoint xsi:type="dc:Point" x="387" y="94" /> - <di:waypoint xsi:type="dc:Point" x="387" y="94" /> - <di:waypoint xsi:type="dc:Point" x="478" y="94" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="357" y="94" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="CustomE2EGetService"> - <dc:Bounds x="196" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService"> <dc:Bounds x="713" y="54" width="100" height="80" /> </bpmndi:BPMNShape> @@ -314,18 +271,6 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> <dc:Bounds x="152" y="945" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0i8cqdy_di" bpmnElement="ScriptTask_0i8cqdy"> - <dc:Bounds x="478" y="54" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1w01tqs_di" bpmnElement="SequenceFlow_1w01tqs"> - <di:waypoint xsi:type="dc:Point" x="578" y="94" /> - <di:waypoint xsi:type="dc:Point" x="646" y="94" /> - <di:waypoint xsi:type="dc:Point" x="646" y="94" /> - <di:waypoint xsi:type="dc:Point" x="713" y="94" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="616" y="94" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9"> <dc:Bounds x="1068" y="54" width="100" height="80" /> </bpmndi:BPMNShape> @@ -352,17 +297,17 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0"> - <di:waypoint xsi:type="dc:Point" x="534" y="300" /> - <di:waypoint xsi:type="dc:Point" x="604" y="300" /> + <di:waypoint xsi:type="dc:Point" x="226" y="300" /> + <di:waypoint xsi:type="dc:Point" x="337" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="524" y="279" width="90" height="12" /> + <dc:Bounds x="236.5" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0v81r5h_di" bpmnElement="Task_0uiekmn"> - <dc:Bounds x="434" y="260" width="100" height="80" /> + <dc:Bounds x="126" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc"> - <dc:Bounds x="604" y="260" width="100" height="80" /> + <dc:Bounds x="337" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> <dc:Bounds x="1315" y="-207" width="36" height="36" /> @@ -451,9 +396,12 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1i7t9hq_di" bpmnElement="SequenceFlow_1i7t9hq"> <di:waypoint xsi:type="dc:Point" x="54" y="97" /> - <di:waypoint xsi:type="dc:Point" x="196" y="97" /> + <di:waypoint xsi:type="dc:Point" x="528" y="94" /> + <di:waypoint xsi:type="dc:Point" x="646" y="94" /> + <di:waypoint xsi:type="dc:Point" x="646" y="94" /> + <di:waypoint xsi:type="dc:Point" x="713" y="94" /> <bpmndi:BPMNLabel> - <dc:Bounds x="125" y="76" width="0" height="12" /> + <dc:Bounds x="542" y="73" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> @@ -462,37 +410,30 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> <dc:Bounds x="-3" y="318" width="82" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9"> - <di:waypoint xsi:type="dc:Point" x="54" y="300" /> - <di:waypoint xsi:type="dc:Point" x="87" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="25.5" y="279" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4"> - <dc:Bounds x="277" y="260" width="100" height="80" /> + <dc:Bounds x="554" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas"> <dc:Bounds x="971" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb"> - <dc:Bounds x="799" y="260" width="100" height="80" /> + <dc:Bounds x="774" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t"> <dc:Bounds x="1145" y="260" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff"> - <di:waypoint xsi:type="dc:Point" x="704" y="300" /> - <di:waypoint xsi:type="dc:Point" x="799" y="300" /> + <di:waypoint xsi:type="dc:Point" x="437" y="300" /> + <di:waypoint xsi:type="dc:Point" x="554" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="706.5" y="279" width="90" height="12" /> + <dc:Bounds x="450.5" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp"> - <di:waypoint xsi:type="dc:Point" x="899" y="300" /> + <di:waypoint xsi:type="dc:Point" x="874" y="300" /> <di:waypoint xsi:type="dc:Point" x="971" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="890" y="279" width="90" height="12" /> + <dc:Bounds x="877.5" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n"> @@ -515,13 +456,6 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> <dc:Bounds x="1235" y="279" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_03ebqhf_di" bpmnElement="SequenceFlow_03ebqhf"> - <di:waypoint xsi:type="dc:Point" x="377" y="300" /> - <di:waypoint xsi:type="dc:Point" x="434" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="405.5" y="278" width="0" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_012h7yx_di" bpmnElement="SequenceFlow_012h7yx"> <di:waypoint xsi:type="dc:Point" x="813" y="-39" /> <di:waypoint xsi:type="dc:Point" x="1315" y="-39" /> @@ -529,16 +463,20 @@ dcsi.doServicePreOperation(execution)]]></bpmn2:script> <dc:Bounds x="1064" y="-61" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_01s0ef2_di" bpmnElement="SequenceFlow_01s0ef2"> - <di:waypoint xsi:type="dc:Point" x="187" y="300" /> - <di:waypoint xsi:type="dc:Point" x="277" y="300" /> + <bpmndi:BPMNEdge id="SequenceFlow_1m2tm19_di" bpmnElement="SequenceFlow_1m2tm19"> + <di:waypoint xsi:type="dc:Point" x="54" y="300" /> + <di:waypoint xsi:type="dc:Point" x="126" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="232" y="278" width="0" height="14" /> + <dc:Bounds x="90" y="278" width="0" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0y3i2k7_di" bpmnElement="SequenceFlow_0y3i2k7"> + <di:waypoint xsi:type="dc:Point" x="654" y="300" /> + <di:waypoint xsi:type="dc:Point" x="774" y="300" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="714" y="278" width="0" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1uhlqf5_di" bpmnElement="Task_0dqjp43"> - <dc:Bounds x="87" y="260" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn index 4c107c7cb4..77c62e573d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateE2EServiceInstanceV2" name="DoCreateE2EServiceInstanceV2" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -13,21 +13,7 @@ def dcsi = new DoCreateE2EServiceInstanceV2() dcsi.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="CustomE2EGetService" targetRef="ScriptTask_0i8cqdy_PostProcessAAIGET" /> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="CustomE2EGetService" /> - <bpmn2:callActivity id="CustomE2EGetService" name="Call Custom E2E Get Service" calledElement="CustomE2EGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceName" target="GENGS_serviceInstanceName" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="IntermediateThrowEvent_0aggdcl_GoToStartService" /> <bpmn2:callActivity id="CustomE2EPutService" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService"> <bpmn2:extensionElements> <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> @@ -83,13 +69,6 @@ dcsi.postProcessRollback(execution) </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" /> </bpmn2:subProcess> - <bpmn2:scriptTask id="ScriptTask_0i8cqdy_PostProcessAAIGET" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10aubhh</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateE2EServiceInstanceV2() -dcsi.postProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_0q37vn9_PostProcessAAIPUT" name="Post Process AAI PUT" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_129ih1g</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_03fabby</bpmn2:outgoing> @@ -225,9 +204,8 @@ def csi = new DoCreateE2EServiceInstanceV2() csi.postOtherControllerType(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0gxsqsa" sourceRef="Task_0zhvu4r_llllll" targetRef="ExclusiveGateway_0r4jkig" /> - <bpmn2:sequenceFlow id="SequenceFlow_10aubhh" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="IntermediateThrowEvent_0aggdcl_GoToStartService" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0aggdcl_GoToStartService" name="GoTo StartService"> - <bpmn2:incoming>SequenceFlow_10aubhh</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartService" /> </bpmn2:intermediateThrowEvent> <bpmn2:intermediateCatchEvent id="StartEvent_0l5bz4h_StartService" name="StartService"> @@ -486,23 +464,13 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <dc:Bounds x="59.5" y="82" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_4"> - <di:waypoint xsi:type="dc:Point" x="664" y="97" /> - <di:waypoint xsi:type="dc:Point" x="917" y="97" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="745.5" y="82" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61" targetElement="CallActivity_1md4kyb_di"> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61" targetElement="IntermediateThrowEvent_1m5zb3d_di"> <di:waypoint xsi:type="dc:Point" x="287" y="97" /> - <di:waypoint xsi:type="dc:Point" x="564" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1239" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="380.5" y="82" width="90" height="0" /> + <dc:Bounds x="718" y="82" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="CustomE2EGetService"> - <dc:Bounds x="564" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService"> <dc:Bounds x="564" y="244" width="100" height="80" /> </bpmndi:BPMNShape> @@ -545,9 +513,6 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <dc:Bounds x="126" y="1831" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0i8cqdy_di" bpmnElement="ScriptTask_0i8cqdy_PostProcessAAIGET"> - <dc:Bounds x="917" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9_PostProcessAAIPUT"> <dc:Bounds x="917" y="244" width="100" height="80" /> </bpmndi:BPMNShape> @@ -752,13 +717,6 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <dc:Bounds x="312.5" y="1193" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_10aubhh_di" bpmnElement="SequenceFlow_10aubhh"> - <di:waypoint xsi:type="dc:Point" x="1017" y="97" /> - <di:waypoint xsi:type="dc:Point" x="1239" y="97" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1128" y="76" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1m5zb3d_di" bpmnElement="IntermediateThrowEvent_0aggdcl_GoToStartService"> <dc:Bounds x="1239" y="79" width="36" height="36" /> <bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn index 12dbfe6dde..2f5fa39dbc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateNetworkInstance" name="DoCreateNetworkInstance" isExecutable="true"> <bpmn2:startEvent id="createNetwork_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1n61wit</bpmn2:outgoing> @@ -332,19 +332,6 @@ DoCreateNetworkInstance.processJavaException(execution)]]></bpmn2:script> <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> </bpmn2:endEvent> </bpmn2:subProcess> - <bpmn2:callActivity id="callGetServiceInstance" name="Get Service Instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="CRENWKI_serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:out source="GENGS_serviceInstance" target="CRENWKI_serviceInstance" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGSI_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGSI_SuccessIndicator" /> - <camunda:out source="GENGS_siResourceLink" target="GENGSI_siResourceLink" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="GENGS_type" target="GENGS_type" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0ftylq3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - </bpmn2:callActivity> <bpmn2:scriptTask id="callAAIQuery_scriptTask" name="Call REST Query Network Name In AAI" scriptFormat="groovy"> <bpmn2:incoming>isNameSentYes_SequenceFlow</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> @@ -353,23 +340,7 @@ def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.callRESTQueryAAINetworkName(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="callAAIQuery_scriptTask" targetRef="isAAIQueryNameOk_ExclusiveGateway" /> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="callGetServiceInstance" targetRef="siFoundCheck" /> - <bpmn2:exclusiveGateway id="siFoundCheck" name="Service Instance Found?" default="siFoundNo"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>siFoundYes</bpmn2:outgoing> - <bpmn2:outgoing>siFoundNo</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="siFoundYes" name="Yes" sourceRef="siFoundCheck" targetRef="isNameSent_ExclusiveGateway"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGSI_FoundIndicator" ) == true && execution.getVariable("GENGSI_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="siFoundNo" name="No" sourceRef="siFoundCheck" targetRef="workflowExceptionSINotFound" /> - <bpmn2:scriptTask id="workflowExceptionSINotFound" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>siFoundNo</bpmn2:incoming> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance Not Found") -]]></bpmn2:script> - </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="callGetServiceInstance" targetRef="isNameSent_ExclusiveGateway" /> <bpmn2:scriptTask id="callRESTQueryVpnBinding_ScriptTask" name="Call REST Query Vpn Binding in AAI" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_16</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing> @@ -413,7 +384,7 @@ DoCreateNetworkInstance.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0ftylq3" sourceRef="ScriptTask_preprocess" targetRef="callGetServiceInstance" /> <bpmn2:exclusiveGateway id="isNameSent_ExclusiveGateway" name="is Network Name Sent? " default="isNameSentNo_SequenceFlow"> - <bpmn2:incoming>siFoundYes</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>isNameSentYes_SequenceFlow</bpmn2:outgoing> <bpmn2:outgoing>isNameSentNo_SequenceFlow</bpmn2:outgoing> </bpmn2:exclusiveGateway> @@ -535,6 +506,13 @@ def DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_18ylufb" sourceRef="ScriptTask_0p3v749" targetRef="EndEvent_0ti2ctu" /> + <bpmn2:scriptTask id="callGetServiceInstance" name=" AAI Query (svc instance) " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0ftylq3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def DoCreateNetworkInstance = new DoCreateNetworkInstance() +DoCreateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> <bpmn2:textAnnotation id="TextAnnotation_1orb6o6"> <bpmn2:text><![CDATA[if '200', Prepare PO Network Rollback]]></bpmn2:text> </bpmn2:textAnnotation> <bpmn2:association id="Association_0c315jr" sourceRef="validateCreatePONetwork_ScriptTask" targetRef="TextAnnotation_1orb6o6" /> @@ -898,37 +876,12 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> <dc:Bounds x="301" y="476" width="6" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_72" bpmnElement="callGetServiceInstance"> - <dc:Bounds x="759" y="155" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_244" bpmnElement="siFoundCheck" isMarkerVisible="true"> - <dc:Bounds x="784" y="291" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="696" y="304" width="80" height="25" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_CallActivity_72" targetElement="_BPMNShape_ExclusiveGateway_244"> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="ScriptTask_0z2n0hl_di" targetElement="ExclusiveGateway_0lw40k5_di"> <di:waypoint xsi:type="dc:Point" x="809" y="235" /> - <di:waypoint xsi:type="dc:Point" x="809" y="291" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="824" y="263" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="siFoundYes" sourceElement="_BPMNShape_ExclusiveGateway_244" targetElement="_BPMNShape_ScriptTask_62"> - <di:waypoint xsi:type="dc:Point" x="834" y="316" /> + <di:waypoint xsi:type="dc:Point" x="809" y="316" /> <di:waypoint xsi:type="dc:Point" x="951" y="316" /> <bpmndi:BPMNLabel> - <dc:Bounds x="851" y="319" width="18" height="13" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_331" bpmnElement="workflowExceptionSINotFound"> - <dc:Bounds x="759" y="395" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="siFoundNo" sourceElement="_BPMNShape_ExclusiveGateway_244" targetElement="_BPMNShape_ScriptTask_331"> - <di:waypoint xsi:type="dc:Point" x="809" y="341" /> - <di:waypoint xsi:type="dc:Point" x="809" y="395" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="823" y="340.55618916742606" width="14" height="13" /> + <dc:Bounds x="779" y="275.5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_333" bpmnElement="callRESTQueryNetworkTableRef_ScriptTask"> @@ -961,7 +914,7 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> <di:waypoint xsi:type="dc:Point" x="706" y="195" /> <di:waypoint xsi:type="dc:Point" x="759" y="195" /> <bpmndi:BPMNLabel> - <dc:Bounds x="721" y="195" width="0" height="0" /> + <dc:Bounds x="676" y="195" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0lw40k5_di" bpmnElement="isNameSent_ExclusiveGateway" isMarkerVisible="true"> @@ -1358,6 +1311,9 @@ DoCreateNetworkInstance.postProcessResponse(execution)]]></bpmn2:script> <dc:Bounds x="287" y="1159" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0z2n0hl_di" bpmnElement="callGetServiceInstance"> + <dc:Bounds x="759" y="155" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn index 29116a67fc..2c6f5ee61d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateServiceInstance" name="DoCreateServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -12,7 +12,7 @@ def dcsi = new DoCreateServiceInstance() dcsi.getAAICustomerById(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getAAICustomerById_scriptTask" targetRef="ExclusiveGateway_09wkav2" /> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getAAICustomerById_scriptTask" targetRef="callGenericPutService" /> <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> @@ -21,7 +21,6 @@ def dcsi = new DoCreateServiceInstance() dcsi.preProcessRequest(execution) ]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="callGenericGetService" targetRef="ScriptTask_0i8cqdy" /> <bpmn2:scriptTask id="PreProcessSDNCAssignRequest" name="PreProcess SDNC Assign Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_156ih25</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> @@ -49,24 +48,12 @@ dcsi.postProcessSDNCAssign(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>SequenceFlow_01q6pl4</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="getAAICustomerById_scriptTask" /> <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="PreProcessSDNCAssignRequest" targetRef="CallSDNCAdapterServiceTopologyAssign" /> <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="CallSDNCAdapterServiceTopologyAssign" targetRef="PostProcessSDNCAssignRequest" /> - <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="PostProcessSDNCAssignRequest" targetRef="CallActivity_1707jgc" /> - <bpmn2:callActivity id="callGenericGetService" name="Call GenericGetService" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceName" target="GENGS_serviceInstanceName" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_11fnnkb</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="PostProcessSDNCAssignRequest" targetRef="EndEvent_3" /> <bpmn2:callActivity id="callGenericPutService" name="Call Generic Put Service" calledElement="GenericPutService"> <bpmn2:extensionElements> <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> @@ -78,19 +65,9 @@ dcsi.postProcessSDNCAssign(execution)]]></bpmn2:script> <camunda:in source="msoRequestId" target="GENPS_requesId" /> <camunda:out source="WorkflowException" target="WorkflowException" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1uw2p9a</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1w01tqs</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jhzmzn</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:exclusiveGateway id="ExclusiveGateway_09wkav2" name="need to check SI name in AAI?" default="SequenceFlow_1uw2p9a"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_11fnnkb</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1uw2p9a</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_11fnnkb" name="yes" sourceRef="ExclusiveGateway_09wkav2" targetRef="callGenericGetService"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("checkAAI" ) == true }]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_1uw2p9a" name="no" sourceRef="ExclusiveGateway_09wkav2" targetRef="callGenericPutService" /> <bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_0yljq9y"> <bpmn2:outgoing>SequenceFlow_0tgrn11</bpmn2:outgoing> @@ -143,37 +120,6 @@ dcsi.postProcessRollback(execution) <bpmn2:sequenceFlow id="SequenceFlow_00v4npo" name="yes" sourceRef="ExclusiveGateway_1nk6aol" targetRef="EndEvent_10659gr"> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{!execution.getVariable("sendToSDNC")}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_0i8cqdy" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1w01tqs</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateServiceInstance() -dcsi.postProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1w01tqs" sourceRef="ScriptTask_0i8cqdy" targetRef="callGenericPutService" /> - <bpmn2:callActivity id="CallActivity_1707jgc" name="Call GenericGetService2" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="subscriptionServiceType" target="GENGS_serviceType" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0tx5frq</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_0tx5frq" sourceRef="CallActivity_1707jgc" targetRef="ScriptTask_1tp0fcx" /> - <bpmn2:sequenceFlow id="SequenceFlow_01q6pl4" sourceRef="ScriptTask_1tp0fcx" targetRef="EndEvent_3" /> - <bpmn2:scriptTask id="ScriptTask_1tp0fcx" name="Post Process AAI GET2" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0tx5frq</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_01q6pl4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateServiceInstance() -dcsi.postProcessAAIGET2(execution)]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_0q37vn9" name="Post Process AAI PUT" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1jhzmzn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_16sdyz9</bpmn2:outgoing> @@ -243,24 +189,18 @@ dcsi.processJavaException(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_62"> <di:waypoint xsi:type="dc:Point" x="493" y="97" /> - <di:waypoint xsi:type="dc:Point" x="565" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="206" /> <bpmndi:BPMNLabel> - <dc:Bounds x="529" y="82" width="0" height="0" /> + <dc:Bounds x="712.5" y="82" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3"> - <dc:Bounds x="1122" y="1297" width="36" height="36" /> + <dc:Bounds x="1004" y="1216" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1095" y="1338" width="90" height="0" /> + <dc:Bounds x="977" y="1257" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_4"> - <di:waypoint xsi:type="dc:Point" x="839" y="94" /> - <di:waypoint xsi:type="dc:Point" x="971" y="94" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="905" y="79" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_334" bpmnElement="PreProcessSDNCAssignRequest"> <dc:Bounds x="972" y="810" width="100" height="80" /> </bpmndi:BPMNShape> @@ -292,39 +232,15 @@ dcsi.processJavaException(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_335"> - <di:waypoint xsi:type="dc:Point" x="1024" y="1134" /> - <di:waypoint xsi:type="dc:Point" x="1024" y="1162" /> + <di:waypoint xsi:type="dc:Point" x="1023" y="1134" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="1216" /> <bpmndi:BPMNLabel> - <dc:Bounds x="994" y="1148" width="90" height="0" /> + <dc:Bounds x="977.5" y="1160" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="callGenericGetService"> - <dc:Bounds x="739" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="callGenericPutService"> <dc:Bounds x="972" y="206" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_09wkav2_di" bpmnElement="ExclusiveGateway_09wkav2" isMarkerVisible="true"> - <dc:Bounds x="565" y="72" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="547" y="27" width="85" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_11fnnkb_di" bpmnElement="SequenceFlow_11fnnkb"> - <di:waypoint xsi:type="dc:Point" x="615" y="97" /> - <di:waypoint xsi:type="dc:Point" x="739" y="97" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="635" y="76" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1uw2p9a_di" bpmnElement="SequenceFlow_1uw2p9a"> - <di:waypoint xsi:type="dc:Point" x="590" y="122" /> - <di:waypoint xsi:type="dc:Point" x="590" y="246" /> - <di:waypoint xsi:type="dc:Point" x="972" y="246" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="594" y="132.89706349694825" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> <dc:Bounds x="99" y="531" width="783" height="195" /> </bpmndi:BPMNShape> @@ -385,18 +301,6 @@ dcsi.processJavaException(execution)]]></bpmn2:script> <dc:Bounds x="1050.5" y="718" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0i8cqdy_di" bpmnElement="ScriptTask_0i8cqdy"> - <dc:Bounds x="971" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1w01tqs_di" bpmnElement="SequenceFlow_1w01tqs"> - <di:waypoint xsi:type="dc:Point" x="1021" y="137" /> - <di:waypoint xsi:type="dc:Point" x="1021" y="172" /> - <di:waypoint xsi:type="dc:Point" x="1021" y="172" /> - <di:waypoint xsi:type="dc:Point" x="1021" y="206" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1036" y="172" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux"> <dc:Bounds x="330" y="586" width="100" height="80" /> </bpmndi:BPMNShape> @@ -419,28 +323,6 @@ dcsi.processJavaException(execution)]]></bpmn2:script> <dc:Bounds x="808" y="626" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1707jgc_di" bpmnElement="CallActivity_1707jgc"> - <dc:Bounds x="972" y="1162" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0tx5frq_di" bpmnElement="SequenceFlow_0tx5frq"> - <di:waypoint xsi:type="dc:Point" x="1022" y="1242" /> - <di:waypoint xsi:type="dc:Point" x="1022" y="1275" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="992" y="1258.5" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_01q6pl4_di" bpmnElement="SequenceFlow_01q6pl4"> - <di:waypoint xsi:type="dc:Point" x="1072" y="1315" /> - <di:waypoint xsi:type="dc:Point" x="1094" y="1315" /> - <di:waypoint xsi:type="dc:Point" x="1094" y="1315" /> - <di:waypoint xsi:type="dc:Point" x="1122" y="1315" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1064" y="1315" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1tp0fcx_di" bpmnElement="ScriptTask_1tp0fcx"> - <dc:Bounds x="972" y="1275" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9"> <dc:Bounds x="972" y="336" width="100" height="80" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn deleted file mode 100644 index 88a99c2938..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> - <bpmn:process id="DoCreateServiceInstanceRollbackV2" name="DoCreateServiceInstanceRollbackV2" isExecutable="true"> - <bpmn:startEvent id="StartEvent_1" name="start"> - <bpmn:outgoing>SequenceFlow_0r35zfs</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0r35zfs" sourceRef="StartEvent_1" targetRef="ScriptTask_2" /> - <bpmn:endEvent id="EndEvent_1uwvw04" name="end"> - <bpmn:incoming>SequenceFlow_1f949uf</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1f949uf" sourceRef="ScriptTask_2" targetRef="EndEvent_1uwvw04" /> - <bpmn:scriptTask id="ScriptTask_2" name="ServiceInstance Rollback (A&AI)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0r35zfs</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1f949uf</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsir = new DoCreateServiceInstanceRollbackV2() -dcsir.aaiServiceInstanceRollback(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:subProcess id="SubProcess_06tpqag" triggeredByEvent="true"> - <bpmn:startEvent id="StartEvent_1n34l5n" name="error start"> - <bpmn:outgoing>SequenceFlow_1tnfu1n</bpmn:outgoing> - <bpmn:errorEventDefinition /> - </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1tnfu1n" sourceRef="StartEvent_1n34l5n" targetRef="Task_11sf5id" /> - <bpmn:endEvent id="EndEvent_1ldhg44" name="end"> - <bpmn:incoming>SequenceFlow_0hi9120</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0hi9120" sourceRef="Task_11sf5id" targetRef="EndEvent_1ldhg44" /> - <bpmn:scriptTask id="Task_11sf5id" name="Rollback ERROR" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1tnfu1n</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0hi9120</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsir = new DoCreateServiceInstanceRollbackV2() -dcsir.rollbackError(execution)]]></bpmn:script> - </bpmn:scriptTask> - </bpmn:subProcess> - </bpmn:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateServiceInstanceRollbackV2"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="223" y="102" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="230" y="138" width="22" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0r35zfs_di" bpmnElement="SequenceFlow_0r35zfs"> - <di:waypoint xsi:type="dc:Point" x="259" y="120" /> - <di:waypoint xsi:type="dc:Point" x="325" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="247" y="99" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1uwvw04_di" bpmnElement="EndEvent_1uwvw04"> - <dc:Bounds x="490" y="102" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="499" y="142" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1f949uf_di" bpmnElement="SequenceFlow_1f949uf"> - <di:waypoint xsi:type="dc:Point" x="425" y="120" /> - <di:waypoint xsi:type="dc:Point" x="490" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="412.5" y="99" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0kr8b5y_di" bpmnElement="ScriptTask_2"> - <dc:Bounds x="325" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_03s2qcr_di" bpmnElement="SubProcess_06tpqag" isExpanded="true"> - <dc:Bounds x="200" y="216" width="350" height="200" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1nwdcsr_di" bpmnElement="StartEvent_1n34l5n"> - <dc:Bounds x="229" y="295" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="223" y="335" width="49" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1tnfu1n_di" bpmnElement="SequenceFlow_1tnfu1n"> - <di:waypoint xsi:type="dc:Point" x="265" y="313" /> - <di:waypoint xsi:type="dc:Point" x="318" y="313" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="291.5" y="292" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1ldhg44_di" bpmnElement="EndEvent_1ldhg44"> - <dc:Bounds x="453" y="295" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="462" y="335" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0hi9120_di" bpmnElement="SequenceFlow_0hi9120"> - <di:waypoint xsi:type="dc:Point" x="418" y="313" /> - <di:waypoint xsi:type="dc:Point" x="453" y="313" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="435.5" y="292" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1w1j8ao_di" bpmnElement="Task_11sf5id"> - <dc:Bounds x="318" y="273" width="100" height="80" /> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn deleted file mode 100644 index e8dbc8c7f6..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn +++ /dev/null @@ -1,197 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2"> - <bpmn:process id="DoCreateServiceInstanceV2" name="DoCreateServiceInstanceV2" isExecutable="true"> - <bpmn:startEvent id="StartEvent_1" name="Start"> - <bpmn:outgoing>SequenceFlow_0g8qp84</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0651nnp" sourceRef="ScriptTask_1" targetRef="ScriptTask_2" /> - <bpmn:sequenceFlow id="SequenceFlow_0u0ptz7" sourceRef="ScriptTask_2" targetRef="ScriptTask_3" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_1" name="Run SDNC Request?"> - <bpmn:incoming>SequenceFlow_0ekno6w</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1t50vt9</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0xhy3o1</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0ekno6w" sourceRef="ScriptTask_3" targetRef="ExclusiveGateway_1" /> - <bpmn:sequenceFlow id="SequenceFlow_1t50vt9" name="Yes" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("callSDNC")}]]></bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:endEvent id="EndEvent_2" name="End"> - <bpmn:incoming>SequenceFlow_0xhy3o1</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0xhy3o1" name="No" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_2" /> - <bpmn:endEvent id="EndEvent_1" name="End"> - <bpmn:incoming>SequenceFlow_0eryvle</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0eryvle" sourceRef="ScriptTask_4" targetRef="EndEvent_1" /> - <bpmn:scriptTask id="ScriptTask_1" name="Create Service Instance (A&AI)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0g8qp84</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0651nnp</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateServiceInstanceV2() -dcsi.createServiceInstance(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_2" name="Create Project (A&AI)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0651nnp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0u0ptz7</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateServiceInstanceV2() -dcsi.createProject(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_3" name="Create Owning Entity (A&AI)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0u0ptz7</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ekno6w</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateServiceInstanceV2() -dcsi.createOwningEntity(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_4" name="Create Service Instance (SDNC)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1t50vt9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0eryvle</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoCreateServiceInstanceV2() -dcsi.sdncCreateServiceInstance(execution)]]></bpmn:script> - </bpmn:scriptTask> - <bpmn:subProcess id="SubProcess_0lezgt7" name="Error Handling" triggeredByEvent="true"> - <bpmn:startEvent id="ErrorEvent_2" name="Error"> - <bpmn:outgoing>SequenceFlow_0mk8fd7</bpmn:outgoing> - <bpmn:errorEventDefinition /> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_3" name="End"> - <bpmn:incoming>SequenceFlow_14mdxgk</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0mk8fd7" sourceRef="ErrorEvent_2" targetRef="SubTask_1" /> - <bpmn:sequenceFlow id="SequenceFlow_14mdxgk" sourceRef="SubTask_1" targetRef="EndEvent_3" /> - <bpmn:callActivity id="SubTask_1" name="DoCreate Rollback" calledElement="DoCreateServiceInstanceRollbackV2"> - <bpmn:extensionElements> - <camunda:in source="sdncRollback" target="sdncRollback" /> - <camunda:in source="aaiServiceInstanceRollback" target="aaiServiceInstanceRollback" /> - <camunda:in source="ServiceDecomposition" target="ServiceDecomposition" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0mk8fd7</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14mdxgk</bpmn:outgoing> - </bpmn:callActivity> - </bpmn:subProcess> - <bpmn:sequenceFlow id="SequenceFlow_0g8qp84" sourceRef="StartEvent_1" targetRef="ScriptTask_1" /> - </bpmn:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateServiceInstanceV2"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="166" y="102" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="173" y="138" width="23" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0651nnp_di" bpmnElement="SequenceFlow_0651nnp"> - <di:waypoint xsi:type="dc:Point" x="371" y="120" /> - <di:waypoint xsi:type="dc:Point" x="442" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="406.5" y="99" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0u0ptz7_di" bpmnElement="SequenceFlow_0u0ptz7"> - <di:waypoint xsi:type="dc:Point" x="542" y="120" /> - <di:waypoint xsi:type="dc:Point" x="620" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="581" y="99" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1hnvq9n_di" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true"> - <dc:Bounds x="784" y="95" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="773" y="67" width="72" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ekno6w_di" bpmnElement="SequenceFlow_0ekno6w"> - <di:waypoint xsi:type="dc:Point" x="720" y="120" /> - <di:waypoint xsi:type="dc:Point" x="784" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="752" y="99" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1t50vt9_di" bpmnElement="SequenceFlow_1t50vt9"> - <di:waypoint xsi:type="dc:Point" x="834" y="120" /> - <di:waypoint xsi:type="dc:Point" x="911" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="856" y="94" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1tlnfr4_di" bpmnElement="EndEvent_2"> - <dc:Bounds x="791" y="196" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="800" y="236" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xhy3o1_di" bpmnElement="SequenceFlow_0xhy3o1"> - <di:waypoint xsi:type="dc:Point" x="809" y="145" /> - <di:waypoint xsi:type="dc:Point" x="809" y="196" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="815" y="165" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_015y2ht_di" bpmnElement="EndEvent_1"> - <dc:Bounds x="1078" y="102" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1087" y="142" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0eryvle_di" bpmnElement="SequenceFlow_0eryvle"> - <di:waypoint xsi:type="dc:Point" x="1011" y="120" /> - <di:waypoint xsi:type="dc:Point" x="1078" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1044.5" y="99" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1qtzumy_di" bpmnElement="ScriptTask_1"> - <dc:Bounds x="271" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_10octqt_di" bpmnElement="ScriptTask_2"> - <dc:Bounds x="442" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_140drj4_di" bpmnElement="ScriptTask_3"> - <dc:Bounds x="620" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1q37c16_di" bpmnElement="ScriptTask_4"> - <dc:Bounds x="911" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_1p4inl6_di" bpmnElement="SubProcess_0lezgt7" isExpanded="true"> - <dc:Bounds x="368" y="268" width="350" height="200" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_0g6sxcc_di" bpmnElement="ErrorEvent_2"> - <dc:Bounds x="409" y="335" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="415" y="375" width="25" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_061qhx5_di" bpmnElement="EndEvent_3"> - <dc:Bounds x="623" y="335" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="632" y="375" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0g8qp84_di" bpmnElement="SequenceFlow_0g8qp84"> - <di:waypoint xsi:type="dc:Point" x="202" y="120" /> - <di:waypoint xsi:type="dc:Point" x="271" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="191.5" y="99" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0mk8fd7_di" bpmnElement="SequenceFlow_0mk8fd7"> - <di:waypoint xsi:type="dc:Point" x="445" y="353" /> - <di:waypoint xsi:type="dc:Point" x="482" y="353" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="463.5" y="332" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14mdxgk_di" bpmnElement="SequenceFlow_14mdxgk"> - <di:waypoint xsi:type="dc:Point" x="582" y="353" /> - <di:waypoint xsi:type="dc:Point" x="623" y="353" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="602.5" y="332" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1jzchuz_di" bpmnElement="SubTask_1"> - <dc:Bounds x="482" y="313" width="100" height="80" /> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn index ac48776c95..26a4112d59 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FhrCQG2BEeaNdqnn65BT4A" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FhrCQG2BEeaNdqnn65BT4A" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateVfModuleVolumeV2" name="DoCreateVfModuleVolumeV2" isExecutable="true"> <bpmn2:scriptTask id="ScriptTask_preProcessRequest" name="Preprocess Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> @@ -128,26 +128,14 @@ doCreateVfModuleVolumeV2.executeMethod('validateVnfResponse', execution, isDebug </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1qwurc5" sourceRef="CallActivity_callVnfAdapterCreate" targetRef="Task_07psich" /> <bpmn2:sequenceFlow id="SequenceFlow_1gbt2n5" sourceRef="Task_07psich" targetRef="ScriptTask_callRestAaiRequeryVolGrpNm" /> - <bpmn2:callActivity id="Task_1u766ge" name="Call Generic Get Service instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:in source="GENGS_type" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - </bpmn2:extensionElements> + <bpmn2:scriptTask id="Task_0qbm5cz" name=" AAI Query (svc instance) " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1wi1cf9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1vmbvy8</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:scriptTask id="Task_0qbm5cz" name="Validate Get Service Instance Call" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1vmbvy8</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1dpt7ul</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def doCreateVfModuleVolumeV2 = new DoCreateVfModuleVolumeV2() -doCreateVfModuleVolumeV2.executeMethod('validateGetServiceInstanceCall', execution, isDebugLogEnabled)]]></bpmn2:script> +doCreateVfModuleVolumeV2.executeMethod('getServiceInstance', execution, isDebugLogEnabled)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1wi1cf9" sourceRef="ScriptTask_preProcessRequest" targetRef="Task_1u766ge" /> - <bpmn2:sequenceFlow id="SequenceFlow_1vmbvy8" sourceRef="Task_1u766ge" targetRef="Task_0qbm5cz" /> + <bpmn2:sequenceFlow id="SequenceFlow_1wi1cf9" sourceRef="ScriptTask_preProcessRequest" targetRef="Task_0qbm5cz" /> <bpmn2:sequenceFlow id="SequenceFlow_1dpt7ul" sourceRef="Task_0qbm5cz" targetRef="ScriptTask_callRestAaiCloudRegion" /> </bpmn2:process> <bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -330,31 +318,21 @@ doCreateVfModuleVolumeV2.executeMethod('validateGetServiceInstanceCall', executi <dc:Bounds x="837" y="322" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1u596hd_di" bpmnElement="Task_1u766ge"> - <dc:Bounds x="506" y="106" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1n9cmka_di" bpmnElement="Task_0qbm5cz"> - <dc:Bounds x="640" y="106" width="100" height="80" /> + <dc:Bounds x="576" y="106" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1wi1cf9_di" bpmnElement="SequenceFlow_1wi1cf9"> <di:waypoint xsi:type="dc:Point" x="469" y="146" /> - <di:waypoint xsi:type="dc:Point" x="506" y="146" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="488" y="121" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1vmbvy8_di" bpmnElement="SequenceFlow_1vmbvy8"> - <di:waypoint xsi:type="dc:Point" x="606" y="146" /> - <di:waypoint xsi:type="dc:Point" x="640" y="146" /> + <di:waypoint xsi:type="dc:Point" x="576" y="146" /> <bpmndi:BPMNLabel> - <dc:Bounds x="623" y="121" width="0" height="0" /> + <dc:Bounds x="477.5" y="131" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1dpt7ul_di" bpmnElement="SequenceFlow_1dpt7ul"> - <di:waypoint xsi:type="dc:Point" x="740" y="146" /> + <di:waypoint xsi:type="dc:Point" x="676" y="146" /> <di:waypoint xsi:type="dc:Point" x="768" y="146" /> <bpmndi:BPMNLabel> - <dc:Bounds x="754" y="121" width="0" height="0" /> + <dc:Bounds x="677" y="131" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn index dacce53963..a093beae91 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn @@ -13,39 +13,6 @@ DoCreateVnf createVnf = new DoCreateVnf() createVnf.preProcessRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="initialization" targetRef="callGetService" /> - <bpmn2:scriptTask id="buildWorkflowException" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>notFound</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildWorkflowException(execution, 404, "Service Instance Not Found")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="buildWorkflowException" targetRef="EndEvent_1" /> - <bpmn2:callActivity id="callGetService" name="Get Service Instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="DoCVNF_serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="GENGS_serviceInstance" target="CRTVI_serviceInstance" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:in source="GENGS_type" target="GENGS_type" /> - <camunda:in source="DoCVNF_serviceInstanceName" target="GENGS_serviceInstanceName" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="callGetService" targetRef="serviceInstanceFound" /> - <bpmn2:exclusiveGateway id="serviceInstanceFound" name="Service Instance Found?" default="notFound"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>notFound</bpmn2:outgoing> - <bpmn2:outgoing>found</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceInstanceFound" targetRef="buildWorkflowException" /> - <bpmn2:sequenceFlow id="found" name="Yes" sourceRef="serviceInstanceFound" targetRef="ExclusiveGateway_0j73e7c"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true && execution.getVariable("GENGS_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> <bpmn2:exclusiveGateway id="vnfExist" name="Vnf Already Exist?" default="vnfExistYes"> <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> <bpmn2:outgoing>vnfExistYes</bpmn2:outgoing> @@ -77,10 +44,6 @@ ExceptionUtil exceptionUtil = new ExceptionUtil() exceptionUtil.buildWorkflowException(execution, 5000, "Generic Vnf Already Exist.")]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="vnfExistWorkflowException" targetRef="EndEvent_2" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_2" /> - </bpmn2:endEvent> <bpmn2:endEvent id="EndEvent_2"> <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" /> @@ -200,7 +163,7 @@ DoCreateVnf createVnf = new DoCreateVnf() createVnf.postProcessCreateGenericVnf(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:exclusiveGateway id="ExclusiveGateway_0j73e7c" name="Vnf-name specified?" default="VnfNameSpecified1"> - <bpmn2:incoming>found</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1mvplyi</bpmn2:incoming> <bpmn2:outgoing>VnfNameNotSpecified1</bpmn2:outgoing> <bpmn2:outgoing>VnfNameSpecified1</bpmn2:outgoing> </bpmn2:exclusiveGateway> @@ -271,6 +234,14 @@ createVnfInfra.validateSDNCResponse(execution, response, "get")]]></bpmn2:script def doCreateVnf = new DoCreateVnf() doCreateVnf.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script> </bpmn2:scriptTask> + <bpmn2:scriptTask id="callGetService" name="AAI Query (svc instance)" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1mvplyi</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +DoCreateVnf createVnf = new DoCreateVnf() +createVnf.getServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1mvplyi" sourceRef="callGetService" targetRef="ExclusiveGateway_0j73e7c" /> </bpmn2:process> <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" /> <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> @@ -283,67 +254,20 @@ doCreateVnf.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_285" bpmnElement="initialization"> - <dc:Bounds x="216" y="200" width="100" height="80" /> + <dc:Bounds x="238" y="200" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_68" targetElement="_BPMNShape_ScriptTask_285"> <di:waypoint xsi:type="dc:Point" x="132" y="240" /> - <di:waypoint xsi:type="dc:Point" x="216" y="240" /> + <di:waypoint xsi:type="dc:Point" x="238" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="165" y="240" width="6" height="6" /> + <dc:Bounds x="140" y="222" width="90" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_285"> - <di:waypoint xsi:type="dc:Point" x="316" y="240" /> - <di:waypoint xsi:type="dc:Point" x="406" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="361" y="225" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_59" bpmnElement="callGetService"> - <dc:Bounds x="406" y="200" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_229" bpmnElement="serviceInstanceFound" isMarkerVisible="true"> - <dc:Bounds x="552" y="215" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="536" y="267" width="82" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_CallActivity_59" targetElement="_BPMNShape_ExclusiveGateway_229"> - <di:waypoint xsi:type="dc:Point" x="506" y="240" /> - <di:waypoint xsi:type="dc:Point" x="552" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="529" y="225" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_293" bpmnElement="buildWorkflowException"> - <dc:Bounds x="720" y="115" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_229" targetElement="_BPMNShape_ScriptTask_293"> - <di:waypoint xsi:type="dc:Point" x="577" y="215" /> - <di:waypoint xsi:type="dc:Point" x="577" y="155" /> - <di:waypoint xsi:type="dc:Point" x="720" y="155" /> + <di:waypoint xsi:type="dc:Point" x="338" y="240" /> + <di:waypoint xsi:type="dc:Point" x="425" y="240" /> <bpmndi:BPMNLabel> - <dc:Bounds x="580" y="174.4237288135593" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_225" bpmnElement="EndEvent_1"> - <dc:Bounds x="876" y="137" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="894" y="178" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_293" targetElement="_BPMNShape_EndEvent_225"> - <di:waypoint xsi:type="dc:Point" x="820" y="155" /> - <di:waypoint xsi:type="dc:Point" x="876" y="155" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="846" y="155" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="found" sourceElement="_BPMNShape_ExclusiveGateway_229" targetElement="_BPMNShape_CallActivity_60"> - <di:waypoint xsi:type="dc:Point" x="602" y="240" /> - <di:waypoint xsi:type="dc:Point" x="646" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="614" y="216.01288698145387" width="18" height="12" /> + <dc:Bounds x="336.5" y="225" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_CallActivity_60" bpmnElement="callGetVnf"> @@ -630,6 +554,16 @@ doCreateVnf.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ScriptTask_0aonzix_di" bpmnElement="Task_053tb0h"> <dc:Bounds x="1445" y="515" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_019g8vu_di" bpmnElement="callGetService"> + <dc:Bounds x="425" y="200" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1mvplyi_di" bpmnElement="SequenceFlow_1mvplyi"> + <di:waypoint xsi:type="dc:Point" x="525" y="240" /> + <di:waypoint xsi:type="dc:Point" x="646" y="240" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="585.5" y="219" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index 73c21090ea..2e12dd3b96 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -15,13 +15,6 @@ ddsi.preProcessRequest(execution) <bpmn:endEvent id="EndEvent_1uqzt26"> <bpmn:incoming>SequenceFlow_0e7inkl</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1rtnsh8" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_188ejvu</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0vi0sv6</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def ddsi = new DoCustomDeleteE2EServiceInstance() -ddsi.postProcessAAIGET(execution)]]></bpmn:script> - </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_01erufg" name=" AAI Delete (svc instance) " scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0oj2anh</bpmn:incoming> <bpmn:incoming>SequenceFlow_1ev7z6q</bpmn:incoming> @@ -49,9 +42,8 @@ ex.processJavaException(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_18vlzfo" name="" sourceRef="ScriptTask_0nha3pr" targetRef="EndEvent_06utmg4" /> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_0vz7cd9" sourceRef="StartEvent_0212h2r" targetRef="ScriptTask_06phzgv" /> - <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="CallActivity_076pc2z" /> + <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="ScriptTask_146jt8v" /> <bpmn:sequenceFlow id="SequenceFlow_0e7inkl" sourceRef="ScriptTask_01erufg" targetRef="EndEvent_1uqzt26" /> - <bpmn:sequenceFlow id="SequenceFlow_0vi0sv6" sourceRef="ScriptTask_1rtnsh8" targetRef="ScriptTask_146jt8v" /> <bpmn:scriptTask id="ScriptTask_0z30dax" name="Prepare Resource Delele For WAN" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1ubor5z</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1dza4q4</bpmn:outgoing> @@ -93,7 +85,7 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script> <bpmn:outgoing>SequenceFlow_1ev7z6q</bpmn:outgoing> </bpmn:serviceTask> <bpmn:scriptTask id="ScriptTask_146jt8v" name="Prepare Resource Oper Status" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0vi0sv6</bpmn:incoming> + <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ym9otf</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCustomDeleteE2EServiceInstance() @@ -122,22 +114,6 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_1j08ko3</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1ym9otf" sourceRef="ScriptTask_146jt8v" targetRef="ServiceTask_00tg69u" /> - <bpmn:callActivity id="CallActivity_076pc2z" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_188ejvu</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_188ejvu" sourceRef="CallActivity_076pc2z" targetRef="ScriptTask_1rtnsh8" /> <bpmn:scriptTask id="ScriptTask_0o5bglz" name="Sequense Resources" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming> <bpmn:outgoing>SequenceFlow_03c0zlq</bpmn:outgoing> @@ -219,9 +195,6 @@ ddsi.parseNextResource(execution)]]></bpmn:script> <dc:Bounds x="1316" y="831" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1rtnsh8_di" bpmnElement="ScriptTask_1rtnsh8"> - <dc:Bounds x="-193" y="-57" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_01erufg_di" bpmnElement="ScriptTask_01erufg"> <dc:Bounds x="1356" y="513" width="100" height="80" /> </bpmndi:BPMNShape> @@ -237,9 +210,9 @@ ddsi.parseNextResource(execution)]]></bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11e6bfy_di" bpmnElement="SequenceFlow_11e6bfy"> <di:waypoint xsi:type="dc:Point" x="-419" y="-17" /> - <di:waypoint xsi:type="dc:Point" x="-357" y="-17" /> + <di:waypoint xsi:type="dc:Point" x="-26" y="-17" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-433" y="-38" width="90" height="12" /> + <dc:Bounds x="-267.5" y="-38" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0e7inkl_di" bpmnElement="SequenceFlow_0e7inkl"> @@ -249,13 +222,6 @@ ddsi.parseNextResource(execution)]]></bpmn:script> <dc:Bounds x="1376" y="685.5" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0vi0sv6_di" bpmnElement="SequenceFlow_0vi0sv6"> - <di:waypoint xsi:type="dc:Point" x="-93" y="-17" /> - <di:waypoint xsi:type="dc:Point" x="-26" y="-17" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="-104.5" y="-38" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_0sf5lpt_di" bpmnElement="StartEvent_0sf5lpt"> <dc:Bounds x="360" y="742" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -327,16 +293,6 @@ ddsi.parseNextResource(execution)]]></bpmn:script> <dc:Bounds x="-6" y="39" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_076pc2z_di" bpmnElement="CallActivity_076pc2z"> - <dc:Bounds x="-357" y="-57" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_188ejvu_di" bpmnElement="SequenceFlow_188ejvu"> - <di:waypoint xsi:type="dc:Point" x="-257" y="-17" /> - <di:waypoint xsi:type="dc:Point" x="-193" y="-17" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="-225" y="-38" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0o5bglz_di" bpmnElement="ScriptTask_0o5bglz"> <dc:Bounds x="-26" y="233" width="100" height="80" /> </bpmndi:BPMNShape> @@ -467,4 +423,4 @@ ddsi.parseNextResource(execution)]]></bpmn:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn index 3e76f61224..2df19abf68 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn @@ -15,12 +15,12 @@ ddsi.preProcessRequest(execution) <bpmn:endEvent id="EndEvent_1uqzt26"> <bpmn:incoming>SequenceFlow_06tonva</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="ScriptTask_1rtnsh8" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_188ejvu</bpmn:incoming> + <bpmn:scriptTask id="ScriptTask_1rtnsh8" name="AAI Query (svc instance)" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_00a3ijv</bpmn:outgoing> <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCustomDeleteE2EServiceInstanceV2() -ddsi.postProcessAAIGET(execution)]]></bpmn:script> +ddsi.getServiceInstance(execution)]]></bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_01erufg" name=" AAI Delete (svc instance) " scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0t5f2dt</bpmn:incoming> @@ -48,7 +48,7 @@ ex.processJavaException(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_18vlzfo" name="" sourceRef="ScriptTask_0nha3pr" targetRef="EndEvent_06utmg4" /> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_0vz7cd9" sourceRef="StartEvent_0212h2r" targetRef="ScriptTask_06phzgv" /> - <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="CallActivity_076pc2z" /> + <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="ScriptTask_1rtnsh8" /> <bpmn:sequenceFlow id="SequenceFlow_0e7inkl" sourceRef="ScriptTask_01erufg" targetRef="ScriptTask_1vlvb1r" /> <bpmn:scriptTask id="ScriptTask_postProcessVFCDelete" name="Post Process VFC Delete" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1931m8u</bpmn:incoming> @@ -122,22 +122,6 @@ ddsi.preSDNCResourceDelete(execution, resourceName )]]></bpmn:script> <bpmn:incoming>SequenceFlow_0akcnw7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0uc2beq</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:callActivity id="CallActivity_076pc2z" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_188ejvu</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_188ejvu" sourceRef="CallActivity_076pc2z" targetRef="ScriptTask_1rtnsh8" /> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1d5z35x" name="GoTo Delete SDNC Resource"> <bpmn:incoming>SequenceFlow_1qzxy2i</bpmn:incoming> <bpmn:linkEventDefinition name="DeleteSDNCResource" /> @@ -430,7 +414,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1rtnsh8_di" bpmnElement="ScriptTask_1rtnsh8"> - <dc:Bounds x="1055" y="88" width="100" height="80" /> + <dc:Bounds x="795" y="88" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_01erufg_di" bpmnElement="ScriptTask_01erufg"> <dc:Bounds x="286" y="1216" width="100" height="80" /> @@ -447,10 +431,9 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11e6bfy_di" bpmnElement="SequenceFlow_11e6bfy"> <di:waypoint xsi:type="dc:Point" x="411" y="128" /> - <di:waypoint xsi:type="dc:Point" x="461" y="128" /> - <di:waypoint xsi:type="dc:Point" x="667" y="128" /> + <di:waypoint xsi:type="dc:Point" x="795" y="128" /> <bpmndi:BPMNLabel> - <dc:Bounds x="391" y="107" width="90" height="12" /> + <dc:Bounds x="558" y="107" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0e7inkl_di" bpmnElement="SequenceFlow_0e7inkl"> @@ -553,16 +536,6 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <bpmndi:BPMNShape id="ServiceTask_0p4b7e1_di" bpmnElement="Task_0edkv0m"> <dc:Bounds x="1055" y="577" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_076pc2z_di" bpmnElement="CallActivity_076pc2z"> - <dc:Bounds x="667" y="88" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_188ejvu_di" bpmnElement="SequenceFlow_188ejvu"> - <di:waypoint xsi:type="dc:Point" x="767" y="128" /> - <di:waypoint xsi:type="dc:Point" x="1055" y="128" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="866" y="107" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1gbu8tc_di" bpmnElement="IntermediateThrowEvent_1d5z35x"> <dc:Bounds x="1294" y="376" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -781,10 +754,10 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_00a3ijv_di" bpmnElement="SequenceFlow_00a3ijv"> - <di:waypoint xsi:type="dc:Point" x="1155" y="128" /> + <di:waypoint xsi:type="dc:Point" x="895" y="128" /> <di:waypoint xsi:type="dc:Point" x="1294" y="128" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1179.5" y="107" width="90" height="12" /> + <dc:Bounds x="1049.5" y="107" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_1fqk4c6_di" bpmnElement="ScriptTask_PrepareServiceResources"> @@ -925,4 +898,4 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions>
\ No newline at end of file +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn index fae66a7381..d9a93e66d8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn @@ -67,28 +67,14 @@ ddsi.preProcessSDNCDelete(execution)]]></bpmn2:script> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("sendToSDNC" ) == false }]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1dwch0k" name="yes" sourceRef="ExclusiveGateway_1mrh7us" targetRef="ScriptTask_0xxwbdq" /> - <bpmn2:callActivity id="CallActivity_1s8pf0x" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - </bpmn2:extensionElements> + <bpmn2:sequenceFlow id="SequenceFlow_1jqc16k" sourceRef="preProcessRequest_ScriptTask" targetRef="ScriptTask_02da0lj" /> + <bpmn2:scriptTask id="ScriptTask_02da0lj" name="AAI Query (svc instance)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1jqc16k</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1grea1r</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_1jqc16k" sourceRef="preProcessRequest_ScriptTask" targetRef="CallActivity_1s8pf0x" /> - <bpmn2:scriptTask id="ScriptTask_02da0lj" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1grea1r</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1up0j5r</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteServiceInstance() -ddsi.postProcessAAIGET(execution)]]></bpmn2:script> +ddsi.getServiceInstance(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1grea1r" sourceRef="CallActivity_1s8pf0x" targetRef="ScriptTask_02da0lj" /> <bpmn2:sequenceFlow id="SequenceFlow_1up0j5r" sourceRef="ScriptTask_02da0lj" targetRef="ExclusiveGateway_0590oev" /> <bpmn2:scriptTask id="ScriptTask_1ybdq3e" name=" AAI Delete (svc instance) " scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0riudmc</bpmn2:incoming> @@ -250,26 +236,16 @@ ddsi.postProcessSDNCDelete(execution, response, "delete")]]></bpmn2:script> <dc:Bounds x="306" y="101" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_1s8pf0x_di" bpmnElement="CallActivity_1s8pf0x"> - <dc:Bounds x="-121" y="57" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1jqc16k_di" bpmnElement="SequenceFlow_1jqc16k"> <di:waypoint xsi:type="dc:Point" x="-165" y="97" /> - <di:waypoint xsi:type="dc:Point" x="-121" y="97" /> + <di:waypoint xsi:type="dc:Point" x="20" y="97" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-143" y="82" width="0" height="0" /> + <dc:Bounds x="-117.5" y="82" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_02da0lj_di" bpmnElement="ScriptTask_02da0lj"> <dc:Bounds x="20" y="57" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1grea1r_di" bpmnElement="SequenceFlow_1grea1r"> - <di:waypoint xsi:type="dc:Point" x="-21" y="97" /> - <di:waypoint xsi:type="dc:Point" x="20" y="97" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="0" y="82" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1up0j5r_di" bpmnElement="SequenceFlow_1up0j5r"> <di:waypoint xsi:type="dc:Point" x="120" y="97" /> <di:waypoint xsi:type="dc:Point" x="150" y="97" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index a46d8d4de2..ef3340e887 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoUpdateE2EServiceInstance" name="DoUpdateE2EServiceInstance" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -113,7 +113,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_1demy08</bpmn2:outgoing> <bpmn2:linkEventDefinition name="UpdateAAI" /> </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1demy08" sourceRef="IntermediateCatchEvent_0a9bdjw" targetRef="ScriptTask_195nptq" /> + <bpmn2:sequenceFlow id="SequenceFlow_1demy08" sourceRef="IntermediateCatchEvent_0a9bdjw" targetRef="ScriptTask_0sis7k0" /> <bpmn2:sequenceFlow id="SequenceFlow_0f76thv" sourceRef="CallActivity_1nm9zq7" targetRef="ScriptTask_0xtabf8" /> <bpmn2:scriptTask id="ScriptTask_19v8l1w" name="Post Config Service Instance Update" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0ku36oy</bpmn2:incoming> @@ -173,40 +173,8 @@ dcsi.postProcessRollback(execution) <bpmn2:sequenceFlow id="SequenceFlow_02znk15" sourceRef="ScriptTask_0vc9jgo" targetRef="EndEvent_014jyvb" /> <bpmn2:sequenceFlow id="SequenceFlow_19ly8h7" sourceRef="ScriptTask_1awrp72" targetRef="ScriptTask_0vc9jgo" /> </bpmn2:subProcess> - <bpmn2:scriptTask id="ScriptTask_195nptq" name="Pre Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1demy08</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1cy5gq2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstance() -dcsi.preProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1cy5gq2" sourceRef="ScriptTask_195nptq" targetRef="CallActivity_069o6fn" /> - <bpmn2:callActivity id="CallActivity_069o6fn" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1cy5gq2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1vy856f</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:scriptTask id="ScriptTask_0lp9y03" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1vy856f</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14ggluy</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstance() -dcsi.postProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1vy856f" sourceRef="CallActivity_069o6fn" targetRef="ScriptTask_0lp9y03" /> - <bpmn2:sequenceFlow id="SequenceFlow_14ggluy" sourceRef="ScriptTask_0lp9y03" targetRef="ScriptTask_0sis7k0" /> <bpmn2:scriptTask id="ScriptTask_0sis7k0" name="Pre Process AAI PUT" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_14ggluy</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1demy08</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1kx5ke9</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoUpdateE2EServiceInstance() @@ -387,11 +355,9 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1demy08_di" bpmnElement="SequenceFlow_1demy08"> <di:waypoint xsi:type="dc:Point" x="110" y="1373" /> - <di:waypoint xsi:type="dc:Point" x="197" y="1373" /> - <di:waypoint xsi:type="dc:Point" x="197" y="1373" /> - <di:waypoint xsi:type="dc:Point" x="293" y="1373" /> + <di:waypoint xsi:type="dc:Point" x="978" y="1373" /> <bpmndi:BPMNLabel> - <dc:Bounds x="212" y="1367" width="0" height="12" /> + <dc:Bounds x="499" y="1352" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0f76thv_di" bpmnElement="SequenceFlow_0f76thv"> @@ -504,36 +470,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="907.5" y="1892" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_195nptq_di" bpmnElement="ScriptTask_195nptq"> - <dc:Bounds x="293" y="1333" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1cy5gq2_di" bpmnElement="SequenceFlow_1cy5gq2"> - <di:waypoint xsi:type="dc:Point" x="393" y="1373" /> - <di:waypoint xsi:type="dc:Point" x="495" y="1373" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="399" y="1352" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_069o6fn_di" bpmnElement="CallActivity_069o6fn"> - <dc:Bounds x="495" y="1333" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0lp9y03_di" bpmnElement="ScriptTask_0lp9y03"> - <dc:Bounds x="724" y="1333" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vy856f_di" bpmnElement="SequenceFlow_1vy856f"> - <di:waypoint xsi:type="dc:Point" x="595" y="1373" /> - <di:waypoint xsi:type="dc:Point" x="724" y="1373" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="614.5" y="1352" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14ggluy_di" bpmnElement="SequenceFlow_14ggluy"> - <di:waypoint xsi:type="dc:Point" x="824" y="1373" /> - <di:waypoint xsi:type="dc:Point" x="978" y="1373" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="856" y="1352" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0sis7k0_di" bpmnElement="ScriptTask_0sis7k0"> <dc:Bounds x="978" y="1333" width="100" height="80" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn index 1589633e59..b53e87d34a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstanceRollback.bpmn @@ -184,7 +184,7 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script> <bpmn2:linkEventDefinition name="UpdateAAI" /> </bpmn2:intermediateCatchEvent> <bpmn2:scriptTask id="ScriptTask_0gj4dj5" name="Pre Process AAI PUT" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1ixphei</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1a65s3k</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1lppnhy</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoUpdateE2EServiceInstanceRollback() @@ -212,7 +212,7 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> def dcsi = new DoUpdateE2EServiceInstanceRollback() dcsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1a65s3k" sourceRef="IntermediateCatchEvent_0546q5i" targetRef="ScriptTask_13h2onn" /> + <bpmn2:sequenceFlow id="SequenceFlow_1a65s3k" sourceRef="IntermediateCatchEvent_0546q5i" targetRef="ScriptTask_0gj4dj5" /> <bpmn2:sequenceFlow id="SequenceFlow_1lppnhy" sourceRef="ScriptTask_0gj4dj5" targetRef="CallActivity_0zs5y0x" /> <bpmn2:sequenceFlow id="SequenceFlow_0kbisn8" sourceRef="CallActivity_0zs5y0x" targetRef="ScriptTask_1p96syr" /> <bpmn2:exclusiveGateway id="ExclusiveGateway_1k16vgh" name="RollBackAAI?" default="SequenceFlow_161uzhj"> @@ -287,38 +287,6 @@ rbk.postProcessRequest(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_1n6foyw" sourceRef="ScriptTask_17k4l6y" targetRef="EndEvent_193e9tt" /> <bpmn2:sequenceFlow id="SequenceFlow_1azhgda" sourceRef="ScriptTask_1p96syr" targetRef="ScriptTask_17k4l6y" /> <bpmn2:sequenceFlow id="SequenceFlow_055b52t" name="no" sourceRef="ExclusiveGateway_0ii31dq" targetRef="ExclusiveGateway_0ybxh3b" /> - <bpmn2:scriptTask id="ScriptTask_13h2onn" name="Pre Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1a65s3k</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0870pzc</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstanceRollback() -dcsi.preProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:callActivity id="CallActivity_1527zgc" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0870pzc</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1f31l5s</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_0870pzc" sourceRef="ScriptTask_13h2onn" targetRef="CallActivity_1527zgc" /> - <bpmn2:scriptTask id="ScriptTask_0td1f55" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1f31l5s</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1ixphei</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstanceRollback() -dcsi.postProcessAAIGET(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1f31l5s" sourceRef="CallActivity_1527zgc" targetRef="ScriptTask_0td1f55" /> - <bpmn2:sequenceFlow id="SequenceFlow_1ixphei" sourceRef="ScriptTask_0td1f55" targetRef="ScriptTask_0gj4dj5" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -602,9 +570,9 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1a65s3k_di" bpmnElement="SequenceFlow_1a65s3k"> <di:waypoint xsi:type="dc:Point" x="192" y="783" /> - <di:waypoint xsi:type="dc:Point" x="234" y="783" /> + <di:waypoint xsi:type="dc:Point" x="687" y="783" /> <bpmndi:BPMNLabel> - <dc:Bounds x="168" y="762" width="90" height="12" /> + <dc:Bounds x="394.5" y="762" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1lppnhy_di" bpmnElement="SequenceFlow_1lppnhy"> @@ -764,36 +732,6 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> <dc:Bounds x="769" y="106" width="15" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_13h2onn_di" bpmnElement="ScriptTask_13h2onn"> - <dc:Bounds x="234" y="743" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1527zgc_di" bpmnElement="CallActivity_1527zgc"> - <dc:Bounds x="391" y="743" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0870pzc_di" bpmnElement="SequenceFlow_0870pzc"> - <di:waypoint xsi:type="dc:Point" x="334" y="783" /> - <di:waypoint xsi:type="dc:Point" x="391" y="783" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="362.5" y="762" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0td1f55_di" bpmnElement="ScriptTask_0td1f55"> - <dc:Bounds x="543" y="743" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1f31l5s_di" bpmnElement="SequenceFlow_1f31l5s"> - <di:waypoint xsi:type="dc:Point" x="491" y="783" /> - <di:waypoint xsi:type="dc:Point" x="543" y="783" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="517" y="762" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ixphei_di" bpmnElement="SequenceFlow_1ixphei"> - <di:waypoint xsi:type="dc:Point" x="643" y="783" /> - <di:waypoint xsi:type="dc:Point" x="687" y="783" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="665" y="762" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn index 306b05cea1..b82b1da951 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateNetworkInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoUpdateNetworkInstance" name="DoUpdateNetworkInstance" isExecutable="true"> <bpmn2:startEvent id="updateNetwork_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -231,42 +231,14 @@ DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="callRESTQueryCloudRegion_ScriptTask" targetRef="prepareSDNCTopoRequest_ScriptTask" /> <bpmn2:scriptTask id="callRESTQueryNetworkId_ScriptTask" name="Call REST Query Network Id In AAI" scriptFormat="groovy"> - <bpmn2:incoming>siFoundYes</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* def DoUpdateNetworkInstance = new DoUpdateNetworkInstance() DoUpdateNetworkInstance.callRESTQueryAAINetworkId(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="callRESTQueryNetworkId_ScriptTask" targetRef="callRESTQueryCloudRegion_ScriptTask" /> - <bpmn2:scriptTask id="workflowExceptionSINotFound" name="Create Workflow Exception" scriptFormat="groovy"> - <bpmn2:incoming>siFoundNo</bpmn2:incoming> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -ExceptionUtil exceptionUtil = new ExceptionUtil() -exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance Not Found")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:exclusiveGateway id="siFoundCheck" name="is SI Found?" default="siFoundNo"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>siFoundYes</bpmn2:outgoing> - <bpmn2:outgoing>siFoundNo</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="siFoundYes" name="Yes" sourceRef="siFoundCheck" targetRef="callRESTQueryNetworkId_ScriptTask"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGSI_FoundIndicator" ) == true && execution.getVariable("GENGSI_SuccessIndicator" ) == true}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="siFoundNo" name="No" sourceRef="siFoundCheck" targetRef="workflowExceptionSINotFound" /> - <bpmn2:callActivity id="callGetServiceInstance" name="Get Service Instance" calledElement="GenericGetService"> - <bpmn2:extensionElements> - <camunda:in source="UPDNETI_serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:out source="GENGS_serviceInstance" target="UPDNETI_serviceInstanceId" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGSI_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGSI_SuccessIndicator" /> - <camunda:out source="GENGS_siResourceLink" target="GENGSI_siResourceLink" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:in source="GENGS_type" target="GENGS_type" /> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - </bpmn2:callActivity> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="callGetServiceInstance" targetRef="siFoundCheck" /> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="callGetServiceInstance" targetRef="callRESTQueryNetworkId_ScriptTask" /> <bpmn2:scriptTask id="validateUpdatePONetwork_ScriptTask" name="Validate Update PO Network" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_59</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> @@ -340,6 +312,13 @@ def DoUpdateNetworkInstance = new DoUpdateNetworkInstance() DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="callRESTQueryNetworkPolicy_ScriptTask" targetRef="callRESTQueryNetworkTableRef_ScriptTask" /> + <bpmn2:scriptTask id="callGetServiceInstance" name="AAI Query (svc instance)" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* +def DoUpdateNetworkInstance = new DoUpdateNetworkInstance() +DoUpdateNetworkInstance.getServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -430,7 +409,7 @@ DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]></bpmn2:scrip <di:waypoint xsi:type="dc:Point" x="572" y="203" /> <di:waypoint xsi:type="dc:Point" x="686" y="203" /> <bpmndi:BPMNLabel> - <dc:Bounds x="629" y="188" width="0" height="0" /> + <dc:Bounds x="584" y="188" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_StartEvent_50" targetElement="_BPMNShape_ExclusiveGateway_90"> @@ -682,42 +661,16 @@ DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]></bpmn2:scrip <dc:Bounds x="221" y="470" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_CallActivity_72" bpmnElement="callGetServiceInstance"> - <dc:Bounds x="686" y="163" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_244" bpmnElement="siFoundCheck" isMarkerVisible="true"> - <dc:Bounds x="836" y="177" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="891" y="195" width="79" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_CallActivity_72" targetElement="_BPMNShape_ExclusiveGateway_244"> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="ScriptTask_0e58tta_di" targetElement="_BPMNShape_ScriptTask_133"> <di:waypoint xsi:type="dc:Point" x="786" y="203" /> <di:waypoint xsi:type="dc:Point" x="805" y="203" /> <di:waypoint xsi:type="dc:Point" x="805" y="202" /> - <di:waypoint xsi:type="dc:Point" x="836" y="202" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="799" y="203" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="siFoundYes" sourceElement="_BPMNShape_ExclusiveGateway_244" targetElement="_BPMNShape_ScriptTask_133"> - <di:waypoint xsi:type="dc:Point" x="861" y="177" /> + <di:waypoint xsi:type="dc:Point" x="861" y="202" /> <di:waypoint xsi:type="dc:Point" x="861" y="140" /> <di:waypoint xsi:type="dc:Point" x="910" y="140" /> <di:waypoint xsi:type="dc:Point" x="984" y="140" /> <bpmndi:BPMNLabel> - <dc:Bounds x="868" y="157" width="29" height="22" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_331" bpmnElement="workflowExceptionSINotFound"> - <dc:Bounds x="984" y="256" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="siFoundNo" sourceElement="_BPMNShape_ExclusiveGateway_244" targetElement="_BPMNShape_ScriptTask_331"> - <di:waypoint xsi:type="dc:Point" x="861" y="227" /> - <di:waypoint xsi:type="dc:Point" x="861" y="296" /> - <di:waypoint xsi:type="dc:Point" x="984" y="296" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="871" y="233" width="22" height="22" /> + <dc:Bounds x="788" y="184" width="90" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_22" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ScriptTask_133" targetElement="_BPMNShape_ScriptTask_245"> @@ -824,6 +777,9 @@ DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(execution)]]></bpmn2:scrip <di:waypoint xsi:type="dc:Point" x="797" y="946" /> <di:waypoint xsi:type="dc:Point" x="816" y="847" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0e58tta_di" bpmnElement="callGetServiceInstance"> + <dc:Bounds x="686" y="163" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/InfraEmbeddedMariaDbConfig.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/InfraEmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..3f1a5eae07 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/InfraEmbeddedMariaDbConfig.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.Profile; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories( + entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager", + basePackages = { "org.onap.so.db.request.data.repository"} +) +@Profile({"test"}) +public class InfraEmbeddedMariaDbConfig { + + @Primary + @Bean(name = "requestEntityManagerFactory") + public LocalContainerEntityManagerFactoryBean + entityManagerFactory( + EntityManagerFactoryBuilder builder, + DataSource dataSource + ) { + return builder + .dataSource(dataSource) + .packages("org.onap.so.db.request.beans") + .persistenceUnit("requestDB") + .build(); + } + + @Bean(name = "requestTransactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("requestEntityManagerFactory") EntityManagerFactory + entityManagerFactory + ) { + return new JpaTransactionManager(entityManagerFactory); + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..314cc0b2de --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import java.io.IOException; + +import javax.annotation.PreDestroy; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +import ch.vorburger.mariadb4j.MariaDB4jService; + +@SpringBootApplication +@Profile("test") +@EnableProcessApplication("MSO CommonBPMN Test Application") +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/ValidBPMNTest.java index 8f75008aef..0521fa737d 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/ValidBPMNTest.java @@ -17,12 +17,27 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -/** - * - */ -/** - * - * - */ +package org.onap.so; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +@AutoConfigureWireMock(port = 0) +public class ValidBPMNTest { + + @Test + public void verifyApplicationStartup(){ + //Verifys Springboot app can start up and all BPMN's are in fact parsable + assert(true); + } -package org.onap.so.adapters.catalogdb.rest; +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..8a5ade6fb6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml @@ -0,0 +1,208 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:${wiremock.server.port} +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost:3904 + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock + vnf: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ + spring: + endpoint: http://localhost:${wiremock.server.port} + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + sdnc: + password: 3141634BF7E070AA289CF2892C986C0B + site-name: localDevEnv + workflow: + default: + aai: + cloud-region: + version: '9' + generic-vnf: + version: '9' + v8: + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + global: + default: + aai: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + delete: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + query: + callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:28090 + publisher: + topic: com.att.mso.asyncStatusUpdate + service-plugin: + third-sp-endpoint: + oof-calc-endpoint: +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sniro: + conductor: + enabled: true + host: http://localhost:${wiremock.server.port} + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: test + password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + role: BPEL-Client +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml deleted file mode 100644 index ebefee7b08..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/applicationContext_forPnfTesting.xml +++ /dev/null @@ -1,65 +0,0 @@ -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-2.5.xsd" > - - <bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"> - <property name="targetDataSource"> - <bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> - <property name="driverClass" value="org.h2.Driver" /> - <property name="url" - value="jdbc:h2:mem:process-engine;DB_CLOSE_DELAY=1000" /> - <property name="username" value="sa" /> - <property name="password" value="" /> - </bean> - </property> - </bean> - - <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> - <property name="dataSource" ref="dataSource" /> - </bean> - - <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration"> - <property name="processEngineName" value="engine" /> - <property name="dataSource" ref="dataSource" /> - <property name="transactionManager" ref="transactionManager" /> - <property name="databaseSchemaUpdate" value="true" /> - <property name="jobExecutorActivate" value="false" /> - <!--<property name="deploymentResources" value="classpath*:*.bpmn" />--> - </bean> - - <bean id="processEngine" class="org.camunda.bpm.engine.spring.ProcessEngineFactoryBean"> - <property name="processEngineConfiguration" ref="processEngineConfiguration" /> - </bean> - - <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /> - <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /> - <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /> - <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" /> - <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" /> - - <context:annotation-config /> - - <bean id="processEngineRule" class="org.camunda.bpm.engine.test.ProcessEngineRule"> - <property name="processEngine" ref="processEngine" /> - </bean> - - <bean id="aaiConnection" class="org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl"/> - - <bean id="checkAaiForCorrelationIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate"> - <property name="aaiConnection" ref="aaiConnection"/> - </bean> - - <bean id="createAaiEntryWithPnfIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate"> - <property name="aaiConnection" ref="aaiConnection"/> - </bean> - - <bean id="informDmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.InformDmaapClient"> - <property name="dmaapClient" ref="dmaapClient"/> - </bean> - - <bean id="dmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/> -</beans> diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 68f7e5a3bb..3483aed8a7 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -30,6 +30,12 @@ <groupId>org.onap.sdnc.northbound</groupId> <artifactId>generic-resource-api-client</artifactId> <version>1.4.0-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 074652e221..9c1fba62e9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -141,6 +141,19 @@ public class AAIUpdateTasks { } } + public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); @@ -281,6 +294,16 @@ public class AAIUpdateTasks { } } + public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + /** * BPMN access method to update L3Network after it was created in AIC * @param execution diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 69fc633bbd..3456fa1c56 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -92,13 +92,18 @@ public class VnfAdapterCreateTasks { ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VolumeGroup volumeGroup = null; + try { + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + } catch(BBObjectNotFoundException bbException) { + } CloudRegion cloudRegion = gBBInput.getCloudRegion(); RequestContext requestContext = gBBInput.getRequestContext(); OrchestrationContext orchestrationContext = gBBInput.getOrchContext(); String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId()); - CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString()); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index aa865f0340..0b712452fd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -96,6 +96,7 @@ public class VnfAdapterImpl { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); } } + execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock()); } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index f94b967643..c45a47bc12 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -23,8 +23,12 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import java.util.Optional; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -42,6 +46,12 @@ public class UnassignNetworkBB { @Autowired private NetworkBBUtils networkBBUtils; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private AAINetworkResources aaiNetworkResources; /** * BPMN access method to prepare overall error messages. @@ -54,9 +64,11 @@ public class UnassignNetworkBB { public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception { try { - AAIResultWrapper aaiResultWrapper = execution.getVariable("l3NetworkAAIResultWrapper"); - Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); - if (networkBBUtils.isRelationshipRelatedToExists(l3network, relatedToValue)) { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); + Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); + if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) { String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue; execution.setVariable("ErrorUnassignNetworkBB", msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java index fd5f00ed6f..6fcad95144 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java @@ -26,6 +26,7 @@ public class Resource { private WorkflowType resourceType; private boolean generated; private boolean baseVfModule; + private String virtualLinkKey; public Resource(WorkflowType resourceType, String resourceId, boolean generated){ this.resourceId = resourceId; @@ -57,4 +58,10 @@ public class Resource { public void setBaseVfModule(boolean baseVfModule) { this.baseVfModule = baseVfModule; } + public String getVirtualLinkKey() { + return virtualLinkKey; + } + public void setVirtualLinkKey(String virtualLinkKey) { + this.virtualLinkKey = virtualLinkKey; + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 0f02928d16..c6a63e1431 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; @@ -159,7 +160,7 @@ public class WorkflowAction { } for (OrchestrationFlow orchFlow : orchFlows) { ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null); flowsToExecute.add(ebb); } } else { @@ -264,6 +265,7 @@ public class WorkflowAction { execution.setVariable("flowsToExecute", flowsToExecute); } catch (Exception ex) { + msoLogger.error(ex); buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex); } } @@ -289,7 +291,7 @@ public class WorkflowAction { Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ - updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type)); + updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null); } }); } @@ -309,12 +311,13 @@ public class WorkflowAction { Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ - updateWorkflowResourceIds(flowsToExecute, type, resourceCounter.stream().filter(x -> type.equals(x.getResourceType())) - .collect(Collectors.toList()).get(i).getResourceId(), null); } + Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())) + .collect(Collectors.toList()).get(i); + updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); } }); } - protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id){ + protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){ String resourceId = id; if(resourceId==null){ resourceId = UUID.randomUUID().toString(); @@ -335,6 +338,12 @@ public class WorkflowAction { } ebb.setWorkflowResourceIds(workflowResourceIds); } + if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink() + && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setNetworkId(resourceId); + ebb.setWorkflowResourceIds(workflowResourceIds); + } } } @@ -381,18 +390,29 @@ public class WorkflowAction { InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); CollectionResourceInstanceGroupCustomization collectionInstCust = null; if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { - collectionInstCust = instanceGroup.getCollectionInstanceGroupCustomizations().get(0); - if(collectionInstCust.getSubInterfaceNetworkQuantity() != null) { + for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) { + if(collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { + collectionInstCust = collectionInstanceGroupTemp; + break; + } + } + if(collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) { minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); } } msoLogger.debug("minNetworks: " + minNetworks); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = null; + for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) { + if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { + collectionNetworkResourceCust = collectionNetworkTemp; + break; + } + } for (int i = 0; i < minNetworks; i++) { - if(collectionInstCust != null) { - - resourceCounter.add( - new Resource(WorkflowType.VIRTUAL_LINK,instanceGroup.getCollectionNetworkResourceCustomizations() - .get(0).getModelCustomizationUUID(),false)); + if(collectionNetworkResourceCust != null && collectionInstCust != null) { + Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,collectionNetworkResourceCust.getModelCustomizationUUID(),false); + resource.setVirtualLinkKey(Integer.toString(i)); + resourceCounter.add(resource); } } } else { @@ -633,7 +653,7 @@ public class WorkflowAction { if (vnf != null && vnf.getVfModules() != null) { for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { Optional<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils - .getRelatedVolumeGroupByNameFromVfModule(vfModule.getVfModuleId(), instanceName); + .getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(), vfModule.getVfModuleId(), instanceName); if (volumeGroupFromVfModule.isPresent()) { return volumeGroupFromVfModule.get().getVolumeGroupId(); } @@ -642,6 +662,7 @@ public class WorkflowAction { } return generatedResourceId; } catch (Exception ex) { + msoLogger.error(ex); throw new IllegalStateException( "WorkflowAction was unable to verify if the instance name already exist in AAI."); } @@ -666,20 +687,32 @@ public class WorkflowAction { for (ExecuteBuildingBlock ebb : orchFlows) { if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) { String key = ebb.getBuildingBlock().getKey(); + boolean isVirtualLink = ebb.getBuildingBlock().getIsVirtualLink(); + String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey(); sortedOrchFlows.add(ebb); for (ExecuteBuildingBlock ebb2 : orchFlows) { - if (ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { sortedOrchFlows.add(ebb2); break; } + if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") + && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) { + sortedOrchFlows.add(ebb2); + break; + } } for (ExecuteBuildingBlock ebb2 : orchFlows) { - if (ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") && ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) { sortedOrchFlows.add(ebb2); break; } + if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB") + && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) { + sortedOrchFlows.add(ebb2); + break; + } } } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB") || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) { @@ -729,48 +762,49 @@ public class WorkflowAction { workflowResourceIds.setServiceInstanceId(resourceId); flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(VNF)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(NETWORK) && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true)); + Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()) + .collect(Collectors.toList()).get(i); + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource.getResourceId(), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey())); } } else if (orchFlow.getFlowName().contains(VFMODULE)) { List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) .collect(Collectors.toList())); for (int i = 0; i < vfModuleResourcesSorted.size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } else { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false)); + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } } return flowsToExecute; @@ -778,13 +812,14 @@ public class WorkflowAction { protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, - WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink) { + WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey) { ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); BuildingBlock buildingBlock = new BuildingBlock(); buildingBlock.setBpmnFlowName(orchFlow.getFlowName()); buildingBlock.setMsoId(UUID.randomUUID().toString()); buildingBlock.setKey(key); buildingBlock.setIsVirtualLink(isVirtualLink); + buildingBlock.setVirtualLinkKey(virtualLinkKey); executeBuildingBlock.setApiVersion(apiVersion); executeBuildingBlock.setaLaCarte(aLaCarte); executeBuildingBlock.setRequestAction(requestAction); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index 373ed63fda..94dfdcc747 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -266,6 +266,10 @@ public class AAIObjectMapper { protected void configure() { map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID()); map().setModelVersionId(source.getModelInfoCollection().getModelVersionId()); + map().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID()); + map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction()); + map().setCollectionRole(source.getModelInfoCollection().getCollectionRole()); + map().setCollectionType(source.getModelInfoCollection().getCollectionType()); map().setCollectionName(source.getName()); } }); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index a1501da0e2..ee8f503e42 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -240,7 +240,7 @@ public class NetworkAdapterObjectMapper { for (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet subnet : subnets) { org.onap.so.openstack.beans.Subnet openstackSubnet = modelMapper.map(subnet, org.onap.so.openstack.beans.Subnet.class); //update cidr value - if (subnet.getNetworkStartAddress() != null & subnet.getCidrMask() != null) + if (subnet.getNetworkStartAddress() != null && subnet.getCidrMask() != null) openstackSubnet.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask())); List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes(); List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java index d8dde57135..67e7afb599 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java @@ -20,14 +20,18 @@ package org.onap.so.client.adapter.vnf.mapper; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.annotation.PostConstruct; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; import org.onap.so.bpmn.core.UrnPropertiesReader; @@ -41,16 +45,19 @@ import org.onap.so.entity.MsoRequest; import org.springframework.stereotype.Component; import org.springframework.web.util.UriUtils; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class VnfAdapterObjectMapper { private ObjectMapper mapper = new ObjectMapper(); + + @PostConstruct + public void init () { + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + } public CreateVolumeGroupRequest createVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest(); @@ -101,7 +108,7 @@ public class VnfAdapterObjectMapper { final String USER_PARAM_NAME_KEY = "name"; final String USER_PARAM_VALUE_KEY = "value"; // sdncVfModuleQueryResponse will not be available in aLaCarte case - if (sdncVfModuleQueryResponse != null) { + if (sdncVfModuleQueryResponse != null) { GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters()); } @@ -164,4 +171,4 @@ public class VnfAdapterObjectMapper { return UrnPropertiesReader.getVariable(key); } -} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index c4dcd1aed9..515f04b218 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -30,18 +30,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; -import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; -import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; -import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.entity.MsoRequest; -import org.onap.so.jsonpath.JsonPathUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; @@ -57,18 +46,37 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataInte import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkInformationItems; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataSriovParameters; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNames; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNetworks; import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfNetworkData; -import org.onap.sdnc.northbound.client.model.*; - +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcNetworkData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcNetworkData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfResourceAssignments; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyVnfTopology; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.entity.MsoRequest; +import org.onap.so.jsonpath.JsonPathUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -96,19 +104,33 @@ public class VnfAdapterVfModuleObjectMapper { private static final String FLOATING_V6_IP = "_floating_v6_ip"; private static final String UNDERSCORE = "_"; + @PostConstruct + public void init () { + mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + } + public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, - VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); createVfModuleRequest.setTenantId(cloudRegion.getTenantId()); createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName()); - createVfModuleRequest.setVnfType(genericVnf.getVnfType()); + createVfModuleRequest.setVnfId(genericVnf.getVnfId()); + createVfModuleRequest.setVnfType(genericVnf.getVnfType()); createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName()); createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID()); - + if (volumeGroup != null) { + createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + } + VfModule baseVfModule = getBaseVfModule(genericVnf); + if (baseVfModule != null) { + createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId()); + createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId()); + } createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse)); createVfModuleRequest.setSkipAAI(true); @@ -134,6 +156,7 @@ public class VnfAdapterVfModuleObjectMapper { private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException { + GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class); GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class); Map<String,String> paramsMap = new HashMap<>(); @@ -151,7 +174,13 @@ public class VnfAdapterVfModuleObjectMapper { buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule); // Parameters received from the request should overwrite any parameters received from SDNC - paramsMap.putAll(requestContext.getUserParams()); + + if (requestContext.getUserParams() != null) { + paramsMap.putAll(requestContext.getUserParams()); + } + if (vfModule.getCloudParams() != null) { + paramsMap.putAll(vfModule.getCloudParams()); + } return paramsMap; } @@ -161,7 +190,9 @@ public class VnfAdapterVfModuleObjectMapper { paramsMap.put("vf_module_id", vfModule.getVfModuleId()); paramsMap.put("vf_module_name", vfModule.getVfModuleName()); paramsMap.put("environment_context",serviceInstance.getModelInfoServiceInstance().getEnvironmentContext()); + paramsMap.putIfAbsent("environment_context", ""); paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext()); + paramsMap.putIfAbsent("workload_context", ""); Integer vfModuleIndex = vfModule.getModuleIndex(); if (vfModuleIndex != null) { paramsMap.put("vf_module_index", vfModuleIndex.toString()); @@ -348,7 +379,7 @@ public class VnfAdapterVfModuleObjectMapper { } private void buildVfModuleSriovParameters(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) { - /** SRIOV Parameters + // SRIOV Parameters GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters(); if (sriovParameters != null) { GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters = sriovParameters.getHeatVlanFilters(); @@ -371,7 +402,7 @@ public class VnfAdapterVfModuleObjectMapper { } } } - **/ + } private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) { @@ -726,4 +757,18 @@ public class VnfAdapterVfModuleObjectMapper { return json; } + + private VfModule getBaseVfModule(GenericVnf genericVnf) { + List<VfModule> vfModules = genericVnf.getVfModules(); + VfModule baseVfModule = null; + if (vfModules != null) { + for(int i = 0; i < vfModules.size(); i++) { + if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) { + baseVfModule = vfModules.get(i); + break; + } + } + } + return baseVfModule; + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index 7fef56d965..a641d43ba3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -67,6 +67,15 @@ public class AAIVfModuleResources { injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } + public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + VfModule copiedVfModule = vfModule.shallowCopyId(); + + copiedVfModule.setHeatStackId(vfModule.getHeatStackId()); + org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule); + injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); + } + public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index 70c6724921..af97e55c14 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -74,4 +74,12 @@ public class AAIVolumeGroupResources { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); injectionHelper.getAaiClient().delete(uri); } + + public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); + + copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId()); + injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup)); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index e52616677d..2d9032c7c0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -28,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; @@ -43,8 +44,8 @@ public class VnfAdapterVfModuleResources { private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, - VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException { - return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException { + return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); } public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java index 1ce7a92eb5..50137cf985 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java @@ -20,11 +20,6 @@ package org.onap.so.client.sdnc; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.Collections; - import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -32,7 +27,6 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.client.BufferingClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -58,25 +52,19 @@ public class BaseClient<I,O> { this.targetUrl = targetUrl; } - public O get(I data, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.GET, uriVariables); + public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.GET, typeRef, uriVariables); } - public O post(I data, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.POST, uriVariables); + public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.POST, typeRef, uriVariables); } - public O run(I data, HttpMethod method, Object... uriVariables) throws RestClientException { + public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); RestTemplate restTemplate = new RestTemplate(); - ObjectMapper mapper = new ObjectMapper(); - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - converter.setObjectMapper(mapper); - mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - restTemplate.getMessageConverters().add(0, converter); restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); - ParameterizedTypeReference<O> output = new ParameterizedTypeReference<O>() {}; - ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, output, + ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); return responseEntity.getBody(); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 1f0d654a85..9e60196426 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -21,6 +21,7 @@ package org.onap.so.client.sdnc; import java.util.LinkedHashMap; + import javax.ws.rs.core.UriBuilder; import org.onap.so.client.exception.BadResponseException; @@ -29,6 +30,7 @@ import org.onap.so.client.sdnc.beans.SDNCProperties; import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; @@ -58,7 +60,7 @@ public class SDNCClient { HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl); - LinkedHashMap<?, ?> output = STOClient.post(jsonRequest); + LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNResponse(output); } @@ -84,7 +86,7 @@ public class SDNCClient { HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); msoLogger.info("Running SDNC CLIENT..."); - LinkedHashMap<?, ?> output = STOClient.get(jsonRequest); + LinkedHashMap<?, ?> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); msoLogger.info("Validating output..."); return sdnCommonTasks.validateSDNGetResponse(output); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java index 20c95dd55e..5b23707cb9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java @@ -54,7 +54,7 @@ public class ServiceTopologyOperationMapper{ GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput(); - servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceId()); + servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName()); servOpInput.setSdncRequestHeader(sdncRequestHeader); servOpInput.setRequestInformation(reqInfo); @@ -64,7 +64,7 @@ public class ServiceTopologyOperationMapper{ if(requestContext.getUserParams()!=null){ for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput(); - serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceId()); + serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName()); GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam(); GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName(entry.getKey()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java index 99256fd507..af670d13d5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java @@ -128,6 +128,15 @@ public class VfModuleTopologyOperationRequestMapper { } } + if (vfModule.getCloudParams() != null) { + for (Map.Entry<String, String> entry : vfModule.getCloudParams().entrySet()) { + GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); + paramItem.setName(entry.getKey()); + paramItem.setValue(entry.getValue()); + vfModuleInputParameters.addParamItem(paramItem); + } + } + if (volumeGroup != null) { GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName("volume-group-id"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java index 979b9e5e80..cee94e28bd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -31,6 +31,7 @@ import org.onap.so.client.sniro.beans.SniroConductorRequest; import org.onap.so.client.sniro.beans.SniroManagerRequest; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; @@ -76,7 +77,7 @@ public class SniroClient { baseClient.setTargetUrl(url); baseClient.setHttpHeader(header); - LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString()); + LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); validator.validateDemandsResponse(response); log.trace("Completed Sniro Client Post Demands"); } @@ -106,7 +107,7 @@ public class SniroClient { baseClient.setTargetUrl(url); baseClient.setHttpHeader(header); - LinkedHashMap<?, ?> response = baseClient.post(releaseRequest.toJsonString()); + LinkedHashMap<?, ?> response = baseClient.post(releaseRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {}); SniroValidator v = new SniroValidator(); v.validateReleaseResponse(response); log.trace("Completed Sniro Client Post Release"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 6ad263a935..c9433a6212 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -203,6 +203,24 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ } @Test + public void updateHeatStackIdVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); + + aaiUpdateTasks.updateHeatStackIdVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf); + } + + @Test + public void updateHeatStackIdVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateHeatStackIdVfModule(execution); + } + + @Test public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); @@ -249,7 +267,23 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ expectedException.expect(BpmnError.class); doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution); - } + } + @Test + public void updateHeatStackIdVolumeGroupTest() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + + aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + } + + @Test + public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); + } + @Test public void updateOstatusAssignedNetworkTest() throws Exception { doNothing().when(aaiNetworkResources).updateNetwork(network); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java index f54e3faf1d..698ebb33f2 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -138,12 +138,52 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); vnfAdapterCreateTasks.createVfModule(execution); verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString()); + } + + @Test + public void test_createVfModuleWithVolumeGroup() throws Exception { + RequestContext requestContext = setRequestContext(); + + ServiceInstance serviceInstance = setServiceInstance(); + + GenericVnf genericVnf = setGenericVnf(); + + VfModule vfModule = setVfModule(); + + VolumeGroup volumeGroup = setVolumeGroup(); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVfModuleRequest modRequest = new CreateVfModuleRequest(); + modRequest.setVfModuleId(vfModule.getVfModuleId()); + modRequest.setBaseVfModuleStackId("baseVfModuleStackId"); + modRequest.setVfModuleName(vfModule.getVfModuleName()); + CreateVfModuleRequest createVfModuleRequest = modRequest; + + String sdncVfModuleQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse); + + String sdncVnfQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); + + doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + vnfAdapterCreateTasks.createVfModule(execution); + + verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString()); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java index 6a117902ea..32c285b0fe 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java @@ -20,48 +20,58 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Test; +import org.mockito.Mock; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.springframework.beans.factory.annotation.Autowired; public class UnassignNetworkBBTest extends BaseTaskTest { + + @Mock + private NetworkBBUtils networkBBUtils; + @Mock + private ExtractPojosForBB extractPojosForBB; @Autowired private UnassignNetworkBB unassignNetworkBB; private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/"; + private L3Network network; @Test public void checkRelationshipRelatedToTrueTest() throws Exception { expectedException.expect(BpmnError.class); + network = setL3Network(); + network.setNetworkId("testNetworkId1"); final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); - execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper); - + Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); + doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID, "testNetworkId1"); + doReturn(aaiResultWrapper).when(aaiNetworkResources).queryNetworkWrapperById(network); + doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(l3network, "vf-module"); unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module"); - } - - @Test - public void checkRelationshipRelatedToFalseTest() throws Exception { - final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); - AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); - execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper); - - unassignNetworkBB.checkRelationshipRelatedTo(execution, "kfc-module"); - //expected result is no exception + assertThat(execution.getVariable("ErrorUnassignNetworkBB"), notNullValue()); } @Test public void getCloudSdncRegion25Test() throws Exception { CloudRegion cloudRegion = setCloudRegion(); cloudRegion.setCloudRegionVersion("2.5"); + doReturn("AAIAIC25").when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC); unassignNetworkBB.getCloudSdncRegion(execution); assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc")); } @@ -71,6 +81,7 @@ public class UnassignNetworkBBTest extends BaseTaskTest { CloudRegion cloudRegion = setCloudRegion(); cloudRegion.setCloudRegionVersion("3.0"); gBBInput.setCloudRegion(cloudRegion); + doReturn(cloudRegion.getLcpCloudRegionId()).when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC); unassignNetworkBB.getCloudSdncRegion(execution); assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc")); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index c910ad19fa..283f8881c7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -600,12 +600,15 @@ public class WorkflowActionTest extends BaseTaskTest { instanceGroup.setCollectionNetworkResourceCustomizations(new ArrayList<>()); CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization(); collectionNetworkResourceCust.setModelCustomizationUUID("123"); + collectionNetworkResourceCust.setNetworkResourceCustomization(collectionResourceCustomization); instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust ); List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>(); CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCustomization.setModelCustomizationUUID("123"); collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3); collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization); collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup); + collectionInstanceGroupCustomization.setCollectionResourceCust(collectionResourceCustomization); instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations); collectionResource.setInstanceGroup(instanceGroup); collectionResourceCustomization.setCollectionResource(collectionResource);; @@ -618,14 +621,32 @@ public class WorkflowActionTest extends BaseTaskTest { assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB"); assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(2).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(3).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(4).getWorkflowResourceIds().getNetworkId().isEmpty(), true); + assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", + ebbs.get(2).getWorkflowResourceIds().getNetworkId() == ebbs.get(3).getWorkflowResourceIds().getNetworkId() + && ebbs.get(3).getWorkflowResourceIds().getNetworkId() == ebbs.get(4).getWorkflowResourceIds().getNetworkId(), true); assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(5).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(6).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(7).getWorkflowResourceIds().getNetworkId().isEmpty(), true); + assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", + ebbs.get(5).getWorkflowResourceIds().getNetworkId() == ebbs.get(6).getWorkflowResourceIds().getNetworkId() + && ebbs.get(6).getWorkflowResourceIds().getNetworkId() == ebbs.get(7).getWorkflowResourceIds().getNetworkId(), true); assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(8).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(9).getWorkflowResourceIds().getNetworkId().isEmpty(), true); assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals("Network id not empty", !ebbs.get(10).getWorkflowResourceIds().getNetworkId().isEmpty(), true); + assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", + ebbs.get(8).getWorkflowResourceIds().getNetworkId() == ebbs.get(9).getWorkflowResourceIds().getNetworkId() + && ebbs.get(9).getWorkflowResourceIds().getNetworkId() == ebbs.get(10).getWorkflowResourceIds().getNetworkId(), true); assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB"); assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); } @@ -1423,7 +1444,7 @@ public class WorkflowActionTest extends BaseTaskTest { workflowResourceIds.setVnfId("id444"); when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf); - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123","111111")).thenReturn(opVolumeGroup); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123","111111")).thenReturn(opVolumeGroup); when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444","111111")).thenReturn(Optional.empty()); id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, workflowResourceIds); assertEquals("id123",id2); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index 88f8526f31..6edda44c0a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -350,11 +350,19 @@ public class AAIObjectMapperTest{ ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); modelInfoCollection.setCollectionFunction("networkCollectionFunction"); modelInfoCollection.setCollectionRole("networkCollectionRole"); + modelInfoCollection.setCollectionType("networkCollectionType"); + modelInfoCollection.setModelCustomizationUUID("modelCustomizationUUID"); + modelInfoCollection.setModelVersionId("modelVersionId"); + modelInfoCollection.setModelInvariantUUID("modelInvariantUUID"); networkCollection.setModelInfoCollection(modelInfoCollection); networkCollection.setName("networkCollectionName"); org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection(); expectedCollection.setCollectionId("networkCollectionId"); + expectedCollection.setCollectionType("networkCollectionType"); + expectedCollection.setCollectionCustomizationId("modelCustomizationUUID"); + expectedCollection.setModelVersionId("modelVersionId"); + expectedCollection.setModelInvariantId("modelInvariantUUID"); expectedCollection.setCollectionFunction("networkCollectionFunction"); expectedCollection.setCollectionRole("networkCollectionRole"); expectedCollection.setCollectionName("networkCollectionName"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index 13bdfc87a1..b2f01f007f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -55,7 +55,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.entity.MsoRequest; public class VnfAdapterObjectMapperTest { - private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/"; @Spy private VnfAdapterObjectMapper vnfAdapterObjectMapper = new VnfAdapterObjectMapper(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java deleted file mode 100644 index b4c73ceb3b..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java +++ /dev/null @@ -1,453 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.adapter.vnf.mapper; - -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; - -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashMap; -import org.junit.Ignore; -import org.junit.Test; -import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; -import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; -import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; -import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; -import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; -import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class VnfAdapterVfModuleObjectMapperIntegrationTest { - - private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; - - @Test - @Ignore - public void createVfModuleRequestMapperTest() throws Exception { - - // prepare and set service instance - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); - ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); - modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); - modelInfoServiceInstance.setModelName("serviceModelName"); - modelInfoServiceInstance.setModelUuid("serviceModelUuid"); - modelInfoServiceInstance.setModelVersion("serviceModelVersion"); - modelInfoServiceInstance.setEnvironmentContext("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - // - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - requestContext.setMsoRequestId("requestId"); - requestContext.setUserParams(userParams); - requestContext.setProductFamilyId("productFamilyId"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("vnfId"); - vnf.setVnfType("vnfType"); - vnf.setVnfName("vnfName"); - ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); - modelInfoGenericVnf.setModelName("vnfModelName"); - modelInfoGenericVnf.setModelVersion("vnfModelVersion"); - modelInfoGenericVnf.setModelUuid("vnfModelUuid"); - modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); - vnf.setModelInfoGenericVnf(modelInfoGenericVnf); - - Integer vfModuleIndex = 1; - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("vfModuleId"); - vfModule.setVfModuleName("vfModuleName"); - vfModule.setModuleIndex(vfModuleIndex); - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); - modelInfoVfModule.setModelName("vfModuleModelName"); - modelInfoVfModule.setModelVersion("vfModuleModelVersion"); - modelInfoVfModule.setModelUUID("vfModuleModelUuid"); - modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); - vfModule.setModelInfoVfModule(modelInfoVfModule); - - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setLcpCloudRegionId("cloudRegionId"); - cloudRegion.setTenantId("tenantId"); - - OrchestrationContext orchestrationContext = new OrchestrationContext(); - orchestrationContext.setIsRollbackEnabled(false); - - String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - @Ignore - public void createVfModuleRequestMapperWithCloudResourcesTest() throws Exception { - - // prepare and set service instance - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); - ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); - modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); - modelInfoServiceInstance.setModelName("serviceModelName"); - modelInfoServiceInstance.setModelUuid("serviceModelUuid"); - modelInfoServiceInstance.setModelVersion("serviceModelVersion"); - modelInfoServiceInstance.setEnvironmentContext("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - // - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - requestContext.setMsoRequestId("requestId"); - requestContext.setUserParams(userParams); - requestContext.setProductFamilyId("productFamilyId"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("vnfId"); - vnf.setVnfType("vnfType"); - vnf.setVnfName("vnfName"); - ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); - modelInfoGenericVnf.setModelName("vnfModelName"); - modelInfoGenericVnf.setModelVersion("vnfModelVersion"); - modelInfoGenericVnf.setModelUuid("vnfModelUuid"); - modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); - vnf.setModelInfoGenericVnf(modelInfoGenericVnf); - - Integer vfModuleIndex = 1; - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("vfModuleId"); - vfModule.setVfModuleName("vfModuleName"); - vfModule.setModuleIndex(vfModuleIndex); - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); - modelInfoVfModule.setModelName("vfModuleModelName"); - modelInfoVfModule.setModelVersion("vfModuleModelVersion"); - modelInfoVfModule.setModelUUID("vfModuleModelUuid"); - modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); - vfModule.setModelInfoVfModule(modelInfoVfModule); - - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setLcpCloudRegionId("cloudRegionId"); - cloudRegion.setTenantId("tenantId"); - - OrchestrationContext orchestrationContext = new OrchestrationContext(); - orchestrationContext.setIsRollbackEnabled(false); - - String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - @Ignore - public void createVfModuleRequestMapperDhcpDisabledTest() throws Exception { - // prepare and set service instance - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); - ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); - modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); - modelInfoServiceInstance.setModelName("serviceModelName"); - modelInfoServiceInstance.setModelUuid("serviceModelUuid"); - modelInfoServiceInstance.setModelVersion("serviceModelVersion"); - modelInfoServiceInstance.setEnvironmentContext("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - - - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - requestContext.setMsoRequestId("requestId"); - requestContext.setUserParams(userParams); - requestContext.setProductFamilyId("productFamilyId"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("vnfId"); - vnf.setVnfType("vnfType"); - vnf.setVnfName("vnfName"); - ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); - modelInfoGenericVnf.setModelName("vnfModelName"); - modelInfoGenericVnf.setModelVersion("vnfModelVersion"); - modelInfoGenericVnf.setModelUuid("vnfModelUuid"); - modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); - vnf.setModelInfoGenericVnf(modelInfoGenericVnf); - - Integer vfModuleIndex = 1; - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("vfModuleId"); - vfModule.setVfModuleName("vfModuleName"); - vfModule.setModuleIndex(vfModuleIndex); - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); - modelInfoVfModule.setModelName("vfModuleModelName"); - modelInfoVfModule.setModelVersion("vfModuleModelVersion"); - modelInfoVfModule.setModelUUID("vfModuleModelUuid"); - modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); - vfModule.setModelInfoVfModule(modelInfoVfModule); - - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setLcpCloudRegionId("cloudRegionId"); - cloudRegion.setTenantId("tenantId"); - - OrchestrationContext orchestrationContext = new OrchestrationContext(); - orchestrationContext.setIsRollbackEnabled(false); - - String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - @Ignore - public void createVfModuleRequestMapperMultipleDhcpTest() throws Exception { - // prepare and set service instance - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); - ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); - modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); - modelInfoServiceInstance.setModelName("serviceModelName"); - modelInfoServiceInstance.setModelUuid("serviceModelUuid"); - modelInfoServiceInstance.setModelVersion("serviceModelVersion"); - modelInfoServiceInstance.setEnvironmentContext("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - requestContext.setMsoRequestId("requestId"); - requestContext.setUserParams(userParams); - requestContext.setProductFamilyId("productFamilyId"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("vnfId"); - vnf.setVnfType("vnfType"); - vnf.setVnfName("vnfName"); - ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); - modelInfoGenericVnf.setModelName("vnfModelName"); - modelInfoGenericVnf.setModelVersion("vnfModelVersion"); - modelInfoGenericVnf.setModelUuid("vnfModelUuid"); - modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); - vnf.setModelInfoGenericVnf(modelInfoGenericVnf); - - Integer vfModuleIndex = 1; - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("vfModuleId"); - vfModule.setVfModuleName("vfModuleName"); - vfModule.setModuleIndex(vfModuleIndex); - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); - modelInfoVfModule.setModelName("vfModuleModelName"); - modelInfoVfModule.setModelVersion("vfModuleModelVersion"); - modelInfoVfModule.setModelUUID("vfModuleModelUuid"); - modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); - vfModule.setModelInfoVfModule(modelInfoVfModule); - - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setLcpCloudRegionId("cloudRegionId"); - cloudRegion.setTenantId("tenantId"); - - OrchestrationContext orchestrationContext = new OrchestrationContext(); - orchestrationContext.setIsRollbackEnabled(false); - - String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json"))); - String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( - requestContext, cloudRegion, orchestrationContext, serviceInstance, - vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); - - ObjectMapper omapper = new ObjectMapper(); - CreateVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - CreateVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } - - @Test - public void DeleteVfModuleRequestMapperTest() throws Exception { - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); - ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); - modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); - modelInfoServiceInstance.setModelName("serviceModelName"); - modelInfoServiceInstance.setModelUuid("serviceModelUuid"); - modelInfoServiceInstance.setModelVersion("serviceModelVersion"); - modelInfoServiceInstance.setEnvironmentContext("environmentContext"); - modelInfoServiceInstance.setWorkloadContext("workloadContext"); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - // prepare Customer object - Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(new ServiceSubscription()); - // set Customer on service instance - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - // - RequestContext requestContext = new RequestContext(); - HashMap<String, String> userParams = new HashMap<String, String>(); - userParams.put("key1", "value1"); - requestContext.setMsoRequestId("requestId"); - requestContext.setUserParams(userParams); - requestContext.setProductFamilyId("productFamilyId"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("vnfId"); - vnf.setVnfType("vnfType"); - vnf.setVnfName("vnfName"); - ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); - modelInfoGenericVnf.setModelName("vnfModelName"); - modelInfoGenericVnf.setModelVersion("vnfModelVersion"); - modelInfoGenericVnf.setModelUuid("vnfModelUuid"); - modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); - vnf.setModelInfoGenericVnf(modelInfoGenericVnf); - - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("vfModuleId"); - vfModule.setVfModuleName("vfModuleName"); - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); - modelInfoVfModule.setModelName("vfModuleModelName"); - modelInfoVfModule.setModelVersion("vfModuleModelVersion"); - modelInfoVfModule.setModelUUID("vfModuleModelUuid"); - modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); - vfModule.setModelInfoVfModule(modelInfoVfModule); - - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setLcpCloudRegionId("cloudRegionId"); - cloudRegion.setTenantId("tenantId"); - - OrchestrationContext orchestrationContext = new OrchestrationContext(); - orchestrationContext.setIsRollbackEnabled(false); - - VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); - mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); - - DeleteVfModuleRequest vfModuleVNFAdapterRequest = mapper.deleteVfModuleRequestMapper( - requestContext, cloudRegion, serviceInstance, - vnf, vfModule); - - - String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json"))); - - ObjectMapper omapper = new ObjectMapper(); - DeleteVfModuleRequest reqMapper1 = omapper.readValue( - jsonToCompare, - DeleteVfModuleRequest.class); - - assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); - } -} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java new file mode 100644 index 0000000000..0c9e281fc7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -0,0 +1,773 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.adapter.vnf.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VnfAdapterVfModuleObjectMapperPayloadTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/"; + + private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper(); + private ObjectMapper omapper = new ObjectMapper(); + @Before + public void setUp() { + vfModuleObjectMapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + vfModuleObjectMapper.init(); + + } + @Test + public void createVfModuleRequestMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value2"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + HashMap<String, String> cloudParams = new HashMap<String, String>(); + cloudParams.put("key3", "value3"); + vfModule.setCloudParams(cloudParams); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext(null); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value2"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleAddonRequestMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value2"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + VfModule baseVfModule = new VfModule(); + baseVfModule.setVfModuleId("baseVfModuleId"); + baseVfModule.setHeatStackId("baseVfModuleStackId"); + ModelInfoVfModule baseModelInfoVfModule = new ModelInfoVfModule(); + baseModelInfoVfModule.setIsBaseBoolean(true); + baseVfModule.setModelInfoVfModule(baseModelInfoVfModule); + vnf.getVfModules().add(baseVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleAddonRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleWithVolumeGroupRequestMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value2"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setHeatStackId("volumeGroupStackId"); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithVolumeGroupRequest.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleWithSingleAvailabilityZoneRequestMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value2"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperWithCloudResourcesTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperDhcpDisabledTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperMultipleDhcpTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperWithNullUserParamsTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("requestId"); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestNoUserParams.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void DeleteVfModuleRequestMapperTest() throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + DeleteVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.deleteVfModuleRequestMapper( + requestContext, cloudRegion, serviceInstance, + vnf, vfModule); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json"))); + + DeleteVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + DeleteVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java index 0c4c8fc443..477be816aa 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java @@ -124,4 +124,17 @@ public class AAIVfModuleResourcesTest extends TestDataSetup{ aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, cloudRegion); verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); } + + @Test + public void updateHeatStackIdVfModuleTest() throws Exception { + vfModule.setHeatStackId("testHeatStackId"); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class)); + + aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class)); + + assertEquals("testHeatStackId", vfModule.getHeatStackId()); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java index de15e0a550..f60f29fa34 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java @@ -129,4 +129,17 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup{ verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); } + + @Test + public void updateHeatStackIdVolumeGroupTest() throws Exception { + volumeGroup.setHeatStackId("testVolumeHeatStackId"); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class)); + + assertEquals("testVolumeHeatStackId", volumeGroup.getHeatStackId()); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java index dfed3c8929..f7c12104cc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java @@ -33,13 +33,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; @@ -59,6 +60,7 @@ public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{ private ModelInfoServiceInstance modelInfoServiceInstance; private GenericVnf genericVnf; private VfModule vfModule; + private VolumeGroup volumeGroup; private ModelInfoVfModule modelInfoVfModule; private CloudRegion cloudRegion; private OrchestrationContext orchestrationContext; @@ -95,13 +97,30 @@ public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{ @Test public void test_createVfModule() throws Exception { doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertNotNull(createVfModuleRequest); + assertNotNull(actualCreateVfModuleRequest); + assertEquals(createVfModuleRequest, actualCreateVfModuleRequest); + } + + @Test + public void test_createVfModuleWithVolumeGroup() throws Exception { + volumeGroup = buildVolumeGroup(); + doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, - genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); assertNotNull(createVfModuleRequest); assertNotNull(actualCreateVfModuleRequest); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java new file mode 100644 index 0000000000..a564d8a21d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java @@ -0,0 +1,50 @@ +package org.onap.so.client.sdnc; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.util.Map; + +import javax.ws.rs.core.UriBuilder; + +import org.junit.Rule; +import org.junit.Test; +import org.springframework.core.ParameterizedTypeReference; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import wiremock.org.apache.http.entity.ContentType; +public class BaseClientTest { + + + @Rule + public WireMockRule wm = new WireMockRule(options().dynamicPort()); + + @Test + public void verifyString() { + BaseClient<String, String> client = new BaseClient<>(); + String response = "{\"hello\" : \"world\"}"; + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString()); + wm.stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + + String result = client.get("", new ParameterizedTypeReference<String>() {}); + assertThat(result, equalTo(response)); + } + + @Test + public void verifyMap() { + BaseClient<String, Map<String, Object>> client = new BaseClient<>(); + String response = "{\"hello\" : \"world\"}"; + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString()); + wm.stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + + Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {}); + assertThat("world", equalTo(result.get("hello"))); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java index 369a7321e2..b3999a788c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -100,6 +100,9 @@ public class VfModuleTopologyOperationRequestMapperTest { modelInfoVfModule.setModelUUID("vfModuleModelUuid"); modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); vfModule.setModelInfoVfModule(modelInfoVfModule); + HashMap<String, String> cloudParams = new HashMap<String, String>(); + userParams.put("key2", "value2"); + vfModule.setCloudParams(cloudParams); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("volumeGroupId"); diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json new file mode 100644 index 0000000000..a24f8bf125 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json @@ -0,0 +1,178 @@ +{ + "vf-module-assignments": { + "vms": { + "vm": [ + { + "vm-type": "vmType0", + "vm-names": { + "vm-name": [ + "vmName0", + "vmName1" + ], + "vnfc-names": [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": { + "vnfc-network-data": [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": { + "vnfc-port": [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": { + "network-information-item": [ + { + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + }, + { + "ip-version": "ipv6", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + } + ] + }, + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + "vm-networks": { + "vm-network": [ + { + "network-role": "vmNetworkRole0", + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + "sriov-parameters": { + "heat-vlan-filters": { + "heat-vlan-filter": [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + "network-information-items": { + "network-information-item": [ + { + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + }, + "ip-version": "ipv4" + }, + { + "network-ips": { + "network-ip": [ + "ip2", + "ip3" + ] + }, + "ip-version": "ipv6" + } + ] + } + } + ] + } + } + ] + } + }, + "vf-module-parameters": { + "param": [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json new file mode 100644 index 0000000000..eaedb92281 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json @@ -0,0 +1,179 @@ +{ + "vf-module-assignments": { + "vms": { + "vm": [ + { + "vm-type": "vmType0", + "vm-names": { + "vm-name": [ + "vmName0", + "vmName1" + ], + "vnfc-names": [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": { + "vnfc-network-data": [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": { + "vnfc-port": [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": { + "network-information-item": [ + { + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + }, + { + "ip-version": "ipv6", + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + } + } + ] + }, + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + "vm-networks": { + "vm-network": [ + { + "network-role": "vmNetworkRole0", + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + "sriov-parameters": { + "heat-vlan-filters": { + "heat-vlan-filter": [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + "network-information-items": { + "network-information-item": [ + { + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + }, + "ip-version": "ipv4" + }, + { + "network-ips": { + "network-ip": [ + "ip2", + "ip3" + ] + }, + "ip-version": "ipv6" + } + ] + } + } + ] + } + } + ] + } + }, + "vf-module-parameters": { + "param": [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + }, + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": { + "resource-key": [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + "status": "status", + "capability-name": "capabilityName" + } + } + ] + }, + "sdnc-generated-cloud-resources": "true" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json new file mode 100644 index 0000000000..39c6708631 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json @@ -0,0 +1,48 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled": "Y" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json new file mode 100644 index 0000000000..21ba0876f5 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json @@ -0,0 +1,48 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled": "N" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json new file mode 100644 index 0000000000..5062a06117 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json @@ -0,0 +1,68 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId1", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId2", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId3", + "dhcp-enabled": "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId4", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId5", + "dhcp-enabled": "Y" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json new file mode 100644 index 0000000000..fedee49609 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json @@ -0,0 +1,47 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone0", + "zone1", + "zone2" + ] + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "", + "sdnc-generated-cloud-resources": "true" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json new file mode 100644 index 0000000000..a6964a323f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json @@ -0,0 +1,44 @@ +{ + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": "zone0" + }, + "vnf-networks": { + "vnf-network": [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": { + "subnet-data": [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled": "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled": "Y" + } + ] + } + } + ] + } + }, + "vnf-parameters-data": { + "param": [ + { + "name": "key1", + "value": "value1" + } + ] + }, + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": {}, + "onap-model-information": {}, + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json new file mode 100644 index 0000000000..c4e7237511 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json @@ -0,0 +1,69 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "baseVfModuleId": "baseVfModuleId", + "baseVfModuleStackId": "baseVfModuleStackId", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value2", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json index a30ee59d5c..0132068fe4 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", @@ -37,7 +38,8 @@ "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", "workload_context": "workloadContext", - "key1": "value1", + "key1": "value2", + "key3": "value3", "availability_zone_0": "zone0", "availability_zone_1": "zone1", "availability_zone_2": "zone2", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json index 49a68b909a..90326e33eb 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json index a862051582..2f943a67bc 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json new file mode 100644 index 0000000000..4c50ad1187 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json @@ -0,0 +1,67 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value1", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json index 9c77f14f4b..d80c739916 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json @@ -1,6 +1,7 @@ { "cloudSiteId": "cloudRegionId", "tenantId": "tenantId", + "vnfId": "vnfId", "vnfType": "vnfType", "vfModuleId": "vfModuleId", "vfModuleName": "vfModuleName", diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json new file mode 100644 index 0000000000..293c6c21ed --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json @@ -0,0 +1,65 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value2", + "availability_zone_0": "zone0", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json new file mode 100644 index 0000000000..fd3b0a3d58 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json @@ -0,0 +1,67 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "", + "key1": "value2", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json new file mode 100644 index 0000000000..dff1ccf7b0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json @@ -0,0 +1,69 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "volumeGroupId": "volumeGroupId", + "volumeGroupStackId": "volumeGroupStackId", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value2", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json index 21e5bde3ec..21e5bde3ec 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterDeleteVfModuleRequest.json diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json index 4231152d86..50d5642fee 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json @@ -23,6 +23,10 @@ "value" : "value1" }, { + "name" : "key2", + "value" : "value2" + }, + { "name" : "volume-group-id", "value" : "volumeGroupId" } ] diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json deleted file mode 100644 index 1497286a1b..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "vf-module-assignments": - { - "vms": - { - "vm": - [ - { - "vm-type": "vmType0", - "vm-names": - { - "vm-name": - [ - "vmName0", - "vmName1" - ], - - "vnfc-names": - [ - { - "vnfc-name": "vnfcName0", - "vnfc-networks": - { - "vnfc-network-data": - [ - { - "vnfc-network-role": "vnfcNetworkRole0", - "vnfc-type": "fw", - "vnfc-ports": - { - "vnfc-port": - [ - { - "vnfc-port-id": "01", - "common-sub-interface-role": "ctrl", - "vnic-sub-interfaces": - { - "sub-interface-network-data": - [ - { - "network-id": "networkId0", - "network-name": 1, - "vlan-tag-id": 1, - "network-information-items": - { - "network-information-item": - [ - { - "ip-version": "ipv4", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - }, - - { - "ip-version": "ipv6", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - } - ] - }, - - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - } - } - ] - } - } - ] - } - } - ] - } - } - ] - }, - - "vm-networks": - { - "vm-network": - [ - { - "network-role": "vmNetworkRole0", - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - }, - - "interface-route-prefixes": - { - "interface-route-prefix": - [ - "interfaceRoutePrefix0", - "interfaceRoutePrefix1" - ] - }, - - "sriov-parameters": - { - "heat-vlan-filters": - { - "heat-vlan-filter": - [ - "heatVlanFilter0", - "heatVlanFilter1" - ] - } - }, - - "network-information-items": - { - "network-information-item": - [ - { - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - }, - - "ip-version": "ipv4" - }, - - { - "network-ips": - { - "network-ip": - [ - "ip2", - "ip3" - ] - }, - - "ip-version": "ipv6" - } - ] - } - } - ] - } - } - ] - } - }, - - "vf-module-parameters": - { - "param": - [ - { - "name": "paramOne", - "value": "paramOneValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramTwo", - "value": "paramTwoValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramThree", - "value": "paramThreeValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - } - ] - } -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json deleted file mode 100644 index 2a8acb927e..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "vf-module-assignments": - { - "vms": - { - "vm": - [ - { - "vm-type": "vmType0", - "vm-names": - { - "vm-name": - [ - "vmName0", - "vmName1" - ], - - "vnfc-names": - [ - { - "vnfc-name": "vnfcName0", - "vnfc-networks": - { - "vnfc-network-data": - [ - { - "vnfc-network-role": "vnfcNetworkRole0", - "vnfc-type": "fw", - "vnfc-ports": - { - "vnfc-port": - [ - { - "vnfc-port-id": "01", - "common-sub-interface-role": "ctrl", - "vnic-sub-interfaces": - { - "sub-interface-network-data": - [ - { - "network-id": "networkId0", - "network-name": 1, - "vlan-tag-id": 1, - "network-information-items": - { - "network-information-item": - [ - { - "ip-version": "ipv4", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - }, - - { - "ip-version": "ipv6", - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - } - } - ] - }, - - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - } - } - ] - } - } - ] - } - } - ] - } - } - ] - }, - - "vm-networks": - { - "vm-network": - [ - { - "network-role": "vmNetworkRole0", - "floating-ips": - { - "floating-ip-v4": - [ - "floatingIpV40", - "floatingIpV41" - ], - - "floating-ip-v6": - [ - "floatingIpV60", - "floatingIpV61" - ] - }, - - "interface-route-prefixes": - { - "interface-route-prefix": - [ - "interfaceRoutePrefix0", - "interfaceRoutePrefix1" - ] - }, - - "sriov-parameters": - { - "heat-vlan-filters": - { - "heat-vlan-filter": - [ - "heatVlanFilter0", - "heatVlanFilter1" - ] - } - }, - - "network-information-items": - { - "network-information-item": - [ - { - "network-ips": - { - "network-ip": - [ - "ip0", - "ip1" - ] - }, - - "ip-version": "ipv4" - }, - - { - "network-ips": - { - "network-ip": - [ - "ip2", - "ip3" - ] - }, - - "ip-version": "ipv6" - } - ] - } - } - ] - } - } - ] - } - }, - - "vf-module-parameters": - { - "param": - [ - { - "name": "paramOne", - "value": "paramOneValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramTwo", - "value": "paramTwoValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - }, - - { - "name": "paramThree", - "value": "paramThreeValue", - "resource-resolution-data": - { - "resource-key": - [ - { - "name": "resourceKeyName", - "value": "resourceKeyValue" - } - ], - - "status": "status", - "capability-name": "capabilityName" - } - } - ] - }, - - "sdnc-generated-cloud-resources": "true" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json deleted file mode 100644 index 2c7728397f..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId1", - "dhcp-enabled" : "Y" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json deleted file mode 100644 index a302777810..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0", - "dhcp-enabled" : "N" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId1", - "dhcp-enabled" : "N" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json deleted file mode 100644 index 67c095a217..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv4", - "subnet-id": "subnetId1", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv4", - "subnet-id": "subnetId2", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId3", - "dhcp-enabled" : "N" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId4", - "dhcp-enabled" : "Y" - }, - { - "ip-version": "ipv6", - "subnet-id": "subnetId5", - "dhcp-enabled" : "Y" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "" -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json deleted file mode 100644 index 0047764713..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "vnf-resource-assignments": - { - "availability-zones": - { - "availability-zone": - [ - "zone0", - "zone1", - "zone2" - ] - }, - - "vnf-networks": - { - "vnf-network": - [ - { - "network-role": "vnfNetworkRole0", - "neutron-id": "neutronId0", - "network-name": "netName0", - "contrail-network-fqdn": "netFqdnValue0", - "subnets-data": - { - "subnet-data": - [ - { - "ip-version": "ipv4", - "subnet-id": "subnetId0" - }, - - { - "ip-version": "ipv6", - "subnet-id": "subnetId1" - } - ] - } - } - ] - } - }, - - "vnf-parameters-data": - { - "param": - [ - { - "name": "key1", - "value": "value1" - } - ] - }, - - "aic-clli": "", - "tenant": "", - "vnf-topology-identifier-structure": - { - - }, - - "onap-model-information": - { - - }, - - "aic-cloud-region": "", - - "sdnc-generated-cloud-resources": "true" -}
\ No newline at end of file diff --git a/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java b/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java new file mode 100644 index 0000000000..bfe7f164b2 --- /dev/null +++ b/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.cloudify.connector.http; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.client.methods.HttpOptions; +import org.apache.http.client.methods.HttpPatch; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpTrace; +import org.junit.Test; + +public class HttpClientRedirectStrategyTest { + + private HttpClientRedirectStrategy httpClientRedirectStrategy = new HttpClientRedirectStrategy(); + + @Test + public void isRedirectable_shouldReturnFalse_forNonRedirectableHttpMethods() { + assertThat(httpClientRedirectStrategy.isRedirectable(HttpPost.METHOD_NAME)).isFalse(); + assertThat(httpClientRedirectStrategy.isRedirectable(HttpPatch.METHOD_NAME)).isFalse(); + assertThat(httpClientRedirectStrategy.isRedirectable(HttpPut.METHOD_NAME)).isFalse(); + assertThat(httpClientRedirectStrategy.isRedirectable(HttpOptions.METHOD_NAME)).isFalse(); + assertThat(httpClientRedirectStrategy.isRedirectable(HttpTrace.METHOD_NAME)).isFalse(); + } + + @Test + public void isRedirectable_shouldReturnTrue_forRedirectableHttpMethods() { + assertThat(httpClientRedirectStrategy.isRedirectable(HttpGet.METHOD_NAME)).isTrue(); + assertThat(httpClientRedirectStrategy.isRedirectable(HttpDelete.METHOD_NAME)).isTrue(); + assertThat(httpClientRedirectStrategy.isRedirectable(HttpHead.METHOD_NAME)).isTrue(); + } +}
\ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml index 8a5f5a2e37..0f1070309a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -133,22 +133,11 @@ <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-ext</artifactId> - <version>1.7.25</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <version>1.2.3</version> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - <version>1.2.3</version> </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - </dependency> <dependency> <groupId>janino</groupId> diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java index 461bb5832c..8eaeee97ee 100644 --- a/common/src/main/java/org/onap/so/client/RestClientSSL.java +++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java @@ -72,23 +72,15 @@ public abstract class RestClientSSL extends RestClient { private KeyStore getKeyStore() { KeyStore ks = null; char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray(); - FileInputStream fis = null; - try { + try(FileInputStream fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY))) { ks = KeyStore.getInstance(KeyStore.getDefaultType()); - fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)); + ks.load(fis, password); } catch(Exception e) { return null; } - finally { - if (fis != null) { - try { - fis.close(); - } - catch(Exception e) {} - } - } + return ks; } } diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java index 25bf54b643..985d7cc885 100644 --- a/common/src/main/java/org/onap/so/client/RestRequest.java +++ b/common/src/main/java/org/onap/so/client/RestRequest.java @@ -72,17 +72,13 @@ public class RestRequest implements Callable<Response> { try { mapper.get().map(response); } catch (NotFoundException e) { - if (this.client.props.mapNotFoundToEmpty()) { + if (this.client.props.mapNotFoundToEmpty() && "GET".equals(method)) { msoLogger.error(e); return response; } else { throw e; } } - } else { - if (response.getStatus() == Status.NOT_FOUND.getStatusCode() && this.client.props.mapNotFoundToEmpty()) { - return response; - } } return response; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java index 39843b2263..3d2410e2a2 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java @@ -22,11 +22,13 @@ package org.onap.so.client.aai; import java.net.URI; +import javax.ws.rs.NotFoundException; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.RestClient; import org.onap.so.client.graphinventory.GraphInventoryClient; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; +import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +51,12 @@ public abstract class AAIClient extends GraphInventoryClient { } @Override protected RestClient createClient(GraphInventoryUri uri) { - return new AAIRestClient(getRestProperties(), constructPath(uri)); + try { + return new AAIRestClient(getRestProperties(), constructPath(uri)); + } catch (GraphInventoryUriComputationException | NotFoundException e) { + logger.debug("failed to construct A&AI uri", e); + throw e; + } } protected AAIVersion getVersion() { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java index 04757c6fc2..072534d6f6 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java @@ -32,6 +32,7 @@ import javax.ws.rs.core.Response.Status; import org.onap.aai.domain.yang.Relationship; import org.onap.so.client.RestClient; import org.onap.so.client.RestProperties; +import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUri; @@ -81,9 +82,13 @@ public class AAIResourcesClient extends AAIClient { */ public boolean exists(AAIResourceUri uri) { AAIUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri); - RestClient aaiRC = this.createClient(forceMinimal); - - return aaiRC.get().getStatus() == Status.OK.getStatusCode(); + try { + RestClient aaiRC = this.createClient(forceMinimal); + + return aaiRC.get().getStatus() == Status.OK.getStatusCode(); + } catch (NotFoundException e) { + return false; + } } /** @@ -100,6 +105,21 @@ public class AAIResourcesClient extends AAIClient { } /** + * Adds a relationship between two objects in A&AI + * with a given edge label + * @param uriA + * @param uriB + * @param edge label + * @return + */ + public void connect(AAIResourceUri uriA, AAIResourceUri uriB, AAIEdgeLabel label) { + AAIResourceUri uriAClone = uriA.clone(); + RestClient aaiRC = this.createClient(uriAClone.relationshipAPI()); + aaiRC.put(this.buildRelationship(uriB, label)); + return; + } + + /** * Removes relationship from two objects in A&AI * * @param uriA @@ -148,7 +168,15 @@ public class AAIResourcesClient extends AAIClient { * @return */ public <T> Optional<T> get(Class<T> clazz, AAIResourceUri uri) { - return this.createClient(uri).get(clazz); + try { + return this.createClient(uri).get(clazz); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return Optional.empty(); + } else { + throw e; + } + } } /** @@ -157,7 +185,15 @@ public class AAIResourcesClient extends AAIClient { * @return */ public Response getFullResponse(AAIResourceUri uri) { - return this.createClient(uri).get(); + try { + return this.createClient(uri).get(); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return e.getResponse(); + } else { + throw e; + } + } } /** @@ -167,7 +203,15 @@ public class AAIResourcesClient extends AAIClient { * @return */ public <T> Optional<T> get(GenericType<T> resultClass, AAIResourceUri uri) { - return this.createClient(uri).get(resultClass); + try { + return this.createClient(uri).get(resultClass); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return Optional.empty(); + } else { + throw e; + } + } } /** @@ -177,7 +221,16 @@ public class AAIResourcesClient extends AAIClient { * @return */ public AAIResultWrapper get(AAIResourceUri uri) { - String json = this.createClient(uri).get(String.class).orElse(null); + String json; + try { + json = this.createClient(uri).get(String.class).orElse(null); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + json = null; + } else { + throw e; + } + } return new AAIResultWrapper(json); } @@ -189,22 +242,42 @@ public class AAIResourcesClient extends AAIClient { * @return */ public AAIResultWrapper get(AAIResourceUri uri, Class<? extends RuntimeException> c) { - + String json; + try { + json = this.createClient(uri).get(String.class) + .orElseThrow(() -> createException(c, uri.build() + " not found in A&AI")); + } catch (NotFoundException e) { + throw createException(c, "could not construct uri for use with A&AI"); + } + + return new AAIResultWrapper(json); + } + + private RuntimeException createException(Class<? extends RuntimeException> c, String message) { RuntimeException e; try { - e = c.getConstructor(String.class).newInstance(uri.build() + " not found in A&AI"); + e = c.getConstructor(String.class).newInstance(message); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e1) { throw new IllegalArgumentException("could not create instance for " + c.getName()); } - String json = this.createClient(uri).get(String.class) - .orElseThrow(() -> e); - return new AAIResultWrapper(json); + + return e; } private Relationship buildRelationship(AAIResourceUri uri) { + return buildRelationship(uri, Optional.empty()); + } + + private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) { + return buildRelationship(uri, Optional.of(label)); + } + private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) { final Relationship result = new Relationship(); result.setRelatedLink(uri.build().toString()); + if (label.isPresent()) { + result.setRelationshipLabel(label.toString()); + } return result; } @@ -248,7 +321,7 @@ public class AAIResourcesClient extends AAIClient { return clone; } @Override - protected <T extends RestProperties> T getRestProperties() { + public <T extends RestProperties> T getRestProperties() { return super.getRestProperties(); } } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java new file mode 100644 index 0000000000..0356e86861 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java @@ -0,0 +1,21 @@ +package org.onap.so.client.aai.entities; + +import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; + +public enum AAIEdgeLabel implements GraphInventoryEdgeLabel { + + BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), + USES("org.onap.relationships.inventory.Uses"); + + + private final String label; + private AAIEdgeLabel(String label) { + this.label = label; + } + + + @Override + public String toString() { + return this.label; + } +} diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java index 093918d49b..a132e15d1f 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java @@ -22,19 +22,19 @@ package org.onap.so.client.aai.entities.uri; import java.io.IOException; import java.net.URI; -import java.util.Collections; +import java.util.Arrays; import java.util.Map; import java.util.Optional; import javax.ws.rs.BadRequestException; +import javax.ws.rs.NotFoundException; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIQueryClient; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.aai.entities.CustomQuery; +import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.graphinventory.entities.uri.SimpleUri; +import org.onap.so.client.graphinventory.Format; +import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; @@ -42,7 +42,7 @@ import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundExc import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -public class ServiceInstanceUri extends AAISimpleUri { +public class ServiceInstanceUri extends AAISimpleUri implements HttpAwareUri { private Optional<String> cachedValue = Optional.empty(); @@ -55,11 +55,10 @@ public class ServiceInstanceUri extends AAISimpleUri { } protected String getSerivceInstance(Object id) throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { if (!this.getCachedValue().isPresent()) { - AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, id); - CustomQuery query = new CustomQuery(Collections.singletonList(serviceInstanceUri)); + AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, id).format(Format.PATHED); String resultJson; try { - resultJson = this.getQueryClient().query(Format.PATHED, query); + resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson(); } catch (BadRequestException e) { throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build()); @@ -99,7 +98,7 @@ public class ServiceInstanceUri extends AAISimpleUri { protected Optional<String> getCachedValue() { return this.cachedValue; } - + @Override public URI build() { try { @@ -119,8 +118,11 @@ public class ServiceInstanceUri extends AAISimpleUri { return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values); } - protected AAIQueryClient getQueryClient() { - AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.ALLOTTED_RESOURCE, "").clone(); - return new AAIQueryClient(); + public AAIResourcesClient getResourcesClient() { + return new AAIResourcesClient(); + } + @Override + public URI buildNoNetwork() { + return super.build(new String[]{"NONE", "NONE", (String)this.values[0]}); } } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java new file mode 100644 index 0000000000..1ede2f9e1b --- /dev/null +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java @@ -0,0 +1,8 @@ +package org.onap.so.client.graphinventory.entities; + +public interface GraphInventoryEdgeLabel { + + + @Override + public String toString(); +} diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java new file mode 100644 index 0000000000..145959dc73 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java @@ -0,0 +1,9 @@ +package org.onap.so.client.graphinventory.entities.uri; + +import java.net.URI; + +public interface HttpAwareUri { + + + public URI buildNoNetwork(); +} diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java index 10f572e772..e4cac067ba 100644 --- a/common/src/main/java/org/onap/so/logger/MsoLogger.java +++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java @@ -35,6 +35,8 @@ import org.onap.so.entity.MsoRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; /** @@ -49,15 +51,23 @@ import org.slf4j.MDC; */ public class MsoLogger { - // MDC parameters - public static final String REQUEST_ID = "RequestId"; - public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; + // Required MDC parameters + public static final String REQUEST_ID = "RequestID"; + public static final String INVOCATION_ID = "InvocationID"; + public static final String INSTANCE_UUID = "InstanceUUID"; public static final String SERVICE_NAME = "ServiceName"; + public static final String STATUSCODE = "StatusCode"; + public static final String RESPONSECODE = "ResponseCode"; + public static final String RESPONSEDESC = "ResponseDesc"; + public static final String FQDN = "ServerFQDN"; + + + public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; + public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName"; - public static final String INSTANCE_UUID = "InstanceUUID"; public static final String SERVER_IP = "ServerIPAddress"; - public static final String FQDN = "ServerFQDN"; + public static final String REMOTE_HOST = "RemoteHost"; public static final String ALERT_SEVERITY = "AlertSeverity"; public static final String TIMER = "Timer"; @@ -73,16 +83,17 @@ public class MsoLogger { public static final String HEADER_REQUEST_ID = "X-RequestId"; public static final String TRANSACTION_ID = "X-TransactionID"; public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; + public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; + public static final String CLIENT_ID = "X-ClientID"; + public static final String INVOCATION_ID_HEADER = "X-InvocationID"; // Audit/Metric log specific public static final String BEGINTIME = "BeginTimestamp"; public static final String STARTTIME = "StartTimeMilis"; public static final String ENDTIME = "EndTimestamp"; public static final String PARTNERNAME = "PartnerName"; - public static final String STATUSCODE = "StatusCode"; - public static final String RESPONSECODE = "ResponseCode"; - public static final String RESPONSEDESC = "ResponseDesc"; + // Metric log specific @@ -103,8 +114,10 @@ public class MsoLogger { public static final String ERRORCODE = "ErrorCode"; public static final String ERRORDESC = "ErrorDesc"; + //Status Codes public static final String COMPLETE = "COMPLETE"; - + public static final String INPROGRESS = "INPROGRESS"; + public enum Catalog { APIH, BPEL, RA, ASDC, GENERAL } @@ -157,6 +170,9 @@ public class MsoLogger { this.value = value; } } + + public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY"); + public static final Marker EXIT = MarkerFactory.getMarker("EXIT"); private Logger logger; private Logger metricsLogger; diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java index 9fab4ff0df..d278a5f761 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java @@ -44,137 +44,152 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; - import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import com.fasterxml.jackson.databind.ObjectMapper; @Priority(1) @Provider @Component public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter { - - private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsFilterLogging.class); - - @Context - private HttpServletRequest httpServletRequest; - - @Context - private Providers providers; - - @Autowired - ObjectMapper objectMapper; - - @Override - public void filter(ContainerRequestContext containerRequest) { - - try { - String clientID = null; - //check headers for request id - MultivaluedMap<String, String> headers = containerRequest.getHeaders(); - String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID ); - if(requestId == null || requestId.isEmpty()){ - if(headers.containsKey(MsoLogger.TRANSACTION_ID)){ - requestId = headers.getFirst(MsoLogger.TRANSACTION_ID); - }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){ - requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID); - }else{ - requestId = UUID.randomUUID().toString(); - logger.warnSimple(containerRequest.getUriInfo().getPath(),"Generating RequestId for Request"); - } - } - containerRequest.setProperty("requestId", requestId); - if(headers.containsKey(MsoLogger.CLIENT_ID)){ - clientID = headers.getFirst(MsoLogger.CLIENT_ID); - }else{ - clientID = "UNKNOWN"; - headers.add(MsoLogger.CLIENT_ID, clientID); - } - String remoteIpAddress = ""; - if (httpServletRequest != null) { - remoteIpAddress = httpServletRequest.getRemoteAddr(); - } - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - - String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID ); - if(partnerName == null || partnerName.isEmpty()) - partnerName="UNKNOWN"; - - MDC.put(MsoLogger.FROM_APP_ID,partnerName); - MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath()); - MDC.put(MsoLogger.BEGINTIME, formatter.format(instant)); - MDC.put(MsoLogger.REQUEST_ID,requestId); - MDC.put(MsoLogger.PARTNERNAME,partnerName); - MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress)); - MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis())); - MDC.put(MsoLogger.CLIENT_ID, clientID); - } catch (Exception e) { - logger.warnSimple("Error in incoming JAX-RS Inteceptor", e); - } - } - - - @Override - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { - try { - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - String startTime= MDC.get(MsoLogger.STARTTIME); - long elapsedTime; - try { - elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime); - }catch(NumberFormatException e){ - elapsedTime = 0; - } - String statusCode; - if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ - statusCode=MsoLogger.COMPLETE; - }else{ - statusCode= MsoLogger.StatusCode.ERROR.toString(); - } - - MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext)); - MDC.put(MsoLogger.STATUSCODE, statusCode); - MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus())); - MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime)); - MDC.put(MsoLogger.ENDTIME,formatter.format(instant)); - logger.recordAuditEvent(); - } catch ( Exception e) { - logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e); - } - } - - private String payloadMessage(ContainerResponseContext responseContext) throws IOException { - String message = new String(); - if (responseContext.hasEntity()) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Class<?> entityClass = responseContext.getEntityClass(); - Type entityType = responseContext.getEntityType(); - Annotation[] entityAnnotations = responseContext.getEntityAnnotations(); - MediaType mediaType = responseContext.getMediaType(); - @SuppressWarnings("unchecked") - MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass, - entityType, - entityAnnotations, - mediaType); - bodyWriter.writeTo(responseContext.getEntity(), - entityClass, - entityType, - entityAnnotations, - mediaType, - responseContext.getHeaders(), - baos); - message = message.concat(new String(baos.toByteArray())); - } - return message; - } + + protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class); + + @Context + private HttpServletRequest httpServletRequest; + + @Context + private Providers providers; + + @Autowired + ObjectMapper objectMapper; + + @Override + public void filter(ContainerRequestContext containerRequest) { + + try { + String clientID = null; + //check headers for request id + MultivaluedMap<String, String> headers = containerRequest.getHeaders(); + String requestId = findRequestId(headers); + containerRequest.setProperty("requestId", requestId); + if(headers.containsKey(MsoLogger.CLIENT_ID)){ + clientID = headers.getFirst(MsoLogger.CLIENT_ID); + }else{ + clientID = "UNKNOWN"; + headers.add(MsoLogger.CLIENT_ID, clientID); + } + + String remoteIpAddress = ""; + if (httpServletRequest != null) { + remoteIpAddress = httpServletRequest.getRemoteAddr(); + } + Instant instant = Instant.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) + .withLocale( Locale.US ) + .withZone( ZoneId.systemDefault() ); + + String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID ); + if(partnerName == null || partnerName.isEmpty()) + partnerName="UNKNOWN"; + + MDC.put(MsoLogger.REQUEST_ID,requestId); + MDC.put(MsoLogger.INVOCATION_ID,requestId); + MDC.put(MsoLogger.FROM_APP_ID,partnerName); + MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath()); + MDC.put(MsoLogger.INVOCATION_ID, findInvocationId(headers)); + MDC.put(MsoLogger.STATUSCODE, MsoLogger.INPROGRESS); + MDC.put(MsoLogger.BEGINTIME, formatter.format(instant)); + MDC.put(MsoLogger.PARTNERNAME,partnerName); + MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress)); + MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis())); + logger.debug(MsoLogger.ENTRY, "Entering."); + } catch (Exception e) { + logger.warn("Error in incoming JAX-RS Inteceptor", e); + } + } + + + private String findRequestId(MultivaluedMap<String, String> headers) { + String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID ); + if(requestId == null || requestId.isEmpty()){ + if(headers.containsKey(MsoLogger.ONAP_REQUEST_ID)){ + requestId = headers.getFirst(MsoLogger.ONAP_REQUEST_ID); + }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){ + requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID); + }else{ + requestId = UUID.randomUUID().toString(); + } + } + return requestId; + } + + private String findInvocationId(MultivaluedMap<String, String> headers) { + String invocationId = (String) headers.getFirst(MsoLogger.INVOCATION_ID_HEADER ); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + return invocationId; + } + + @Override + public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) + throws IOException { + try { + Instant instant = Instant.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) + .withLocale( Locale.US ) + .withZone( ZoneId.systemDefault() ); + String startTime= MDC.get(MsoLogger.STARTTIME); + long elapsedTime; + try { + elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime); + }catch(NumberFormatException e){ + elapsedTime = 0; + } + String statusCode; + if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=MsoLogger.COMPLETE; + }else{ + statusCode= MsoLogger.StatusCode.ERROR.toString(); + } + + MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext)); + MDC.put(MsoLogger.STATUSCODE, statusCode); + MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus())); + MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime)); + MDC.put(MsoLogger.ENDTIME,formatter.format(instant)); + logger.debug(MsoLogger.EXIT, "Exiting."); + } catch ( Exception e) { + logger.warn("Error in outgoing JAX-RS Inteceptor", e); + } + } + + private String payloadMessage(ContainerResponseContext responseContext) throws IOException { + String message = new String(); + if (responseContext.hasEntity()) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Class<?> entityClass = responseContext.getEntityClass(); + Type entityType = responseContext.getEntityType(); + Annotation[] entityAnnotations = responseContext.getEntityAnnotations(); + MediaType mediaType = responseContext.getMediaType(); + @SuppressWarnings("unchecked") + MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass, + entityType, + entityAnnotations, + mediaType); + bodyWriter.writeTo(responseContext.getEntity(), + entityClass, + entityType, + entityAnnotations, + mediaType, + responseContext.getHeaders(), + baos); + message = message.concat(new String(baos.toByteArray())); + } + return message; + } } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java index d71334288e..0364043e8e 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java @@ -58,6 +58,8 @@ public class RequestDetails implements Serializable { protected LineOfBusiness lineOfBusiness; @JsonProperty("instanceName") private List<Map<String, String>> instanceName = new ArrayList<>(); + @JsonProperty("configurationParameters") + protected List<Map<String, String>> configurationParameters = new ArrayList<>(); /** @@ -290,14 +292,20 @@ public class RequestDetails implements Serializable { public void setInstanceName(List<Map<String, String>> instanceName) { this.instanceName = instanceName; } + public List<Map<String, String>> getConfigurationParameters() { + return configurationParameters; + } + + public void setConfigurationParameters(List<Map<String, String>> configurationParameters) { + this.configurationParameters = configurationParameters; + } + @Override public String toString() { - return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo=" - + requestInfo + ", relatedInstanceList=" - + Arrays.toString(relatedInstanceList) + ", subscriberInfo=" - + subscriberInfo + ", cloudConfiguration=" + cloudConfiguration - + ", requestParameters=" + requestParameters + ", platform=" + platform - + ", lineOfBusiness=" + ", project=" + project + ", owningEntity=" + owningEntity - + ", instanceName" + instanceName + "]"; + return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo=" + requestInfo + ", relatedInstanceList=" + + Arrays.toString(relatedInstanceList) + ", subscriberInfo=" + subscriberInfo + ", cloudConfiguration=" + + cloudConfiguration + ", requestParameters=" + requestParameters + ", project=" + project + + ", owningEntity=" + owningEntity + ", platform=" + platform + ", lineOfBusiness=" + lineOfBusiness + + ", instanceName=" + instanceName + ", configurationParameters=" + configurationParameters + "]"; } } diff --git a/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java index 15368f9966..587e4841d7 100644 --- a/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java +++ b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java @@ -78,6 +78,8 @@ public class CryptoTest { encodeString = CryptoUtils.encryptCloudConfigPassword(testData); assertEquals(testData, CryptoUtils.decryptCloudConfigPassword(encodeString)); + + System.out.println(CryptoUtils.encrypt("poBpmn:password1$", "aa3871669d893c7fb8abbcda31b88b4f")); } } diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java new file mode 100644 index 0000000000..efd60a36a8 --- /dev/null +++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java @@ -0,0 +1,99 @@ +package org.onap.so.client.aai; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; + +import java.util.List; +import java.util.Optional; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.entities.uri.ServiceInstanceUri; +import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +public class AAIResourcesClientWithServiceInstanceUriTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443)); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private ServiceInstanceUri uri; + @Before + public void setUp() { + wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "application/json") + .withHeader("Mock", "true"))); + + uri = spy((ServiceInstanceUri)AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "id")); + doReturn(createClient()).when(uri).getResourcesClient(); + } + + @Test + public void getWithClass() { + AAIResourcesClient client = createClient(); + Optional<String> result = client.get(String.class, uri); + + assertThat(result.isPresent(), equalTo(false)); + } + + @Test + public void getFullResponse() { + AAIResourcesClient client = createClient(); + Response result = client.getFullResponse(uri); + assertThat(result.getStatus(), equalTo(Status.NOT_FOUND.getStatusCode())); + } + + @Test + public void getWithGenericType() { + AAIResourcesClient client = createClient(); + Optional<List<String>> result = client.get(new GenericType<List<String>>() {}, uri); + assertThat(result.isPresent(), equalTo(false)); + } + + @Test + public void getAAIWrapper() { + AAIResourcesClient client = createClient(); + AAIResultWrapper result = client.get(uri); + assertThat(result.isEmpty(), equalTo(true)); + } + + @Test + public void getWithException() { + AAIResourcesClient client = createClient(); + this.thrown.expect(IllegalArgumentException.class); + AAIResultWrapper result = client.get(uri, IllegalArgumentException.class); + } + + @Test + public void existsTest() { + AAIResourcesClient client = createClient(); + doReturn(uri).when(uri).clone(); + boolean result = client.exists(uri); + assertThat(result, equalTo(false)); + } + private AAIResourcesClient createClient() { + AAIResourcesClient client = spy(new AAIResourcesClient()); + doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties(); + return client; + } +} diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java index 73720f55c2..2cd7848cfa 100644 --- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java +++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java @@ -21,10 +21,9 @@ package org.onap.so.client.aai.entities.uri; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; @@ -43,14 +42,16 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Optional; +import javax.ws.rs.NotFoundException; import javax.ws.rs.core.UriBuilder; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.onap.so.client.aai.AAIQueryClient; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.aai.entities.CustomQuery; +import org.mockito.Matchers; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; @@ -155,9 +156,11 @@ public class ServiceInstanceUriTest { ServiceInstanceUri instance = new ServiceInstanceUri("key3"); ServiceInstanceUri spy = spy(instance); - AAIQueryClient mockQueryClient = mock(AAIQueryClient.class); - when(mockQueryClient.query(any(Format.class), any(CustomQuery.class))).thenReturn(content); - when(spy.getQueryClient()).thenReturn(mockQueryClient); + AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); + AAIResultWrapper wrapper = mock(AAIResultWrapper.class); + when(mockResourcesClient.get(Matchers.<AAIResourceUri>any(AAIResourceUri.class), Matchers.<Class<NotFoundException>>any())).thenReturn(wrapper); + when(wrapper.getJson()).thenReturn(content); + when(spy.getResourcesClient()).thenReturn(mockResourcesClient); exception.expect(GraphInventoryUriComputationException.class); spy.build(); @@ -176,17 +179,24 @@ public class ServiceInstanceUriTest { public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { ServiceInstanceUri instance = new ServiceInstanceUri("key3"); ServiceInstanceUri spy = spy(instance); - AAIQueryClient client = mock(AAIQueryClient.class); - when(client.query(any(Format.class), any(CustomQuery.class))).thenReturn("{\"results\":[]}"); - doReturn(client).when(spy).getQueryClient(); - stubFor(put(urlMatching("/aai/v[0-9]+/query.*")) - .withRequestBody(containing("key3")) + AAIResourcesClient client = createClient(); + doReturn(client).when(spy).getResourcesClient(); + /*AAIResultWrapper wrapper = mock(AAIResultWrapper.class); + when(client.get(Matchers.<AAIResourceUri>any(AAIResourceUri.class), Matchers.<Class<NotFoundException>>any())).thenReturn(wrapper); + when(wrapper.getJson()).thenReturn("{\"results\":[]}"); + doReturn(client).when(spy).getResourcesClient();*/ + stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")) .willReturn(aResponse() - .withStatus(400) + .withStatus(404) .withHeader("Content-Type", "application/json") .withBodyFile(""))); - exception.expect(GraphInventoryUriComputationException.class); - exception.expectMessage(containsString("NotFoundException")); + exception.expect(NotFoundException.class); spy.build(); } + + private AAIResourcesClient createClient() { + AAIResourcesClient client = spy(new AAIResourcesClient()); + doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties(); + return client; + } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java index d5540ddbaa..400ce567ba 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java @@ -45,8 +45,6 @@ public final class CommonConstants { public static final String CAMUNDA_AUTH = "mso.camundaAuth"; public static final String BPEL_SEARCH_STR = "active-bpel"; public static final String TASK_SEARCH_STR = "task"; - public static final String BPEL_URL = "bpelURL"; - public static final String BPEL_AUTH = "bpelAuth"; public static final int BPEL = 0; public static final int CAMUNDA = 1; public static final int CAMUNDATASK = 2; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java index fc6da3fa7d..0cac7db404 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java @@ -89,7 +89,7 @@ public class ResponseHandler { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); - ValidateException validateException = new ValidateException.Builder("JSON Object Mapping Request", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) + ValidateException validateException = new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); throw validateException; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index e0bcc71736..0e581cb48a 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -63,7 +63,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { errorText = errorText.substring(0, 1999); } - writeErrorLog(errorText, errorLoggerInfo, alarmLoggerInfo); + writeErrorLog(exception, errorText, errorLoggerInfo, alarmLoggerInfo); return buildServiceErrorResponse(errorText,messageId,variables); @@ -96,8 +96,9 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { return requestErrorStr; } - protected void writeErrorLog(String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { - + protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { + if( e!= null) + logger.error(e); if(errorLogInfo != null) logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText); if(alarmLogInfo != null){ diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java index 7bb054c297..117c8a2c27 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java @@ -96,7 +96,7 @@ public class ResponseHandlerTest{ @Test public void tesMappingErrorResponse () throws ApiException { thrown.expect(ValidateException.class); - thrown.expectMessage(startsWith("JSON Object Mapping Request")); + thrown.expectMessage(startsWith("Cannot parse Camunda Response")); thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST))); thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java index 3eee14e3bf..5b08cc1b17 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java @@ -42,5 +42,6 @@ public enum Action implements Actions{ unassignInstance, compareModel, scaleInstance, - deactivateAndCloudDelete + deactivateAndCloudDelete, + scaleOut } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index ee50d920fe..e8a6beb278 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -56,10 +56,8 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; -import org.onap.so.db.catalog.data.repository.ServiceRecipeRepository; -import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoAlarmLogger; import org.onap.so.logger.MsoLogger; @@ -84,14 +82,12 @@ import com.wordnik.swagger.annotations.ApiOperation; public class E2EServiceInstances { private HashMap<String, String> instanceIdMap = new HashMap<>(); - private static MsoLogger msoLogger = MsoLogger + private static final MsoLogger msoLogger = MsoLogger .getMsoLogger(MsoLogger.Catalog.APIH, E2EServiceInstances.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: "; - public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB"; - public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine"; + private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: "; @Autowired private MsoRequest msoRequest; @@ -100,13 +96,10 @@ public class E2EServiceInstances { private RequestClientFactory requestClientFactory; @Autowired - private OperationStatusRepository osRepo; + private RequestsDbClient requestsDbClient; @Autowired - private ServiceRepository serviceRepo; - - @Autowired - private ServiceRecipeRepository sRecipeRepo; + private CatalogDbClient catalogDbClient; @Autowired private ResponseBuilder builder; @@ -224,7 +217,7 @@ public class E2EServiceInstances { long startTime = System.currentTimeMillis(); msoLogger.debug("requestId is: " + requestId); - CompareModelsRequest e2eCompareModelReq = null; + CompareModelsRequest e2eCompareModelReq; ObjectMapper mapper = new ObjectMapper(); try { @@ -256,8 +249,8 @@ public class E2EServiceInstances { String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance"; int recipeTimeout = 180; - RequestClient requestClient = null; - HttpResponse response = null; + RequestClient requestClient; + HttpResponse response; long subStartTime = System.currentTimeMillis(); @@ -327,12 +320,11 @@ public class E2EServiceInstances { long startTime = System.currentTimeMillis(); - OperationStatus operationStatus = null; + OperationStatus operationStatus; try { - operationStatus = osRepo.findOneByServiceIdAndOperationId(serviceId, + operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId, operationId); - } catch (Exception e) { msoLogger .error(MessageEnum.APIH_DB_ACCESS_EXC, @@ -353,7 +345,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } @@ -371,7 +363,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by serviceId"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); + + resp.getEntity()); return resp; } @@ -387,7 +379,7 @@ public class E2EServiceInstances { String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis(); msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceDeleteRequest e2eDelReq = null; + E2EServiceInstanceDeleteRequest e2eDelReq; ObjectMapper mapper = new ObjectMapper(); try { @@ -410,11 +402,11 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } - RecipeLookupResult recipeLookupResult = null; + RecipeLookupResult recipeLookupResult; try { //TODO Get the service template model version uuid from AAI. recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); @@ -436,7 +428,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } if (recipeLookupResult == null) { @@ -454,12 +446,12 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } - RequestClient requestClient = null; - HttpResponse response = null; + RequestClient requestClient; + HttpResponse response; long subStartTime = System.currentTimeMillis(); try { @@ -514,7 +506,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); msoLogger.debug("End of the transaction, the final response is: " - + (String) resp.getEntity()); + + resp.getEntity()); return resp; } @@ -530,7 +522,7 @@ public class E2EServiceInstances { msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -548,7 +540,7 @@ public class E2EServiceInstances { String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis(); msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceRequest e2eSir = null; + E2EServiceInstanceRequest e2eSir; String serviceId = instanceIdMap.get("serviceId"); ObjectMapper mapper = new ObjectMapper(); @@ -565,7 +557,7 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.SchemaError, requestJSON, e); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -585,11 +577,11 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.SchemaError, requestJSON, e); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } - RecipeLookupResult recipeLookupResult = null; + RecipeLookupResult recipeLookupResult; try { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { @@ -603,7 +595,7 @@ public class E2EServiceInstances { msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -617,15 +609,15 @@ public class E2EServiceInstances { msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } String serviceInstanceType = e2eSir.getService().getServiceType(); - RequestClient requestClient = null; - HttpResponse response = null; + RequestClient requestClient; + HttpResponse response; long subStartTime = System.currentTimeMillis(); String sirRequestJson = convertToString(sir); @@ -665,7 +657,7 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -677,7 +669,7 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -694,7 +686,7 @@ public class E2EServiceInstances { String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis(); msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceRequest e2eSir = null; + E2EServiceInstanceRequest e2eSir; MsoRequest msoRequest = new MsoRequest(); ObjectMapper mapper = new ObjectMapper(); @@ -711,7 +703,7 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.SchemaError, requestJSON, e); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -731,11 +723,11 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.SchemaError, requestJSON, e); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } - RecipeLookupResult recipeLookupResult = null; + RecipeLookupResult recipeLookupResult; try { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { @@ -749,7 +741,7 @@ public class E2EServiceInstances { msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -762,15 +754,15 @@ public class E2EServiceInstances { msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } String serviceInstanceType = e2eSir.getService().getServiceType(); String serviceId = ""; - RequestClient requestClient = null; - HttpResponse response = null; + RequestClient requestClient; + HttpResponse response; long subStartTime = System.currentTimeMillis(); String sirRequestJson = convertToString(sir); @@ -809,7 +801,7 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -820,7 +812,7 @@ public class E2EServiceInstances { MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -837,7 +829,7 @@ public class E2EServiceInstances { String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis(); msoLogger.debug("requestId is: " + requestId); - E2EServiceInstanceScaleRequest e2eScaleReq = null; + E2EServiceInstanceScaleRequest e2eScaleReq; ObjectMapper mapper = new ObjectMapper(); try { @@ -860,11 +852,11 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } - RecipeLookupResult recipeLookupResult = null; + RecipeLookupResult recipeLookupResult; try { //TODO Get the service template model version uuid from AAI. recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); @@ -886,7 +878,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } if (recipeLookupResult == null) { @@ -903,12 +895,12 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) response.getEntity()); + + response.getEntity()); return response; } - RequestClient requestClient = null; - HttpResponse response = null; + RequestClient requestClient; + HttpResponse response; long subStartTime = System.currentTimeMillis(); try { @@ -963,7 +955,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); + + resp.getEntity()); return resp; } @@ -979,7 +971,7 @@ public class E2EServiceInstances { msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity()); + msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -1028,7 +1020,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); + + resp.getEntity()); return resp; } else { Response resp = msoRequest @@ -1047,7 +1039,7 @@ public class E2EServiceInstances { MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); msoLogger.debug(END_OF_THE_TRANSACTION - + (String) resp.getEntity()); + + resp.getEntity()); return resp; } } @@ -1056,7 +1048,6 @@ public class E2EServiceInstances { /** * Getting recipes from catalogDb * - * @param db the catalog db * @param serviceModelUUID the service model version uuid * @param action the action for the service * @return the service recipe result @@ -1079,7 +1070,6 @@ public class E2EServiceInstances { /** * Getting recipes from catalogDb * If Service recipe is not set, use default recipe, if set , use special recipe. - * @param db the catalog db * @param serviceModelUUID the service version uuid * @param action the action of the service. * @return the service recipe result. @@ -1088,13 +1078,12 @@ public class E2EServiceInstances { String defaultServiceModelName = "UUI_DEFAULT"; - Service defaultServiceRecord = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName); - ServiceRecipe defaultRecipe = sRecipeRepo.findFirstByServiceModelUUIDAndAction(defaultServiceRecord.getModelUUID(), action.name()); + Service defaultServiceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName); //set recipe as default generic recipe - ServiceRecipe recipe = defaultRecipe; + ServiceRecipe recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(defaultServiceRecord.getModelUUID(), action.name()); //check the service special recipe if(null != serviceModelUUID && ! serviceModelUUID.isEmpty()){ - ServiceRecipe serviceSpecialRecipe = sRecipeRepo.findFirstByServiceModelUUIDAndAction( + ServiceRecipe serviceSpecialRecipe = catalogDbClient.getFirstByServiceModelUUIDAndAction( serviceModelUUID, action.name()); if(null != serviceSpecialRecipe){ //set service special recipe. diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java index a93feb6cd9..66afcf3738 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java @@ -44,6 +44,7 @@ import org.onap.so.apihandler.common.ResponseBuilder; import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.validation.ApplyUpdatedConfigValidation; import org.onap.so.apihandlerinfra.validation.CloudConfigurationValidation; +import org.onap.so.apihandlerinfra.validation.ConfigurationParametersValidation; import org.onap.so.apihandlerinfra.validation.InPlaceSoftwareUpdateValidation; import org.onap.so.apihandlerinfra.validation.InstanceIdMapValidation; import org.onap.so.apihandlerinfra.validation.ModelInfoValidation; @@ -95,7 +96,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class MsoRequest { @Autowired - private InfraActiveRequestsRepository iarRepo; + private RequestsDbClient requestsDbClient; @Autowired private ResponseBuilder builder; @@ -178,6 +179,7 @@ public class MsoRequest { rules.add(new PlatformLOBValidation()); rules.add(new ProjectOwningEntityValidation()); rules.add(new RelatedInstancesValidation()); + rules.add(new ConfigurationParametersValidation()); } if(reqVersion >= 7 && requestParameters != null && requestParameters.getUserParams() != null){ for(Map<String, Object> params : requestParameters.getUserParams()){ @@ -426,7 +428,7 @@ public class MsoRequest { request.setRequestBody(requestJSON); Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis()); request.setEndTime(endTimeStamp); - iarRepo.save(request); + requestsDbClient.save(request); } catch (Exception e) { msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); msoLogger.debug ("Exception: ", e); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index 3a944473d9..014739d581 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -102,7 +102,7 @@ public class OrchestrationRequests { requestDB = requestsDbClient.getInfraActiveRequestbyRequestId(requestId); } catch (Exception e) { - + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build(); AlarmLoggerInfo alarmLoggerInfo = new AlarmLoggerInfo.Builder("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)).build(); @@ -156,12 +156,10 @@ public class OrchestrationRequests { throw new ValidationException("At least one filter query param must be specified"); } }catch(ValidationException ex){ + msoLogger.error(ex); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build(); - - ValidateException validateException = new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build(); - throw validateException; } @@ -202,10 +200,8 @@ public class OrchestrationRequests { ObjectMapper mapper = new ObjectMapper(); sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); } catch(IOException e){ - + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); - - ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); @@ -215,6 +211,7 @@ public class OrchestrationRequests { try{ msoRequest.parseOrchestration(sir); } catch (Exception e) { + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); @@ -301,7 +298,7 @@ public class OrchestrationRequests { requestDetails = mapper.readValue(requestBody, RequestDetails.class); } } catch (IOException e) { - + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build(); ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java index 466de0aa0e..380ee2c6ad 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java @@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra; import org.apache.http.HttpStatus; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -30,10 +31,6 @@ import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; -import org.springframework.http.HttpRequest; -import org.springframework.http.client.ClientHttpRequestExecution; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; @@ -41,10 +38,9 @@ import org.springframework.web.client.RestTemplate; import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; -import uk.co.blackpepper.bowman.RestTemplateConfigurer; import javax.annotation.PostConstruct; -import java.io.IOException; +import javax.ws.rs.core.UriBuilder; import java.net.URI; import java.util.HashMap; import java.util.List; @@ -53,7 +49,11 @@ import java.util.Map; @Component("RequestDbClient") public class RequestsDbClient { + private static final String SERVICE_ID = "SERVICE_ID"; + private static final String OPERATION_ID = "OPERATION_ID"; + private Client<InfraActiveRequests> infraActiveRequestClient; + private Client<OperationStatus> operationStatusClient; @Value("${mso.adapters.requestDb.endpoint}") private String endpoint; @@ -62,12 +62,15 @@ public class RequestsDbClient { private String msoAdaptersAuth; private String getOrchestrationFilterURI = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive/"; + private static final String OPERATION_STATUS_REPOSITORY_SEARCH = "/operationStatusRepository/search"; private String checkVnfIdStatus = "/infraActiveRequests/checkVnfIdStatus/"; private String infraActiveRequestURI = "/infraActiveRequests/"; private String checkInstanceNameDuplicate = "/infraActiveRequests/checkInstanceNameDuplicate"; + + private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId"; private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive"; @@ -83,27 +86,18 @@ public class RequestsDbClient { checkVnfIdStatus = endpoint + checkVnfIdStatus; checkInstanceNameDuplicate = endpoint + checkInstanceNameDuplicate; cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive; + findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_REPOSITORY_SEARCH + findOneByServiceIdAndOperationIdURI; headers = new HttpHeaders(); headers.set("Authorization", msoAdaptersAuth); } public RequestsDbClient() { - ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { - - public void configure(RestTemplate restTemplate) { - - restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { - - public ClientHttpResponse intercept(HttpRequest request, byte[] body, - ClientHttpRequestExecution execution) throws IOException { - - request.getHeaders().add("Authorization", msoAdaptersAuth); - return execution.execute(request, body); - } - }); - } - }).build().buildClientFactory(); + ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(restTemplate -> restTemplate.getInterceptors().add((request, body, execution) -> { + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + })).build().buildClientFactory(); infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); + operationStatusClient = clientFactory.create(OperationStatus.class); } public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){ @@ -145,6 +139,13 @@ public class RequestsDbClient { } } + + public OperationStatus getOneByServiceIdAndOperationId(String serviceId, String operationId){ + return this.getSingleOperationStatus(UriBuilder.fromUri(findOneByServiceIdAndOperationIdURI) + .queryParam(SERVICE_ID,serviceId) + .queryParam(OPERATION_ID,operationId) + .build()); + } public void save(InfraActiveRequests infraActiveRequests) { URI uri = getUri(infraActiveRequestURI); @@ -159,6 +160,10 @@ public class RequestsDbClient { public void updateInfraActiveRequests(InfraActiveRequests request) { infraActiveRequestClient.put(request); } + + public OperationStatus getSingleOperationStatus(URI uri){ + return operationStatusClient.get(uri); + } protected URI getUri(String uri) { return URI.create(uri); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index e259839d6e..ced69df55c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -525,6 +525,21 @@ public class ServiceInstances { Response response = serviceInstances(request, Action.deactivateAndCloudDelete, instanceIdMap, version, requestId, getRequestUri(requestContext)); return response; } + + @POST + @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value="VF Auto Scale Out",response=Response.class) + @Transactional + public Response scaleOutVfModule(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, + @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws ApiException { + String requestId = getRequestId(requestContext); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("vnfInstanceId", vnfInstanceId); + return serviceInstances(request, Action.scaleOut, instanceIdMap, version, requestId, getRequestUri(requestContext)); + } @POST @@ -845,8 +860,20 @@ public class ServiceInstances { throw clientException; } - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); + ResponseHandler respHandler = null; + int bpelStatus = 500; + try { + respHandler = new ResponseHandler (response, requestClient.getType ()); + bpelStatus = respHandler.getStatus (); + } catch (ApiException e) { + msoLogger.error(e); + ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) + .errorInfo(errorLoggerInfo).build(); + currentActiveReq.setRequestStatus(Status.FAILED.name()); + currentActiveReq.setStatusMessage(validateException.getMessage()); + throw validateException; + } // BPEL accepted the request, the request is in progress if (bpelStatus == HttpStatus.SC_ACCEPTED) { @@ -858,7 +885,7 @@ public class ServiceInstances { ObjectMapper mapper = new ObjectMapper(); jsonResponse = mapper.readValue(camundaResp.getResponse(), ServiceInstancesResponse.class); } catch (IOException e) { - e.printStackTrace(); + msoLogger.error(e); ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e) .errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java index 4c7365b187..f366c7e74b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CloudConfigurationValidation.java @@ -53,7 +53,7 @@ public class CloudConfigurationValidation implements ValidationRule{ (action == Action.enablePort || action == Action.disablePort || action == Action.activateInstance || action == Action.deactivateInstance)){ throw new ValidationException ("cloudConfiguration"); } - if(requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.deactivateAndCloudDelete){ + if(requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && (action == Action.deactivateAndCloudDelete || action == Action.scaleOut)){ throw new ValidationException("cloudConfiguration"); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java new file mode 100644 index 0000000000..edd1b1a10e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.apihandlerinfra.validation; + +import java.util.List; +import java.util.Map; + +import org.onap.so.apihandlerinfra.Action; +import org.onap.so.apihandlerinfra.Actions; +import org.onap.so.exceptions.ValidationException; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; + +public class ConfigurationParametersValidation implements ValidationRule{ + private static boolean empty(String s) { + return (s == null || s.trim().isEmpty()); + } + @Override + public ValidationInformation validate(ValidationInformation info) throws ValidationException{ + ServiceInstancesRequest sir = info.getSir(); + List<Map<String, String>> configParams = sir.getRequestDetails().getConfigurationParameters(); + String requestScope = info.getRequestScope(); + Actions action = info.getAction(); + + if(requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut && configParams.isEmpty()){ + throw new ValidationException("configuration parameters"); + } + return info; + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java index 8ab7fccdff..aa98d2abf2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ModelInfoValidation.java @@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra.validation; import org.onap.so.apihandlerinfra.Action; import org.onap.so.apihandlerinfra.Actions; +import org.onap.so.apihandlerinfra.TestApi; import org.onap.so.exceptions.ValidationException; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -73,19 +74,22 @@ public class ModelInfoValidation implements ValidationRule{ (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) { throw new ValidationException ("modelInvariantId"); } + if(empty(modelInfo.getModelInvariantId()) && (requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut)){ + throw new ValidationException("modelInvariantId"); + } if (!empty (modelInfo.getModelInvariantId ()) && !UUIDChecker.isValidUUID (modelInfo.getModelInvariantId ())) { throw new ValidationException ("modelInvariantId format"); } if(reqVersion >= 4 && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || - action == Action.addRelationships || action == Action.removeRelationships || (action == Action.deleteInstance && (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){ + action == Action.addRelationships || action == Action.removeRelationships || ((action == Action.deleteInstance || action == Action.scaleOut) && (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){ throw new ValidationException ("modelName"); } if (empty (modelInfo.getModelVersion ()) && !(requestScope.equalsIgnoreCase(ModelType.configuration.name())) && (!(reqVersion < 4 && requestScope.equalsIgnoreCase (ModelType.network.name ())) - && (action == Action.createInstance || action == Action.updateInstance || action == Action.addRelationships || action == Action.removeRelationships))) { + && (action == Action.createInstance || action == Action.updateInstance || action == Action.addRelationships || action == Action.removeRelationships || action == Action.scaleOut))) { throw new ValidationException ("modelVersion"); } @@ -95,6 +99,9 @@ public class ModelInfoValidation implements ValidationRule{ (requestScope.equalsIgnoreCase(ModelType.configuration.name()) && (action == Action.activateInstance || action == Action.deactivateInstance))))) { throw new ValidationException ("modelVersionId"); } + if(empty(modelInfo.getModelVersionId()) && (requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut)){ + throw new ValidationException("modelVersionId"); + } if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) { if (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) { @@ -106,6 +113,9 @@ public class ModelInfoValidation implements ValidationRule{ && (action == Action.updateInstance || action == Action.createInstance)){ throw new ValidationException ("modelCustomizationId"); } + if(empty(modelInfo.getModelCustomizationId()) && action == Action.scaleOut && !(requestParameters.getTestApi() == TestApi.VNF_API.name() && requestParameters.isUsePreload() == true)){ + throw new ValidationException ("modelCustomizationId"); + } return info; } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java index 096b30939b..1f4fbc974a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java @@ -217,7 +217,8 @@ public class RelatedInstancesValidation implements ValidationRule{ } else if ((( requestScope.equalsIgnoreCase(ModelType.vnf.name ()) || requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) || requestScope.equalsIgnoreCase(ModelType.configuration.name())) && (action == Action.createInstance || action == Action.enablePort || action == Action.disablePort)) || - (reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance) || + (reqVersion >= 4 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance || + (requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) && action == Action.scaleOut)) || (requestScope.equalsIgnoreCase(ModelType.service.name()) && (action.equals(Action.addRelationships) || action.equals(Action.removeRelationships)))){ msoLogger.debug ("related instance exception"); throw new ValidationException ("related instances"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml index 3252146bfa..acc04061cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml @@ -17,6 +17,10 @@ camunda-nodehealthcheck-urn: /mso/nodehealthcheck mso: + adapters: + requestDb: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + endpoint: http://localhost:8081 logPath: logs site-name: mtanj catalog: @@ -42,8 +46,6 @@ mso: sdna: url: http://localhost:8089/ password: 4112B789E942B161228F7D5AFC654C0F - bpelURL: http://localhost:8080/ - bpelAuth: 786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1 camundaURL: http://localhost:8089/ camundaAuth: F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D async: diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java index 2baa54fdec..a63b778a1f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java @@ -20,10 +20,7 @@ package org.onap.so.apihandlerinfra; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -33,11 +30,17 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.junit.Ignore; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.Test; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.ServiceRecipe; +import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; import org.springframework.http.HttpEntity; @@ -45,43 +48,65 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.http.Fault; public class E2EServiceInstancesTest extends BaseTest { -private ObjectMapper mapper = new ObjectMapper(); +private final ObjectMapper mapper = new ObjectMapper(); private final String e2eServInstancesUri = "/e2eServiceInstances/"; + + @Before + public void init() throws JsonProcessingException { + stubFor(post(urlPathEqualTo("/testOrchestrationUri")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + stubFor(post(urlPathEqualTo("/infraActiveRequests/")).withRequestBody(equalToJson("{\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"Error parsing request: No valid requestorId is specified\",\"progress\":100,\"startTime\":1533541051247,\"endTime\":1533541051247,\"source\":null,\"vnfId\":null,\"vnfName\":null,\"vnfType\":null,\"serviceType\":null,\"aicNodeClli\":null,\"tenantId\":null,\"provStatus\":null,\"vnfParams\":null,\"vnfOutputs\":null,\"requestBody\":\"{\\r\\n \\\"service\\\":{\\r\\n \\\"name\\\":\\\"so_test4\\\",\\r\\n \\\"description\\\":\\\"so_test2\\\",\\r\\n \\\"serviceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561519\\\",\\r\\n \\\"serviceUuid\\\":\\\"592f9437-a9c0-4303-b9f6-c445bb7e9814\\\",\\r\\n \\\"globalSubscriberId\\\":\\\"123457\\\",\\r\\n \\\"serviceType\\\":\\\"voLTE\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"resources\\\":[\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vIMS\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vBAS-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vMME-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vEPC\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"61c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"62c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-CSCF-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad1\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"underlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561513\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561514\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"overlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561517\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561518\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n }\\r\\n ],\\r\\n \\\"requestInputs\\\":{\\r\\n \\\"externalDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"m6000_mng_ip\\\":\\\"181.18.20.2\\\",\\r\\n \\\"externalCompanyFtpDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"externalPluginManageNetworkName\\\":\\\"plugin_net_2014\\\",\\r\\n \\\"externalManageNetworkName\\\":\\\"mng_net_2017\\\",\\r\\n \\\"sfc_data_network\\\":\\\"sfc_data_net_2016\\\",\\r\\n \\\"NatIpRange\\\":\\\"210.1.1.10-210.1.1.20\\\",\\r\\n \\\"location\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\",\\r\\n \\\"sdncontroller\\\":\\\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\\\"\\r\\n }\\r\\n }\\r\\n\\r\\n }\\r\\n\\r\\n}\",\"responseBody\":null,\"lastModifiedBy\":\"APIH\",\"modifyTime\":null,\"requestType\":null,\"volumeGroupId\":null,\"volumeGroupName\":null,\"vfModuleId\":null,\"vfModuleName\":null,\"vfModuleModelName\":null,\"aaiServiceId\":null,\"aicCloudRegion\":null,\"callBackUrl\":null,\"correlator\":null,\"serviceInstanceId\":null,\"serviceInstanceName\":null,\"requestScope\":\"service\",\"requestAction\":\"createInstance\",\"networkId\":null,\"networkName\":null,\"networkType\":null,\"requestorId\":null,\"configurationId\":null,\"configurationName\":null,\"operationalEnvId\":null,\"operationalEnvName\":null,\"requestURI\":\"d167c9d0-1785-4e93-b319-996ebbcc3272\"}")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + Service defaultService = new Service(); + defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); + ServiceRecipe serviceRecipe = new ServiceRecipe(); + serviceRecipe.setServiceModelUUID(defaultService.getModelUUID()); + serviceRecipe.setAction(Action.scaleInstance.name()); + serviceRecipe.setRecipeTimeout(180); + serviceRecipe.setOrchestrationUri("/testOrchestrationUri"); + + stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(defaultService)) + .withStatus(HttpStatus.SC_OK))); + + stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(serviceRecipe)) + .withStatus(HttpStatus.SC_OK))); + + } public String inputStream(String JsonInput)throws IOException{ JsonInput = "src/test/resources/E2EServiceInstancesTest" + JsonInput; - String input = new String(Files.readAllBytes(Paths.get(JsonInput))); - return input; + return new String(Files.readAllBytes(Paths.get(JsonInput))); } public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type",MediaType.APPLICATION_JSON); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); - HttpEntity<String> request = new HttpEntity<String>(requestJson, headers); - ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), + HttpEntity<String> request = new HttpEntity<>(requestJson, headers); + + return restTemplate.exchange(builder.toUriString(), reqMethod, request, String.class); - - return response; } - //Currently returning a 500 response - @Ignore + @Test - public void createE2EServiceInstanceNoRequestInfo() throws JsonParseException, JsonMappingException, IOException{ - String uri = e2eServInstancesUri + "v5"; + public void createE2EServiceInstanceNoRequestInfo() throws IOException{ + String uri = e2eServInstancesUri + "v3"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.POST); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); } @Test - public void updateE2EServiceInstanceJSONMappingError() throws JsonParseException, JsonMappingException, IOException{ + public void updateE2EServiceInstanceJSONMappingError() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; ResponseEntity<String> response = sendRequest(inputStream("/CompareModelRequest.json"), uri, HttpMethod.PUT); @@ -90,7 +115,7 @@ private ObjectMapper mapper = new ObjectMapper(); assertTrue(realResponse.getServiceException().getText().contains("Mapping of request to JSON object failed")); } @Test - public void updateE2EServiceInstanceNoRequestorId() throws JsonParseException, JsonMappingException, IOException{ + public void updateE2EServiceInstanceNoRequestorId() throws IOException{ RequestError expectedResponse = new RequestError(); ServiceException exception = new ServiceException(); exception.setMessageId("SVC0002"); @@ -105,7 +130,7 @@ private ObjectMapper mapper = new ObjectMapper(); assertThat(realResponse, sameBeanAs(expectedResponse)); } @Test - public void deleteE2EServiceInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException{ + public void deleteE2EServiceInstance() throws IOException{ RequestError expectedResponse = new RequestError(); ServiceException exception = new ServiceException(); exception.setMessageId("SVC1000"); @@ -115,12 +140,10 @@ private ObjectMapper mapper = new ObjectMapper(); String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; ResponseEntity<String> response = sendRequest(inputStream("/DeleteRequest.json"), uri, HttpMethod.DELETE); - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertThat(realResponse, sameBeanAs(expectedResponse)); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); } @Test - public void deleteE2EServiceInstanceNotValid() throws JsonParseException, JsonMappingException, IOException{ + public void deleteE2EServiceInstanceNotValid() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.DELETE); @@ -129,14 +152,14 @@ private ObjectMapper mapper = new ObjectMapper(); assertTrue(realResponse.getServiceException().getText().contains("Mapping of request to JSON object failed")); } @Test - public void getE2EServiceInstanceNullOperationalStatus() throws JsonParseException, JsonMappingException, IOException{ + public void getE2EServiceInstanceNullOperationalStatus() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/operations/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.GET); assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatusCode().value()); } @Test - public void scaleE2EServiceInstanceMappingError() throws JsonParseException, JsonMappingException, IOException{ + public void scaleE2EServiceInstanceMappingError() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/scale"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.POST); @@ -145,22 +168,35 @@ private ObjectMapper mapper = new ObjectMapper(); assertTrue(realResponse.getServiceException().getText().contains("Mapping of request to JSON object failed")); } @Test - public void scaleE2EServiceInstance() throws JsonParseException, JsonMappingException, IOException{ - RequestError expectedResponse = new RequestError(); - ServiceException exception = new ServiceException(); - exception.setMessageId("SVC1000"); - exception.setText("No communication to catalog DB null"); - expectedResponse.setServiceException(exception); - + public void scaleE2EServiceInstance() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/scale"; ResponseEntity<String> response = sendRequest(inputStream("/ScaleRequest.json"), uri, HttpMethod.POST); - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertThat(realResponse, sameBeanAs(expectedResponse)); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + } + + @Test + public void updateE2EServiceInstance() throws IOException{ + String uri = e2eServInstancesUri + "v3/9b9f02c0-298b-458a-bc9c-be3692e4f35e"; + ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.PUT); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + } + + @Test + public void getE2EServiceInstance() throws IOException{ + OperationStatus status = new OperationStatus(); + status.setOperationId("operationId"); + status.setServiceId("9b9f02c0-298b-458a-bc9c-be3692e4f35e"); + stubFor(get(urlPathEqualTo("/operationStatusRepository/search/findOneByServiceIdAndOperationId")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(status)) + .withStatus(HttpStatus.SC_OK))); + String uri = e2eServInstancesUri + "v3/9b9f02c0-298b-458a-bc9c-be3692e4f35e/operations/operationId"; + ResponseEntity<String> response = sendRequest("", uri, HttpMethod.GET); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test - public void compareModelWithTargetVersionBadRequest() throws JsonParseException, JsonMappingException, IOException{ + public void compareModelWithTargetVersionBadRequest() throws IOException{ String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/modeldifferences"; ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.POST); @@ -169,7 +205,7 @@ private ObjectMapper mapper = new ObjectMapper(); assertTrue(realResponse.getServiceException().getText().contains("Mapping of request to JSON object failed")); } @Test - public void compareModelWithTargetVersion() throws JsonParseException, JsonMappingException, IOException{ + public void compareModelWithTargetVersion() throws IOException{ stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("Camunda/SuccessfulResponse.json").withStatus(org.apache.http.HttpStatus.SC_ACCEPTED))); @@ -183,7 +219,7 @@ private ObjectMapper mapper = new ObjectMapper(); assertEquals(expectedResponse, actualResponse); } @Test - public void compareModelWithTargetVersionEmptyResponse() throws JsonParseException, JsonMappingException, IOException{ + public void compareModelWithTargetVersionEmptyResponse() throws IOException{ stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE))); @@ -201,7 +237,7 @@ private ObjectMapper mapper = new ObjectMapper(); assertThat(realResponse, sameBeanAs(expectedResponse)); } @Test - public void compareModelWithTargetVersionBadBpelResponse() throws JsonParseException, JsonMappingException, IOException{ + public void compareModelWithTargetVersionBadBpelResponse() throws IOException{ stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); @@ -214,7 +250,7 @@ private ObjectMapper mapper = new ObjectMapper(); assertTrue(realResponse.getServiceException().getText().contains("Request Failed due to BPEL error with HTTP Status")); } @Test - public void compareModelWithTargetVersionNoBPELResponse() throws JsonParseException, JsonMappingException, IOException{ + public void compareModelWithTargetVersionNoBPELResponse() throws IOException{ stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")) .willReturn(aResponse().withHeader("Content-Type", "application/json") .withBody("{}").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index c9d83efced..5d6aa43a9b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -26,6 +26,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import java.io.IOException; @@ -57,62 +58,80 @@ import ch.qos.logback.classic.spi.ILoggingEvent; public class ManualTasksTest extends BaseTest{ - private final String basePath = "/tasks/v1/"; - - - - @Test - public void testCreateOpEnvObjectMapperError() throws IOException { - TestAppender.events.clear(); - stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) - .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); - - String taskId = "55"; - TasksRequest taskReq = new TasksRequest(); - RequestDetails reqDetail = new RequestDetails(); - RequestInfo reqInfo = new RequestInfo(); - reqInfo.setRequestorId("testId"); - reqInfo.setSource("testSource"); - reqInfo.setResponseValue(ValidResponses.skip); - reqDetail.setRequestInfo(reqInfo); - taskReq.setRequestDetails(reqDetail); - - //expected response - TaskRequestReference expectedResponse = new TaskRequestReference(); - expectedResponse.setTaskId(taskId); - - headers.set("Accept", MediaType.APPLICATION_JSON); - headers.set("Content-Type", MediaType.APPLICATION_JSON); - headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); - headers.set(MsoLogger.CLIENT_ID, "VID"); - HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); - - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); - ResponseEntity<String> response = restTemplate.exchange( - builder.toUriString(), - HttpMethod.POST, entity, String.class); - - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - TaskRequestReference realResponse = mapper.readValue(response.getBody(), TaskRequestReference.class); - - - //then - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - assertThat(realResponse, sameBeanAs(expectedResponse)); - ILoggingEvent logEvent = TestAppender.events.get(0); - Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertEquals("987654321", mdc.get(MsoLogger.REQUEST_ID)); - assertEquals("VID", mdc.get(MsoLogger.CLIENT_ID)); - assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); - assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); - assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); - assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); - assertEquals("987654321", response.getHeaders().get("X-TransactionID").get(0)); - MDC.remove(MsoLogger.CLIENT_ID); - - } + private final String basePath = "/tasks/v1/"; + + + + @Test + public void testCreateOpEnvObjectMapperError() throws IOException { + TestAppender.events.clear(); + stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + + String taskId = "55"; + TasksRequest taskReq = new TasksRequest(); + RequestDetails reqDetail = new RequestDetails(); + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setRequestorId("testId"); + reqInfo.setSource("testSource"); + reqInfo.setResponseValue(ValidResponses.skip); + reqDetail.setRequestInfo(reqInfo); + taskReq.setRequestDetails(reqDetail); + + //expected response + TaskRequestReference expectedResponse = new TaskRequestReference(); + expectedResponse.setTaskId(taskId); + + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); + headers.set(MsoLogger.CLIENT_ID, "VID"); + HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.POST, entity, String.class); + + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + TaskRequestReference realResponse = mapper.readValue(response.getBody(), TaskRequestReference.class); + + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + assertThat(realResponse, sameBeanAs(expectedResponse)); + + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); + assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && + logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(MsoLogger.ENDTIME)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); + assertEquals("202",mdc.get(MsoLogger.RESPONSECODE)); + assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME)); + assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE)); + assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); + assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); + assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); + assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); + } + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java index 7feea9a456..63dc96f485 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java @@ -192,6 +192,7 @@ public class MsoRequestTest extends BaseTest { {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/CloudConfigurationConfig.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, 5}, {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, 6}, {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/DeactivateAndCloudDeleteCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateAndCloudDelete, 7}, + {"No valid cloudConfiguration is specified", mapper.readValue(inputStream("/CloudConfiguration/ScaleOutNoCloudConfig.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid lcpCloudRegionId is specified", mapper.readValue(inputStream("/CloudConfiguration/EmptyLcpCloudConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid lcpCloudRegionId is specified", mapper.readValue(inputStream("/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, 6}, {"No valid tenantId is specified", mapper.readValue(inputStream("/CloudConfiguration/EmptyTenantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, @@ -206,6 +207,7 @@ public class MsoRequestTest extends BaseTest { {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/ModelCustomization.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, 6}, {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/ModelCustomization.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 6}, {"No valid modelCustomizationId or modelCustomizationName is specified", mapper.readValue(inputStream("/ModelInfo/VnfModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.replaceInstance, 5}, + {"No valid modelCustomizationId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid model-info is specified", mapper.readValue(inputStream("/ModelInfo/ModelInfoNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelInvariantId format is specified", mapper.readValue(inputStream("/ModelInfo/InvalidModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 2}, {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/ModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, 4}, @@ -215,11 +217,14 @@ public class MsoRequestTest extends BaseTest { {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/ModelInvariantIdConfiguration.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 3}, {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/v5DeactivateModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deactivateInstance, 5}, {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/v3UpdateNetworkBad.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 4}, + {"No valid modelInvariantId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelInvariantId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid modelName is specified", mapper.readValue(inputStream("/ModelInfo/VfModuleModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.deleteInstance, 4}, + {"No valid modelName is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid modelType is specified", mapper.readValue(inputStream("/ModelInfo/ModelTypeNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 3}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionVfModule.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 3}, {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionServiceCreate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 3}, + {"No valid modelVersion is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelVersion.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ConfigurationModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 4}, @@ -229,6 +234,7 @@ public class MsoRequestTest extends BaseTest { {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/v2ModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.disablePort, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ModelVersionIdCreate.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/v5ActivateModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, + {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, //ValidationException for Platform and LineOfBusiness {"No valid lineOfBusinessName is specified", mapper.readValue(inputStream("/PlatformAndLineOfBusiness/EmptyLineOfBusiness.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid platform is specified", mapper.readValue(inputStream("/PlatformAndLineOfBusiness/Platform.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 6}, @@ -261,6 +267,7 @@ public class MsoRequestTest extends BaseTest { {"No valid related instances is specified", mapper.readValue(inputStream("/RelatedInstances/v5EnablePortNoRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.enablePort, 5}, {"No valid related instances is specified", mapper.readValue(inputStream("/RelatedInstances/v5CreateNoRelatedInstances.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid related instances is specified", mapper.readValue(inputStream("/RelatedInstances/v4RelatedInstancesNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 4}, + {"No valid related instances is specified", mapper.readValue(inputStream("/RelatedInstances/ScaleOutNoRelatedInstances.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid related service instance for vfModule request is specified", mapper.readValue(inputStream("/RelatedInstances/VfModuleRelatedInstancesService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid related service instance for vnf request is specified", mapper.readValue(inputStream("/RelatedInstances/VnfRelatedInstancesService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid related service instance for volumeGroup request is specified", mapper.readValue(inputStream("/RelatedInstances/RelatedInstancesServiceInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, @@ -275,6 +282,7 @@ public class MsoRequestTest extends BaseTest { {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo/RequestInfoNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo/RequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.applyUpdatedConfig, 6}, {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo/RequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.inPlaceSoftwareUpdate, 6}, + {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo/ScaleOutNoRequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid productFamilyId is specified", mapper.readValue(inputStream("/RequestInfo/VnfProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 3}, {"No valid productFamilyId is specified", mapper.readValue(inputStream("/RequestInfo/NetworkProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 3}, {"No valid productFamilyId is specified", mapper.readValue(inputStream("/RequestInfo/NetworkProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.updateInstance, 3}, @@ -310,7 +318,9 @@ public class MsoRequestTest extends BaseTest { {"No valid model-info in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/Network.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelCustomizationId in userParams vfModule resources is specified", mapper.readValue(inputStream("/RequestParameters/VfModuleModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelCustomizationId in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/VnfModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, - {"No valid modelCustomizationId in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/NetworkModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7} + {"No valid modelCustomizationId in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/NetworkModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, + //Validation for ConfigurationParameters + {"No valid configuration parameters is specified", mapper.readValue(inputStream("/ConfigurationParameters/NoConfigurationParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7} }); } @Test diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 1ab66561b0..48d424c8d1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -73,1335 +73,1386 @@ import ch.qos.logback.classic.spi.ILoggingEvent; public class ServiceInstancesTest extends BaseTest{ - - @Autowired - private InfraActiveRequestsRepository iar; - - @Autowired - private ServiceInstances servInstances; - - private final String servInstanceuri = "/onap/so/infra/serviceInstantiation/"; - private final String servInstanceUriPrev7 = "/onap/so/infra/serviceInstances/"; - private String uri; - - public String inputStream(String JsonInput)throws IOException{ - JsonInput = "src/test/resources/ServiceInstanceTest" + JsonInput; - String input = new String(Files.readAllBytes(Paths.get(JsonInput))); - return input; - } - - public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ - headers.set("Accept", MediaType.APPLICATION_JSON); - headers.set("Content-Type",MediaType.APPLICATION_JSON); - - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); - - HttpEntity<String> request = new HttpEntity<String>(requestJson, headers); - ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), - reqMethod, request, String.class); - - return response; - } - - @Test - public void test_mapJSONtoMSOStyle() throws IOException{ - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - String testRequest= inputStream("/ServiceInstanceDefault.json"); - String resultString = servInstances.mapJSONtoMSOStyle(testRequest, null, false, null); - ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class); - ModelInfo modelInfo = sir.getRequestDetails().getModelInfo(); - assertEquals("f7ce78bb-423b-11e7-93f8-0050569a796",modelInfo.getModelCustomizationUuid()); - assertEquals("modelInstanceName",modelInfo.getModelInstanceName()); - assertEquals("f7ce78bb-423b-11e7-93f8-0050569a7965",modelInfo.getModelInvariantUuid()); - assertEquals("10",modelInfo.getModelUuid()); - - } - @Test - public void createServiceInstanceVIDDefault() throws JsonParseException, JsonMappingException, IOException{ - TestAppender.events.clear(); - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(MsoLogger.CLIENT_ID, "VID"); - //expect - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - //then - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - ILoggingEvent logEvent = TestAppender.events.get(0); - Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(MsoLogger.REQUEST_ID)); - assertEquals("VID", mdc.get(MsoLogger.CLIENT_ID)); - MDC.remove(MsoLogger.CLIENT_ID); - assertTrue(response.getBody().contains("1882939")); - assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); - assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); - assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); - assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0)); - assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", response.getHeaders().get("X-TransactionID").get(0)); + + @Autowired + private InfraActiveRequestsRepository iar; + + @Autowired + private ServiceInstances servInstances; + + private final String servInstanceuri = "/onap/so/infra/serviceInstantiation/"; + private final String servInstanceUriPrev7 = "/onap/so/infra/serviceInstances/"; + private String uri; + + public String inputStream(String JsonInput)throws IOException{ + JsonInput = "src/test/resources/ServiceInstanceTest" + JsonInput; + String input = new String(Files.readAllBytes(Paths.get(JsonInput))); + return input; + } + + public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){ + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type",MediaType.APPLICATION_JSON); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); + + HttpEntity<String> request = new HttpEntity<String>(requestJson, headers); + ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), + reqMethod, request, String.class); + + return response; + } + + @Test + public void test_mapJSONtoMSOStyle() throws IOException{ + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + String testRequest= inputStream("/ServiceInstanceDefault.json"); + String resultString = servInstances.mapJSONtoMSOStyle(testRequest, null, false, null); + ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class); + ModelInfo modelInfo = sir.getRequestDetails().getModelInfo(); + assertEquals("f7ce78bb-423b-11e7-93f8-0050569a796",modelInfo.getModelCustomizationUuid()); + assertEquals("modelInstanceName",modelInfo.getModelInstanceName()); + assertEquals("f7ce78bb-423b-11e7-93f8-0050569a7965",modelInfo.getModelInvariantUuid()); + assertEquals("10",modelInfo.getModelUuid()); + + } + @Test + public void createServiceInstanceVIDDefault() throws JsonParseException, JsonMappingException, IOException{ + TestAppender.events.clear(); + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(MsoLogger.CLIENT_ID, "VID"); + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + + + + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); + assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && + logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(MsoLogger.ENDTIME)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); + assertEquals("202",mdc.get(MsoLogger.RESPONSECODE)); + assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); + assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME)); + assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE)); + assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); + assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); + assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0)); + } - //ExpectedRecord - InfraActiveRequests expectedRecord = new InfraActiveRequests(); - expectedRecord.setRequestStatus("IN_PROGRESS"); - expectedRecord.setRequestBody(inputStream("/ServiceInstanceDefault.json")); - expectedRecord.setAction("createInstance"); - expectedRecord.setSource("VID"); - expectedRecord.setVnfId("1882938"); - expectedRecord.setLastModifiedBy("APIH"); - expectedRecord.setServiceInstanceId("1882939"); - expectedRecord.setServiceInstanceName("testService9"); - expectedRecord.setRequestScope("service"); - expectedRecord.setRequestorId("xxxxxx"); - expectedRecord.setRequestAction("createInstance"); - expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - - //ActualRecord - InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("modifyTime").toString()); - - } - @Test - public void createServiceInstanceServiceInstancesUri() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/CreateGenericALaCarteServiceInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expect - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceUriPrev7 + "v5"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - //then - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createServiceInstanceBpelStatusError() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); - - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceStatusError.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void createServiceInstanceBadGateway() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY).withBody("{}"))); - - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceBadGateway.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void createServiceInstanceEmptyResponse() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE))); - - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEmpty.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.BAD_GATEWAY.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void activateServiceInstanceNoRecipeALaCarte() throws JsonParseException, JsonMappingException, IOException{ - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; - headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST); - - //ExpectedRecord - InfraActiveRequests expectedRecord = new InfraActiveRequests(); - expectedRecord.setRequestStatus("FAILED"); - expectedRecord.setAction("activateInstance"); - expectedRecord.setStatusMessage("Recipe could not be retrieved from catalog DB."); - expectedRecord.setProgress(new Long(100)); - expectedRecord.setSource("VID"); - expectedRecord.setVnfId("1882938"); - expectedRecord.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json")); - expectedRecord.setLastModifiedBy("APIH"); - expectedRecord.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7968"); - expectedRecord.setServiceInstanceName("testService7"); - expectedRecord.setRequestScope("service"); - expectedRecord.setRequestAction("activateInstance"); - expectedRecord.setRequestorId("xxxxxx"); - expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - - //ActualRecord - InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").toString()); - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void activateServiceInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException{ - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceNoRecipe.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void activateServiceInstance() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/ActivateInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivate.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deactivateServiceInstance() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/DeactivateInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/deactivate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivate.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deleteServiceInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/DeleteInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a8868/"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDelete.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void assignServiceInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/AssignServiceInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/assign"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceAssign.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void unassignServiceInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/UnassignServiceInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/unassign"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceUnassign.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createPortConfiguration() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertTrue(response.getBody().contains("1882939")); - } - @Test - public void createPortConfigurationEmptyProductFamilyId() throws JsonParseException, JsonMappingException, IOException { - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void deletePortConfiguration() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstance.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void enablePort() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/enablePort"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEnablePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void disablePort() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/disablePort"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDisablePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void activatePort() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivatePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deactivatePort() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/deactivate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivatePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void addRelationships() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/addRelationships"; - ResponseEntity<String> response = sendRequest(inputStream("/AddRelationships.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void removeRelationships() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/removeRelationships"; - ResponseEntity<String> response = sendRequest(inputStream("/RemoveRelationships.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createVnfInstanceNoALaCarte() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/49585b36-2b5a-443a-8b10-c75d34bb5e46/vnfs"; - ResponseEntity<String> response = sendRequest(inputStream("/VnfCreateDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createVnfInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c3"; - headers.set(MsoLogger.TRANSACTION_ID, requestId); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; - ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstance.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - InfraActiveRequests record = iar.findOneByRequestId(requestId); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertTrue(response.getBody().contains("1882939")); - assertEquals(record.getVnfType(), "vSAMP12/test"); - } - @Test - public void createVnfWithServiceRelatedInstanceFail() throws JsonParseException, JsonMappingException, IOException { - uri = servInstanceUriPrev7 + "v6" + "/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs"; - ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - } - @Test - public void createVnfInstanceInvalidVnfResource() throws JsonParseException, JsonMappingException, IOException { - uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; - ResponseEntity<String> response = sendRequest(inputStream("/NoVnfResource.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertTrue(realResponse.getServiceException().getText().equals("No valid vnfResource is specified")); - } - @Test - public void replaceVnfInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; - ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnf.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void replaceVnfRecreateInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; - ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnfRecreate.json"), uri, HttpMethod.POST); - logger.debug(response.getBody()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void updateVnfInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateVnf.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void applyUpdatedConfig() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/VnfConfigUpdate")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c5"; - headers.set(MsoLogger.TRANSACTION_ID, requestId); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/applyUpdatedConfig"; - ResponseEntity<String> response = sendRequest(inputStream("/ApplyUpdatedConfig.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - InfraActiveRequests record = iar.findOneByRequestId(requestId); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertNull(record.getVnfType()); - } - @Test - public void deleteVnfInstanceV5() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v5" + "/serviceInstances/e446b97d-9c35-437a-95a2-6b4c542c4507/vnfs/49befbfe-fccb-421d-bb4c-0734a43f5ea0"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVnfV5.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/7a88cbeb-0ec8-4765-a271-4f9e90c3da7b/vnfs/cbba721b-4803-4df7-9347-307c9a955426/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleWithRelatedInstances.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertTrue(response.getBody().contains("1882939")); - } - @Test - public void createVfModuleInstanceNoModelCustomization() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelCustomization.json"), uri, HttpMethod.POST); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ObjectMapper mapper = new ObjectMapper(); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deleteVfModuleInstanceNoMatchingModelUUD() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoMatchingModelUUID.json"), uri, HttpMethod.DELETE); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ObjectMapper mapper = new ObjectMapper(); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createVfModuleInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException { - uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertTrue(realResponse.getServiceException().getText().equals("No valid vfModuleCustomization is specified")); - } - @Test - public void replaceVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; - ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVfModule.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void updateVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateVfModule.json"), uri, HttpMethod.PUT); - logger.debug(response.getBody()); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createVfModuleNoModelType() throws JsonParseException, JsonMappingException, IOException{ - headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - InfraActiveRequests expectedRecord = new InfraActiveRequests(); - expectedRecord.setRequestStatus("FAILED"); - expectedRecord.setAction("createInstance"); - expectedRecord.setStatusMessage("Error parsing request: No valid modelType is specified"); - expectedRecord.setProgress(new Long(100)); - expectedRecord.setSource("VID"); - expectedRecord.setRequestBody(inputStream("/VfModuleNoModelType.json")); - expectedRecord.setLastModifiedBy("APIH"); - expectedRecord.setVfModuleName("testVfModule2"); - expectedRecord.setVfModuleModelName("serviceModel"); - expectedRecord.setRequestScope("vfModule"); - expectedRecord.setRequestAction("createInstance"); - expectedRecord.setRequestorId("zz9999"); - expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - //VnfType is not sent in this request, should be blank in db - expectedRecord.setVnfType(""); - uri = servInstanceuri + "v5/serviceInstances/32807a28-1a14-4b88-b7b3-2950918aa76d/vnfs/32807a28-1a14-4b88-b7b3-2950918aa76d/vfModules"; - - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelType.json"), uri, HttpMethod.POST); - //ActualRecord - InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").toString()); - assertNotNull(requestRecord.getStartTime()); - assertNotNull(requestRecord.getEndTime()); - } - @Test - public void inPlaceSoftwareUpdate() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/inPlaceSoftwareUpdate"; - ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void inPlaceSoftwareUpdateDuplicate() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - InfraActiveRequests req = new InfraActiveRequests(); - req.setRequestStatus("IN_PROGRESS"); - req.setAction("inPlaceSoftwareUpdate"); - req.setProgress(new Long(10)); - req.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json")); - req.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7908"); - req.setVnfId("ff305d54-75b4-431b-adb2-eb6b9e5ff033"); - req.setRequestScope("vnf"); - req.setVnfName("duplicateCheck123"); - req.setRequestAction("inPlaceSoftwareUpdate"); - req.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - iar.save(req); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7908/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff033/inPlaceSoftwareUpdate"; - ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate2.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatusCode().value()); - - InfraActiveRequests newRecord = iar.findOneByRequestBody(inputStream("/InPlaceSoftwareUpdate2.json")); - - assertNotNull(newRecord.getServiceInstanceId()); - assertNotNull(newRecord.getVnfId()); - - } - - @Test - public void deleteVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVfModule.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deactivateAndCloudDeleteVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/deactivateAndCloudDelete"; - ResponseEntity<String> response = sendRequest(inputStream("/DeactivateAndCloudDeleteVfModule.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups"; - ResponseEntity<String> response = sendRequest(inputStream("/VolumeGroup.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertTrue(response.getBody().contains("1882939")); - } - @Test - public void updateVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateVolumeGroup.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deleteVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVolumeGroup.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void createNetworkInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c4"; - headers.set(MsoLogger.TRANSACTION_ID, requestId); - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreate.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - InfraActiveRequests record = iar.findOneByRequestId(requestId); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertEquals(record.getNetworkType(), "TestNetworkType"); - } - @Test - public void updateNetworkInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - assertTrue(response.getBody().contains("1882939")); - } - @Test - public void deleteNetworkInstance() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void deleteNetworkInstanceNoReqParams() throws JsonParseException, JsonMappingException, IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstanceNoReqParams.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - @Test - public void convertJsonToServiceInstanceRequestFail() throws JsonParseException, JsonMappingException, IOException { - headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - //ExpectedRecord - InfraActiveRequests expectedRecord = new InfraActiveRequests(); - expectedRecord.setRequestStatus("FAILED"); - expectedRecord.setStatusMessage("Error mapping request: "); - expectedRecord.setProgress(new Long(100)); - expectedRecord.setRequestBody(inputStream("/ConvertRequestFail.json")); - expectedRecord.setLastModifiedBy("APIH"); - expectedRecord.setRequestScope("network"); - expectedRecord.setRequestAction("deleteInstance"); - expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - - uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.DELETE); - - //ActualRecord - InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - assertThat(expectedRecord, sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").ignoring("statusMessage")); - assertThat(requestRecord.getStatusMessage(), containsString("Error mapping request: ")); - assertNotNull(requestRecord.getStartTime()); - assertNotNull(requestRecord.getEndTime()); - } - @Test - public void convertJsonToServiceInstanceRequestConfigurationFail() throws JsonParseException, JsonMappingException, IOException { - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/configurations/test/enablePort"; - ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - } - - @Test - public void creatServiceInstanceGRTestApiNoCustomRecipeFound() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v7" + "/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceMacro.json"), uri, HttpMethod.POST); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void createNetworkInstanceTestApiUndefinedUsePropertiesDefault() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateAlternateInstanceName.json"), uri, HttpMethod.POST); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void createNetworkInstanceTestApiIncorrectUsePropertiesDefault() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiIncorrect.json"), uri, HttpMethod.POST); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } - - @Test - public void createNetworkInstanceTestApiGrApi() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiGrApi.json"), uri, HttpMethod.POST); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void createNetworkInstanceTestApiVnfApi() throws IOException { - stubFor(post(urlPathEqualTo("/mso/async/services/CreateNetworkInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiVnfApi.json"), uri, HttpMethod.POST); - - //expected response - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void activateServiceInstanceRequestStatus() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/ActivateInstance")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - - InfraActiveRequests expectedRecord = new InfraActiveRequests(); - expectedRecord.setRequestStatus("FAILED"); - expectedRecord.setAction("activateInstance"); - expectedRecord.setStatusMessage("Recipe could not be retrieved from catalog DB."); - expectedRecord.setProgress(new Long(100)); - expectedRecord.setSource("VID"); - expectedRecord.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json")); - expectedRecord.setLastModifiedBy("APIH"); - expectedRecord.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7999"); - expectedRecord.setServiceInstanceName("testService1234"); - expectedRecord.setRequestScope("service"); - expectedRecord.setRequestAction("activateInstance"); - expectedRecord.setRequestorId("xxxxxx"); - expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - - //expect - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7999/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev8.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); - - //then - assertEquals(Status.IN_PROGRESS.name(), requestRecord.getRequestStatus()); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void invalidRequestId() throws IOException { - String illegalRequestId = "1234"; - headers.set("X-ECOMP-RequestID", illegalRequestId); - - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - assertTrue(response.getBody().contains("Request Id " + illegalRequestId + " is not a valid UUID")); - } - @Test - public void invalidBPELResponse() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponseInvalid2.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertEquals("Request Failed due to BPEL error with HTTP Status = 202{\"instanceId\": \"1882939\"}", realResponse.getServiceException().getText()); - } - - @Test - public void invalidBPELResponse2() throws IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponseInvalid.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); - assertTrue(realResponse.getServiceException().getText().contains("<aetgt:ErrorMessage>Exception in create execution list 500")); - } - - @Test - public void createMacroServiceInstance() throws JsonParseException, JsonMappingException, IOException{ - stubFor(post(urlPathEqualTo("/mso/async/services/CreateMacroServiceNetworkVnf")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - - //expect - ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("1882939"); - expectedResponse.setRequestReferences(requestReferences); - uri = servInstanceUriPrev7 + "v5"; - ResponseEntity<String> response = sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - //then - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); - assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - } - - @Test - public void testUserParams() throws JsonParseException, JsonMappingException, IOException { - ObjectMapper mapper = new ObjectMapper(); - ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class); - RequestParameters requestParameters = request.getRequestDetails().getRequestParameters(); - String userParamsTxt = inputStream("/userParams.txt"); - - List<Map<String, Object>> userParams = servInstances.configureUserParams(requestParameters); - System.out.println(userParams); - assertTrue(userParams.size() > 0); - assertTrue(userParams.get(0).containsKey("name")); - assertTrue(userParams.get(0).containsKey("value")); - assertTrue(userParamsTxt.replaceAll("\\s+","").equals(userParams.toString().replaceAll("\\s+",""))); - } - - @Test - public void testConfigureCloudConfig() throws IOException { - ObjectMapper mapper = new ObjectMapper(); - ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class); - CloudConfiguration cloudConfig = servInstances.configureCloudConfig(request.getRequestDetails().getRequestParameters()); - - assertEquals("mdt25b", cloudConfig.getLcpCloudRegionId()); - assertEquals("aefb697db6524ddebfe4915591b0a347", cloudConfig.getTenantId()); - } - - @Test - public void testMapToLegacyRequest() throws IOException { - ObjectMapper mapper = new ObjectMapper(); - ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class); - ServiceInstancesRequest expected = mapper.readValue(inputStream("/LegacyMacroServiceInstance.json"), ServiceInstancesRequest.class); - servInstances.mapToLegacyRequest(request.getRequestDetails()); - System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request)); - assertThat(request, sameBeanAs(expected)); - } + //ExpectedRecord + InfraActiveRequests expectedRecord = new InfraActiveRequests(); + expectedRecord.setRequestStatus("IN_PROGRESS"); + expectedRecord.setRequestBody(inputStream("/ServiceInstanceDefault.json")); + expectedRecord.setAction("createInstance"); + expectedRecord.setSource("VID"); + expectedRecord.setVnfId("1882938"); + expectedRecord.setLastModifiedBy("APIH"); + expectedRecord.setServiceInstanceId("1882939"); + expectedRecord.setServiceInstanceName("testService9"); + expectedRecord.setRequestScope("service"); + expectedRecord.setRequestorId("xxxxxx"); + expectedRecord.setRequestAction("createInstance"); + expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + + //ActualRecord + InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("modifyTime").toString()); + + } + @Test + public void createServiceInstanceServiceInstancesUri() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/CreateGenericALaCarteServiceInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceUriPrev7 + "v5"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createServiceInstanceBpelStatusError() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceStatusError.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void createServiceInstanceBadGateway() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY).withBody("{}"))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceBadGateway.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void createServiceInstanceBadData() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY).withBody("{I AM REALLY BAD}"))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceBadGateway.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void createServiceInstanceEmptyResponse() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEmpty.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.BAD_GATEWAY.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void activateServiceInstanceNoRecipeALaCarte() throws JsonParseException, JsonMappingException, IOException{ + uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; + headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST); + + //ExpectedRecord + InfraActiveRequests expectedRecord = new InfraActiveRequests(); + expectedRecord.setRequestStatus("FAILED"); + expectedRecord.setAction("activateInstance"); + expectedRecord.setStatusMessage("Recipe could not be retrieved from catalog DB."); + expectedRecord.setProgress(new Long(100)); + expectedRecord.setSource("VID"); + expectedRecord.setVnfId("1882938"); + expectedRecord.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json")); + expectedRecord.setLastModifiedBy("APIH"); + expectedRecord.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7968"); + expectedRecord.setServiceInstanceName("testService7"); + expectedRecord.setRequestScope("service"); + expectedRecord.setRequestAction("activateInstance"); + expectedRecord.setRequestorId("xxxxxx"); + expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + + //ActualRecord + InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").toString()); + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void activateServiceInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException{ + uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceNoRecipe.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void activateServiceInstance() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/ActivateInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivate.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deactivateServiceInstance() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/DeactivateInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/deactivate"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivate.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deleteServiceInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/DeleteInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a8868/"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDelete.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void assignServiceInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/AssignServiceInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/assign"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceAssign.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void unassignServiceInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/UnassignServiceInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/unassign"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceUnassign.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createPortConfiguration() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + } + @Test + public void createPortConfigurationEmptyProductFamilyId() throws JsonParseException, JsonMappingException, IOException { + uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void deletePortConfiguration() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstance.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void enablePort() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/enablePort"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEnablePort.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void disablePort() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/disablePort"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDisablePort.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void activatePort() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/activate"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivatePort.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deactivatePort() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/deactivate"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivatePort.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void addRelationships() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/addRelationships"; + ResponseEntity<String> response = sendRequest(inputStream("/AddRelationships.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void removeRelationships() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/removeRelationships"; + ResponseEntity<String> response = sendRequest(inputStream("/RemoveRelationships.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createVnfInstanceNoALaCarte() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/49585b36-2b5a-443a-8b10-c75d34bb5e46/vnfs"; + ResponseEntity<String> response = sendRequest(inputStream("/VnfCreateDefault.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createVnfInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c3"; + headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; + ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstance.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + InfraActiveRequests record = iar.findOneByRequestId(requestId); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + assertEquals(record.getVnfType(), "vSAMP12/test"); + } + @Test + public void createVnfWithServiceRelatedInstanceFail() throws JsonParseException, JsonMappingException, IOException { + uri = servInstanceUriPrev7 + "v6" + "/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs"; + ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + } + @Test + public void createVnfInstanceInvalidVnfResource() throws JsonParseException, JsonMappingException, IOException { + uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; + ResponseEntity<String> response = sendRequest(inputStream("/NoVnfResource.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertTrue(realResponse.getServiceException().getText().equals("No valid vnfResource is specified")); + } + @Test + public void replaceVnfInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; + ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnf.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void replaceVnfRecreateInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; + ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnfRecreate.json"), uri, HttpMethod.POST); + logger.debug(response.getBody()); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void updateVnfInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; + ResponseEntity<String> response = sendRequest(inputStream("/UpdateVnf.json"), uri, HttpMethod.PUT); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void applyUpdatedConfig() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/VnfConfigUpdate")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c5"; + headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/applyUpdatedConfig"; + ResponseEntity<String> response = sendRequest(inputStream("/ApplyUpdatedConfig.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + InfraActiveRequests record = iar.findOneByRequestId(requestId); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertNull(record.getVnfType()); + } + @Test + public void deleteVnfInstanceV5() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v5" + "/serviceInstances/e446b97d-9c35-437a-95a2-6b4c542c4507/vnfs/49befbfe-fccb-421d-bb4c-0734a43f5ea0"; + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVnfV5.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/7a88cbeb-0ec8-4765-a271-4f9e90c3da7b/vnfs/cbba721b-4803-4df7-9347-307c9a955426/vfModules"; + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleWithRelatedInstances.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + } + @Test + public void createVfModuleInstanceNoModelCustomization() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules"; + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelCustomization.json"), uri, HttpMethod.POST); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deleteVfModuleInstanceNoMatchingModelUUD() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoMatchingModelUUID.json"), uri, HttpMethod.DELETE); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createVfModuleInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException { + uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules"; + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertTrue(realResponse.getServiceException().getText().equals("No valid vfModuleCustomization is specified")); + } + @Test + public void replaceVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; + ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVfModule.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void updateVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; + ResponseEntity<String> response = sendRequest(inputStream("/UpdateVfModule.json"), uri, HttpMethod.PUT); + logger.debug(response.getBody()); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createVfModuleNoModelType() throws JsonParseException, JsonMappingException, IOException{ + headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + InfraActiveRequests expectedRecord = new InfraActiveRequests(); + expectedRecord.setRequestStatus("FAILED"); + expectedRecord.setAction("createInstance"); + expectedRecord.setStatusMessage("Error parsing request: No valid modelType is specified"); + expectedRecord.setProgress(new Long(100)); + expectedRecord.setSource("VID"); + expectedRecord.setRequestBody(inputStream("/VfModuleNoModelType.json")); + expectedRecord.setLastModifiedBy("APIH"); + expectedRecord.setVfModuleName("testVfModule2"); + expectedRecord.setVfModuleModelName("serviceModel"); + expectedRecord.setRequestScope("vfModule"); + expectedRecord.setRequestAction("createInstance"); + expectedRecord.setRequestorId("zz9999"); + expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + //VnfType is not sent in this request, should be blank in db + expectedRecord.setVnfType(""); + uri = servInstanceuri + "v5/serviceInstances/32807a28-1a14-4b88-b7b3-2950918aa76d/vnfs/32807a28-1a14-4b88-b7b3-2950918aa76d/vfModules"; + + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelType.json"), uri, HttpMethod.POST); + //ActualRecord + InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").toString()); + assertNotNull(requestRecord.getStartTime()); + assertNotNull(requestRecord.getEndTime()); + } + @Test + public void inPlaceSoftwareUpdate() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/inPlaceSoftwareUpdate"; + ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void inPlaceSoftwareUpdateDuplicate() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + InfraActiveRequests req = new InfraActiveRequests(); + req.setRequestStatus("IN_PROGRESS"); + req.setAction("inPlaceSoftwareUpdate"); + req.setProgress(new Long(10)); + req.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json")); + req.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7908"); + req.setVnfId("ff305d54-75b4-431b-adb2-eb6b9e5ff033"); + req.setRequestScope("vnf"); + req.setVnfName("duplicateCheck123"); + req.setRequestAction("inPlaceSoftwareUpdate"); + req.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + iar.save(req); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7908/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff033/inPlaceSoftwareUpdate"; + ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate2.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatusCode().value()); + + InfraActiveRequests newRecord = iar.findOneByRequestBody(inputStream("/InPlaceSoftwareUpdate2.json")); + + assertNotNull(newRecord.getServiceInstanceId()); + assertNotNull(newRecord.getVnfId()); + + } + + @Test + public void deleteVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVfModule.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deactivateAndCloudDeleteVfModuleInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/deactivateAndCloudDelete"; + ResponseEntity<String> response = sendRequest(inputStream("/DeactivateAndCloudDeleteVfModule.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups"; + ResponseEntity<String> response = sendRequest(inputStream("/VolumeGroup.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + } + @Test + public void updateVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; + ResponseEntity<String> response = sendRequest(inputStream("/UpdateVolumeGroup.json"), uri, HttpMethod.PUT); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deleteVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVolumeGroup.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void createNetworkInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c4"; + headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreate.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + InfraActiveRequests record = iar.findOneByRequestId(requestId); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertEquals(record.getNetworkType(), "TestNetworkType"); + } + @Test + public void updateNetworkInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; + ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + } + @Test + public void deleteNetworkInstance() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deleteNetworkInstanceNoReqParams() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstanceNoReqParams.json"), uri, HttpMethod.DELETE); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void convertJsonToServiceInstanceRequestFail() throws JsonParseException, JsonMappingException, IOException { + headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + //ExpectedRecord + InfraActiveRequests expectedRecord = new InfraActiveRequests(); + expectedRecord.setRequestStatus("FAILED"); + expectedRecord.setStatusMessage("Error mapping request: "); + expectedRecord.setProgress(new Long(100)); + expectedRecord.setRequestBody(inputStream("/ConvertRequestFail.json")); + expectedRecord.setLastModifiedBy("APIH"); + expectedRecord.setRequestScope("network"); + expectedRecord.setRequestAction("deleteInstance"); + expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + + uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; + ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.DELETE); + + //ActualRecord + InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertThat(expectedRecord, sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").ignoring("statusMessage")); + assertThat(requestRecord.getStatusMessage(), containsString("Error mapping request: ")); + assertNotNull(requestRecord.getStartTime()); + assertNotNull(requestRecord.getEndTime()); + } + @Test + public void convertJsonToServiceInstanceRequestConfigurationFail() throws JsonParseException, JsonMappingException, IOException { + uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/configurations/test/enablePort"; + ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + } + + @Test + public void creatServiceInstanceGRTestApiNoCustomRecipeFound() throws IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v7" + "/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceMacro.json"), uri, HttpMethod.POST); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void createNetworkInstanceTestApiUndefinedUsePropertiesDefault() throws IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateAlternateInstanceName.json"), uri, HttpMethod.POST); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void createNetworkInstanceTestApiIncorrectUsePropertiesDefault() throws IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiIncorrect.json"), uri, HttpMethod.POST); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } + + @Test + public void createNetworkInstanceTestApiGrApi() throws IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiGrApi.json"), uri, HttpMethod.POST); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void createNetworkInstanceTestApiVnfApi() throws IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/CreateNetworkInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiVnfApi.json"), uri, HttpMethod.POST); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void activateServiceInstanceRequestStatus() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/ActivateInstance")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); + + InfraActiveRequests expectedRecord = new InfraActiveRequests(); + expectedRecord.setRequestStatus("FAILED"); + expectedRecord.setAction("activateInstance"); + expectedRecord.setStatusMessage("Recipe could not be retrieved from catalog DB."); + expectedRecord.setProgress(new Long(100)); + expectedRecord.setSource("VID"); + expectedRecord.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json")); + expectedRecord.setLastModifiedBy("APIH"); + expectedRecord.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7999"); + expectedRecord.setServiceInstanceName("testService1234"); + expectedRecord.setRequestScope("service"); + expectedRecord.setRequestAction("activateInstance"); + expectedRecord.setRequestorId("xxxxxx"); + expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7999/activate"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev8.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d"); + + //then + assertEquals(Status.IN_PROGRESS.name(), requestRecord.getRequestStatus()); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void invalidRequestId() throws IOException { + String illegalRequestId = "1234"; + headers.set("X-ECOMP-RequestID", illegalRequestId); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + assertTrue(response.getBody().contains("Request Id " + illegalRequestId + " is not a valid UUID")); + } + @Test + public void invalidBPELResponse() throws IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponseInvalid2.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertEquals("Request Failed due to BPEL error with HTTP Status = 202{\"instanceId\": \"1882939\"}", realResponse.getServiceException().getText()); + } + + @Test + public void invalidBPELResponse2() throws IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponseInvalid.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertTrue(realResponse.getServiceException().getText().contains("<aetgt:ErrorMessage>Exception in create execution list 500")); + } + + @Test + public void createMacroServiceInstance() throws JsonParseException, JsonMappingException, IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/CreateMacroServiceNetworkVnf")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceUriPrev7 + "v5"; + ResponseEntity<String> response = sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + + @Test + public void testUserParams() throws JsonParseException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class); + RequestParameters requestParameters = request.getRequestDetails().getRequestParameters(); + String userParamsTxt = inputStream("/userParams.txt"); + + List<Map<String, Object>> userParams = servInstances.configureUserParams(requestParameters); + System.out.println(userParams); + assertTrue(userParams.size() > 0); + assertTrue(userParams.get(0).containsKey("name")); + assertTrue(userParams.get(0).containsKey("value")); + assertTrue(userParamsTxt.replaceAll("\\s+","").equals(userParams.toString().replaceAll("\\s+",""))); + } + + @Test + public void testConfigureCloudConfig() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class); + CloudConfiguration cloudConfig = servInstances.configureCloudConfig(request.getRequestDetails().getRequestParameters()); + + assertEquals("mdt25b", cloudConfig.getLcpCloudRegionId()); + assertEquals("aefb697db6524ddebfe4915591b0a347", cloudConfig.getTenantId()); + } + + @Test + public void testMapToLegacyRequest() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class); + ServiceInstancesRequest expected = mapper.readValue(inputStream("/LegacyMacroServiceInstance.json"), ServiceInstancesRequest.class); + servInstances.mapToLegacyRequest(request.getRequestDetails()); + System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request)); + assertThat(request, sameBeanAs(expected)); + } + @Test + public void scaleOutVfModule() throws JsonParseException, JsonMappingException, IOException { + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + //expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7" + "/serviceInstances/7a88cbeb-0ec8-4765-a271-4f9e90c3da7b/vnfs/cbba721b-4803-4df7-9347-307c9a955426/vfModules/scaleOut"; + ResponseEntity<String> response = sendRequest(inputStream("/ScaleOutRequest.json"), uri, HttpMethod.POST); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertTrue(response.getBody().contains("1882939")); + } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json index 18b785cae5..57aea4d2bb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudConfiguration.json @@ -32,7 +32,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json index bd114f7ad8..e876711c66 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/InPlaceSoftwareUpdateCloudRegionId.json @@ -35,7 +35,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/ScaleOutNoCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/ScaleOutNoCloudConfig.json new file mode 100644 index 0000000000..1cc91500f0 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/CloudConfiguration/ScaleOutNoCloudConfig.json @@ -0,0 +1,50 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ConfigurationParameters/NoConfigurationParameters.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ConfigurationParameters/NoConfigurationParameters.json new file mode 100644 index 0000000000..2f3f42e135 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ConfigurationParameters/NoConfigurationParameters.json @@ -0,0 +1,54 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelCustomizationId.json new file mode 100644 index 0000000000..d1220ad949 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelCustomizationId.json @@ -0,0 +1,53 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelInvariantId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelInvariantId.json new file mode 100644 index 0000000000..9447250ef6 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelInvariantId.json @@ -0,0 +1,53 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelName.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelName.json new file mode 100644 index 0000000000..ca60ffcf41 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelName.json @@ -0,0 +1,53 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersion.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersion.json new file mode 100644 index 0000000000..b9914d374b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersion.json @@ -0,0 +1,53 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersionId.json new file mode 100644 index 0000000000..b4afcda4cf --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersionId.json @@ -0,0 +1,53 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersionVersion.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersionVersion.json new file mode 100644 index 0000000000..b9914d374b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/ScaleOutNoModelVersionVersion.json @@ -0,0 +1,53 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "MSO-DEV-VF-1806BB-vSAMP10a-base-it2-1", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ScaleOutNoRelatedInstances.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ScaleOutNoRelatedInstances.json new file mode 100644 index 0000000000..47f49a728a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ScaleOutNoRelatedInstances.json @@ -0,0 +1,34 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vfModule", + "modelInvariantId":"ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelCustomizationId":"cb82ffd8-252a-11e7-93ae-92361f002672", + "modelName":"vSAMP12..base..module-0", + "modelVersion":"1" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "instanceName":"MSOTEST103a-vSAMP12_base_module-0", + "source":"VID", + "suppressRollback":true, + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "usePreload":true, + "userParams":[ + + ] + }, + "configurationParameters":[ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json index b1c9e65bba..c917a9504e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v6VnfDeleteInstance.json @@ -36,7 +36,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json index 484f7bfc97..39cba3cfc8 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestInfo.json @@ -29,7 +29,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json index 8562be02b8..dbf47112f3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/RequestorId.json @@ -35,7 +35,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/ScaleOutNoRequestInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/ScaleOutNoRequestInfo.json new file mode 100644 index 0000000000..d403cc2af9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestInfo/ScaleOutNoRequestInfo.json @@ -0,0 +1,48 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "vSAMP10aDEV::base::module-0", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelVersion": "2", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo": { + "modelType": "service", + "modelName": "MSOTADevInfra_vSAMP10a_Service", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo": { + "modelType": "vnf", + "modelName": "vSAMP10a", + "modelVersionId": "d40be095-940e-4738-a72a-59aa9eb5671e", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelVersion": "1.0", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelCustomizationName": "vSAMP10a 1" + } + } + } + ], + "requestParameters": { + "usePreload": true, + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json index 476b9367c1..9a21a23ca0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceInPlaceSoftwareUpdate.json @@ -36,7 +36,7 @@ ], "requestParameters": { "autoBuildVfModules": false, - "payload": "{\"existing-software-version\": \"3.1\",\"new-software-version\": \"3.2\", \"operations-timeout\": \"3600\"}" + "payload": "{\"existing_software_version\": \"3.1\",\"new_software_version\": \"3.2\", \"operations_timeout\": \"3600\"}" } } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json new file mode 100644 index 0000000000..ba5a8a92e5 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json @@ -0,0 +1,71 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"vfModule", + "modelInvariantId":"ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelCustomizationId":"cb82ffd8-252a-11e7-93ae-92361f002672", + "modelName":"vSAMP12..base..module-0", + "modelVersion":"1" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"mdt1", + "tenantId":"88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo":{ + "instanceName":"MSOTEST103a-vSAMP12_base_module-0", + "source":"VID", + "suppressRollback":true, + "requestorId":"xxxxxx" + }, + "relatedInstanceList":[ + { + "relatedInstance":{ + "instanceId":"cbba721b-4803-4df7-9347-307c9a955426", + "instanceName":"MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo":{ + "modelType":"volumeGroup" + } + } + }, + { + "relatedInstance":{ + "instanceId":"7a88cbeb-0ec8-4765-a271-4f9e90c3da7b", + "modelInfo":{ + "modelType":"service", + "modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName":"{parent service model name}", + "modelVersion":"1.0" + } + } + }, + { + "relatedInstance":{ + "instanceId":"cbba721b-4803-4df7-9347-307c9a955426", + "modelInfo":{ + "modelType":"vnf", + "modelInvariantId":"ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelVersionId":"fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName":"vSAMP12", + "modelVersion":"1.0", + "modelCustomizationName":"vSAMP12 1", + "modelCustomizationId":"a7f1d08e-b02d-11e6-80f5-76304dec7eb7" + } + } + } + ], + "requestParameters":{ + "usePreload":true, + "userParams":[ + + ] + }, + "configurationParameters":[ + { + "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml index c5b3b70723..b7b6a8c1cb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml @@ -29,7 +29,7 @@ mso: catalog: db: spring: - endpoint: "http://localhost:" + endpoint: http://localhost:${wiremock.server.port} db: auth: Basic YnBlbDptc28tZGItMTUwNyE= config: diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql index 54984eeabb..70c0791055 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql @@ -224,8 +224,7 @@ INSERT INTO vnf_components_recipe(ID, VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, SERV ('19', 'vfModule', 'vfModule', 'createInstance', '', '1', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '', '180', '2016-09-14 19:18:20', '20c4431c-246d-11e7-93ae-92361f002672'), ('20', 'vfModule', 'vfModule', 'deleteInstance', '', '1', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), ('21', 'vfModule', 'vfModule', 'updateInstance', '', '1', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '', '180', '2016-09-14 19:18:20', 'VID_DEFAULT'), -('25', 'vfModule', 'vfModule', 'replaceInstance', '', '1', 'VID_DEFAULT vfModule replace', '/mso/async/services/ReplaceVfModuleInfra', '', '180', '2017-07-28 18:25:06', 'VID_DEFAULT'); - +('25', 'vfModule', 'vfModule', 'replaceInstance', '', '1', 'VID_DEFAULT vfModule replace', '/mso/async/services/ReplaceVfModuleInfra', '', '180', '2017-07-28 18:25:06', 'VID_DEFAULT'); INSERT INTO catalogdb.network_recipe(ID, MODEL_NAME, ACTION, DESCRIPTION, ORCHESTRATION_URI, NETWORK_PARAM_XSD, RECIPE_TIMEOUT, SERVICE_TYPE, CREATION_TIMESTAMP, VERSION_STR) VALUES ('17', 'VID_DEFAULT', 'createInstance', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstance', '', '180', '', '2016-09-14 19:18:20', '1.0'), @@ -274,7 +273,9 @@ VALUES ('vfModule', 'deleteInstance', '1', 'Gr api recipe to delete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), ('vfModule', 'updateInstance', '1', 'Gr api recipe to update vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), ('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), -('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'); +('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT'); + UPDATE vnf_components_recipe SET vf_module_model_uuid = 'VNF-API-DEFAULT' diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml index 1b3a7cc6da..4da57a15f9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml @@ -1,39 +1,41 @@ -<configuration > - - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n +<configuration> + + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n </pattern> - </encoder> - </appender> - <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender"/> - - - <logger name="AUDIT" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - <appender-ref ref = "test" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.error" level="ERROR" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + </encoder> + </appender> + <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender" /> + + + <logger name="AUDIT" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.error" level="ERROR" additivity="false"> <appender-ref ref="STDOUT" /> </logger> - - <logger name="com.att" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> - - <logger name="wiremock.org" level="ERROR" /> + + <logger name="org.onap" level="${so.log.level:-DEBUG}" + additivity="false"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </logger> + + <logger name="com.att" level="${so.log.level:-DEBUG}" + additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="wiremock.org" level="ERROR" /> </configuration>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java index c51e4edcea..22a1604bdd 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java @@ -23,12 +23,13 @@ package org.onap.so.db.request.data.repository; import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.beans.OperationStatusId; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; -@Repository +@RepositoryRestResource(collectionResourceRel = "operationStatusRepository", path = "operationStatusRepository") public interface OperationStatusRepository extends JpaRepository<OperationStatus, OperationStatusId> { - OperationStatus findOneByServiceIdAndOperationId(String serviceId, String operationId); + OperationStatus findOneByServiceIdAndOperationId(@Param("SERVICE_ID") String serviceId, @Param("OPERATION_ID") String operationId); public OperationStatus findOneByServiceName(String serviceName); public OperationStatus findOneByServiceId(String serviceId); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java index 7cb2222525..b1cb07447d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.db.catalog.beans; public enum AuthenticationType { USERNAME_PASSWORD, RACKSPACE_APIKEY; diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java index 188a93025e..b1c81cf8d8 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java @@ -18,60 +18,110 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.db.catalog.beans; import com.fasterxml.jackson.annotation.JsonProperty; import com.openpojo.business.annotation.BusinessKey; import org.apache.commons.lang3.builder.HashCodeBuilder; - -import java.util.Comparator; +import java.util.Date; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + /** - * JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity + * EntityBean class for a CloudIdentity. This bean represents a cloud identity * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via - * CloudConfig object, of which it is a component (a CloudConfig JSON configuration - * file may contain multiple CloudIdentity definitions). - * - * Note that this is only used to access Cloud Configurations loaded from a - * JSON config file, so there are no explicit setters. + * CloudConfig object, of which it is a component. * */ +@Entity +@Table(name = "identity_services") public class CloudIdentity { - + @JsonProperty @BusinessKey + @Id + @Column(name = "ID") private String id; + @JsonProperty("identity_url") @BusinessKey + @Column(name = "IDENTITY_URL") private String identityUrl; + @JsonProperty("mso_id") @BusinessKey + @Column(name = "MSO_ID") private String msoId; + @JsonProperty("mso_pass") @BusinessKey + @Column(name = "MSO_PASS") private String msoPass; + @JsonProperty("admin_tenant") @BusinessKey + @Column(name = "ADMIN_TENANT") private String adminTenant; + @JsonProperty("member_role") @BusinessKey + @Column(name = "MEMBER_ROLE") private String memberRole; + @JsonProperty("tenant_metadata") @BusinessKey + @Column(name = "TENANT_METADATA") private Boolean tenantMetadata; + @JsonProperty("identity_server_type") @BusinessKey + @Enumerated(EnumType.STRING) + @Column(name = "IDENTITY_SERVER_TYPE") private ServerType identityServerType; + @JsonProperty("identity_authentication_type") @BusinessKey + @Enumerated(EnumType.STRING) + @Column(name = "IDENTITY_AUTHENTICATION_TYPE") private AuthenticationType identityAuthenticationType; + + @JsonProperty("last_updated_by") + @BusinessKey + @Column(name = "LAST_UPDATED_BY") + private String lastUpdatedBy ; + + @JsonProperty("creation_timestamp") + @BusinessKey + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @JsonProperty("update_timestamp") + @BusinessKey + @Column(name = "UPDATE_TIMESTAMP") + @Temporal(TemporalType.TIMESTAMP) + private Date updated; public CloudIdentity() {} + @PrePersist + protected void onCreate() { + this.created = new Date(); + this.updated = new Date(); + } + public String getId () { return id; } @@ -107,6 +157,30 @@ public class CloudIdentity { return adminTenant; } + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public Date getCreated() { + return created; + } + + public Date getUpdated() { + return updated; + } + + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + public void setAdminTenant (String tenant) { this.adminTenant = tenant; } @@ -119,7 +193,7 @@ public class CloudIdentity { this.memberRole = role; } - public Boolean hasTenantMetadata () { + public Boolean getTenantMetadata() { return tenantMetadata; } @@ -172,7 +246,7 @@ public class CloudIdentity { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId()) .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId()) .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole()) - .append("tenantMetadata", hasTenantMetadata()).append("identityServerType", getIdentityServerType()) + .append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType()) .append("identityAuthenticationType", getIdentityAuthenticationType()).toString(); } @@ -189,7 +263,7 @@ public class CloudIdentity { .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId()) .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant()) .append(getMemberRole(), castOther.getMemberRole()) - .append(hasTenantMetadata(), castOther.hasTenantMetadata()) + .append(getTenantMetadata(), castOther.getTenantMetadata()) .append(getIdentityServerType(), castOther.getIdentityServerType()) .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals(); } @@ -197,7 +271,7 @@ public class CloudIdentity { @Override public int hashCode() { return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId()) - .append(getMsoPass()).append(getAdminTenant()).append(getMemberRole()).append(hasTenantMetadata()) + .append(getMsoPass()).append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata()) .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode(); } }
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java new file mode 100644 index 0000000000..9cce212c36 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java @@ -0,0 +1,263 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * EntityBean class for a CloudSite. This bean represents a cloud location + * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig + * object, of which it is a component + * + */ +@Entity +@Table(name = "cloud_sites") +public class CloudSite { + + @JsonProperty + @BusinessKey + @Id + @Column(name = "ID") + private String id; + + @JsonProperty("region_id") + @BusinessKey + @Column(name = "REGION_ID") + private String regionId; + + @JsonProperty("aic_version") + @BusinessKey + @Column(name = "CLOUD_VERSION") + private String cloudVersion; + + @JsonProperty("clli") + @BusinessKey + @Column(name = "CLLI") + private String clli; + + @JsonProperty("platform") + @BusinessKey + @Column(name = "PLATFORM") + private String platform; + + @JsonProperty("orchestrator") + @BusinessKey + @Column(name = "ORCHESTRATOR") + private String orchestrator; + + @JsonProperty("cloudify_id") + @BusinessKey + @Column(name = "CLOUDIFY_ID") + private String cloudifyId; + + // Derived property (set by CloudConfig loader based on identityServiceId) + @BusinessKey + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "IDENTITY_SERVICE_ID") + private CloudIdentity identityService; + + @BusinessKey + @JsonProperty("identity_service_id") + private transient String identityServiceId; + + @JsonProperty("last_updated_by") + @BusinessKey + @Column(name = "LAST_UPDATED_BY") + private String lastUpdatedBy ; + + @JsonProperty("creation_timestamp") + @BusinessKey + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @JsonProperty("update_timestamp") + @BusinessKey + @Column(name = "UPDATE_TIMESTAMP") + @Temporal(TemporalType.TIMESTAMP) + private Date updated; + + public CloudSite() { + + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + this.updated = new Date(); + } + + public CloudSite(CloudSite site) { + this.cloudVersion = site.getCloudVersion(); + this.clli = site.getClli(); + this.id = site.getId(); + this.identityService = site.getIdentityService(); + this.orchestrator = site.getOrchestrator(); + this.platform = site.getPlatform(); + this.regionId = site.getRegionId(); + this.identityServiceId = site.getIdentityServiceId(); + } + + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRegionId() { + return regionId; + } + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + + public String getIdentityServiceId() { + return identityServiceId == null ? (identityService== null? null:identityService.getId()):identityServiceId; + } + + public String getCloudVersion() { + return cloudVersion; + } + + public void setCloudVersion(String cloudVersion) { + this.cloudVersion = cloudVersion; + } + + public String getClli() { + return clli; + } + + public void setClli(String clli) { + this.clli = clli; + } + + public String getCloudifyId() { + return cloudifyId; + } + + public void setCloudifyId(String cloudifyId) { + this.cloudifyId = cloudifyId; + } + + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public Date getCreated() { + return created; + } + + public Date getUpdated() { + return updated; + } + + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getOrchestrator() { + return orchestrator; + } + + public void setOrchestrator(String orchestrator) { + this.orchestrator = orchestrator; + } + + public CloudIdentity getIdentityService () { + return identityService; + } + + public void setIdentityService (CloudIdentity identity) { + this.identityService = identity; + } + @Deprecated + public void setIdentityServiceId(String identityServiceId) { + this.identityServiceId = identityServiceId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId()) + .append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion()) + .append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform()) + .append("orchestrator", getOrchestrator()).toString(); + } + + @Override + public boolean equals(final Object other) { + if (other == null) { + return false; + } + if (!getClass().equals(other.getClass())) { + return false; + } + CloudSite castOther = (CloudSite) other; + return new EqualsBuilder().append(getRegionId(), castOther.getRegionId()) + .append(getIdentityServiceId(), castOther.getIdentityServiceId()) + .append(getCloudVersion(), castOther.getCloudVersion()).append(getClli(), castOther.getClli()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getCloudVersion()) + .append(getClli()).toHashCode(); + } +}
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java index 1bf3f136b0..eb9078fd57 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java @@ -18,24 +18,29 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.db.catalog.beans; -import java.security.GeneralSecurityException; -import java.util.Comparator; - -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.CryptoUtils; +import java.util.Date; import com.fasterxml.jackson.annotation.JsonProperty; import com.openpojo.business.annotation.BusinessKey; +import org.onap.so.logger.MsoLogger; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.EqualsBuilder; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + /** - * JavaBean JSON class for a Cloudify Manager. This bean represents a Cloudify + * EntityBean class for a Cloudify Manager. This bean represents a Cloudify * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints. * Cloudify Managers may support multiple Cloud Sites, but each site will have @@ -43,36 +48,62 @@ import org.apache.commons.lang3.builder.EqualsBuilder; * * This does not replace the ability to use the CloudSite directly via Openstack. * - * Note that this is only used to access Cloud Configurations loaded from a - * JSON config file, so there are no explicit setters. - * * @author JC1348 */ +@Entity +@Table(name = "cloudify_managers") public class CloudifyManager { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CloudifyManager.class); - - @BusinessKey @JsonProperty + @BusinessKey + @Id + @Column(name = "ID") private String id; @BusinessKey @JsonProperty ("cloudify_url") + @Column(name = "CLOUDIFY_URL") private String cloudifyUrl; @BusinessKey @JsonProperty("username") + @Column(name = "USERNAME") private String username; @BusinessKey @JsonProperty("password") + @Column(name = "PASSWORD") private String password; @BusinessKey @JsonProperty("version") + @Column(name = "VERSION") private String version; + @JsonProperty("last_updated_by") + @BusinessKey + @Column(name = "LAST_UPDATED_BY") + private String lastUpdatedBy ; + + @JsonProperty("creation_timestamp") + @BusinessKey + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @JsonProperty("update_timestamp") + @BusinessKey + @Column(name = "UPDATE_TIMESTAMP") + @Temporal(TemporalType.TIMESTAMP) + private Date updated; + public CloudifyManager() {} + + @PrePersist + protected void onCreate() { + this.created = new Date(); + this.updated = new Date(); + } public String getId() { return id; @@ -113,6 +144,30 @@ public class CloudifyManager { this.version = version; } + public String getLastUpdatedBy() { + return lastUpdatedBy; + } + + public Date getCreated() { + return created; + } + + public Date getUpdated() { + return updated; + } + + public void setLastUpdatedBy(String lastUpdatedBy) { + this.lastUpdatedBy = lastUpdatedBy; + } + + public void setCreated(Date created) { + this.created = created; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + @Override public CloudifyManager clone() { CloudifyManager cloudifyManagerCopy = new CloudifyManager(); diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java index ac59018c6b..d8d386db8c 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.db.catalog.beans; public enum ServerType { KEYSTONE, ORM; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index d3a1c5d8d6..0caafc794b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -20,14 +20,6 @@ package org.onap.so.db.catalog.client; -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.ws.rs.core.UriBuilder; - import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; @@ -40,77 +32,103 @@ import org.onap.so.db.catalog.beans.ResourceType; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.CloudifyManager; +import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpRequest; import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; - import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; import uk.co.blackpepper.bowman.RestTemplateConfigurer; +import javax.annotation.PostConstruct; +import javax.ws.rs.core.UriBuilder; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + @Component("CatalogDbClient") public class CatalogDbClient { - protected Client<Service> serviceClient; + private static final String SERVICE_RECIPE_SEARCH = "/serviceRecipe/search"; + private static final String SERVICE_MODEL_UUID = "SERVICE_MODEL_UUID"; + private static final String ACTION = "ACTION"; + private static final String MODEL_NAME = "MODEL_NAME"; + private static final String SERVICE_SEARCH = "/service/search"; + private static final String MODEL_VERSION = "MODEL_VERSION"; + private static final String MODEL_INVARIANT_UUID = "MODEL_INVARIANT_UUID"; + private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc"; + private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction"; + private String findByModelVersionAndModelInvariantUUIDURI = "/findByModelVersionAndModelInvariantUUID"; + + private Client<Service> serviceClient; - protected Client<VfModuleCustomization> vfModuleCustomizationClient; + private Client<VfModuleCustomization> vfModuleCustomizationClient; - protected Client<OrchestrationFlow> orchestrationClient; + private Client<OrchestrationFlow> orchestrationClient; - protected Client<NorthBoundRequest> northBoundRequestClient; + private Client<NorthBoundRequest> northBoundRequestClient; - protected Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient; + private Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient; - protected Client<BuildingBlockDetail> buildingBlockDetailClient; + private Client<BuildingBlockDetail> buildingBlockDetailClient; - protected Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient; + private Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient; - protected Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient; + private Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient; - protected Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient; + private Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient; - protected Client<InstanceGroup> instanceGroupClient; + private Client<InstanceGroup> instanceGroupClient; - protected Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient; + private Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient; - protected Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient; + private Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient; + + private Client<ServiceRecipe> serviceRecipeClient; + + private Client<CloudSite> cloudSiteClient; + + private Client<CloudIdentity> cloudIdentityClient; + + private Client<CloudifyManager> cloudifyManagerClient; @Value("${mso.catalog.db.spring.endpoint}") - protected String endpoint; + private String endpoint; @Value("${mso.db.auth}") private String msoAdaptersAuth; + @PostConstruct + public void init(){ + findFirstByModelNameURI = endpoint + SERVICE_SEARCH + findFirstByModelNameURI; + findByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE_SEARCH + findByModelVersionAndModelInvariantUUIDURI; + findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE_SEARCH + findFirstByServiceModelUUIDAndActionURI; + } + public CatalogDbClient() { ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()); - ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(new RestTemplateConfigurer() { - - public void configure(RestTemplate restTemplate) { - restTemplate.getInterceptors().add((new SpringClientFilter())); - - restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { - - public ClientHttpResponse intercept(HttpRequest request, byte[] body, - ClientHttpRequestExecution execution) throws IOException { - - request.getHeaders().add("Authorization", msoAdaptersAuth); - return execution.execute(request, body); - } - }); - } + ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { + restTemplate.getInterceptors().add((new SpringClientFilter())); + + restTemplate.getInterceptors().add((request, body, execution) -> { + + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + }); }).build().buildClientFactory(); serviceClient = clientFactory.create(Service.class); orchestrationClient = clientFactory.create(OrchestrationFlow.class); @@ -126,6 +144,10 @@ public class CatalogDbClient { instanceGroupClient = clientFactory.create(InstanceGroup.class); networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class); collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class); + cloudSiteClient = clientFactory.create(CloudSite.class); + cloudIdentityClient = clientFactory.create(CloudIdentity.class); + cloudifyManagerClient = clientFactory.create(CloudifyManager.class); + serviceRecipeClient = clientFactory.create(ServiceRecipe.class); } public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) { @@ -198,7 +220,7 @@ public class CatalogDbClient { return this.getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/").build()); } - protected List<OrchestrationFlow> getMultipleOrchestrationFlows(URI uri) { + private List<OrchestrationFlow> getMultipleOrchestrationFlows(URI uri) { Iterable<OrchestrationFlow> orchIterator = orchestrationClient.getAll(uri); List<OrchestrationFlow> orchList = new ArrayList<>(); Iterator<OrchestrationFlow> it = orchIterator.iterator(); @@ -229,7 +251,7 @@ public class CatalogDbClient { return collectionInstanceGroupCustList; } - protected List<VnfcInstanceGroupCustomization> getMultipleVnfcInstanceGroupCustomizations(URI uri) { + private List<VnfcInstanceGroupCustomization> getMultipleVnfcInstanceGroupCustomizations(URI uri) { Iterable<VnfcInstanceGroupCustomization> vnfcIterator = vnfcInstanceGroupCustomizationClient.getAll(uri); List<VnfcInstanceGroupCustomization> vnfcList = new ArrayList<>(); Iterator<VnfcInstanceGroupCustomization> it = vnfcIterator.iterator(); @@ -264,35 +286,83 @@ public class CatalogDbClient { .build()); } - protected CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) { + public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action){ + return this.getSingleServiceRecipe(UriBuilder.fromUri(findFirstByServiceModelUUIDAndActionURI) + .queryParam(SERVICE_MODEL_UUID,modelUUID) + .queryParam(ACTION,action) + .build()); + } + + public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){ + return this.getSingleService(UriBuilder.fromUri(findFirstByModelNameURI) + .queryParam(MODEL_NAME,modelName) + .build()); + } + + + private CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) { return collectionNetworkResourceCustomizationClient.get(uri); } - protected InstanceGroup getSingleInstanceGroup(URI uri) { + public CloudifyManager getCloudifyManager(String id) { + return this.getSingleCloudifyManager(UriBuilder.fromUri(endpoint+"/cloudifyManager/"+id).build()); + } + + public CloudSite getCloudSite(String id){ + return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/"+id).build()); + } + + public CloudIdentity getCloudIdentity(String id){ + return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build()); + } + + public CloudSite getCloudSiteByClliAndAicVersion (String clli, String aicVersion){ + return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloud_sites/search/findByClliAndCloudVersion") + .queryParam("CLLI",clli).queryParam("AIC_VERSION",aicVersion) + .build()); + } + + private InstanceGroup getSingleInstanceGroup(URI uri) { return instanceGroupClient.get(uri); } - protected Service getSingleService(URI uri) { + private Service getSingleService(URI uri) { return serviceClient.get(uri); } - protected VfModuleCustomization getSingleVfModuleCustomization(URI uri) { + private VfModuleCustomization getSingleVfModuleCustomization(URI uri) { return vfModuleCustomizationClient.get(uri); } - protected NorthBoundRequest getSingleNorthBoundRequest(URI uri) { + private NorthBoundRequest getSingleNorthBoundRequest(URI uri) { return northBoundRequestClient.get(uri); } - protected RainyDayHandlerStatus getSingleRainyDayHandlerStatus(URI uri) { + private RainyDayHandlerStatus getSingleRainyDayHandlerStatus(URI uri) { return rainyDayHandlerStatusClient.get(uri); } + + private ServiceRecipe getSingleServiceRecipe(URI uri){ + return serviceRecipeClient.get(uri); + } + + protected CloudSite getSinglCloudSite(URI uri) { + return cloudSiteClient.get(uri); + } + + protected CloudIdentity getSingleCloudIdentity(URI uri) { + return cloudIdentityClient.get(uri); + } + + protected CloudifyManager getSingleCloudifyManager(URI uri) { + return cloudifyManagerClient.get(uri); + } public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) { return this.getSingleService( - UriBuilder.fromUri(endpoint + "/service/search/findByModelVersionAndModelInvariantUUID") - .queryParam("MODEL_VERSION", modelVersion) - .queryParam("MODEL_INVARIANT_UUID", modelInvariantUUID).build()); + UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI) + .queryParam(MODEL_VERSION, modelVersion) + .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build()); } //USED FOR TEST ONLY diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java new file mode 100644 index 0000000000..78f117b3ae --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java @@ -0,0 +1,14 @@ +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.CloudSite; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +import javax.transaction.Transactional; + +@RepositoryRestResource(collectionResourceRel = "cloudSite", path = "cloudSite") +@Transactional +public interface CloudSiteRepository extends JpaRepository<CloudSite, String> { + + CloudSite findByClliAndCloudVersion(String clli, String aicVersion); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java new file mode 100644 index 0000000000..dfa677b402 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java @@ -0,0 +1,10 @@ +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.CloudifyManager; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "cloudifyManager", path = "cloudifyManager") +public interface CloudifyManagerRepository extends JpaRepository<CloudifyManager, String> { + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java index 57578cfb07..cd46846d78 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java @@ -22,6 +22,7 @@ package org.onap.so.db.catalog.data.repository; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "serviceRecipe", path = "serviceRecipe") @@ -30,5 +31,5 @@ public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Lo public ServiceRecipe findByAction(String action); - public ServiceRecipe findFirstByServiceModelUUIDAndAction(String serviceModelUUID, String action); + public ServiceRecipe findFirstByServiceModelUUIDAndAction(@Param("SERVICE_MODEL_UUID") String serviceModelUUID, @Param("ACTION") String action); }
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java index eac432a4dd..25b1757185 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java @@ -41,7 +41,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> { * @return */ @Query(value = "SELECT * FROM service WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) - Service findFirstByModelNameOrderByModelVersionDesc(String modelName); + Service findFirstByModelNameOrderByModelVersionDesc(@Param("MODEL_NAME") String modelName); /** * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting @@ -59,7 +59,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> { /** * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting - * @param modelName + * @param modelUUID * @return */ @Query(value = "SELECT * FROM service WHERE MODEL_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) @@ -67,7 +67,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> { /** * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting - * @param modelName + * @param modelUUID * @return */ @Query(value = "SELECT * FROM service WHERE MODEL_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) @@ -78,7 +78,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> { /** * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting - * @param modelName + * @param modelInvariantUUID * @return */ @Query(value = "SELECT * FROM service WHERE MODEL_INVARIANT_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) diff --git a/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..6e6db11c45 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,15 @@ +package org.onap.so; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class BaseTest { + @Test + public void testNothing(){} +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java index db2ba05bf1..f8f3435fe1 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.db.catalog.beans; import static org.junit.Assert.assertEquals; @@ -27,6 +27,9 @@ import static org.junit.Assert.assertTrue; import java.security.GeneralSecurityException; import org.junit.Test; +import org.onap.so.db.catalog.beans.AuthenticationType; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.utils.CryptoUtils; public class CloudIdentityTest { @@ -61,7 +64,7 @@ public class CloudIdentityTest { assertTrue (id.getMemberRole ().equals ("member")); assertTrue (id.getMsoId ().equals ("msoId")); assertTrue (CryptoUtils.decryptCloudConfigPassword(id.getMsoPass()).equals ("password")); - assertTrue (id.hasTenantMetadata ()); + assertTrue (id.getTenantMetadata ()); // assertTrue (id.toString ().contains ("keystone")); assertTrue(id.toString().contains("null")); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java index 9a660b4d40..2405a413cf 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java @@ -18,10 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.db.catalog.beans; import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.onap.so.db.catalog.beans.CloudifyManager; public class CloudifyManagerTest { diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java new file mode 100644 index 0000000000..5a0770ead6 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java @@ -0,0 +1,37 @@ +package org.onap.so.db.catalog.data.repository; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.db.catalog.beans.CloudSite; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +public class CloudSiteRepositoryTest extends BaseTest { + + @Autowired + private CloudSiteRepository cloudSiteRepository; + + @Test + public void findByClliAndAicVersionTest() throws Exception { + CloudSite cloudSite = cloudSiteRepository.findByClliAndCloudVersion("MDT13","2.5"); + Assert.assertNotNull(cloudSite); + Assert.assertEquals("mtn13",cloudSite.getId()); + } + + @Test + public void findOneTest() throws Exception { + CloudSite cloudSite = cloudSiteRepository.findOne("mtn13"); + Assert.assertNotNull(cloudSite); + Assert.assertEquals("mtn13",cloudSite.getId()); + } + + @Test + public void findAllTest() throws Exception { + List<CloudSite> cloudSiteList = cloudSiteRepository.findAll(); + Assert.assertFalse(CollectionUtils.isEmpty(cloudSiteList)); + } + +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java new file mode 100644 index 0000000000..21f95a7727 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java @@ -0,0 +1,21 @@ +package org.onap.so.db.catalog.data.repository; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.db.catalog.beans.CloudifyManager; +import org.springframework.beans.factory.annotation.Autowired; + +public class CloudifyManagerRepositoryTest extends BaseTest { + + @Autowired + private CloudifyManagerRepository cloudifyManagerRepository; + + @Test + public void findOneTest() throws Exception { + CloudifyManager cloudifyManager = cloudifyManagerRepository.findOne("mtn13"); + Assert.assertNotNull(cloudifyManager); + Assert.assertEquals("mtn13", cloudifyManager.getId()); + } + +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index 604f493cf0..e16ca0fe8f 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -641,3 +641,10 @@ VALUES ('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), ('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), ('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); + + +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 `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');
\ No newline at end of file diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index b4b9c0d28b..8ff04ea038 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -823,4 +823,53 @@ create table if not exists model ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `vnf_recipe` -CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
\ No newline at end of file +CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; + +CREATE TABLE IF NOT EXISTS `identity_services` ( + `ID` varchar(50) NOT NULL, + `IDENTITY_URL` varchar(200) DEFAULT NULL, + `MSO_ID` varchar(255) DEFAULT NULL, + `MSO_PASS` varchar(255) DEFAULT NULL, + `ADMIN_TENANT` varchar(50) DEFAULT NULL, + `MEMBER_ROLE` varchar(50) DEFAULT NULL, + `TENANT_METADATA` tinyint(1) DEFAULT 0, + `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, + `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + +CREATE TABLE IF NOT EXISTS `cloudify_managers` ( + `ID` varchar(50) NOT NULL, + `CLOUDIFY_URL` varchar(200) DEFAULT NULL, + `USERNAME` varchar(255) DEFAULT NULL, + `PASSWORD` varchar(255) DEFAULT NULL, + `VERSION` varchar(20) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`) +) ; + + + + +CREATE TABLE IF NOT EXISTS `cloud_sites` ( + `ID` varchar(50) NOT NULL, + `REGION_ID` varchar(11) DEFAULT NULL, + `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, + `CLOUD_VERSION` varchar(20) DEFAULT NULL, + `CLLI` varchar(11) DEFAULT NULL, + `CLOUDIFY_ID` varchar(50) DEFAULT NULL, + `PLATFORM` varchar(50) DEFAULT NULL, + `ORCHESTRATOR` varchar(50) DEFAULT NULL, + `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, + `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`), + KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), + CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) +) ;
\ No newline at end of file diff --git a/packages/deliveries/pom.xml b/packages/deliveries/pom.xml deleted file mode 100644 index f61348b9ba..0000000000 --- a/packages/deliveries/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.so</groupId> - <artifactId>packages</artifactId> - <version>1.3.0-SNAPSHOT</version> - </parent> - - <groupId>org.onap.packages</groupId> - <artifactId>so-deliveries</artifactId> - <packaging>pom</packaging> - - <name>MsoDeliveries</name> - - <description>This project is responsible of the final packages</description> - <organization> - <name>ONAP - SO</name> - <url>http://www.onap.org/</url> - </organization> - - - <build> - - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>2.6</version> - <executions> - - <!-- MSO DB PACKS --> - <execution> - <configuration> - - <descriptors> - <descriptor>src/main/assembly/mso-config/mso-db.xml</descriptor> - </descriptors> - <finalName>mso-config/mso-db-${project.version}</finalName> - <appendAssemblyId>false</appendAssemblyId> - <attach>false</attach> - </configuration> - - <id>db-packs-mso</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - - </execution> - - - </executions> - </plugin> - - </plugins> - </build> - -</project> diff --git a/packages/deliveries/src/main/assembly/mso-config/mso-db.xml b/packages/deliveries/src/main/assembly/mso-config/mso-db.xml deleted file mode 100644 index 6e7bcf7ed9..0000000000 --- a/packages/deliveries/src/main/assembly/mso-config/mso-db.xml +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - OpenECOMP MSO - ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - --> - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd"> - <id>mso-db</id> - - <formats> - <format>zip</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - - <fileSets> - - <!-- include MSO Extra files (scripts, db scripts) --> - <fileSet> - <includes> - <include>**/</include> - </includes> - <directory>../../packages/root-pack-extras/config-resources/mariadb/db-sql-scripts</directory> - <outputDirectory>/</outputDirectory> - </fileSet> - - </fileSets> -</assembly> diff --git a/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml b/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml deleted file mode 100644 index 2b09451dcc..0000000000 --- a/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml +++ /dev/null @@ -1,120 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - ECOMP MSO - ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - --> - -<assembly - xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd"> - <id>mso-dev</id> - - <formats> - <format>tar.gz</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - - - <fileSets> - - <!-- include config files --> - - <fileSet> - <includes> - <include>mso-network-adapter*.war</include> - </includes> - <directory>../../adapters/mso-network-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <fileSet> - <includes> - <include>mso-sdnc-adapter*.war</include> - </includes> - <directory>../../adapters/mso-sdnc-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <fileSet> - <includes> - <include>mso-tenant-adapter*.war</include> - </includes> - <directory>../../adapters/mso-tenant-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <fileSet> - <includes> - <include>mso-vnf-adapter*.war</include> - </includes> - <directory>../../adapters/mso-vnf-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <!--add vfc adapter--> - <fileSet> - <includes> - <include>mso-vfc-adapter*.war</include> - </includes> - <directory>../../adapters/mso-vfc-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <fileSet> - <includes> - <include>mso-api-handler*.war</include> - </includes> - <directory>../../mso-api-handlers/mso-api-handler-infra/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <fileSet> - <includes> - <include>mso-requests-db-adapter*.war</include> - </includes> - <directory>../../adapters/mso-requests-db-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - - <fileSet> - <includes> - <include>mso-catalog-db-adapter*.war</include> - </includes> - <directory>../../adapters/mso-catalog-db-adapter/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - - <fileSet> - <includes> - <include>asdc-controller*.war</include> - </includes> - <directory>../../asdc-controller/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - - <fileSet> - <includes> - <include>MSOInfrastructureBPMN*.war</include> - </includes> - <directory>../../bpmn/MSOInfrastructureBPMN/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - <fileSet> - <includes> - <include>MSOCockpit*.war</include> - </includes> - <directory>../../bpmn/MSOCockpit/target/</directory> - <outputDirectory>artifacts</outputDirectory> - </fileSet> - </fileSets> - -</assembly> diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index 9f96b2fcd0..eed81b9ca9 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -72,7 +72,7 @@ <images> <image> - <name>so/base-image:1.0</name> + <name>onap/so/base-image:1.0</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -80,7 +80,7 @@ </build> </image> <image> - <name>so/catalog-db-adapter</name> + <name>onap/so/catalog-db-adapter</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -105,7 +105,7 @@ </build> </image> <image> - <name>so/request-db-adapter</name> + <name>onap/so/request-db-adapter</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -130,7 +130,7 @@ </build> </image> <image> - <name>so/sdnc-adapter</name> + <name>onap/so/sdnc-adapter</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -155,7 +155,7 @@ </build> </image> <image> - <name>so/openstack-adapter</name> + <name>onap/so/openstack-adapter</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -180,7 +180,7 @@ </build> </image> <image> - <name>so/vfc-adapter</name> + <name>onap/so/vfc-adapter</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -205,7 +205,7 @@ </build> </image> <image> - <name>so/asdc-controller</name> + <name>onap/so/asdc-controller</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -230,7 +230,7 @@ </build> </image> <image> - <name>so/bpmn-infra</name> + <name>onap/so/bpmn-infra</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -255,7 +255,7 @@ </build> </image> <image> - <name>so/api-handler-infra</name> + <name>onap/so/api-handler-infra</name> <build> <cleanup>try</cleanup> <dockerFileDir>docker-files</dockerFileDir> @@ -310,7 +310,7 @@ <goal>push</goal> </goals> <configuration> - <image>so/catalog-db-adapter,so/request-db-adapter,so/sdnc-adapter,so/openstack-adapter,so/vfc-adapter,so/asdc-controller,so/bpmn-infra,so/api-handler-infra</image> + <image>onap/so/catalog-db-adapter,onap/so/request-db-adapter,onap/so/sdnc-adapter,onap/so/openstack-adapter,onap/so/vfc-adapter,onap/so/asdc-controller,onap/so/bpmn-infra,onap/so/api-handler-infra</image> </configuration> </execution> </executions> diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app index 69b88d8905..88031db0cd 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app @@ -1,4 +1,4 @@ -FROM so/base-image:1.0 +FROM onap/so/base-image:1.0 ARG http_proxy ENV HTTP_PROXY=$http_proxy diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml index dbba5da9b0..df6d92163b 100644 --- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -166,6 +166,7 @@ name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level" level="WARN" /> + <logger name="db.migration" level="DEBUG" /> <logger name="org.apache.wire" level="DEBUG" /> <logger name="org.onap" level="DEBUG" /> <logger name="com.att.ecomp" level="DEBUG" /> @@ -185,4 +186,4 @@ <appender-ref ref="asyncError" /> </root> -</configuration>
\ No newline at end of file +</configuration> diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh index df2e646138..84c2b48f12 100644 --- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh +++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh @@ -73,7 +73,7 @@ if [ ! -z "${TRUSTSTORE}" ]; then jksargs="$jksargs -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}" fi -jvmargs="${JVM_ARGS} -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}" +jvmargs="${JVM_ARGS} -Djava.security.egd=file:/dev/./urandom -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}" echo "JVM Arguments: ${jvmargs}" diff --git a/packages/pom.xml b/packages/pom.xml index 578127d80c..79b848565d 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -20,16 +20,12 @@ <activation> <activeByDefault>true</activeByDefault> </activation> - <modules> - <module>deliveries</module> - </modules> </profile> <!-- Those profile are exclusive, choose docker or with-integration-tests --> <profile> <id>docker</id> - <modules> - <module>deliveries</module> + <modules> <module>docker</module> </modules> <properties> @@ -37,18 +33,5 @@ <docker.skip.push>false</docker.skip.push> </properties> </profile> - - <profile> - <id>with-integration-tests</id> - <modules> - <module>deliveries</module> - <module>docker</module> - </modules> - <properties> - <!-- For this profile we want to skip the docker push (if deploy goal is specified) --> - <docker.skip.push>true</docker.skip.push> - </properties> - </profile> - </profiles> </project> diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/.gitignore b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/.gitignore deleted file mode 100644 index 568f8e96a3..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/main-schemas/ diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql deleted file mode 100644 index 146ad01605..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql +++ /dev/null @@ -1,49 +0,0 @@ -SOURCE ../default/create_mso_db-default.sql - -USE `mso_requests`; -DROP USER 'mso'; -CREATE USER 'mso'; -GRANT ALL on mso_requests.* to 'mso' identified by 'mso123' with GRANT OPTION; -FLUSH PRIVILEGES; - -USE `mso_catalog`; -DROP USER 'catalog'; -CREATE USER 'catalog'; -GRANT ALL on mso_catalog.* to 'catalog' identified by 'catalog123' with GRANT OPTION; -FLUSH PRIVILEGES; - -LOCK TABLES `NETWORK_RESOURCE` WRITE; -/*!40000 ALTER TABLE `NETWORK_RESOURCE` DISABLE KEYS */; -/*!40000 ALTER TABLE `NETWORK_RESOURCE` ENABLE KEYS */; -insert into NETWORK_RESOURCE (id, NETWORK_TYPE, VERSION_STR, ORCHESTRATION_MODE ,DESCRIPTION, TEMPLATE_ID, NEUTRON_NETWORK_TYPE, AIC_VERSION_MIN) values -(1, "vlan",'1',"NEUTRON","Cool network",1,"BASIC","0"); -UNLOCK TABLES; - -LOCK TABLES `NETWORK_RECIPE` WRITE; -/*!40000 ALTER TABLE `NETWORK_RECIPE` DISABLE KEYS */; -INSERT INTO `NETWORK_RECIPE`(`NETWORK_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES -('vlan','CREATE','1',NULL,'/active-bpel/services/REST/CreateNetwork',NULL,180,NULL), -('vlan','DELETE','1',NULL,'/active-bpel/services/REST/DeleteNetwork',NULL,180,NULL); -/*!40000 ALTER TABLE `NETWORK_RECIPE` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `VNF_RECIPE` WRITE; -INSERT INTO `VNF_RECIPE`(`ID`, `VNF_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES -(100,'VPE','CREATE','1','','/active-bpel/services/REST/CreateGenericVNF','',180,'SDN-ETHERNET-INTERNET'), -(101,'VPE','DELETE','1','','/active-bpel/services/REST/DeleteGenericVNF','',180,'SDN-ETHERNET-INTERNET'); -UNLOCK TABLES; - -LOCK TABLES `VF_MODULE` WRITE; -INSERT INTO `VF_MODULE`(`ID`, `TYPE`, `ASDC_SERVICE_MODEL_VERSION`, `MODEL_NAME`, `MODEL_VERSION`, `IS_BASE`, `VNF_RESOURCE_ID`) VALUES -(100,'dns-servicetest/DNSResource-1::VF_DNS::module-1','1.0','VF_DNS::module-1','1.0','1','7'), -(101,'dns-servicetest/DNSResource-1::Mog111..mog_psm..module-1','1.0','Mog111..mog_psm..module-1','1.0','1','7'); -UNLOCK TABLES; - -LOCK TABLES `VNF_RESOURCE` WRITE; -INSERT INTO `VNF_RESOURCE`(`ID`, `VNF_TYPE`, `ASDC_SERVICE_MODEL_VERSION`, `ORCHESTRATION_MODE`, `MODEL_VERSION`) VALUES -(100,'dns-servicetest/DNSResource-1','1.0','VF_DNS::module-1','1.0'); -UNLOCK TABLES; - -DELETE FROM HEAT_TEMPLATE_PARAMS; -DELETE FROM HEAT_TEMPLATE; -DELETE FROM HEAT_ENVIRONMENT; diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql deleted file mode 100644 index bbb632fbc3..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql +++ /dev/null @@ -1,105 +0,0 @@ -SOURCE ../../camunda/mariadb_engine_7.7.3-ee.sql - --- --- Create an admin user automatically for the cockpit --- -SOURCE ../../camunda/mysql_create_camunda_admin.sql - --- --- Current Database: `mso_requests` --- - -DROP DATABASE IF EXISTS `mso_requests`; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mso_requests` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `mso_requests`; - -SOURCE ../../main-schemas/MySQL-Requests-schema.sql -SOURCE ../../sub-sql-files/site_status_updated_timestamp.sql - - --- --- Current Database: `mso_catalog` --- - -DROP DATABASE IF EXISTS `mso_catalog`; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mso_catalog` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `mso_catalog`; - -SOURCE ../../main-schemas/MySQL-Catalog-schema.sql -SOURCE ../../sub-sql-files/catalog_timestamp_mso_db.sql -SOURCE ../../sub-sql-files/catalog_add_constraints.sql - -LOCK TABLES `NETWORK_RECIPE` WRITE; -/*!40000 ALTER TABLE `NETWORK_RECIPE` DISABLE KEYS */; -INSERT INTO `NETWORK_RECIPE`(`ID`, `NETWORK_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES -(1,'CONTRAIL_BASIC','CREATE','1',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL), -(2,'CONTRAIL_BASIC','DELETE','1',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL), -(3,'CONTRAIL_BASIC','UPDATE','1',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL), -(4,'CONTRAIL_SHARED','CREATE','1',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL), -(5,'CONTRAIL_SHARED','UPDATE','1',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL), -(6,'CONTRAIL_SHARED','DELETE','1',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL), -(7,'CONTRAIL_EXTERNAL','CREATE','1',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL), -(8,'CONTRAIL_EXTERNAL','UPDATE','1',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL), -(9,'CONTRAIL_EXTERNAL','DELETE','1',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL); - -/*!40000 ALTER TABLE `NETWORK_RECIPE` ENABLE KEYS */; -UNLOCK TABLES; -INSERT INTO `NETWORK_RECIPE`(`NETWORK_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES -('CONTRAIL30_BASIC','CREATE','1',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL), -('CONTRAIL30_BASIC','UPDATE','1',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL), -('CONTRAIL30_BASIC','DELETE','1',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL), -('CONTRAIL30_MPSCE','CREATE','1',NULL,'/mso/async/services/CreateNetworkV2',NULL,180,NULL), -('CONTRAIL30_MPSCE','UPDATE','1',NULL,'/mso/async/services/UpdateNetworkV2',NULL,180,NULL), -('CONTRAIL30_MPSCE','DELETE','1',NULL,'/mso/async/services/DeleteNetworkV2',NULL,180,NULL); - - -LOCK TABLES `VNF_RECIPE` WRITE; -/*!40000 ALTER TABLE `VNF_RECIPE` DISABLE KEYS */; -INSERT INTO `VNF_RECIPE`(`ID`, `VNF_TYPE`, `VF_MODULE_ID`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES -(1,'*',NULL,'CREATE','1','Recipe Match All for VNFs if no custom flow exists','/mso/workflow/services/CreateGenericVNFV1',NULL,180,NULL), -(2,'*',NULL,'DELETE','1','Recipe Match All for VNFs if no custom flow exists','/mso/async/services//deleteGenericVNFV1',NULL,180,NULL), -(3,'*',NULL,'UPDATE','1','Recipe Match All for VNFs if no custom flow exists','/mso/workflow/services/updateGenericVNFV1',NULL,180,NULL), -(4,NULL,'*','CREATE_VF_MODULE','1','Recipe Match All for VNFs if no custom flow exists','/mso/async/services/CreateVfModule',NULL,180,NULL), -(5,NULL,'*','DELETE_VF_MODULE','1','Recipe Match All for VNFs if no custom flow exists','/mso/async/services/DeleteVfModule',NULL,180,NULL), -(6,NULL,'*','UPDATE_VF_MODULE','1','Recipe Match All for VNFs if no custom flow exists','/mso/async/services/UpdateVfModule',NULL,180,NULL); -/*!40000 ALTER TABLE `VNF_RECIPE` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `VNF_COMPONENTS_RECIPE` WRITE; -/*!40000 ALTER TABLE `VNF_COMPONENTS_RECIPE` DISABLE KEYS */; -INSERT INTO `VNF_COMPONENTS_RECIPE` -(`ID`, `VNF_TYPE`, `VF_MODULE_ID`, `ACTION`, `VERSION`, `DESCRIPTION`, `ORCHESTRATION_URI`,`VNF_COMPONENT_TYPE`, `VNF_COMPONENT_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES -(1,'*',NULL,'CREATE','1','Recipe Match All for VF Modules if no custom flow exists','/mso/async/services/createCinderVolumeV1','VOLUME_GROUP',NULL,180,NULL), -(2,'*',NULL,'DELETE','1','Recipe Match All for VF Modules if no custom flow exists','/mso/async/services/deleteCinderVolumeV1','VOLUME_GROUP',NULL,180,NULL), -(3,'*',NULL,'UPDATE','1','Recipe Match All for VF Modules if no custom flow exists','/mso/async/services/updateCinderVolumeV1','VOLUME_GROUP',NULL,180,NULL), -(4,NULL,'*','CREATE_VF_MODULE_VOL','1','Recipe Match All for VF Modules if no custom flow exists','/mso/async/services/CreateVfModuleVolume','VOLUME_GROUP',NULL,180,NULL), -(5,NULL,'*','DELETE_VF_MODULE_VOL','1','Recipe Match All for VF Modules if no custom flow exists','/mso/async/services/DeleteVfModuleVolume','VOLUME_GROUP',NULL,180,NULL), -(6,NULL,'*','UPDATE_VF_MODULE_VOL','1','Recipe Match All for VF Modules if no custom flow exists','/mso/async/services/UpdateVfModuleVolume','VOLUME_GROUP',NULL,180,NULL); -/*!40000 ALTER TABLE `VNF_COMPONENTS_RECIPE` ENABLE KEYS */; -UNLOCK TABLES; - -INSERT INTO service (id, SERVICE_NAME, VERSION_STR, DESCRIPTION, SERVICE_NAME_VERSION_ID) VALUES ('4', 'VID_DEFAULT', '1.0', 'Default service for VID to use for infra APIH orchestration', 'MANUAL_RECORD'); -INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('4', 'createInstance', '1', 'VID_DEFAULT recipe to create service-instance if no custom BPMN flow is found', '/mso/async/services/CreateGenericALaCarteServiceInstance', '180'); -INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('4', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete service-instance if no custom BPMN flow is found', '/mso/async/services/DeleteGenericALaCarteServiceInstance', '180'); -INSERT INTO vnf_recipe (VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'createInstance', '1', 'VID_DEFAULT recipe to create VNF if no custom BPMN flow is found', '/mso/async/services/CreateVnfInfra', '180'); -INSERT INTO vnf_recipe (VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found', '/mso/async/services/DeleteVnfInfra', '180'); -INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'createInstance', '1', 'VID_DEFAULT recipe to create volume-group if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleVolumeInfraV1', '180', 'VID_DEFAULT'); -INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete volume-group if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleVolumeInfraV1', '180', 'VID_DEFAULT'); -INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'updateInstance', '1', 'VID_DEFAULT recipe to update volume-group if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleVolumeInfraV1', '180', 'VID_DEFAULT'); -INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'createInstance', '1', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '180', 'VID_DEFAULT'); -INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '180', 'VID_DEFAULT'); -INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'updateInstance', '1', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '180', 'VID_DEFAULT'); -INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'createInstance', '1.0', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstance', '180'); -INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'updateInstance', '1.0', 'VID_DEFAULT recipe to update network if no custom BPMN flow is found', '/mso/async/services/UpdateNetworkInstance', '180'); -INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'deleteInstance', '1.0', 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found', '/mso/async/services/DeleteNetworkInstance', '180'); - --- --- Custom Reciepe for the E2E service --- -INSERT INTO service (id, SERVICE_NAME, VERSION_STR, DESCRIPTION, SERVICE_NAME_VERSION_ID) VALUES ('20', 'UUI_DEFAULT', '1.0', 'Default service for UUI to use for infra APIH orchestration', 'MANUAL_RECORD'); -INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('20', 'createInstance', '1', 'UUI_DEFAULT recipe to create service-instance if no custom BPMN flow is found', '/mso/async/services/CreateCustomE2EServiceInstance', '180'); -INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('20', 'deleteInstance', '1', 'UUI_DEFAULT recipe to delete service-instance if no custom BPMN flow is found', '/mso/async/services/DeleteCustomE2EServiceInstance', '180'); diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/demo-dns/create_mso_db-demo-dns.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/demo-dns/create_mso_db-demo-dns.sql deleted file mode 100644 index 9ddc9ff0d3..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/demo-dns/create_mso_db-demo-dns.sql +++ /dev/null @@ -1,85 +0,0 @@ -SOURCE ../default/create_mso_db-default.sql - -USE `mso_requests`; -DROP USER 'mso'; -CREATE USER 'mso'; -GRANT ALL on mso_requests.* to 'mso' identified by 'mso123' with GRANT OPTION; -FLUSH PRIVILEGES; - -USE `mso_catalog`; -DROP USER 'catalog'; -CREATE USER 'catalog'; -GRANT ALL on mso_catalog.* to 'catalog' identified by 'catalog123' with GRANT OPTION; -FLUSH PRIVILEGES; - -LOCK TABLES `heat_environment` WRITE; -/*!40000 ALTER TABLE `heat_environment` DISABLE KEYS */; -INSERT INTO `heat_environment` VALUES (3,'base_vlb.env','1.0','dns-service/DNSResource-1','BASE VLB ENV file','parameters:\n vlb_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)\n vlb_flavor_name: 4 GB General Purpose v1\n public_net_id: 00000000-0000-0000-0000-000000000000\n vlb_private_net_id: zdfw1lb01_private\n ecomp_private_net_id: oam_ecomp\n vlb_private_net_cidr: 192.168.10.0/24\n ecomp_private_net_cidr: 192.168.9.0/24\n vlb_private_ip_0: 192.168.10.111\n vlb_private_ip_1: 192.168.9.111\n vdns_private_ip_0: 192.168.10.211\n vdns_private_ip_1: 192.168.9.211\n vlb_name_0: zdfw1lb01lb01\n vdns_name_0: zdfw1lb01dns01\n vnf_id: vLoadBalancer_demo_app\n vf_module_id: vLoadBalancer\n webserver_ip: 162.242.237.182\n dcae_collector_ip: 192.168.9.1\n key_name: vlb_key\n pub_key: INSERT YOUR PUBLIC KEY HERE','2016-11-14 13:04:07','EnvArtifact-UUID1','Label'); -INSERT INTO `heat_environment` VALUES (4,'dnsscaling.env','1.0','dns-service/DNSResource-1','DNS Scaling ENV file','parameters:\n vlb_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)\n vlb_flavor_name: 4 GB General Purpose v1\n public_net_id: 00000000-0000-0000-0000-000000000000\n vlb_private_net_id: zdfw1lb01_private\n ecomp_private_net_id: oam_ecomp\n vlb_private_ip_0: 192.168.10.111\n vlb_private_ip_1: 192.168.9.111\n vdns_private_ip_0: 192.168.10.222\n vdns_private_ip_1: 192.168.9.222\n vdns_name_0: zdfw1lb01dns02\n vnf_id: vLoadBalancer_demo_app\n vf_module_id: vLoadBalancer\n webserver_ip: 162.242.237.182\n dcae_collector_ip: 192.168.9.1\n key_name: vlb_key\n pub_key: INSERT YOUR PUBLIC KEY HERE','2016-11-14 13:04:07','EnvArtifact-UUID2','Label'); -/*!40000 ALTER TABLE `heat_environment` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `heat_template` WRITE; -/*!40000 ALTER TABLE `heat_template` DISABLE KEYS */; -INSERT INTO `heat_template` VALUES (6,'base_vlb.yaml','1.0','DNSResource','base_vlb.yaml','heat_template_version: 2013-05-23\n\ndescription: Heat template to deploy vLoadBalancer/vDNS demo app for OpenECOMP\n\nparameters:\n vlb_image_name:\n type: string\n label: Image name or ID\n description: Image to be used for compute instance\n vlb_flavor_name:\n type: string\n label: Flavor\n description: Type of instance (flavor) to be used\n public_net_id:\n type: string\n label: Public network name or ID\n description: Public network that enables remote connection to VNF\n vlb_private_net_id:\n type: string\n label: vLoadBalancer private network name or ID\n description: Private network that connects vLoadBalancer with vDNSs\n ecomp_private_net_id:\n type: string\n label: ECOMP management network name or ID\n description: Private network that connects ECOMP component and the VNF\n vlb_private_net_cidr:\n type: string\n label: vLoadBalancer private network CIDR\n description: The CIDR of the vLoadBalancer private network\n ecomp_private_net_cidr:\n type: string\n label: ECOMP private network CIDR\n description: The CIDR of the protected private network\n vlb_private_ip_0:\n type: string\n label: vLoadBalancer private IP address towards the private network\n description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs\n vlb_private_ip_1:\n type: string\n label: vLoadBalancer private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vLoadBalancer to communicate with ECOMP components\n vdns_private_ip_0:\n type: string\n label: vDNS private IP address towards the private network\n description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer\n vdns_private_ip_1:\n type: string\n label: vDNS private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vDNS to communicate with ECOMP components\n vlb_name_0:\n type: string\n label: vLoadBalancer name\n description: Name of the vLoadBalancer\n vdns_name_0:\n type: string\n label: vDNS name\n description: Name of the vDNS\n vnf_id:\n type: string\n label: VNF ID\n description: The VNF ID is provided by ECOMP\n vf_module_id:\n type: string\n label: vFirewall module ID\n description: The vLoadBalancer Module ID is provided by ECOMP\n webserver_ip:\n type: string\n label: Webserver IP address\n description: IP address of the webserver that hosts the source code and binaries\n dcae_collector_ip:\n type: string\n label: DCAE collector IP address\n description: IP address of the DCAE collector\n key_name:\n type: string\n label: Key pair name\n description: Public/Private key pair name\n pub_key:\n type: string\n label: Public key\n description: Public key to be installed on the compute instance\n\nresources:\n my_keypair:\n type: OS::Nova::KeyPair\n properties:\n name: { get_param: key_name }\n public_key: { get_param: pub_key }\n save_private_key: false\n\n vlb_private_network:\n type: OS::Neutron::Net\n properties:\n name: { get_param: vlb_private_net_id }\n\n vlb_private_subnet:\n type: OS::Neutron::Subnet\n properties:\n name: { get_param: vlb_private_net_id }\n network_id: { get_resource: vlb_private_network }\n cidr: { get_param: vlb_private_net_cidr }\n\n vlb_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vlb_image_name }\n flavor: { get_param: vlb_flavor_name }\n name: { get_param: vlb_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vlb_private_0_port }\n - port: { get_resource: vlb_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __dcae_collector_ip__: { get_param: dcae_collector_ip }\n __local_private_ipaddr__: { get_param: vlb_private_ip_0 }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n DCAE_COLLECTOR_IP=__dcae_collector_ip__\n LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_lb_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vlb.sh\n chmod +x v_lb_init.sh\n chmod +x vlb.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $DCAE_COLLECTOR_IP > config/dcae_collector_ip.txt\n echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt\n echo "no" > config/install.txt\n LOCAL_PUBLIC_IPADDR=$(ifconfig eth0 | grep "inet addr" | tr -s \' \' | cut -d\' \' -f3 | cut -d\':\' -f2)\n echo $LOCAL_PUBLIC_IPADDR > config/local_public_ipaddr.txt\n mv vlb.sh /etc/init.d\n update-rc.d vlb.sh defaults\n ./v_lb_init.sh\n\n vlb_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: vlb_private_network }\n fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]\n\n vlb_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vlb_private_ip_1 }}]\n\n vdns_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vlb_image_name }\n flavor: { get_param: vlb_flavor_name }\n name: { get_param: vdns_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vdns_private_0_port }\n - port: { get_resource: vdns_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __lb_oam_int__ : { get_param: vlb_private_ip_1 }\n __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }\n __local_private_ipaddr__: { get_param: vdns_private_ip_0 }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n LB_OAM_INT=__lb_oam_int__\n LB_PRIVATE_IPADDR=__lb_private_ipaddr__\n LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_dns_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vdns.sh\n chmod +x v_dns_init.sh\n chmod +x vdns.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $LB_OAM_INT > config/lb_oam_int.txt\n echo $LB_PRIVATE_IPADDR > config/lb_private_ipaddr.txt\n echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt\n echo "no" > config/install.txt\n mv vdns.sh /etc/init.d\n update-rc.d vdns.sh defaults\n ./v_dns_init.sh\n\n vdns_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: vlb_private_network }\n fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]\n\n vdns_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vdns_private_ip_1 }}]\n',300,'Artifact-UUID1','Base VLB Heat','label','2016-11-14 13:04:07',NULL); -INSERT INTO `heat_template` VALUES (7,'dnsscaling.yaml','1.0','DNSResource','dnsscaling.yaml','heat_template_version: 2013-05-23\n\ndescription: Heat template to deploy a vDNS for OpenECOMP (scaling-up scenario)\n\nparameters:\n vlb_image_name:\n type: string\n label: Image name or ID\n description: Image to be used for compute instance\n vlb_flavor_name:\n type: string\n label: Flavor\n description: Type of instance (flavor) to be used\n public_net_id:\n type: string\n label: Public network name or ID\n description: Public network that enables remote connection to VNF\n vlb_private_net_id:\n type: string\n label: vLoadBalancer private network name or ID\n description: Private network that connects vLoadBalancer with vDNSs\n ecomp_private_net_id:\n type: string\n label: ECOMP management network name or ID\n description: Private network that connects ECOMP component and the VNF\n vlb_private_ip_0:\n type: string\n label: vLoadBalancer private IP address towards the private network\n description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs\n vlb_private_ip_1:\n type: string\n label: vLoadBalancer private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vLoadBalancer to communicate with ECOMP components\n vdns_private_ip_0:\n type: string\n label: vDNS private IP address towards the private network\n description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer\n vdns_private_ip_1:\n type: string\n label: vDNS private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vDNS to communicate with ECOMP components\n vdns_name_0:\n type: string\n label: vDNS name\n description: Name of the vDNS\n vnf_id:\n type: string\n label: VNF ID\n description: The VNF ID is provided by ECOMP\n vf_module_id:\n type: string\n label: vFirewall module ID\n description: The vLoadBalancer Module ID is provided by ECOMP\n webserver_ip:\n type: string\n label: Webserver IP address\n description: IP address of the webserver that hosts the source code and binaries\n dcae_collector_ip:\n type: string\n label: DCAE collector IP address\n description: IP address of the DCAE collector\n key_name:\n type: string\n label: Key pair name\n description: Public/Private key pair name\n pub_key:\n type: string\n label: Public key\n description: Public key to be installed on the compute instance\n\nresources:\n vdns_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vlb_image_name }\n flavor: { get_param: vlb_flavor_name }\n name: { get_param: vdns_name_0 }\n key_name: { get_param: key_name }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vdns_private_0_port }\n - port: { get_resource: vdns_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __lb_oam_int__ : { get_param: vlb_private_ip_1 }\n __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }\n __local_private_ipaddr__: { get_param: vdns_private_ip_0 }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n LB_OAM_INT=__lb_oam_int__\n LB_PRIVATE_IPADDR=__lb_private_ipaddr__\n LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_dns_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vdns.sh\n chmod +x v_dns_init.sh\n chmod +x vdns.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $LB_OAM_INT > config/lb_oam_int.txt\n echo $LB_PRIVATE_IPADDR > config/lb_private_ipaddr.txt\n echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt\n echo "no" > config/install.txt\n mv vdns.sh /etc/init.d\n update-rc.d vdns.sh defaults\n ./v_dns_init.sh\n\n vdns_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: vlb_private_net_id }\n fixed_ips: [{"subnet": { get_param: vlb_private_net_id }, "ip_address": { get_param: vdns_private_ip_0 }}]\n\n vdns_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vdns_private_ip_1 }}]\n',300,'Artifact-UUID2','DNS Scaling Heat','label','2016-11-14 13:04:07',NULL); -/*!40000 ALTER TABLE `heat_template` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `heat_template_params` WRITE; -/*!40000 ALTER TABLE `heat_template_params` DISABLE KEYS */; -INSERT INTO `heat_template_params` VALUES (110,6,'vlb_flavor_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (111,6,'vlb_private_ip_1','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (112,6,'dcae_collector_ip','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (113,6,'vlb_private_net_cidr','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (114,6,'ecomp_private_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (115,6,'vnf_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (116,6,'key_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (117,6,'pub_key','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (118,6,'vlb_private_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (119,6,'webserver_ip','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (120,6,'vdns_private_ip_1','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (121,6,'public_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (122,6,'vlb_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (123,6,'vlb_name_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (124,6,'vdns_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (125,6,'vdsn_name_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (126,6,'ecomp_private_net_cidr','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (127,6,'vf_module_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (128,6,'vlb_image_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (129,7,'vnf_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (130,7,'vf_module_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (131,7,'vlb_flavor_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (132,7,'vlb_image_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (133,7,'vdns_private_ip_1','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (134,7,'dcae_collector_ip','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (135,7,'webserver_ip','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (136,7,'vlb_private_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (137,7,'vdns_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (138,7,'vdsn_name_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (139,7,'vlb_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (140,7,'pub_key','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (141,7,'public_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (142,7,'key_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (143,7,'ecomp_private_net_id','\1','string',NULL); -/*!40000 ALTER TABLE `heat_template_params` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `service` WRITE; -/*!40000 ALTER TABLE `service` DISABLE KEYS */; -INSERT INTO `service` VALUES (10,'dns-service','1.0','dns service for unit test','1e34774e-715e-4fd6-bd09-7b654622f35i',NULL,NULL,'2016-11-14 13:04:07','585822c8-4027-4f84-ba50-e9248606f111'); -/*!40000 ALTER TABLE `service` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `vf_module` WRITE; -/*!40000 ALTER TABLE `vf_module` DISABLE KEYS */; -INSERT INTO `vf_module` VALUES (7,'dns-service/DNSResource-1::VF_RI1_DNS::module-1','1.0','VF_RI1_DNS::module-1','1.0','1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI1_DNS::module-1::module-1.group',NULL,6,1,'2016-11-14 13:04:07',NULL,NULL,6,3,'585822c7-4027-4f84-ba50-e9248606f132'); -INSERT INTO `vf_module` VALUES (8,'dns-service/DNSResource-1::VF_RI1_DNS::module-2','1.0','VF_RI1_DNS::module-2','1.0','1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI1_DNS::module-2::module-1.group',NULL,7,0,'2016-11-14 13:04:07',NULL,NULL,6,4,'585822c7-4027-4f84-ba50-e9248606f133'); -/*!40000 ALTER TABLE `vf_module` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `vnf_resource` WRITE; -/*!40000 ALTER TABLE `vnf_resource` DISABLE KEYS */; -INSERT INTO `vnf_resource` VALUES (6,'dns-service/DNSResource-1','1.0','HEAT','dns service for unit test',NULL,NULL,'2016-11-14 13:04:07','585822c7-4027-4f84-ba50-e9248606f131',NULL,NULL,'585822c7-4027-4f84-ba50-e9248606f112','1.0','DNSResource-1','DNSResource','585822c8-4027-4f84-ba50-e9248606f111'); -/*!40000 ALTER TABLE `vnf_resource` ENABLE KEYS */; -UNLOCK TABLES;
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/demo-vfw/create_mso_db-demo-vfw.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/demo-vfw/create_mso_db-demo-vfw.sql deleted file mode 100644 index e61abae404..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/demo-vfw/create_mso_db-demo-vfw.sql +++ /dev/null @@ -1,73 +0,0 @@ -SOURCE ../default/create_mso_db-default.sql - -USE `mso_requests`; -DROP USER 'mso'; -CREATE USER 'mso'; -GRANT ALL on mso_requests.* to 'mso' identified by 'mso123' with GRANT OPTION; -FLUSH PRIVILEGES; - -USE `mso_catalog`; -DROP USER 'catalog'; -CREATE USER 'catalog'; -GRANT ALL on mso_catalog.* to 'catalog' identified by 'catalog123' with GRANT OPTION; -FLUSH PRIVILEGES; - -LOCK TABLES `heat_environment` WRITE; -/*!40000 ALTER TABLE `heat_environment` DISABLE KEYS */; -INSERT INTO `heat_environment` VALUES (5,'base_vfw.env','1.0','vfw-service/VFWResource-1','base_vfw ENV file','parameters:\n vfw_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)\n vfw_flavor_name: 4 GB General Purpose v1\n public_net_id: 00000000-0000-0000-0000-000000000000\n unprotected_private_net_id: zdfw1fwl01_unprotected\n protected_private_net_id: zdfw1fwl01_protected\n ecomp_private_net_id: oam_ecomp\n unprotected_private_net_cidr: 192.168.10.0/24\n protected_private_net_cidr: 192.168.20.0/24\n ecomp_private_net_cidr: 192.168.9.0/24\n vfw_private_ip_0: 192.168.10.100\n vfw_private_ip_1: 192.168.20.100\n vfw_private_ip_2: 192.168.9.100\n vpg_private_ip_0: 192.168.10.200\n vpg_private_ip_1: 192.168.9.200\n vsn_private_ip_0: 192.168.20.250\n vsn_private_ip_1: 192.168.9.250\n vfw_name_0: zdfw1fwl01fwl01\n vpg_name_0: zdfw1fwl01pgn01\n vsn_name_0: zdfw1fwl01snk01\n vnf_id: vFirewall_demo_app\n vf_module_id: vFirewall\n webserver_ip: 162.242.237.182\n dcae_collector_ip: 192.168.9.1\n key_name: vfw_key\n pub_key: INSERT YOUR PUBLIC KEY HERE','2016-11-14 13:04:07','EnvArtifact-UUID3','Label'); -/*!40000 ALTER TABLE `heat_environment` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `heat_template` WRITE; -/*!40000 ALTER TABLE `heat_template` DISABLE KEYS */; -INSERT INTO `heat_template` VALUES (8,'base_vfw.yaml','1.0','VFWResource','base_vfw.yaml','heat_template_version: 2013-05-23\n\ndescription: Heat template to deploy vFirewall demo app for OpenECOMP\n\nparameters:\n vfw_image_name:\n type: string\n label: Image name or ID\n description: Image to be used for compute instance\n vfw_flavor_name:\n type: string\n label: Flavor\n description: Type of instance (flavor) to be used\n public_net_id:\n type: string\n label: Public network name or ID\n description: Public network that enables remote connection to VNF\n unprotected_private_net_id:\n type: string\n label: Unprotected private network name or ID\n description: Private network that connects vPacketGenerator with vFirewall\n protected_private_net_id:\n type: string\n label: Protected private network name or ID\n description: Private network that connects vFirewall with vSink\n ecomp_private_net_id:\n type: string\n label: ECOMP management network name or ID\n description: Private network that connects ECOMP component and the VNF\n unprotected_private_net_cidr:\n type: string\n label: Unprotected private network CIDR\n description: The CIDR of the unprotected private network\n protected_private_net_cidr:\n type: string\n label: Protected private network CIDR\n description: The CIDR of the protected private network\n ecomp_private_net_cidr:\n type: string\n label: ECOMP private network CIDR\n description: The CIDR of the protected private network\n vfw_private_ip_0:\n type: string\n label: vFirewall private IP address towards the unprotected network\n description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator\n vfw_private_ip_1:\n type: string\n label: vFirewall private IP address towards the protected network\n description: Private IP address that is assigned to the vFirewall to communicate with the vSink\n vfw_private_ip_2:\n type: string\n label: vFirewall private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vFirewall to communicate with ECOMP components\n vpg_private_ip_0:\n type: string\n label: vPacketGenerator private IP address towards the unprotected network\n description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall\n vpg_private_ip_1:\n type: string\n label: vPacketGenerator private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vPacketGenerator to communicate with ECOMP components\n vsn_private_ip_0:\n type: string\n label: vSink private IP address towards the protected network\n description: Private IP address that is assigned to the vSink to communicate with the vFirewall\n vsn_private_ip_1:\n type: string\n label: vSink private IP address towards the ECOMP management network\n description: Private IP address that is assigned to the vSink to communicate with ECOMP components\n vfw_name_0:\n type: string\n label: vFirewall name\n description: Name of the vFirewall\n vpg_name_0:\n type: string\n label: vPacketGenerator name\n description: Name of the vPacketGenerator\n vsn_name_0:\n type: string\n label: vSink name\n description: Name of the vSink\n vnf_id:\n type: string\n label: VNF ID\n description: The VNF ID is provided by ECOMP\n vf_module_id:\n type: string\n label: vFirewall module ID\n description: The vFirewall Module ID is provided by ECOMP\n webserver_ip:\n type: string\n label: Webserver IP address\n description: IP address of the webserver that hosts the source code and binaries\n dcae_collector_ip:\n type: string\n label: DCAE collector IP address\n description: IP address of the DCAE collector\n key_name:\n type: string\n label: Key pair name\n description: Public/Private key pair name\n pub_key:\n type: string\n label: Public key\n description: Public key to be installed on the compute instance\n\nresources:\n my_keypair:\n type: OS::Nova::KeyPair\n properties:\n name: { get_param: key_name }\n public_key: { get_param: pub_key }\n save_private_key: false\n\n unprotected_private_network:\n type: OS::Neutron::Net\n properties:\n name: { get_param: unprotected_private_net_id }\n\n protected_private_network:\n type: OS::Neutron::Net\n properties:\n name: { get_param: protected_private_net_id }\n\n unprotected_private_subnet:\n type: OS::Neutron::Subnet\n properties:\n network_id: { get_resource: unprotected_private_network }\n cidr: { get_param: unprotected_private_net_cidr }\n\n protected_private_subnet:\n type: OS::Neutron::Subnet\n properties:\n network_id: { get_resource: protected_private_network }\n cidr: { get_param: protected_private_net_cidr }\n\n vfw_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vfw_image_name }\n flavor: { get_param: vfw_flavor_name }\n name: { get_param: vfw_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vfw_private_0_port }\n - port: { get_resource: vfw_private_1_port }\n - port: { get_resource: vfw_private_2_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __dcae_collector_ip__ : { get_param: dcae_collector_ip }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n DCAE_COLLECTOR_IP=__dcae_collector_ip__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_firewall_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vfirewall.sh\n chmod +x v_firewall_init.sh\n chmod +x vfirewall.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $DCAE_COLLECTOR_IP > config/dcae_collector_ip.txt\n echo "no" > config/install.txt\n mv vfirewall.sh /etc/init.d\n sudo update-rc.d vfirewall.sh defaults\n ./v_firewall_init.sh\n\n vfw_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: unprotected_private_network }\n fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vfw_private_ip_0 }}]\n\n vfw_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: protected_private_network }\n fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vfw_private_ip_1 }}]\n\n vfw_private_2_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vfw_private_ip_2 }}]\n\n vpg_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vfw_image_name }\n flavor: { get_param: vfw_flavor_name }\n name: { get_param: vpg_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vpg_private_0_port }\n - port: { get_resource: vpg_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __fw_ipaddr__: { get_param: vfw_private_ip_0 }\n __protected_net_cidr__: { get_param: protected_private_net_cidr }\n __sink_ipaddr__: { get_param: vsn_private_ip_0 }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n FW_IPADDR=__fw_ipaddr__\n PROTECTED_NET_CIDR=__protected_net_cidr__\n SINK_IPADDR=__sink_ipaddr__\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_packetgen_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vpacketgen.sh\n chmod +x v_packetgen_init.sh\n chmod +x vpacketgen.sh\n echo $WEBSERVER_IP > config/webserver_ip.txt\n echo $FW_IPADDR > config/fw_ipaddr.txt\n echo $PROTECTED_NET_CIDR > config/protected_net_cidr.txt\n echo $SINK_IPADDR > config/sink_ipaddr.txt\n echo "no" > config/install.txt\n mv vpacketgen.sh /etc/init.d\n sudo update-rc.d vpacketgen.sh defaults\n ./v_packetgen_init.sh\n\n vpg_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: unprotected_private_network }\n fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}]\n\n vpg_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vpg_private_ip_1 }}]\n\n vsn_0:\n type: OS::Nova::Server\n properties:\n image: { get_param: vfw_image_name }\n flavor: { get_param: vfw_flavor_name }\n name: { get_param: vsn_name_0 }\n key_name: { get_resource: my_keypair }\n networks:\n - network: { get_param: public_net_id }\n - port: { get_resource: vsn_private_0_port }\n - port: { get_resource: vsn_private_1_port }\n metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\n user_data_format: RAW\n user_data:\n str_replace:\n params:\n __webserver__: { get_param: webserver_ip }\n __protected_net_gw__: { get_param: vfw_private_ip_1 }\n __unprotected_net__: { get_param: unprotected_private_net_cidr }\n template: |\n #!/bin/bash\n\n WEBSERVER_IP=__webserver__\n PROTECTED_NET_GW=__protected_net_gw__\n UNPROTECTED_NET=__unprotected_net__\n UNPROTECTED_NET=$(echo $UNPROTECTED_NET | cut -d\'/\' -f1)\n\n mkdir /opt/config\n cd /opt\n wget http://$WEBSERVER_IP/demo_repo/v_sink_init.sh\n wget http://$WEBSERVER_IP/demo_repo/vsink.sh\n chmod +x v_sink_init.sh\n chmod +x vsink.sh\n echo $PROTECTED_NET_GW > config/protected_net_gw.txt\n echo $UNPROTECTED_NET > config/unprotected_net.txt\n echo "no" > config/install.txt\n mv vsink.sh /etc/init.d\n sudo update-rc.d vsink.sh defaults\n ./v_sink_init.sh\n\n vsn_private_0_port:\n type: OS::Neutron::Port\n properties:\n network: { get_resource: protected_private_network }\n fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vsn_private_ip_0 }}]\n\n vsn_private_1_port:\n type: OS::Neutron::Port\n properties:\n network: { get_param: ecomp_private_net_id }\n fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vsn_private_ip_1 }}]\n \n',300,'Artifact-UUID3','Base VFW Heat','label','2016-11-14 13:04:07',NULL); -/*!40000 ALTER TABLE `heat_template` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `heat_template_params` WRITE; -/*!40000 ALTER TABLE `heat_template_params` DISABLE KEYS */; -INSERT INTO `heat_template_params` VALUES (144,8,'vsn_private_ip_1','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (145,8,'ecomp_private_net_cidr','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (146,8,'public_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (147,8,'unprotected_private_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (148,8,'webserver_ip','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (149,8,'vfw_image_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (150,8,'vnf_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (151,8,'dcae_collector_ip','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (152,8,'protected_private_net_cidr','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (153,8,'vsn_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (154,8,'vfw_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (155,8,'vfw_private_ip_1','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (156,8,'vfw_private_ip_2','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (157,8,'unprotected_private_net_cidr','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (158,8,'vsn_name_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (159,8,'ecomp_private_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (160,8,'vpg_private_ip_1','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (161,8,'vpg_name_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (162,8,'vf_module_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (163,8,'pub_key','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (164,8,'protected_private_net_id','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (165,8,'key_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (166,8,'vfw_flavor_name','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (167,8,'vpg_private_ip_0','\1','string',NULL); -INSERT INTO `heat_template_params` VALUES (168,8,'vfw_name_0','\1','string',NULL); -/*!40000 ALTER TABLE `heat_template_params` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `service` WRITE; -/*!40000 ALTER TABLE `service` DISABLE KEYS */; -INSERT INTO `service` VALUES (11,'vfw-service','1.0','VFW service','2e34774e-715e-4fd5-bd09-7b654622f35i',NULL,NULL,'2016-11-14 13:04:07','585822c7-4027-4f84-ba50-e9248606f112'); -/*!40000 ALTER TABLE `service` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `vf_module` WRITE; -/*!40000 ALTER TABLE `vf_module` DISABLE KEYS */; -INSERT INTO `vf_module` VALUES (9,'vfw-service/VFWResource-1::VF_RI1_VFW::module-1','1.0','VF_RI1_VFW::module-1','1.0','1e34774e-715e-4fd5-bd08-7b654622f33f.VF_RI1_VFW::module-1::module-1.group',NULL,8,1,'2016-11-14 13:04:07',NULL,NULL,7,5,'585822c7-4027-4f84-ba50-e9248606f134'); -/*!40000 ALTER TABLE `vf_module` ENABLE KEYS */; -UNLOCK TABLES; - -LOCK TABLES `vnf_resource` WRITE; -/*!40000 ALTER TABLE `vnf_resource` DISABLE KEYS */; -INSERT INTO `vnf_resource` VALUES (7,'vfw-service/VFWResource-1','1.0','HEAT','VFW service',NULL,NULL,'2016-11-14 13:04:07','685822c7-4027-4f84-ba50-e9248606f132',NULL,NULL,'585822c7-4027-4f84-ba50-e9248606f113','1.0','VFWResource-1','VFWResource','585822c7-4027-4f84-ba50-e9248606f112'); -/*!40000 ALTER TABLE `vnf_resource` ENABLE KEYS */; -UNLOCK TABLES;
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.7.3-ee.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.7.3-ee.sql deleted file mode 100644 index b9b8dd62c9..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.7.3-ee.sql +++ /dev/null @@ -1,1195 +0,0 @@ -DROP DATABASE IF EXISTS `camundabpmn`; - -CREATE DATABASE `camundabpmn`; - -USE `camundabpmn`; - -# DROP USER IF EXISTS 'camunda'; -delete from mysql.user where User='camunda'; -CREATE USER 'camunda'; -GRANT ALL on camundabpmn.* to 'camunda' identified by 'camunda123' with GRANT OPTION; -FLUSH PRIVILEGES; - -USE `camundabpmn`; - -create table ACT_GE_PROPERTY ( - NAME_ varchar(64), - VALUE_ varchar(300), - REV_ integer, - primary key (NAME_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -insert into ACT_GE_PROPERTY -values ('schema.version', 'fox', 1); - -insert into ACT_GE_PROPERTY -values ('schema.history', 'create(fox)', 1); - -insert into ACT_GE_PROPERTY -values ('next.dbid', '1', 1); - -insert into ACT_GE_PROPERTY -values ('deployment.lock', '0', 1); - -insert into ACT_GE_PROPERTY -values ('history.cleanup.job.lock', '0', 1); - -create table ACT_GE_BYTEARRAY ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - DEPLOYMENT_ID_ varchar(64), - BYTES_ LONGBLOB, - GENERATED_ TINYINT, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RE_DEPLOYMENT ( - ID_ varchar(64), - NAME_ varchar(255), - DEPLOY_TIME_ timestamp(3), - SOURCE_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_EXECUTION ( - ID_ varchar(64), - REV_ integer, - PROC_INST_ID_ varchar(64), - BUSINESS_KEY_ varchar(255), - PARENT_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - SUPER_EXEC_ varchar(64), - SUPER_CASE_EXEC_ varchar(64), - CASE_INST_ID_ varchar(64), - ACT_ID_ varchar(255), - ACT_INST_ID_ varchar(64), - IS_ACTIVE_ TINYINT, - IS_CONCURRENT_ TINYINT, - IS_SCOPE_ TINYINT, - IS_EVENT_SCOPE_ TINYINT, - SUSPENSION_STATE_ integer, - CACHED_ENT_STATE_ integer, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_JOB ( - ID_ varchar(64) NOT NULL, - REV_ integer, - TYPE_ varchar(255) NOT NULL, - LOCK_EXP_TIME_ timestamp(3) NULL, - LOCK_OWNER_ varchar(255), - EXCLUSIVE_ boolean, - EXECUTION_ID_ varchar(64), - PROCESS_INSTANCE_ID_ varchar(64), - PROCESS_DEF_ID_ varchar(64), - PROCESS_DEF_KEY_ varchar(255), - RETRIES_ integer, - EXCEPTION_STACK_ID_ varchar(64), - EXCEPTION_MSG_ varchar(4000), - DUEDATE_ timestamp(3) NULL, - REPEAT_ varchar(255), - HANDLER_TYPE_ varchar(255), - HANDLER_CFG_ varchar(4000), - DEPLOYMENT_ID_ varchar(64), - SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, - JOB_DEF_ID_ varchar(64), - PRIORITY_ bigint NOT NULL DEFAULT 0, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_JOBDEF ( - ID_ varchar(64) NOT NULL, - REV_ integer, - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - ACT_ID_ varchar(255), - JOB_TYPE_ varchar(255) NOT NULL, - JOB_CONFIGURATION_ varchar(255), - SUSPENSION_STATE_ integer, - JOB_PRIORITY_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RE_PROCDEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - HAS_START_FORM_KEY_ TINYINT, - SUSPENSION_STATE_ integer, - TENANT_ID_ varchar(64), - VERSION_TAG_ varchar(64), - HISTORY_TTL_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_TASK ( - ID_ varchar(64), - REV_ integer, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_DEF_ID_ varchar(64), - NAME_ varchar(255), - PARENT_TASK_ID_ varchar(64), - DESCRIPTION_ varchar(4000), - TASK_DEF_KEY_ varchar(255), - OWNER_ varchar(255), - ASSIGNEE_ varchar(255), - DELEGATION_ varchar(64), - PRIORITY_ integer, - CREATE_TIME_ timestamp(3), - DUE_DATE_ datetime(3), - FOLLOW_UP_DATE_ datetime(3), - SUSPENSION_STATE_ integer, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_IDENTITYLINK ( - ID_ varchar(64), - REV_ integer, - GROUP_ID_ varchar(255), - TYPE_ varchar(255), - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_VARIABLE ( - ID_ varchar(64) not null, - REV_ integer, - TYPE_ varchar(255) not null, - NAME_ varchar(255) not null, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - TASK_ID_ varchar(64), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB NULL, - TEXT2_ LONGBLOB NULL, - VAR_SCOPE_ varchar(64) not null, - SEQUENCE_COUNTER_ bigint, - IS_CONCURRENT_LOCAL_ TINYINT, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_EVENT_SUBSCR ( - ID_ varchar(64) not null, - REV_ integer, - EVENT_TYPE_ varchar(255) not null, - EVENT_NAME_ varchar(255), - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - ACTIVITY_ID_ varchar(255), - CONFIGURATION_ varchar(255), - CREATED_ timestamp(3) not null, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_INCIDENT ( - ID_ varchar(64) not null, - REV_ integer not null, - INCIDENT_TIMESTAMP_ timestamp(3) not null, - INCIDENT_MSG_ varchar(4000), - INCIDENT_TYPE_ varchar(255) not null, - EXECUTION_ID_ varchar(64), - ACTIVITY_ID_ varchar(255), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - CAUSE_INCIDENT_ID_ varchar(64), - ROOT_CAUSE_INCIDENT_ID_ varchar(64), - CONFIGURATION_ varchar(255), - TENANT_ID_ varchar(64), - JOB_DEF_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_AUTHORIZATION ( - ID_ varchar(64) not null, - REV_ integer not null, - TYPE_ integer not null, - GROUP_ID_ varchar(255), - USER_ID_ varchar(255), - RESOURCE_TYPE_ integer not null, - RESOURCE_ID_ varchar(64), - PERMS_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_FILTER ( - ID_ varchar(64) not null, - REV_ integer not null, - RESOURCE_TYPE_ varchar(255) not null, - NAME_ varchar(255) not null, - OWNER_ varchar(255), - QUERY_ LONGTEXT not null, - PROPERTIES_ LONGTEXT, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_METER_LOG ( - ID_ varchar(64) not null, - NAME_ varchar(64) not null, - REPORTER_ varchar(255), - VALUE_ bigint, - TIMESTAMP_ timestamp(3), - MILLISECONDS_ bigint DEFAULT 0, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_EXT_TASK ( - ID_ varchar(64) not null, - REV_ integer not null, - WORKER_ID_ varchar(255), - TOPIC_NAME_ varchar(255), - RETRIES_ integer, - ERROR_MSG_ varchar(4000), - ERROR_DETAILS_ID_ varchar(64), - LOCK_EXP_TIME_ timestamp(3) NULL, - SUSPENSION_STATE_ integer, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - ACT_ID_ varchar(255), - ACT_INST_ID_ varchar(64), - TENANT_ID_ varchar(64), - PRIORITY_ bigint NOT NULL DEFAULT 0, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_BATCH ( - ID_ varchar(64) not null, - REV_ integer not null, - TYPE_ varchar(255), - TOTAL_JOBS_ integer, - JOBS_CREATED_ integer, - JOBS_PER_SEED_ integer, - INVOCATIONS_PER_JOB_ integer, - SEED_JOB_DEF_ID_ varchar(64), - BATCH_JOB_DEF_ID_ varchar(64), - MONITOR_JOB_DEF_ID_ varchar(64), - SUSPENSION_STATE_ integer, - CONFIGURATION_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); -create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); -create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); -create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); -create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); -create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); -create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); -create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); -create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); -create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); -create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); -create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); -create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); -create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); --- CAM-5914 -create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); --- this index needs to be limited in mariadb see CAM-6938 -create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); -create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); -create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); -create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); - --- new metric milliseconds column -CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); -CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); -CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); - --- old metric timestamp column -CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); -CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); - -create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); -create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); -create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); -create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); -create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); -create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); - -alter table ACT_GE_BYTEARRAY - add constraint ACT_FK_BYTEARR_DEPL - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_SUPER - foreign key (SUPER_EXEC_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); - -alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_TSKASS_TASK - foreign key (TASK_ID_) - references ACT_RU_TASK (ID_); - -alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_ATHRZ_PROCEDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF(ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION(ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_BYTEARRAY - foreign key (BYTEARRAY_ID_) - references ACT_GE_BYTEARRAY (ID_); - -alter table ACT_RU_JOB - add constraint ACT_FK_JOB_EXCEPTION - foreign key (EXCEPTION_STACK_ID_) - references ACT_GE_BYTEARRAY (ID_); - -alter table ACT_RU_EVENT_SUBSCR - add constraint ACT_FK_EVENT_EXEC - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION(ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_CAUSE - foreign key (CAUSE_INCIDENT_ID_) - references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_RCAUSE - foreign key (ROOT_CAUSE_INCIDENT_ID_) - references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; - -alter table ACT_RU_EXT_TASK - add constraint ACT_FK_EXT_TASK_ERROR_DETAILS - foreign key (ERROR_DETAILS_ID_) - references ACT_GE_BYTEARRAY (ID_); - -create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_JOB_DEF - foreign key (JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - -alter table ACT_RU_AUTHORIZATION - add constraint ACT_UNIQ_AUTH_USER - unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); - -alter table ACT_RU_AUTHORIZATION - add constraint ACT_UNIQ_AUTH_GROUP - unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_UNIQ_VARIABLE - unique (VAR_SCOPE_, NAME_); - -alter table ACT_RU_EXT_TASK - add constraint ACT_FK_EXT_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); -alter table ACT_RU_BATCH - add constraint ACT_FK_BATCH_SEED_JOB_DEF - foreign key (SEED_JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - -create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); -alter table ACT_RU_BATCH - add constraint ACT_FK_BATCH_MONITOR_JOB_DEF - foreign key (MONITOR_JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - -create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); -alter table ACT_RU_BATCH - add constraint ACT_FK_BATCH_JOB_DEF - foreign key (BATCH_JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - --- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- -create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); -create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); -create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); -create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); -create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); --- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- -create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); --- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- -create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); - --- indexes to improve deployment -create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); -create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); -create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); -create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); -create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); -create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); -create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); -create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); -create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); --- create case definition table -- -create table ACT_RE_CASE_DEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - TENANT_ID_ varchar(64), - HISTORY_TTL_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create case execution table -- -create table ACT_RU_CASE_EXECUTION ( - ID_ varchar(64) NOT NULL, - REV_ integer, - CASE_INST_ID_ varchar(64), - SUPER_CASE_EXEC_ varchar(64), - SUPER_EXEC_ varchar(64), - BUSINESS_KEY_ varchar(255), - PARENT_ID_ varchar(64), - CASE_DEF_ID_ varchar(64), - ACT_ID_ varchar(255), - PREV_STATE_ integer, - CURRENT_STATE_ integer, - REQUIRED_ boolean, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create case sentry part table -- - -create table ACT_RU_CASE_SENTRY_PART ( - ID_ varchar(64) NOT NULL, - REV_ integer, - CASE_INST_ID_ varchar(64), - CASE_EXEC_ID_ varchar(64), - SENTRY_ID_ varchar(255), - TYPE_ varchar(255), - SOURCE_CASE_EXEC_ID_ varchar(64), - STANDARD_EVENT_ varchar(255), - SOURCE_ varchar(255), - VARIABLE_EVENT_ varchar(255), - VARIABLE_NAME_ varchar(255), - SATISFIED_ boolean, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create index on business key -- -create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); - --- create foreign key constraints on ACT_RU_CASE_EXECUTION -- -alter table ACT_RU_CASE_EXECUTION - add constraint ACT_FK_CASE_EXE_CASE_INST - foreign key (CASE_INST_ID_) - references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; - -alter table ACT_RU_CASE_EXECUTION - add constraint ACT_FK_CASE_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_CASE_EXECUTION - add constraint ACT_FK_CASE_EXE_CASE_DEF - foreign key (CASE_DEF_ID_) - references ACT_RE_CASE_DEF(ID_); - --- create foreign key constraints on ACT_RU_VARIABLE -- -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_CASE_EXE - foreign key (CASE_EXECUTION_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_CASE_INST - foreign key (CASE_INST_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - --- create foreign key constraints on ACT_RU_TASK -- -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_CASE_EXE - foreign key (CASE_EXECUTION_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_CASE_DEF - foreign key (CASE_DEF_ID_) - references ACT_RE_CASE_DEF(ID_); - --- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- -alter table ACT_RU_CASE_SENTRY_PART - add constraint ACT_FK_CASE_SENTRY_CASE_INST - foreign key (CASE_INST_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_CASE_SENTRY_PART - add constraint ACT_FK_CASE_SENTRY_CASE_EXEC - foreign key (CASE_EXEC_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); -create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); --- create decision definition table -- -create table ACT_RE_DECISION_DEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - DEC_REQ_ID_ varchar(64), - DEC_REQ_KEY_ varchar(255), - TENANT_ID_ varchar(64), - HISTORY_TTL_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create decision requirements definition table -- -create table ACT_RE_DECISION_REQ_DEF ( - ID_ varchar(64) NOT NULL, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) NOT NULL, - VERSION_ integer NOT NULL, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -alter table ACT_RE_DECISION_DEF - add constraint ACT_FK_DEC_REQ - foreign key (DEC_REQ_ID_) - references ACT_RE_DECISION_REQ_DEF(ID_); - -create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); -create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); -create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); -create table ACT_HI_PROCINST ( - ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) not null, - BUSINESS_KEY_ varchar(255), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64) not null, - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - START_USER_ID_ varchar(255), - START_ACT_ID_ varchar(255), - END_ACT_ID_ varchar(255), - SUPER_PROCESS_INSTANCE_ID_ varchar(64), - SUPER_CASE_INSTANCE_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - DELETE_REASON_ varchar(4000), - TENANT_ID_ varchar(64), - STATE_ varchar(255), - primary key (ID_), - unique (PROC_INST_ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_ACTINST ( - ID_ varchar(64) not null, - PARENT_ACT_INST_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) not null, - EXECUTION_ID_ varchar(64) not null, - ACT_ID_ varchar(255) not null, - TASK_ID_ varchar(64), - CALL_PROC_INST_ID_ varchar(64), - CALL_CASE_INST_ID_ varchar(64), - ACT_NAME_ varchar(255), - ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - ACT_INST_STATE_ integer, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_TASKINST ( - ID_ varchar(64) not null, - TASK_DEF_KEY_ varchar(255), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - NAME_ varchar(255), - PARENT_TASK_ID_ varchar(64), - DESCRIPTION_ varchar(4000), - OWNER_ varchar(255), - ASSIGNEE_ varchar(255), - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - DELETE_REASON_ varchar(4000), - PRIORITY_ integer, - DUE_DATE_ datetime(3), - FOLLOW_UP_DATE_ datetime(3), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_VARINST ( - ID_ varchar(64) not null, - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - NAME_ varchar(255) not null, - VAR_TYPE_ varchar(100), - REV_ integer, - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB NULL, - TEXT2_ LONGBLOB NULL, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_DETAIL ( - ID_ varchar(64) not null, - TYPE_ varchar(255) not null, - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - VAR_INST_ID_ varchar(64), - NAME_ varchar(255) not null, - VAR_TYPE_ varchar(255), - REV_ integer, - TIME_ datetime(3) not null, - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB NULL, - TEXT2_ LONGBLOB NULL, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - OPERATION_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_IDENTITYLINK ( - ID_ varchar(64) not null, - TIMESTAMP_ timestamp(3) not null, - TYPE_ varchar(255), - USER_ID_ varchar(255), - GROUP_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - OPERATION_TYPE_ varchar(64), - ASSIGNER_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_COMMENT ( - ID_ varchar(64) not null, - TYPE_ varchar(255), - TIME_ datetime(3) not null, - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - ACTION_ varchar(255), - MESSAGE_ varchar(4000), - FULL_MSG_ LONGBLOB, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_ATTACHMENT ( - ID_ varchar(64) not null, - REV_ integer, - USER_ID_ varchar(255), - NAME_ varchar(255), - DESCRIPTION_ varchar(4000), - TYPE_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - URL_ varchar(4000), - CONTENT_ID_ varchar(64), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_OP_LOG ( - ID_ varchar(64) not null, - DEPLOYMENT_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - JOB_ID_ varchar(64), - JOB_DEF_ID_ varchar(64), - BATCH_ID_ varchar(64), - USER_ID_ varchar(255), - TIMESTAMP_ timestamp(3) not null, - OPERATION_TYPE_ varchar(64), - OPERATION_ID_ varchar(64), - ENTITY_TYPE_ varchar(30), - PROPERTY_ varchar(64), - ORG_VALUE_ varchar(4000), - NEW_VALUE_ varchar(4000), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_INCIDENT ( - ID_ varchar(64) not null, - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CREATE_TIME_ timestamp(3) not null, - END_TIME_ timestamp(3) null, - INCIDENT_MSG_ varchar(4000), - INCIDENT_TYPE_ varchar(255) not null, - ACTIVITY_ID_ varchar(255), - CAUSE_INCIDENT_ID_ varchar(64), - ROOT_CAUSE_INCIDENT_ID_ varchar(64), - CONFIGURATION_ varchar(255), - INCIDENT_STATE_ integer, - TENANT_ID_ varchar(64), - JOB_DEF_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_JOB_LOG ( - ID_ varchar(64) not null, - TIMESTAMP_ timestamp(3) not null, - JOB_ID_ varchar(64) not null, - JOB_DUEDATE_ timestamp(3) NULL, - JOB_RETRIES_ integer, - JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, - JOB_EXCEPTION_MSG_ varchar(4000), - JOB_EXCEPTION_STACK_ID_ varchar(64), - JOB_STATE_ integer, - JOB_DEF_ID_ varchar(64), - JOB_DEF_TYPE_ varchar(255), - JOB_DEF_CONFIGURATION_ varchar(255), - ACT_ID_ varchar(255), - EXECUTION_ID_ varchar(64), - PROCESS_INSTANCE_ID_ varchar(64), - PROCESS_DEF_ID_ varchar(64), - PROCESS_DEF_KEY_ varchar(255), - DEPLOYMENT_ID_ varchar(64), - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_BATCH ( - ID_ varchar(64) not null, - TYPE_ varchar(255), - TOTAL_JOBS_ integer, - JOBS_PER_SEED_ integer, - INVOCATIONS_PER_JOB_ integer, - SEED_JOB_DEF_ID_ varchar(64), - MONITOR_JOB_DEF_ID_ varchar(64), - BATCH_JOB_DEF_ID_ varchar(64), - TENANT_ID_ varchar(64), - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_EXT_TASK_LOG ( - ID_ varchar(64) not null, - TIMESTAMP_ timestamp(3) not null, - EXT_TASK_ID_ varchar(64) not null, - RETRIES_ integer, - TOPIC_NAME_ varchar(255), - WORKER_ID_ varchar(255), - PRIORITY_ bigint NOT NULL DEFAULT 0, - ERROR_MSG_ varchar(4000), - ERROR_DETAILS_ID_ varchar(64), - ACT_ID_ varchar(255), - ACT_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - TENANT_ID_ varchar(64), - STATE_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); -create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); -create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); -create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); - -create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); -create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); -create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); -create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); -create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); -create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); -create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); - -create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); -create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); - -create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); -create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); -create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); -create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); -create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); -create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); -create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); -create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); -create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); - -create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); -create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); -create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); -create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); - -create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); -create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); -create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); -create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); -create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); - -create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); -create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); - -create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); -create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); -create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); -create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); -create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); - -create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); -create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); -create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); -create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); - -create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); -create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); -create table ACT_HI_CASEINST ( - ID_ varchar(64) not null, - CASE_INST_ID_ varchar(64) not null, - BUSINESS_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64) not null, - CREATE_TIME_ datetime(3) not null, - CLOSE_TIME_ datetime(3), - DURATION_ bigint, - STATE_ integer, - CREATE_USER_ID_ varchar(255), - SUPER_CASE_INSTANCE_ID_ varchar(64), - SUPER_PROCESS_INSTANCE_ID_ varchar(64), - TENANT_ID_ varchar(64), - primary key (ID_), - unique (CASE_INST_ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_CASEACTINST ( - ID_ varchar(64) not null, - PARENT_ACT_INST_ID_ varchar(64), - CASE_DEF_ID_ varchar(64) not null, - CASE_INST_ID_ varchar(64) not null, - CASE_ACT_ID_ varchar(255) not null, - TASK_ID_ varchar(64), - CALL_PROC_INST_ID_ varchar(64), - CALL_CASE_INST_ID_ varchar(64), - CASE_ACT_NAME_ varchar(255), - CASE_ACT_TYPE_ varchar(255), - CREATE_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - STATE_ integer, - REQUIRED_ boolean, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); -create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); -create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); -create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); -create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); -create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); -create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); -create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); --- create history decision instance table -- -create table ACT_HI_DECINST ( - ID_ varchar(64) NOT NULL, - DEC_DEF_ID_ varchar(64) NOT NULL, - DEC_DEF_KEY_ varchar(255) NOT NULL, - DEC_DEF_NAME_ varchar(255), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - ACT_ID_ varchar(255), - EVAL_TIME_ datetime(3) not null, - COLLECT_VALUE_ double, - USER_ID_ varchar(255), - ROOT_DEC_INST_ID_ varchar(64), - DEC_REQ_ID_ varchar(64), - DEC_REQ_KEY_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create history decision input table -- -create table ACT_HI_DEC_IN ( - ID_ varchar(64) NOT NULL, - DEC_INST_ID_ varchar(64) NOT NULL, - CLAUSE_ID_ varchar(64), - CLAUSE_NAME_ varchar(255), - VAR_TYPE_ varchar(100), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB NULL, - TEXT2_ LONGBLOB NULL, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create history decision output table -- -create table ACT_HI_DEC_OUT ( - ID_ varchar(64) NOT NULL, - DEC_INST_ID_ varchar(64) NOT NULL, - CLAUSE_ID_ varchar(64), - CLAUSE_NAME_ varchar(255), - RULE_ID_ varchar(64), - RULE_ORDER_ integer, - VAR_NAME_ varchar(255), - VAR_TYPE_ varchar(100), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB NULL, - TEXT2_ LONGBLOB NULL, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - - -create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); -create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); -create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); -create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); -create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); -create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); -create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); -create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); -create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); -create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); -create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); - - -create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); -create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); - -create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); -create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); - - --- mariadb identity: - -create table ACT_ID_GROUP ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - TYPE_ varchar(255), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_MEMBERSHIP ( - USER_ID_ varchar(64), - GROUP_ID_ varchar(64), - primary key (USER_ID_, GROUP_ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_USER ( - ID_ varchar(64), - REV_ integer, - FIRST_ varchar(255), - LAST_ varchar(255), - EMAIL_ varchar(255), - PWD_ varchar(255), - SALT_ varchar(255), - PICTURE_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_INFO ( - ID_ varchar(64), - REV_ integer, - USER_ID_ varchar(64), - TYPE_ varchar(64), - KEY_ varchar(255), - VALUE_ varchar(255), - PASSWORD_ LONGBLOB, - PARENT_ID_ varchar(255), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_TENANT ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_TENANT_MEMBER ( - ID_ varchar(64) not null, - TENANT_ID_ varchar(64) not null, - USER_ID_ varchar(64), - GROUP_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); - -alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_UNIQ_TENANT_MEMB_USER - unique (TENANT_ID_, USER_ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_UNIQ_TENANT_MEMB_GROUP - unique (TENANT_ID_, GROUP_ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_FK_TENANT_MEMB - foreign key (TENANT_ID_) - references ACT_ID_TENANT (ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_FK_TENANT_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_FK_TENANT_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); - diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.8.0-ee.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.8.0-ee.sql deleted file mode 100644 index 712b58860f..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.8.0-ee.sql +++ /dev/null @@ -1,1226 +0,0 @@ -# Start of Statements added for MSO -DROP DATABASE IF EXISTS `camundabpmn`; - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `camundabpmn` /*!40100 DEFAULT CHARACTER SET latin1 */; - -USE `camundabpmn`; - -# DROP USER IF EXISTS 'camunda'; -#delete from mysql.user where User='camunda'; -#CREATE USER 'camunda'; -#GRANT ALL on camundabpmn.* to 'camunda' identified by 'camunda123' with GRANT OPTION; -FLUSH PRIVILEGES; -# End of Statements added for MSO - - -create table ACT_GE_PROPERTY ( - NAME_ varchar(64), - VALUE_ varchar(300), - REV_ integer, - primary key (NAME_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -insert into ACT_GE_PROPERTY -values ('schema.version', 'fox', 1); - -insert into ACT_GE_PROPERTY -values ('schema.history', 'create(fox)', 1); - -insert into ACT_GE_PROPERTY -values ('next.dbid', '1', 1); - -insert into ACT_GE_PROPERTY -values ('deployment.lock', '0', 1); - -insert into ACT_GE_PROPERTY -values ('history.cleanup.job.lock', '0', 1); - -insert into ACT_GE_PROPERTY -values ('startup.lock', '0', 1); - -create table ACT_GE_BYTEARRAY ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - DEPLOYMENT_ID_ varchar(64), - BYTES_ LONGBLOB, - GENERATED_ TINYINT, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RE_DEPLOYMENT ( - ID_ varchar(64), - NAME_ varchar(255), - DEPLOY_TIME_ timestamp(3), - SOURCE_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_EXECUTION ( - ID_ varchar(64), - REV_ integer, - PROC_INST_ID_ varchar(64), - BUSINESS_KEY_ varchar(255), - PARENT_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - SUPER_EXEC_ varchar(64), - SUPER_CASE_EXEC_ varchar(64), - CASE_INST_ID_ varchar(64), - ACT_ID_ varchar(255), - ACT_INST_ID_ varchar(64), - IS_ACTIVE_ TINYINT, - IS_CONCURRENT_ TINYINT, - IS_SCOPE_ TINYINT, - IS_EVENT_SCOPE_ TINYINT, - SUSPENSION_STATE_ integer, - CACHED_ENT_STATE_ integer, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_JOB ( - ID_ varchar(64) NOT NULL, - REV_ integer, - TYPE_ varchar(255) NOT NULL, - LOCK_EXP_TIME_ timestamp(3) NULL, - LOCK_OWNER_ varchar(255), - EXCLUSIVE_ boolean, - EXECUTION_ID_ varchar(64), - PROCESS_INSTANCE_ID_ varchar(64), - PROCESS_DEF_ID_ varchar(64), - PROCESS_DEF_KEY_ varchar(255), - RETRIES_ integer, - EXCEPTION_STACK_ID_ varchar(64), - EXCEPTION_MSG_ varchar(4000), - DUEDATE_ timestamp(3) NULL, - REPEAT_ varchar(255), - HANDLER_TYPE_ varchar(255), - HANDLER_CFG_ varchar(4000), - DEPLOYMENT_ID_ varchar(64), - SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, - JOB_DEF_ID_ varchar(64), - PRIORITY_ bigint NOT NULL DEFAULT 0, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_JOBDEF ( - ID_ varchar(64) NOT NULL, - REV_ integer, - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - ACT_ID_ varchar(255), - JOB_TYPE_ varchar(255) NOT NULL, - JOB_CONFIGURATION_ varchar(255), - SUSPENSION_STATE_ integer, - JOB_PRIORITY_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RE_PROCDEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - HAS_START_FORM_KEY_ TINYINT, - SUSPENSION_STATE_ integer, - TENANT_ID_ varchar(64), - VERSION_TAG_ varchar(64), - HISTORY_TTL_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_TASK ( - ID_ varchar(64), - REV_ integer, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_DEF_ID_ varchar(64), - NAME_ varchar(255), - PARENT_TASK_ID_ varchar(64), - DESCRIPTION_ varchar(4000), - TASK_DEF_KEY_ varchar(255), - OWNER_ varchar(255), - ASSIGNEE_ varchar(255), - DELEGATION_ varchar(64), - PRIORITY_ integer, - CREATE_TIME_ timestamp(3), - DUE_DATE_ datetime(3), - FOLLOW_UP_DATE_ datetime(3), - SUSPENSION_STATE_ integer, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_IDENTITYLINK ( - ID_ varchar(64), - REV_ integer, - GROUP_ID_ varchar(255), - TYPE_ varchar(255), - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_VARIABLE ( - ID_ varchar(64) not null, - REV_ integer, - TYPE_ varchar(255) not null, - NAME_ varchar(255) not null, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - TASK_ID_ varchar(64), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB, - TEXT2_ LONGBLOB, - VAR_SCOPE_ varchar(64) not null, - SEQUENCE_COUNTER_ bigint, - IS_CONCURRENT_LOCAL_ TINYINT, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_EVENT_SUBSCR ( - ID_ varchar(64) not null, - REV_ integer, - EVENT_TYPE_ varchar(255) not null, - EVENT_NAME_ varchar(255), - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - ACTIVITY_ID_ varchar(255), - CONFIGURATION_ varchar(255), - CREATED_ timestamp(3) not null, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_INCIDENT ( - ID_ varchar(64) not null, - REV_ integer not null, - INCIDENT_TIMESTAMP_ timestamp(3) not null, - INCIDENT_MSG_ varchar(4000), - INCIDENT_TYPE_ varchar(255) not null, - EXECUTION_ID_ varchar(64), - ACTIVITY_ID_ varchar(255), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - CAUSE_INCIDENT_ID_ varchar(64), - ROOT_CAUSE_INCIDENT_ID_ varchar(64), - CONFIGURATION_ varchar(255), - TENANT_ID_ varchar(64), - JOB_DEF_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_AUTHORIZATION ( - ID_ varchar(64) not null, - REV_ integer not null, - TYPE_ integer not null, - GROUP_ID_ varchar(255), - USER_ID_ varchar(255), - RESOURCE_TYPE_ integer not null, - RESOURCE_ID_ varchar(255), - PERMS_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_FILTER ( - ID_ varchar(64) not null, - REV_ integer not null, - RESOURCE_TYPE_ varchar(255) not null, - NAME_ varchar(255) not null, - OWNER_ varchar(255), - QUERY_ LONGTEXT not null, - PROPERTIES_ LONGTEXT, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_METER_LOG ( - ID_ varchar(64) not null, - NAME_ varchar(64) not null, - REPORTER_ varchar(255), - VALUE_ bigint, - TIMESTAMP_ timestamp(3), - MILLISECONDS_ bigint DEFAULT 0, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_EXT_TASK ( - ID_ varchar(64) not null, - REV_ integer not null, - WORKER_ID_ varchar(255), - TOPIC_NAME_ varchar(255), - RETRIES_ integer, - ERROR_MSG_ varchar(4000), - ERROR_DETAILS_ID_ varchar(64), - LOCK_EXP_TIME_ timestamp(3) NULL, - SUSPENSION_STATE_ integer, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - ACT_ID_ varchar(255), - ACT_INST_ID_ varchar(64), - TENANT_ID_ varchar(64), - PRIORITY_ bigint NOT NULL DEFAULT 0, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_RU_BATCH ( - ID_ varchar(64) not null, - REV_ integer not null, - TYPE_ varchar(255), - TOTAL_JOBS_ integer, - JOBS_CREATED_ integer, - JOBS_PER_SEED_ integer, - INVOCATIONS_PER_JOB_ integer, - SEED_JOB_DEF_ID_ varchar(64), - BATCH_JOB_DEF_ID_ varchar(64), - MONITOR_JOB_DEF_ID_ varchar(64), - SUSPENSION_STATE_ integer, - CONFIGURATION_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); -create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); -create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); -create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); -create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); -create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); -create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); -create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); -create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); -create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); -create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); -create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); -create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); -create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); --- CAM-5914 -create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); --- this index needs to be limited in mariadb see CAM-6938 -create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); -create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); -create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); -create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); - --- new metric milliseconds column -CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); -CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); -CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); - --- old metric timestamp column -CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); -CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); - -create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); -create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); -create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); -create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); -create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); -create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); - -alter table ACT_GE_BYTEARRAY - add constraint ACT_FK_BYTEARR_DEPL - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_SUPER - foreign key (SUPER_EXEC_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); - -alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_TSKASS_TASK - foreign key (TASK_ID_) - references ACT_RU_TASK (ID_); - -alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_ATHRZ_PROCEDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF(ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION(ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_BYTEARRAY - foreign key (BYTEARRAY_ID_) - references ACT_GE_BYTEARRAY (ID_); - -alter table ACT_RU_JOB - add constraint ACT_FK_JOB_EXCEPTION - foreign key (EXCEPTION_STACK_ID_) - references ACT_GE_BYTEARRAY (ID_); - -alter table ACT_RU_EVENT_SUBSCR - add constraint ACT_FK_EVENT_EXEC - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION(ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_CAUSE - foreign key (CAUSE_INCIDENT_ID_) - references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; - -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_RCAUSE - foreign key (ROOT_CAUSE_INCIDENT_ID_) - references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; - -alter table ACT_RU_EXT_TASK - add constraint ACT_FK_EXT_TASK_ERROR_DETAILS - foreign key (ERROR_DETAILS_ID_) - references ACT_GE_BYTEARRAY (ID_); - -create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); -alter table ACT_RU_INCIDENT - add constraint ACT_FK_INC_JOB_DEF - foreign key (JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - -alter table ACT_RU_AUTHORIZATION - add constraint ACT_UNIQ_AUTH_USER - unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); - -alter table ACT_RU_AUTHORIZATION - add constraint ACT_UNIQ_AUTH_GROUP - unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_UNIQ_VARIABLE - unique (VAR_SCOPE_, NAME_); - -alter table ACT_RU_EXT_TASK - add constraint ACT_FK_EXT_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); - -create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); -alter table ACT_RU_BATCH - add constraint ACT_FK_BATCH_SEED_JOB_DEF - foreign key (SEED_JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - -create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); -alter table ACT_RU_BATCH - add constraint ACT_FK_BATCH_MONITOR_JOB_DEF - foreign key (MONITOR_JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - -create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); -alter table ACT_RU_BATCH - add constraint ACT_FK_BATCH_JOB_DEF - foreign key (BATCH_JOB_DEF_ID_) - references ACT_RU_JOBDEF (ID_); - --- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- -create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); -create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); -create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); -create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); -create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); --- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- -create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); --- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- -create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); - --- indexes to improve deployment -create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); -create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); -create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); -create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); -create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); -create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); -create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); -create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); -create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); --- create case definition table -- -create table ACT_RE_CASE_DEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - TENANT_ID_ varchar(64), - HISTORY_TTL_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create case execution table -- -create table ACT_RU_CASE_EXECUTION ( - ID_ varchar(64) NOT NULL, - REV_ integer, - CASE_INST_ID_ varchar(64), - SUPER_CASE_EXEC_ varchar(64), - SUPER_EXEC_ varchar(64), - BUSINESS_KEY_ varchar(255), - PARENT_ID_ varchar(64), - CASE_DEF_ID_ varchar(64), - ACT_ID_ varchar(255), - PREV_STATE_ integer, - CURRENT_STATE_ integer, - REQUIRED_ boolean, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create case sentry part table -- - -create table ACT_RU_CASE_SENTRY_PART ( - ID_ varchar(64) NOT NULL, - REV_ integer, - CASE_INST_ID_ varchar(64), - CASE_EXEC_ID_ varchar(64), - SENTRY_ID_ varchar(255), - TYPE_ varchar(255), - SOURCE_CASE_EXEC_ID_ varchar(64), - STANDARD_EVENT_ varchar(255), - SOURCE_ varchar(255), - VARIABLE_EVENT_ varchar(255), - VARIABLE_NAME_ varchar(255), - SATISFIED_ boolean, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create index on business key -- -create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); - --- create foreign key constraints on ACT_RU_CASE_EXECUTION -- -alter table ACT_RU_CASE_EXECUTION - add constraint ACT_FK_CASE_EXE_CASE_INST - foreign key (CASE_INST_ID_) - references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; - -alter table ACT_RU_CASE_EXECUTION - add constraint ACT_FK_CASE_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_CASE_EXECUTION - add constraint ACT_FK_CASE_EXE_CASE_DEF - foreign key (CASE_DEF_ID_) - references ACT_RE_CASE_DEF(ID_); - --- create foreign key constraints on ACT_RU_VARIABLE -- -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_CASE_EXE - foreign key (CASE_EXECUTION_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_CASE_INST - foreign key (CASE_INST_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - --- create foreign key constraints on ACT_RU_TASK -- -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_CASE_EXE - foreign key (CASE_EXECUTION_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_TASK - add constraint ACT_FK_TASK_CASE_DEF - foreign key (CASE_DEF_ID_) - references ACT_RE_CASE_DEF(ID_); - --- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- -alter table ACT_RU_CASE_SENTRY_PART - add constraint ACT_FK_CASE_SENTRY_CASE_INST - foreign key (CASE_INST_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -alter table ACT_RU_CASE_SENTRY_PART - add constraint ACT_FK_CASE_SENTRY_CASE_EXEC - foreign key (CASE_EXEC_ID_) - references ACT_RU_CASE_EXECUTION(ID_); - -create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); -create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); --- create decision definition table -- -create table ACT_RE_DECISION_DEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - DEC_REQ_ID_ varchar(64), - DEC_REQ_KEY_ varchar(255), - TENANT_ID_ varchar(64), - HISTORY_TTL_ integer, - VERSION_TAG_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create decision requirements definition table -- -create table ACT_RE_DECISION_REQ_DEF ( - ID_ varchar(64) NOT NULL, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) NOT NULL, - VERSION_ integer NOT NULL, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -alter table ACT_RE_DECISION_DEF - add constraint ACT_FK_DEC_REQ - foreign key (DEC_REQ_ID_) - references ACT_RE_DECISION_REQ_DEF(ID_); - -create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); -create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); -create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); -create table ACT_HI_PROCINST ( - ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) not null, - BUSINESS_KEY_ varchar(255), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64) not null, - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - START_USER_ID_ varchar(255), - START_ACT_ID_ varchar(255), - END_ACT_ID_ varchar(255), - SUPER_PROCESS_INSTANCE_ID_ varchar(64), - SUPER_CASE_INSTANCE_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - DELETE_REASON_ varchar(4000), - TENANT_ID_ varchar(64), - STATE_ varchar(255), - primary key (ID_), - unique (PROC_INST_ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_ACTINST ( - ID_ varchar(64) not null, - PARENT_ACT_INST_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) not null, - EXECUTION_ID_ varchar(64) not null, - ACT_ID_ varchar(255) not null, - TASK_ID_ varchar(64), - CALL_PROC_INST_ID_ varchar(64), - CALL_CASE_INST_ID_ varchar(64), - ACT_NAME_ varchar(255), - ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - ACT_INST_STATE_ integer, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_TASKINST ( - ID_ varchar(64) not null, - TASK_DEF_KEY_ varchar(255), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - NAME_ varchar(255), - PARENT_TASK_ID_ varchar(64), - DESCRIPTION_ varchar(4000), - OWNER_ varchar(255), - ASSIGNEE_ varchar(255), - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - DELETE_REASON_ varchar(4000), - PRIORITY_ integer, - DUE_DATE_ datetime(3), - FOLLOW_UP_DATE_ datetime(3), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_VARINST ( - ID_ varchar(64) not null, - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - NAME_ varchar(255) not null, - VAR_TYPE_ varchar(100), - REV_ integer, - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB, - TEXT2_ LONGBLOB, - TENANT_ID_ varchar(64), - STATE_ varchar(20), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_DETAIL ( - ID_ varchar(64) not null, - TYPE_ varchar(255) not null, - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - VAR_INST_ID_ varchar(64), - NAME_ varchar(255) not null, - VAR_TYPE_ varchar(255), - REV_ integer, - TIME_ datetime(3) not null, - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB, - TEXT2_ LONGBLOB, - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - OPERATION_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_IDENTITYLINK ( - ID_ varchar(64) not null, - TIMESTAMP_ timestamp(3) not null, - TYPE_ varchar(255), - USER_ID_ varchar(255), - GROUP_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - OPERATION_TYPE_ varchar(64), - ASSIGNER_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_COMMENT ( - ID_ varchar(64) not null, - TYPE_ varchar(255), - TIME_ datetime(3) not null, - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - ACTION_ varchar(255), - MESSAGE_ varchar(4000), - FULL_MSG_ LONGBLOB, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_ATTACHMENT ( - ID_ varchar(64) not null, - REV_ integer, - USER_ID_ varchar(255), - NAME_ varchar(255), - DESCRIPTION_ varchar(4000), - TYPE_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - URL_ varchar(4000), - CONTENT_ID_ varchar(64), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_OP_LOG ( - ID_ varchar(64) not null, - DEPLOYMENT_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - CASE_EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - JOB_ID_ varchar(64), - JOB_DEF_ID_ varchar(64), - BATCH_ID_ varchar(64), - USER_ID_ varchar(255), - TIMESTAMP_ timestamp(3) not null, - OPERATION_TYPE_ varchar(64), - OPERATION_ID_ varchar(64), - ENTITY_TYPE_ varchar(30), - PROPERTY_ varchar(64), - ORG_VALUE_ varchar(4000), - NEW_VALUE_ varchar(4000), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_INCIDENT ( - ID_ varchar(64) not null, - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - CREATE_TIME_ timestamp(3) not null, - END_TIME_ timestamp(3) null, - INCIDENT_MSG_ varchar(4000), - INCIDENT_TYPE_ varchar(255) not null, - ACTIVITY_ID_ varchar(255), - CAUSE_INCIDENT_ID_ varchar(64), - ROOT_CAUSE_INCIDENT_ID_ varchar(64), - CONFIGURATION_ varchar(255), - INCIDENT_STATE_ integer, - TENANT_ID_ varchar(64), - JOB_DEF_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_JOB_LOG ( - ID_ varchar(64) not null, - TIMESTAMP_ timestamp(3) not null, - JOB_ID_ varchar(64) not null, - JOB_DUEDATE_ timestamp(3) NULL, - JOB_RETRIES_ integer, - JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, - JOB_EXCEPTION_MSG_ varchar(4000), - JOB_EXCEPTION_STACK_ID_ varchar(64), - JOB_STATE_ integer, - JOB_DEF_ID_ varchar(64), - JOB_DEF_TYPE_ varchar(255), - JOB_DEF_CONFIGURATION_ varchar(255), - ACT_ID_ varchar(255), - EXECUTION_ID_ varchar(64), - PROCESS_INSTANCE_ID_ varchar(64), - PROCESS_DEF_ID_ varchar(64), - PROCESS_DEF_KEY_ varchar(255), - DEPLOYMENT_ID_ varchar(64), - SEQUENCE_COUNTER_ bigint, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_BATCH ( - ID_ varchar(64) not null, - TYPE_ varchar(255), - TOTAL_JOBS_ integer, - JOBS_PER_SEED_ integer, - INVOCATIONS_PER_JOB_ integer, - SEED_JOB_DEF_ID_ varchar(64), - MONITOR_JOB_DEF_ID_ varchar(64), - BATCH_JOB_DEF_ID_ varchar(64), - TENANT_ID_ varchar(64), - START_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_EXT_TASK_LOG ( - ID_ varchar(64) not null, - TIMESTAMP_ timestamp(3) not null, - EXT_TASK_ID_ varchar(64) not null, - RETRIES_ integer, - TOPIC_NAME_ varchar(255), - WORKER_ID_ varchar(255), - PRIORITY_ bigint NOT NULL DEFAULT 0, - ERROR_MSG_ varchar(4000), - ERROR_DETAILS_ID_ varchar(64), - ACT_ID_ varchar(255), - ACT_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - PROC_DEF_KEY_ varchar(255), - TENANT_ID_ varchar(64), - STATE_ integer, - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); -create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); -create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); -create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); - -create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); -create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); -create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); -create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); -create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); -create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); -create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); - -create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); -create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); -create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); -create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); - -create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); -create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); -create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); -create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); -create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); -create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); -create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); -create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); -create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); -create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); - -create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); -create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); -create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); -create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); -create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); - -create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); -create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); -create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); -create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); -create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); -create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); - -create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); -create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); -create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); - -create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); -create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); -create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); -create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); -create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); -create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); - -create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); -create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); -create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); -create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); -create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); - -create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); -create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); - -create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); -create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); - -create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); -create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); -create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); -create table ACT_HI_CASEINST ( - ID_ varchar(64) not null, - CASE_INST_ID_ varchar(64) not null, - BUSINESS_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64) not null, - CREATE_TIME_ datetime(3) not null, - CLOSE_TIME_ datetime(3), - DURATION_ bigint, - STATE_ integer, - CREATE_USER_ID_ varchar(255), - SUPER_CASE_INSTANCE_ID_ varchar(64), - SUPER_PROCESS_INSTANCE_ID_ varchar(64), - TENANT_ID_ varchar(64), - primary key (ID_), - unique (CASE_INST_ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_HI_CASEACTINST ( - ID_ varchar(64) not null, - PARENT_ACT_INST_ID_ varchar(64), - CASE_DEF_ID_ varchar(64) not null, - CASE_INST_ID_ varchar(64) not null, - CASE_ACT_ID_ varchar(255) not null, - TASK_ID_ varchar(64), - CALL_PROC_INST_ID_ varchar(64), - CALL_CASE_INST_ID_ varchar(64), - CASE_ACT_NAME_ varchar(255), - CASE_ACT_TYPE_ varchar(255), - CREATE_TIME_ datetime(3) not null, - END_TIME_ datetime(3), - DURATION_ bigint, - STATE_ integer, - REQUIRED_ boolean, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); -create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); -create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); -create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); -create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); -create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); -create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); -create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); --- create history decision instance table -- -create table ACT_HI_DECINST ( - ID_ varchar(64) NOT NULL, - DEC_DEF_ID_ varchar(64) NOT NULL, - DEC_DEF_KEY_ varchar(255) NOT NULL, - DEC_DEF_NAME_ varchar(255), - PROC_DEF_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - CASE_DEF_KEY_ varchar(255), - CASE_DEF_ID_ varchar(64), - CASE_INST_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - ACT_ID_ varchar(255), - EVAL_TIME_ datetime(3) not null, - COLLECT_VALUE_ double, - USER_ID_ varchar(255), - ROOT_DEC_INST_ID_ varchar(64), - DEC_REQ_ID_ varchar(64), - DEC_REQ_KEY_ varchar(255), - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create history decision input table -- -create table ACT_HI_DEC_IN ( - ID_ varchar(64) NOT NULL, - DEC_INST_ID_ varchar(64) NOT NULL, - CLAUSE_ID_ varchar(64), - CLAUSE_NAME_ varchar(255), - VAR_TYPE_ varchar(100), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB, - TEXT2_ LONGBLOB, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- create history decision output table -- -create table ACT_HI_DEC_OUT ( - ID_ varchar(64) NOT NULL, - DEC_INST_ID_ varchar(64) NOT NULL, - CLAUSE_ID_ varchar(64), - CLAUSE_NAME_ varchar(255), - RULE_ID_ varchar(64), - RULE_ORDER_ integer, - VAR_NAME_ varchar(255), - VAR_TYPE_ varchar(100), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ LONGBLOB, - TEXT2_ LONGBLOB, - TENANT_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - - -create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); -create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); -create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); -create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); -create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); -create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); -create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); -create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); -create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); -create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); -create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); - - -create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); -create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); - -create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); -create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); - --- mariadb_identity_7.8.0-ee - -create table ACT_ID_GROUP ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - TYPE_ varchar(255), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_MEMBERSHIP ( - USER_ID_ varchar(64), - GROUP_ID_ varchar(64), - primary key (USER_ID_, GROUP_ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_USER ( - ID_ varchar(64), - REV_ integer, - FIRST_ varchar(255), - LAST_ varchar(255), - EMAIL_ varchar(255), - PWD_ varchar(255), - SALT_ varchar(255), - PICTURE_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_INFO ( - ID_ varchar(64), - REV_ integer, - USER_ID_ varchar(64), - TYPE_ varchar(64), - KEY_ varchar(255), - VALUE_ varchar(255), - PASSWORD_ LONGBLOB, - PARENT_ID_ varchar(255), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_TENANT ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -create table ACT_ID_TENANT_MEMBER ( - ID_ varchar(64) not null, - TENANT_ID_ varchar(64) not null, - USER_ID_ varchar(64), - GROUP_ID_ varchar(64), - primary key (ID_) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - -alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); - -alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_UNIQ_TENANT_MEMB_USER - unique (TENANT_ID_, USER_ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_UNIQ_TENANT_MEMB_GROUP - unique (TENANT_ID_, GROUP_ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_FK_TENANT_MEMB - foreign key (TENANT_ID_) - references ACT_ID_TENANT (ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_FK_TENANT_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); - -alter table ACT_ID_TENANT_MEMBER - add constraint ACT_FK_TENANT_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); - --- additional changes for MSO - --- Table for the urn mapping entries -CREATE TABLE `mso_urn_mapping` ( -`NAME_` VARCHAR(64) NOT NULL COLLATE 'utf8_bin', -`VALUE_` VARCHAR(300) NULL DEFAULT NULL COLLATE 'utf8_bin', -`REV_` INT(11) NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; - --- setting history level from full (id=3) to audit (id=2) -update act_ge_property set value_='2' where name_='historyLevel';
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.8_patch_7.8.0_to_7.8.2.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.8_patch_7.8.0_to_7.8.2.sql deleted file mode 100644 index 783695750b..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.8_patch_7.8.0_to_7.8.2.sql +++ /dev/null @@ -1,7 +0,0 @@ --- 7.8.0 to 7.8.2 upgrade - -USE `camundabpmn`; --- https://app.camunda.com/jira/browse/CAM-8485 -drop index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST; -create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, PROC_INST_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); -create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_TIME_); diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_create_camunda_admin.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_create_camunda_admin.sql deleted file mode 100644 index 4472fbefcf..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_create_camunda_admin.sql +++ /dev/null @@ -1,9 +0,0 @@ -USE camundabpmn; - -INSERT INTO `act_id_user` VALUES ('admin',1,'admin','user','camundaadmin@openecomp.org','{SHA}Y7MVubSDgzJeaulJRLN2dFyNCyc=',NULL); - -INSERT INTO `act_id_group` VALUES ('camunda-admin',1,'camunda BPM Administrators','SYSTEM'); - -INSERT INTO `act_id_membership` VALUES ('admin','camunda-admin'); - -INSERT INTO `act_ru_authorization` VALUES ('4ca68335-b7c5-11e6-b411-0242ac110003',1,1,NULL,'admin',1,'admin',2147483647),('4ca91b46-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,2,'camunda-admin',2),('4cab3e27-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,0,'*',2147483647),('4cadd638-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,1,'*',2147483647),('4caf0eb9-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,2,'*',2147483647),('4caff91a-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,3,'*',2147483647),('4cb10a8b-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,4,'*',2147483647),('4cb2430c-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,5,'*',2147483647),('4cb32d6d-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,6,'*',2147483647),('4cb43ede-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,7,'*',2147483647),('4cb5293f-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,8,'*',2147483647),('4cb5ec90-b7c5-11e6-b411-0242ac110003',1,1,'camunda-admin',NULL,9,'*',2147483647); diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/catalog_add_constraints.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/catalog_add_constraints.sql deleted file mode 100644 index a5e9834de2..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/catalog_add_constraints.sql +++ /dev/null @@ -1,45 +0,0 @@ -USE `mso_catalog`; - -ALTER TABLE `mso_catalog`.`service_to_allotted_resources` - ADD INDEX `fk_service_to_allotted_resources__service_model_uuid_idx` (`SERVICE_MODEL_UUID` ASC), - ADD INDEX `fk_service_to_allotted_resources__allotted_resource_customiz_idx` (`AR_MODEL_CUSTOMIZATION_UUID` ASC), - ADD CONSTRAINT `fk_service_to_allotted_resources__service__service_name_ver_id` - FOREIGN KEY (`SERVICE_MODEL_UUID`) - REFERENCES `mso_catalog`.`service` (`SERVICE_NAME_VERSION_ID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_service_to_allotted_resources__allotted_resource_customizat1` - FOREIGN KEY (`AR_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `mso_catalog`.`allotted_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - - -ALTER TABLE `mso_catalog`.`service_to_networks` - ADD INDEX `fk_service_to_networks__service_model_uuid_idx` (`SERVICE_MODEL_UUID` ASC), - ADD INDEX `fk_service_to_networks__network_resource_customization1_idx` (`NETWORK_MODEL_CUSTOMIZATION_UUID` ASC), - ADD CONSTRAINT `fk_service_to_networks__service__service_name_version_id` - FOREIGN KEY (`SERVICE_MODEL_UUID`) - REFERENCES `mso_catalog`.`service` (`SERVICE_NAME_VERSION_ID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_service_to_networks__network_resource_customization1` - FOREIGN KEY (`NETWORK_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `mso_catalog`.`network_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - - -ALTER TABLE `mso_catalog`.`vf_module` - ADD INDEX `UK_model_customization_uuid__asdc_service_model_version` (`MODEL_CUSTOMIZATION_UUID` ASC, `ASDC_SERVICE_MODEL_VERSION` ASC); - -ALTER TABLE `mso_catalog`.`vnf_resource` - ADD UNIQUE INDEX `UK_model_customization_uuid__asdc_service_model_version` (`MODEL_CUSTOMIZATION_UUID` ASC, `ASDC_SERVICE_MODEL_VERSION` ASC); - -ALTER TABLE `mso_catalog`.`network_resource_customization` - ADD INDEX `fk_network_resource_customization__network_resource_id_idx` (`NETWORK_RESOURCE_ID` ASC), - ADD CONSTRAINT `fk_network_resource_customization__network_resource__id` - FOREIGN KEY (`NETWORK_RESOURCE_ID`) - REFERENCES `mso_catalog`.`network_resource` (`id`) - ON DELETE CASCADE - ON UPDATE CASCADE;
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/catalog_timestamp_mso_db.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/catalog_timestamp_mso_db.sql deleted file mode 100644 index bc88adcc70..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/catalog_timestamp_mso_db.sql +++ /dev/null @@ -1,19 +0,0 @@ -USE `mso_catalog`; - -ALTER TABLE HEAT_ENVIRONMENT MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE NETWORK_RECIPE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE NETWORK_RESOURCE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE SERVICE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE VNF_COMPONENTS MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE VNF_COMPONENTS_RECIPE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE VNF_RECIPE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE VNF_RESOURCE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE HEAT_FILES MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE HEAT_TEMPLATE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE VF_MODULE MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE SERVICE_RECIPE MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE NETWORK_RESOURCE_CUSTOMIZATION MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE ALLOTTED_RESOURCE_CUSTOMIZATION MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE SERVICE_TO_ALLOTTED_RESOURCES MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; -ALTER TABLE SERVICE_TO_NETWORKS MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; - diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/site_status_updated_timestamp.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/site_status_updated_timestamp.sql deleted file mode 100644 index 3b2de4c0b7..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/old-scripts/site_status_updated_timestamp.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE SITE_STATUS MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalogdb/V2.10__UpdateNorthboundRequestToUseInstance.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalogdb/V2.10__UpdateNorthboundRequestToUseInstance.sql deleted file mode 100644 index 5ee4deb26e..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalogdb/V2.10__UpdateNorthboundRequestToUseInstance.sql +++ /dev/null @@ -1,24 +0,0 @@ -USE catalogdb; - - - -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'Service-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'Service-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'assignInstance' WHERE MACRO_ACTION = 'Service-Macro-Assign'; -UPDATE northbound_request_ref_lookup SET ACTION = 'activateInstance' WHERE MACRO_ACTION = 'Service-Macro-Activate'; -UPDATE northbound_request_ref_lookup SET ACTION = 'unassignInstance' WHERE MACRO_ACTION = 'Service-Macro-Unassign'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'Service-Macro-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'Service-Macro-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'Network-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'Network-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'replaceInstance' WHERE MACRO_ACTION = 'VNF-Macro-Replace'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'VNF-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'VNF-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'VolumeGroup-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'VolumeGroup-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'VFModule-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'VFModule-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'deleteInstance' WHERE MACRO_ACTION = 'AVPNBonding-Macro-Delete'; -UPDATE northbound_request_ref_lookup SET ACTION = 'createInstance' WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create';
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalogdb/V3.0__UpdateOrchFlowTableWithATTFlows.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalogdb/V3.0__UpdateOrchFlowTableWithATTFlows.sql deleted file mode 100644 index ec9848563a..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalogdb/V3.0__UpdateOrchFlowTableWithATTFlows.sql +++ /dev/null @@ -1,16 +0,0 @@ -USE catalogdb; - -UPDATE orchestration_flow_reference SET FLOW_NAME = 'AssignServiceInstanceATTBB' WHERE FLOW_NAME = 'AssignServiceInstanceBB'; -UPDATE orchestration_flow_reference SET FLOW_NAME = 'ActivateServiceInstanceATTBB' WHERE FLOW_NAME = 'ActivateServiceInstanceBB'; -UPDATE orchestration_flow_reference SET FLOW_NAME = 'DeactivateServiceInstanceATTBB' WHERE FLOW_NAME = 'DeactivateServiceInstanceBB'; -UPDATE orchestration_flow_reference SET FLOW_NAME = 'UnassignServiceInstanceATTBB' WHERE FLOW_NAME = 'UnassignServiceInstanceBB'; - -UPDATE rainy_day_handler_macro SET FLOW_NAME = 'AssignServiceInstanceATTBB' WHERE FLOW_NAME = 'AssignServiceInstanceBB'; -UPDATE rainy_day_handler_macro SET FLOW_NAME = 'ActivateServiceInstanceATTBB' WHERE FLOW_NAME = 'ActivateServiceInstanceBB'; -UPDATE rainy_day_handler_macro SET FLOW_NAME = 'DeactivateServiceInstanceATTBB' WHERE FLOW_NAME = 'DeactivateServiceInstanceBB'; -UPDATE rainy_day_handler_macro SET FLOW_NAME = 'UnassignServiceInstanceATTBB' WHERE FLOW_NAME = 'UnassignServiceInstanceBB'; - -UPDATE building_block_detail SET BUILDING_BLOCK_NAME = 'AssignServiceInstanceATTBB' WHERE BUILDING_BLOCK_NAME = 'AssignServiceInstanceBB'; -UPDATE building_block_detail SET BUILDING_BLOCK_NAME = 'ActivateServiceInstanceATTBB' WHERE BUILDING_BLOCK_NAME = 'ActivateServiceInstanceBB'; -UPDATE building_block_detail SET BUILDING_BLOCK_NAME = 'DeactivateServiceInstanceATTBB' WHERE BUILDING_BLOCK_NAME = 'DeactivateServiceInstanceBB'; -UPDATE building_block_detail SET BUILDING_BLOCK_NAME = 'UnassignServiceInstanceATTBB' WHERE BUILDING_BLOCK_NAME = 'UnassignServiceInstanceBB';
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/load-sql-files-tests-automation.sh b/packages/root-pack-extras/config-resources/mariadb/load-sql-files-tests-automation.sh deleted file mode 100644 index d974c1d4bb..0000000000 --- a/packages/root-pack-extras/config-resources/mariadb/load-sql-files-tests-automation.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# ============LICENSE_START========================================== -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END============================================ -# -# ECOMP and OpenECOMP are trademarks -# and service marks of AT&T Intellectual Property. -# -cd /docker-entrypoint-initdb.d/db-sql-scripts/bulkload-files/automated-tests -mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < create_mso_db-tests.sql
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/camunda/archive_mariadb_camunda_tables.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/camunda/archive_mariadb_camunda_tables.sql deleted file mode 100644 index 43a87916ce..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/camunda/archive_mariadb_camunda_tables.sql +++ /dev/null @@ -1,665 +0,0 @@ --- Fix for https://itrack.web.att.com/browse/AJSCCMDA-90 -- -use camundabpmn; - -/* uncomment below statement and run for your db, e.g. : use camundabpmn; - */ --- use <db_name>; - -/* -Drop a archive tables -*/ -/*-- TMP_ARCHIVING_PROCINST */ -DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST; - -/*-- TMP_ARCHIVING_BYTEARRAY */ -DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY; - -/*-- TMP LOG TABLE */ -DROP TABLE IF EXISTS TMPLOGTABLE; - -/* -- Camunda Hi Tables --*/ -DROP TABLE IF EXISTS Camunda_Hi_Tables; - -/* drop own extentions columns: -alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); -*/ - -/*--#1 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST; -/*--#2 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST; -/*--#3 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST; -/*--#4 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST; -/*--#5 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL; -/*--#6 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT; -/*--#7 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT; -/*--#8 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG; -/*--#9 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT; -/*--#10 */ -DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY; - -/* drop PL SQL procedures: */ -DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; -DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; - -/*-- Sequence */ --- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence - DROP PROCEDURE IF EXISTS DropSequence; - -/*-- To Drop the MariaDB specific user defined procedures and functions */ -DROP FUNCTION IF EXISTS NextVal; -DROP PROCEDURE IF EXISTS CreateSequence; -DROP PROCEDURE IF EXISTS DropSequence; -DROP TABLE IF EXISTS _sequences; - -/* -- If only the sequence: STAT_EXECUTION_SEQ needs to be removed, uncomment and use below statements --*/ -/* - DELIMITER // - CREATE PROCEDURE DropSequence (vname VARCHAR(30)) - BEGIN - -- Drop the sequence - DELETE FROM _sequences WHERE name = vname; - END - // - DELIMITER ; - --- use the above procedure to drop sequence -CALL DropSequence('STAT_EXECUTION_SEQ'); -*/ - - - - - -/* - 1. Create starts - Add some Camunda Indexes to history schema part (for Archiving) -*/ -create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_); -create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_); - - -/* - 2. Create Archiving Tables in current schema -*/ - -/*-- TMP_ARCHIVING_PROCINST */ -CREATE TABLE TMP_ARCHIVING_PROCINST -( PROC_INST_ID_ varchar(64) not null, - END_TIME_ datetime(3) -); -CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_); - -/*-- TMP_ARCHIVING_BYTEARRAY */ -CREATE TABLE TMP_ARCHIVING_BYTEARRAY -( BYTEARRAY_ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) -); -CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_); - - -/*--#1 ARCHIVE_ACT_HI_PROCINST; */ -create TABLE ARCHIVE_ACT_HI_PROCINST -AS ( select * from ACT_HI_PROCINST where 1=0); - -create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_); -ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_); - -/*--#2 ARCHIVE_ACT_HI_ACTINST; */ -create TABLE ARCHIVE_ACT_HI_ACTINST -AS ( select * from ACT_HI_ACTINST where 1=0); - -create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_); -create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_); - -/*--#3 ARCHIVE_ACT_HI_TASKINST; */ -create TABLE ARCHIVE_ACT_HI_TASKINST -AS ( select * from ACT_HI_TASKINST where 1=0); - -create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_); -create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_); - -/*--#4 ARCHIVE_ACT_HI_VARINST; */ -create TABLE ARCHIVE_ACT_HI_VARINST -AS ( select * from ACT_HI_VARINST where 1=0); - -create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_); - -/*--#5 ARCHIVE_ACT_HI_DETAIL; */ -create TABLE ARCHIVE_ACT_HI_DETAIL -AS ( select * from ACT_HI_DETAIL where 1=0); - -create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_); -create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_); - -/*--#6 ARCHIVE_ACT_HI_COMMENT; */ -create TABLE ARCHIVE_ACT_HI_COMMENT -AS ( select * from ACT_HI_COMMENT where 1=0); - -create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_); -create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_); - -/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */ -create TABLE ARCHIVE_ACT_HI_ATTACHMENT -AS ( select * from ACT_HI_ATTACHMENT where 1=0); - -create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_); - -/*--#8 ARCHIVE_ACT_HI_OP_LOG; */ -create TABLE ARCHIVE_ACT_HI_OP_LOG -AS ( select * from ACT_HI_OP_LOG where 1=0); - -create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_); -create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_); - -/*--#9 ARCHIVE_ACT_HI_INCIDENT; */ -create TABLE ARCHIVE_ACT_HI_INCIDENT -AS ( select * from ACT_HI_INCIDENT where 1=0); - -create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_); - -/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */ -create TABLE ARCHIVE_ACT_GE_BYTEARRAY -AS ( select * from ACT_GE_BYTEARRAY where 1=0); - -create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_); - -/* ----------------------------------------------------------------------------- -Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS -*/ - -/* ---TEMPLATE: -alter table ARCHIVE_%TableName% - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID); -*/ - - -/*--#1 ACT_HI_PROCINST */ -alter table ARCHIVE_ACT_HI_PROCINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID); - -/*--#2 ACT_HI_ACTINST */ -alter table ARCHIVE_ACT_HI_ACTINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID); - -/*--#3 ACT_HI_TASKINST */ -alter table ARCHIVE_ACT_HI_TASKINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID); - -/*--#4 ACT_HI_VARINST */ -alter table ARCHIVE_ACT_HI_VARINST - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID); - -/*--#5 ACT_HI_DETAIL */ -alter table ARCHIVE_ACT_HI_DETAIL - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID); - -/*--#6 ACT_HI_COMMENT */ -alter table ARCHIVE_ACT_HI_COMMENT - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID); - -/*--#7 ACT_HI_ATTACHMENT */ -alter table ARCHIVE_ACT_HI_ATTACHMENT - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID); - -/*--#8 ACT_HI_OP_LOG */ -alter table ARCHIVE_ACT_HI_OP_LOG - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID); - -/*--#9 ACT_HI_INCIDENT */ -alter table ARCHIVE_ACT_HI_INCIDENT - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID); - -/*--#10 ACT_GE_BYTEARRAY */ -alter table ARCHIVE_ACT_GE_BYTEARRAY - add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); -CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID); - - -/* -- Next Val as a user defined function needed only in MariaDB--*/ -DROP FUNCTION IF EXISTS NextVal; - DELIMITER // - CREATE FUNCTION NextVal (vname VARCHAR(30)) - RETURNS INT - BEGIN - -- Retrieve and update in single statement - UPDATE _sequences - SET next = next + 1 - WHERE name = vname; - - RETURN (SELECT next FROM _sequences LIMIT 1); - END - // - DELIMITER ; - -/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/ - -Create Table Camunda_Hi_Tables (id_ INT NOT NULL, -TableName_ varchar(80) NOT NULL); - -Insert Into Camunda_Hi_Tables Values (1,'ACT_HI_PROCINST'); -Insert Into Camunda_Hi_Tables Values (2,'ACT_HI_ACTINST'); -Insert Into Camunda_Hi_Tables Values (3,'ACT_HI_TASKINST'); -Insert Into Camunda_Hi_Tables Values (4,'ACT_HI_VARINST'); -Insert Into Camunda_Hi_Tables Values (5,'ACT_HI_DETAIL'); -Insert Into Camunda_Hi_Tables Values (6,'ACT_HI_COMMENT'); -Insert Into Camunda_Hi_Tables Values (7,'ACT_HI_ATTACHMENT'); -Insert Into Camunda_Hi_Tables Values (8,'ACT_HI_OP_LOG'); -Insert Into Camunda_Hi_Tables Values (9,'ACT_HI_INCIDENT'); - -/*-- log table --*/ -CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700)); - - -/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/ -/*-- Create a sequence SP */ -DROP PROCEDURE IF EXISTS CreateSequence; - DELIMITER // - CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT) - BEGIN - -- Create a table to store sequences - CREATE TABLE IF NOT EXISTS _sequences - ( - name VARCHAR(70) NOT NULL UNIQUE, - next INT NOT NULL, - inc INT NOT NULL - ); - - -- Add the new sequence - INSERT INTO _sequences VALUES (name, start, inc); - END - // - DELIMITER ; - -/*-------------------------------------------------------------------------------------------------- - Add Meta to Archive - -------------------------------------------------------------------------------------------------- */ - -/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */ -CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1); - - - -/* -ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure starts -Camunda Version: 7.5.4-ee; MariaDB tested -Date: 11.30.2016 -Balaji Mudipalli, AJSC Camunda Team - -DOC.: --------------------------------------------------------------------------------------- -Create ARCHIVE_CAMUNDA_HISTORY StoreProcedure -function for archiving of history camunda tables. -*/ - -/* uncomment below statement and run for your db, e.g. : use camundabpmn; - */ - -DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; - -DELIMITER // - -CREATE PROCEDURE ARCHIVE_CAMUNDA_HISTORY(IN IN_periodInDays INT, IN IN_maxProcessInstances INT) -MODIFIES SQL DATA - -BEGIN - DECLARE P_hiTableCount INT; - DECLARE P_executionId BIGINT; - DECLARE P_piProcessed DOUBLE; - DECLARE P_baProcessed DOUBLE; - DECLARE P_startDate DATE; - DECLARE P_executionDuration double; - - DECLARE not_found INT DEFAULT 0; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; - - /* START TRANSACTION */ - set P_startDate = sysdate(); - set P_executionId = NextVal('STAT_EXECUTION_SEQ'); - - INSERT INTO TMPLOGTABLE SELECT CONCAT('P_executionId value is ',P_executionId); - - DELETE FROM TMP_ARCHIVING_PROCINST; - DELETE FROM TMP_ARCHIVING_BYTEARRAY; - -- temp table -- - DELETE FROM TMPLOGTABLE; - - - /* 1. Set Default Value for Max Pi's */ - IF IN_maxProcessInstances = 0 THEN SET IN_maxProcessInstances = 1000; END IF; - IF IN_maxProcessInstances > 1000 THEN SET IN_maxProcessInstances = 1000; END IF; - - INSERT INTO TMPLOGTABLE SELECT CONCAT('IN_maxProcessInstances value is: ',IN_maxProcessInstances); - - /* 2. Fill TMP_ARCHIVING_PROCINST with candidates: */ - IF IN_maxProcessInstances = 0 THEN /* all */ - INSERT INTO TMP_ARCHIVING_PROCINST - SELECT hi.PROC_INST_ID_, hi.END_TIME_ - FROM ACT_HI_PROCINST hi - WHERE hi.END_TIME_ IS NOT NULL - AND hi.END_TIME_ <= ( DATE_SUB(SYSDATE(), INTERVAL IN_periodInDays DAY)); - - ELSE /* limit: IN_maxProcessInstances */ - INSERT INTO TMP_ARCHIVING_PROCINST - (PROC_INST_ID_, END_TIME_) ( - SELECT hi2.PROC_INST_ID_, hi2.END_TIME_ - FROM ACT_HI_PROCINST hi2 - WHERE hi2.END_TIME_ IS NOT NULL - AND hi2.END_TIME_ <= ( DATE_SUB(SYSDATE(), INTERVAL IN_periodInDays DAY)) - ) LIMIT IN_maxProcessInstances; - END IF; - - /* 3. Check PI's im TEMP if any found, ready for ACHIVING */ - select count(*) INTO P_piProcessed FROM TMP_ARCHIVING_PROCINST; - - IF P_piProcessed = 0 THEN - INSERT INTO TMPLOGTABLE SELECT CONCAT('P_piProcessed value is: ',P_piProcessed); - ROLLBACK; - /* 4. Move data from history to archive (insert to archive and delete in history) */ - ELSE - SELECT COUNT(*)+1 INTO P_hiTableCount FROM camunda_hi_tables; - INSERT INTO TMPLOGTABLE SELECT CONCAT('P_hiTableCount value is ',P_hiTableCount); - SET @i = 1; - WHILE @i < P_hiTableCount - DO - SELECT TableName_ INTO @P_tableName FROM camunda_hi_tables WHERE id_ = @i; - INSERT INTO TMPLOGTABLE SELECT CONCAT('P_tableName: ', @P_tableName); - - Set @P_archiveTableName = Concat('ARCHIVE_',IFNULL(@P_tableName, '')); - INSERT INTO TMPLOGTABLE SELECT CONCAT('@P_archiveTableName: ', @P_archiveTableName); - - SET @query1 = CONCAT('INSERT INTO ', @P_archiveTableName , - ' SELECT hi3.*, ',P_executionId, ', NOW() FROM ', @P_tableName,' hi3 - WHERE hi3.PROC_INST_ID_ in ( SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST)'); - INSERT INTO TMPLOGTABLE SELECT CONCAT('@query1: ', @query1); - - PREPARE stmt1 FROM @query1; - EXECUTE stmt1; - DEALLOCATE PREPARE stmt1; - - SET @query2 = CONCAT ('DELETE ACT FROM ',@P_tableName,' ACT INNER JOIN TMP_ARCHIVING_PROCINST TMP ON ACT.PROC_INST_ID_ = TMP.PROC_INST_ID_'); - INSERT INTO TMPLOGTABLE SELECT CONCAT('@query2: ', @query2); - - PREPARE stmt2 FROM @query2; - EXECUTE stmt2; - DEALLOCATE PREPARE stmt2; - - SET @i = @i+1; - END WHILE; - /* select bytearray_ids */ - INSERT INTO TMP_ARCHIVING_BYTEARRAY - SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_VARINST archvar - where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) - AND archvar.BYTEARRAY_ID_ is not null; - - INSERT INTO TMP_ARCHIVING_BYTEARRAY - SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_DETAIL archvar - where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) - AND archvar.BYTEARRAY_ID_ is not null; - - /* 5. Check Bytearrays im TEMP if any found, ready for ACHIVING */ - select count(*) INTO P_baProcessed FROM TMP_ARCHIVING_BYTEARRAY; - - /* INSERT */ - INSERT INTO ARCHIVE_ACT_GE_BYTEARRAY - SELECT hi4.*, P_executionId, NOW() FROM ACT_GE_BYTEARRAY hi4 - WHERE hi4.ID_ in ( SELECT BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); - - /* DELETE */ - DELETE FROM ACT_GE_BYTEARRAY WHERE ID_ in (select BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); - - /* COMMIT TRANSACTION */ - COMMIT; - INSERT INTO TMPLOGTABLE SELECT CONCAT('P_executionId is ', P_executionId); - - set P_executionDuration = DATEDIFF(sysdate(), P_startDate); - - INSERT INTO TMPLOGTABLE SELECT CONCAT('SP success and P_executionDuration is ', ifnull((round(P_executionDuration*24*60*60, 1)), ''), ' sec.'); - END IF; - - END; -// - -DELIMITER ; - - - -/* -ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure starts -Camunda Version: 7.5.4-ee; MariaDB tested -Date: 11.30.2016 -Balaji Mudipalli, AJSC Camunda Team - -DOC.: --------------------------------------------------------------------------------------- -Create ROLLB_ARCHIVE_CAMUNDA_HISTORY StoreProcedure for ROLLBACK (RESTORE) -of archived Camunda history tables. -*/ - -/* uncomment below statement and run for your db, e.g. : use camundabpmn; - */ --- use <db_name>; - - -DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; - -DELIMITER // -CREATE PROCEDURE ROLLB_ARCHIVE_CAMUNDA_HISTORY(IN IN_executionId_from INT, - IN IN_executionId_til INT, - IN IN_maxProcessInstances INT) -MODIFIES SQL DATA - -BEGIN - DECLARE P_hiTableCount INT; - DECLARE P_piProcessed DOUBLE; - DECLARE P_baProcessed DOUBLE; - DECLARE P_query VARCHAR(600); - DECLARE P_startDate DATETIME; - DECLARE P_executionDuration DOUBLE; - DECLARE P_result NVARCHAR(400); -DECLARE not_found INT DEFAULT 0; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; - - - /* START TRANSACTION */ - SET P_startDate = sysdate(); - DELETE FROM TMPLOGTABLE; - - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: START EXECUTION: ' , ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , - '; PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , - '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , - '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); - - /* 1. Truncate TMP_ARCHIVING_PROCINST */ - - DELETE FROM TMP_ARCHIVING_PROCINST; - DELETE FROM TMP_ARCHIVING_BYTEARRAY; - - /* 2. Fill TMP_ARCHIVING_PROCINST with candidates: */ - IF IN_executionId_til = -1 THEN /* IN_executionId_from only */ - SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID = ' , IFNULL(IN_executionId_from, '')); - - ELSEIF IN_executionId_til = 0 THEN /* all from IN_executionId_from */ - SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID >= ' , IFNULL(IN_executionId_from, '')); - - ELSE /* between IN_executionId_from AND IN_executionId_til */ - SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID between ', IFNULL(IN_executionId_from, '') , ' AND ' , IFNULL(IN_executionId_til, '')); - END IF; - - IF IN_maxProcessInstances = 0 THEN /* all */ - - SET @P_query1 = CONCAT('INSERT INTO TMP_ARCHIVING_PROCINST ', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' SELECT PROC_INST_ID_, END_TIME_ FROM ARCHIVE_ACT_HI_PROCINST ', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' ', Ifnull(P_query, '')); - - ELSE /* limit: IN_maxProcessInstances */ - SET @P_query1 = CONCAT('INSERT INTO TMP_ARCHIVING_PROCINST ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' (PROC_INST_ID_, END_TIME_ ) ( ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' SELECT PROC_INST_ID_, END_TIME_ FROM ARCHIVE_ACT_HI_PROCINST ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' ', Ifnull(P_query, '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ') LIMIT ', IFNULL(IN_maxProcessInstances, '')); - END IF; - - INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /fill temp table with PI candidates/ ' , Ifnull(P_query, '')); - - PREPARE stmt1 FROM @P_query1; - EXECUTE stmt1; - DEALLOCATE PREPARE stmt1; - - INSERT INTO TMPLOGTABLE SELECT CONCAT('.... rows inserted into TMP_ARCHIVING_PROCINST: ' , IFNULL((ROW_COUNT()), '')); - - /* 3. Fill TMP_ARCHIVING_BYTEARRAYS with candidates: */ - INSERT INTO TMP_ARCHIVING_BYTEARRAY - SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_VARINST archvar - where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) - AND archvar.BYTEARRAY_ID_ is not null; - - INSERT INTO TMP_ARCHIVING_BYTEARRAY - SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_DETAIL archvar - where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) - AND archvar.BYTEARRAY_ID_ is not null; - - select count(*) INTO P_baProcessed FROM TMP_ARCHIVING_BYTEARRAY; - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ', IFNULL(P_baProcessed, '') ,' ByteArray candidates for rollback found!' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); - - - /* 4. Check PI's im TEMP ready for ROLLBACK */ - select count(*) INTO P_piProcessed FROM TMP_ARCHIVING_PROCINST; - - IF P_piProcessed = 0 THEN /* no candidates found */ - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: NO ProcessInstance-Candidates for archive-Rollback found! '); - INSERT INTO TMPLOGTABLE SELECT CONCAT('Try TA-ROLLBACK ...'); - ROLLBACK; /*-- TMP_ARCHIVING_PROCINST un-Delete */ - INSERT INTO TMPLOGTABLE SELECT CONCAT('TA-ROLLBACK DONE! ...' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); - - SET P_result = CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: NO ProcessInstance candidates for archive-Rollback found!', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' Used PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , - '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , - '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); - - INSERT INTO TMPLOGTABLE SELECT CONCAT(P_result); - - ELSE - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ', IFNULL(P_piProcessed, '') ,' ProcessInstance candidates for Rollback found!'); - - /* LOOP over tables */ - SELECT COUNT(*)+1 INTO P_hiTableCount FROM camunda_hi_tables; - - INSERT INTO TMPLOGTABLE SELECT CONCAT('P_hiTableCount value is ',P_hiTableCount); - - SET @i = 1; - - WHILE @i < P_hiTableCount - DO - SELECT TableName_ INTO @P_tableName FROM camunda_hi_tables WHERE id_ = @i; - - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ####### Start restore from: ARCHIVE_' , IFNULL(@P_tableName, '') ,' ...'); - - SET @P_tableFields = CONCAT(''); - - select GROUP_CONCAT(column_name order by ordinal_position) - INTO @P_tableFields - from information_schema.columns - where table_schema = (select DATABASE()) AND TABLE_NAME = @P_tableName; - - /* INSERT */ - SET @P_query2 = CONCAT('INSERT INTO ', IFNULL(@P_tableName, '') , - ' SELECT ' , @P_tableFields, - ' FROM ARCHIVE_' , IFNULL(@P_tableName, '') , - ' WHERE PROC_INST_ID_ in ( SELECT tmp.PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST tmp)'); - - INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /copy back to history table/ ' , Ifnull(@P_query2, '')); - - PREPARE stmt2 FROM @P_query2; - EXECUTE stmt2; - DEALLOCATE PREPARE stmt2; - - INSERT INTO TMPLOGTABLE SELECT Concat('.... rows inserted: ' , IFNULL((ROW_COUNT()), '')); - - /* DELETE */ - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: Delete in Archive: ARCHIVE_' , IFNULL(@P_tableName, '') ,' ...'); - /* SET @P_query3 = CONCAT(' DELETE FROM ARCHIVE_' , IFNULL(@P_tableName, '') , ' WHERE PROC_INST_ID_ in (select PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST)'); */ - SET @P_query3 = CONCAT('DELETE ARCH FROM ARCHIVE_' , IFNULL(@P_tableName, '') , - ' ARCH INNER JOIN TMP_ARCHIVING_PROCINST TMP ON ARCH.PROC_INST_ID_ = TMP.PROC_INST_ID_'); - INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): ' , Ifnull(@P_query3, '')); - PREPARE stmt3 FROM @P_query3; - EXECUTE stmt3; - DEALLOCATE PREPARE stmt3; - - INSERT INTO TMPLOGTABLE SELECT Concat('.... rows deleted: ' , IFNULL((ROW_COUNT()), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); - - SET @i = @i+1; - END WHILE; - - /* INSERT */ - SET @P_tableFields2 = CONCAT(''); /* reset, becouse had some problems with double columns */ - /* fetch table column names into P_tableFields : */ - select GROUP_CONCAT(COLUMN_NAME order by ordinal_position) - INTO @P_tableFields2 - from information_schema.columns - where table_schema = (select DATABASE()) AND TABLE_NAME = 'ACT_GE_BYTEARRAY'; - - SET @P_query4 = CONCAT('INSERT INTO ACT_GE_BYTEARRAY ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' SELECT ' , IFNULL(@P_tableFields2, '') ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' FROM ARCHIVE_ACT_GE_BYTEARRAY' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' WHERE ID_ in ( SELECT tmp.BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY tmp)'); - INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /copy back to history table/ ' , Ifnull(@P_query4, '')); - PREPARE stmt4 FROM @P_query4; - EXECUTE stmt4; - DEALLOCATE PREPARE stmt4; - INSERT INTO TMPLOGTABLE SELECT Concat('.... rows inserted: ' , IFNULL((ROW_COUNT()), '')); - - /* DELETE */ - /* DELETE FROM ARCHIVE_ACT_GE_BYTEARRAY WHERE ID_ in (select BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); */ - DELETE AAGB FROM ARCHIVE_ACT_GE_BYTEARRAY AAGB INNER JOIN TMP_ARCHIVING_BYTEARRAY TMP_B ON AAGB.ID_ = TMP_B.BYTEARRAY_ID_; - INSERT INTO TMPLOGTABLE SELECT Concat('.... rows deleted: ' , IFNULL((ROW_COUNT()), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); - - /* COMMIT TRANSACTION */ - INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: PIs processed: ' , IFNULL(P_piProcessed, '')) ; - COMMIT; - INSERT INTO TMPLOGTABLE SELECT CONCAT('TA-COMMIT DONE!' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); - - SET P_executionDuration = DATEDIFF(sysdate(), P_startDate); - - SET P_result = CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: EXECUTED (commited) successfully! ' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , '; Duration: ' , ifnull((round(P_executionDuration*24*60*60, 1)), ''), ' sec.' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '') , - ' PIs processed: ' , IFNULL(P_piProcessed, '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), - ' Used PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , - '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , - '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); - - INSERT INTO TMPLOGTABLE SELECT CONCAT(P_result); - END IF; - END; -// - -DELIMITER ; diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgrade-1702.37_drop1_to_1707.40_drop1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgrade-1702.37_drop1_to_1707.40_drop1.sql deleted file mode 100644 index 1cadb75d5f..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgrade-1702.37_drop1_to_1707.40_drop1.sql +++ /dev/null @@ -1,30 +0,0 @@ --- MSO Catalog DB: table 'service-recipe' ---- --- should update a row for create instance -UPDATE mso_catalog.service_recipe -SET ORCHESTRATION_URI = "/mso/async/services/CreateGenericALaCarteServiceInstance" -WHERE SERVICE_ID = 4 - AND ACTION = 'createInstance'; - --- should update a row for delete instance -UPDATE mso_catalog.service_recipe -SET ORCHESTRATION_URI = "/mso/async/services/DeleteGenericALaCarteServiceInstance" -WHERE SERVICE_ID = 4 - AND ACTION = 'deleteInstance'; - -SET SQL_SAFE_UPDATES = 0; - --- 1 coordinate this change with Dmitry when updating labs -UPDATE mso_catalog.service_recipe -SET orchestration_uri = "/mso/async/services/CreateGenericMacroServiceNetworkVnf" -WHERE orchestration_uri = "/mso/async/services/CreateViprAtmService"; - -UPDATE mso_catalog.service_recipe -SET orchestration_uri = "/mso/async/services/DeleteGenericMacroServiceNetworkVnf" -WHERE orchestration_uri = "/mso/async/services/DeleteViprAtmService"; - --- 2 network_recipe -UPDATE mso_catalog.network_recipe -SET orchestration_uri = '/mso/async/services/UpdateNetworkInstance' -WHERE network_type = 'VID_DEFAULT' AND action = 'updateInstance'; - -SET SQL_SAFE_UPDATES = 1;
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgrade-1707.40_drop1_to_1707.41_drop1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgrade-1707.40_drop1_to_1707.41_drop1.sql deleted file mode 100644 index add114da1e..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgrade-1707.40_drop1_to_1707.41_drop1.sql +++ /dev/null @@ -1,1350 +0,0 @@ --- MySQL Workbench Synchronization <<<1 --- Generated: April 2017 --- MariaDB-upgrade-1707.40_drop1_to_1707.41_drop1.sql - --- Turn off validation and alter schema <<<1 -BEGIN; - -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; - -ALTER SCHEMA `mso_catalog` DEFAULT CHARACTER SET latin1 DEFAULT COLLATE latin1_swedish_ci ; --- >>>1 - --- FOREIGN KEYS <<<1 -ALTER TABLE `mso_catalog`.`heat_template` -- K <<<2 -DROP FOREIGN KEY `FK_ek5sot1q07taorbdmkvnveu98`; - -ALTER TABLE `mso_catalog`.`heat_template_params` -- K <<<2 -DROP FOREIGN KEY `FK_8sxvm215cw3tjfh3wni2y3myx`; - -ALTER TABLE `mso_catalog`.`service_recipe` -- K <<<2 -DROP FOREIGN KEY `FK_kv13yx013qtqkn94d5gkwbu3s`; - -ALTER TABLE `mso_catalog`.`network_resource_customization` -- K <<<2 -DROP FOREIGN KEY `fk_network_resource_customization__network_resource__id`; --- >>>1 - -UPDATE mso_catalog.heat_environment -- 7 UUID() * <<<1 -SET - description = CONCAT(description, '1707MIGRATED'), - asdc_uuid = (SELECT UUID()) -WHERE - asdc_uuid LIKE "MAN%" OR asdc_uuid is NULL OR asdc_uuid = ''; - --- DEBUGGING E2E <<<1 --- ERROR 1062 (23000) at line 40: Duplicate entry '53a70d06-f598-4375-9c3c-fcca1dea3f51' for key 'PRIMARY' -DELETE FROM `mso_catalog`.`heat_environment` where `ASDC_UUID` IN ('53a70d06-f598-4375-9c3c-fcca1dea3f51', 'adc9f8d5-e9d2-4180-994d-cbd59d6eb405'); --- >>>1 - --- heat_environment - * <<<1 -CREATE TABLE `mso_catalog`.`hetemp` ( -- <<<2 - `id` int(11), - `ARTIFACT_UUID` VARCHAR(200) - ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.hetemp SELECT id, asdc_uuid artifact_uuid FROM mso_catalog.heat_environment; -- <<<2 - -ALTER TABLE `mso_catalog`.`heat_environment` -- <<<2 -DROP COLUMN `ASDC_LABEL`, -DROP COLUMN `ASDC_RESOURCE_NAME`, -DROP COLUMN `id`, -CHANGE COLUMN `ASDC_UUID` `ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, -CHANGE COLUMN `ARTIFACT_CHECKSUM` `ARTIFACT_CHECKSUM` VARCHAR(200) NOT NULL DEFAULT 'MANUAL RECORD' AFTER `BODY`, -CHANGE COLUMN `ENVIRONMENT` `BODY` LONGTEXT NOT NULL , -DROP PRIMARY KEY, -ADD PRIMARY KEY (`ARTIFACT_UUID`), -DROP INDEX `UK_a4jkta7hgpa99brceaxasnfqp` ; --- >>>1 - -UPDATE mso_catalog.heat_files -- 7 UUID() * <<<1 -SET - description = CONCAT(description, '1707MIGRATED'), - asdc_uuid = (SELECT UUID()) -WHERE - asdc_uuid LIKE "MAN%" OR asdc_uuid is NULL OR asdc_uuid = ''; - -ALTER TABLE `mso_catalog`.`heat_files` -- ^ <<<1 -MODIFY `id` INT, -DROP COLUMN `ASDC_RESOURCE_NAME`, -DROP COLUMN `ASDC_LABEL`, -DROP COLUMN `VNF_RESOURCE_ID`, -CHANGE COLUMN `ASDC_UUID` `ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, -CHANGE COLUMN `FILE_NAME` `NAME` VARCHAR(200) NOT NULL AFTER `ARTIFACT_UUID`, -CHANGE COLUMN `VERSION` `VERSION` VARCHAR(20) NOT NULL AFTER `NAME`, -CHANGE COLUMN `ARTIFACT_CHECKSUM` `ARTIFACT_CHECKSUM` VARCHAR(200) NOT NULL DEFAULT 'MANUAL RECORD' AFTER `BODY`, -CHANGE COLUMN `FILE_BODY` `BODY` LONGTEXT NOT NULL , -DROP PRIMARY KEY, -ADD PRIMARY KEY (`ARTIFACT_UUID`), -DROP INDEX `UK_m23vfqc1tdvj7d6f0jjo4cl7e` ; - -CREATE TABLE IF NOT EXISTS `mso_catalog`.`temp_network_heat_template_lookup` ( -- V <<<1 - `NETWORK_RESOURCE_MODEL_NAME` VARCHAR(200) NOT NULL, - `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NOT NULL, - `AIC_VERSION_MIN` VARCHAR(20) NOT NULL, - `AIC_VERSION_MAX` VARCHAR(20) NULL DEFAULT NULL, - PRIMARY KEY (`NETWORK_RESOURCE_MODEL_NAME`), - INDEX `fk_temp_network_heat_template_lookup__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC) -) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -UPDATE mso_catalog.heat_template -- 7 UUID() V <<<1 -SET - description = CONCAT(description, '1707MIGRATED'), - asdc_uuid = (SELECT UUID()) -WHERE - asdc_uuid LIKE "MAN%" OR asdc_uuid is NULL OR asdc_uuid = ''; - --- delete where network_resource_model_name is CONTRAIL_EXTERNAL or CONTRAIL_SHARED. Q spec 5/25 -INSERT INTO mso_catalog.temp_network_heat_template_lookup ( -- 3sc * b4 heat_template network_resource <<<1 - network_resource_model_name, - heat_template_artifact_uuid, - aic_version_min, - aic_version_max -) - SELECT - a.network_type, - b.asdc_uuid, - a.aic_version_min, - a.aic_version_max - FROM - mso_catalog.network_resource a, - mso_catalog.heat_template b - WHERE - a.template_id = b.id - AND a.network_type NOT IN ('CONTRAIL_EXTERNAL', 'CONTRAIL_SHARED'); - -ALTER TABLE `mso_catalog`.`heat_template` -- ^ <<<1 -MODIFY `id` INT, -DROP COLUMN `ASDC_LABEL`, -DROP COLUMN `CHILD_TEMPLATE_ID`, -DROP COLUMN `TEMPLATE_PATH`, -DROP COLUMN `ASDC_RESOURCE_NAME`, -CHANGE COLUMN `ASDC_UUID` `ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, -CHANGE COLUMN `DESCRIPTION` `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL AFTER `VERSION`, -CHANGE COLUMN `ARTIFACT_CHECKSUM` `ARTIFACT_CHECKSUM` VARCHAR(200) NOT NULL DEFAULT 'MANUAL RECORD' AFTER `TIMEOUT_MINUTES`, -CHANGE COLUMN `TEMPLATE_NAME` `NAME` VARCHAR(200) NOT NULL , -CHANGE COLUMN `TEMPLATE_BODY` `BODY` LONGTEXT NOT NULL , -DROP PRIMARY KEY, -ADD PRIMARY KEY (`ARTIFACT_UUID`), -DROP INDEX `FK_ek5sot1q07taorbdmkvnveu98` , -DROP INDEX `UK_k1tq7vblss8ykiwhiltnkg6no` ; - -ALTER TABLE `mso_catalog`.`temp_network_heat_template_lookup` -- after alter heat_template ^ <<<1 - ADD CONSTRAINT `fk_temp_network_heat_template_lookup__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE RESTRICT - ON UPDATE CASCADE; --- >>>1 - --- heat_nested_template AFTER heat_template * <<<1 -CREATE TABLE `mso_catalog`.`hnttemp` ( -- <<<2 - `PARENT_HEAT_TEMPLATE_UUID` VARCHAR(200) NOT NULL , - `CHILD_HEAT_TEMPLATE_UUID` VARCHAR(200) NOT NULL, - `PROVIDER_RESOURCE_FILE` varchar(100) DEFAULT NULL - ) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.hnttemp ( -- <<<2 - PARENT_HEAT_TEMPLATE_UUID, - CHILD_HEAT_TEMPLATE_UUID, - PROVIDER_RESOURCE_FILE -) - SELECT - ht1.artifact_uuid PARENT_HEAT_TEMPLATE_UUID, - ht2.artifact_uuid CHILD_HEAT_TEMPLATE_UUID, - a.PROVIDER_RESOURCE_FILE - FROM - (SELECT * FROM mso_catalog.heat_nested_template) AS a - JOIN (SELECT * FROM mso_catalog.heat_template) AS ht1 ON a.parent_template_id = ht1.id - JOIN (SELECT * FROM mso_catalog.heat_template) AS ht2 ON a.child_template_id = ht2.id; - -DELETE FROM mso_catalog.heat_nested_template; -- <<<2 - -ALTER TABLE `mso_catalog`.`heat_nested_template` -- <<<2 -CHANGE COLUMN `PARENT_TEMPLATE_ID` `PARENT_HEAT_TEMPLATE_UUID` VARCHAR(200) NOT NULL , -CHANGE COLUMN `CHILD_TEMPLATE_ID` `CHILD_HEAT_TEMPLATE_UUID` VARCHAR(200) NOT NULL , -ADD INDEX `fk_heat_nested_template__heat_template2_idx` (`CHILD_HEAT_TEMPLATE_UUID` ASC); - -INSERT INTO mso_catalog.heat_nested_template SELECT * FROM mso_catalog.hnttemp; -- <<<2 - -DROP TABLE IF EXISTS mso_catalog.hnttemp; -- <<<2 - --- heat_template_params AFTER heat_template ^ <<<1 -CREATE TABLE IF NOT EXISTS `mso_catalog`.`htptemp` ( -- <<<2 - `PARAM_NAME` varchar(100) NOT NULL, - `IS_REQUIRED` bit(1) NOT NULL, - `PARAM_TYPE` varchar(20) DEFAULT NULL, - `PARAM_ALIAS` varchar(45) DEFAULT NULL, - `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -INSERT INTO mso_catalog.htptemp ( -- <<<2 - PARAM_NAME, - IS_REQUIRED, - PARAM_TYPE, - PARAM_ALIAS, - HEAT_TEMPLATE_ARTIFACT_UUID -) - SELECT - a.PARAM_NAME, - a.IS_REQUIRED, - a.PARAM_TYPE, - a.PARAM_ALIAS, - ht1.artifact_uuid HEAT_TEMPLATE_ARTIFACT_UUID - FROM - (SELECT * FROM mso_catalog.heat_template_params) AS a - JOIN (SELECT * FROM mso_catalog.heat_template) AS ht1 ON a.heat_template_id = ht1.id; - -DELETE FROM mso_catalog.heat_template_params; -- <<<2 - -ALTER TABLE `mso_catalog`.`heat_template_params` -- <<<2 -DROP COLUMN `id`, -CHANGE COLUMN `HEAT_TEMPLATE_ID` `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NOT NULL , -DROP PRIMARY KEY, -ADD PRIMARY KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`), -DROP INDEX `UK_pj3cwbmewecf0joqv2mvmbvw3` ; - -INSERT INTO mso_catalog.heat_template_params ( -- <<<2 - PARAM_NAME, - IS_REQUIRED, - PARAM_TYPE, - PARAM_ALIAS, - HEAT_TEMPLATE_ARTIFACT_UUID -) - SELECT - a.PARAM_NAME, - a.IS_REQUIRED, - a.PARAM_TYPE, - a.PARAM_ALIAS, - a.HEAT_TEMPLATE_ARTIFACT_UUID - FROM mso_catalog.htptemp a; - -DROP TABLE IF EXISTS mso_catalog.htptemp; -- <<<2 - --- >>>1 - -ALTER TABLE `mso_catalog`.`network_recipe` -- <<<1 -CHANGE COLUMN `NETWORK_TYPE` `MODEL_NAME` VARCHAR(20) NOT NULL ; - --- 1, 2 UPDATE SERVICE Before SERVICE * <<<1 -UPDATE `mso_catalog`.`service_recipe` -JOIN ( - SELECT - MAX(CAST((COALESCE(NULLIF(version_str, ''), '1.0')) AS DECIMAL(5,2))), - id, - service_name - FROM mso_catalog.service - WHERE service_name = "WAN Bonding" -) a -ON a.service_name = "WAN Bonding" -SET - `service_id` = a.id, - `action` = CASE - WHEN action = 'Layer3AddBonding' then 'createInstance' - WHEN action = 'Layer3DeleteBonding' then 'deleteInstance' - END -WHERE - `action` IN ('Layer3AddBonding', 'Layer3DeleteBonding'); - -UPDATE mso_catalog.service -- 2 <<<2 -SET - service_name_version_id = (SELECT UUID()), - description = CONCAT(description, '1707MIGRATED') -WHERE - service_name_version_id LIKE "MAN%" OR service_name_version_id is NULL OR service_name_version_id = ''; - -UPDATE mso_catalog.service -SET - model_invariant_uuid = (SELECT UUID()), - description = CONCAT(description, '1707MIGRATED') -WHERE - model_invariant_uuid LIKE 'MAN%' OR model_invariant_uuid is NULL OR model_invariant_uuid = ''; - --- service - from temporary table servtemp ^ <<<1 -CREATE TABLE `mso_catalog`.`servtemp` ( -- <<<2 - `id` int(11), - `MODEL_NAME` varchar(40) DEFAULT NULL, - `MODEL_VERSION` varchar(20) NOT NULL, - `DESCRIPTION` varchar(1200) DEFAULT NULL, - `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `MODEL_UUID` varchar(50) NOT NULL DEFAULT 'MANUAL_RECORD', - `MODEL_INVARIANT_UUID` varchar(200) NOT NULL DEFAULT 'MANUAL_RECORD' - ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.servtemp ( -- <<<2 - id, - MODEL_NAME, - MODEL_VERSION, - DESCRIPTION, - CREATION_TIMESTAMP, - MODEL_UUID, - MODEL_INVARIANT_UUID -) - SELECT - id, - SERVICE_NAME, - VERSION_STR, - DESCRIPTION, - CREATION_TIMESTAMP, - SERVICE_NAME_VERSION_ID, - MODEL_INVARIANT_UUID - FROM mso_catalog.service - WHERE SERVICE_NAME NOT IN ('Layer3AddBonding', 'Layer3DeleteBonding'); - -DELETE FROM mso_catalog.service; -- <<<2 - -ALTER TABLE `mso_catalog`.`service_to_allotted_resources` -- <<<2 - DROP FOREIGN KEY `fk_service_to_allotted_resources__service__service_name_ver_id`; - -ALTER TABLE `mso_catalog`.`service_to_networks` -- <<<2 - DROP FOREIGN KEY `fk_service_to_networks__service__service_name_version_id`; - -ALTER TABLE `mso_catalog`.`service` -- ^ <<<2 -MODIFY `id` INT, -DROP COLUMN `SERVICE_ID`, -DROP COLUMN `HTTP_METHOD`, -DROP COLUMN `SERVICE_NAME_VERSION_ID`, -ADD COLUMN `MODEL_UUID` VARCHAR(200) NOT NULL FIRST, -CHANGE COLUMN `MODEL_INVARIANT_UUID` `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL AFTER `MODEL_NAME`, -CHANGE COLUMN `SERVICE_NAME` `MODEL_NAME` VARCHAR(200) NOT NULL , -CHANGE COLUMN `VERSION_STR` `MODEL_VERSION` VARCHAR(20) NOT NULL , -ADD COLUMN `TOSCA_CSAR_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `CREATION_TIMESTAMP`, -DROP PRIMARY KEY, -ADD PRIMARY KEY (`MODEL_UUID`), -ADD INDEX `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID` ASC), -DROP INDEX `UK_service_name__service_name_version_id` ; - -INSERT INTO mso_catalog.service ( - id, CREATION_TIMESTAMP, DESCRIPTION, MODEL_INVARIANT_UUID, MODEL_NAME, MODEL_UUID, MODEL_VERSION -) -SELECT - id, CREATION_TIMESTAMP, DESCRIPTION, MODEL_INVARIANT_UUID, MODEL_NAME, MODEL_UUID, MODEL_VERSION -FROM mso_catalog.servtemp; -- >>>2 - -DROP TABLE IF EXISTS mso_catalog.servtemp; -- <<<2 - --- service_recipe - from temporary table srtemp - AFTER service ^ <<<1 -CREATE TABLE `mso_catalog`.`srtemp` ( -- <<<2 - `id` int(11) NOT NULL , - `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, - `ACTION` varchar(40) NOT NULL, - `VERSION_STR` varchar(20) DEFAULT NULL, - `DESCRIPTION` varchar(1200) DEFAULT NULL, - `ORCHESTRATION_URI` varchar(256) NOT NULL, - `SERVICE_PARAM_XSD` varchar(2048) DEFAULT NULL, - `RECIPE_TIMEOUT` int(11) DEFAULT NULL, - `SERVICE_TIMEOUT_INTERIM` int(11) DEFAULT NULL, - `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP - ) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - --- ST-CreationTimestamp <<<2 --- ERROR 1292 (22007) at line 331: Incorrect datetime value: '0000-00-00 00:00:00' for column 'CREATION_TIMESTAMP' at row 1 -UPDATE `mso_catalog`.`service_recipe` set CREATION_TIMESTAMP = now() where cast(`CREATION_TIMESTAMP` as char(20)) = '0000-00-00 00:00:00'; --- >>>2 - -INSERT INTO mso_catalog.srtemp ( -- <<<2 - id, - SERVICE_MODEL_UUID, - ACTION, - VERSION_STR, - DESCRIPTION, - ORCHESTRATION_URI, - SERVICE_PARAM_XSD, - RECIPE_TIMEOUT, - SERVICE_TIMEOUT_INTERIM, - CREATION_TIMESTAMP -) - SELECT - a.id, - ht1.MODEL_UUID SERVICE_MODEL_UUID, - a.ACTION, - a.VERSION_STR, - a.DESCRIPTION, - a.ORCHESTRATION_URI, - a.SERVICE_PARAM_XSD, - a.RECIPE_TIMEOUT, - a.SERVICE_TIMEOUT_INTERIM, - a.CREATION_TIMESTAMP - FROM mso_catalog.service_recipe a - JOIN mso_catalog.service AS ht1 ON a.service_id = ht1.id; - -DELETE FROM mso_catalog.service_recipe; -- <<<2 - -ALTER TABLE `mso_catalog`.`service_recipe` -- <<<2 -CHANGE COLUMN `SERVICE_ID` `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL AFTER `CREATION_TIMESTAMP`, -ADD INDEX `fk_service_recipe__service1_idx` (`SERVICE_MODEL_UUID` ASC); - -INSERT INTO mso_catalog.service_recipe ( -- <<<2 - id, - SERVICE_MODEL_UUID, - ACTION, - VERSION_STR, - DESCRIPTION, - ORCHESTRATION_URI, - SERVICE_PARAM_XSD, - RECIPE_TIMEOUT, - SERVICE_TIMEOUT_INTERIM, - CREATION_TIMESTAMP -) -SELECT - id, - SERVICE_MODEL_UUID, - ACTION, - VERSION_STR, - DESCRIPTION, - ORCHESTRATION_URI, - SERVICE_PARAM_XSD, - RECIPE_TIMEOUT, - SERVICE_TIMEOUT_INTERIM, - CREATION_TIMESTAMP - FROM mso_catalog.srtemp; - -DROP TABLE IF EXISTS mso_catalog.srtemp; -- <<<2 - --- >>>1 - -DELETE FROM mso_catalog.vnf_components_recipe WHERE vnf_component_type = 'VOLUME_GROUP' and vnf_type != '*'; -- Q spec 5/25 <<<1 --- >>>1 - -DELETE FROM mso_catalog.vnf_resource WHERE id IN (2,3,4); -- 3 * <<<1 - -UPDATE mso_catalog.vnf_resource -- 4 * <<<1 -SET - model_name = model_customization_name, - asdc_uuid = '09cb25b0-f2f6-40ed-96bc-71ad43e42fc8', - model_invariant_uuid = '9fdda511-ffe3-4117-b3cc-cff9c1fc3fff' -WHERE - id=5; - -UPDATE mso_catalog.vnf_resource -- 6 set model_name * <<<1 -SET - model_name = vnf_type -WHERE - service_model_invariant_uuid IS NULL OR model_invariant_uuid = ''; - -UPDATE mso_catalog.vnf_resource -- 7 UUID() asdc_uuid * <<<1 -SET - asdc_uuid = (SELECT UUID()), - description = CONCAT(description, '1707MIGRATED') -WHERE - asdc_uuid LIKE "MAN%" OR asdc_uuid is NULL OR asdc_uuid = ''; - -UPDATE mso_catalog.vnf_resource -- 8 UUID() model_customization_uuid * <<<1 -SET - description = CONCAT(description, '1707MIGRATED'), - model_customization_uuid = (SELECT UUID()) -WHERE - model_customization_uuid LIKE "MAN%" OR model_customization_uuid is NULL OR model_customization_uuid = ''; - --- >>>1 -UPDATE mso_catalog.vnf_resource -- NOT IN SPEC * <<<1 -SET - model_customization_name = CONCAT('1707MIGRATED_', model_name) -WHERE - model_customization_name is NULL OR model_customization_name = ''; - --- 5 aka 8d delete each asdc_uuid except highest ASDC_SERVICE_MODEL_VERSION vnf_resource and cascade vf_module * <<<1 -CREATE TABLE mso_catalog.req5temp (`vnfs` INT(11) NOT NULL, `vfs` INT(11)); - --- delete VR and cascade VMs what have null/empty VR.service_model_invariant_uuid where vnf_name is NOT "BrocadeVce" -INSERT INTO mso_catalog.req5temp (vnfs, vfs) -- <<<2 - SELECT a.id, m.id - FROM mso_catalog.vnf_resource a - LEFT JOIN mso_catalog.vf_module m ON a.id = m.vnf_resource_id - WHERE (a.vnf_name != "BrocadeVce" OR a.vnf_name IS NULL) - AND (a.service_model_invariant_uuid is NULL OR a.service_model_invariant_uuid = ''); - -DELETE FROM mso_catalog.vnf_resource WHERE id = ANY(SELECT vnfs FROM mso_catalog.req5temp); -DELETE FROM mso_catalog.vf_module WHERE id = ANY(SELECT vfs FROM mso_catalog.req5temp); - -DELETE FROM mso_catalog.req5temp; -- <<<2 - -INSERT INTO mso_catalog.req5temp (vnfs, vfs) -- <<<2 - SELECT a.id, m.id - FROM mso_catalog.vnf_resource a - LEFT JOIN mso_catalog.vf_module m ON a.id = m.vnf_resource_id - JOIN ( - SELECT - MAX(CAST((COALESCE(NULLIF(asdc_service_model_version, ''), '1.0')) AS DECIMAL(5,2))) AS v, - asdc_uuid - FROM mso_catalog.vnf_resource - GROUP BY asdc_uuid - ) b - ON - a.asdc_uuid = b.asdc_uuid AND - CAST((COALESCE(NULLIF(a.asdc_service_model_version, ''), '1.0')) AS DECIMAL(5,2)) != b.v; --- >>>1 - -UPDATE mso_catalog.vf_module -- 7 UUID() asdc_uuid * <<<1 -SET - asdc_uuid = (SELECT UUID()), - description = CONCAT(description, '1707MIGRATED') -WHERE - asdc_uuid LIKE "MAN%" OR asdc_uuid is NULL OR asdc_uuid = ''; - -UPDATE mso_catalog.vf_module -- 8 UUID() model_customization_uuid * <<<1 -SET - description = CONCAT(description, '1707MIGRATED'), - model_customization_uuid = (SELECT UUID()) -WHERE - model_customization_uuid LIKE "MAN%" OR model_customization_uuid is NULL OR model_customization_uuid = ''; - --- VMC vf_module_customization * <<<1 -CREATE TABLE IF NOT EXISTS `mso_catalog`.`vf_module_customization` ( -- V <<<2 - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `LABEL` VARCHAR(200) NULL DEFAULT NULL, - `INITIAL_COUNT` INT(11) NULL DEFAULT 0, - `MIN_INSTANCES` INT(11) NULL DEFAULT 0, - `MAX_INSTANCES` INT(11) NULL DEFAULT NULL, - `AVAILABILITY_ZONE_COUNT` INT(11) NULL DEFAULT NULL, - `HEAT_ENVIRONMENT_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL, - `VOL_ENVIRONMENT_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `VF_MODULE_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - INDEX `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID` ASC), - INDEX `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID` ASC), - INDEX `fk_vf_module_customization__vol_env__heat_environment2_idx` (`VOL_ENVIRONMENT_ARTIFACT_UUID` ASC), - CONSTRAINT `fk_vf_module_customization__heat_env__heat_environment1` - FOREIGN KEY (`HEAT_ENVIRONMENT_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_environment` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - CONSTRAINT `fk_vf_module_customization__vol_env__heat_environment2` - FOREIGN KEY (`VOL_ENVIRONMENT_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_environment` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE -) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -CREATE TABLE mso_catalog.vfduptemp (`id` INT(11) NOT NULL); -- <<<2 - -INSERT INTO mso_catalog.vfduptemp (id) -- <<<2 -SELECT a.id -FROM mso_catalog.vf_module a -JOIN ( - SELECT - MAX(CAST((COALESCE(NULLIF(asdc_service_model_version, ''), '1.0')) AS DECIMAL(5,2))) AS ver, - model_customization_uuid mcu, - id vid - FROM mso_catalog.vf_module - GROUP BY model_customization_uuid - ) b -ON - a.model_customization_uuid = mcu - AND CAST((COALESCE(NULLIF(a.asdc_service_model_version, ''), '1.0')) AS DECIMAL(5,2)) != b.ver -ORDER BY a.model_customization_uuid; - -INSERT INTO mso_catalog.vf_module_customization ( -- <<<2 - model_customization_uuid, -- <<<3 - label, - initial_count, - min_instances, - max_instances, - heat_environment_artifact_uuid, - vol_environment_artifact_uuid, - vf_module_model_uuid -- >>>3 -) -SELECT - a.model_customization_uuid, - a.label, - a.initial_count, - a.min_instances, - a.max_instances, - ht1.artifact_uuid, - ht2.artifact_uuid, - a.asdc_uuid -FROM mso_catalog.vf_module a -LEFT JOIN mso_catalog.hetemp AS ht1 ON a.environment_id = ht1.id -LEFT JOIN mso_catalog.hetemp AS ht2 ON a.vol_environment_id = ht2.id -WHERE NOT EXISTS ( - SELECT 1 FROM mso_catalog.vfduptemp vdt - WHERE - a.id = vdt.id -); - -DROP TABLE IF EXISTS mso_catalog.vfduptemp; -- <<<2 - -DROP TABLE IF EXISTS mso_catalog.hetemp; -- <<<2 - --- >>>1 - --- AR ALLOTTED_RESOURCE <<<1 -CREATE TABLE IF NOT EXISTS `mso_catalog`.`allotted_resource` ( -- V <<<2 - `MODEL_UUID` VARCHAR(200) NOT NULL, - `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, - `MODEL_VERSION` VARCHAR(20) NOT NULL, - `MODEL_NAME` VARCHAR(200) NOT NULL, - `TOSCA_NODE_TYPE` VARCHAR(200) NULL DEFAULT NULL, - `SUBCATEGORY` VARCHAR(200) NULL DEFAULT NULL, - `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`MODEL_UUID`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - - INSERT INTO `mso_catalog`.`allotted_resource` ( -- 2sc * <<<2 - model_uuid, - model_invariant_uuid, - model_version, - model_name, - description - ) - SELECT DISTINCT - model_uuid, - model_invariant_uuid, - model_version, - model_name, - description - FROM - mso_catalog.allotted_resource_customization; --- >>>1 - -ALTER TABLE `mso_catalog`.`allotted_resource_customization` -- ^ <<<1 -DROP COLUMN `DESCRIPTION`, -DROP COLUMN `MODEL_NAME`, -DROP COLUMN `MODEL_VERSION`, -DROP COLUMN `MODEL_INVARIANT_UUID`, -CHANGE COLUMN `MODEL_UUID` `AR_MODEL_UUID` VARCHAR(200) NOT NULL, -- ARC -CHANGE COLUMN `MODEL_INSTANCE_NAME` `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL AFTER `MODEL_CUSTOMIZATION_UUID`, -ADD COLUMN `PROVIDING_SERVICE_MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `MODEL_INSTANCE_NAME`, -ADD COLUMN `TARGET_NETWORK_ROLE` VARCHAR(200) NULL DEFAULT NULL AFTER `PROVIDING_SERVICE_MODEL_INVARIANT_UUID`, -ADD COLUMN `NF_TYPE` VARCHAR(200) NULL DEFAULT NULL AFTER `TARGET_NETWORK_ROLE`, -ADD COLUMN `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL AFTER `NF_TYPE`, -ADD COLUMN `NF_FUNCTION` VARCHAR(200) NULL DEFAULT NULL AFTER `NF_ROLE`, -ADD COLUMN `NF_NAMING_CODE` VARCHAR(200) NULL DEFAULT NULL AFTER `NF_FUNCTION`, -ADD COLUMN `MIN_INSTANCES` INT(11) NULL DEFAULT NULL AFTER `NF_NAMING_CODE`, -ADD COLUMN `MAX_INSTANCES` INT(11) NULL DEFAULT NULL AFTER `MIN_INSTANCES`, -ADD INDEX `fk_allotted_resource_customization__allotted_resource1_idx` (`AR_MODEL_UUID` ASC); --- >>>1 - --- VRC vnf_resource_customization <<<1 --- vnftemp table <<<2 -CREATE TABLE `mso_catalog`.`vnftemp` AS - SELECT model_customization_uuid, service_model_invariant_uuid, asdc_service_model_version - FROM `mso_catalog`.`vnf_resource`; - -DROP TABLE IF EXISTS `mso_catalog`.`vnf_resource_customization`; -- <<<2 - -CREATE TABLE `mso_catalog`.`vnf_resource_customization` ( -- <<<2 - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `MIN_INSTANCES` INT(11) NULL DEFAULT NULL, - `MAX_INSTANCES` INT(11) NULL DEFAULT NULL, - `AVAILABILITY_ZONE_MAX_COUNT` INT(11) NULL DEFAULT NULL, - `NF_TYPE` VARCHAR(200) NULL DEFAULT NULL, - `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL, - `NF_FUNCTION` VARCHAR(200) NULL DEFAULT NULL, - `NF_NAMING_CODE` VARCHAR(200) NULL DEFAULT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `VNF_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL, - PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - INDEX `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID` ASC) -) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.vnf_resource_customization ( -- <<<2 - model_customization_uuid, - model_instance_name, - vnf_resource_model_uuid -) - SELECT DISTINCT - a.model_customization_uuid, - ht1.model_customization_name, - ht1.asdc_uuid - FROM mso_catalog.vnftemp a - JOIN mso_catalog.vnf_resource AS ht1 ON - a.model_customization_uuid = ht1.model_customization_uuid AND - a.asdc_service_model_version = ht1.asdc_service_model_version; --- >>>1 - --- network_resource_customization * <<<1 -CREATE TABLE `mso_catalog`.`nrctemp` ( -- <<<2 - `MODEL_UUID` varchar(200) NOT NULL, - `MODEL_NAME` varchar(200) NOT NULL, - `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, - `NETWORK_RESOURCE_ID` int(11) NOT NULL, - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `NETWORK_TECHNOLOGY` VARCHAR(45) NULL, - `NETWORK_TYPE` VARCHAR(45) NULL, - `NETWORK_ROLE` VARCHAR(200) NULL, - `NETWORK_SCOPE` VARCHAR(45) NULL, - `MODEL_VERSION` VARCHAR(20) NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `NETWORK_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -INSERT INTO mso_catalog.nrctemp ( -- <<<2 - model_customization_uuid, - model_uuid, - model_invariant_uuid, - model_instance_name, - model_name, - network_resource_id, - model_version, - creation_timestamp, - network_resource_model_uuid -) - SELECT - model_customization_uuid, - model_uuid, - model_invariant_uuid, - model_instance_name, - model_name, - network_resource_id, - model_version, - creation_timestamp, - model_uuid - FROM mso_catalog.network_resource_customization; - -DELETE FROM mso_catalog.network_resource_customization; -- <<<2 - -ALTER TABLE `mso_catalog`.`network_resource_customization` -- <<<2 -DROP COLUMN `NETWORK_RESOURCE_ID`, -DROP COLUMN `MODEL_VERSION`, -DROP COLUMN `MODEL_INVARIANT_UUID`, -DROP COLUMN `MODEL_NAME`, -DROP COLUMN `MODEL_UUID`, -ADD COLUMN `NETWORK_TECHNOLOGY` VARCHAR(45) NULL DEFAULT NULL AFTER `MODEL_INSTANCE_NAME`, -ADD COLUMN `NETWORK_TYPE` VARCHAR(45) NULL DEFAULT NULL AFTER `NETWORK_TECHNOLOGY`, -ADD COLUMN `NETWORK_ROLE` VARCHAR(200) NULL DEFAULT NULL AFTER `NETWORK_TYPE`, -ADD COLUMN `NETWORK_SCOPE` VARCHAR(45) NULL DEFAULT NULL AFTER `NETWORK_ROLE`, -ADD COLUMN `NETWORK_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL AFTER `CREATION_TIMESTAMP`, -DROP PRIMARY KEY, -ADD PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), -ADD INDEX `fk_network_resource_customization__network_resource1_idx` (`NETWORK_RESOURCE_MODEL_UUID` ASC), -DROP INDEX `fk_network_resource_customization__network_resource_id_idx`; --- >>>2 - -INSERT INTO mso_catalog.network_resource_customization ( -- <<<2 - model_customization_uuid, - model_instance_name, - creation_timestamp, - network_resource_model_uuid, - network_type -) - SELECT - a.model_customization_uuid, - a.model_instance_name, - a.creation_timestamp, - a.model_uuid, - a.network_type - FROM mso_catalog.nrctemp a; - --- DROP temp table later, after network_resource uses it <<<2 - --- >>>1 - --- network_resource * <<<1 -CREATE TABLE `mso_catalog`.`nrtemp` ( -- <<<2 - `MODEL_NAME` VARCHAR(200) NOT NULL, - `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL, - `DESCRIPTION` varchar(1200) DEFAULT NULL, - `NEUTRON_NETWORK_TYPE` varchar(20) DEFAULT NULL, - `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `MODEL_VERSION` VARCHAR(20) NULL DEFAULT NULL, - `AIC_VERSION_MIN` varchar(20) NOT NULL, - `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, - `MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL, - `TOSCA_NODE_TYPE` VARCHAR(200) NULL DEFAULT NULL, - `TEMPLATE_ID` VARCHAR(200) - ) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - --- E2E-CreationTimestamp <<<2 --- ERROR 1292 (22007) at line 675: Incorrect datetime value: '0000-00-00 00:00:00' for column 'CREATION_TIMESTAMP' at row 1 -UPDATE `mso_catalog`.`network_resource` set CREATION_TIMESTAMP = now() where cast(`CREATION_TIMESTAMP` as char(20)) = '0000-00-00 00:00:00'; --- >>>2 - -INSERT INTO mso_catalog.nrtemp ( -- <<<2 - MODEL_NAME, - ORCHESTRATION_MODE, - DESCRIPTION, - NEUTRON_NETWORK_TYPE, - CREATION_TIMESTAMP, - MODEL_VERSION, - AIC_VERSION_MIN, - AIC_VERSION_MAX, - TEMPLATE_ID -) - SELECT - NETWORK_TYPE, - ORCHESTRATION_MODE, - DESCRIPTION, - NEUTRON_NETWORK_TYPE, - CREATION_TIMESTAMP, - VERSION_STR, - AIC_VERSION_MIN, - AIC_VERSION_MAX, - TEMPLATE_ID - FROM mso_catalog.network_resource; - -DELETE FROM mso_catalog.network_resource; -- <<<2 - -ALTER TABLE `mso_catalog`.`network_resource` -- <<<2 -DROP COLUMN `id`, -CHANGE COLUMN `VERSION_STR` `MODEL_VERSION` VARCHAR(20) NULL DEFAULT NULL, -CHANGE COLUMN `TEMPLATE_ID` `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NOT NULL, -CHANGE COLUMN `NETWORK_TYPE` `MODEL_NAME` VARCHAR(200) NOT NULL, -CHANGE COLUMN `NEUTRON_NETWORK_TYPE` `NEUTRON_NETWORK_TYPE` VARCHAR(20) NULL DEFAULT NULL, -CHANGE COLUMN `ORCHESTRATION_MODE` `ORCHESTRATION_MODE` VARCHAR(20) NULL DEFAULT 'HEAT' AFTER `AIC_VERSION_MAX`, -CHANGE COLUMN `CREATION_TIMESTAMP` `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `ORCHESTRATION_MODE`, -ADD COLUMN `MODEL_UUID` VARCHAR(200) NOT NULL FIRST, -ADD COLUMN `MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `MODEL_NAME`, -ADD COLUMN `TOSCA_NODE_TYPE` VARCHAR(200) NULL DEFAULT NULL AFTER `MODEL_VERSION`, -DROP PRIMARY KEY, -ADD PRIMARY KEY (`MODEL_UUID`), -ADD INDEX `fk_network_resource__temp_network_heat_template_lookup1_idx` (`MODEL_NAME` ASC), -ADD INDEX `fk_network_resource__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC), -DROP INDEX `UK_e5vlpk2xorqk7ogtg6wgw2eo6` ; - -INSERT INTO mso_catalog.network_resource ( -- <<<2 - model_name, - orchestration_mode, - description, - heat_template_artifact_uuid, - neutron_network_type, - creation_timestamp, - model_version, - aic_version_min, - aic_version_max, - model_uuid, - model_invariant_uuid -) - SELECT DISTINCT - ht2.model_name, - a.ORCHESTRATION_MODE, - a.DESCRIPTION, - ht1.ARTIFACT_UUID, - a.NEUTRON_NETWORK_TYPE, - a.CREATION_TIMESTAMP, - ht2.model_version, - a.AIC_VERSION_MIN, - a.AIC_VERSION_MAX, - ht2.model_uuid, - ht2.model_invariant_uuid - FROM mso_catalog.nrtemp a - JOIN mso_catalog.heat_template ht1 ON a.template_id = ht1.id - JOIN mso_catalog.nrctemp ht2 ON a.model_name = ht2.model_name - GROUP BY a.model_name; - -DROP TABLE IF EXISTS mso_catalog.nrtemp; -- <<<2 - -DROP TABLE IF EXISTS mso_catalog.nrctemp; -- <<<2 - --- >>>1 - --- VRC2VMC vnf_res_custom_to_vf_module_custom <<<1 -CREATE TABLE IF NOT EXISTS `mso_catalog`.`vnf_res_custom_to_vf_module_custom` ( -- <<<2 - `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`), - INDEX `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_vnf_res_custom_to_vf_module_custom__vf_module_customization1` - FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `mso_catalog`.`vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - CONSTRAINT `fk_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` - FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) - REFERENCES `mso_catalog`.`vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.vnf_res_custom_to_vf_module_custom ( -- 6sc aka 8c <<<2 - vnf_resource_cust_model_customization_uuid, - vf_module_cust_model_customization_uuid, - creation_timestamp -) - SELECT DISTINCT - a.model_customization_uuid, - b.model_customization_uuid, - now() - FROM - mso_catalog.vnf_resource a, - mso_catalog.vf_module b - WHERE a.id = b.vnf_resource_id; --- >>>1 - --- VR vnf_resource After vrc2vmc and vrc ^ <<<1 --- ERROR 1292 (22007) : Incorrect datetime value: '0000-00-00 00:00:00' for column 'CREATION_TIMESTAMP' <<<2 -UPDATE `mso_catalog`.`vnf_resource` set CREATION_TIMESTAMP = now() where cast(`CREATION_TIMESTAMP` as char(20)) = '0000-00-00 00:00:00'; - -ALTER TABLE `mso_catalog`.`vnf_resource` -- after vrc2vmc and vrc ^ <<<2 -MODIFY `id` INT, -DROP COLUMN `MODEL_CUSTOMIZATION_UUID`, -DROP COLUMN `SERVICE_MODEL_INVARIANT_UUID`, -DROP COLUMN `MODEL_CUSTOMIZATION_NAME`, -DROP COLUMN `VNF_TYPE`, -DROP COLUMN `ASDC_SERVICE_MODEL_VERSION`, -DROP COLUMN `ENVIRONMENT_ID`, -DROP COLUMN `VERSION`, -DROP COLUMN `VNF_NAME`, -CHANGE COLUMN `DESCRIPTION` `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, -CHANGE COLUMN `ORCHESTRATION_MODE` `ORCHESTRATION_MODE` VARCHAR(20) NOT NULL DEFAULT 'HEAT', -CHANGE COLUMN `AIC_VERSION_MIN` `AIC_VERSION_MIN` VARCHAR(20) NULL DEFAULT NULL, -CHANGE COLUMN `AIC_VERSION_MAX` `AIC_VERSION_MAX` VARCHAR(20) NULL DEFAULT NULL, -CHANGE COLUMN `CREATION_TIMESTAMP` `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -CHANGE COLUMN `ASDC_UUID` `MODEL_UUID` VARCHAR(200) NOT NULL , -ADD COLUMN `TOSCA_NODE_TYPE` VARCHAR(200) NULL DEFAULT NULL, -ADD COLUMN `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL, -DROP PRIMARY KEY, -ADD INDEX `fk_vnf_resource__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC), -DROP INDEX `UK_model_customization_uuid__asdc_service_model_version`, -DROP INDEX `UK_k10a0w7h4t0lnbynd3inkg67k`; - -UPDATE mso_catalog.vnf_resource a -- * <<<2 - LEFT JOIN mso_catalog.heat_template ht1 ON a.template_id = ht1.id -SET - heat_template_artifact_uuid = ht1.artifact_uuid; - --- Eliminate duplicates <<<2 -CREATE TABLE `mso_catalog`.`vrtemp` AS - -SELECT vr.* FROM `mso_catalog`.`vnf_resource` vr -WHERE vr.id NOT IN (SELECT vnfs FROM mso_catalog.req5temp) -GROUP BY MODEL_UUID; - -DROP TABLE `mso_catalog`.`vnf_resource`; -RENAME TABLE `mso_catalog`.`vrtemp` TO `mso_catalog`.`vnf_resource`; --- >>>1 - --- VF vf_module after VRC2VMC and VMC ^ <<<1 -CREATE TABLE IF NOT EXISTS `mso_catalog`.`vftemp` ( -- <<<2 - `id` int(11) NOT NULL, - `MODEL_UUID` VARCHAR(200) NOT NULL, - `MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL, - `MODEL_VERSION` VARCHAR(20) NOT NULL, - `MODEL_NAME` VARCHAR(200) NOT NULL, - `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, - `IS_BASE` INT(11) NOT NULL, - `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200), - `VOL_HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `VNF_RESOURCE_MODEL_UUID` VARCHAR(200) - ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.vftemp ( -- <<<2 - id, -- <<<3 - model_uuid, - is_base, - model_name, - model_version, - creation_timestamp, - description, - heat_template_artifact_uuid, - vol_heat_template_artifact_uuid, - vnf_resource_model_uuid, - model_invariant_uuid -- >>>3 -) - SELECT - a.id, -- <<<3 - a.asdc_uuid, - a.is_base, - a.model_name, - a.model_version, - a.creation_timestamp, - a.description, - ht1.artifact_uuid heat_template_artifact_uuid, - ht2.artifact_uuid vol_heat_template_artifact_uuid, - vr1.model_uuid vnf_resource_model_uuid, - a.model_invariant_uuid -- >>>3 - FROM - (SELECT * FROM mso_catalog.vf_module) AS a - LEFT JOIN (SELECT * FROM mso_catalog.heat_template) AS ht1 ON a.template_id = ht1.id - LEFT JOIN (SELECT * FROM mso_catalog.heat_template) AS ht2 ON a.vol_template_id = ht2.id - JOIN (SELECT * FROM mso_catalog.vnf_resource) AS vr1 ON a.vnf_resource_id = vr1.id; - -DELETE FROM mso_catalog.vf_module; -- <<<2 - -ALTER TABLE `mso_catalog`.`vf_module` -- after vftemp vrc2vmc and vmc <<<2 -DROP COLUMN `LABEL`, -DROP COLUMN `INITIAL_COUNT`, -DROP COLUMN `MAX_INSTANCES`, -DROP COLUMN `MIN_INSTANCES`, -DROP COLUMN `MODEL_CUSTOMIZATION_UUID`, -DROP COLUMN `TYPE`, -DROP COLUMN `ASDC_SERVICE_MODEL_VERSION`, -DROP COLUMN `ENVIRONMENT_ID`, -DROP COLUMN `VNF_RESOURCE_ID`, -DROP COLUMN `VOL_ENVIRONMENT_ID`, -CHANGE COLUMN `id` `id` INT(11), -CHANGE COLUMN `MODEL_INVARIANT_UUID` `MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `MODEL_UUID`, -CHANGE COLUMN `MODEL_VERSION` `MODEL_VERSION` VARCHAR(20) NOT NULL AFTER `MODEL_INVARIANT_UUID`, -CHANGE COLUMN `IS_BASE` `IS_BASE` INT(11) NOT NULL AFTER `DESCRIPTION`, -CHANGE COLUMN `TEMPLATE_ID` `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `IS_BASE`, -CHANGE COLUMN `CREATION_TIMESTAMP` `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `VOL_HEAT_TEMPLATE_ARTIFACT_UUID`, -CHANGE COLUMN `ASDC_UUID` `MODEL_UUID` VARCHAR(200) NOT NULL , -CHANGE COLUMN `DESCRIPTION` `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL , -CHANGE COLUMN `VOL_TEMPLATE_ID` `VOL_HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL , -ADD COLUMN `VNF_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL AFTER `CREATION_TIMESTAMP`, -DROP PRIMARY KEY, -ADD INDEX `fk_vf_module__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID` ASC), -ADD INDEX `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC), -ADD INDEX `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID` ASC), -DROP INDEX `UK_model_customization_uuid__asdc_service_model_version` , -DROP INDEX `UK_o3bvdqspginaxlp4gxqohd44l` ; - -INSERT INTO mso_catalog.vf_module ( -- <<<2 - id, -- <<<3 - model_uuid, - is_base, - model_name, - model_version, - creation_timestamp, - description, - heat_template_artifact_uuid, - vol_heat_template_artifact_uuid, - vnf_resource_model_uuid, - model_invariant_uuid -- >>>3 -) - SELECT - id, -- <<<3 - model_uuid, - is_base, - model_name, - model_version, - creation_timestamp, - description, - heat_template_artifact_uuid, - vol_heat_template_artifact_uuid, - vnf_resource_model_uuid, - model_invariant_uuid -- >>>3 - FROM - mso_catalog.vftemp; - --- DROP vftemp later <<<2 - --- >>>1 - --- vnf_components_recipe AFTER vf_module ^ <<<1 -CREATE TABLE `mso_catalog`.`vcrtemp` ( -- <<<2 - `id` int(11) NOT NULL, - `VNF_TYPE` varchar(200) DEFAULT NULL, - `VNF_COMPONENT_TYPE` varchar(45) NOT NULL, - `ACTION` varchar(20) NOT NULL, - `SERVICE_TYPE` varchar(45) DEFAULT NULL, - `VERSION` varchar(20) DEFAULT NULL, - `DESCRIPTION` varchar(1200) DEFAULT NULL, - `ORCHESTRATION_URI` varchar(256) NOT NULL, - `VNF_COMPONENT_PARAM_XSD` varchar(2048) DEFAULT NULL, - `RECIPE_TIMEOUT` int(11) DEFAULT NULL, - `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP, - `VF_MODULE_MODEL_UUID` VARCHAR(200) NULL DEFAULT NULL - ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.vcrtemp ( -- <<<2 - id, -- <<<3 - VNF_TYPE, - VNF_COMPONENT_TYPE, - ACTION, - SERVICE_TYPE, - VERSION, - DESCRIPTION, - ORCHESTRATION_URI, - VNF_COMPONENT_PARAM_XSD, - RECIPE_TIMEOUT, - CREATION_TIMESTAMP, - VF_MODULE_MODEL_UUID -- >>>3 -) - SELECT - a.id, -- <<<3 - a.VNF_TYPE, - a.VNF_COMPONENT_TYPE, - a.ACTION, - a.SERVICE_TYPE, - a.VERSION, - a.DESCRIPTION, - a.ORCHESTRATION_URI, - a.VNF_COMPONENT_PARAM_XSD, - a.RECIPE_TIMEOUT, - a.CREATION_TIMESTAMP, - COALESCE(ht1.model_uuid, a.vf_module_id) VF_MODULE_MODEL_UUID -- >>>3 - FROM mso_catalog.vnf_components_recipe a - LEFT JOIN mso_catalog.vftemp ht1 ON a.vf_module_id = CONVERT(ht1.id, CHAR(100)); - --- DROP vftemp later <<<2 - -DELETE FROM mso_catalog.vnf_components_recipe; -- <<<2 - -ALTER TABLE `mso_catalog`.`vnf_components_recipe` -- <<<2 -CHANGE COLUMN `VF_MODULE_ID` `VF_MODULE_MODEL_UUID` VARCHAR(200) NULL DEFAULT NULL; - -INSERT INTO mso_catalog.vnf_components_recipe SELECT * FROM mso_catalog.vcrtemp; -- <<<2 - -DROP TABLE IF EXISTS mso_catalog.vcrtemp; -- <<<2 - --- >>>1 - --- vf_module_to_heat_files AFTER vf_module heat_files ^ <<<1 -CREATE TABLE `mso_catalog`.`vmthftemp` ( -- <<<2 - VF_MODULE_MODEL_UUID VARCHAR(200) NOT NULL, - HEAT_FILES_ARTIFACT_UUID VARCHAR(200) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -INSERT INTO mso_catalog.vmthftemp ( -- <<<2 - VF_MODULE_MODEL_UUID, - HEAT_FILES_ARTIFACT_UUID -) - SELECT DISTINCT - ht1.model_uuid, - ht2.artifact_uuid - FROM mso_catalog.vf_module_to_heat_files a - JOIN mso_catalog.vftemp ht1 ON a.vf_module_id = CONVERT(ht1.id, CHAR(100)) - JOIN mso_catalog.heat_files ht2 ON a.HEAT_FILES_ID = ht2.id; - -DROP TABLE IF EXISTS mso_catalog.vftemp; -- <<<2 - -DELETE FROM mso_catalog.vf_module_to_heat_files; -- <<<2 - -ALTER TABLE `mso_catalog`.`vf_module_to_heat_files` -- <<<2 -CHANGE COLUMN `VF_MODULE_ID` `VF_MODULE_MODEL_UUID` VARCHAR(200) NOT NULL , -CHANGE COLUMN `HEAT_FILES_ID` `HEAT_FILES_ARTIFACT_UUID` VARCHAR(200) NOT NULL , -ADD INDEX `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`HEAT_FILES_ARTIFACT_UUID` ASC); - -INSERT INTO mso_catalog.vf_module_to_heat_files SELECT * FROM mso_catalog.vmthftemp; -- <<<2 - -DROP TABLE IF EXISTS mso_catalog.vmthftemp; -- <<<2 - --- >>>1 - --- S2RC service_to_resource_customizations` <<<1 -CREATE TABLE IF NOT EXISTS `mso_catalog`.`service_to_resource_customizations` ( -- V <<<2 - `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, - `RESOURCE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_TYPE` VARCHAR(20) NOT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - INDEX `fk_service_to_resource_cust__service_model_uuid_idx` (`SERVICE_MODEL_UUID` ASC), - PRIMARY KEY (`SERVICE_MODEL_UUID`, `RESOURCE_MODEL_CUSTOMIZATION_UUID`, `MODEL_TYPE`), - INDEX `fk_service_to_resource_cust__resource_model_customiz_uuid_idx` (`RESOURCE_MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_service_to_resource_cust__service__model_uuid0` - FOREIGN KEY (`SERVICE_MODEL_UUID`) - REFERENCES `mso_catalog`.`service` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE - ) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -INSERT INTO mso_catalog.service_to_resource_customizations ( -- 4sc * <<<2 - service_model_uuid, - resource_model_customization_uuid, - model_type -) - SELECT - a.service_model_uuid, - a.network_model_customization_uuid, - "network" - FROM - mso_catalog.service_to_networks a; - -INSERT INTO mso_catalog.service_to_resource_customizations ( -- 5sc * <<<2 - service_model_uuid, - resource_model_customization_uuid, - model_type -) - SELECT - a.service_model_uuid, - a.ar_model_customization_uuid, - "allottedResource" - FROM - mso_catalog.service_to_allotted_resources a; - -INSERT INTO mso_catalog.service_to_resource_customizations ( -- 8a * <<<2 - service_model_uuid, - resource_model_customization_uuid, - model_type -) - SELECT - ht1.model_uuid, - a.model_customization_uuid, - "vnf" - FROM mso_catalog.vnftemp a - JOIN mso_catalog.service AS ht1 ON - a.service_model_invariant_uuid = ht1.model_invariant_uuid AND - a.asdc_service_model_version = ht1.model_version; - -ALTER TABLE `mso_catalog`.`service` -- * <<<2 -DROP COLUMN `SERVICE_VERSION`; - -DROP TABLE IF EXISTS mso_catalog.vnftemp; -- <<<2 - --- >>>1 - -CREATE TABLE IF NOT EXISTS `mso_catalog`.`tosca_csar` ( -- C <<<1 - `ARTIFACT_UUID` VARCHAR(200) NOT NULL, - `NAME` VARCHAR(200) NOT NULL, - `VERSION` VARCHAR(20) NOT NULL, - `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, - `ARTIFACT_CHECKSUM` VARCHAR(200) NOT NULL, - `URL` VARCHAR(200) NOT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`ARTIFACT_UUID`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; --- >>>1 - --- 5 aka 8d delete each asdc_uuid except highest ASDC_SERVICE_MODEL_VERSION vnf_resource and cascade vf_module * <<<1 --- DELETE FROM mso_catalog.vnf_resource WHERE id = ANY(SELECT vnfs FROM mso_catalog.req5temp); -DELETE FROM mso_catalog.vf_module WHERE id = ANY(SELECT vfs FROM mso_catalog.req5temp); -DROP TABLE mso_catalog.req5temp; --- >>>1 - -DROP TABLE IF EXISTS `mso_catalog`.`service_to_networks` ; -- D <<<1 - -DROP TABLE IF EXISTS `mso_catalog`.`service_to_allotted_resources` ; -- D <<<1 - --- >>>1 - --- Drop ID's <<<1 -ALTER TABLE `mso_catalog`.`heat_template` DROP COLUMN `id`; -ALTER TABLE `mso_catalog`.`heat_files` DROP COLUMN `id`; -ALTER TABLE `mso_catalog`.`service` DROP COLUMN `id`; -ALTER TABLE `mso_catalog`.`vnf_resource` DROP COLUMN `id`; -ALTER TABLE `mso_catalog`.`vf_module` DROP COLUMN `id`; --- >>>1 - --- FOREIGN KEYS <<<1 -ALTER TABLE `mso_catalog`.`heat_nested_template` -- K <<<2 -ADD CONSTRAINT `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` - FOREIGN KEY (`PARENT_HEAT_TEMPLATE_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, -ADD CONSTRAINT `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` - FOREIGN KEY (`CHILD_HEAT_TEMPLATE_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`heat_template_params` -- K <<<2 -ADD CONSTRAINT `fk_heat_template_params__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`service` -- K <<<2 -ADD CONSTRAINT `fk_service__tosca_csar1` - FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`tosca_csar` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`service_recipe` -- K <<<2 -ADD CONSTRAINT `fk_service_recipe__service1` - FOREIGN KEY (`SERVICE_MODEL_UUID`) - REFERENCES `mso_catalog`.`service` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vnf_resource` -- K <<<2 - ADD PRIMARY KEY (`MODEL_UUID`), - DROP COLUMN `TEMPLATE_ID`, -ADD CONSTRAINT `fk_vnf_resource__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vf_module` -- K <<<2 -ADD PRIMARY KEY (`MODEL_UUID`, `VNF_RESOURCE_MODEL_UUID`), -ADD CONSTRAINT `fk_vf_module__vnf_resource1` - FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) - REFERENCES `mso_catalog`.`vnf_resource` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, -ADD CONSTRAINT `fk_vf_module__heat_template_art_uuid__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, -ADD CONSTRAINT `fk_vf_module__vol_heat_template_art_uuid__heat_template2` - FOREIGN KEY (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vf_module_customization` -- after vf_module K <<<2 - ADD CONSTRAINT `fk_vf_module_customization__vf_module1` - FOREIGN KEY (`VF_MODULE_MODEL_UUID`) - REFERENCES `mso_catalog`.`vf_module` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vf_module_to_heat_files` -- K <<<2 -ADD CONSTRAINT `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` - FOREIGN KEY (`HEAT_FILES_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_files` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, -ADD CONSTRAINT `fk_vf_module_to_heat_files__vf_module__model_uuid1` - FOREIGN KEY (`VF_MODULE_MODEL_UUID`) - REFERENCES `mso_catalog`.`vf_module` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`allotted_resource_customization` -- K <<<2 -ADD CONSTRAINT `fk_allotted_resource_customization__allotted_resource1` - FOREIGN KEY (`AR_MODEL_UUID`) - REFERENCES `mso_catalog`.`allotted_resource` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`network_resource` -- K <<<2 -ADD CONSTRAINT `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` - FOREIGN KEY (`MODEL_NAME`) - REFERENCES `mso_catalog`.`temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, -ADD CONSTRAINT `fk_network_resource__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE RESTRICT - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`network_resource_customization` -- K <<<2 -ADD CONSTRAINT `fk_network_resource_customization__network_resource1` - FOREIGN KEY (`NETWORK_RESOURCE_MODEL_UUID`) - REFERENCES `mso_catalog`.`network_resource` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vnf_resource_customization` -- K <<<2 -ADD CONSTRAINT `fk_vnf_resource_customization__vnf_resource1` - FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) - REFERENCES `mso_catalog`.`vnf_resource` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; --- >>>1 - --- turn validation back on <<<1 -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; - -COMMIT; --- >>>1 - -/* -This file uses folds, set by last line. - -While reading this file, lines with the + are folded. - To unfold all: zR - To fold all: zM - -Move cursor to folded line: type in commands... - Toggle folding: za - Recursively: zA - -Vim help about folding -:help fold -*/ --- vim:foldmarker=<<<,>>>:foldenable:foldmethod=marker diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgradeScript-1707.41.1_to_1710.44.1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgradeScript-1707.41.1_to_1710.44.1.sql deleted file mode 100644 index 0c1bc81bf0..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB-upgradeScript-1707.41.1_to_1710.44.1.sql +++ /dev/null @@ -1,261 +0,0 @@ --- MySQL Workbench Synchronization --- Generated: 2017-07-10 12:52 --- Model: New Model --- Version: 1.0 --- Project: Name of the project --- Author: mz1936 - -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; - -ALTER SCHEMA `mso_catalog` DEFAULT CHARACTER SET latin1 DEFAULT COLLATE latin1_swedish_ci ; - -ALTER TABLE `mso_catalog`.`heat_nested_template` - DROP FOREIGN KEY `fk_heat_nested_template__child_heat_temp_uuid__heat_template1`; - -ALTER TABLE `mso_catalog`.`heat_template_params` - DROP FOREIGN KEY `fk_heat_template_params__heat_template1`; - -ALTER TABLE `mso_catalog`.`service_recipe` - DROP FOREIGN KEY `fk_service_recipe__service1`; - -ALTER TABLE `mso_catalog`.`vf_module` - DROP FOREIGN KEY `fk_vf_module__vol_heat_template_art_uuid__heat_template2`, - DROP FOREIGN KEY `fk_vf_module__heat_template_art_uuid__heat_template1`; - -ALTER TABLE `mso_catalog`.`vf_module_to_heat_files` - DROP FOREIGN KEY `fk_vf_module_to_heat_files__heat_files__artifact_uuid1`, - DROP FOREIGN KEY `fk_vf_module_to_heat_files__vf_module__model_uuid1`; - -ALTER TABLE `mso_catalog`.`network_resource` - DROP FOREIGN KEY `fk_network_resource__heat_template1`; - -ALTER TABLE `mso_catalog`.`temp_network_heat_template_lookup` - DROP FOREIGN KEY `fk_temp_network_heat_template_lookup__heat_template1`; - -ALTER TABLE `mso_catalog`.`vf_module_customization` - DROP FOREIGN KEY `fk_vf_module_customization__vol_env__heat_environment2`, - DROP FOREIGN KEY `fk_vf_module_customization__heat_env__heat_environment1`; - -ALTER TABLE `mso_catalog`.`heat_environment` - MODIFY COLUMN `ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `BODY` LONGTEXT NOT NULL AFTER `DESCRIPTION`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`ARTIFACT_UUID`); - -ALTER TABLE `mso_catalog`.`heat_files` - MODIFY COLUMN `ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `NAME` VARCHAR(200) NOT NULL AFTER `ARTIFACT_UUID`, - MODIFY COLUMN `BODY` LONGTEXT NOT NULL AFTER `DESCRIPTION`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`ARTIFACT_UUID`); - -ALTER TABLE `mso_catalog`.`heat_nested_template` - MODIFY COLUMN `PARENT_HEAT_TEMPLATE_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `CHILD_HEAT_TEMPLATE_UUID` VARCHAR(200) NOT NULL AFTER `PARENT_HEAT_TEMPLATE_UUID`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`PARENT_HEAT_TEMPLATE_UUID`, `CHILD_HEAT_TEMPLATE_UUID`), - DROP INDEX `fk_heat_nested_template__heat_template2_idx`, - ADD INDEX `fk_heat_nested_template__heat_template2_idx` (`CHILD_HEAT_TEMPLATE_UUID` ASC); - -ALTER TABLE `mso_catalog`.`heat_template` - MODIFY COLUMN `ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `NAME` VARCHAR(200) NOT NULL AFTER `ARTIFACT_UUID`, - MODIFY COLUMN `BODY` LONGTEXT NOT NULL AFTER `DESCRIPTION`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`ARTIFACT_UUID`); - -ALTER TABLE `mso_catalog`.`heat_template_params` - MODIFY COLUMN `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NOT NULL FIRST, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`); - -ALTER TABLE `mso_catalog`.`network_recipe` - MODIFY COLUMN `MODEL_NAME` VARCHAR(20) NOT NULL AFTER `id`, - DROP INDEX `UK_rl4f296i0p8lyokxveaiwkayi`, - ADD UNIQUE INDEX `UK_rl4f296i0p8lyokxveaiwkayi` (`MODEL_NAME` ASC, `ACTION` ASC, `VERSION_STR` ASC); - -ALTER TABLE `mso_catalog`.`service` - ADD COLUMN `SERVICE_TYPE` VARCHAR(200) NULL DEFAULT NULL AFTER `DESCRIPTION`, - ADD COLUMN `SERVICE_ROLE` VARCHAR(200) NULL DEFAULT NULL AFTER `SERVICE_TYPE`, - MODIFY COLUMN `MODEL_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `MODEL_NAME` VARCHAR(200) NOT NULL AFTER `MODEL_UUID`, - MODIFY COLUMN `MODEL_VERSION` VARCHAR(20) NOT NULL AFTER `MODEL_INVARIANT_UUID`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`MODEL_UUID`), - ADD INDEX `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID` ASC), - DROP INDEX `fk_service__tosca_csar1_idx`; - -ALTER TABLE `mso_catalog`.`service_recipe` - MODIFY COLUMN `SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL AFTER `CREATION_TIMESTAMP`, - DROP INDEX `fk_service_recipe__service1_idx`, - ADD INDEX `fk_service_recipe__service1_idx` (`SERVICE_MODEL_UUID` ASC), - DROP INDEX `UK_7fav5dkux2v8g9d2i5ymudlgc`, - ADD UNIQUE INDEX `UK_7fav5dkux2v8g9d2i5ymudlgc` (`SERVICE_MODEL_UUID` ASC, `ACTION` ASC); - -ALTER TABLE `mso_catalog`.`vf_module` - MODIFY COLUMN `MODEL_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `IS_BASE`, - MODIFY COLUMN `VOL_HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `HEAT_TEMPLATE_ARTIFACT_UUID`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`MODEL_UUID`, `VNF_RESOURCE_MODEL_UUID`), - ADD INDEX `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC), - ADD INDEX `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID` ASC), - DROP INDEX `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx`, - DROP INDEX `fk_vf_module__heat_template_art_uuid__heat_template1_idx`; - -ALTER TABLE `mso_catalog`.`vf_module_to_heat_files` - MODIFY COLUMN `VF_MODULE_MODEL_UUID` VARCHAR(200) NOT NULL FIRST, - MODIFY COLUMN `HEAT_FILES_ARTIFACT_UUID` VARCHAR(200) NOT NULL AFTER `VF_MODULE_MODEL_UUID`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`VF_MODULE_MODEL_UUID`, `HEAT_FILES_ARTIFACT_UUID`), - DROP INDEX `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx`, - ADD INDEX `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`HEAT_FILES_ARTIFACT_UUID` ASC), - COMMENT = ''; - -ALTER TABLE `mso_catalog`.`vnf_components_recipe` - MODIFY COLUMN `VF_MODULE_MODEL_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `CREATION_TIMESTAMP`, - CHANGE COLUMN `VERSION` `VERSION` VARCHAR(20) NOT NULL, - DROP INDEX `UK_4dpdwddaaclhc11wxsb7h59ma`, - ADD UNIQUE INDEX `UK_4dpdwddaaclhc11wxsb7h59ma` (`VF_MODULE_MODEL_UUID` ASC, `VNF_COMPONENT_TYPE` ASC, `ACTION` ASC, `VERSION` ASC); - -ALTER TABLE `mso_catalog`.`vnf_resource` - MODIFY COLUMN `MODEL_UUID` VARCHAR(200) NOT NULL FIRST, - CHANGE COLUMN `DESCRIPTION` `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL AFTER `TOSCA_NODE_TYPE`, - CHANGE COLUMN `ORCHESTRATION_MODE` `ORCHESTRATION_MODE` VARCHAR(20) NOT NULL DEFAULT 'HEAT' AFTER `DESCRIPTION`, - CHANGE COLUMN `AIC_VERSION_MIN` `AIC_VERSION_MIN` VARCHAR(20) NULL DEFAULT NULL AFTER `ORCHESTRATION_MODE`, - CHANGE COLUMN `AIC_VERSION_MAX` `AIC_VERSION_MAX` VARCHAR(20) NULL DEFAULT NULL AFTER `AIC_VERSION_MIN`, - CHANGE COLUMN `CREATION_TIMESTAMP` `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `AIC_VERSION_MAX`, - DROP PRIMARY KEY, - ADD PRIMARY KEY (`MODEL_UUID`), - DROP INDEX `fk_vnf_resource__heat_template1`, - ADD INDEX `fk_vnf_resource__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC); - -ALTER TABLE `mso_catalog`.`allotted_resource_customization` - MODIFY COLUMN `PROVIDING_SERVICE_MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `MODEL_INSTANCE_NAME`, - MODIFY COLUMN `TARGET_NETWORK_ROLE` VARCHAR(200) NULL DEFAULT NULL AFTER `PROVIDING_SERVICE_MODEL_INVARIANT_UUID`, - MODIFY COLUMN `NF_NAMING_CODE` VARCHAR(200) NULL DEFAULT NULL AFTER `NF_FUNCTION`, - CHANGE COLUMN `CREATION_TIMESTAMP` `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `MAX_INSTANCES`; - -ALTER TABLE `mso_catalog`.`vnf_resource_customization` - MODIFY COLUMN `NF_NAMING_CODE` VARCHAR(200) NULL DEFAULT NULL AFTER `NF_FUNCTION`; - -ALTER TABLE `mso_catalog`.`network_resource` - CHANGE COLUMN `NEUTRON_NETWORK_TYPE` `NEUTRON_NETWORK_TYPE` VARCHAR(20) NULL DEFAULT NULL AFTER `TOSCA_NODE_TYPE`, - CHANGE COLUMN `DESCRIPTION` `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL AFTER `NEUTRON_NETWORK_TYPE`, - CHANGE COLUMN `HEAT_TEMPLATE_ARTIFACT_UUID` `HEAT_TEMPLATE_ARTIFACT_UUID` VARCHAR(200) NOT NULL AFTER `CREATION_TIMESTAMP`, - CHANGE COLUMN `MODEL_INVARIANT_UUID` `MODEL_INVARIANT_UUID` VARCHAR(200) NULL DEFAULT NULL; - -ALTER TABLE `mso_catalog`.`temp_network_heat_template_lookup` - ADD INDEX `fk_temp_network_heat_template_lookup__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID` ASC), - DROP INDEX `fk_temp_network_heat_template_lookup__heat_template1_idx`; - -ALTER TABLE `mso_catalog`.`vf_module_customization` - ADD INDEX `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID` ASC), - ADD INDEX `fk_vf_module_customization__vol_env__heat_environment2_idx` (`VOL_ENVIRONMENT_ARTIFACT_UUID` ASC), - DROP INDEX `fk_vf_module_customization__vol_env__heat_environment2_idx`, - DROP INDEX `fk_vf_module_customization__heat_env__heat_environment1_idx`; - -ALTER TABLE `mso_catalog`.`service_to_resource_customizations` - DROP INDEX `fk_service_to_resource_cust__resource_model_customiz_uuid_idx`; - -ALTER TABLE `mso_catalog`.`heat_nested_template` - DROP FOREIGN KEY `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1`; - -ALTER TABLE `mso_catalog`.`heat_nested_template` - ADD CONSTRAINT `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` - FOREIGN KEY (`PARENT_HEAT_TEMPLATE_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` - FOREIGN KEY (`CHILD_HEAT_TEMPLATE_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`heat_template_params` - ADD CONSTRAINT `fk_heat_template_params__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`service_recipe` - ADD CONSTRAINT `fk_service_recipe__service1` - FOREIGN KEY (`SERVICE_MODEL_UUID`) - REFERENCES `mso_catalog`.`service` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vf_module` - ADD CONSTRAINT `fk_vf_module__heat_template_art_uuid__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_vf_module__vol_heat_template_art_uuid__heat_template2` - FOREIGN KEY (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vf_module_to_heat_files` - ADD CONSTRAINT `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` - FOREIGN KEY (`HEAT_FILES_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_files` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_vf_module_to_heat_files__vf_module__model_uuid1` - FOREIGN KEY (`VF_MODULE_MODEL_UUID`) - REFERENCES `mso_catalog`.`vf_module` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`network_resource` - ADD CONSTRAINT `fk_network_resource__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE RESTRICT - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`temp_network_heat_template_lookup` - ADD CONSTRAINT `fk_temp_network_heat_template_lookup__heat_template1` - FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_template` (`ARTIFACT_UUID`) - ON DELETE RESTRICT - ON UPDATE CASCADE; - -ALTER TABLE `mso_catalog`.`vf_module_customization` - ADD CONSTRAINT `fk_vf_module_customization__heat_env__heat_environment1` - FOREIGN KEY (`HEAT_ENVIRONMENT_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_environment` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE, - ADD CONSTRAINT `fk_vf_module_customization__vol_env__heat_environment2` - FOREIGN KEY (`VOL_ENVIRONMENT_ARTIFACT_UUID`) - REFERENCES `mso_catalog`.`heat_environment` (`ARTIFACT_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE; - -INSERT INTO mso_catalog.SERVICE_RECIPE (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID) -VALUES ('activateInstance', '1.0', 'VID_DEFAULT activate', '/mso/async/services/ActivateGenericMacroService', 180, (SELECT model_uuid from mso_catalog.SERVICE where MODEL_NAME = 'VID_DEFAULT')); - -INSERT INTO mso_catalog.SERVICE_RECIPE (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID) -VALUES ('deactivateInstance', '1.0', 'VID_DEFAULT deactivate', '/mso/async/services/DeactivateGenericMacroService', 180, (SELECT model_uuid from mso_catalog.SERVICE where MODEL_NAME = 'VID_DEFAULT')); - -INSERT INTO mso_catalog.VNF_RECIPE(VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) -VALUES ('VID_DEFAULT', 'updateInstance', '1', 'VID_DEFAULT update', '/mso/async/services/UpdateVnfInfra', 180); - -INSERT INTO mso_catalog.VNF_RECIPE(VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) -VALUES ('VID_DEFAULT', 'replaceInstance', '1', 'VID_DEFAULT replace', '/mso/async/services/ReplaceVnfInfra', 180); - -INSERT INTO mso_catalog.VNF_COMPONENTS_RECIPE(VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID) -VALUES ('vfModule', 'replaceInstance', '1', 'VID_DEFAULT vfModule replace', '/mso/async/services/ReplaceVfModuleInfra', 180, 'VID_DEFAULT'); - -ALTER TABLE mso_requests.infra_active_requests modify LAST_MODIFIED_BY VARCHAR(100); - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_catalog_data_load_1710.46.1_to_1802.48.1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_catalog_data_load_1710.46.1_to_1802.48.1.sql deleted file mode 100644 index d89795ba92..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_catalog_data_load_1710.46.1_to_1802.48.1.sql +++ /dev/null @@ -1,18 +0,0 @@ --- MSO-817 Insert new vnf_recipe records for "inPlaceSoftwareUpdate" and "applyUpdatedConfig" actions for VID_DEFAULT --- ----------------------------------------------------------- -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; --- - -INSERT INTO mso_catalog.VNF_RECIPE ( - VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT -) VALUES - ('VID_DEFAULT', 'inPlaceSoftwareUpdate', '1', 'VID_DEFAULT inPlaceSoftwareUpdate', '/mso/async/services/VnfInPlaceUpdate', 180), - ('VID_DEFAULT', 'applyUpdatedConfig', '1', 'VID_DEFAULT applyUpdatedConfig', '/mso/async/services/VnfConfigUpdate', 180); - --- -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; ---
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_catalog_schema_upgrade_1710.46.1_to_1802.48.1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_catalog_schema_upgrade_1710.46.1_to_1802.48.1.sql deleted file mode 100644 index ef6ec9eea7..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_catalog_schema_upgrade_1710.46.1_to_1802.48.1.sql +++ /dev/null @@ -1,22 +0,0 @@ --- MSO-1224 Add 2 new allottedResource columns in Catalog DB and return in catalog db adapter - AND - --- MSO-670 To support new ACTION value of "inPlaceSoftwareUpdate" --- increase ACTION column length to varchar(50) in all *_RECIPE tables in catalog db. --- ------------------------------------------------------------- -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; --- - -ALTER TABLE `mso_catalog`.`network_recipe` CHANGE COLUMN `ACTION` `ACTION` VARCHAR(50) NOT NULL ; -ALTER TABLE `mso_catalog`.`service_recipe` CHANGE COLUMN `ACTION` `ACTION` VARCHAR(50) NOT NULL ; -ALTER TABLE `mso_catalog`.`vnf_components_recipe` CHANGE COLUMN `ACTION` `ACTION` VARCHAR(50) NOT NULL ; -ALTER TABLE `mso_catalog`.`vnf_recipe` CHANGE COLUMN `ACTION` `ACTION` VARCHAR(50) NOT NULL ; - -ALTER TABLE `mso_catalog`.`allotted_resource_customization` - ADD COLUMN `PROVIDING_SERVICE_MODEL_UUID` VARCHAR(200) NULL DEFAULT NULL AFTER `MODEL_INSTANCE_NAME`, - ADD COLUMN `PROVIDING_SERVICE_MODEL_NAME` VARCHAR(200) NULL DEFAULT NULL AFTER `PROVIDING_SERVICE_MODEL_INVARIANT_UUID`; - --- -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_requests_schema_upgrade_1710.46.1_to_1802.48.1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_requests_schema_upgrade_1710.46.1_to_1802.48.1.sql deleted file mode 100644 index a467fbafd5..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_onap_mso_requests_schema_upgrade_1710.46.1_to_1802.48.1.sql +++ /dev/null @@ -1,100 +0,0 @@ --- MSO-816 mso_requests DB changes to support tenant isolation --- ----------------------------------------------------------- -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; --- - -ALTER TABLE `mso_requests`.`infra_active_requests` - ADD COLUMN `OPERATIONAL_ENV_ID` VARCHAR(45) NULL DEFAULT NULL AFTER `CONFIGURATION_NAME`, - ADD COLUMN `OPERATIONAL_ENV_NAME` VARCHAR(200) NULL DEFAULT NULL AFTER `OPERATIONAL_ENV_ID`, - CHANGE COLUMN `REQUEST_SCOPE` `REQUEST_SCOPE` VARCHAR(50) NOT NULL; - --- - -DROP TABLE IF EXISTS `mso_requests`.`activate_operational_env_per_distributionid_status`; -DROP TABLE IF EXISTS `mso_requests`.`activate_operational_env_service_model_distribution_status`; -DROP TABLE IF EXISTS `mso_requests`.`watchdog_distributionid_status`; -DROP TABLE IF EXISTS `mso_requests`.`watchdog_per_component_distribution_status`; -DROP TABLE IF EXISTS `mso_requests`.`watchdog_service_mod_ver_id_lookup`; - --- ----------------------------------------------------- --- Table `mso_requests`.`activate_operational_env_service_model_distribution_status` --- ----------------------------------------------------- -CREATE TABLE `mso_requests`.`activate_operational_env_service_model_distribution_status` ( - `OPERATIONAL_ENV_ID` VARCHAR(45) NOT NULL, - `SERVICE_MODEL_VERSION_ID` VARCHAR(45) NOT NULL, - `REQUEST_ID` VARCHAR(45) NOT NULL, - `SERVICE_MOD_VER_FINAL_DISTR_STATUS` VARCHAR(45) NULL, - `RECOVERY_ACTION` VARCHAR(30) NULL, - `RETRY_COUNT_LEFT` INT(11) NULL, - `WORKLOAD_CONTEXT` VARCHAR(80) NOT NULL, - `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `MODIFY_TIME` DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`)) -ENGINE = InnoDB; - --- ----------------------------------------------------- --- Table `mso_requests`.`activate_operational_env_per_distributionid_status` --- ----------------------------------------------------- -CREATE TABLE `mso_requests`.`activate_operational_env_per_distributionid_status` ( - `DISTRIBUTION_ID` VARCHAR(45) NOT NULL, - `DISTRIBUTION_ID_STATUS` VARCHAR(45) NULL, - `DISTRIBUTION_ID_ERROR_REASON` VARCHAR(250) NULL, - `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `MODIFY_TIME` DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, - `OPERATIONAL_ENV_ID` VARCHAR(45) NOT NULL, - `SERVICE_MODEL_VERSION_ID` VARCHAR(45) NOT NULL, - `REQUEST_ID` VARCHAR(45) NOT NULL, - PRIMARY KEY (`DISTRIBUTION_ID`), - INDEX `fk_activate_op_env_per_distributionid_status__aoesmds1_idx` (`OPERATIONAL_ENV_ID` ASC, `SERVICE_MODEL_VERSION_ID` ASC, `REQUEST_ID` ASC), - CONSTRAINT `fk_activate_op_env_per_distributionid_status__aoesmds1` - FOREIGN KEY (`OPERATIONAL_ENV_ID` , `SERVICE_MODEL_VERSION_ID` , `REQUEST_ID`) - REFERENCES `mso_requests`.`activate_operational_env_service_model_distribution_status` (`OPERATIONAL_ENV_ID` , `SERVICE_MODEL_VERSION_ID` , `REQUEST_ID`) - ON DELETE CASCADE - ON UPDATE CASCADE) -ENGINE = InnoDB; - --- ----------------------------------------------------- --- Table `mso_requests`.`watchdog_distributionid_status` --- ----------------------------------------------------- -CREATE TABLE `mso_requests`.`watchdog_distributionid_status` ( - `DISTRIBUTION_ID` VARCHAR(45) NOT NULL, - `DISTRIBUTION_ID_STATUS` VARCHAR(45) NULL, - `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `MODIFY_TIME` DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`DISTRIBUTION_ID`)) -ENGINE = InnoDB; - --- ----------------------------------------------------- --- Table `mso_requests`.`watchdog_per_component_distribution_status` --- ----------------------------------------------------- -CREATE TABLE `mso_requests`.`watchdog_per_component_distribution_status` ( - `DISTRIBUTION_ID` VARCHAR(45) NOT NULL, - `COMPONENT_NAME` VARCHAR(45) NOT NULL, - `COMPONENT_DISTRIBUTION_STATUS` VARCHAR(45) NULL, - `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `MODIFY_TIME` DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`DISTRIBUTION_ID`, `COMPONENT_NAME`), - CONSTRAINT `fk_watchdog_component_distribution_status_watchdog_distributi1` - FOREIGN KEY (`DISTRIBUTION_ID`) - REFERENCES `mso_requests`.`watchdog_distributionid_status` (`DISTRIBUTION_ID`) - ON DELETE CASCADE - ON UPDATE CASCADE) -ENGINE = InnoDB; - --- ----------------------------------------------------- --- Table `mso_requests`.`watchdog_service_mod_ver_id_lookup` --- ----------------------------------------------------- -CREATE TABLE `mso_requests`.`watchdog_service_mod_ver_id_lookup` ( - `DISTRIBUTION_ID` VARCHAR(45) NOT NULL, - `SERVICE_MODEL_VERSION_ID` VARCHAR(45) NOT NULL, - `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`DISTRIBUTION_ID`)) -ENGINE = InnoDB; - --- -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; ---
\ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_upgrade_1710.44.1_to_1710.45.1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_upgrade_1710.44.1_to_1710.45.1.sql deleted file mode 100644 index b76dd1b5da..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_upgrade_1710.44.1_to_1710.45.1.sql +++ /dev/null @@ -1,20 +0,0 @@ -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; - -ALTER TABLE `mso_catalog`.`service` - ADD COLUMN `ENVIRONMENT_CONTEXT` VARCHAR(200) NULL DEFAULT NULL AFTER `SERVICE_ROLE`, - ADD COLUMN `WORKLOAD_CONTEXT` VARCHAR(200) NULL DEFAULT NULL AFTER `ENVIRONMENT_CONTEXT`; - -ALTER TABLE `mso_catalog`.`vnf_resource_customization` - ADD COLUMN `MULTI_STAGE_DESIGN` VARCHAR(20) NULL DEFAULT NULL AFTER `NF_NAMING_CODE`; - -INSERT INTO mso_catalog.VNF_RECIPE ( - VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT -) VALUES ( - 'POLO_DEFAULT', 'replaceInstance', '1', 'POLO_DEFAULT recreate', '/mso/async/services/RecreateInfraVce' , 180 -); - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_upgrade_1710.45.1_to_1710.46.1.sql b/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_upgrade_1710.45.1_to_1710.46.1.sql deleted file mode 100644 index 35cfdbf307..0000000000 --- a/packages/root-pack-extras/config-resources/mysql/db-sql-scripts/upgrade/MariaDB_upgrade_1710.45.1_to_1710.46.1.sql +++ /dev/null @@ -1,20 +0,0 @@ -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; - -ALTER SCHEMA `mso_requests` DEFAULT CHARACTER SET latin1 DEFAULT COLLATE latin1_swedish_ci ; - -ALTER TABLE `mso_requests`.`active_requests` -CHANGE COLUMN `CLIENT_REQUEST_ID` `CLIENT_REQUEST_ID` VARCHAR(45) NULL DEFAULT NULL AFTER `REQUEST_ID`; - -ALTER TABLE `mso_requests`.`infra_active_requests` -CHANGE COLUMN `CLIENT_REQUEST_ID` `CLIENT_REQUEST_ID` VARCHAR(45) NULL DEFAULT NULL AFTER `REQUEST_ID`, -CHANGE COLUMN `ACTION` `ACTION` VARCHAR(45) NULL DEFAULT NULL , -CHANGE COLUMN `LAST_MODIFIED_BY` `LAST_MODIFIED_BY` VARCHAR(100) NULL DEFAULT NULL , -ADD COLUMN `CONFIGURATION_ID` VARCHAR(45) NULL DEFAULT NULL AFTER `REQUESTOR_ID`, -ADD COLUMN `CONFIGURATION_NAME` VARCHAR(200) NULL DEFAULT NULL AFTER `CONFIGURATION_ID`; - - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; @@ -47,8 +47,7 @@ <org.apache.maven.user-settings></org.apache.maven.user-settings> <openstack.version>1.2.2</openstack.version> <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> - <springboot.version>1.5.13.RELEASE</springboot.version> - <cxf.version>3.1.12</cxf.version> + <springboot.version>1.5.13.RELEASE</springboot.version> <originalClassifier>original</originalClassifier> <docker.skip>true</docker.skip> <docker.skip.build>true</docker.skip.build> @@ -63,6 +62,8 @@ <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath> <publicNexusPath>content/repositories/public/</publicNexusPath> <siteNexusPath>content/sites/site/org/onap/so/${project.version}/</siteNexusPath> + <cxf.version>3.2.5</cxf.version> + <jax.ws.rs>2.1</jax.ws.rs> </properties> <distributionManagement> <repository> @@ -547,7 +548,7 @@ <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> - <version>2.0</version> + <version>${jax.ws.rs}</version> </dependency> <dependency> <groupId>javax.annotation</groupId> |