aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java30
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java83
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java99
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java15
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java121
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java38
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java165
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java86
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java37
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java107
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml35
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/application.yaml15
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql11
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql3
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java74
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java67
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java155
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java387
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json53
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml79
39 files changed, 1503 insertions, 281 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
index 469a7ad7e4..354c3d07f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,35 +67,35 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
public void migrate(Connection connection) throws Exception {
logger.debug("Starting migration for CloudConfig");
- CloudConfig cloudConfig = null;
+ CloudConfig cloudConfiguration = null;
// Try the override file
String configLocation = System.getProperty("spring.config.additional-location");
if (configLocation != null) {
try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
} catch (Exception e) {
logger.warn("Error Loading override.yaml", e);
}
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", configLocation);
// Try the application.yaml file
try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", getApplicationYamlName());
}
}
- if (cloudConfig != null) {
- migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
- migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
- migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
+ if (cloudConfiguration != null) {
+ migrateCloudIdentity(cloudConfiguration.getIdentityServices().values(), connection);
+ migrateCloudSite(cloudConfiguration.getCloudSites().values(), connection);
+ migrateCloudifyManagers(cloudConfiguration.getCloudifyManagers().values(), connection);
}
}
@@ -110,13 +110,13 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
R__CloudConfigMigration cloudConfigMigration = mapper.readValue(stream, R__CloudConfigMigration.class);
- CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+ CloudConfig cloudConfiguration = cloudConfigMigration.getCloudConfig();
- if (cloudConfig != null) {
- cloudConfig.populateId();
+ if (cloudConfiguration != null) {
+ cloudConfiguration.populateId();
}
- return cloudConfig;
+ return cloudConfiguration;
}
private String getApplicationYamlName() {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
index a0a0756d3d..aa19aed515 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
@@ -24,12 +24,14 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client",
"org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client",
- "org.onap.so.configuration"})
+ "org.onap.so.configuration", "org.onap.so.db"})
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
@EntityScan("org.onap.so.db.catalog.beans")
+@EnableScheduling
public class CatalogDBApplication {
private static final String LOGS_DIR = "logs_dir";
@@ -42,6 +44,7 @@ public class CatalogDBApplication {
public static void main(String[] args) {
SpringApplication.run(CatalogDBApplication.class, args);
+ java.security.Security.setProperty("networkaddress.cache.ttl", "10");
System.getProperties().setProperty("mso.db", "MARIADB");
System.getProperties().setProperty("server.name", "Springboot");
setLogsDir();
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java
new file mode 100644
index 0000000000..f7faa1f709
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"})
+@Profile({"!test"})
+public class CatalogDBConfig {
+
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig catalogDbConfig() {
+ return new HikariConfig();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ public DataSource dataSource() {
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("dataSource");
+ }
+ HikariConfig hikariConfig = this.catalogDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index db73d4afec..b43447f5c4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -24,6 +24,8 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
+import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl;
+import org.onap.so.adapters.catalogdb.rest.VnfRestImpl;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.context.annotation.Configuration;
import io.swagger.jaxrs.config.BeanConfig;
@@ -40,12 +42,13 @@ public class JerseyConfiguration extends ResourceConfig {
register(ApiListingResource.class);
register(SwaggerSerializers.class);
register(JaxRsFilterLogging.class);
+ register(ServiceRestImpl.class);
+ register(VnfRestImpl.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[] {"http"});
- beanConfig.setHost("localhost:8080");
+ beanConfig.setSchemes(new String[] {"https"});
beanConfig.setBasePath("/ecomp/mso/catalog");
- beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb");
+ beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb.rest");
beanConfig.setPrettyPrint(true);
beanConfig.setScan(true);
}
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 e550394931..c1acc319f7 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
@@ -104,7 +104,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
first = false;
- boolean arNull = o.getAllottedResource() == null ? true : false;
+ boolean arNull = o.getAllottedResource() == null;
put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName());
put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java
new file mode 100644
index 0000000000..ed2526f400
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ *
+ * Copyright (C) 2019 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "groups")
+public class QueryGroups extends CatalogQuery {
+
+ private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
+ private static final String TEMPLATE = "\n" + "\t{ \"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : <MODEL_NAME>,\n" + "\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\"modelVersion\" : <MODEL_VERSION>\n" + "\t\t},\n" + "<_VNFCS_>\n" + "\t}";
+
+ public QueryGroups() {
+ super();
+ vnfcInstanceGroupCustomizations = new ArrayList<>();
+
+ }
+
+ public QueryGroups(List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
+ this.vnfcInstanceGroupCustomizations = new ArrayList<>();
+ if (vnfcInstanceGroupCustomizations != null) {
+ for (VnfcInstanceGroupCustomization g : vnfcInstanceGroupCustomizations) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(g.toString());
+ }
+ this.vnfcInstanceGroupCustomizations.add(g);
+ }
+ }
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"groups\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfcInstanceGroupCustomization o : vnfcInstanceGroupCustomizations) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ boolean vnfcCustomizationNull = o.getVnfcCustomizations() == null;
+ InstanceGroup instanceGroup = o.getInstanceGroup();
+
+ if (instanceGroup != null) {
+ put(valueMap, "MODEL_NAME", instanceGroup.getModelName());
+ put(valueMap, "MODEL_UUID", instanceGroup.getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", instanceGroup.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", instanceGroup.getModelVersion());
+ }
+
+ String subItem = new QueryVnfcs(vnfcCustomizationNull ? null : o.getVnfcCustomizations()).JSON2(true, true);
+ valueMap.put("_VNFCS_", subItem.replaceAll("(?m)^", "\t\t"));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ 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/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 96ea797631..5573b23a8d 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
@@ -104,7 +104,7 @@ public class QueryServiceNetworks extends CatalogQuery {
if (first)
sb.append("\n");
first = false;
- boolean nrNull = o.getNetworkResource() == null ? true : false;
+ boolean nrNull = o.getNetworkResource() == null;
put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID());
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 b1bdeda445..0b8de60a81 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
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +29,7 @@ import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +48,8 @@ public class QueryServiceVnfs extends CatalogQuery {
+ "\t\"nfFunction\" : <NF_FUNCTION>,\n" + "\t\"nfType\" : <NF_TYPE>,\n"
+ "\t\"nfRole\" : <NF_ROLE>,\n" + "\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"
+ "\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"
- + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>\n" + "\t}";
+ + "\t\"vnfcInstGroupOrder\" : <VNFC_INSTANCE_GROUP_ORDER>,\n"
+ + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>,\n" + "<_GROUPS_>\n" + "\t}";
public QueryServiceVnfs() {
super();
@@ -101,7 +105,7 @@ public class QueryServiceVnfs extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vrNull = o.getVnfResources() == null ? true : false;
+ boolean vrNull = o.getVnfResources() == null;
put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName());
put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID());
@@ -114,12 +118,19 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_TYPE", o.getNfType());
put(valueMap, "NF_ROLE", o.getNfRole());
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
+ put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations =
+ o.getVnfcInstanceGroupCustomizations();
+
+ String grpSubItem = new QueryGroups(vrNull ? null : vnfcInstanceGroupCustomizations).JSON2(true, true);
+ valueMap.put("_GROUPS_", grpSubItem.replaceAll("(?m)^", "\t\t"));
+
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
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 1dec9cecae..1604e99a72 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
@@ -97,7 +97,7 @@ public class QueryVfModule extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vfNull = o.getVfModule() == null ? true : false;
+ boolean vfNull = o.getVfModule() == null;
boolean hasVolumeGroup = false;
HeatEnvironment envt = o.getVolumeHeatEnv();
if (envt != null) {
@@ -109,10 +109,10 @@ public class QueryVfModule extends CatalogQuery {
put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID());
put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion());
put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false);
+ put(valueMap, "IS_BASE", !vfNull && (o.getVfModule().getIsBase()));
put(valueMap, "VF_MODULE_LABEL", o.getLabel());
put(valueMap, "INITIAL_COUNT", o.getInitialCount());
- put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
+ put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup);
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
new file mode 100644
index 0000000000..dc73fe904d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "vnfcs")
+public class QueryVnfcs extends CatalogQuery {
+ private List<VnfcCustomization> vnfcCustomizations;
+ private static final String TEMPLATE =
+ "\t{\n" + "\t\t\"modelInfo\" : { \n" + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n" + "\t\t},\n"
+ + "\t\t\"resourceInput\" : <RESOURCE_INPUT>\n" + "\t}";
+
+ public QueryVnfcs() {
+ super();
+ vnfcCustomizations = new ArrayList();
+ }
+
+ public QueryVnfcs(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = new ArrayList();
+ if (vnfcCustomizations != null) {
+ for (VnfcCustomization vnfcCustomization : vnfcCustomizations) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(vnfcCustomization.toString());
+ }
+ this.vnfcCustomizations.add(vnfcCustomization);
+ }
+ }
+ }
+
+ public List<VnfcCustomization> getVnfcCustomizations() {
+ return vnfcCustomizations;
+ }
+
+ public void setVnfcCustomizations(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = vnfcCustomizations;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (VnfcCustomization o : vnfcCustomizations) {
+ sb.append(i).append("\t");
+ if (!first) {
+ sb.append("\n");
+ }
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray) {
+ sb.append("{");
+ }
+
+ if (isArray) {
+ sb.append("\"vnfcs\": [");
+ }
+
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfcCustomization o : vnfcCustomizations) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ put(valueMap, "MODEL_NAME", o.getModelName());
+ put(valueMap, "MODEL_UUID", o.getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", o.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", o.getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ 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 6cc53e6ec9..f2e0762a79 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
@@ -48,6 +48,7 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Recipe;
@@ -55,11 +56,13 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
@@ -120,6 +123,9 @@ public class CatalogDbAdapterRest {
@Autowired
private AllottedResourceRepository arResourceRepo;
+ @Autowired
+ private InstanceGroupRepository instanceGroupRepository;
+
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
@@ -279,6 +285,7 @@ public class CatalogDbAdapterRest {
@QueryParam("serviceModelUuid") String modelUUID,
@QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
@QueryParam("serviceModelVersion") String modelVersion) {
+
QueryServiceMacroHolder qryResp;
int respStatus = HttpStatus.SC_OK;
String uuid = "";
@@ -535,6 +542,16 @@ public class CatalogDbAdapterRest {
arResource.getModelVersion());
}
}
+
+ if (null == recipe) {
+ InstanceGroup grpResource = instanceGroupRepository.findByModelUUID(rmUuid);
+ if (grpResource != null) {
+ recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr(
+ grpResource.getModelName(), action, grpResource.getModelVersion());
+ }
+
+ }
+
if (recipe != null) {
QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
entity = resourceRecipe.JSON2(false, false);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java
new file mode 100644
index 0000000000..f8a7ba6da4
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java
@@ -0,0 +1,14 @@
+package org.onap.so.adapters.catalogdb.rest;
+
+public class CatalogEntityNotFoundException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -300157844846680791L;
+
+ public CatalogEntityNotFoundException(String errorMessage) {
+ super(errorMessage);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java
new file mode 100644
index 0000000000..c42eaabea7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class CatalogEntityNotFoundExceptionMapper implements ExceptionMapper<CatalogEntityNotFoundException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(CatalogEntityNotFoundExceptionMapper.class);
+
+ @Override
+ public Response toResponse(CatalogEntityNotFoundException e) {
+ return Response.status(Response.Status.NOT_FOUND).entity(e).build();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
new file mode 100644
index 0000000000..e74663dbba
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Cvnfc;
+import org.onap.so.rest.catalog.beans.Service;
+import org.onap.so.rest.catalog.beans.VfModule;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class ServiceMapper {
+ private static final Logger logger = LoggerFactory.getLogger(ServiceMapper.class);
+
+ public Service mapService(org.onap.so.db.catalog.beans.Service service, int depth) {
+ Service restService = new Service();
+ if (service.getCategory() != null) {
+ restService.setCategory(service.getCategory());
+ }
+ restService.setCreated(service.getCreated());
+ restService.setDescription(service.getDescription());
+
+ if (service.getDistrobutionStatus() != null) {
+ restService.setDistrobutionStatus(service.getDistrobutionStatus());
+ }
+ restService.setEnvironmentContext(service.getEnvironmentContext());
+ restService.setModelInvariantId(service.getModelInvariantUUID());
+ restService.setModelName(service.getModelName());
+ restService.setModelVersionId(service.getModelUUID());
+ restService.setModelVersion(service.getModelVersion());
+ if (service.getServiceRole() != null) {
+ restService.setServiceRole(service.getServiceRole());
+ }
+ restService.setServiceType(service.getServiceType());
+ restService.setWorkloadContext(service.getWorkloadContext());
+ if (depth > 0)
+ restService.setVnf(mapVnfs(service, depth));
+ return restService;
+ }
+
+ private List<Vnf> mapVnfs(org.onap.so.db.catalog.beans.Service service, int depth) {
+ List<Vnf> vnfs = new ArrayList<>();
+ logger.info("Vnf Count : {}", service.getVnfCustomizations().size());
+ service.getVnfCustomizations().parallelStream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
+ return vnfs;
+ }
+
+ protected Vnf mapVnf(org.onap.so.db.catalog.beans.VnfResourceCustomization vnfResourceCustomization, int depth) {
+ Vnf vnf = new Vnf();
+ vnf.setAvailabilityZoneMaxCount(vnfResourceCustomization.getAvailabilityZoneMaxCount());
+ vnf.setCategory(vnfResourceCustomization.getVnfResources().getCategory());
+ vnf.setCloudVersionMax(vnfResourceCustomization.getVnfResources().getAicVersionMax());
+ vnf.setCloudVersionMin(vnfResourceCustomization.getVnfResources().getAicVersionMin());
+ vnf.setMaxInstances(vnfResourceCustomization.getMaxInstances());
+ vnf.setMinInstances(vnfResourceCustomization.getMinInstances());
+ vnf.setModelCustomizationId(vnfResourceCustomization.getModelCustomizationUUID());
+ vnf.setModelInstanceName(vnfResourceCustomization.getModelInstanceName());
+ vnf.setModelInvariantId(vnfResourceCustomization.getVnfResources().getModelInvariantId());
+ vnf.setModelName(vnfResourceCustomization.getVnfResources().getModelName());
+ vnf.setModelVersionId(vnfResourceCustomization.getVnfResources().getModelUUID());
+ vnf.setModelVersion(vnfResourceCustomization.getVnfResources().getModelVersion());
+ vnf.setMultiStageDesign(vnfResourceCustomization.getMultiStageDesign());
+ vnf.setNfFunction(vnfResourceCustomization.getNfFunction());
+ vnf.setNfNamingCode(vnfResourceCustomization.getNfNamingCode());
+ vnf.setNfRole(vnfResourceCustomization.getNfRole());
+ vnf.setNfType(vnfResourceCustomization.getNfType());
+ vnf.setNfDataValid(vnfResourceCustomization.getNfDataValid());
+ vnf.setOrchestrationMode(vnfResourceCustomization.getVnfResources().getOrchestrationMode());
+ vnf.setSubCategory(vnfResourceCustomization.getVnfResources().getSubCategory());
+ vnf.setToscaNodeType(vnfResourceCustomization.getVnfResources().getToscaNodeType());
+
+ if (depth > 1) {
+ vnf.setVfModule(mapVfModules(vnfResourceCustomization, depth));
+ }
+ return vnf;
+ }
+
+ private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
+ List<VfModule> vfModules = new ArrayList<>();
+ vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
+ .forEach(vfModule -> vfModules.add(mapVfModule(vfModule, depth)));
+ return vfModules;
+ }
+
+ private VfModule mapVfModule(VfModuleCustomization vfModuleCust, int depth) {
+ VfModule vfModule = new VfModule();
+ vfModule.setAvailabilityZoneCount(vfModuleCust.getAvailabilityZoneCount());
+ vfModule.setCreated(vfModuleCust.getCreated());
+ vfModule.setDescription(vfModuleCust.getVfModule().getDescription());
+ vfModule.setInitialCount(vfModuleCust.getInitialCount());
+ vfModule.setIsBase(vfModuleCust.getVfModule().getIsBase());
+ vfModule.setIsVolumeGroup(getIsVolumeGroup(vfModuleCust));
+ vfModule.setMaxInstances(vfModuleCust.getMaxInstances());
+ vfModule.setMinInstances(vfModuleCust.getMinInstances());
+ vfModule.setLabel(vfModuleCust.getLabel());
+ vfModule.setModelCustomizationId(vfModuleCust.getModelCustomizationUUID());
+ vfModule.setModelInvariantId(vfModuleCust.getVfModule().getModelInvariantUUID());
+ vfModule.setModelName(vfModuleCust.getVfModule().getModelName());
+ vfModule.setModelVersionId(vfModuleCust.getVfModule().getModelUUID());
+ vfModule.setModelVersion(vfModuleCust.getVfModule().getModelVersion());
+ if (depth > 3) {
+ vfModule.setVnfc(mapCvnfcs(vfModuleCust));
+ }
+ return vfModule;
+ }
+
+ private List<Cvnfc> mapCvnfcs(VfModuleCustomization vfModuleCustomization) {
+ List<Cvnfc> cvnfcs = new ArrayList<>();
+ vfModuleCustomization.getCvnfcCustomization().parallelStream()
+ .forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
+ return cvnfcs;
+ }
+
+ private Cvnfc mapCvnfcCus(CvnfcCustomization cvnfcCust) {
+ Cvnfc cvnfc = new Cvnfc();
+ cvnfc.setCreated(cvnfcCust.getCreated());
+ cvnfc.setDescription(cvnfcCust.getDescription());
+ cvnfc.setModelCustomizationId(cvnfcCust.getModelCustomizationUUID());
+ cvnfc.setModelInstanceName(cvnfcCust.getModelInstanceName());
+ cvnfc.setModelInvariantId(cvnfcCust.getModelInvariantUUID());
+ cvnfc.setModelName(cvnfcCust.getModelName());
+ cvnfc.setModelVersion(cvnfcCust.getModelVersion());
+ cvnfc.setModelVersionId(cvnfcCust.getModelUUID());
+ cvnfc.setNfcFunction(cvnfcCust.getNfcFunction());
+ cvnfc.setNfcNamingCode(cvnfcCust.getNfcNamingCode());
+ return cvnfc;
+ }
+
+ private boolean getIsVolumeGroup(VfModuleCustomization vfModuleCust) {
+ boolean isVolumeGroup = false;
+ HeatEnvironment envt = vfModuleCust.getVolumeHeatEnv();
+ if (envt != null) {
+ isVolumeGroup = true;
+ }
+ return isVolumeGroup;
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
new file mode 100644
index 0000000000..6f556edfa1
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.rest.catalog.beans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.google.common.base.Strings;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+@Api(value = "/v1", tags = "model")
+@Path("/v1/services")
+@Component
+public class ServiceRestImpl {
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceMapper serviceMapper;
+
+
+ @GET
+ @Path("/{modelUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Service findService(@PathParam("modelUUID") String modelUUID, @QueryParam("depth") int depth) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(modelUUID);
+ if (service == null) {
+ new CatalogEntityNotFoundException("Unable to find Service " + modelUUID);
+ }
+ return serviceMapper.mapService(service, depth);
+ }
+
+ @GET
+ @ApiOperation(value = "Find Service Models", response = Service.class, responseContainer = "List")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public List<Service> queryServices(
+ @ApiParam(value = "modelName", required = false) @QueryParam("modelName") String modelName,
+ @ApiParam(value = "distributionStatus",
+ required = false) @QueryParam("distributionStatus") String distributionStatus,
+ @ApiParam(value = "depth", required = false) @QueryParam("depth") int depth) {
+ List<Service> services = new ArrayList<>();
+ List<org.onap.so.db.catalog.beans.Service> serviceFromDB = new ArrayList<>();
+ if (!Strings.isNullOrEmpty(modelName) && !Strings.isNullOrEmpty(distributionStatus)) {
+ serviceFromDB = serviceRepo.findByModelNameAndDistrobutionStatus(modelName, distributionStatus);
+ } else if (!Strings.isNullOrEmpty(modelName)) {
+ serviceFromDB = serviceRepo.findByModelName(modelName);
+ } else {
+ serviceFromDB = serviceRepo.findAll();
+ }
+ serviceFromDB.stream().forEach(serviceDB -> services.add(serviceMapper.mapService(serviceDB, depth)));
+ return services;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java
new file mode 100644
index 0000000000..52a8ccb5a7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java
@@ -0,0 +1,37 @@
+package org.onap.so.adapters.catalogdb.rest;
+
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
+
+@Component
+public class VnfMapper {
+
+ public VnfResourceCustomization mapVnf(VnfResourceCustomization vnfCust, Vnf vnf) {
+
+ vnfCust.setAvailabilityZoneMaxCount(vnf.getAvailabilityZoneMaxCount());
+ vnfCust.setMaxInstances(vnf.getMaxInstances());
+ vnfCust.setMinInstances(vnf.getMinInstances());
+ vnfCust.setModelCustomizationUUID(vnf.getModelCustomizationId());
+ vnfCust.setModelInstanceName(vnf.getModelInstanceName());
+ vnfCust.setMultiStageDesign(vnf.getMultiStageDesign());
+ vnfCust.setNfDataValid(vnf.getNfDataValid());
+ vnfCust.setNfFunction(Strings.nullToEmpty(vnf.getNfFunction()));
+ vnfCust.setNfNamingCode(Strings.nullToEmpty(vnf.getNfNamingCode()));
+ vnfCust.setNfRole(Strings.nullToEmpty(vnf.getNfRole()));
+ vnfCust.setNfType(Strings.nullToEmpty(vnf.getNfType()));
+
+ VnfResource vnfRes = vnfCust.getVnfResources();
+ vnfRes.setOrchestrationMode(Strings.nullToEmpty(vnfRes.getOrchestrationMode()));
+ vnfRes.setSubCategory(Strings.nullToEmpty(vnfRes.getSubCategory()));
+ vnfRes.setToscaNodeType(Strings.nullToEmpty(vnfRes.getToscaNodeType()));
+ vnfRes.setModelInvariantUUID(vnfRes.getModelInvariantId());
+ vnfRes.setModelName(vnfRes.getModelName());
+ vnfRes.setModelUUID(vnfRes.getModelUUID());
+ vnfRes.setModelVersion(vnfRes.getModelVersion());
+ return vnfCust;
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
new file mode 100644
index 0000000000..4353526872
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Api(value = "/v1/services/{modelUUID}/vnfs", tags = "model")
+@Path("/v1/services/{modelUUID}/vnfs")
+@Component
+public class VnfRestImpl {
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceMapper serviceMapper;
+
+ @Autowired
+ private VnfMapper vnfMapper;
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustRepo;
+
+ @GET
+ @ApiOperation(value = "Find a VNF model contained within a service", response = Vnf.class)
+ @Path("/{modelCustomizationUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Vnf findService(@PathParam("modelUUID") String serviceModelUUID,
+ @PathParam("modelCustomizationUUID") String modelCustomizationUUID, @QueryParam("depth") int depth) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(serviceModelUUID);
+ if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
+ throw new WebApplicationException("Vnf Not Found", 404);
+ }
+ List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
+ .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
+ .collect(Collectors.toList());
+ if (vnfCustom.isEmpty() || vnfCustom == null) {
+ return null;
+ } else if (vnfCustom.size() > 1) {
+ throw new RuntimeException(
+ "More than one Vnf model returned with model Customization UUID: " + modelCustomizationUUID);
+ }
+ return serviceMapper.mapVnf(vnfCustom.get(0), depth);
+ }
+
+ @PUT
+ @ApiOperation(value = "Update a VNF model contained within a service", response = Vnf.class)
+ @Path("/{modelCustomizationUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional
+ public Response findService(@PathParam("modelUUID") String serviceModelUUID,
+ @PathParam("modelCustomizationUUID") String modelCustomizationUUID, Vnf vnf) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(serviceModelUUID);
+ List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
+ .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
+ .collect(Collectors.toList());
+ if (vnfCustom.isEmpty() || vnfCustom == null) {
+ throw new RuntimeException("No Vnf Found");
+ } else if (vnfCustom.size() > 1) {
+ throw new RuntimeException(
+ "More than one Vnf model returned with model Customization UUID: " + modelCustomizationUUID);
+ }
+ VnfResourceCustomization vnfCust = vnfMapper.mapVnf(vnfCustom.get(0), vnf);
+ vnfCustRepo.save(vnfCust);
+ return Response.ok().build();
+ }
+
+}
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml
deleted file mode 100644
index d7c13eaa14..0000000000
--- a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-catalog:
- db:
- endpoint: http://localhost:8090
-
-ssl-enable: false
-mso:
- site-name: localDevEnv
- logPath: logs
- catalog:
- db:
- spring:
- endpoint: http://localhost:8090
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
-spring:
- security:
- usercredentials:
- -
- username: test
- password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
- role: BPEL-Client
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
-server:
- port: 8090
-
-
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
index b1528a0897..1487cb21b2 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
@@ -16,11 +16,14 @@ mso:
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
- initialization-mode: never
+ hikari:
+ jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: catdb-pool
+ registerMbeans: true
+
flyway:
baseline-on-migrate: false
url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
@@ -38,6 +41,8 @@ spring:
jackson:
serialization:
fail-on-empty-beans: false
+ main:
+ allow-bean-definition-overriding: true
#Actuator
management:
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql
new file mode 100644
index 0000000000..4a9c2cce9f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql
@@ -0,0 +1,11 @@
+
+UPDATE catalogdb.service serv SET OVERALL_DISTRIBUTION_STATUS =(
+SELECT wds.DISTRIBUTION_ID_STATUS
+FROM requestdb.watchdog_distributionid_status wds
+INNER JOIN requestdb.watchdog_service_mod_ver_id_lookup wdlook
+ON wds.DISTRIBUTION_ID = wdlook.DISTRIBUTION_ID
+WHERE wdlook.SERVICE_MODEL_VERSION_ID = serv.MODEL_UUID
+ORDER BY wdlook.MODIFY_TIME DESC LIMIT 1);
+
+UPDATE catalogdb.service SET OVERALL_DISTRIBUTION_STATUS = 'DISTRIBUTION_COMPLETE_OK'
+WHERE service.OVERALL_DISTRIBUTION_STATUS = NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index eec8a82cc9..13d736e747 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -188,8 +188,8 @@ VALUES
('VnfAdapterBB', '*', '*', '*', '*' , 'Retry'),
('AAICheckVnfInMaintBB', '*', '*', '*', '*' , 'Abort'),
('AAISetVnfInMaintBB', '*', '*', '*', '*' , 'Abort'),
-('AAIUnsetVnfInMaintBB', '*', '*', '*', '*' , 'Abort');
-
+('AAIUnsetVnfInMaintBB', '*', '*', '*', '*' , 'Abort'),
+('ConfigDeployVnfBB', '*', '*', '*', '*' , 'Retry');
INSERT INTO building_block_detail (building_block_name, resource_type, target_action)
@@ -811,3 +811,7 @@ INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACT
VALUES
('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'),
('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
+
+UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
+
+UPDATE rainy_day_handler_macro SET SERVICE_ROLE = '*' WHERE SERVICE_ROLE IS null;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
index 3f76334bd9..137f73cf65 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
@@ -201,5 +201,5 @@ VALUES
INSERT INTO `workflow` (`ARTIFACT_UUID`,`ARTIFACT_NAME`,`NAME`,`OPERATION_NAME`,`VERSION`,`DESCRIPTION`,`RESOURCE_TARGET`,`SOURCE`)
VALUES
('9d45cd30-1a89-4993-87c1-6dd09c1696cf','VFModule-ScaleOut','VNF Scale Out','ScaleOut',1.0,'native static workflow to support ScaleOut','vfModule','native'),
-('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VNF In Place Software Update','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'),
-('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VNF Config Update','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native'); \ No newline at end of file
+('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VnfInPlaceUpdate','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'),
+('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VnfConfigUpdate','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
new file mode 100644
index 0000000000..16e6ecf4bf
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
@@ -0,0 +1,7 @@
+use catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD VNFCINSTANCEGROUP_ORDER varchar(255);
+
+ALTER TABLE vnfc_customization
+ADD RESOURCE_INPUT varchar(2000); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql
new file mode 100644
index 0000000000..95a2c25eb8
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE vnfc_customization ADD vnfc_instance_group_customization_id INTEGER NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
index 5d940fb9ea..8e52fbeeaf 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
@@ -30,3 +30,8 @@ resources:
INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` )
VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','3.0');
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'network_name', 0, 'String', NULL);
+
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'shared', 0, 'Boolean', NULL);
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql
new file mode 100644
index 0000000000..ae416ffbfe
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql
@@ -0,0 +1 @@
+ALTER TABLE catalogdb.service ADD COLUMN IF NOT EXISTS OVERALL_DISTRIBUTION_STATUS varchar(45); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql
new file mode 100644
index 0000000000..cf54d55fde
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS REG_EX_ERROR_MESSAGE varchar(300) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql
new file mode 100644
index 0000000000..3c45507b81
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql
@@ -0,0 +1,8 @@
+USE catalogdb;
+
+ALTER TABLE service
+ADD IF NOT EXISTS ONAP_GENERATED_NAMING tinyint(1) DEFAULT NULL;
+
+ALTER TABLE service
+ADD IF NOT EXISTS NAMING_POLICY varchar(200) DEFAULT NULL;
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
new file mode 100644
index 0000000000..8fe3caf88f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS SERVICE_ROLE varchar(300) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql
new file mode 100644
index 0000000000..93dde1341e
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql
@@ -0,0 +1,5 @@
+USE catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD IF NOT EXISTS NF_DATA_VALID tinyint(1) DEFAULT 0;
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql
new file mode 100644
index 0000000000..6f61b830f2
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql
@@ -0,0 +1,3 @@
+USE catalogdb;
+
+ALTER TABLE controller_selection_reference MODIFY ACTION_CATEGORY VARCHAR(50) NOT NULL;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
index 3fb156d68a..499310748e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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;
import org.junit.Test;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java
new file mode 100644
index 0000000000..00db6d5938
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VFCInstanceGroup;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class QueryGroupsTest {
+
+ @Test
+ public void convertToJson_successful() {
+ QueryGroups queryGroups = new QueryGroups(createList());
+ String jsonResult = queryGroups.JSON2(true, false);
+
+ Assertions.assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.groups[0].modelInfo.modelName"))
+ .contains("test");
+ Assertions
+ .assertThat(
+ JsonPathUtil.getInstance().locateResult(jsonResult, "$.groups[0].vnfcs[0].modelInfo.modelName"))
+ .contains("test");
+ }
+
+ private List<VnfcInstanceGroupCustomization> createList() {
+
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("test");
+ vnfcCustomization.setModelVersion("test");
+ vnfcCustomization.setModelInvariantUUID("test");
+ vnfcCustomization.setModelName("test");
+
+ VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
+ vfcInstanceGroup.setModelName("test");
+ vfcInstanceGroup.setModelUUID("test");
+ vfcInstanceGroup.setModelInvariantUUID("test");
+ vfcInstanceGroup.setModelVersion("test");
+
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = new VnfcInstanceGroupCustomization();
+ vnfcInstanceGroupCustomization.setVnfcCustomizations(Arrays.asList(vnfcCustomization));
+ vnfcInstanceGroupCustomization.setInstanceGroup(vfcInstanceGroup);
+
+
+ vfcInstanceGroup.setVnfcInstanceGroupCustomizations(Arrays.asList(vnfcInstanceGroupCustomization));
+ return Arrays.asList(vnfcInstanceGroupCustomization);
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
new file mode 100644
index 0000000000..abc59352b0
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.List;
+
+public class QueryVnfcsTest {
+
+ @Test
+ public void convertToJson_successful() {
+ QueryVnfcs queryVnfcs = new QueryVnfcs(createList());
+ String jsonResult = queryVnfcs.JSON2(true, false);
+ System.out.println(jsonResult);
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vnfcs[0].modelInfo.modelName"))
+ .contains("model1");
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vnfcs[1].modelInfo.modelName"))
+ .contains("model2");
+
+ }
+
+ private List<VnfcCustomization> createList() {
+ List<VnfcCustomization> customizations = new ArrayList();
+
+ VnfcCustomization c1 = new VnfcCustomization();
+ c1.setModelName("model1");
+ c1.setModelUUID("uuid1");
+ c1.setModelInvariantUUID("inv1");
+ c1.setModelVersion("v1");
+ c1.setModelCustomizationUUID("cust1");
+ c1.setResourceInput("resourceInput1");
+
+ VnfcCustomization c2 = new VnfcCustomization();
+ c2.setModelName("model2");
+ c2.setModelUUID("uuid2");
+ c2.setModelInvariantUUID("inv2");
+ c2.setModelVersion("v2");
+ c2.setModelCustomizationUUID("cust2");
+ c2.setResourceInput("resourceInput2");
+
+ customizations.add(c1);
+ customizations.add(c2);
+ return customizations;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
new file mode 100644
index 0000000000..d46fd9c7ba
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.junit.Test;
+import org.onap.so.adapters.catalogdb.rest.ServiceMapper;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.rest.catalog.beans.Service;
+import wiremock.com.fasterxml.jackson.core.JsonParseException;
+import wiremock.com.fasterxml.jackson.databind.JsonMappingException;
+import wiremock.com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceMapperTest {
+
+ private ServiceMapper serviceMapper = new ServiceMapper();
+
+ @Test
+ public void service_map_test() throws JsonParseException, JsonMappingException, IOException {
+ Service actual = serviceMapper.mapService(getTestService(), 2);
+ assertThat(actual, sameBeanAs(getExpectedService()));
+ }
+
+ private Service getExpectedService() throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(getJson("ExpectedService.json"), Service.class);
+ }
+
+
+ private org.onap.so.db.catalog.beans.Service getTestService() {
+ org.onap.so.db.catalog.beans.Service testService = new org.onap.so.db.catalog.beans.Service();
+ testService.setCategory("category");
+ testService.setDescription("description");
+ testService.setDistrobutionStatus("distrobutionStatus");
+ testService.setEnvironmentContext("environmentContext");
+ testService.setModelInvariantUUID("modelInvariantUUID");
+ testService.setModelName("modelName");
+ testService.setModelUUID("modelUUID");
+ testService.setModelVersion("modelVersion");
+ testService.setServiceType("serviceType");
+ testService.setServiceRole("serviceRole");
+
+ testService.getVnfCustomizations().add(getTestVnfCustomization());
+ return testService;
+ }
+
+ private org.onap.so.db.catalog.beans.VnfResourceCustomization getTestVnfCustomization() {
+ org.onap.so.db.catalog.beans.VnfResourceCustomization test =
+ new org.onap.so.db.catalog.beans.VnfResourceCustomization();
+ test.setId(1);
+ test.setAvailabilityZoneMaxCount(11);
+ test.setMaxInstances(3);
+ test.setMinInstances(1);
+ test.setModelCustomizationUUID("modelCustomizationUUID");
+ test.setModelInstanceName("modelInstanceName");
+ test.setMultiStageDesign("multiStageDesign");
+ test.setNfFunction("nfFunction");
+ test.setNfNamingCode("nfNamingCode");
+ test.setNfRole("nfRole");
+ test.setNfType("nfType");
+ test.setService(new org.onap.so.db.catalog.beans.Service());
+ test.setVnfResources(getTestVnfResource());
+ test.setVfModuleCustomizations(getTestVfModuleCust());
+ return test;
+ }
+
+ private List<VfModuleCustomization> getTestVfModuleCust() {
+ List<VfModuleCustomization> test = new ArrayList<>();
+ VfModuleCustomization testVfMod = new VfModuleCustomization();
+ testVfMod.setAvailabilityZoneCount(10);
+ testVfMod.setInitialCount(1);
+ testVfMod.setLabel("label");
+ testVfMod.setMaxInstances(3);
+ testVfMod.setMinInstances(1);
+ testVfMod.setModelCustomizationUUID("modelCustomizationUUID");
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setDescription("description");
+ vfModule.setIsBase(false);
+ vfModule.setModelInvariantUUID("modelInvariantUUID");
+ vfModule.setModelName("modelName");
+ vfModule.setModelUUID("modelUUID");
+ vfModule.setModelVersion("modelVersion");
+ HeatTemplate moduleHeatTemplate = new HeatTemplate();
+ moduleHeatTemplate.setArtifactChecksum("artifactChecksum");
+ moduleHeatTemplate.setArtifactUuid("artifactUuid");
+ List<HeatTemplate> childTemplates;
+ // moduleHeatTemplate.setChildTemplates(childTemplates);
+ moduleHeatTemplate.setDescription("description");
+ Set<HeatTemplateParam> parameters = new HashSet<>();
+ HeatTemplateParam heatParam = new HeatTemplateParam();
+ heatParam.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid");
+ heatParam.setParamAlias("paramAlias");
+ heatParam.setParamName("paramName");
+ heatParam.setParamType("paramType");
+ heatParam.setRequired(false);
+ parameters.add(heatParam);
+ moduleHeatTemplate.setParameters(parameters);
+ moduleHeatTemplate.setTemplateBody("templateBody");
+ moduleHeatTemplate.setTemplateName("templateName");
+ moduleHeatTemplate.setTimeoutMinutes(1000);
+ moduleHeatTemplate.setVersion("version");
+ vfModule.setModuleHeatTemplate(moduleHeatTemplate);
+ testVfMod.setVfModule(vfModule);
+ test.add(testVfMod);
+ return test;
+ }
+
+ private org.onap.so.db.catalog.beans.VnfResource getTestVnfResource() {
+ org.onap.so.db.catalog.beans.VnfResource test = new org.onap.so.db.catalog.beans.VnfResource();
+ test.setCategory("category");
+ test.setDescription("description");
+ test.setModelInvariantUUID("modelInvariantUUID");
+ test.setModelName("modelName");
+ test.setModelUUID("modelUUID");
+ test.setModelVersion("modelVersion");
+ test.setAicVersionMax("cloudVersionMax");
+ test.setAicVersionMin("cloudVersionMin");
+ test.setOrchestrationMode("orchestrationMode");
+ test.setSubCategory("subCategory");
+ test.setToscaNodeType("toscaNodeType");
+ return test;
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index d8d9ee191a..f82c7acd38 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -22,15 +22,14 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.UUID;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -56,10 +55,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@@ -74,123 +70,130 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Autowired
CatalogDbClientPortChanger client;
+
+
@Before
public void initialize() {
client.wiremockPort = String.valueOf(port);
+ client.setEndpoint(getEndpoint(port));
+ }
+
+ protected String getEndpoint(int port) {
+ return "http://localhost:" + port;
}
@Test
- public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep() {
- RainyDayHandlerStatus rainyDayHandlerStatus =
- client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "*", "*", "*", "*");
- Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ public void testGetRainyDayHandler_Regex() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
+ "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found.", "*");
+ assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
- public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound() {
- RainyDayHandlerStatus rainyDayHandlerStatus =
- client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- UUID.randomUUID().toString(), "*", "*", "*", "*");
- Assert.assertNull(rainyDayHandlerStatus);
+ public void testGetRainyDayHandler__Encoding_Regex() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
+ "*", "*", "*",
+ "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found",
+ "*");
+ assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
public void testGetCloudSiteHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSite(MTN13);
- Assert.assertNotNull(cloudSite);
- Assert.assertNotNull(cloudSite.getIdentityService());
- Assert.assertEquals("MDT13", cloudSite.getClli());
- Assert.assertEquals("mtn13", cloudSite.getRegionId());
- Assert.assertEquals("MTN13", cloudSite.getIdentityServiceId());
+ assertNotNull(cloudSite);
+ assertNotNull(cloudSite.getIdentityService());
+ assertEquals("MDT13", cloudSite.getClli());
+ assertEquals("mtn13", cloudSite.getRegionId());
+ assertEquals("MTN13", cloudSite.getIdentityServiceId());
}
@Test
public void testGetCloudSiteNotFound() throws Exception {
CloudSite cloudSite = client.getCloudSite(UUID.randomUUID().toString());
- Assert.assertNull(cloudSite);
+ assertNull(cloudSite);
}
@Test
public void testGetCloudifyManagerHappyPath() throws Exception {
CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
- Assert.assertNotNull(cloudifyManager);
- Assert.assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
+ assertNotNull(cloudifyManager);
+ assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
}
@Test
public void testGetCloudifyManagerNotFound() throws Exception {
CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
- Assert.assertNull(cloudifyManager);
+ assertNull(cloudifyManager);
}
@Test
public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "2.5");
- Assert.assertNotNull(cloudSite);
+ assertNotNull(cloudSite);
}
@Test
public void testGetCloudSiteByClliAndAicVersionNotFound() throws Exception {
CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "232496239746328");
- Assert.assertNull(cloudSite);
+ assertNull(cloudSite);
}
@Test
public void testGetServiceByID() throws Exception {
Service serviceByID = client.getServiceByID("5df8b6de-2083-11e7-93ae-92361f002671");
- Assert.assertNotNull(serviceByID);
- Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
- Assert.assertEquals("NA", serviceByID.getServiceType());
- Assert.assertEquals("NA", serviceByID.getServiceRole());
+ assertNotNull(serviceByID);
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ assertEquals("NA", serviceByID.getServiceType());
+ assertEquals("NA", serviceByID.getServiceRole());
}
@Test
public void testGetServiceByIDNotFound() throws Exception {
Service serviceByID = client.getServiceByID(UUID.randomUUID().toString());
- Assert.assertNull(serviceByID);
+ assertNull(serviceByID);
}
@Test
public void testGetVfModuleByModelUUID() throws Exception {
VfModule vfModule = client.getVfModuleByModelUUID("20c4431c-246d-11e7-93ae-92361f002671");
- Assert.assertNotNull(vfModule);
- Assert.assertNotNull(vfModule.getVfModuleCustomization());
- Assert.assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
- Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ assertNotNull(vfModule);
+ assertNotNull(vfModule.getVfModuleCustomization());
+ assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
+ assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
}
@Test
public void testGetVfModuleByModelUUIDNotFound() throws Exception {
VfModule vfModule = client.getVfModuleByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(vfModule);
+ assertNull(vfModule);
}
@Test
public void testGetVnfResourceByModelUUID() throws Exception {
VnfResource vnfResource = client.getVnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
- Assert.assertNotNull(vnfResource);
- Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ assertNotNull(vnfResource);
+ assertEquals("vSAMP10a", vnfResource.getModelName());
}
@Test
public void testGetVnfResourceByModelUUIDNotFound() throws Exception {
VnfResource vnfResource = client.getVnfResourceByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(vnfResource);
+ assertNull(vnfResource);
}
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
VnfResourceCustomization vnfResourceCustomization =
client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
- Assert.assertNotNull(vnfResourceCustomization);
- Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
- Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
- Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
- Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
- Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
+ assertNotNull(vnfResourceCustomization);
+ assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
+ assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
+ assertNotNull(vnfResourceCustomization.getVnfResources());
+ assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
+ assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
assertTrue("skip post instantiation configuration", vnfResourceCustomization.isSkipPostInstConf());
}
@@ -198,15 +201,15 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
VnfResourceCustomization vnfResourceCustomization =
client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(vnfResourceCustomization);
+ assertNull(vnfResourceCustomization);
}
@Test
public void testGetInstanceGroupByModelUUID() {
InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b");
- Assert.assertNotNull(instanceGroup);
- Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
- Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
+ assertNotNull(instanceGroup);
+ assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
+ assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
instanceGroup.getToscaNodeType().toString());
}
@@ -214,33 +217,33 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
- Assert.assertNotNull(vfModuleCustomization);
- Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
- Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ assertNotNull(vfModuleCustomization);
+ assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ assertEquals("base", vfModuleCustomization.getLabel());
}
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(vfModuleCustomization);
+ assertNull(vfModuleCustomization);
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
NetworkResourceCustomization networkResourceCustomization =
client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
- Assert.assertNotNull(networkResourceCustomization);
- Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
- Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
- Assert.assertNotNull(networkResourceCustomization.getNetworkResource());
+ assertNotNull(networkResourceCustomization);
+ assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
+ assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
+ assertNotNull(networkResourceCustomization.getNetworkResource());
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
NetworkResourceCustomization networkResourceCustomization =
client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(networkResourceCustomization);
+ assertNull(networkResourceCustomization);
}
@Test
@@ -248,10 +251,10 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
"cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
- Assert.assertNotNull(vfModuleCustomization);
- Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
- Assert.assertNotNull(vfModuleCustomization.getVfModule());
- Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ assertNotNull(vfModuleCustomization);
+ assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ assertNotNull(vfModuleCustomization.getVfModule());
+ assertEquals("base", vfModuleCustomization.getLabel());
}
@Test
@@ -259,45 +262,43 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
"cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
- Assert.assertNull(vfModuleCustomization);
+ assertNull(vfModuleCustomization);
}
@Test
public void testGetFirstByServiceModelUUIDAndAction() {
ServiceRecipe serviceRecipe =
client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
- Assert.assertNotNull(serviceRecipe);
- Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
- Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
- Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ assertNotNull(serviceRecipe);
+ assertNotNull(serviceRecipe.getServiceModelUUID());
+ assertNotNull(serviceRecipe.getAction());
+ assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testGetFirstByServiceModelUUIDAndActionNotFound() {
ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671",
UUID.randomUUID().toString());
- Assert.assertNull(serviceRecipe);
+ assertNull(serviceRecipe);
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
VnfResource vnfResource = client
.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
- Assert.assertNotNull(vnfResource);
- Assert.assertNotNull(vnfResource.getModelInvariantId());
- Assert.assertNotNull(vnfResource.getModelVersion());
- Assert.assertNotNull(vnfResource.getHeatTemplates());
- Assert.assertNotNull(vnfResource.getVnfResourceCustomizations());
- Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ assertNotNull(vnfResource);
+ assertNotNull(vnfResource.getModelInvariantId());
+ assertNotNull(vnfResource.getModelVersion());
+ assertNotNull(vnfResource.getHeatTemplates());
+ assertEquals("vSAMP10a", vnfResource.getModelName());
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
"2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
- Assert.assertNull(vnfResource);
+ assertNull(vnfResource);
}
@Test
@@ -306,29 +307,28 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources =
client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
- Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
- Assert.assertEquals("vSAMP10a 1",
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
+ assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
+ assertEquals("vSAMP10a 1",
firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
- Assert.assertNotNull(
- firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
}
@Test
public void testGetFirstVnfRecipeByNfRoleAndAction() {
VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction("GR-API-DEFAULT", "createInstance");
- Assert.assertNotNull(vnfRecipe);
- Assert.assertNotNull(vnfRecipe.getNfRole());
- Assert.assertNotNull(vnfRecipe.getAction());
- Assert.assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
+ assertNotNull(vnfRecipe);
+ assertNotNull(vnfRecipe.getNfRole());
+ assertNotNull(vnfRecipe.getAction());
+ assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
+ assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
}
@Test
public void testGetFirstVnfRecipeByNfRoleAndActionNotFound() {
VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction(UUID.randomUUID().toString(), "createInstance");
- Assert.assertNull(vnfRecipe);
+ assertNull(vnfRecipe);
}
@Test
@@ -336,12 +336,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
"20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
- Assert.assertNotNull(vnfComponentsRecipe);
- Assert.assertNotNull(vnfComponentsRecipe.getAction());
- Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
- Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
- Assert.assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
+ assertNotNull(vnfComponentsRecipe);
+ assertNotNull(vnfComponentsRecipe.getAction());
+ assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
+ assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
+ assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
}
@@ -351,80 +351,79 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
UUID.randomUUID().toString(), "volumeGroup", "createInstance");
- Assert.assertNull(vnfComponentsRecipe);
+ assertNull(vnfComponentsRecipe);
}
@Test
public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
- Assert.assertNotNull(vnfComponentsRecipe);
- Assert.assertNotNull(vnfComponentsRecipe.getAction());
- Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
- Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1",
- vnfComponentsRecipe.getOrchestrationUri());
+ assertNotNull(vnfComponentsRecipe);
+ assertNotNull(vnfComponentsRecipe.getAction());
+ assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
+ assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUID() {
Service service =
client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUIDNotFound() {
Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", UUID.randomUUID().toString());
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
VfModule vfModule =
client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
- Assert.assertNotNull(vfModule);
- Assert.assertNotNull(vfModule.getModelVersion());
- Assert.assertNotNull(vfModule.getModelInvariantUUID());
- Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
- Assert.assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
+ assertNotNull(vfModule);
+ assertNotNull(vfModule.getModelVersion());
+ assertNotNull(vfModule.getModelInvariantUUID());
+ assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
}
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersionNotFound() {
VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2");
- Assert.assertNull(vfModule);
+ assertNull(vfModule);
}
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
List<Service> serviceList =
client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- Assert.assertFalse(serviceList.isEmpty());
- Assert.assertEquals(2, serviceList.size());
+ assertFalse(serviceList.isEmpty());
+ assertEquals(2, serviceList.size());
Service service = serviceList.get(0);
- Assert.assertEquals("2.0", service.getModelVersion());
+ assertEquals("2.0", service.getModelVersion());
}
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
List<Service> serviceList =
client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
- Assert.assertTrue(serviceList.isEmpty());
+ assertTrue(serviceList.isEmpty());
}
@Test
public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
List<VfModule> moduleList =
client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
- Assert.assertFalse(moduleList.isEmpty());
- Assert.assertEquals(2, moduleList.size());
+ assertFalse(moduleList.isEmpty());
+ assertEquals(2, moduleList.size());
VfModule module = moduleList.get(0);
- Assert.assertEquals("vSAMP10a DEV Base", module.getDescription());
+ assertEquals("vSAMP10a DEV Base", module.getDescription());
}
@Test
@@ -450,20 +449,20 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
cloudSite.setIdentityService(cloudIdentity);
localClient.postCloudSite(cloudSite);
CloudSite getCloudSite = this.client.getCloudSite("MTN6");
- Assert.assertNotNull(getCloudSite);
- Assert.assertNotNull(getCloudSite.getIdentityService());
- Assert.assertEquals("TESTCLLI", getCloudSite.getClli());
- Assert.assertEquals("regionId", getCloudSite.getRegionId());
- Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
+ assertNotNull(getCloudSite);
+ assertNotNull(getCloudSite.getIdentityService());
+ assertEquals("TESTCLLI", getCloudSite.getClli());
+ assertEquals("regionId", getCloudSite.getRegionId());
+ assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
}
@Test
public void testGetHomingInstance() {
HomingInstance homingInstance = client.getHomingInstance("5df8b6de-2083-11e7-93ae-92361f232671");
- Assert.assertNotNull(homingInstance);
- Assert.assertNotNull(homingInstance.getCloudOwner());
- Assert.assertNotNull(homingInstance.getCloudRegionId());
- Assert.assertNotNull(homingInstance.getOofDirectives());
+ assertNotNull(homingInstance);
+ assertNotNull(homingInstance.getCloudOwner());
+ assertNotNull(homingInstance.getCloudRegionId());
+ assertNotNull(homingInstance.getOofDirectives());
}
@Test
@@ -487,43 +486,43 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
+ "\"id\": \"vsink\"\n" + "}\n" + "]\n" + "}");
localClient.postHomingInstance(homingInstance);
HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671");
- Assert.assertNotNull(getHomingInstance);
- Assert.assertNotNull(getHomingInstance.getCloudRegionId());
- Assert.assertNotNull(getHomingInstance.getCloudOwner());
- Assert.assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
- Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
+ assertNotNull(getHomingInstance);
+ assertNotNull(getHomingInstance.getCloudRegionId());
+ assertNotNull(getHomingInstance.getCloudOwner());
+ assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
+ assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
}
@Test
public void testGetServiceByModelName() {
Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelNameNotFound() {
Service service = client.getServiceByModelName("Not_Found");
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
public void testGetServiceByModelUUID() {
Service service = client.getServiceByModelUUID("5df8b6de-2083-11e7-93ae-92361f002679");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelUUIDNotFound() {
Service service = client.getServiceByModelUUID("Not_Found");
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
@@ -535,53 +534,52 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
northBoundRequest.setCloudOwner("my-custom-cloud-owner");
client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true,
"my-custom-cloud-owner");
- Assert.assertNotNull(northBoundRequest);
- Assert.assertEquals("createService", northBoundRequest.getAction());
- Assert.assertEquals("service", northBoundRequest.getRequestScope());
- Assert.assertEquals(true, northBoundRequest.getIsAlacarte());
- Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
+ assertNotNull(northBoundRequest);
+ assertEquals("createService", northBoundRequest.getAction());
+ assertEquals("service", northBoundRequest.getRequestScope());
+ assertEquals(true, northBoundRequest.getIsAlacarte());
+ assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUID() {
ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance",
"4694a55f-58b3-4f17-92a5-796d6f5ffd0d");
- Assert.assertNotNull(serviceRecipe);
- Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
- Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
- Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ assertNotNull(serviceRecipe);
+ assertNotNull(serviceRecipe.getServiceModelUUID());
+ assertNotNull(serviceRecipe.getAction());
+ assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
ServiceRecipe serviceRecipe =
client.findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test");
- Assert.assertNull(serviceRecipe);
+ assertNull(serviceRecipe);
}
@Test
public void testFindExternalToInternalServiceByServiceName() {
ExternalServiceToInternalService externalServiceToInternalService =
client.findExternalToInternalServiceByServiceName("MySpecialServiceName");
- Assert.assertNotNull(externalServiceToInternalService);
- Assert.assertNotNull(externalServiceToInternalService.getServiceName());
- Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID());
- Assert.assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
+ assertNotNull(externalServiceToInternalService);
+ assertNotNull(externalServiceToInternalService.getServiceName());
+ assertNotNull(externalServiceToInternalService.getServiceModelUUID());
+ assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
}
@Test
public void testFindExternalToInternalServiceByServiceNameNotFound() {
ExternalServiceToInternalService externalServiceToInternalService =
client.findExternalToInternalServiceByServiceName("Not_Found");
- Assert.assertNull(externalServiceToInternalService);
+ assertNull(externalServiceToInternalService);
}
@Test
public void getPnfResourceByModelUUID_validUuid_expectedOutput() {
PnfResource pnfResource = client.getPnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002680");
- Assert.assertNotNull(pnfResource);
+ assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
pnfResource.getModelInvariantUUID());
@@ -592,7 +590,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getPnfResourceByModelUUID_invalidUuid_NullOutput() {
PnfResource pnfResource = client.getPnfResourceByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(pnfResource);
+ assertNull(pnfResource);
}
@Test
@@ -616,7 +614,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() {
PnfResourceCustomization pnfResourceCustomization =
client.getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(pnfResourceCustomization);
+ assertNull(pnfResourceCustomization);
}
@Test
@@ -647,6 +645,53 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetServiceTopologyById() throws Exception {
+ org.onap.so.rest.catalog.beans.Service serviceByID =
+ client.getServiceModelInformation("5df8b6de-2083-11e7-93ae-92361f002671", "2");
+ assertNotNull(serviceByID);
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ assertEquals("NA", serviceByID.getServiceType());
+ assertEquals("NA", serviceByID.getServiceRole());
+ }
+
+ @Test
+ public void testGetServices() throws Exception {
+ List<org.onap.so.rest.catalog.beans.Service> services = client.getServices();
+ assertEquals(false, services.isEmpty());
+ }
+
+ @Test
+ public void testVnf() throws Exception {
+ org.onap.so.rest.catalog.beans.Vnf vnf = client.getVnfModelInformation("5df8b6de-2083-11e7-93ae-92361f002671",
+ "68dc9a92-214c-11e7-93ae-92361f002671", "0");
+ assertNotNull(vnf);
+ assertEquals("vSAMP10a", vnf.getModelName());
+ assertEquals(false, vnf.getNfDataValid());
+ assertEquals("vSAMP", vnf.getNfFunction());
+ assertEquals("vSAMP", vnf.getNfNamingCode());
+ assertEquals("vSAMP", vnf.getNfRole());
+ assertEquals("vSAMP", vnf.getNfType());
+
+ vnf.setNfDataValid(true);
+ vnf.setNfFunction("nfFunction");
+ vnf.setNfRole("nfRole");
+ vnf.setNfType("nfType");
+ vnf.setNfNamingCode("nfNamingCode");
+
+ client.updateVnf("5df8b6de-2083-11e7-93ae-92361f002671", vnf);
+ vnf = client.getVnfModelInformation("5df8b6de-2083-11e7-93ae-92361f002671",
+ "68dc9a92-214c-11e7-93ae-92361f002671", "0");
+ assertEquals("vSAMP10a", vnf.getModelName());
+ assertEquals(true, vnf.getNfDataValid());
+ assertEquals("nfFunction", vnf.getNfFunction());
+ assertEquals("nfNamingCode", vnf.getNfNamingCode());
+ assertEquals("nfRole", vnf.getNfRole());
+ assertEquals("nfType", vnf.getNfType());
+
+
+ }
+
+ @Test
public void getWorkflowByArtifactUUID_validUuid_expectedOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
assertEquals("artifactName", "testingWorkflow.bpmn", workflow.getArtifactName());
@@ -655,7 +700,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByArtifactUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
@Test
@@ -670,7 +715,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByModelUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
@Test
@@ -685,7 +730,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowBySource_invalidSource_nullOutput() {
List<Workflow> workflow = client.findWorkflowBySource("abc");
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
new file mode 100644
index 0000000000..2dc83c8963
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
@@ -0,0 +1,53 @@
+{
+ "modelName": "modelName",
+ "description": "description",
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersion": "modelVersion",
+ "serviceType": "serviceType",
+ "serviceRole": "serviceRole",
+ "environmentContext": "environmentContext",
+ "category": "category",
+ "distrobutionStatus": "distrobutionStatus",
+ "vnf": [
+ {
+ "modelName": "modelName",
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersion": "modelVersion",
+ "modelCustomizationId": "modelCustomizationUUID",
+ "modelInstanceName": "modelInstanceName",
+ "minInstances": 1,
+ "maxInstances": 3,
+ "availabilityZoneMaxCount": 11,
+ "toscaNodeType": "toscaNodeType",
+ "nfFunction": "nfFunction",
+ "nfRole": "nfRole",
+ "nfType": "nfType",
+ "nfNamingCode": "nfNamingCode",
+ "multiStageDesign": "multiStageDesign",
+ "orchestrationMode": "orchestrationMode",
+ "cloudVersionMin": "cloudVersionMin",
+ "cloudVersionMax": "cloudVersionMax",
+ "category": "category",
+ "subCategory": "subCategory",
+ "vfModule": [
+ {
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelName": "modelName",
+ "modelVersion": "modelVersion",
+ "description": "description",
+ "isBase": false,
+ "modelCustomizationId": "modelCustomizationUUID",
+ "label": "label",
+ "minInstances": 1,
+ "maxInstances": 3,
+ "initialCount": "1",
+ "availabilityZoneCount": 10,
+ "isVolumeGroup": false
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
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 1ba1597c73..32c51293c2 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
@@ -183,7 +183,10 @@ VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
'toscaNodeType',
'testVnfcCustomizationDescription',
'2018-07-17 14:05:08');
-
+
+INSERT INTO `rainy_day_handler_macro` (`FLOW_NAME`,`SERVICE_TYPE`,`VNF_TYPE`,`ERROR_CODE`,`WORK_STEP`,`POLICY`,`SECONDARY_POLICY`,`REG_EX_ERROR_MESSAGE`, `SERVICE_ROLE`)
+VALUES ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.','*');
+
INSERT INTO `cvnfc_customization`
(`id`,
`model_customization_uuid`,
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 463be2e527..97a4503190 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,45 +1,46 @@
<configuration>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
+
+ <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.adapters.catalogdb.catalogrest.TestAppender" />
-
- <logger name="com.att.ecomp.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="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <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">
- <appender-ref ref="STDOUT" />
- </logger>
-
-
- <logger name="ch.vorburger" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
-
- <root level="WARN">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </root>
+ </appender>
+
+ <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
+
+ <logger name="com.att.ecomp.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="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <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">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger name="org.hibernate" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="ch.vorburger" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </root>
</configuration> \ No newline at end of file