aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/pom.xml10
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java134
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java3
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java12
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java5
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java4
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java82
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java42
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java73
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java7
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java117
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java5
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java11
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java5
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java6
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java10
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java13
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java14
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java18
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json6
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/application-test.yaml55
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/data.sql3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java62
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java45
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java47
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java53
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java965
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java28
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.0__AddModelAndModelRecipe.sql (renamed from adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql)0
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.1__AddCloudConfig.sql47
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java66
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql50
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml19
-rw-r--r--adapters/mso-openstack-adapters/pom.xml8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java67
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java167
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java10
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application-local.yaml20
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application.yaml4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java107
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java64
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java22
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml122
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml31
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/data.sql4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql51
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java48
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java44
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java4
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java135
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt302
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json458
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json96
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env2
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml45
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env18
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml152
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env9
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml86
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env17
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml128
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csarbin97867 -> 0 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json217
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt412
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt289
-rw-r--r--asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json75
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java145
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java76
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json4
-rw-r--r--bpmn/so-bpmn-building-blocks/pom.xml6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn36
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn38
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn29
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java23
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java17
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy27
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json67
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java14
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java99
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java21
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java28
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java9
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java34
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java261
-rw-r--r--common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java99
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java44
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java135
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java2689
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml70
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java (renamed from adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java)2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java (renamed from adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java)101
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java (renamed from adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java)151
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java (renamed from adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java)83
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java (renamed from adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java)2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java71
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java10
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/BaseTest.java15
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java (renamed from adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java)7
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java (renamed from adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java)3
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.java21
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java37
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java21
-rw-r--r--mso-catalog-db/src/test/resources/data.sql7
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql51
-rw-r--r--pom.xml5
156 files changed, 4865 insertions, 5392 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/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/java/org/onap/so/adapters/catalogdb/rest/package-info.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java
deleted file mode 100644
index 8f75008aef..0000000000
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java
+++ /dev/null
@@ -1,28 +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.catalogdb.rest;
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/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/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 054c239c91..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');
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{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, 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 47b65a11de..01c1df304e 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -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..fd2ec179dc
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -0,0 +1,167 @@
+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.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 = loadCloudConfig();
+ if(cloudConfig == null){
+ LOGGER.debug("No CloudConfig defined in :"+getApplicationYamlName()+" exiting.");
+ }else{
+ 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() throws Exception {
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ R__CloudConfigMigration cloudConfigMigration = mapper.readValue(R__CloudConfigMigration.class
+ .getResourceAsStream(getApplicationYamlName()), 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 (?,?,?,?,?,?,?,?,?,?);";
+ PreparedStatement ps = connection.prepareStatement(insert);
+ try (Statement stmt = connection.createStatement()) {
+ 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 (?,?,?,?,?,?,?,?,?);";
+ PreparedStatement ps = connection.prepareStatement(insert);
+ try (Statement stmt = connection.createStatement()) {
+ 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 (?,?,?,?,?,?);";
+ PreparedStatement ps = connection.prepareStatement(insert);
+ try (Statement stmt = connection.createStatement()) {
+ 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/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..4a4c83e4a5 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
@@ -38,3 +38,7 @@ spring:
#Actuator
management:
context-path: /manage
+
+flyway:
+ outOfOrder: true
+ ignoreMissingMigrations: true \ No newline at end of file
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/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
index a2faaaff78..cf68f097dc 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,16 @@ 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.onap.so.db.catalog.data.repository.CloudIdentityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
@@ -36,16 +42,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 +73,11 @@ public class BaseRestTestUtils {
@LocalServerPort
private int port;
+
+ public ObjectMapper mapper;
+
+ @Autowired
+ private CloudIdentityRepository cloudIdentityRepository;
protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{
ObjectMapper mapper = new ObjectMapper();
@@ -87,10 +102,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/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/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 87df2648d1..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,26 +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 for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID());
+ // Make sure the vfMetadata and tosca customizations match before comparing their VF Modules UUID's
+ if(vfCustomizationUUID.equals(vfMetaDataResource.getResourceCustomizationUUID())){
- }
- service.getVnfCustomizations().add(vnfResource);
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfMetaData CustomizationUUID");
+
+ VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+
+ 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);
+ }
}
}
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 13af95a8fc..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,6 +209,10 @@ 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());
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 af0987f6d0..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);
@@ -380,7 +374,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
.ignoring("createTime")
.ignoring("modifyTime"));
}
-
@Test
public void installTheResourceExceptionTest() throws Exception {
@@ -472,132 +465,4 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
return actualWatchdogComponentDistributionStatus;
}
-
- private void populatevfResourceStructure() throws Exception {
- vfResourceStructure = spy(new VfResourceStructure(notificationData, resourceInstance));
-
- HashMap<String, VfModuleArtifact> vfModuleArtifacts = mock(HashMap.class);
- CapabilityAssignments capabilityAssignments = mock(CapabilityAssignments.class);
- CapabilityAssignment capabilityAssignment = mock(CapabilityAssignment.class);
-
- Iterator artifactIterator = mock(Iterator.class);
- Iterator nodeTemplateIterator = mock(Iterator.class);
- IDistributionClientDownloadResult clientResult = mock(IDistributionClientDownloadResult.class);
- doReturn(IOUtils.toByteArray(
- new FileInputStream(
- new File(
- getClass().getClassLoader().getResource("resource-examples/simpleTest.yaml").getFile())
- ))).when(clientResult).getArtifactPayload();
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult);
- Collection<VfModuleArtifact> vfModuleArtifactsValues = mock(Collection.class);
-
- NodeTemplate nodeTemplate = mock(NodeTemplate.class);
- List<NodeTemplate> nodeTemplateList = new ArrayList<>();
- nodeTemplateList.add(nodeTemplate);
-
- doReturn(sdcCsarHelper).when(toscaResourceStruct).getSdcCsarHelper();
- doReturn("metadataPropertyValue").when(sdcCsarHelper).getMetadataPropertyValue(any(Metadata.class), any(String.class));
- doReturn("ntPropertyLeafValue").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(any(NodeTemplate.class), any(String.class));
- doReturn("true").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
- doReturn("1").when(sdcCsarHelper).getCapabilityPropertyLeafValue(any(CapabilityAssignment.class), any(String.class));
- doReturn(vfGroups).when(sdcCsarHelper).getVfModulesByVf(any(String.class));
- doReturn(capabilityAssignments).when(sdcCsarHelper).getCapabilitiesOf(any(NodeTemplate.class));
- doReturn(capabilityAssignment).when(capabilityAssignments).getCapabilityByName(any(String.class));
- doReturn(vfModuleArtifacts).when(vfResourceStructure).getArtifactsMapByUUID();
- when(vfModuleArtifacts.values()).thenReturn(vfModuleArtifactsValues);
- when(vfModuleArtifactsValues.iterator()).thenReturn(artifactIterator);
- when(artifactIterator.hasNext()).thenReturn(true, false);
- when(artifactIterator.next()).thenReturn(vfModuleArtifact);
- when(artifactInfo.getArtifactType()).thenReturn(ASDCConfiguration.OTHER);
- when(nodeTemplateIterator.hasNext()).thenReturn(true, false);
- doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVfList();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVlList();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources();
- doReturn(metadata).when(nodeTemplate).getMetaData();
- doReturn("model_instance_name").when(nodeTemplate).getName();
- }
-
- private void populateToscaResourceStruct() {
-
- VnfResource vnfResource = new VnfResource();
- vnfResource.setModelName("modelName");
- vnfResource.setModelVersion("1.1");
- vnfResource.setModelUUID("modelUUID");
- vnfResource.setOrchestrationMode("orchestrationMode");
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setVnfResources(vnfResource);
- vnfResourceCustomization.setModelCustomizationUUID("vnfResCustModelCustomizationUUID");
- vnfResourceCustomization.setModelInstanceName("modelInstanceName");
-
- allottedResource = new AllottedResource();
- allottedResource.setModelUUID("serviceMetadataValue");
- allottedResource.setModelInvariantUUID("modelInvariantUUID");
- allottedResource.setModelName("modelName");
- allottedResource.setModelVersion("1.1");
-
- allottedResourceCustomization = new AllottedResourceCustomization();
- allottedResourceCustomization.setAllottedResource(allottedResource);
- allottedResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
- allottedResourceCustomization.setModelInstanceName("modelInstanceName");
-
- catalogService = new Service();
- catalogService.setServiceType("Bonding");
- catalogService.setModelUUID("5df8b6de-2083-11e7-93ae-92361f002672");
- catalogService.setModelInvariantUUID("modelInvariantUUID");
- catalogService.setModelName("modelName");
- catalogService.setModelVersion("modelVersion");
- catalogService.getVnfCustomizations().add(vnfResourceCustomization);
-
- catalogService.setServiceRole("COLLABORATE");
-
- HeatTemplate heatTemplate = new HeatTemplate();
- heatTemplate.setArtifactUuid("ff874603-4222-11e7-9252-005056850d2e");
- heatTemplate.setArtifactChecksum("MANUAL RECORD");
- heatTemplate.setTemplateBody("templateBody");
- heatTemplate.setTemplateName("module_mns_zrdm3frwl01exn_01_rgvm_1.yml");
- heatTemplate.setVersion("1");
-
- NetworkResource networkResource = new NetworkResource();
- networkResource.setAicVersionMin("aicVersionMin");
- networkResource.setModelUUID("modelUUID");
- networkResource.setOrchestrationMode("orchestrationMode");
- networkResource.setModelVersion("modelVersion");
- networkResource.setNeutronNetworkType("neutronNetworkType");
- networkResource.setAicVersionMax("aicVersionMax");
- networkResource.setModelName("CONTRAIL30_GNDIRECT");
- networkResource.setModelInvariantUUID("modelInvariantUUID");
- networkResource.setHeatTemplate(heatTemplate);
-
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
- networkResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
- networkResourceCustomization.setModelInstanceName("modelInstanceName");
- networkResourceCustomization.setNetworkResource(networkResource);
-
- doReturn(networkResource).when(toscaResourceStruct).getCatalogNetworkResource();
- doReturn(networkResourceCustomization).when(toscaResourceStruct).getCatalogNetworkResourceCustomization();
- doNothing().when(toscaResourceStruct).setSuccessfulDeployment();
- doReturn("serviceVersion").when(toscaResourceStruct).getServiceVersion();
- doReturn(catalogService).when(toscaResourceStruct).getCatalogService();
- doReturn(artifactInfo).when(toscaResourceStruct).getToscaArtifact();
- doReturn("artifactChecksum").when(artifactInfo).getArtifactChecksum();
- doReturn("artifactUUID").when(artifactInfo).getArtifactUUID();
- doReturn("artifactName").when(artifactInfo).getArtifactName();
- doReturn("1.0").when(artifactInfo).getArtifactVersion();
- doReturn("artifactDescription").when(artifactInfo).getArtifactDescription();
- doReturn("artifactURL").when(artifactInfo).getArtifactURL();
- doReturn(metadata).when(toscaResourceStruct).getServiceMetadata();
- doReturn("serviceMetadataValue").when(metadata).getValue(any(String.class));
- doReturn("CONTRAIL30_GNDIRECT").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
- doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization();
- doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource();
- doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization();
- }
-
- private void populateNotificationData() {
- notificationData.setDistributionID("testStatusSuccessTosca");
- notificationData.setServiceVersion("123456");
- notificationData.setServiceUUID("5df8b6de-2083-11e7-93ae-92361f002671");
- notificationData.setWorkloadContext("workloadContext");
- }
}
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
deleted file mode 100644
index 69b1c23404..0000000000
--- a/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar
+++ /dev/null
Binary files differ
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/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index ab6ae35ace..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
@@ -247,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 {
@@ -321,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) {
@@ -350,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");
@@ -423,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));
@@ -522,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();
@@ -535,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);
}
}
@@ -585,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(
@@ -636,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);
}
}
@@ -1496,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 abd7ed5a8e..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);
@@ -462,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 3a88377a51..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
@@ -412,4 +412,4 @@ public class BBInputSetupUtils {
return Optional.of(volumeGroup);
}
}
-}
+} \ 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 daa63044e4..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
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 db0f408010..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
@@ -773,4 +773,4 @@ public class BBInputSetupUtilsTest {
assertEquals(actualVolumeGroup, Optional.empty());
}
-}
+} \ No newline at end of file
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/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 3d18810e48..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
@@ -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="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(&#34;gBuildingBlockExecution&#34;)))}">
- <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(&#34;gBuildingBlockExecution&#34;)))}">
+ <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(&#34;gBuildingBlockExecution&#34;)))}">
- <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(&#34;gBuildingBlockExecution&#34;)))}">
+ <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 755bfe8126..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
@@ -24,6 +24,7 @@
<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 &#39;vf-module&#39; relationship exists" camunda:expression="${UnassignNetworkBB.checkRelationshipRelatedTo(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;vf-module&#34;)}">
- <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(&#34;gBuildingBlockExecution&#34;)))}">
- <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(&#34;gBuildingBlockExecution&#34;)))}">
<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 70b9d0633b..ab0ac25a99 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -234,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>
diff --git a/bpmn/so-bpmn-infrastructure-common/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-common/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/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index 8557cf178e..1a3a64bcc8 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -211,7 +211,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>
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/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/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 5f922e0c99..1d87b70754 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
@@ -187,7 +187,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());
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/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/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/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/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
index 9c51ee8006..1bb59e7b8d 100644
--- 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
@@ -129,6 +129,76 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
}
@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
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/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/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/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/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/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/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index e259839d6e..b241a5136e 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
@@ -845,8 +845,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 +870,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/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/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 1ab66561b0..ef318513fc 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,1364 @@ 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"));
+
+
- //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));
- }
+ 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 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));
+ }
} \ No newline at end of file
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/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..e6d02c6836 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,111 @@
* ============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 +158,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 +194,7 @@ public class CloudIdentity {
this.memberRole = role;
}
- public Boolean hasTenantMetadata () {
+ public Boolean getTenantMetadata() {
return tenantMetadata;
}
@@ -172,7 +247,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 +264,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 +272,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/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
index f38403d0cd..53c97fbce6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.cloud;
+package org.onap.so.db.catalog.beans;
-import java.util.Comparator;
+import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.openpojo.business.annotation.BusinessKey;
@@ -30,62 +30,110 @@ 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;
+
/**
- * JavaBean JSON class for a CloudSite. This bean represents a cloud location
+ * 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 (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.
+ * 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("identity_service_id")
- @BusinessKey
- private String identityServiceId;
+
@JsonProperty("aic_version")
@BusinessKey
- private String aicVersion;
+ @Column(name = "CLOUD_VERSION")
+ private String cloudVersion;
+
@JsonProperty("clli")
@BusinessKey
+ @Column(name = "CLLI")
private String clli;
- @JsonProperty("cloudify_id")
- @BusinessKey
- private String cloudifyId;
+
@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;
- // Derived property (set by CloudConfig loader based on cloudifyId)
- private CloudifyManager cloudifyManager;
+
+ @BusinessKey
+ @JsonProperty("identity_service_id")
+ transient private 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.aicVersion = site.getAicVersion();
+ this.cloudVersion = site.getCloudVersion();
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();
+ this.regionId = site.getRegionId();
+ this.identityServiceId = site.getIdentityServiceId();
}
public String getId() {
return this.id;
@@ -104,18 +152,15 @@ public class CloudSite {
}
public String getIdentityServiceId() {
- return identityServiceId;
+ return identityServiceId == null ? (identityService== null? null:identityService.getId()):identityServiceId;
}
- public void setIdentityServiceId(String identityServiceId) {
- this.identityServiceId = identityServiceId;
- }
- public String getAicVersion() {
- return aicVersion;
+ public String getCloudVersion() {
+ return cloudVersion;
}
- public void setAicVersion(String aicVersion) {
- this.aicVersion = aicVersion;
+ public void setCloudVersion(String cloudVersion) {
+ this.cloudVersion = cloudVersion;
}
public String getClli() {
@@ -130,10 +175,34 @@ public class CloudSite {
return cloudifyId;
}
- public void setCloudifyId (String id) {
- this.cloudifyId = id;
+ 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;
}
@@ -157,19 +226,15 @@ public class CloudSite {
public void setIdentityService (CloudIdentity identity) {
this.identityService = identity;
}
-
- public CloudifyManager getCloudifyManager () {
- return cloudifyManager;
- }
-
- public void setCloudifyManager (CloudifyManager cloudify) {
- this.cloudifyManager = cloudify;
+ @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("aicVersion", getAicVersion())
+ .append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion())
.append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform())
.append("orchestrator", getOrchestrator()).toString();
}
@@ -185,12 +250,12 @@ public class CloudSite {
CloudSite castOther = (CloudSite) other;
return new EqualsBuilder().append(getRegionId(), castOther.getRegionId())
.append(getIdentityServiceId(), castOther.getIdentityServiceId())
- .append(getAicVersion(), castOther.getAicVersion()).append(getClli(), castOther.getClli()).isEquals();
+ .append(getCloudVersion(), castOther.getCloudVersion()).append(getClli(), castOther.getClli()).isEquals();
}
@Override
public int hashCode() {
- return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getAicVersion())
+ 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 edfaba0fb2..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
@@ -32,18 +32,17 @@ 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;
@@ -100,8 +99,14 @@ public class CatalogDbClient {
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;
@@ -116,21 +121,14 @@ public class CatalogDbClient {
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);
@@ -146,6 +144,9 @@ 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);
}
@@ -303,6 +304,24 @@ public class CatalogDbClient {
return collectionNetworkResourceCustomizationClient.get(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);
}
@@ -327,6 +346,18 @@ public class CatalogDbClient {
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(findByModelVersionAndModelInvariantUUIDURI)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java
new file mode 100644
index 0000000000..c1714821ee
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java
@@ -0,0 +1,10 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "cloudIdentity", path = "cloudIdentity")
+public interface CloudIdentityRepository extends JpaRepository<CloudIdentity, String> {
+
+}
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/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/CloudIdentityRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.java
new file mode 100644
index 0000000000..8fb65c2080
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.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.CloudIdentity;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class CloudIdentityRepositoryTest extends BaseTest {
+
+ @Autowired
+ private CloudIdentityRepository cloudIdentityRepository;
+
+ @Test
+ public void findOneTest() throws Exception {
+ CloudIdentity cloudIdentity = cloudIdentityRepository.findOne("mtn13");
+ Assert.assertNotNull(cloudIdentity);
+ Assert.assertEquals("mtn13",cloudIdentity.getId());
+ }
+
+} \ No newline at end of file
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/pom.xml b/pom.xml
index 32733b1ff3..beb42242b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +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.1.12</cxf.version>
+ <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>