diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2018-08-09 20:47:29 +0000 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-10 18:48:54 +0000 |
commit | aa7486577fb66e85a5bb220438946579695b27b8 (patch) | |
tree | fe93c4ce0441b82d9b185b5be4e93255cc2cdbac /ms/controllerblueprints/modules/service/src/test | |
parent | 3db41eeb5c71efe3153ab5761a7b0ad091a56399 (diff) |
Controller Blueprints MS
Creating the base directory structure for Controller Blueprints MicroService
Change-Id: I1ccf7fc76446048af3b2822f9155bb634657aee3
Issue-ID: CCSDK-410
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/test')
16 files changed, 2175 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java new file mode 100644 index 00000000..db35fe66 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/DatabaseConfig.java @@ -0,0 +1,61 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.sql.DataSource;
+
+/**
+ * DatabaseConfig.java Purpose: Provide Configuration Generator DatabaseConfig Information
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+@Configuration
+@EntityScan("org.onap.ccsdk.apps.controllerblueprints.service.domain")
+@EnableTransactionManagement
+@EnableJpaRepositories("org.onap.ccsdk.apps.controllerblueprints.service.repository")
+@EnableJpaAuditing
+public class DatabaseConfig {
+ /**
+ * This is a entityManagerFactory method
+ *
+ * @param dataSource
+ * @return LocalContainerEntityManagerFactoryBean
+ */
+
+ @Bean
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
+ HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
+ vendorAdapter.setGenerateDdl(true);
+ vendorAdapter.setShowSql(false);
+ LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
+ factory.setJpaVendorAdapter(vendorAdapter);
+ factory.setPackagesToScan("org.onap.ccsdk.apps.controllerblueprints.service.domain");
+ factory.setDataSource(dataSource);
+ return factory;
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java new file mode 100644 index 00000000..f5535eb1 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/JerseyConfiguration.java @@ -0,0 +1,69 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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. + */ + +package org.onap.ccsdk.apps.controllerblueprints; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import org.glassfish.jersey.logging.LoggingFeature; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.servlet.ServletProperties; +import org.onap.ccsdk.apps.controllerblueprints.service.common.ServiceExceptionMapper; +import org.onap.ccsdk.apps.controllerblueprints.service.rs.ConfigModelRestImpl; +import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestImpl; +import org.onap.ccsdk.apps.controllerblueprints.service.rs.ResourceDictionaryRestImpl; +import org.onap.ccsdk.apps.controllerblueprints.service.rs.ServiceTemplateRestImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; + +import java.util.logging.Logger; + + +@Component +public class JerseyConfiguration extends ResourceConfig { + private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName()); + + @Bean + @Primary + public ObjectMapper objectMapper() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + return objectMapper; + } + + @Autowired + public JerseyConfiguration() { + register(ConfigModelRestImpl.class); + register(ModelTypeRestImpl.class); + register(ResourceDictionaryRestImpl.class); + register(ServiceTemplateRestImpl.class); + // Exception Mapping + register(ServiceExceptionMapper.class); + property(ServletProperties.FILTER_FORWARD_ON_404, true); + register(new LoggingFeature(log)); + } + + +}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java new file mode 100644 index 00000000..537429f0 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestApplication.java @@ -0,0 +1,34 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+
+
+@SpringBootApplication
+@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})
+@EnableAutoConfiguration
+public class TestApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(TestApplication.class, args);
+ }
+
+}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java new file mode 100644 index 00000000..ea259c9c --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/TestConfiguration.java @@ -0,0 +1,36 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints;
+
+import org.springframework.context.annotation.Bean;
+
+import java.util.ArrayList;
+
+//@Configuration
+public class TestConfiguration {
+
+ @Bean("jaxrsProviders")
+ public ArrayList<Object> provider() {
+ return new ArrayList<Object>();
+ }
+
+ @Bean("jaxrsServices")
+ public ArrayList<Object> service() {
+ return new ArrayList<Object>();
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java new file mode 100644 index 00000000..50e94df9 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SchemaGeneratorServiceTest.java @@ -0,0 +1,50 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.common;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.service.SchemaGeneratorService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.nio.charset.Charset;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class SchemaGeneratorServiceTest {
+
+ private static Logger log = LoggerFactory.getLogger(ServiceTemplateValidationTest.class);
+
+ @Test
+ public void test01GenerateSwaggerData() throws Exception {
+ log.info("******************* test01GenerateSwaggerData ******************************");
+
+ String file = "src/test/resources/enhance/enhanced-template.json";
+ String serviceTemplateContent = FileUtils.readFileToString(new File(file), Charset.defaultCharset());
+ SchemaGeneratorService schemaGeneratorService = new SchemaGeneratorService();
+ String schema = schemaGeneratorService.generateSchema(serviceTemplateContent);
+ log.trace("Generated Schema " + schema);
+ Assert.assertNotNull("failed to generate Sample Data", schema);
+
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java new file mode 100644 index 00000000..af309e21 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceTemplateValidationTest.java @@ -0,0 +1,56 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.common;
+
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
+import org.onap.ccsdk.apps.controllerblueprints.service.validator.ServiceTemplateValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.charset.Charset;
+import java.util.List;
+
+public class ServiceTemplateValidationTest {
+ private static Logger log = LoggerFactory.getLogger(ServiceTemplateValidationTest.class);
+
+ @Test
+ public void testBluePrintDirs(){
+ List<String> dirs = ConfigModelUtils.getBlueprintNames("load/blueprints");
+ Assert.assertNotNull("Failed to get blueprint directories", dirs );
+ Assert.assertEquals("Failed to get actual directories",2, dirs.size() );
+ }
+
+ // @Test
+ public void validateServiceTemplate() {
+ try {
+ String file = "load/service_template/vrr-201806-test/service-template.json";
+ String serviceTemplateContent =
+ IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader().getResourceAsStream(file),
+ Charset.defaultCharset());
+ ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
+ serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
+ log.info("Validated Service Template " + serviceTemplateValidator.getMetaData());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java new file mode 100644 index 00000000..5b10a7e8 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestTest.java @@ -0,0 +1,172 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.rs;
+
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ConfigModelRestTest {
+
+ private static Logger log = LoggerFactory.getLogger(ConfigModelRestTest.class);
+
+ @Autowired
+ ConfigModelRest configModelRest;
+
+ ConfigModel configModel;
+
+ String name = "vrr-test";
+ String version = "1.0.0";
+
+ @Before
+ public void setUp() {
+
+ }
+
+
+ @After
+ public void tearDown() {
+ }
+
+
+ @Test
+ public void test01getInitialConfigModel() throws Exception {
+ log.info("** test01getInitialConfigModel *****************");
+
+ String name = "default_netconf";
+ ConfigModel configModel = configModelRest.getInitialConfigModel(name);
+ Assert.assertNotNull("Failed to get Initial Config Model , Return object is Null", configModel);
+ Assert.assertNotNull("Failed to get Service Template Content ", configModel.getConfigModelContents());
+
+ }
+
+
+ @Test
+ public void test02SaveServiceTemplate() throws Exception {
+ log.info("************************ test02SaveServiceTemplate ******************");
+
+
+ configModel = ConfigModelUtils.getConfigModel("load/blueprints/vrr-test");
+
+ configModel = configModelRest.saveConfigModel(configModel);
+ Assert.assertNotNull("Failed to ConfigModel, Return object is Null", configModel);
+ Assert.assertNotNull("Failed to ConfigModel Id , Return ID object is Null", configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel Content, Return object is Null",
+ configModel.getConfigModelContents());
+ Assert.assertEquals("Failed in validation of ConfigModel Content count,", 3,
+ configModel.getConfigModelContents().size());
+
+ ConfigModel dbconfigModel = configModelRest.getConfigModel(configModel.getId());
+
+ log.info("************************ test02SaveServiceTemplate-2 ******************");
+
+ dbconfigModel.getConfigModelContents().remove(2);
+ dbconfigModel = configModelRest.saveConfigModel(dbconfigModel);
+ log.info("Saved Config Model " + configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel, Return object is Null", dbconfigModel);
+ Assert.assertNotNull("Failed to ConfigModel Id ", dbconfigModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel Content",
+ dbconfigModel.getConfigModelContents());
+ Assert.assertEquals("Failed to Remove the ConfigModel Content,", 2,
+ dbconfigModel.getConfigModelContents().size());
+
+
+ }
+
+
+ @Test
+ public void test03PublishServiceTemplate() throws Exception {
+ log.info("** test03PublishServiceTemplate *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+ log.info("Publishing Config Model " + configModel.getId());
+ configModel = configModelRest.publishConfigModel(configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel, Return object is Null", configModel);
+ Assert.assertNotNull("Failed to ConfigModel Id ", configModel.getId());
+ Assert.assertNotNull("Failed to ConfigModel Content", configModel.getConfigModelContents());
+ Assert.assertEquals("Failed to update the publish indicator", "Y", configModel.getPublished());
+ }
+
+
+ @Test
+ public void test04GetConfigModel() throws Exception {
+ log.info("** test04GetConfigModel *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+ Assert.assertNotNull("Failed to get ConfigModel for the Name (" + configModel.getArtifactName() + ") and ("
+ + configModel.getArtifactVersion() + ")", configModel);
+ Assert.assertNotNull("Failed to get ConfigModel Id", configModel.getId());
+
+ configModel = configModelRest.getConfigModel(configModel.getId());
+ Assert.assertNotNull("Failed to get ConfigModel for the Id (" + configModel.getId() + ") ", configModel);
+
+ }
+
+ @Test
+ public void test05GetCloneConfigModel() throws Exception {
+ log.info("** test05GetCloneConfigModel *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+
+ Assert.assertNotNull("Failed to get ConfigModel for the Name (" + configModel.getArtifactName() + ") and ("
+ + configModel.getArtifactVersion() + ")", configModel);
+ Assert.assertNotNull("Failed to get ConfigModel Id", configModel.getId());
+
+ configModel = configModelRest.getCloneConfigModel(configModel.getId());
+ Assert.assertNotNull("Failed to get ConfigModel for the Id (" + configModel.getId() + ") ", configModel);
+ }
+
+
+ @Test
+ public void test07SearchConfigModels() throws Exception {
+ log.info("** test07SearchConfigModels *****************");
+
+ List<ConfigModel> configModels = configModelRest.searchConfigModels("vrr-test");
+ Assert.assertNotNull("Failed to search ConfigModel", configModels);
+ Assert.assertTrue("Failed to search ConfigModel with count", configModels.size() > 0);
+ // update the ServiceModelContent
+ }
+
+
+ @Test
+ public void test08DeleteConfigModels() throws Exception {
+ log.info("** test08DeleteConfigModels *****************");
+
+ ConfigModel configModel = configModelRest.getConfigModelByNameAndVersion(name, version);
+ configModelRest.deleteConfigModel(configModel.getId());
+
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java new file mode 100644 index 00000000..d33349c5 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java @@ -0,0 +1,130 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.rs;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ModelTypeRestTest {
+ private static Logger log = LoggerFactory.getLogger(ModelTypeRestTest.class);
+ @Autowired
+ ModelTypeRest modelTypeRest;
+
+ String modelName = "test-datatype";
+
+ @Before
+ public void setUp() {
+
+ }
+
+
+ @After
+ public void tearDown() {}
+
+ @Test
+ public void test01SaveModelType() throws Exception {
+ log.info( "**************** test01SaveModelType ********************");
+
+ String content = FileUtils.readFileToString(new File("load/model_type/data_type/datatype-property.json"), Charset.defaultCharset());
+ ModelType modelType = new ModelType();
+ modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
+ modelType.setDescription("Definition for Sample Datatype ");
+ modelType.setDefinition(content);
+ modelType.setModelName(modelName);
+ modelType.setVersion("1.0.0");
+ modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ modelType.setUpdatedBy("xxxxxx@xxx.com");
+ modelType = modelTypeRest.saveModelType(modelType);
+ log.info( "Saved Mode {}", modelType.toString());
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType);
+ Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.getModelName());
+
+ ModelType dbModelType = modelTypeRest.getModelTypeByName(modelType.getModelName());
+ Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType.getModelName() + ")",
+ dbModelType);
+
+ // Model Update
+ modelType.setUpdatedBy("bs2796@xxx.com");
+ modelType = modelTypeRest.saveModelType(modelType);
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType);
+ Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.getUpdatedBy());
+
+ }
+
+ @Test
+ public void test02SearchModelTypes() throws Exception {
+ log.info( "*********************** test02SearchModelTypes ***************************");
+
+ String tags = "test-datatype";
+
+ List<ModelType> dbModelTypes = modelTypeRest.searchModelTypes(tags);
+ Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes);
+ Assert.assertEquals("Failed to search ResourceMapping by tags count", true, dbModelTypes.size() > 0);
+
+ }
+
+ @Test
+ public void test03GetModelType() throws Exception {
+ log.info( "************************* test03GetModelType *********************************");
+ ModelType dbModelType = modelTypeRest.getModelTypeByName(modelName);
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbModelType);
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType.getModelName());
+
+ List<ModelType> dbDatatypeModelTypes =
+ modelTypeRest.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes);
+ Assert.assertEquals("Failed to find getModelTypeByDefinitionType by count", true,
+ dbDatatypeModelTypes.size() > 0);
+ }
+
+ @Test
+ public void test04DeleteModelType() throws Exception {
+ log.info(
+ "************************ test03DeleteModelType ***********************");
+ ModelType dbResourceMapping = modelTypeRest.getModelTypeByName(modelName);
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping);
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping.getModelName());
+
+ modelTypeRest.deleteModelTypeByName(dbResourceMapping.getModelName());
+ }
+
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java new file mode 100644 index 00000000..71dff338 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java @@ -0,0 +1,113 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.rs;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ResourceDictionaryRestTest {
+
+ private static Logger log = LoggerFactory.getLogger(ResourceDictionaryRestTest.class);
+
+ @Autowired
+ protected ResourceDictionaryRest resourceDictionaryRest;
+
+ @Before
+ public void setUp() {
+
+ }
+
+ @Test
+ public void test01SaveDataDictionary() throws Exception {
+ String definition = IOUtils.toString(
+ getClass().getClassLoader().getResourceAsStream("resourcedictionary/default_definition.json"),
+ Charset.defaultCharset());
+
+ ResourceDictionary dataDictionary = new ResourceDictionary();
+ dataDictionary.setResourcePath("test/vnf/ipaddress");
+ dataDictionary.setName("test-name");
+ dataDictionary.setDefinition(definition);
+ dataDictionary.setValidValues("127.0.0.1");
+ dataDictionary.setResourceType("ONAP");
+ dataDictionary.setDataType("string");
+ dataDictionary.setDescription("Sample Resource Mapping");
+ dataDictionary.setTags("test, ipaddress");
+ dataDictionary.setUpdatedBy("xxxxxx@xxx.com");
+
+ dataDictionary = resourceDictionaryRest.saveResourceDictionary(dataDictionary);
+
+ Assert.assertNotNull("Failed to get Saved Resource Dictionary", dataDictionary);
+ Assert.assertNotNull("Failed to get Saved Resource Dictionary, Id", dataDictionary.getName());
+
+ ResourceDictionary dbDataDictionary =
+ resourceDictionaryRest.getResourceDictionaryByName(dataDictionary.getName());
+ Assert.assertNotNull("Failed to query Resource Dictionary for ID (" + dataDictionary.getName() + ")",
+ dbDataDictionary);
+ Assert.assertNotNull("Failed to query Resource Dictionary definition for ID (" + dataDictionary.getName() + ")",
+ dbDataDictionary.getDefinition());
+
+ log.trace("Saved Dictionary " + dbDataDictionary.getDefinition());
+
+ }
+
+ @Test
+ public void test02GetDataDictionary() throws Exception {
+
+ ResourceDictionary dbResourceDictionary = resourceDictionaryRest.getResourceDictionaryByName("test-name");
+ Assert.assertNotNull("Failed to query Resource Dictionary by Name", dbResourceDictionary);
+
+ String tags = "ipaddress";
+
+ List<ResourceDictionary> dbResourceDictionaries = resourceDictionaryRest.searchResourceDictionaryByTags(tags);
+ Assert.assertNotNull("Failed to search ResourceDictionary by tags", dbResourceDictionaries);
+ Assert.assertTrue("Failed to search searchResourceDictionaryByTags by tags by count",
+ dbResourceDictionaries.size() > 0);
+
+ List<String> names = new ArrayList<>();
+ names.add("test-name");
+ dbResourceDictionaries = resourceDictionaryRest.searchResourceDictionaryByNames(names);
+ Assert.assertNotNull("Failed to search ResourceDictionary by Names", dbResourceDictionaries);
+ Assert.assertTrue("Failed to search searchResourceDictionaryByNames by tags by count",
+ dbResourceDictionaries.size() > 0);
+
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java new file mode 100644 index 00000000..f81dd416 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java @@ -0,0 +1,155 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.rs;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;
+import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
+import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.util.List;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ServiceTemplateRestTest {
+
+ private static Logger log = LoggerFactory.getLogger(ServiceTemplateRestTest.class);
+ @Autowired
+ ModelTypeRest modelTypeRest;
+
+ @Autowired
+ private ServiceTemplateRest serviceTemplateRest;
+
+ @Test
+ public void test02EnrichServiceTemplate() throws Exception {
+ log.info("*********** test02EnrichServiceTemplate ***********************");
+ String file = "src/test/resources/enhance/enhance-template.json";
+
+ String serviceTemplateContent = FileUtils.readFileToString(new File(file), Charset.defaultCharset());
+
+ ServiceTemplate serviceTemplate = JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+
+ serviceTemplate = serviceTemplateRest.enrichServiceTemplate(serviceTemplate);
+
+ String enhancedFile = "src/test/resources/enhance/enhanced-template.json";
+
+ FileUtils.write(new File(enhancedFile),
+ JacksonUtils.getJson(serviceTemplate, true), Charset.defaultCharset());
+
+ Assert.assertNotNull("Failed to get Enriched Blueprints, Return object is Null", serviceTemplate);
+ Assert.assertNotNull("Failed to get Enriched Blueprints Data Type, Return object is Null",
+ serviceTemplate.getDataTypes());
+ Assert.assertNotNull("Failed to get Enriched Blueprints Node Type, Return object is Null",
+ serviceTemplate.getNodeTypes());
+ log.trace("Enriched Service Template :\n" + JacksonUtils.getJson(serviceTemplate, true));
+ }
+
+ @Test
+ public void test03ValidateServiceTemplate() throws Exception {
+ log.info("*********** test03ValidateServiceTemplate *******************************************");
+ String enhancedFile = "src/test/resources/enhance/enhanced-template.json";
+ String serviceTemplateContent = FileUtils.readFileToString(new File(enhancedFile), Charset.defaultCharset());
+
+ ServiceTemplate serviceTemplate =
+ JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
+
+ serviceTemplate = serviceTemplateRest.validateServiceTemplate(serviceTemplate);
+
+ Assert.assertNotNull("Failed to validate Service Template, Return object is Null", serviceTemplate);
+ Assert.assertNotNull("Failed to get Service Template Data Type, Return object is Null",
+ serviceTemplate.getDataTypes());
+ Assert.assertNotNull("Failed to get Service Template Node Type, Return object is Null",
+ serviceTemplate.getNodeTypes());
+
+ log.trace("Validated Service Template :\n" + JacksonUtils.getJson(serviceTemplate, true));
+
+ }
+
+
+ @Test
+ public void test04GenerateResourceAssignments() throws Exception {
+ log.info("*********** test04GenerateResourceAssignments *******************************************");
+ ConfigModelContent baseConfigConfigModelContent = new ConfigModelContent();
+ String baseConfigContent = FileUtils.readFileToString(new File("load/blueprints/vrr-test/Templates/base-config-template.vtl")
+ , Charset.defaultCharset());
+ baseConfigConfigModelContent.setName("base-config-template");
+ baseConfigConfigModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);
+ baseConfigConfigModelContent.setContent(baseConfigContent);
+
+ List<ResourceAssignment> resourceAssignments =
+ serviceTemplateRest.generateResourceAssignments(baseConfigConfigModelContent);
+
+ Assert.assertNotNull("Failed to get ResourceAssignments, Return object is Null", resourceAssignments);
+ Assert.assertTrue("Failed to get ResourceAssignments count", resourceAssignments.size() > 0);
+
+ log.trace("Validated Service Template :\n" + JacksonUtils.getJson(resourceAssignments, true));
+
+
+ }
+
+ @Test
+ public void test05AutoMap() throws Exception {
+ log.info("*********** test05AutoMap *******************************************");
+
+ String resourceassignmentContent = FileUtils.readFileToString(
+ new File("src/test/resources/resourcedictionary/automap.json"), Charset.defaultCharset());
+ List<ResourceAssignment> batchResourceAssignment =
+ JacksonUtils.getListFromJson(resourceassignmentContent, ResourceAssignment.class);
+ AutoMapResponse autoMapResponse = serviceTemplateRest.autoMap(batchResourceAssignment);
+
+ Assert.assertNotNull("Failed to get ResourceAssignments, Return object is Null",
+ autoMapResponse.getResourceAssignments());
+ Assert.assertNotNull("Failed to get Data Dictionary from ResourceAssignments",
+ autoMapResponse.getDataDictionaries());
+ Assert.assertTrue("Failed to get ResourceAssignments count",
+ CollectionUtils.isNotEmpty(autoMapResponse.getDataDictionaries()));
+
+ List<ResourceAssignment> autoMappedResourceAssignment = autoMapResponse.getResourceAssignments();
+ autoMappedResourceAssignment.forEach(resourceAssignment -> {
+ if ("bundle-id".equals(resourceAssignment.getName())) {
+ Assert.assertEquals("Failed to assign default first source", "db",
+ resourceAssignment.getDictionarySource());
+ }
+ });
+
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java new file mode 100644 index 00000000..b38dd6de --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtilsTest.java @@ -0,0 +1,33 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.utils;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+
+public class ConfigModelUtilsTest {
+
+ @Test
+ public void testConfigModel() throws Exception {
+
+ ConfigModel configModel = ConfigModelUtils.getConfigModel("load/blueprints/vrr-test");
+ Assert.assertNotNull("Failed to prepare config model", configModel);
+ Assert.assertTrue("Failed to prepare config model contents", CollectionUtils.isNotEmpty(configModel.getConfigModelContents()));
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties new file mode 100644 index 00000000..a13e1684 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -0,0 +1,67 @@ +# +# Copyright © 2017-2018 AT&T Intellectual Property. +# +# 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. +# + +info.build.artifact=@project.artifactId@ +info.build.name=@project.name@ +info.build.description=@project.description@ +info.build.version=@project.version@ +info.build.groupId=@project.groupId@ +logging.level.root=info + +server.contextPath=/ +server.servlet-path=/ +spring.jersey.application-path=/api/controller-blueprints/v1 +server.routingPath=/api + + +mots.application.acronym=MOTS_ID +platform.identifier=AJSC7_JERSEY +#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration + +#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + + +#The max number of active threads in this pool +server.tomcat.max-threads=200 +#The minimum number of threads always kept alive +server.tomcat.min-Spare-Threads=25 +#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads +server.tomcat.max-idle-time=60000 + +#for changing the tomcat port... +#server.port=8081 + + + +#Servlet context parameters +server.context_parameters.p-name=value #context parameter with p-name as key and value as value. + +# make this true for AAF authentication and place cadi.properties into etc folder +aaf.enabled=true + +# set to true to enable version proxy +#ivp.enabled=false + +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS = false + + +logging.level.org.springframework.web=INFO +logging.level.org.hibernate.SQL=warn +logging.level.org.hibernate.type.descriptor.sql=debug + + +blueprints.load.initial-data=true +blueprints.load.path=load
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json new file mode 100644 index 00000000..8b4fd9d3 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json @@ -0,0 +1,345 @@ +{
+ "metadata": {
+ "template_author": "Brinda Santh",
+ "template_name": "enhance-template",
+ "template_version": "1.0.0",
+ "service-type": "Sample Service",
+ "release": "1806",
+ "vnf-type": "VPE"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "vpe-netconf-device": {
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "login-key": "sdnc",
+ "login-account": "sndc-local",
+ "source": "local",
+ "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "port-number": 22,
+ "connection-time-out": 30
+ }
+ }
+ },
+ "type": "vnf-netconf-device"
+ },
+ "activate-netconf-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vpe-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "template_name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"hostname\" }",
+ "execution-script": "execution-script"
+ },
+ "outputs": {
+ "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
+ "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ },
+ "implementation" : {
+ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-netconf-executor"
+ },
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "interfaces": {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": "{ \"get_input\" : \"action-name\" }",
+ "service-template-name": "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_input\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"hostname\" }"
+ },
+ "outputs": {
+ "resource-assignment-params": "success",
+ "status": "status"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": "false"
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-resource-assignment"
+ },
+ "activate-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": "false"
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "activate-netconf-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-activate-netconf"
+ },
+ "base-config-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "bundle-mac",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "string",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": ""
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "db",
+ "dependencies": [
+ "hostname"
+ ],
+ "version": 0
+ },
+ {
+ "name": "wan-aggregate-ipv4-addresses",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "wan-aggregate-ipv4-addresses",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id",
+ "oam-network-role",
+ "oam-v4-ip-type ",
+ "oam-vm-type"
+ ],
+ "version": 0
+ },
+ {
+ "name": "hostname",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ },
+ "licence-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://licence-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "licenses",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "status": "",
+ "constraints": [
+ {}
+ ],
+ "entry_schema": {
+ "type": "dt-license-key"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "licenses",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ }
+ }
+ },
+ "node_types": {
+ },
+ "data_types": {
+ }
+}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json new file mode 100644 index 00000000..18f49925 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -0,0 +1,824 @@ +{
+ "metadata" : {
+ "template_author" : "Brinda Santh",
+ "template_name" : "enhance-template",
+ "template_version" : "1.0.0",
+ "service-type" : "Sample Service",
+ "release" : "1806",
+ "vnf-type" : "VPE"
+ },
+ "tosca_definitions_version" : "controller_blueprint_1_0_0",
+ "artifact_types" : { },
+ "data_types" : {
+ "dt-v4-aggregate" : {
+ "description" : "This is dt-v4-aggregate Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "ipv4-address" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "ipv4-plen" : {
+ "required" : false,
+ "type" : "integer"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "dt-license-key" : {
+ "description" : "This is dt-plicense-key Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "license-key" : {
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "datatype-resource-assignment" : {
+ "description" : "This is Resource Assignment Data Type",
+ "version" : "1.0.0",
+ "properties" : {
+ "property" : {
+ "required" : true,
+ "type" : "datatype-property"
+ },
+ "input-param" : {
+ "required" : true,
+ "type" : "boolean"
+ },
+ "dictionary-name" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "dictionary-source" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "dependencies" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "status" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "message" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "updated-date" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "updated-by" : {
+ "required" : false,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "datatype-property" : {
+ "description" : "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "version" : "1.0.0",
+ "properties" : {
+ "type" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "description" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "required" : {
+ "required" : false,
+ "type" : "boolean"
+ },
+ "default" : {
+ "required" : false,
+ "type" : "string"
+ },
+ "entry_schema" : {
+ "required" : false,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Root"
+ },
+ "dt-resource-assignment-request" : {
+ "description" : "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.",
+ "version" : "1.0.0",
+ "properties" : {
+ "bundle-mac" : {
+ "description" : "",
+ "required" : true,
+ "type" : "string",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : ""
+ }
+ },
+ "hostname" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "licenses" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-license-key"
+ }
+ },
+ "wan-aggregate-ipv4-addresses" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-v4-aggregate"
+ }
+ },
+ "service" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "service-instance-id" : {
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "derived_from" : "tosca.datatypes.Dynamic"
+ }
+ },
+ "node_types" : {
+ "dg-resource-assignment" : {
+ "description" : "This is Resource Assignment Directed Graph",
+ "version" : "1.0.0",
+ "properties" : {
+ "mode" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "sync"
+ },
+ "version" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "LATEST"
+ },
+ "is-start-flow" : {
+ "required" : false,
+ "type" : "boolean",
+ "default" : "false"
+ }
+ },
+ "capabilities" : {
+ "dg-node" : {
+ "type" : "tosca.capabilities.Node"
+ },
+ "content" : {
+ "type" : "tosca.capability.Content",
+ "properties" : {
+ "type" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "json"
+ },
+ "content" : {
+ "required" : false,
+ "type" : "string"
+ }
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "component-resource-assignment",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ResourceAssignment" : {
+ "inputs" : {
+ "params" : {
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.DG"
+ },
+ "component-resource-assignment" : {
+ "description" : "This is Resource Assignment Component API",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "service-template-name" : {
+ "description" : "Service Template Name.",
+ "required" : true,
+ "type" : "string"
+ },
+ "service-template-version" : {
+ "description" : "Service Template Version.",
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-type" : {
+ "description" : "Request type.",
+ "required" : true,
+ "type" : "string"
+ },
+ "template-names" : {
+ "description" : "Name of the artifact Node Templates, to get the template Content.",
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ },
+ "request-id" : {
+ "description" : "Request Id, Unique Id for the request.",
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-id" : {
+ "description" : "Resource Id.",
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "description" : "Action Name of the process",
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "outputs" : {
+ "resource-assignment-params" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "status" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Component"
+ },
+ "artifact-config-template" : {
+ "description" : "This is Configuration Velocity Template",
+ "version" : "1.0.0",
+ "properties" : {
+ "action-names" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "capabilities" : {
+ "content" : {
+ "type" : "tosca.capability.Content",
+ "properties" : {
+ "content" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ },
+ "mapping" : {
+ "type" : "tosca.capability.Mapping",
+ "properties" : {
+ "mapping" : {
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Artifact"
+ },
+ "vnf-netconf-device" : {
+ "description" : "This is VNF Device with Netconf Capability",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "netconf" : {
+ "type" : "tosca.capability.Netconf",
+ "properties" : {
+ "login-key" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "sdnc"
+ },
+ "login-account" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "sdnc-tacacs"
+ },
+ "source" : {
+ "required" : true,
+ "type" : "string",
+ "default" : "npm"
+ },
+ "target-ip-address" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "port-number" : {
+ "required" : true,
+ "type" : "integer",
+ "default" : 830
+ },
+ "connection-time-out" : {
+ "required" : false,
+ "type" : "integer",
+ "default" : 30
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Vnf"
+ },
+ "component-netconf-executor" : {
+ "description" : "This is Netconf Transaction Configuration Component API",
+ "version" : "1.0.0",
+ "capabilities" : {
+ "component-node" : {
+ "type" : "tosca.capabilities.Node"
+ }
+ },
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "vnf-netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "request-id" : {
+ "description" : "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required" : true,
+ "type" : "string"
+ },
+ "service-template-name" : {
+ "description" : "Service Template Name",
+ "required" : true,
+ "type" : "string"
+ },
+ "service-template-version" : {
+ "description" : "Service Template Version",
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "description" : "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required" : false,
+ "type" : "string"
+ },
+ "resource-type" : {
+ "description" : "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required" : false,
+ "type" : "string"
+ },
+ "resource-id" : {
+ "description" : "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required" : false,
+ "type" : "string"
+ },
+ "reservation-id" : {
+ "description" : "Reservation Id used to send to NPM",
+ "required" : false,
+ "type" : "string"
+ },
+ "execution-script" : {
+ "description" : "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",
+ "required" : true,
+ "type" : "string"
+ }
+ },
+ "outputs" : {
+ "response-data" : {
+ "description" : "Execution Response Data in JSON format.",
+ "required" : false,
+ "type" : "string"
+ },
+ "status" : {
+ "description" : "Status of the Component Execution ( success or failure )",
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.Component"
+ },
+ "dg-activate-netconf" : {
+ "description" : "This is Download Netconf Directed Graph",
+ "version" : "1.0.0",
+ "properties" : {
+ "mode" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "sync"
+ },
+ "version" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "LATEST"
+ },
+ "is-start-flow" : {
+ "required" : false,
+ "type" : "boolean",
+ "default" : "false"
+ }
+ },
+ "capabilities" : {
+ "dg-node" : {
+ "type" : "tosca.capabilities.Node"
+ },
+ "content" : {
+ "type" : "tosca.capability.Content",
+ "properties" : {
+ "type" : {
+ "required" : false,
+ "type" : "string",
+ "default" : "json"
+ },
+ "content" : {
+ "required" : true,
+ "type" : "string"
+ }
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "component-netconf-executor",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ActivateNetconf" : {
+ "inputs" : {
+ "params" : {
+ "required" : false,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from" : "tosca.nodes.DG"
+ }
+ },
+ "topology_template" : {
+ "inputs" : {
+ "request-id" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "service-instance-id" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "scope-type" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "hostname" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-assignment-request" : {
+ "description" : "This is Dynamic Data type for the receipe resource-assignment-action.",
+ "required" : false,
+ "type" : "dt-resource-assignment-request"
+ }
+ },
+ "node_templates" : {
+ "vpe-netconf-device" : {
+ "type" : "vnf-netconf-device",
+ "capabilities" : {
+ "netconf" : {
+ "properties" : {
+ "login-key" : "sdnc",
+ "login-account" : "sndc-local",
+ "source" : "local",
+ "target-ip-address" : "{\"get_attribute\":\"lo0-local-ipv4-address\"}",
+ "port-number" : 22,
+ "connection-time-out" : 30
+ }
+ }
+ }
+ },
+ "activate-netconf-component" : {
+ "type" : "component-netconf-executor",
+ "capabilities" : {
+ "component-node" : { }
+ },
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "vpe-netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode" : {
+ "operations" : {
+ "process" : {
+ "implementation" : {
+ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ },
+ "inputs" : {
+ "action-name" : "{ \"get_input\" : \"action-name\" }",
+ "template_name" : "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type" : "vnf-type",
+ "request-id" : "{ \"get_input\" : \"request-id\" }",
+ "resource-id" : "{ \"get_input\" : \"hostname\" }",
+ "execution-script" : "execution-script"
+ },
+ "outputs" : {
+ "response-data" : "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",
+ "status" : "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"
+ }
+ }
+ }
+ }
+ }
+ },
+ "resource-assignment-ra-component" : {
+ "type" : "component-resource-assignment",
+ "capabilities" : {
+ "component-node" : { }
+ },
+ "interfaces" : {
+ "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "template-names" : [ "base-config-template", "licence-template" ],
+ "action-name" : "{ \"get_input\" : \"action-name\" }",
+ "service-template-name" : "{ \"get_attribute\" : \"template_name\" }",
+ "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "resource-type" : "vnf-type",
+ "request-id" : "{ \"get_input\" : \"request-id\" }",
+ "resource-id" : "{ \"get_input\" : \"hostname\" }"
+ },
+ "outputs" : {
+ "resource-assignment-params" : "success",
+ "status" : "status"
+ }
+ }
+ }
+ }
+ }
+ },
+ "resource-assignment-action" : {
+ "type" : "dg-resource-assignment",
+ "properties" : {
+ "mode" : "sync",
+ "version" : "LATEST",
+ "is-start-flow" : "false"
+ },
+ "capabilities" : {
+ "dg-node" : { },
+ "content" : {
+ "properties" : {
+ "type" : "json"
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "resource-assignment-ra-component",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ResourceAssignment" : {
+ "inputs" : {
+ "params" : [ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-action" : {
+ "type" : "dg-activate-netconf",
+ "properties" : {
+ "mode" : "sync",
+ "version" : "LATEST",
+ "is-start-flow" : "false"
+ },
+ "capabilities" : {
+ "dg-node" : { },
+ "content" : {
+ "properties" : {
+ "type" : "json"
+ }
+ }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "activate-netconf-component",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ActivateNetconf" : {
+ "inputs" : {
+ "params" : [ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "base-config-template" : {
+ "type" : "artifact-config-template",
+ "properties" : {
+ "action-names" : [ "resource-assignment-action" ]
+ },
+ "capabilities" : {
+ "content" : {
+ "properties" : {
+ "content" : "db://base-config-template"
+ }
+ },
+ "mapping" : {
+ "properties" : {
+ "mapping" : [ {
+ "name" : "bundle-mac",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "string",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : ""
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "bundle-mac",
+ "dictionary-source" : "db",
+ "dependencies" : [ "hostname" ],
+ "version" : 0
+ }, {
+ "name" : "wan-aggregate-ipv4-addresses",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-v4-aggregate"
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "wan-aggregate-ipv4-addresses",
+ "dictionary-source" : "mdsal",
+ "dependencies" : [ "service-instance-id", "oam-network-role", "oam-v4-ip-type ", "oam-vm-type" ],
+ "version" : 0
+ }, {
+ "name" : "hostname",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "hostname",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ }, {
+ "name" : "service",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ }, {
+ "name" : "service-instance-id",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service-instance-id",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ } ]
+ }
+ }
+ }
+ },
+ "licence-template" : {
+ "type" : "artifact-config-template",
+ "properties" : {
+ "action-names" : [ "resource-assignment-action" ]
+ },
+ "capabilities" : {
+ "content" : {
+ "properties" : {
+ "content" : "db://licence-template"
+ }
+ },
+ "mapping" : {
+ "properties" : {
+ "mapping" : [ {
+ "name" : "licenses",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "status" : "",
+ "constraints" : [ { } ],
+ "entry_schema" : {
+ "type" : "dt-license-key"
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "licenses",
+ "dictionary-source" : "mdsal",
+ "dependencies" : [ "service-instance-id" ],
+ "version" : 0
+ }, {
+ "name" : "service-instance-id",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service-instance-id",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ } ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json new file mode 100644 index 00000000..a85e7155 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json @@ -0,0 +1,11 @@ +[
+ {
+ "name": "action-name"
+ },
+ {
+ "name": "v4-ip-type"
+ },
+ {
+ "name": "bundle-id"
+ }
+]
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json new file mode 100644 index 00000000..2b392054 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json @@ -0,0 +1,19 @@ +{
+ "name": "v4-aggregat-list",
+ "description": "This collection v4-aggregate list",
+ "valid-values": null,
+ "sample-value": null,
+ "updated-by": "Brinda Santh (bs2796)",
+ "resource-type": "ONAP",
+ "resource-path": "/v4-aggregat-list",
+ "data-type": "list",
+ "entry-schema": "dt-v4-aggregate",
+ "tags": null,
+ "default": null,
+ "source": {
+ "input": {
+
+ }
+ },
+ "candidate-dependency": null
+}
\ No newline at end of file |