Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18
Issue-ID: SO-670
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
diff --git a/asdc-controller/src/main/antlr4/org/onap/so/asdc/utils/ASDCLogging.g4 b/asdc-controller/src/main/antlr4/org/onap/so/asdc/utils/ASDCLogging.g4
new file mode 100644
index 0000000..669247d
--- /dev/null
+++ b/asdc-controller/src/main/antlr4/org/onap/so/asdc/utils/ASDCLogging.g4
@@ -0,0 +1,23 @@
+grammar ASDCLogging;
+doc : value+;
+list : listName ':' '{' (obj (',' obj)*)? '}';
+simplePair : key ':' keyValue;
+complexPair : key ':' obj;
+value : simplePair | list | complexPair ;
+obj
+ : '{' 'NULL' '}'
+ | 'NULL'
+ | '{' value+ '}'
+ | value+
+ | '{' '}'
+ ;
+key : STRING;
+keyValue : STRING;
+listName : LIST_NAME;
+LIST_NAME : STRING 'List' | 'RelatedArtifacts';
+STRING : ~[:\r\n{},]+;
+
+LINE_COMMENT
+ : '//' ~[\r\n]* -> skip
+;
+WS: [ \t\n\r]+ -> skip ;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
new file mode 100644
index 0000000..0ed8784
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.asdc;
+
+import javax.annotation.PreDestroy;
+
+import org.onap.so.asdc.client.ASDCController;
+import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.security.SecureRandom;
+
+@Component
+@Profile("!test")
+public class ASDCControllerSingleton {
+
+
+ @Autowired
+ private ASDCController asdcController;
+
+
+
+ @Scheduled (fixedRate = 50000)
+ public void periodicControllerTask() {
+
+ try {
+ int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
+ asdcController.setControllerName("mso-controller"+randomNumber);
+ asdcController.initASDC();
+ } catch (ASDCControllerException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @PreDestroy
+ private void terminate () {
+ try {
+ asdcController.closeASDC ();
+ } catch (ASDCControllerException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
new file mode 100644
index 0000000..a365d07
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
@@ -0,0 +1,44 @@
+/*-
+ * ============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.asdc;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = { "org.onap.so" })
+public class Application {
+
+ private static final String LOGS_DIR = "logs_dir";
+
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/asdc/");
+ }
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("mso.config.path", ".");
+ System.getProperties().setProperty("server.name", "Springboot");
+ setLogsDir();
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
new file mode 100644
index 0000000..48f0990
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
@@ -0,0 +1,79 @@
+/*-
+ * ============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.asdc;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+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.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"}
+ )
+@Profile({"!test"})
+public class CatalogDBConfig {
+
+ @Primary
+ @Bean(name = "dataSource")
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @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/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
new file mode 100644
index 0000000..3a26b7b
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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.asdc;
+
+import javax.annotation.PostConstruct;
+import javax.ws.rs.ApplicationPath;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.onap.so.asdc.client.test.rest.ASDCRestInterface;
+import org.springframework.context.annotation.Configuration;
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.jaxrs.listing.ApiListingResource;
+import io.swagger.jaxrs.listing.SwaggerSerializers;
+
+@Configuration
+@ApplicationPath("/test")
+public class JerseyConfiguration extends ResourceConfig {
+
+
+ @PostConstruct
+ public void setUp() {
+ register(ASDCRestInterface.class);
+ register(ApiListingResource.class);
+ register(SwaggerSerializers.class);
+
+ BeanConfig beanConfig = new BeanConfig();
+ beanConfig.setVersion("1.0.2");
+ beanConfig.setSchemes(new String[] { "http" });
+ beanConfig.setHost("localhost:8080");
+ beanConfig.setBasePath("/mso");
+ beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
+ beanConfig.setPrettyPrint(true);
+ beanConfig.setScan(true);
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
new file mode 100644
index 0000000..da2fb2e
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.asdc;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+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.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
+ basePackages = { "org.onap.so.db.request.data.repository" }
+ )
+@Profile({"!test"})
+public class RequestDBConfig {
+
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "request.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean
+ entityManagerFactory(
+ EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource
+ ) {
+ return builder
+ .dataSource(dataSource)
+ .packages("org.onap.so.db.request.beans")
+ .persistenceUnit("requestDB")
+ .build();
+ }
+
+
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory
+ entityManagerFactory
+ ) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java
new file mode 100644
index 0000000..bbd7cc0
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.util.StringUtils;
+
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable()
+ .authorizeRequests()
+ .antMatchers("/manage/health","/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
+ .and()
+ .httpBasic();
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
new file mode 100644
index 0000000..85e3e9e
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -0,0 +1,263 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client;
+
+
+import java.security.GeneralSecurityException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.onap.sdc.api.consumer.IConfiguration;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ASDCConfiguration implements IConfiguration {
+
+ // SHell command to obtain the same encryption, 128 bits key, key must be HEX
+ // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd
+
+
+
+ private String asdcControllerName;
+
+ public static final String MSO_PROP_ASDC = "MSO_PROP_ASDC";
+ public static final String PARAMETER_PATTERN = "asdc-connections";
+ public static final String MSG_BUS_ADDRESS_ATTRIBUTE_NAME = "messageBusAddress";
+ public static final String WATCHDOG_TIMEOUT_NAME = "watchDogTimeout";
+
+ public static final String CONSUMER_GROUP_ATTRIBUTE_NAME = "consumerGroup";
+ public static final String CONSUMER_ID_ATTRIBUTE_NAME = "consumerId";
+ public static final String ENVIRONMENT_NAME_ATTRIBUTE_NAME = "environmentName";
+ public static final String PASSWORD_ATTRIBUTE_NAME = "password";
+ public static final String POLLING_INTERVAL_ATTRIBUTE_NAME = "pollingInterval";
+ public static final String RELEVANT_ARTIFACT_TYPES_ATTRIBUTE_NAME = "relevantArtifactTypes";
+ public static final String USER_ATTRIBUTE_NAME = "user";
+ public static final String ASDC_ADDRESS_ATTRIBUTE_NAME = "asdcAddress";
+ public static final String POLLING_TIMEOUT_ATTRIBUTE_NAME = "pollingTimeout";
+ public static final String ACTIVATE_SERVER_TLS_AUTH = "activateServerTLSAuth";
+ public static final String KEY_STORE_PASSWORD = "keyStorePassword";
+ public static final String KEY_STORE_PATH = "keyStorePath";
+
+ public static final String HEAT="HEAT";
+ public static final String HEAT_ARTIFACT="HEAT_ARTIFACT";
+ public static final String HEAT_ENV="HEAT_ENV";
+ public static final String HEAT_NESTED="HEAT_NESTED";
+ public static final String HEAT_NET="HEAT_NET";
+ public static final String HEAT_VOL="HEAT_VOL";
+ public static final String OTHER="OTHER";
+ public static final String TOSCA_CSAR="TOSCA_CSAR";
+ public static final String VF_MODULES_METADATA="VF_MODULES_METADATA";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC,ASDCConfiguration.class);
+
+
+
+ private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT,
+ HEAT_ARTIFACT,
+ HEAT_ENV,
+ HEAT_NESTED,
+ HEAT_NET,
+ HEAT_VOL,
+ OTHER,
+ TOSCA_CSAR,
+ VF_MODULES_METADATA};
+
+ public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
+
+ @Autowired
+ private Environment env;
+
+ @Value("${mso.asdc.config.key}")
+ private String configKey;
+
+ @Value("${mso.asdc-connections.asdc-controller1.messageBusAddress}")
+ private String[] messageBusAddress;
+
+
+ public void setAsdcControllerName(String asdcControllerName) {
+ this.asdcControllerName = asdcControllerName;
+ }
+
+
+ @Override
+ public java.lang.Boolean isUseHttpsWithDmaap() {
+ return false;
+ }
+
+ @Override
+ public boolean isConsumeProduceStatusTopic(){
+ return true;
+ }
+
+ @Override
+ public List<String> getMsgBusAddress(){
+ if (messageBusAddress.length > 0) {
+ return Arrays.asList(messageBusAddress);
+ } else {
+ return Collections.emptyList();
+ }
+
+
+ }
+
+ public String getAsdcControllerName () {
+ return asdcControllerName;
+ }
+
+
+ @Override
+ public String getConsumerGroup() {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.consumerGroup");
+ }
+
+ public int getWatchDogTimeout () {
+ return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.watchDogTimeout");
+
+ }
+
+ @Override
+ public String getConsumerID () {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.consumerId");
+ }
+
+ public int getIntegerPropertyOrZero (String propertyName) {
+ String property = env.getProperty(propertyName);
+ if (property == null || "NULL".equals(property) || property.isEmpty()) {
+ return 0;
+ } else {
+ try {
+ return Integer.parseInt(property);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+ }
+
+ public String getPropertyOrNull (String propertyName) {
+ String config = env.getProperty(propertyName);
+ if (config==null || "NULL".equals(config) || config.isEmpty()) {
+ return null;
+ } else {
+ return config;
+ }
+ }
+
+ public String getEncryptedPropertyOrNull (String propertyName) {
+ String decryptedKey;
+ String config = env.getProperty(propertyName);
+
+ if (config==null || "NULL".equals(config) || config.isEmpty()) {
+ return null;
+ }
+
+ try {
+ decryptedKey = CryptoUtils.decrypt(config, this.configKey);
+ } catch (GeneralSecurityException e) {
+ msoLogger.debug("Exception while decrypting property: " + propertyName, e);
+ return null;
+ }
+
+ if (decryptedKey.isEmpty ()) {
+ return null;
+ } else {
+ return decryptedKey;
+ }
+ }
+
+ public boolean getBooleanPropertyWithDefault (String propertyName, boolean defaultValue) {
+ String config = env.getProperty(propertyName);
+ if (config == null || "NULL".equals(config) || config.isEmpty()) {
+ return defaultValue;
+ } else {
+ try {
+ return Boolean.valueOf(config);
+ } catch (Exception e) {
+ return defaultValue;
+ }
+ }
+ }
+
+ @Override
+ public String getEnvironmentName () {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.environmentName");
+ }
+
+ @Override
+ public String getPassword () {
+ return getEncryptedPropertyOrNull("mso.asdc-connections.asdc-controller1.password");
+ }
+
+ @Override
+ public int getPollingInterval () {
+ return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.pollingInterval");
+ }
+
+ @Override
+ public List <String> getRelevantArtifactTypes () {
+ // DO not return the Static List SUPPORTED_ARTIFACT_TYPES_LIST because the ASDC Client will try to modify it !!!
+ return Arrays.asList(SUPPORTED_ARTIFACT_TYPES);
+ }
+
+ @Override
+ public String getUser () {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.user");
+ }
+
+ @Override
+ public String getAsdcAddress () {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.asdcAddress");
+ }
+
+ @Override
+ public int getPollingTimeout () {
+ return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.pollingTimeout");
+ }
+
+ @Override
+ public boolean activateServerTLSAuth() {
+ return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.activateServerTLSAuth", true);
+ }
+
+ @Override
+ public String getKeyStorePassword() {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.keyStorePassword");
+ }
+
+ @Override
+ public String getKeyStorePath() {
+ return getPropertyOrNull("mso.asdc-connections.asdc-controller1.keyStorePath");
+ }
+
+ /**
+ * The flag allows the client to receive metadata for all resources of the service regardless of the artifacts associated to them.
+ * Setting the flag to false will preserve legacy behavior.
+ */
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.isFilterInEmptyResources", true);
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
similarity index 64%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 867efd5..7423a7a 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -1,915 +1,776 @@
-/*-
-d * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client;
-
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.consumer.IDistributionStatusMessage;
-import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
-import org.onap.sdc.api.consumer.INotificationCallback;
-import org.onap.sdc.api.consumer.IStatusCallback;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.notification.IStatusData;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.impl.DistributionClientFactory;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-import org.onap.sdc.utils.DistributionStatusEnum;
-import org.openecomp.mso.asdc.client.exceptions.ASDCControllerException;
-import org.openecomp.mso.asdc.client.exceptions.ASDCDownloadException;
-import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.installer.IVfResourceInstaller;
-import org.openecomp.mso.asdc.installer.ToscaResourceStructure;
-import org.openecomp.mso.asdc.installer.VfResourceStructure;
-import org.openecomp.mso.asdc.installer.heat.ToscaResourceInstaller;
-import org.openecomp.mso.asdc.installer.heat.VfResourceInstaller;
-import org.openecomp.mso.asdc.tenantIsolation.DistributionStatus;
-import org.openecomp.mso.asdc.tenantIsolation.WatchdogDistribution;
-import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.requestsdb.WatchdogDistributionStatusDb;
-import org.openecomp.mso.utils.UUIDChecker;
-
-public class ASDCController {
-
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
- protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
-
- protected boolean isAsdcClientAutoManaged = false;
-
- protected String controllerName;
-
- protected ToscaResourceInstaller toscaInstaller;
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
-
- private final class ResourceInstance implements IResourceInstance {
-
- @Override
- public String getResourceInstanceName(){
- return new String();
- }
-
- @Override
- public String getResourceName(){
- return new String();
- }
-
- @Override
- public String getResourceVersion(){
- return new String();
- }
-
- @Override
- public String getResourceType(){
- return new String();
- }
-
- @Override
- public String getResourceUUID(){
- return new String();
- }
-
- // Method descriptor #10 ()Ljava/util/List;
- @Override
- public java.util.List getArtifacts(){
- return new ArrayList();
- }
-
- @Override
- public String getResourceInvariantUUID(){
- return new String();
- }
-
- @Override
- public String getResourceCustomizationUUID(){
- return new String();
- }
-
- @Override
- public String getCategory(){
- return new String();
- }
-
- @Override
- public String getSubcategory(){
- return new String();
- }
-
- }
-
- private final class ASDCStatusCallBack implements IStatusCallback {
-
- @Override
- public void activateCallback (IStatusData iStatus) {
-
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (LOGGER);
- MsoLogger.setServiceName ("ASDCStatusCallBack");
- MsoLogger.setLogContext (iStatus.getDistributionID (), iStatus.getComponentName());
- String event = "Receive a callback componentStatus in ASDC, for componentName: " + iStatus.getComponentName() + " and status of " + iStatus.getStatus() + " distributionID of " + iStatus.getDistributionID() +
- " consumerID of " + iStatus.getConsumerID() + " errorReason of " + iStatus.getErrorReason();
-
- try{
-
- if (iStatus.getStatus() == DistributionStatusEnum.COMPONENT_DONE_OK ||
- iStatus.getStatus() == DistributionStatusEnum.COMPONENT_DONE_ERROR) {
-
- LOGGER.debug(event);
-
- toscaInstaller.installTheComponentStatus(iStatus);
-
- }
-
- }catch(ArtifactInstallerException e){
- System.out.println("Error in ASDCStatusCallback " + e.getMessage());
- LOGGER.debug("Error in ASDCStatusCallback " + e.getMessage());
- }
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the Status Call Back");
- }
-
- }
-
-
- /**
- * Inner class for Notification callback
- *
- *
- */
- private final class ASDCNotificationCallBack implements INotificationCallback {
-
- private ASDCController asdcController;
-
- ASDCNotificationCallBack (ASDCController controller) {
- asdcController = controller;
- }
-
- /**
- * This method can be called multiple times at the same moment.
- * The controller must be thread safe !
- */
- @Override
- public void activateCallback (INotificationData iNotif) {
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (LOGGER);
- MsoLogger.setServiceName ("NotificationHandler");
- MsoLogger.setLogContext (iNotif.getDistributionID (), iNotif.getServiceUUID ());
- String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources ().size ();
- LOGGER.debug(event);
- asdcController.treatNotification (iNotif);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
- }
- }
-
-
- // ***** Controller STATUS code
-
- protected int nbOfNotificationsOngoing = 0;
-
- public int getNbOfNotificationsOngoing () {
- return nbOfNotificationsOngoing;
- }
-
- private ASDCControllerStatus controllerStatus = ASDCControllerStatus.STOPPED;
-
- protected synchronized final void changeControllerStatus (ASDCControllerStatus newControllerStatus) {
- switch (newControllerStatus) {
-
- case BUSY:
- ++this.nbOfNotificationsOngoing;
- this.controllerStatus = newControllerStatus;
- break;
-
- case IDLE:
- if (this.nbOfNotificationsOngoing > 1) {
- --this.nbOfNotificationsOngoing;
- } else {
- this.nbOfNotificationsOngoing = 0;
- this.controllerStatus = newControllerStatus;
- }
-
- break;
- default:
- this.controllerStatus = newControllerStatus;
- break;
-
- }
- }
-
- public synchronized final ASDCControllerStatus getControllerStatus () {
- return this.controllerStatus;
- }
-
- // ***** END of Controller STATUS code
- protected ASDCConfiguration asdcConfig;
- private IDistributionClient distributionClient;
- private IVfResourceInstaller resourceInstaller;
-
- public ASDCController (String controllerConfigName) {
- isAsdcClientAutoManaged = true;
- this.controllerName = controllerConfigName;
- this.resourceInstaller = new VfResourceInstaller();
- toscaInstaller = new ToscaResourceInstaller();
- }
-
- public ASDCController (String controllerConfigName, IDistributionClient asdcClient, IVfResourceInstaller resourceinstaller) {
-
- distributionClient = asdcClient;
- this.resourceInstaller = resourceinstaller;
- this.controllerName = controllerConfigName;
- }
-
- public ASDCController (String controllerConfigName,IDistributionClient asdcClient) {
- distributionClient = asdcClient;
- this.controllerName = controllerConfigName;
- this.resourceInstaller = new VfResourceInstaller();
- toscaInstaller = new ToscaResourceInstaller();
- }
-
- /**
- * This method refresh the ASDC Controller config and restart the client.
- *
- * @return true if config has been reloaded, false otherwise
- * @throws ASDCControllerException If case of issue with the init or close called during the config reload
- * @throws ASDCParametersException If there is an issue with the parameters
- * @throws IOException In case of the key file could not be loaded properly
- */
- public boolean updateConfigIfNeeded () throws ASDCParametersException, ASDCControllerException, IOException {
- LOGGER.debug ("Checking whether ASDC config must be reloaded");
-
- try {
- if (this.asdcConfig != null && this.asdcConfig.hasASDCConfigChanged ()) {
- LOGGER.debug ("ASDC Config must be reloaded");
- this.closeASDC ();
- this.asdcConfig.refreshASDCConfig ();
- this.initASDC ();
- return true;
- } else {
- LOGGER.debug ("ASDC Config must NOT be reloaded");
- return false;
- }
- } catch (ASDCParametersException ep) {
- // Try to close it at least to make it consistent with the file specified
- // We cannot let it run with a different config file, even if it's bad.
- // This call could potentially throw a ASDCController exception if the controller is currently BUSY.
- this.closeASDC ();
-
- throw ep;
- }
- }
-
- /**
- * This method initializes the ASDC Controller and the ASDC Client.
- *
- * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be instantiated or if an init
- * attempt is done when already initialized
- * @throws ASDCParametersException If there is an issue with the parameters provided
- * @throws IOException In case of issues when trying to load the key file
- */
- public void initASDC () throws ASDCControllerException, ASDCParametersException, IOException {
- String event = "Initialize the ASDC Controller";
- MsoLogger.setServiceName ("InitASDC");
- LOGGER.debug (event);
- if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) {
- String endEvent = "The controller is already initialized, call the closeASDC method first";
- throw new ASDCControllerException (endEvent);
- }
-
- if (asdcConfig == null) {
- asdcConfig = new ASDCConfiguration (this.controllerName);
-
- }
- // attempt to refresh during init as MsoProperties is may be pointing to an old file
- // Be careful this is static in MsoProperties
- asdcConfig.refreshASDCConfig ();
-
- if (this.distributionClient == null) {
- distributionClient = DistributionClientFactory.createDistributionClient ();
- }
- long initStartTime = System.currentTimeMillis ();
- IDistributionClientResult result = this.distributionClient.init (asdcConfig,
- new ASDCNotificationCallBack (this), new ASDCStatusCallBack());
- if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
- String endEvent = "ASDC distribution client init failed with reason:"
- + result.getDistributionMessageResult ();
- LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Initialization of the ASDC Controller failed with reason:" + result.getDistributionMessageResult (), "ASDC", "init", null);
- LOGGER.debug (endEvent);
- asdcConfig = null;
-
- this.changeControllerStatus (ASDCControllerStatus.STOPPED);
- throw new ASDCControllerException ("Initialization of the ASDC Controller failed with reason: "
- + result.getDistributionMessageResult ());
- }
- LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully initialize ASDC Controller", "ASDC", "init", null);
-
- long clientstartStartTime = System.currentTimeMillis ();
- result = this.distributionClient.start ();
- if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
- String endEvent = "ASDC distribution client start failed with reason:"
- + result.getDistributionMessageResult ();
- LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, endEvent, "ASDC", "start", null);
- LOGGER.debug (endEvent);
- asdcConfig = null;
- this.changeControllerStatus (ASDCControllerStatus.STOPPED);
- throw new ASDCControllerException ("Startup of the ASDC Controller failed with reason: "
- + result.getDistributionMessageResult ());
- }
- LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully start ASDC distribution client", "ASDC", "start", null);
-
-
- this.changeControllerStatus (ASDCControllerStatus.IDLE);
- LOGGER.info (MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC, "ASDC", "changeControllerStatus");
- }
-
- /**
- * This method closes the ASDC Controller and the ASDC Client.
- *
- * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be closed because
- * it's currently BUSY in processing notifications.
- */
- public void closeASDC () throws ASDCControllerException {
-
- MsoLogger.setServiceName ("CloseController");
- if (this.getControllerStatus () == ASDCControllerStatus.BUSY) {
- throw new ASDCControllerException ("Cannot close the ASDC controller as it's currently in BUSY state");
- }
- if (this.distributionClient != null) {
- this.distributionClient.stop ();
- // If auto managed we can set it to Null, ASDCController controls it.
- // In the other case the client of this class has specified it, so we can't reset it
- if (isAsdcClientAutoManaged) {
- // Next init will initialize it with a new ASDC Client
- this.distributionClient = null;
- }
-
- }
- this.changeControllerStatus (ASDCControllerStatus.STOPPED);
- }
-
- private boolean checkResourceAlreadyDeployed (VfResourceStructure resource) throws ArtifactInstallerException {
-
-
- if (toscaInstaller.isResourceAlreadyDeployed (resource)) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST,
- resource.getResourceInstance().getResourceInstanceName(),
- resource.getResourceInstance().getResourceUUID(),
- resource.getResourceInstance().getResourceName(), "", "");
-
- this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
- this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
-
- return true;
- } else {
- return false;
- }
- }
-
- private final static String UUID_PARAM = "(UUID:";
-
- private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
- String distributionId) throws ASDCDownloadException {
-
- LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")");
- IDistributionClientDownloadResult downloadResult;
-
-
- try {
- downloadResult = distributionClient.download (artifact);
- if (null == downloadResult) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_NULL, artifact.getArtifactUUID (), "", "");
- return downloadResult;
- }
- } catch (RuntimeException e) {
- LOGGER.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
- this.sendASDCNotification (NotificationType.DOWNLOAD,
- artifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- distributionId,
- DistributionStatusEnum.DOWNLOAD_ERROR,
- e.getMessage (),
- System.currentTimeMillis ());
-
- throw new ASDCDownloadException ("Exception caught when downloading the artifact", e);
- }
-
- if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult ())) {
-
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC,
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- String.valueOf (downloadResult.getArtifactPayload ().length), "", "");
-
- } else {
-
- LOGGER.error (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- downloadResult.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC artifact download fail");
-
- this.sendASDCNotification (NotificationType.DOWNLOAD,
- artifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- distributionId,
- DistributionStatusEnum.DOWNLOAD_ERROR,
- downloadResult.getDistributionMessageResult (),
- System.currentTimeMillis ());
-
- throw new ASDCDownloadException ("Artifact " + artifact.getArtifactName ()
- + " could not be downloaded from ASDC URL "
- + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")"
- + System.lineSeparator ()
- + "Error message is "
- + downloadResult.getDistributionMessageResult ()
- + System.lineSeparator ());
-
- }
-
- this.sendASDCNotification (NotificationType.DOWNLOAD,
- artifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- distributionId,
- DistributionStatusEnum.DOWNLOAD_OK,
- null,
- System.currentTimeMillis ());
- return downloadResult;
-
- }
-
- private void writeArtifactToFile (IArtifactInfo artifact,
- IDistributionClientDownloadResult resultArtifact) throws ASDCDownloadException {
-
- LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")");
-
- File spoolFile = new File(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName());
-
-
- byte[] payloadBytes = resultArtifact.getArtifactPayload();
-
- try {
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
-
- try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) {
- outFile.write(payloadBytes, 0, payloadBytes.length);
- }
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed");
- }
-
- }
-
-
- private void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) {
-
- for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) {
-
- if ((DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) && !artifactInfo.getArtifactType().equalsIgnoreCase("OTHER"))
- // This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP
- && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null
- && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()).getDeployedInDb() == 0) {
- this.sendASDCNotification (NotificationType.DEPLOY,
- artifactInfo.getArtifactURL (),
- asdcConfig.getConsumerID (),
- vfResourceStructure.getNotification().getDistributionID(),
- DistributionStatusEnum.DEPLOY_ERROR,
- "The artifact has not been used by the modules defined in the resource",
- System.currentTimeMillis ());
- } else {
- this.sendASDCNotification (NotificationType.DEPLOY,
- artifactInfo.getArtifactURL (),
- asdcConfig.getConsumerID (),
- vfResourceStructure.getNotification().getDistributionID(),
- distribStatus,
- errorReason,
- System.currentTimeMillis ());
- }
- }
- }
-
- private void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) {
-
- IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact();
-
- if(deploySuccessful){
-
- this.sendASDCNotification (NotificationType.DEPLOY,
- csarArtifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- resourceStructure.getNotification().getDistributionID(),
- DistributionStatusEnum.DEPLOY_OK,
- errorReason,
- System.currentTimeMillis ());
-
- } else {
-
- this.sendASDCNotification (NotificationType.DEPLOY,
- csarArtifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- resourceStructure.getNotification().getDistributionID(),
- DistributionStatusEnum.DEPLOY_ERROR,
- errorReason,
- System.currentTimeMillis ());
-
- }
- }
-
- private void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
-
- LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC", "deployResourceStructure");
- try {
- String resourceType = resourceStructure.getResourceInstance().getResourceType();
- String category = resourceStructure.getResourceInstance().getCategory();
- if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
- resourceStructure.createVfModuleStructures();
- }
-
-
- toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
-
-
- } catch (ArtifactInstallerException e) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
- sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage());
- throw e;
- }
-
- if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC,
- resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
- sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null);
- }
-
- }
-
-
- private enum NotificationType {
- DOWNLOAD, DEPLOY
- }
-
- private void sendASDCNotification (NotificationType notificationType,
- String artifactURL,
- String consumerID,
- String distributionID,
- DistributionStatusEnum status,
- String errorReason,
- long timestamp) {
-
- String event = "Sending " + notificationType.name ()
- + "("
- + status.name ()
- + ")"
- + " notification to ASDC for artifact:"
- + artifactURL;
-
- if (errorReason != null) {
- event=event+"("+errorReason+")";
- }
- LOGGER.info (MessageEnum.ASDC_SEND_NOTIF_ASDC, notificationType.name (), status.name (), artifactURL, "ASDC", "sendASDCNotification");
- LOGGER.debug (event);
-
- long subStarttime = System.currentTimeMillis ();
- String action = "";
- try {
- IDistributionStatusMessage message = new DistributionStatusMessage (artifactURL,
- consumerID,
- distributionID,
- status,
- timestamp);
-
- switch (notificationType) {
- case DOWNLOAD:
- if (errorReason != null) {
- this.distributionClient.sendDownloadStatus (message, errorReason);
- } else {
- this.distributionClient.sendDownloadStatus (message);
- }
- action = "sendDownloadStatus";
- break;
- case DEPLOY:
- if (errorReason != null) {
- this.distributionClient.sendDeploymentStatus (message, errorReason);
- } else {
- this.distributionClient.sendDeploymentStatus (message);
- }
- action = "sendDeploymentdStatus";
- break;
- default:
- break;
- }
- } catch (RuntimeException e) {
- // TODO: May be a list containing the unsent notification should be
- // kept
- LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
- }
- LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null);
- }
-
- private void sendFinalDistributionStatus (
- String distributionID,
- DistributionStatusEnum status,
- String errorReason) {
-
-
- LOGGER.debug ("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status.name() + " and ErrorReason " + errorReason);
-
- long subStarttime = System.currentTimeMillis ();
- try {
-
-
- IFinalDistrStatusMessage finalDistribution = new FinalDistributionStatusMessage(distributionID,status,subStarttime, asdcConfig.getConsumerID());
-
- if(errorReason == null){
- this.distributionClient.sendFinalDistrStatus(finalDistribution);
- }else{
- this.distributionClient.sendFinalDistrStatus(finalDistribution, errorReason);
- }
-
-
- } catch (RuntimeException e) {
- // TODO: May be a list containing the unsent notification should be
- // kept
- LOGGER.debug ("Exception caught in sendFinalDistributionStatus " + e.getMessage());
- LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
- }
- LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent Final notification to ASDC", "ASDC", null, null);
- }
-
- public void treatNotification (INotificationData iNotif) {
-
- int noOfArtifacts = 0;
- WatchdogDistribution wd = new WatchdogDistribution();
-
- for (IResourceInstance resource : iNotif.getResources ()) {
- noOfArtifacts += resource.getArtifacts ().size ();
- }
- LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF,
- String.valueOf (noOfArtifacts),
- iNotif.getServiceUUID (), "ASDC", "treatNotification");
-
- try {
- LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification");
- this.changeControllerStatus(ASDCControllerStatus.BUSY);
-
-
-
- // Process only the Resource artifacts in MSO
- for (IResourceInstance resource : iNotif.getResources()) {
-
- // We process only VNF(VF), Network(VL) and PNF resources on MSO Side
- //if ("VF".equals(resource.getResourceType()) || "VL".equals(resource.getResourceType()) || "PNF".equals(resource.getResourceType())){
- this.processResourceNotification(iNotif,resource);
- //}
-
- }
-
- //Handle services without any resources
- if (iNotif.getResources() == null || iNotif.getResources().size() < 1){
-
- this.processResourceNotification(iNotif, new ResourceInstance());
- }
-
- //********************************************************************************************************
- //Start Watchdog loop and wait for all components to complete before reporting final status back.
- // **If timer expires first then we will report a Distribution Error back to ASDC
- //********************************************************************************************************
- long initialStartTime = System.currentTimeMillis();
- boolean componentsComplete = false;
- String distributionStatus = null;
- String watchdogError = null;
- String overallStatus = null;
- int watchDogTimeout = asdcConfig.getWatchDogTimeout() * 1000;
- boolean isDeploySuccess = false;
- WatchdogDistributionStatusDb wdDistributionStatus = WatchdogDistributionStatusDb.getInstance();
-
-
- while(componentsComplete == false && (System.currentTimeMillis() - initialStartTime) < watchDogTimeout)
- {
-
- try{
-
- distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
- Thread.sleep(watchDogTimeout / 10);
-
- }catch(Exception e){
- LOGGER.debug ("Exception in Watchdog Loop " + e.getMessage());
- Thread.sleep(watchDogTimeout / 10);
- }
-
- if(distributionStatus != null && !distributionStatus.equalsIgnoreCase(DistributionStatus.INCOMPLETE.name())){
-
- if(distributionStatus.equalsIgnoreCase(DistributionStatus.SUCCESS.name())){
- isDeploySuccess = true;
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.name();
- }else{
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- }
-
- componentsComplete = true;
- }
- }
-
- if(componentsComplete == false){
- LOGGER.debug("Timeout of " + watchDogTimeout + " seconds was reached before all components reported status");
- watchdogError = "Timeout occurred while waiting for all components to report status";
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- }
-
- if(distributionStatus == null){
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- LOGGER.debug("DistributionStatus is null for DistributionId: " + iNotif.getDistributionID());
-
- }
-
- try {
- wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus);
- LOGGER.debug ("A&AI Updated succefully with Distribution Status!");
- }
- catch(Exception e) {
- LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e.getMessage());
- watchdogError = "Error calling A&AI " + e.getMessage();
- if(e.getCause() != null) {
- LOGGER.debug ("Exception caused by: " + e.getCause().getMessage());
- }
- }
-
-
- if(isDeploySuccess && watchdogError == null){
- sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK, null);
- wdDistributionStatus.updateWatchdogDistributionIdStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.name());
- } else {
- sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, watchdogError);
- wdDistributionStatus.updateWatchdogDistributionIdStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
- }
-
-
-
- } catch (Exception e) {
- LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification",
- e);
-
- sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, e.getMessage());
-
- } finally {
- this.changeControllerStatus (ASDCControllerStatus.IDLE);
- }
- }
-
-
- private void processResourceNotification (INotificationData iNotif,IResourceInstance resource) {
- // For each artifact, create a structure describing the VFModule in a ordered flat level
- VfResourceStructure resourceStructure = new VfResourceStructure(iNotif,resource);
- ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();
- boolean deploySuccessful = true;
- String errorMessage = null;
-
- try {
-
- if (!this.checkResourceAlreadyDeployed(resourceStructure)) {
- for (IArtifactInfo artifact : resource.getArtifacts()) {
-
- IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,
- iNotif.getDistributionID());
-
- if (resultArtifact != null) {
- if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
- LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8"));
- LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
- }
- resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
-
- }
-
- }
- this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
-
- try{
-
- this.deployResourceStructure(resourceStructure, toscaResourceStructure);
-
- } catch(ArtifactInstallerException e){
- deploySuccessful = false;
- errorMessage = e.getMessage();
- }
-
- this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage);
-
-
-
- }
- } catch (ArtifactInstallerException | ASDCDownloadException | UnsupportedEncodingException e) {
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
- }
- }
-
- private void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
-
- List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
-
- for(IArtifactInfo artifact : serviceArtifacts){
-
- if(artifact.getArtifactType().equals(ASDCConfiguration.TOSCA_CSAR)){
-
- try{
-
- toscaResourceStructure.setToscaArtifact(artifact);
-
- IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,iNotif.getDistributionID());
-
- writeArtifactToFile(artifact, resultArtifact);
-
- toscaResourceStructure.updateResourceStructure(artifact);
-
- toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
-
- LOGGER.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
-
-
- } catch(Exception e){
- System.out.println("Whats the error " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e);
- }
- }
-
- }
- }
-
- private static final String UNKNOWN="Unknown";
-
- /**
- * @return the address of the ASDC we are connected to.
- */
- public String getAddress () {
- if (asdcConfig != null) {
- return asdcConfig.getAsdcAddress ();
- }
- return UNKNOWN;
- }
-
- /**
- * @return the environment name of the ASDC we are connected to.
- */
- public String getEnvironment () {
- if (asdcConfig != null) {
- return asdcConfig.getEnvironmentName ();
- }
- return UNKNOWN;
- }
-
-}
+/*-
+d * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client;
+
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.onap.so.asdc.client.exceptions.ASDCDownloadException;
+import org.onap.so.asdc.client.exceptions.ASDCParametersException;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.installer.IVfResourceInstaller;
+import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
+import org.onap.so.asdc.tenantIsolation.DistributionStatus;
+import org.onap.so.asdc.tenantIsolation.WatchdogDistribution;
+import org.onap.so.asdc.util.ASDCNotificationLogging;
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ASDCController {
+
+ protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCController.class);
+
+ protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
+ protected boolean isAsdcClientAutoManaged = false;
+
+ protected String controllerName;
+
+ private ASDCControllerStatus controllerStatus = ASDCControllerStatus.STOPPED;
+
+ protected int nbOfNotificationsOngoing = 0;
+
+ @Autowired
+ private ToscaResourceInstaller toscaInstaller;
+
+ @Autowired
+ private WatchdogDistributionStatusRepository wdsRepo;
+
+ @Autowired
+ private ASDCConfiguration asdcConfig;
+
+ @Autowired
+ private ASDCStatusCallBack asdcStatusCallBack;
+
+ @Autowired
+ private ASDCNotificationCallBack asdcNotificationCallBack;
+
+ private IDistributionClient distributionClient;
+
+ private static final String UUID_PARAM = "(UUID:";
+
+ @Autowired
+ private WatchdogDistribution wd;
+
+
+ public int getNbOfNotificationsOngoing () {
+ return nbOfNotificationsOngoing;
+ }
+
+ public IDistributionClient getDistributionClient() {
+ return distributionClient;
+ }
+
+
+
+ public void setDistributionClient(IDistributionClient distributionClient) {
+ this.distributionClient = distributionClient;
+ }
+
+
+
+ protected void changeControllerStatus (ASDCControllerStatus newControllerStatus) {
+ switch (newControllerStatus) {
+
+ case BUSY:
+ ++this.nbOfNotificationsOngoing;
+ this.controllerStatus = newControllerStatus;
+ break;
+
+ case IDLE:
+ if (this.nbOfNotificationsOngoing > 1) {
+ --this.nbOfNotificationsOngoing;
+ } else {
+ this.nbOfNotificationsOngoing = 0;
+ this.controllerStatus = newControllerStatus;
+ }
+
+ break;
+ default:
+ this.controllerStatus = newControllerStatus;
+ break;
+
+ }
+ }
+
+ public ASDCControllerStatus getControllerStatus () {
+ return this.controllerStatus;
+ }
+
+ public ASDCController () {
+ isAsdcClientAutoManaged = true;
+ }
+
+ public ASDCController (String controllerConfigName) {
+ isAsdcClientAutoManaged = true;
+ this.controllerName = controllerConfigName;
+ }
+
+ public ASDCController (String controllerConfigName, IDistributionClient asdcClient, IVfResourceInstaller resourceinstaller) {
+ distributionClient = asdcClient;
+ }
+
+ public ASDCController (String controllerConfigName,IDistributionClient asdcClient) {
+ distributionClient = asdcClient;
+ this.controllerName = controllerConfigName;
+ }
+ public String getControllerName() {
+ return controllerName;
+ }
+
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+
+ /**
+ * This method initializes the ASDC Controller and the ASDC Client.
+ *
+ * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be instantiated or if an init
+ * attempt is done when already initialized
+ * @throws ASDCParametersException If there is an issue with the parameters provided
+ * @throws IOException In case of issues when trying to load the key file
+ */
+ public void initASDC () throws ASDCControllerException {
+ String event = "Initialize the ASDC Controller";
+ MsoLogger.setServiceName ("InitASDC");
+ LOGGER.debug (event);
+ if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) {
+ String endEvent = "The controller is already initialized, call the closeASDC method first";
+ throw new ASDCControllerException (endEvent);
+ }
+
+ if (asdcConfig != null) {
+ asdcConfig.setAsdcControllerName(controllerName);
+ }
+
+ if (this.distributionClient == null) {
+ distributionClient = DistributionClientFactory.createDistributionClient ();
+ }
+
+ long initStartTime = System.currentTimeMillis ();
+ IDistributionClientResult result = this.distributionClient.init (asdcConfig,
+ asdcNotificationCallBack, asdcStatusCallBack);
+ if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
+ String endEvent = "ASDC distribution client init failed with reason:"
+ + result.getDistributionMessageResult ();
+ LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Initialization of the ASDC Controller failed with reason:" + result.getDistributionMessageResult (), "ASDC", "init", null);
+ LOGGER.debug (endEvent);
+ this.changeControllerStatus (ASDCControllerStatus.STOPPED);
+ throw new ASDCControllerException ("Initialization of the ASDC Controller failed with reason: "
+ + result.getDistributionMessageResult ());
+ }
+ LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully initialize ASDC Controller", "ASDC", "init", null);
+
+ long clientstartStartTime = System.currentTimeMillis ();
+ result = this.distributionClient.start ();
+ if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
+ String endEvent = "ASDC distribution client start failed with reason:"
+ + result.getDistributionMessageResult ();
+ LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, endEvent, "ASDC", "start", null);
+ LOGGER.debug (endEvent);
+ this.changeControllerStatus (ASDCControllerStatus.STOPPED);
+ throw new ASDCControllerException ("Startup of the ASDC Controller failed with reason: "
+ + result.getDistributionMessageResult ());
+ }
+ LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully start ASDC distribution client", "ASDC", "start", null);
+
+
+ this.changeControllerStatus (ASDCControllerStatus.IDLE);
+ LOGGER.info (MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC, "ASDC", "changeControllerStatus","");
+ }
+
+ /**
+ * This method closes the ASDC Controller and the ASDC Client.
+ *
+ * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be closed because
+ * it's currently BUSY in processing notifications.
+ */
+ public void closeASDC () throws ASDCControllerException {
+
+ MsoLogger.setServiceName ("CloseController");
+ if (this.getControllerStatus () == ASDCControllerStatus.BUSY) {
+ throw new ASDCControllerException ("Cannot close the ASDC controller as it's currently in BUSY state");
+ }
+ if (this.distributionClient != null) {
+ this.distributionClient.stop ();
+ // If auto managed we can set it to Null, ASDCController controls it.
+ // In the other case the client of this class has specified it, so we can't reset it
+ if (isAsdcClientAutoManaged) {
+ // Next init will initialize it with a new ASDC Client
+ this.distributionClient = null;
+ }
+
+ }
+ this.changeControllerStatus (ASDCControllerStatus.STOPPED);
+ }
+
+ private boolean checkResourceAlreadyDeployed (VfResourceStructure resource) throws ArtifactInstallerException {
+
+
+ if (toscaInstaller.isResourceAlreadyDeployed (resource)) {
+ LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST,
+ resource.getResourceInstance().getResourceInstanceName(),
+ resource.getResourceInstance().getResourceUUID(),
+ resource.getResourceInstance().getResourceName(), "", "");
+
+ this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
+ this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+
+ private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
+ String distributionId) throws ASDCDownloadException {
+
+ LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL ()
+ + UUID_PARAM
+ + artifact.getArtifactUUID ()
+ + ")");
+ IDistributionClientDownloadResult downloadResult;
+
+
+ try {
+ downloadResult = distributionClient.download (artifact);
+ if (null == downloadResult) {
+ LOGGER.info (MessageEnum.ASDC_ARTIFACT_NULL, artifact.getArtifactUUID (), "", "");
+ return downloadResult;
+ }
+ } catch (RuntimeException e) {
+ LOGGER.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
+ this.sendASDCNotification (NotificationType.DOWNLOAD,
+ artifact.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ distributionId,
+ DistributionStatusEnum.DOWNLOAD_ERROR,
+ e.getMessage (),
+ System.currentTimeMillis ());
+
+ throw new ASDCDownloadException ("Exception caught when downloading the artifact", e);
+ }
+
+ if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult ())) {
+
+ LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC,
+ artifact.getArtifactURL (),
+ artifact.getArtifactUUID (),
+ String.valueOf (downloadResult.getArtifactPayload ().length), "", "");
+
+ } else {
+
+ LOGGER.error (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ artifact.getArtifactName (),
+ artifact.getArtifactURL (),
+ artifact.getArtifactUUID (),
+ downloadResult.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC artifact download fail");
+
+ this.sendASDCNotification (NotificationType.DOWNLOAD,
+ artifact.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ distributionId,
+ DistributionStatusEnum.DOWNLOAD_ERROR,
+ downloadResult.getDistributionMessageResult (),
+ System.currentTimeMillis ());
+
+ throw new ASDCDownloadException ("Artifact " + artifact.getArtifactName ()
+ + " could not be downloaded from ASDC URL "
+ + artifact.getArtifactURL ()
+ + UUID_PARAM
+ + artifact.getArtifactUUID ()
+ + ")"
+ + System.lineSeparator ()
+ + "Error message is "
+ + downloadResult.getDistributionMessageResult ()
+ + System.lineSeparator ());
+
+ }
+
+ this.sendASDCNotification (NotificationType.DOWNLOAD,
+ artifact.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ distributionId,
+ DistributionStatusEnum.DOWNLOAD_OK,
+ null,
+ System.currentTimeMillis ());
+ return downloadResult;
+
+ }
+
+ private void writeArtifactToFile (IArtifactInfo artifact,
+ IDistributionClientDownloadResult resultArtifact) {
+
+ LOGGER.debug ("Trying to write artifact to file : " + artifact.getArtifactURL ()
+ + UUID_PARAM
+ + artifact.getArtifactUUID ()
+ + ")");
+
+ byte[] payloadBytes = resultArtifact.getArtifactPayload();
+
+ try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) {
+ LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
+ outFile.write(payloadBytes, 0, payloadBytes.length);
+ outFile.close();
+ } catch (Exception e) {
+ LOGGER.debug("Exception :",e);
+ LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ artifact.getArtifactName (),
+ artifact.getArtifactURL (),
+ artifact.getArtifactUUID (),
+ resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed");
+ }
+
+ }
+
+
+ private void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) {
+
+ for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) {
+
+ if ((DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) && !artifactInfo.getArtifactType().equalsIgnoreCase("OTHER") && !vfResourceStructure.isAlreadyDeployed())
+ // This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP
+ && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null
+ && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()).getDeployedInDb() == 0) {
+ this.sendASDCNotification (NotificationType.DEPLOY,
+ artifactInfo.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ vfResourceStructure.getNotification().getDistributionID(),
+ DistributionStatusEnum.DEPLOY_ERROR,
+ "The artifact has not been used by the modules defined in the resource",
+ System.currentTimeMillis ());
+ } else {
+ this.sendASDCNotification (NotificationType.DEPLOY,
+ artifactInfo.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ vfResourceStructure.getNotification().getDistributionID(),
+ distribStatus,
+ errorReason,
+ System.currentTimeMillis ());
+ }
+ }
+ }
+
+ private void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) {
+
+ IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact();
+
+ if(deploySuccessful){
+
+ this.sendASDCNotification (NotificationType.DEPLOY,
+ csarArtifact.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ resourceStructure.getNotification().getDistributionID(),
+ DistributionStatusEnum.DEPLOY_OK,
+ errorReason,
+ System.currentTimeMillis ());
+
+ } else {
+
+ this.sendASDCNotification (NotificationType.DEPLOY,
+ csarArtifact.getArtifactURL (),
+ asdcConfig.getConsumerID (),
+ resourceStructure.getNotification().getDistributionID(),
+ DistributionStatusEnum.DEPLOY_ERROR,
+ errorReason,
+ System.currentTimeMillis ());
+
+ }
+ }
+
+ private void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
+
+ LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
+ try {
+ String resourceType = resourceStructure.getResourceInstance().getResourceType();
+ String category = resourceStructure.getResourceInstance().getCategory();
+ if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
+ resourceStructure.createVfModuleStructures();
+ }
+ toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
+
+ } catch (ArtifactInstallerException e) {
+ LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ resourceStructure.getResourceInstance().getResourceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(),
+ String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage());
+ throw e;
+ }
+
+ if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
+ LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC,
+ resourceStructure.getResourceInstance().getResourceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(),
+ String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null);
+ }
+
+ }
+
+
+ private enum NotificationType {
+ DOWNLOAD, DEPLOY
+ }
+
+ private void sendASDCNotification (NotificationType notificationType,
+ String artifactURL,
+ String consumerID,
+ String distributionID,
+ DistributionStatusEnum status,
+ String errorReason,
+ long timestamp) {
+
+ String event = "Sending " + notificationType.name ()
+ + "("
+ + status.name ()
+ + ")"
+ + " notification to ASDC for artifact:"
+ + artifactURL;
+
+ if (errorReason != null) {
+ event=event+"("+errorReason+")";
+ }
+ LOGGER.info (MessageEnum.ASDC_SEND_NOTIF_ASDC, notificationType.name (), status.name (), artifactURL, "ASDC", "sendASDCNotification");
+ LOGGER.debug (event);
+
+ long subStarttime = System.currentTimeMillis ();
+ String action = "";
+ try {
+ IDistributionStatusMessage message = new DistributionStatusMessage (artifactURL,
+ consumerID,
+ distributionID,
+ status,
+ timestamp);
+
+ switch (notificationType) {
+ case DOWNLOAD:
+ if (errorReason != null) {
+ this.distributionClient.sendDownloadStatus (message, errorReason);
+ } else {
+ this.distributionClient.sendDownloadStatus (message);
+ }
+ action = "sendDownloadStatus";
+ break;
+ case DEPLOY:
+ if (errorReason != null) {
+ this.distributionClient.sendDeploymentStatus (message, errorReason);
+ } else {
+ this.distributionClient.sendDeploymentStatus (message);
+ }
+ action = "sendDeploymentdStatus";
+ break;
+ default:
+ break;
+ }
+ } catch (RuntimeException e) {
+ LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
+ }
+ LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null);
+ }
+
+ private void sendFinalDistributionStatus (
+ String distributionID,
+ DistributionStatusEnum status,
+ String errorReason) {
+
+
+ LOGGER.debug ("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status.name() + " and ErrorReason " + errorReason);
+
+ long subStarttime = System.currentTimeMillis ();
+ try {
+
+
+ IFinalDistrStatusMessage finalDistribution = new FinalDistributionStatusMessage(distributionID,status,subStarttime, asdcConfig.getConsumerID());
+
+ if(errorReason == null){
+ this.distributionClient.sendFinalDistrStatus(finalDistribution);
+ }else{
+ this.distributionClient.sendFinalDistrStatus(finalDistribution, errorReason);
+ }
+
+
+ } catch (RuntimeException e) {
+ LOGGER.debug ("Exception caught in sendFinalDistributionStatus " + e.getMessage());
+ LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
+ }
+ LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent Final notification to ASDC", "ASDC", null, null);
+ }
+
+ public void treatNotification (INotificationData iNotif) {
+
+ int noOfArtifacts = 0;
+
+
+ for (IResourceInstance resource : iNotif.getResources ()) {
+ noOfArtifacts += resource.getArtifacts ().size ();
+ }
+ LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF,
+ String.valueOf (noOfArtifacts),
+ iNotif.getServiceUUID (), "ASDC");
+
+ try {
+ LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+ LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification");
+ this.changeControllerStatus(ASDCControllerStatus.BUSY);
+ toscaInstaller.processWatchdog(iNotif.getDistributionID(),iNotif.getServiceUUID());
+
+ // Process only the Resource artifacts in MSO
+ this.processResourceNotification(iNotif);
+
+ //********************************************************************************************************
+ //Start Watchdog loop and wait for all components to complete before reporting final status back.
+ // **If timer expires first then we will report a Distribution Error back to ASDC
+ //********************************************************************************************************
+ long initialStartTime = System.currentTimeMillis();
+ boolean componentsComplete = false;
+ String distributionStatus = null;
+ String watchdogError = null;
+ String overallStatus = null;
+ int watchDogTimeout = asdcConfig.getWatchDogTimeout() * 1000;
+ boolean isDeploySuccess = false;
+
+ while(!componentsComplete && (System.currentTimeMillis() - initialStartTime) < watchDogTimeout)
+ {
+
+ try{
+ distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
+ Thread.sleep(watchDogTimeout / 10);
+ }catch(Exception e){
+ LOGGER.debug ("Exception in Watchdog Loop " + e.getMessage());
+ Thread.sleep(watchDogTimeout / 10);
+ }
+
+ if(distributionStatus != null && !distributionStatus.equalsIgnoreCase(DistributionStatus.INCOMPLETE.name())){
+
+ if(distributionStatus.equalsIgnoreCase(DistributionStatus.SUCCESS.name())){
+ isDeploySuccess = true;
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.name();
+ }else{
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
+ }
+ componentsComplete = true;
+ }
+ }
+
+ if(!componentsComplete){
+ LOGGER.debug("Timeout of " + watchDogTimeout + " seconds was reached before all components reported status");
+ watchdogError = "Timeout occurred while waiting for all components to report status";
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
+ }
+
+ if(distributionStatus == null){
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
+ LOGGER.debug("DistributionStatus is null for DistributionId: " + iNotif.getDistributionID());
+ }
+
+ try {
+ wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus);
+ LOGGER.debug ("A&AI Updated succefully with Distribution Status!");
+ }
+ catch(Exception e) {
+ LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e.getMessage());
+ watchdogError = "Error calling A&AI " + e.getMessage();
+ if(e.getCause() != null) {
+ LOGGER.debug ("Exception caused by: " + e.getCause().getMessage());
+ }
+ }
+
+
+ if(isDeploySuccess && watchdogError == null){
+ sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK, null);
+ WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
+ wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.toString());
+ wdsRepo.save(wds);
+ } else {
+ sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, watchdogError);
+ WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
+ wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.toString());
+ wdsRepo.save(wds);
+ }
+
+
+
+ } catch (Exception e) {
+ LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
+ "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification",
+ e);
+
+ try {
+ wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
+ LOGGER.debug ("A&AI Updated succefully with Distribution Status of " + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
+ }
+ catch(Exception aaiException) {
+ LOGGER.debug ("Exception in executePatchAAI(): " + aaiException.getMessage());
+ if(aaiException.getCause() != null) {
+ LOGGER.debug ("Exception caused by: " + aaiException.getCause().getMessage());
+ }
+ }
+
+ sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, e.getMessage());
+
+ WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
+ wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.toString());
+ wdsRepo.save(wds);
+
+ } finally {
+ this.changeControllerStatus (ASDCControllerStatus.IDLE);
+ }
+ }
+
+ private void processResourceNotification (INotificationData iNotif) {
+ // For each artifact, create a structure describing the VFModule in a ordered flat level
+ VfResourceStructure resourceStructure = null;
+ ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();
+ boolean deploySuccessful = true;
+ String errorMessage = null;
+
+ try {
+
+ this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
+
+ for (IResourceInstance resource : iNotif.getResources()){
+
+ resourceStructure = new VfResourceStructure(iNotif,resource);
+
+ String resourceType = resourceStructure.getResourceInstance().getResourceType();
+ String category = resourceStructure.getResourceInstance().getCategory();
+
+ LOGGER.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID());
+
+ if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
+
+ for (IArtifactInfo artifact : resource.getArtifacts()) {
+ IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,
+ iNotif.getDistributionID());
+ if (resultArtifact != null) {
+ if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
+ LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8"));
+ LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
+ }
+ resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
+ }
+ }
+ }
+ }
+ try{
+
+ //Deploy All resources and artifacts
+ LOGGER.debug("Preparing to deploy Service: " + iNotif.getServiceUUID());
+ if(resourceStructure == null){
+ resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance());
+ }
+ this.deployResourceStructure(resourceStructure, toscaResourceStructure);
+
+
+ } catch(ArtifactInstallerException e){
+ deploySuccessful = false;
+ errorMessage = e.getMessage();
+ }
+
+ this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage);
+
+ } catch (ASDCDownloadException | UnsupportedEncodingException e) {
+ LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
+ "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
+ }
+ }
+ private void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
+
+ List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
+
+ for(IArtifactInfo artifact : serviceArtifacts){
+
+ if(artifact.getArtifactType().equals(ASDCConfiguration.TOSCA_CSAR)){
+
+ try{
+
+ toscaResourceStructure.setToscaArtifact(artifact);
+
+ IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,iNotif.getDistributionID());
+
+ writeArtifactToFile(artifact, resultArtifact);
+
+ toscaResourceStructure.updateResourceStructure(artifact);
+
+ toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
+
+ LOGGER.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
+
+
+ } catch(Exception e){
+ LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e);
+ }
+ }
+
+ }
+ }
+
+ private static final String UNKNOWN="Unknown";
+
+ /**
+ * @return the address of the ASDC we are connected to.
+ */
+ public String getAddress () {
+ if (asdcConfig != null) {
+ return asdcConfig.getAsdcAddress ();
+ }
+ return UNKNOWN;
+ }
+
+ /**
+ * @return the environment name of the ASDC we are connected to.
+ */
+ public String getEnvironment () {
+ if (asdcConfig != null) {
+ return asdcConfig.getEnvironmentName ();
+ }
+ return UNKNOWN;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCControllerStatus.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCControllerStatus.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCControllerStatus.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCControllerStatus.java
index db83a91..e358fee 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCControllerStatus.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCControllerStatus.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client;
+package org.onap.so.asdc.client;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java
new file mode 100644
index 0000000..ab5b7aa
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.asdc.client;
+
+import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Inner class for Notification callback
+ *
+ *
+ */
+@Component
+public final class ASDCNotificationCallBack implements INotificationCallback {
+
+ @Autowired
+ private ASDCController asdcController;
+
+ protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCNotificationCallBack.class);
+
+ /**
+ * This method can be called multiple times at the same moment.
+ * The controller must be thread safe !
+ */
+ @Override
+ public void activateCallback (INotificationData iNotif) {
+ long startTime = System.currentTimeMillis ();
+ UUIDChecker.generateUUID (LOGGER);
+ MsoLogger.setServiceName ("NotificationHandler");
+ MsoLogger.setLogContext (iNotif.getDistributionID (), iNotif.getServiceUUID ());
+ String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources ().size ();
+ LOGGER.debug(event);
+ asdcController.treatNotification (iNotif);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
new file mode 100644
index 0000000..cbacd88
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.asdc.client;
+
+import org.onap.sdc.api.consumer.IStatusCallback;
+import org.onap.sdc.api.notification.IStatusData;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.UUIDChecker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public final class ASDCStatusCallBack implements IStatusCallback {
+
+ @Autowired
+ private ToscaResourceInstaller toscaInstaller;
+
+ protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCStatusCallBack.class);
+
+ @Autowired
+ private WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
+
+ @Override
+ public void activateCallback (IStatusData iStatus) {
+ long startTime = System.currentTimeMillis ();
+ UUIDChecker.generateUUID (LOGGER);
+ MsoLogger.setServiceName ("ASDCStatusCallBack");
+ MsoLogger.setLogContext (iStatus.getDistributionID (), iStatus.getComponentName());
+ String event = "Receive a callback componentStatus in ASDC, for componentName: " + iStatus.getComponentName() + " and status of " + iStatus.getStatus() + " distributionID of " + iStatus.getDistributionID();
+
+ try{
+
+ if(iStatus.getStatus() != null){
+ if(iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) || iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) {
+ WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findOne(iStatus.getDistributionID ());
+ if(watchdogDistributionStatus==null){
+ watchdogDistributionStatus = new WatchdogDistributionStatus();
+ watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID ());
+ watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
+ }
+ LOGGER.debug(event);
+ toscaInstaller.installTheComponentStatus(iStatus);
+
+ }
+ }
+ }catch(ArtifactInstallerException e){
+ LOGGER.error("Error in ASDCStatusCallback " + e.getMessage(),e);
+ LOGGER.debug("Error in ASDCStatusCallback " + e.getMessage());
+ }
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
+ }
+}
\ No newline at end of file
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/DistributionStatusMessage.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/DistributionStatusMessage.java
similarity index 97%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/DistributionStatusMessage.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/DistributionStatusMessage.java
index 60fa4a9..db2d2c3 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/DistributionStatusMessage.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/DistributionStatusMessage.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client;
+package org.onap.so.asdc.client;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/FinalDistributionStatusMessage.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
similarity index 98%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/FinalDistributionStatusMessage.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
index bf22d7e..376b678 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/FinalDistributionStatusMessage.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client;
+package org.onap.so.asdc.client;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
import org.onap.sdc.utils.DistributionStatusEnum;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java
new file mode 100644
index 0000000..cfdff85
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java
@@ -0,0 +1,79 @@
+/*-
+ * ============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.asdc.client;
+
+import java.util.ArrayList;
+
+import org.onap.sdc.api.notification.IResourceInstance;
+
+final class ResourceInstance implements IResourceInstance {
+
+ @Override
+ public String getResourceInstanceName(){
+ return new String();
+ }
+
+ @Override
+ public String getResourceName(){
+ return new String();
+ }
+
+ @Override
+ public String getResourceVersion(){
+ return new String();
+ }
+
+ @Override
+ public String getResourceType(){
+ return new String();
+ }
+
+ @Override
+ public String getResourceUUID(){
+ return new String();
+ }
+
+ @Override
+ public java.util.List getArtifacts(){
+ return new ArrayList();
+ }
+
+ @Override
+ public String getResourceInvariantUUID(){
+ return new String();
+ }
+
+ @Override
+ public String getResourceCustomizationUUID(){
+ return new String();
+ }
+
+ @Override
+ public String getCategory(){
+ return new String();
+ }
+
+ @Override
+ public String getSubcategory(){
+ return new String();
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCControllerException.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCControllerException.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCControllerException.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCControllerException.java
index e8cb308..98257f7 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCControllerException.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCControllerException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.exceptions;
+package org.onap.so.asdc.client.exceptions;
/**
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCDownloadException.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCDownloadException.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCDownloadException.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCDownloadException.java
index a8a0f15..f4e0bf0 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCDownloadException.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCDownloadException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.exceptions;
+package org.onap.so.asdc.client.exceptions;
/**
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCParametersException.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCParametersException.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCParametersException.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCParametersException.java
index b4bce4e..aecb922 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ASDCParametersException.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ASDCParametersException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.exceptions;
+package org.onap.so.asdc.client.exceptions;
/**
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ArtifactInstallerException.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerException.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ArtifactInstallerException.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerException.java
index e8a5e81..78ccb5d 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/exceptions/ArtifactInstallerException.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.exceptions;
+package org.onap.so.asdc.client.exceptions;
/**
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
new file mode 100644
index 0000000..7dab49f
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
@@ -0,0 +1,171 @@
+/*-
+ * ============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.asdc.client.test.emulators;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.sdc.api.notification.IArtifactInfo;
+
+public class ArtifactInfoImpl implements IArtifactInfo {
+
+ private String artifactName;
+ private String artifactType;
+ private String artifactURL;
+ private String artifactChecksum;
+ private String artifactDescription;
+ private Integer artifactTimeout;
+ private String artifactVersion;
+ private String artifactUUID;
+ private String generatedFromUUID;
+ private ArtifactInfoImpl generatedArtifact;
+ private List<IArtifactInfo> relatedArtifactsInfo;
+ private List<ArtifactInfoImpl> relatedArtifactsImpl;
+ ArtifactInfoImpl(){}
+
+ private ArtifactInfoImpl(IArtifactInfo iArtifactInfo){
+ artifactName = iArtifactInfo.getArtifactName();
+ artifactType = iArtifactInfo.getArtifactType();
+ artifactURL = iArtifactInfo.getArtifactURL();
+ artifactChecksum = iArtifactInfo.getArtifactChecksum();
+ artifactDescription = iArtifactInfo.getArtifactDescription();
+ artifactTimeout = iArtifactInfo.getArtifactTimeout();
+ artifactVersion = iArtifactInfo.getArtifactVersion();
+ artifactUUID = iArtifactInfo.getArtifactUUID();
+ generatedArtifact = (ArtifactInfoImpl) iArtifactInfo.getGeneratedArtifact();
+ relatedArtifactsInfo = iArtifactInfo.getRelatedArtifacts();
+ }
+
+ public static List<ArtifactInfoImpl> convertToArtifactInfoImpl(List<IArtifactInfo> list){
+ List<ArtifactInfoImpl> ret = new ArrayList<ArtifactInfoImpl>();
+ if( list != null ){
+ for(IArtifactInfo artifactInfo : list ){
+ ret.add(new ArtifactInfoImpl(artifactInfo));
+ }
+ }
+ return ret;
+ }
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public String getArtifactURL() {
+ return artifactURL;
+ }
+
+ public void setArtifactURL(String artifactURL) {
+ this.artifactURL = artifactURL;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ public Integer getArtifactTimeout() {
+ return artifactTimeout;
+ }
+
+ public void setArtifactTimeout(Integer artifactTimeout) {
+ this.artifactTimeout = artifactTimeout;
+ }
+
+ @Override
+ public String toString() {
+ return "BaseArtifactInfoImpl [artifactName=" + artifactName
+ + ", artifactType=" + artifactType + ", artifactURL="
+ + artifactURL + ", artifactChecksum=" + artifactChecksum
+ + ", artifactDescription=" + artifactDescription
+ + ", artifactVersion=" + artifactVersion
+ + ", artifactUUID=" + artifactUUID
+ + ", artifactTimeout=" + artifactTimeout + "]";
+ }
+
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ public String getGeneratedFromUUID() {
+ return generatedFromUUID;
+ }
+
+ public void setGeneratedFromUUID(String generatedFromUUID) {
+ this.generatedFromUUID = generatedFromUUID;
+ }
+
+ @Override
+ public ArtifactInfoImpl getGeneratedArtifact() {
+ return generatedArtifact;
+ }
+
+ public void setGeneratedArtifact(ArtifactInfoImpl generatedArtifact) {
+ this.generatedArtifact = generatedArtifact;
+ }
+
+ @Override
+ public List<IArtifactInfo> getRelatedArtifacts(){
+ List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
+ if( relatedArtifactsInfo != null ){
+ temp.addAll(relatedArtifactsImpl);
+ }
+ return temp;
+ }
+
+ public void setRelatedArtifacts(List<ArtifactInfoImpl> relatedArtifacts) {
+ this.relatedArtifactsImpl = relatedArtifacts;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/DistributionClientEmulator.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
similarity index 76%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/DistributionClientEmulator.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
index 426e235..4f76d3f 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/DistributionClientEmulator.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.test.emulators;
+package org.onap.so.asdc.client.test.emulators;
-import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.LinkedList;
import java.util.List;
-import org.apache.commons.io.IOUtils;
-import org.openecomp.mso.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.IVfModuleData;
+import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IConfiguration;
@@ -51,8 +51,13 @@
private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>();
- public DistributionClientEmulator(String notifFolderInResource) {
-
+
+ private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,DistributionClientEmulator.class );
+
+ public DistributionClientEmulator() {
+ }
+
+ public DistributionClientEmulator(String notifFolderInResource) {
resourcePath = notifFolderInResource;
}
@@ -64,58 +69,37 @@
public List<IVfModuleMetadata> decodeVfModuleArtifact(byte[] arg0) {
return null;
}
-
- /* @Override
- public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
- try {
- listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference<List<JsonVfModuleMetaData>>(){});
- return listVFModuleMetaData;
-
- } catch (JsonParseException e) {
- e.printStackTrace();
- } catch (JsonMappingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- } */
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
+ }
+
public List<IVfModuleData> getListVFModuleMetaData() {
return listVFModuleMetaData;
}
@Override
- public IDistributionClientDownloadResult download (IArtifactInfo arg0) {
+ public IDistributionClientDownloadResult download (IArtifactInfo arg0) {
-
- //String filename = resourcePath+"/artifacts/"+arg0.getArtifactURL();
String filename = arg0.getArtifactURL();
- System.out.println("Emulating the download from resources files:"+filename);
-
- InputStream inputStream = null;
-
- if(arg0.getArtifactName().equals("service_PortMirroringContainer_csar.csar")){
- try{
- inputStream = new FileInputStream("C://Users//JM5423//git//mso//asdc-tosca-1712-test3//openecomp-mso//asdc-controller//src//main//resources//resource-examples//service_PortMirroringContainer_csar.csar");
- }catch(Exception e){
- System.out.println("Error " + e.getMessage());
- }
- }else{
-
- inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath + filename);
- }
-
- if (inputStream == null) {
- System.out.println("InputStream is NULL for:"+filename);
- }
- try {
- return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),IOUtils.toByteArray(inputStream));
- } catch (IOException e) {
-
+
+ byte[] inputStream=null;
+ try {
+ inputStream = getData(filename);
+ } catch (IOException e) {
e.printStackTrace();
- }
- return null;
+ logger.debug("InputStream is NULL for:"+ resourcePath + filename);
+ }
+
+ return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),inputStream);
+ }
+
+ private byte[] getData(String filename) throws IOException {
+ return Files.readAllBytes(Paths.get(resourcePath + filename));
}
@Override
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
similarity index 98%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusData.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
index 25615b7..58193db 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.test.emulators;
+package org.onap.so.asdc.client.test.emulators;
import java.io.IOException;
import java.io.InputStream;
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
similarity index 95%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaData.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
index 765f14f..9202559 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.test.emulators;
+package org.onap.so.asdc.client.test.emulators;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.openecomp.mso.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.IVfModuleData;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
new file mode 100644
index 0000000..2942213
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
@@ -0,0 +1,175 @@
+/*-
+ * ============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.asdc.client.test.emulators;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NotificationDataImpl implements INotificationData {
+
+ private String distributionID;
+ private String serviceName;
+ private String serviceVersion;
+ private String serviceUUID;
+ private String serviceDescription;
+ private String serviceInvariantUUID;
+ private List<ResourceInfoImpl> resources;
+ private List<ArtifactInfoImpl> serviceArtifacts;
+ private String workloadContext;
+
+ @Override
+ public String getDistributionID() {
+ return distributionID;
+ }
+
+ @Override
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ @Override
+ public String getServiceVersion() {
+ return serviceVersion;
+ }
+
+ @Override
+ public String getServiceUUID() {
+ return serviceUUID;
+ }
+
+ public void setDistributionID(String distributionID) {
+ this.distributionID = distributionID;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void setServiceVersion(String serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ }
+
+ public void setServiceUUID(String serviceUUID) {
+ this.serviceUUID = serviceUUID;
+ }
+
+
+
+ public String getServiceDescription() {
+ return serviceDescription;
+ }
+
+ public void setServiceDescription(String serviceDescription) {
+ this.serviceDescription = serviceDescription;
+ }
+
+ @Override
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ @Override
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ @Override
+ public String toString() {
+ return "NotificationDataImpl [distributionID=" + distributionID + ", serviceName=" + serviceName
+ + ", serviceVersion=" + serviceVersion + ", serviceUUID=" + serviceUUID + ", serviceDescription="
+ + serviceDescription + ", serviceInvariantUUID=" + serviceInvariantUUID + ", resources=" + resources
+ + ", serviceArtifacts=" + serviceArtifacts + ", workloadContext=" + workloadContext + "]";
+ }
+
+ @Override
+ public List<IResourceInstance> getResources() {
+ List<IResourceInstance> ret = new ArrayList<IResourceInstance>();
+ if( resources != null ){
+ ret.addAll(resources);
+ }
+ return ret;
+ }
+
+ public List<ResourceInfoImpl> getResourcesImpl(){
+ return resources;
+ }
+
+ List<ArtifactInfoImpl> getServiceArtifactsImpl(){
+ return serviceArtifacts;
+ }
+
+ @Override
+ public List<IArtifactInfo> getServiceArtifacts() {
+ List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
+ if( serviceArtifacts != null ){
+ temp.addAll(serviceArtifacts);
+ }
+ return temp;
+ }
+
+ public void setServiceArtifacts(List<ArtifactInfoImpl> relevantServiceArtifacts) {
+ serviceArtifacts = relevantServiceArtifacts;
+
+ }
+
+ @Override
+ public String getServiceInvariantUUID() {
+ return serviceInvariantUUID;
+ }
+
+
+ public void setServiceInvariantUUID(String serviceInvariantUUID) {
+ this.serviceInvariantUUID = serviceInvariantUUID;
+ }
+ @Override
+ public IArtifactInfo getArtifactMetadataByUUID(String artifactUUID){
+ IArtifactInfo ret = findArtifactInfoByUUID(artifactUUID, serviceArtifacts);
+ if( ret == null && resources != null ){
+ for( ResourceInfoImpl currResourceInstance : resources ){
+ ret = findArtifactInfoByUUID(artifactUUID, currResourceInstance.getArtifactsImpl());
+ if( ret != null ){
+ break;
+ }
+ }
+ }
+ return ret;
+
+ }
+
+ private IArtifactInfo findArtifactInfoByUUID(String artifactUUID, List<ArtifactInfoImpl> listToCheck) {
+ IArtifactInfo ret = null;
+ if( listToCheck != null ){
+ for(IArtifactInfo curr: listToCheck ){
+ if(curr.getArtifactUUID().equals(artifactUUID) ){
+ ret = curr;
+ break;
+ }
+ }
+ }
+ return ret;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
new file mode 100644
index 0000000..eb4764d
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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.asdc.client.test.emulators;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.IResourceInstance;
+
+public class ResourceInfoImpl implements IResourceInstance{
+ ResourceInfoImpl (){}
+ private String resourceInstanceName;
+ private String resourceCustomizationUUID;
+ private String resourceName;
+ private String resourceVersion;
+ private String resourceType;
+ private String resourceUUID;
+ private String resourceInvariantUUID;
+ private String category;
+ private String subcategory;
+ private List<ArtifactInfoImpl> artifacts;
+
+ private ResourceInfoImpl(IResourceInstance resourceInstance){
+ resourceInstanceName = resourceInstance.getResourceInstanceName();
+ resourceCustomizationUUID = resourceInstance.getResourceCustomizationUUID();
+ resourceName = resourceInstance.getResourceName();
+ resourceVersion = resourceInstance.getResourceVersion();
+ resourceType = resourceInstance.getResourceType();
+ resourceUUID = resourceInstance.getResourceUUID();
+ resourceInvariantUUID = resourceInstance.getResourceInvariantUUID();
+ category = resourceInstance.getCategory();
+ subcategory = resourceInstance.getSubcategory();
+ artifacts = ArtifactInfoImpl.convertToArtifactInfoImpl(resourceInstance.getArtifacts());
+ }
+
+ public static List<ResourceInfoImpl> convertToJsonContainer(List<IResourceInstance> resources){
+ List<ResourceInfoImpl> buildResources = new ArrayList<ResourceInfoImpl>();
+ if( resources != null ){
+ for( IResourceInstance resourceInstance : resources ){
+ buildResources.add(new ResourceInfoImpl(resourceInstance));
+ }
+ }
+ return buildResources;
+ }
+
+ @Override
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+ @Override
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ @Override
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ @Override
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ public void setResoucreType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ @Override
+ public String getResourceUUID() {
+ return resourceUUID;
+ }
+
+ public void setResourceUUID(String resourceUUID) {
+ this.resourceUUID = resourceUUID;
+ }
+
+ @Override
+ public List<IArtifactInfo> getArtifacts() {
+ List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
+ if( artifacts != null ){
+ temp.addAll(artifacts);
+ }
+ return temp;
+ }
+
+ public void setArtifacts(List<ArtifactInfoImpl> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ public List<ArtifactInfoImpl> getArtifactsImpl(){
+ return artifacts;
+ }
+
+ @Override
+ public String getResourceInvariantUUID() {
+ return resourceInvariantUUID;
+ }
+
+ public void setResourceInvariantUUID(String resourceInvariantUUID) {
+ this.resourceInvariantUUID = resourceInvariantUUID;
+ }
+ public String getResourceCustomizationUUID() {
+ return resourceCustomizationUUID;
+ }
+
+ public void setResourceCustomizationUUID(String resourceCustomizationUUID) {
+ this.resourceCustomizationUUID = resourceCustomizationUUID;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getSubcategory() {
+ return subcategory;
+ }
+
+ public void setSubcategory(String subcategory) {
+ this.subcategory = subcategory;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
similarity index 62%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/rest/ASDCRestInterface.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index ae434b1..e86fac7 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,100 +18,103 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.test.rest;
-
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.asdc.client.ASDCController;
-import org.openecomp.mso.asdc.client.test.emulators.DistributionClientEmulator;
-import org.openecomp.mso.asdc.client.test.emulators.JsonNotificationData;
-import org.openecomp.mso.asdc.client.test.emulators.JsonStatusData;
-import org.openecomp.mso.asdc.installer.heat.ToscaResourceInstaller;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service on jboss without the need to be connected
- * to the ASDC service broker. It starts the test at the treatNotification step and simulates both the notification step as well as the artifact download step.
- *
- * i.e. http://localhost:8080/asdc/treatNotification/v1
- *
- * i.e. http://localhost:8080/asdc/statusData/v1
- *
- * @author jm5423
- *
- */
-
-@Path("/")
-public class ASDCRestInterface {
-
- private static DistributionClientEmulator distributionClientEmulator;
-
- private static JsonNotificationData notifDataWithoutModuleInfo;
-
- private static JsonStatusData statusData;
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
- @GET
- @Path("/treatNotification/v1")
- @Produces(MediaType.APPLICATION_JSON)
- public Response invokeASDCService(String request) {
-
- try{
- distributionClientEmulator = new DistributionClientEmulator("resource-examples/");
- notifDataWithoutModuleInfo = JsonNotificationData.instantiateNotifFromJsonFile("resource-examples/");
-
- ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator);
- LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "initASDC()");
- asdcController.initASDC();
- LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "treatNotification()");
- asdcController.treatNotification(notifDataWithoutModuleInfo);
- LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "closeASDC()");
- asdcController.closeASDC();
- }catch(Exception e){
- System.out.println("Error caught " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION,
- "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in invokeASDCService", e);
- }
- System.out.println("ASDC Updates are complete");
- LOGGER.info(MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "ASDC Updates Are Complete");
-
- return null;
- }
-
- @GET
- @Path("/statusData/v1")
- @Produces(MediaType.APPLICATION_JSON)
- public Response invokeASDCStatusData(String request) {
-
- ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller();
-
- try{
- distributionClientEmulator = new DistributionClientEmulator("resource-examples/");
- statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
-
- ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator);
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "initASDC()");
- asdcController.initASDC();
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "treatNotification()");
- toscaInstaller.installTheComponentStatus(statusData);
- //asdcController.treatNotification(notifDataWithoutModuleInfo);
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "closeASDC()");
- asdcController.closeASDC();
- }catch(Exception e){
- System.out.println("Error caught " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION,
- "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in invokeASDCService", e);
- }
- System.out.println("ASDC Updates are complete");
- LOGGER.info(MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
-
- return null;
- }
-}
+package org.onap.so.asdc.client.test.rest;
+
+
+import java.io.IOException;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.onap.so.asdc.client.ASDCController;
+import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.onap.so.asdc.client.exceptions.ASDCParametersException;
+import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.asdc.client.test.emulators.JsonStatusData;
+import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+/**
+ * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service on jboss without the need to be connected
+ * to the ASDC service broker. It starts the test at the treatNotification step and simulates both the notification step as well as the artifact download step.
+ *
+ * i.e. http://localhost:8080/asdc/treatNotification/v1
+ *
+ * i.e. http://localhost:8080/asdc/statusData/v1
+ *
+ * @author jm5423
+ *
+ */
+
+@Path("/")
+@Component
+@Profile("test")
+public class ASDCRestInterface {
+
+ private static DistributionClientEmulator distributionClientEmulator;
+
+ private static JsonStatusData statusData;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCRestInterface.class );
+
+ @Autowired
+ private ASDCController asdcController;
+
+ @Autowired
+ private ToscaResourceInstaller toscaInstaller;
+
+ @POST
+ @Path("/treatNotification/v1")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response invokeASDCService(NotificationDataImpl request, @HeaderParam("resource-location") String resourceLocation)
+ throws ASDCControllerException, ASDCParametersException, IOException {
+ distributionClientEmulator = new DistributionClientEmulator(resourceLocation);
+
+ asdcController.setControllerName("asdc-controller1");
+ asdcController.setDistributionClient(distributionClientEmulator);
+ asdcController.initASDC();
+ asdcController.treatNotification(request);
+ asdcController.closeASDC();
+ return Response.status(200).build();
+ }
+
+ @POST
+ @Path("/statusData/v1")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response invokeASDCStatusData(String request) {
+
+ try{
+ distributionClientEmulator = new DistributionClientEmulator("resource-examples/");
+ statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
+
+ ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator);
+ //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "initASDC()");
+ asdcController.initASDC();
+ //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "treatNotification()");
+ toscaInstaller.installTheComponentStatus(statusData);
+ //asdcController.treatNotification(notifDataWithoutModuleInfo);
+ //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "closeASDC()");
+ asdcController.closeASDC();
+ }catch(Exception e){
+ System.out.println("Error caught " + e.getMessage());
+ LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION,
+ "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in invokeASDCService", e);
+ }
+ System.out.println("ASDC Updates are complete");
+ LOGGER.info(MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
+
+ return null;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java
similarity index 98%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java
index b6e1308..1e227ae 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
import java.util.ArrayList;
import java.util.HashMap;
@@ -28,7 +28,7 @@
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IResourceInstance;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.ASDCConfiguration;
/**
* A class representing a generic element whose information can be used for example to log artifacts, resource... data.
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/BigDecimalVersion.java
similarity index 97%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/BigDecimalVersion.java
index c2faf1c..1dd92ea 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/BigDecimalVersion.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
import java.math.BigDecimal;
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IArtifactOrchestrator.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/IArtifactOrchestrator.java
similarity index 92%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IArtifactOrchestrator.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/IArtifactOrchestrator.java
index 60519f2..ac43a66 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IArtifactOrchestrator.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/IArtifactOrchestrator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
@@ -26,7 +26,7 @@
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
public interface IArtifactOrchestrator {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/IVfModuleData.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/IVfModuleData.java
index 1e24b59..f9524de 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/IVfModuleData.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,10 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
-
-import java.util.Map;
-
+package org.onap.so.asdc.installer;
public interface IVfModuleData {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/IVfResourceInstaller.java
similarity index 91%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfResourceInstaller.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/IVfResourceInstaller.java
index 128239c..445b10b 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/IVfResourceInstaller.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
public interface IVfResourceInstaller {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
similarity index 65%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ToscaResourceStructure.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index 941787e..565ddf4 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -1,537 +1,506 @@
-/*-
- * ============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.openecomp.mso.asdc.installer;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-
-import java.util.List;
-
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-//import org.openecomp.generic.tosca.parser.model.Metadata;
-//import org.onap.sdc.tosca.parser.factory.SdcCsarHelperFactory;
-//import org.onap.sdc.tosca.parser.factory.SdcCsarHelperFactory;
-///import org.openecomp.generic.tosca.parser.model.Metadata;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl;
-import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-
-
-import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
-
-
-
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.openecomp.mso.asdc.client.exceptions.ASDCDownloadException;
-import org.openecomp.mso.db.catalog.beans.AllottedResource;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.NetworkResource;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
-import org.openecomp.mso.db.catalog.beans.VnfResCustomToVfModuleCustom;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class ToscaResourceStructure {
-
- Metadata serviceMetadata;
- private Service catalogService;
- ISdcCsarHelper sdcCsarHelper;
- List<NodeTemplate> allottedList;
- List<NodeTemplate> networkTypes;
- List<NodeTemplate> vfTypes;
- String heatTemplateUUID;
- String volHeatTemplateUUID;
- String volHeatEnvTemplateUUID;
- String envHeatTemplateUUID;
- String heatFilesUUID;
- String workloadPerformance;
- boolean isVnfAlreadyInstalled = false;
- String serviceVersion;
- private boolean isDeployedSuccessfully=false;
-
-
- private NetworkResourceCustomization catalogNetworkResourceCustomization;
-
- private NetworkResource catalogNetworkResource;
-
- private AllottedResourceCustomization catalogResourceCustomization;
-
- private VfModule vfModule;
-
- private VfModuleCustomization vfModuleCustomization;
-
- private VnfResource vnfResource;
-
- private VnfResourceCustomization vnfResourceCustomization;
-
- private ServiceToResourceCustomization serviceToResourceCustomization;
-
- private AllottedResource allottedResource;
-
- private AllottedResourceCustomization allottedResourceCustomization;
-
- private VnfResCustomToVfModuleCustom vnfResCustomToVfModuleCustom;
-
- private TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup;
-
- private VfModuleToHeatFiles vfModuleToHeatFiles;
-
- private IArtifactInfo toscaArtifact;
-
- private ToscaCsar toscaCsar;
-
- private ServiceToResourceCustomization vfServiceToResourceCustomization;
-
- private ServiceToResourceCustomization allottedServiceToResourceCustomization;
-
- private ServiceToResourceCustomization vlServiceToResourceCustomization;
-
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
-
- public ToscaResourceStructure(){
- }
-
- public void updateResourceStructure(IArtifactInfo artifact) throws ASDCDownloadException {
-
-
- try {
-
- SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();//Autoclosable
-
- LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
-
- File spoolFile = new File(System.getProperty("mso.config.path") + "ASDC/" + artifact.getArtifactName());
-
- LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath());
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath());
-
-
- sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath());
-
- }catch(Exception e){
- System.out.println("System out " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
-
- throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e);
- }
-
- serviceMetadata = sdcCsarHelper.getServiceMetadata();
-
- }
-
- public String getHeatTemplateUUID() {
- return heatTemplateUUID;
- }
-
- public void setHeatTemplateUUID(String heatTemplateUUID) {
- this.heatTemplateUUID = heatTemplateUUID;
- }
-
- public List<NodeTemplate> getAllottedList() {
- return allottedList;
- }
-
- public void setAllottedList(List<NodeTemplate> allottedList) {
- this.allottedList = allottedList;
- }
-
- public ISdcCsarHelper getSdcCsarHelper() {
- return sdcCsarHelper;
- }
-
- public void setSdcCsarHelper(ISdcCsarHelper sdcCsarHelper) {
- this.sdcCsarHelper = sdcCsarHelper;
- }
-
- public Metadata getServiceMetadata() {
- return serviceMetadata;
- }
-
- public Service getCatalogService() {
- return catalogService;
- }
-
- public void setServiceMetadata(Metadata serviceMetadata) {
- this.serviceMetadata = serviceMetadata;
- }
-
- public void setCatalogService(Service catalogService) {
- this.catalogService = catalogService;
- }
-
- public List<NodeTemplate> getNetworkTypes() {
- return networkTypes;
- }
-
- public void setNetworkTypes(List<NodeTemplate> networkTypes) {
- this.networkTypes = networkTypes;
- }
-
- public List<NodeTemplate> getVfTypes() {
- return vfTypes;
- }
-
- public void setVfTypes(List<NodeTemplate> vfTypes) {
- this.vfTypes = vfTypes;
- }
-
- public AllottedResourceCustomization getCatalogResourceCustomization() {
- return catalogResourceCustomization;
- }
-
- public void setCatalogResourceCustomization(
- AllottedResourceCustomization catalogResourceCustomization) {
- this.catalogResourceCustomization = catalogResourceCustomization;
- }
-
- // Network Only
- public NetworkResourceCustomization getCatalogNetworkResourceCustomization() {
- return catalogNetworkResourceCustomization;
- }
- // Network Only
- public void setCatalogNetworkResourceCustomization(NetworkResourceCustomization catalogNetworkResourceCustomization) {
- this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization;
- }
-
- public NetworkResource getCatalogNetworkResource() {
- return catalogNetworkResource;
- }
-
- public void setCatalogNetworkResource(NetworkResource catalogNetworkResource) {
- this.catalogNetworkResource = catalogNetworkResource;
- }
-
- public VfModule getCatalogVfModule() {
- return vfModule;
- }
-
- public void setCatalogVfModule(VfModule vfModule) {
- this.vfModule = vfModule;
- }
-
- public VnfResource getCatalogVnfResource() {
- return vnfResource;
- }
-
- public void setCatalogVnfResource(VnfResource vnfResource) {
- this.vnfResource = vnfResource;
- }
-
- public VnfResourceCustomization getCatalogVnfResourceCustomization() {
- return vnfResourceCustomization;
- }
-
- public void setCatalogVnfResourceCustomization(
- VnfResourceCustomization vnfResourceCustomization) {
- this.vnfResourceCustomization = vnfResourceCustomization;
- }
-
- public VfModuleCustomization getCatalogVfModuleCustomization() {
- return vfModuleCustomization;
- }
-
- public void setCatalogVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
- this.vfModuleCustomization = vfModuleCustomization;
- }
-
- public ServiceToResourceCustomization getServiceToResourceCustomization() {
- return serviceToResourceCustomization;
- }
-
- public void setServiceToResourceCustomization(
- ServiceToResourceCustomization serviceToResourceCustomization) {
- this.serviceToResourceCustomization = serviceToResourceCustomization;
- }
-
- public AllottedResource getAllottedResource() {
- return allottedResource;
- }
-
- public void setAllottedResource(AllottedResource allottedResource) {
- this.allottedResource = allottedResource;
- }
-
- public AllottedResourceCustomization getCatalogAllottedResourceCustomization() {
- return allottedResourceCustomization;
- }
-
- public void setCatalogAllottedResourceCustomization(
- AllottedResourceCustomization allottedResourceCustomization) {
- this.allottedResourceCustomization = allottedResourceCustomization;
- }
-
- public VnfResCustomToVfModuleCustom getCatalogVnfResCustomToVfModuleCustom() {
- return vnfResCustomToVfModuleCustom;
- }
-
- public void setCatalogVnfResCustomToVfModuleCustom(
- VnfResCustomToVfModuleCustom vnfResCustomToVfModuleCustom) {
- this.vnfResCustomToVfModuleCustom = vnfResCustomToVfModuleCustom;
- }
-
- public TempNetworkHeatTemplateLookup getCatalogTempNetworkHeatTemplateLookup() {
- return tempNetworkHeatTemplateLookup;
- }
-
- public void setCatalogTempNetworkHeatTemplateLookup(
- TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup) {
- this.tempNetworkHeatTemplateLookup = tempNetworkHeatTemplateLookup;
- }
-
- public String getHeatFilesUUID() {
- return heatFilesUUID;
- }
-
- public void setHeatFilesUUID(String heatFilesUUID) {
- this.heatFilesUUID = heatFilesUUID;
- }
-
- public VfModuleToHeatFiles getCatalogVfModuleToHeatFiles() {
- return vfModuleToHeatFiles;
- }
-
- public void setCatalogVfModuleToHeatFiles(VfModuleToHeatFiles vfModuleToHeatFiles) {
- this.vfModuleToHeatFiles = vfModuleToHeatFiles;
- }
-
- public IArtifactInfo getToscaArtifact() {
- return toscaArtifact;
- }
-
- public void setToscaArtifact(IArtifactInfo toscaArtifact) {
- this.toscaArtifact = toscaArtifact;
- }
-
- public ToscaCsar getCatalogToscaCsar() {
- return toscaCsar;
- }
-
- public void setCatalogToscaCsar(ToscaCsar toscaCsar) {
- this.toscaCsar = toscaCsar;
- }
-
- public boolean isVnfAlreadyInstalled() {
- return isVnfAlreadyInstalled;
- }
-
- public void setVnfAlreadyInstalled(boolean isVnfAlreadyInstalled) {
- this.isVnfAlreadyInstalled = isVnfAlreadyInstalled;
- }
-
- public ServiceToResourceCustomization getCatalogVfServiceToResourceCustomization() {
- return vfServiceToResourceCustomization;
- }
-
- public void setCatalogVfServiceToResourceCustomization(
- ServiceToResourceCustomization vfServiceToResourceCustomization) {
- this.vfServiceToResourceCustomization = vfServiceToResourceCustomization;
- }
-
- public ServiceToResourceCustomization getCatalogAllottedServiceToResourceCustomization() {
- return allottedServiceToResourceCustomization;
- }
-
- public void setCatalogAllottedServiceToResourceCustomization(
- ServiceToResourceCustomization allottedServiceToResourceCustomization) {
- this.allottedServiceToResourceCustomization = allottedServiceToResourceCustomization;
- }
-
- public ServiceToResourceCustomization getCatalogVlServiceToResourceCustomization() {
- return vlServiceToResourceCustomization;
- }
-
- public void setCatalogVlServiceToResourceCustomization(
- ServiceToResourceCustomization vlServiceToResourceCustomization) {
- this.vlServiceToResourceCustomization = vlServiceToResourceCustomization;
- }
-
- public String getVolHeatTemplateUUID() {
- return volHeatTemplateUUID;
- }
-
- public void setVolHeatTemplateUUID(String volHeatTemplateUUID) {
- this.volHeatTemplateUUID = volHeatTemplateUUID;
- }
-
- public String getEnvHeatTemplateUUID() {
- return envHeatTemplateUUID;
- }
-
- public void setEnvHeatTemplateUUID(String envHeatTemplateUUID) {
- this.envHeatTemplateUUID = envHeatTemplateUUID;
- }
-
- public String getVolHeatEnvTemplateUUID() {
- return volHeatEnvTemplateUUID;
- }
-
- public void setVolHeatEnvTemplateUUID(String volHeatEnvTemplateUUID) {
- this.volHeatEnvTemplateUUID = volHeatEnvTemplateUUID;
- }
-
- public String getServiceVersion() {
- return serviceVersion;
- }
-
- public void setServiceVersion(String serviceVersion) {
- this.serviceVersion = serviceVersion;
- }
-
- public String getWorkloadPerformance() {
- return workloadPerformance;
- }
-
- public void setWorkloadPerformance(String workloadPerformance) {
- this.workloadPerformance = workloadPerformance;
- }
-
- public VfModule getVfModule() {
- return vfModule;
- }
-
- public void setVfModule(VfModule vfModule) {
- this.vfModule = vfModule;
- }
-
- public VfModuleCustomization getVfModuleCustomization() {
- return vfModuleCustomization;
- }
-
- public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
- this.vfModuleCustomization = vfModuleCustomization;
- }
-
- public VnfResource getVnfResource() {
- return vnfResource;
- }
-
- public void setVnfResource(VnfResource vnfResource) {
- this.vnfResource = vnfResource;
- }
-
- public VnfResourceCustomization getVnfResourceCustomization() {
- return vnfResourceCustomization;
- }
-
- public void setVnfResourceCustomization(
- VnfResourceCustomization vnfResourceCustomization) {
- this.vnfResourceCustomization = vnfResourceCustomization;
- }
-
- public AllottedResourceCustomization getAllottedResourceCustomization() {
- return allottedResourceCustomization;
- }
-
- public void setAllottedResourceCustomization(
- AllottedResourceCustomization allottedResourceCustomization) {
- this.allottedResourceCustomization = allottedResourceCustomization;
- }
-
- public VnfResCustomToVfModuleCustom getVnfResCustomToVfModuleCustom() {
- return vnfResCustomToVfModuleCustom;
- }
-
- public void setVnfResCustomToVfModuleCustom(
- VnfResCustomToVfModuleCustom vnfResCustomToVfModuleCustom) {
- this.vnfResCustomToVfModuleCustom = vnfResCustomToVfModuleCustom;
- }
-
- public TempNetworkHeatTemplateLookup getTempNetworkHeatTemplateLookup() {
- return tempNetworkHeatTemplateLookup;
- }
-
- public void setTempNetworkHeatTemplateLookup(
- TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup) {
- this.tempNetworkHeatTemplateLookup = tempNetworkHeatTemplateLookup;
- }
-
- public VfModuleToHeatFiles getVfModuleToHeatFiles() {
- return vfModuleToHeatFiles;
- }
-
- public void setVfModuleToHeatFiles(VfModuleToHeatFiles vfModuleToHeatFiles) {
- this.vfModuleToHeatFiles = vfModuleToHeatFiles;
- }
-
- public ToscaCsar getToscaCsar() {
- return toscaCsar;
- }
-
- public void setToscaCsar(ToscaCsar toscaCsar) {
- this.toscaCsar = toscaCsar;
- }
-
- public ServiceToResourceCustomization getVfServiceToResourceCustomization() {
- return vfServiceToResourceCustomization;
- }
-
- public void setVfServiceToResourceCustomization(
- ServiceToResourceCustomization vfServiceToResourceCustomization) {
- this.vfServiceToResourceCustomization = vfServiceToResourceCustomization;
- }
-
- public ServiceToResourceCustomization getAllottedServiceToResourceCustomization() {
- return allottedServiceToResourceCustomization;
- }
-
- public void setAllottedServiceToResourceCustomization(
- ServiceToResourceCustomization allottedServiceToResourceCustomization) {
- this.allottedServiceToResourceCustomization = allottedServiceToResourceCustomization;
- }
-
- public ServiceToResourceCustomization getVlServiceToResourceCustomization() {
- return vlServiceToResourceCustomization;
- }
-
- public void setVlServiceToResourceCustomization(
- ServiceToResourceCustomization vlServiceToResourceCustomization) {
- this.vlServiceToResourceCustomization = vlServiceToResourceCustomization;
- }
-
- public static MsoLogger getLogger() {
- return LOGGER;
- }
-
- public boolean isDeployedSuccessfully() {
- return isDeployedSuccessfully;
- }
-
- public void setSuccessfulDeployment() {
- isDeployedSuccessfully = true;
- }
-
-}
+/*-
+ * ============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.asdc.installer;
+
+import java.io.File;
+import java.util.List;
+
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.so.asdc.client.exceptions.ASDCDownloadException;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResource;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResource;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
+import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
+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.VnfResourceCustomization;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+
+public class ToscaResourceStructure {
+
+ Metadata serviceMetadata;
+ private Service catalogService;
+ ISdcCsarHelper sdcCsarHelper;
+ List<NodeTemplate> allottedList;
+ List<NodeTemplate> networkTypes;
+ List<NodeTemplate> vfTypes;
+ String heatTemplateUUID;
+ String volHeatTemplateUUID;
+ String volHeatEnvTemplateUUID;
+ String envHeatTemplateUUID;
+ String heatFilesUUID;
+ String workloadPerformance;
+ boolean isVnfAlreadyInstalled = false;
+ String serviceVersion;
+ private boolean isDeployedSuccessfully=false;
+
+
+ private NetworkResourceCustomization catalogNetworkResourceCustomization;
+
+ private NetworkResource catalogNetworkResource;
+
+ private List<NetworkInstanceGroup> catalogNetworkInstanceGroup;
+
+ private CollectionNetworkResourceCustomization catalogCollectionNetworkResourceCustomization;
+
+ private CollectionResource catalogCollectionResource;
+
+ private CollectionResourceCustomization catalogCollectionResourceCustomization;
+
+ private NetworkCollectionResourceCustomization catalogNetworkCollectionResourceCustomization;
+
+ private ServiceProxyResource catalogServiceProxyResource;
+
+ private ServiceProxyResourceCustomization catalogServiceProxyResourceCustomization;
+
+ private ConfigurationResource catalogConfigurationResource;
+
+ private ConfigurationResourceCustomization catalogConfigurationResourceCustomization;
+
+ private AllottedResourceCustomization catalogResourceCustomization;
+
+ private VfModule vfModule;
+
+ private VfModuleCustomization vfModuleCustomization;
+
+ //private VnfResource vnfResource;
+
+ private VnfResourceCustomization vnfResourceCustomization;
+
+ private AllottedResource allottedResource;
+
+ private AllottedResourceCustomization allottedResourceCustomization;
+
+ private TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup;
+
+ private IArtifactInfo toscaArtifact;
+
+ private ToscaCsar toscaCsar;
+
+ protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, ToscaResourceStructure.class);
+
+
+ public ToscaResourceStructure(){
+ }
+
+ public void updateResourceStructure(IArtifactInfo artifact) throws ASDCDownloadException {
+
+
+ try {
+
+ SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();//Autoclosable
+
+ LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
+
+ File spoolFile = new File(System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactName());
+
+ LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath());
+ LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath());
+
+
+ sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath());
+
+ }catch(Exception e){
+ System.out.println("System out " + e.getMessage());
+ LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
+ "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
+
+ throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e);
+ }
+
+ serviceMetadata = sdcCsarHelper.getServiceMetadata();
+
+ }
+
+ public String getHeatTemplateUUID() {
+ return heatTemplateUUID;
+ }
+
+ public void setHeatTemplateUUID(String heatTemplateUUID) {
+ this.heatTemplateUUID = heatTemplateUUID;
+ }
+
+ public List<NodeTemplate> getAllottedList() {
+ return allottedList;
+ }
+
+ public void setAllottedList(List<NodeTemplate> allottedList) {
+ this.allottedList = allottedList;
+ }
+
+ public ISdcCsarHelper getSdcCsarHelper() {
+ return sdcCsarHelper;
+ }
+
+ public void setSdcCsarHelper(ISdcCsarHelper sdcCsarHelper) {
+ this.sdcCsarHelper = sdcCsarHelper;
+ }
+
+ public Metadata getServiceMetadata() {
+ return serviceMetadata;
+ }
+
+ public Service getCatalogService() {
+ return catalogService;
+ }
+
+ public void setServiceMetadata(Metadata serviceMetadata) {
+ this.serviceMetadata = serviceMetadata;
+ }
+
+ public void setCatalogService(Service catalogService) {
+ this.catalogService = catalogService;
+ }
+
+ public List<NodeTemplate> getNetworkTypes() {
+ return networkTypes;
+ }
+
+ public void setNetworkTypes(List<NodeTemplate> networkTypes) {
+ this.networkTypes = networkTypes;
+ }
+
+ public List<NodeTemplate> getVfTypes() {
+ return vfTypes;
+ }
+
+ public void setVfTypes(List<NodeTemplate> vfTypes) {
+ this.vfTypes = vfTypes;
+ }
+
+ public AllottedResourceCustomization getCatalogResourceCustomization() {
+ return catalogResourceCustomization;
+ }
+
+ public void setCatalogResourceCustomization(
+ AllottedResourceCustomization catalogResourceCustomization) {
+ this.catalogResourceCustomization = catalogResourceCustomization;
+ }
+
+ // Network Only
+ public NetworkResourceCustomization getCatalogNetworkResourceCustomization() {
+ return catalogNetworkResourceCustomization;
+ }
+ // Network Only
+ public void setCatalogNetworkResourceCustomization(NetworkResourceCustomization catalogNetworkResourceCustomization) {
+ this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization;
+ }
+
+ public NetworkResource getCatalogNetworkResource() {
+ return catalogNetworkResource;
+ }
+
+ public void setCatalogNetworkResource(NetworkResource catalogNetworkResource) {
+ this.catalogNetworkResource = catalogNetworkResource;
+ }
+
+ public VfModule getCatalogVfModule() {
+ return vfModule;
+ }
+
+ public void setCatalogVfModule(VfModule vfModule) {
+ this.vfModule = vfModule;
+ }
+/*
+ public VnfResource getCatalogVnfResource() {
+ return vnfResource;
+ }
+
+ public void setCatalogVnfResource(VnfResource vnfResource) {
+ this.vnfResource = vnfResource;
+ }
+
+ */
+
+ public VnfResourceCustomization getCatalogVnfResourceCustomization() {
+ return vnfResourceCustomization;
+ }
+
+ public void setCatalogVnfResourceCustomization(
+ VnfResourceCustomization vnfResourceCustomization) {
+ this.vnfResourceCustomization = vnfResourceCustomization;
+ }
+
+ public VfModuleCustomization getCatalogVfModuleCustomization() {
+ return vfModuleCustomization;
+ }
+
+ public void setCatalogVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
+ this.vfModuleCustomization = vfModuleCustomization;
+ }
+
+ public AllottedResource getAllottedResource() {
+ return allottedResource;
+ }
+
+ public void setAllottedResource(AllottedResource allottedResource) {
+ this.allottedResource = allottedResource;
+ }
+
+ public AllottedResourceCustomization getCatalogAllottedResourceCustomization() {
+ return allottedResourceCustomization;
+ }
+
+ public void setCatalogAllottedResourceCustomization(
+ AllottedResourceCustomization allottedResourceCustomization) {
+ this.allottedResourceCustomization = allottedResourceCustomization;
+ }
+
+ public TempNetworkHeatTemplateLookup getCatalogTempNetworkHeatTemplateLookup() {
+ return tempNetworkHeatTemplateLookup;
+ }
+
+ public void setCatalogTempNetworkHeatTemplateLookup(
+ TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup) {
+ this.tempNetworkHeatTemplateLookup = tempNetworkHeatTemplateLookup;
+ }
+
+ public String getHeatFilesUUID() {
+ return heatFilesUUID;
+ }
+
+ public void setHeatFilesUUID(String heatFilesUUID) {
+ this.heatFilesUUID = heatFilesUUID;
+ }
+
+ public IArtifactInfo getToscaArtifact() {
+ return toscaArtifact;
+ }
+
+ public void setToscaArtifact(IArtifactInfo toscaArtifact) {
+ this.toscaArtifact = toscaArtifact;
+ }
+
+ public ToscaCsar getCatalogToscaCsar() {
+ return toscaCsar;
+ }
+
+ public void setCatalogToscaCsar(ToscaCsar toscaCsar) {
+ this.toscaCsar = toscaCsar;
+ }
+
+ public boolean isVnfAlreadyInstalled() {
+ return isVnfAlreadyInstalled;
+ }
+
+ public void setVnfAlreadyInstalled(boolean isVnfAlreadyInstalled) {
+ this.isVnfAlreadyInstalled = isVnfAlreadyInstalled;
+ }
+
+ public String getVolHeatTemplateUUID() {
+ return volHeatTemplateUUID;
+ }
+
+ public void setVolHeatTemplateUUID(String volHeatTemplateUUID) {
+ this.volHeatTemplateUUID = volHeatTemplateUUID;
+ }
+
+ public String getEnvHeatTemplateUUID() {
+ return envHeatTemplateUUID;
+ }
+
+ public void setEnvHeatTemplateUUID(String envHeatTemplateUUID) {
+ this.envHeatTemplateUUID = envHeatTemplateUUID;
+ }
+
+ public String getVolHeatEnvTemplateUUID() {
+ return volHeatEnvTemplateUUID;
+ }
+
+ public void setVolHeatEnvTemplateUUID(String volHeatEnvTemplateUUID) {
+ this.volHeatEnvTemplateUUID = volHeatEnvTemplateUUID;
+ }
+
+ public String getServiceVersion() {
+ return serviceVersion;
+ }
+
+ public void setServiceVersion(String serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ }
+
+ public String getWorkloadPerformance() {
+ return workloadPerformance;
+ }
+
+ public void setWorkloadPerformance(String workloadPerformance) {
+ this.workloadPerformance = workloadPerformance;
+ }
+
+ public VfModule getVfModule() {
+ return vfModule;
+ }
+
+ public void setVfModule(VfModule vfModule) {
+ this.vfModule = vfModule;
+ }
+
+ public VfModuleCustomization getVfModuleCustomization() {
+ return vfModuleCustomization;
+ }
+
+ public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
+ this.vfModuleCustomization = vfModuleCustomization;
+ }
+
+
+ public VnfResourceCustomization getVnfResourceCustomization() {
+ return vnfResourceCustomization;
+ }
+
+ public void setVnfResourceCustomization(
+ VnfResourceCustomization vnfResourceCustomization) {
+ this.vnfResourceCustomization = vnfResourceCustomization;
+ }
+
+ public AllottedResourceCustomization getAllottedResourceCustomization() {
+ return allottedResourceCustomization;
+ }
+
+ public void setAllottedResourceCustomization(
+ AllottedResourceCustomization allottedResourceCustomization) {
+ this.allottedResourceCustomization = allottedResourceCustomization;
+ }
+
+ public TempNetworkHeatTemplateLookup getTempNetworkHeatTemplateLookup() {
+ return tempNetworkHeatTemplateLookup;
+ }
+
+ public void setTempNetworkHeatTemplateLookup(
+ TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup) {
+ this.tempNetworkHeatTemplateLookup = tempNetworkHeatTemplateLookup;
+ }
+
+ public List<NetworkInstanceGroup> getCatalogNetworkInstanceGroup() {
+ return catalogNetworkInstanceGroup;
+ }
+
+ public void setCatalogNetworkInstanceGroup(List<NetworkInstanceGroup> catalogNetworkInstanceGroup) {
+ this.catalogNetworkInstanceGroup = catalogNetworkInstanceGroup;
+ }
+
+ public CollectionNetworkResourceCustomization getCatalogCollectionNetworkResourceCustomization() {
+ return catalogCollectionNetworkResourceCustomization;
+ }
+
+ public void setCatalogCollectionNetworkResourceCustomization(
+ CollectionNetworkResourceCustomization catalogCollectionNetworkResourceCustomization) {
+ this.catalogCollectionNetworkResourceCustomization = catalogCollectionNetworkResourceCustomization;
+ }
+
+ public CollectionResource getCatalogCollectionResource() {
+ return catalogCollectionResource;
+ }
+
+ public void setCatalogCollectionResource(CollectionResource catalogCollectionResource) {
+ this.catalogCollectionResource = catalogCollectionResource;
+ }
+
+ public CollectionResourceCustomization getCatalogCollectionResourceCustomization() {
+ return catalogCollectionResourceCustomization;
+ }
+
+ public void setCatalogCollectionResourceCustomization(
+ CollectionResourceCustomization catalogCollectionResourceCustomization) {
+ this.catalogCollectionResourceCustomization = catalogCollectionResourceCustomization;
+ }
+
+ public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustomization() {
+ return catalogNetworkCollectionResourceCustomization;
+ }
+
+ public void setCatalogNetworkCollectionResourceCustomization(
+ NetworkCollectionResourceCustomization catalogNetworkCollectionResourceCustomization) {
+ this.catalogNetworkCollectionResourceCustomization = catalogNetworkCollectionResourceCustomization;
+ }
+
+ public ServiceProxyResource getCatalogServiceProxyResource() {
+ return catalogServiceProxyResource;
+ }
+
+ public void setCatalogServiceProxyResource(ServiceProxyResource catalogServiceProxyResource) {
+ this.catalogServiceProxyResource = catalogServiceProxyResource;
+ }
+
+ public ServiceProxyResourceCustomization getCatalogServiceProxyResourceCustomization() {
+ return catalogServiceProxyResourceCustomization;
+ }
+
+ public void setCatalogServiceProxyResourceCustomization(
+ ServiceProxyResourceCustomization catalogServiceProxyResourceCustomization) {
+ this.catalogServiceProxyResourceCustomization = catalogServiceProxyResourceCustomization;
+ }
+
+ public ConfigurationResource getCatalogConfigurationResource() {
+ return catalogConfigurationResource;
+ }
+
+ public void setCatalogConfigurationResource(ConfigurationResource catalogConfigurationResource) {
+ this.catalogConfigurationResource = catalogConfigurationResource;
+ }
+
+ public ConfigurationResourceCustomization getCatalogConfigurationResourceCustomization() {
+ return catalogConfigurationResourceCustomization;
+ }
+
+ public void setCatalogConfigurationResourceCustomization(
+ ConfigurationResourceCustomization catalogConfigurationResourceCustomization) {
+ this.catalogConfigurationResourceCustomization = catalogConfigurationResourceCustomization;
+ }
+
+ public ToscaCsar getToscaCsar() {
+ return toscaCsar;
+ }
+
+ public void setToscaCsar(ToscaCsar toscaCsar) {
+ this.toscaCsar = toscaCsar;
+ }
+
+ public static MsoLogger getLogger() {
+ return LOGGER;
+ }
+
+ public boolean isDeployedSuccessfully() {
+ return isDeployedSuccessfully;
+ }
+
+ public void setSuccessfulDeployment() {
+ isDeployedSuccessfully = true;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleArtifact.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
similarity index 69%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleArtifact.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
index c1f8369..adc8071 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleArtifact.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
@@ -18,11 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
import java.io.UnsupportedEncodingException;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.HeatFiles;
+import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
@@ -33,22 +36,31 @@
public final class VfModuleArtifact {
private final IArtifactInfo artifactInfo;
private int deployedInDb=0;
- private final String result;
-
- private Object catalogObject;
+ private final String result;
+ private HeatFiles heatFiles;
+ private HeatTemplate heatTemplate;
+ private HeatEnvironment heatEnvironment;
public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
artifactInfo=artifactinfo;
result = new String(clientResult.getArtifactPayload(), "UTF-8");
+ }
+
+ public HeatFiles getHeatFiles() {
+ return heatFiles;
}
- public Object getCatalogObject() {
- return catalogObject;
+ public void setHeatFiles(HeatFiles heatFiles) {
+ this.heatFiles = heatFiles;
}
- public void setCatalogObject(Object catalogObject) {
- this.catalogObject = catalogObject;
+ public HeatTemplate getHeatTemplate() {
+ return heatTemplate;
+ }
+
+ public void setHeatTemplate(HeatTemplate heatTemplate) {
+ this.heatTemplate = heatTemplate;
}
public IArtifactInfo getArtifactInfo() {
@@ -66,5 +78,13 @@
public void incrementDeployedInDB() {
++deployedInDb;
}
+
+ public HeatEnvironment getHeatEnvironment() {
+ return heatEnvironment;
+ }
+
+ public void setHeatEnvironment(HeatEnvironment heatEnvironment) {
+ this.heatEnvironment=heatEnvironment;
+ }
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleMetaData.java
similarity index 98%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleMetaData.java
index 8ee5302..11000be 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleMetaData.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
import java.util.HashMap;
import java.util.List;
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
similarity index 93%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
index 2986a80..9f0525d 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,17 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
import org.onap.sdc.api.notification.IVfModuleMetadata;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.db.catalog.beans.VfModule;
public final class VfModuleStructure {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
similarity index 76%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index 10e9360..a045c2b 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -8,9 +8,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.
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.installer;
+package org.onap.so.asdc.installer;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -27,22 +27,19 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.mso.logger.MessageEnum;
+import org.onap.so.logger.MessageEnum;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -51,15 +48,21 @@
* This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure).
*
*/
-public final class VfResourceStructure {
+
+
+public class VfResourceStructure {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
+ protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, VfResourceStructure.class);
private boolean isDeployedSuccessfully=false;
/**
* The Raw notification data.
*/
private final INotificationData notification;
+ /**
+ * The Raw notification data.
+ */
+ private boolean isAlreadyDeployed=false;
/**
* The resource we will try to deploy.
@@ -79,16 +82,10 @@
private VnfResource catalogVnfResource;
private NetworkResourceCustomization catalogNetworkResourceCustomization;
-
- private ServiceToNetworks catalogServiceToNetworks;
-
- private ServiceToAllottedResources catalogServiceToAllottedResources;
-
+
private AllottedResourceCustomization catalogResourceCustomization;
private Service catalogService;
-
- private List<String> vfArtifactUUIDList;
/**
* The list of artifacts existing in this resource hashed by UUID.
@@ -99,13 +96,10 @@
public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) {
notification=notificationdata;
resourceInstance=resourceinstance;
-
-
vfModulesStructureList = new LinkedList<>();
artifactsMapByUUID = new HashMap<>();
}
-
- //@Override
+
public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult);
@@ -119,21 +113,11 @@
case ASDCConfiguration.OTHER:
artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
break;
-
case ASDCConfiguration.VF_MODULES_METADATA:
- vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
-
- for(IVfModuleData moduleData : vfModulesMetadataList){
-
- }
-
- //vfArtifactUUIDList.add(artifactinfo.getArtifactUUID());
- //vfModulesMetadataList = distributionClient.decodeVfModuleArtifact(clientResult.getArtifactPayload());
+ vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
break;
-
default:
break;
-
}
}
@@ -144,10 +128,10 @@
LOGGER.info(MessageEnum.ASDC_GENERAL_INFO,"There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures");
return;
}
- for (IVfModuleData vfModuleMeta:vfModulesMetadataList) {
- vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta));
+ for (IVfModuleData vfModuleMeta:vfModulesMetadataList) {
+ vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta));
+ }
}
- }
public INotificationData getNotification() {
return notification;
@@ -168,6 +152,14 @@
public void setSuccessfulDeployment() {
isDeployedSuccessfully = true;
}
+
+ public boolean isAlreadyDeployed() {
+ return isAlreadyDeployed;
+ }
+
+ public void setAlreadyDeployed(boolean isAlreadyDeployed) {
+ this.isAlreadyDeployed = isAlreadyDeployed;
+ }
public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
return artifactsMapByUUID;
@@ -193,24 +185,6 @@
public void setCatalogNetworkResourceCustomization(NetworkResourceCustomization catalogNetworkResourceCustomization) {
this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization;
}
- // Network Only
- public ServiceToNetworks getCatalogServiceToNetworks() {
- return catalogServiceToNetworks;
- }
- // Network Only
- public void setCatalogServiceToNetworks(
- ServiceToNetworks catalogServiceToNetworks) {
- this.catalogServiceToNetworks = catalogServiceToNetworks;
- }
-
- public ServiceToAllottedResources getCatalogServiceToAllottedResources() {
- return catalogServiceToAllottedResources;
- }
-
- public void setCatalogServiceToAllottedResources(
- ServiceToAllottedResources catalogServiceToAllottedResources) {
- this.catalogServiceToAllottedResources = catalogServiceToAllottedResources;
- }
public AllottedResourceCustomization getCatalogResourceCustomization() {
return catalogResourceCustomization;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
new file mode 100644
index 0000000..ea952f6
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -0,0 +1,1589 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.installer.heat;
+
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+
+import org.hibernate.exception.ConstraintViolationException;
+import org.hibernate.exception.LockAcquisitionException;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.IStatusData;
+import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.onap.sdc.tosca.parser.impl.SdcTypes;
+import org.onap.sdc.toscaparser.api.CapabilityAssignment;
+import org.onap.sdc.toscaparser.api.CapabilityAssignments;
+import org.onap.sdc.toscaparser.api.Group;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.RequirementAssignment;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.installer.ASDCElementInfo;
+import org.onap.so.asdc.installer.BigDecimalVersion;
+import org.onap.so.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.asdc.installer.VfModuleArtifact;
+import org.onap.so.asdc.installer.VfModuleStructure;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.asdc.util.YamlEditor;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResource;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.HeatFiles;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.InstanceGroupType;
+import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResource;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
+import org.onap.so.db.catalog.beans.SubType;
+import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
+import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VFCInstanceGroup;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+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.CollectionResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
+import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository;
+import org.onap.so.db.catalog.data.repository.HeatTemplateRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
+import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class ToscaResourceInstaller {
+
+ protected static final String ALLOTTED_RESOURCE = "Allotted Resource";
+
+ protected static final String MULTI_STAGE_DESIGN = "multi_stage_design";
+
+ protected static final String SCALABLE = "scalable";
+
+ protected static final String BASIC = "BASIC";
+
+ protected static final String PROVIDER = "PROVIDER";
+
+ protected static final String HEAT = "HEAT";
+
+ protected static final String MANUAL_RECORD = "MANUAL_RECORD";
+
+ protected static final String MSO = "SO";
+
+
+ @Autowired
+ protected ServiceRepository serviceRepo;
+
+ @Autowired
+ protected InstanceGroupRepository instanceGroupRepo;
+
+ @Autowired
+ protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
+
+ @Autowired
+ protected CollectionResourceRepository collectionRepo;
+
+ @Autowired
+ protected CollectionResourceCustomizationRepository collectionCustomizationRepo;
+
+ @Autowired
+ protected ConfigurationResourceCustomizationRepository configCustomizationRepo;
+
+ @Autowired
+ protected VnfResourceRepository vnfRepo;
+
+ @Autowired
+ protected VnfCustomizationRepository vnfCustomizationRepo;
+
+ @Autowired
+ protected VFModuleRepository vfModuleRepo;
+
+ @Autowired
+ protected VFModuleCustomizationRepository vfModuleCustomizationRepo;
+
+ @Autowired
+ protected VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo;
+
+ @Autowired
+ protected AllottedResourceRepository allottedRepo;
+
+ @Autowired
+ protected AllottedResourceCustomizationRepository allottedCustomizationRepo;
+
+ @Autowired
+ protected NetworkResourceRepository networkRepo;
+
+ @Autowired
+ protected HeatTemplateRepository heatRepo;
+
+ @Autowired
+ protected NetworkResourceCustomizationRepository networkCustomizationRepo;
+
+ @Autowired
+ protected WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository;
+ @Autowired
+ protected WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
+ @Autowired
+ protected WatchdogServiceModVerIdLookupRepository watchdogModVerIdLookupRepository;
+
+ @Autowired
+ protected TempNetworkHeatTemplateRepository tempNetworkLookupRepo;
+
+ @Autowired
+ protected ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository;
+
+ protected static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ToscaResourceInstaller.class);
+
+ public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
+ boolean status = false;
+ VfResourceStructure vfResourceStructure = vfResourceStruct;
+ try {
+ status = vfResourceStructure.isDeployedSuccessfully();
+ } catch (RuntimeException e) {
+ status = false;
+ }
+ try {
+ Service existingService = serviceRepo.findOneByModelUUID(vfResourceStructure.getNotification().getServiceUUID());
+ if(existingService != null)
+ status = true;
+ if (status) {
+ logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
+ vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
+ vfResourceStructure.getNotification().getServiceName(),
+ BigDecimalVersion.castAndCheckNotificationVersionToString(
+ vfResourceStructure.getNotification().getServiceVersion()),
+ vfResourceStructure.getNotification().getServiceUUID(),
+ vfResourceStructure.getResourceInstance().getResourceName(), "", "");
+ WatchdogComponentDistributionStatus wdStatus = new WatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), MSO);
+ wdStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+ watchdogCDStatusRepository.saveAndFlush(wdStatus);
+ } else {
+ logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
+ vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
+ vfResourceStructure.getNotification().getServiceName(),
+ BigDecimalVersion.castAndCheckNotificationVersionToString(
+ vfResourceStructure.getNotification().getServiceVersion()),
+ vfResourceStructure.getNotification().getServiceUUID(),
+ vfResourceStructure.getResourceInstance().getResourceName(), "", "");
+ }
+ return status;
+ } catch (Exception e) {
+ logger.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, "", "", MsoLogger.ErrorCode.SchemaError,
+ "Exception - isResourceAlreadyDeployed");
+ throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
+ }
+ }
+
+ public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException {
+ logger.debug("Entering installTheComponentStatus for distributionId " + iStatus.getDistributionID()
+ + " and ComponentName " + iStatus.getComponentName());
+
+ try {
+ WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(iStatus.getDistributionID(),
+ iStatus.getComponentName());
+ cdStatus.setComponentDistributionStatus(iStatus.getStatus().toString());
+ watchdogCDStatusRepository.save(cdStatus);
+
+ } catch (Exception e) {
+ logger.debug("Exception caught in installTheComponentStatus " + e.getMessage());
+ throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage());
+ }
+ }
+
+ @Transactional(rollbackFor = { ArtifactInstallerException.class })
+ public void installTheResource(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct)
+ throws ArtifactInstallerException {
+ VfResourceStructure vfResourceStructure = vfResourceStruct;
+ extractHeatInformation(toscaResourceStruct, vfResourceStructure);
+
+ // PCLO: in case of deployment failure, use a string that will represent
+ // the type of artifact that failed...
+ List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
+ try {
+ createToscaCsar(toscaResourceStruct);
+ createService(toscaResourceStruct, vfResourceStruct);
+ Service service = toscaResourceStruct.getCatalogService();
+ List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
+
+
+ for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
+
+ Metadata metadata = nodeTemplate.getMetaData();
+ String serviceType = toscaResourceStruct.getCatalogService().getServiceType();
+ String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper()
+ .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
+ vfCustomizationCategory);
+ }
+
+ List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
+ processAllottedResources(toscaResourceStruct, service, allottedResourceList);
+ processNetworks(toscaResourceStruct, service);
+ // process Network Collections
+ processNetworkCollections(toscaResourceStruct, service);
+ // Process Service Proxy & Configuration
+ processServiceProxyAndConfiguration(toscaResourceStruct, service);
+
+ serviceRepo.save(service);
+
+ WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), MSO);
+ status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+ watchdogCDStatusRepository.save(status);
+
+ toscaResourceStruct.setSuccessfulDeployment();
+
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), MSO);
+ status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_ERROR.name());
+ watchdogCDStatusRepository.save(status);
+ Throwable dbExceptionToCapture = e;
+ while (!(dbExceptionToCapture instanceof ConstraintViolationException
+ || dbExceptionToCapture instanceof LockAcquisitionException)
+ && (dbExceptionToCapture.getCause() != null)) {
+ dbExceptionToCapture = dbExceptionToCapture.getCause();
+ }
+
+ if (dbExceptionToCapture instanceof ConstraintViolationException
+ || dbExceptionToCapture instanceof LockAcquisitionException) {
+ logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED,
+ vfResourceStructure.getResourceInstance().getResourceName(),
+ vfResourceStructure.getNotification().getServiceVersion(), "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
+ } else {
+ String elementToLog = (!artifactListForLogging.isEmpty()
+ ? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
+ : "No element listed");
+ logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError,
+ "Exception caught during installation of "
+ + vfResourceStructure.getResourceInstance().getResourceName()
+ + ". Transaction rollback",
+ e);
+ throw new ArtifactInstallerException("Exception caught during installation of "
+ + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
+ }
+ }
+ }
+
+ protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service)
+ throws ArtifactInstallerException {
+ List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList();
+
+ if (nodeTemplatesVLList != null) {
+ for (NodeTemplate vlNode : nodeTemplatesVLList) {
+ String networkResourceModelName = vlNode.getMetaData()
+ .getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+
+ TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkResourceModelName);
+
+ if (tempNetworkLookUp != null ) {
+ HeatTemplate heatTemplate = heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
+ if (heatTemplate != null ) {
+ NetworkResourceCustomization networkCustomization = createNetwork(vlNode, toscaResourceStruct, heatTemplate,tempNetworkLookUp.getAicVersionMax(),
+ tempNetworkLookUp.getAicVersionMin(),service);
+ service.getNetworkCustomizations()
+ .add(networkCustomization);
+ }
+ else{
+ throw new ArtifactInstallerException(
+ "No HeatTemplate found for artifactUUID: "
+ + tempNetworkLookUp.getHeatTemplateArtifactUuid());
+ }
+ } else {
+ throw new ArtifactInstallerException(
+ "No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
+ + networkResourceModelName);
+ }
+
+ }
+ }
+ }
+
+ protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service,
+ List<NodeTemplate> allottedResourceList) {
+ if (allottedResourceList != null) {
+ for (NodeTemplate allottedNode : allottedResourceList) {
+ service.getAllottedCustomizations()
+ .add(createAllottedResource(allottedNode, toscaResourceStruct, service));
+ }
+ }
+ }
+
+ protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) {
+
+ List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
+
+ List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
+
+ if (serviceProxyResourceList != null) {
+ for (NodeTemplate spNode : serviceProxyResourceList) {
+ createServiceProxy(spNode, service, toscaResourceStruct);
+ serviceProxyCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogServiceProxyResourceCustomization());
+
+ for (NodeTemplate configNode : configurationNodeTemplatesList) {
+
+ List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
+ for (RequirementAssignment requirement : requirementsList) {
+ if (requirement.getNodeTemplateName().equals(spNode.getName())) {
+ createConfiguration(configNode, toscaResourceStruct, toscaResourceStruct.getCatalogServiceProxyResourceCustomization());
+ configCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogConfigurationResourceCustomization());
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+ protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
+
+ List<NodeTemplate> networkCollectionList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
+
+ if (networkCollectionList != null) {
+ for (NodeTemplate crNode : networkCollectionList) {
+
+ createNetworkCollection(crNode, toscaResourceStruct, service);
+ collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource());
+
+ List<NetworkInstanceGroup> networkInstanceGroupList = toscaResourceStruct.getCatalogNetworkInstanceGroup();
+ for(NetworkInstanceGroup networkInstanceGroup : networkInstanceGroupList){
+ instanceGroupRepo.saveAndFlush(networkInstanceGroup);
+ }
+
+ }
+ }
+ service.getCollectionResourceCustomizations().add(toscaResourceStruct.getCatalogCollectionResourceCustomization());
+ }
+
+ protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
+ Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) throws Exception {
+ if (!vfCustomizationCategory.equalsIgnoreCase(ALLOTTED_RESOURCE))
+ {
+
+ String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper()
+ .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ logger.debug("vfCustomizationUUID=" + vfCustomizationUUID);
+
+ VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+
+ for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
+ logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
+ List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct
+ .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
+ IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
+ Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream().
+ filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())).
+ findFirst();
+ if(matchingObject.isPresent()){
+ VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource);
+ vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
+ }else
+ throw (new Exception("Cannot find matching VFModule Customization"));
+
+ }
+ service.getVnfCustomizations().add(vnfResource);
+ }
+ }
+
+ protected void processFlexware(ToscaResourceStructure toscaResourceStruct, Service service, NodeTemplate nodeTemplate,
+ String serviceType) {
+ if (serviceType != null && serviceType.equalsIgnoreCase("Flexware")) {
+
+ createVnfResource(nodeTemplate, toscaResourceStruct, service);
+ String modelName = toscaResourceStruct.getVnfResourceCustomization().getVnfResources().getModelName();
+
+ String modelVersion = BigDecimalVersion.castAndCheckNotificationVersionToString(
+ toscaResourceStruct.getCatalogVnfResourceCustomization().getVnfResources().getModelVersion());
+ // check for duplicate record already in the database
+ VnfResource vnfResource = vnfRepo.findByModelNameAndModelVersion(modelName, modelVersion);
+
+ if (vnfResource != null) {
+ toscaResourceStruct.setVnfAlreadyInstalled(true);
+ }
+
+ vnfCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogVnfResourceCustomization());
+ }
+ }
+
+ public void processWatchdog(String distributionId, String servideUUID) {
+ WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId,servideUUID);
+ watchdogModVerIdLookupRepository.saveAndFlush(modVerIdLookup);
+
+ WatchdogDistributionStatus distributionStatus = new WatchdogDistributionStatus(distributionId);
+ watchdogDistributionStatusRepository.saveAndFlush(distributionStatus);
+ }
+
+ protected void extractHeatInformation(ToscaResourceStructure toscaResourceStruct,
+ VfResourceStructure vfResourceStructure) {
+ for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+
+ switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) {
+ case ASDCConfiguration.HEAT:
+ case ASDCConfiguration.HEAT_NESTED:
+ createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct,
+ vfModuleArtifact);
+ break;
+ case ASDCConfiguration.HEAT_VOL:
+ createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct,
+ vfModuleArtifact);
+ VfModuleArtifact envModuleArtifact = getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure, vfModuleArtifact);
+ createHeatEnvFromArtifact(vfResourceStructure, envModuleArtifact);
+ break;
+ case ASDCConfiguration.HEAT_ENV:
+ createHeatEnvFromArtifact(vfResourceStructure, vfModuleArtifact);
+ break;
+ case ASDCConfiguration.HEAT_ARTIFACT:
+ createHeatFileFromArtifact(vfResourceStructure, vfModuleArtifact,
+ toscaResourceStruct);
+ break;
+ case ASDCConfiguration.HEAT_NET:
+ case ASDCConfiguration.OTHER:
+ logger.warn(MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
+ vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
+ + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
+ "", "", MsoLogger.ErrorCode.DataError, "Artifact type not supported");
+ break;
+ default:
+ break;
+
+ }
+ }
+ }
+
+ protected VfModuleArtifact getHeatEnvArtifactFromGeneratedArtifact(VfResourceStructure vfResourceStructure,
+ VfModuleArtifact vfModuleArtifact) {
+ String artifactName = vfModuleArtifact.getArtifactInfo().getArtifactName();
+ artifactName = artifactName.substring(0, artifactName.indexOf('.'));
+ for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+ if (moduleArtifact.getArtifactInfo().getArtifactName().contains(artifactName)
+ && moduleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
+ return moduleArtifact;
+ }
+ }
+ return null;
+ }
+
+ public String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure,
+ List<String> listTypes) {
+ String newFileBody = filebody;
+ for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+
+ if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) {
+
+ newFileBody = verifyTheFilePrefixInString(newFileBody,
+ moduleArtifact.getArtifactInfo().getArtifactName());
+ }
+ }
+ return newFileBody;
+ }
+
+ public String verifyTheFilePrefixInString(final String body, final String filenameToVerify) {
+
+ String needlePrefix = "file:///";
+ String prefixedFilenameToVerify = needlePrefix + filenameToVerify;
+
+ if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) {
+ return body;
+ }
+
+ StringBuilder sb = new StringBuilder(body.length());
+
+ int currentIndex = 0;
+ int startIndex = 0;
+
+ while (currentIndex != -1) {
+ startIndex = currentIndex;
+ currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex);
+
+ if (currentIndex == -1) {
+ break;
+ }
+ // We append from the startIndex up to currentIndex (start of File
+ // Name)
+ sb.append(body.substring(startIndex, currentIndex));
+ sb.append(filenameToVerify);
+
+ currentIndex += prefixedFilenameToVerify.length();
+ }
+
+ sb.append(body.substring(startIndex));
+
+ return sb.toString();
+ }
+
+ protected void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure,
+ ToscaResourceStructure toscaResourceStruct, VfModuleArtifact vfModuleArtifact) {
+ HeatTemplate heatTemplate = new HeatTemplate();
+ List<String> typeList = new ArrayList<>();
+ typeList.add(ASDCConfiguration.HEAT_NESTED);
+ typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
+
+ heatTemplate.setTemplateBody(
+ verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(), vfResourceStructure, typeList));
+ heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName());
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
+ heatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
+ } else {
+ heatTemplate.setTimeoutMinutes(240);
+ }
+
+ heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
+ heatTemplate.setVersion(BigDecimalVersion
+ .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+ heatTemplate.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
+ heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+ } else {
+ heatTemplate.setArtifactChecksum(MANUAL_RECORD);
+ }
+
+ Set<HeatTemplateParam> heatParam = extractHeatTemplateParameters(
+ vfModuleArtifact.getResult(), vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+ heatTemplate.setParameters(heatParam);
+ vfModuleArtifact.setHeatTemplate(heatTemplate);
+ }
+
+ protected void createHeatEnvFromArtifact(VfResourceStructure vfResourceStructure,
+ VfModuleArtifact vfModuleArtifact) {
+ HeatEnvironment heatEnvironment = new HeatEnvironment();
+ heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName());
+ List<String> typeList = new ArrayList<>();
+ typeList.add(ASDCConfiguration.HEAT);
+ typeList.add(ASDCConfiguration.HEAT_VOL);
+ heatEnvironment.setEnvironment(
+ verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(), vfResourceStructure, typeList));
+ heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
+ heatEnvironment.setVersion(BigDecimalVersion
+ .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+ heatEnvironment.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
+ heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+ } else {
+ heatEnvironment.setArtifactChecksum(MANUAL_RECORD);
+ }
+ vfModuleArtifact.setHeatEnvironment(heatEnvironment);
+ }
+
+ protected void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure,
+ VfModuleArtifact vfModuleArtifact, ToscaResourceStructure toscaResourceStruct) {
+
+ HeatFiles heatFile = new HeatFiles();
+ heatFile.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+ heatFile.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
+ heatFile.setFileBody(vfModuleArtifact.getResult());
+ heatFile.setFileName(vfModuleArtifact.getArtifactInfo().getArtifactName());
+ heatFile.setVersion(BigDecimalVersion
+ .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+ toscaResourceStruct.setHeatFilesUUID(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+ if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
+ heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+ } else {
+ heatFile.setArtifactChecksum(MANUAL_RECORD);
+ }
+ vfModuleArtifact.setHeatFiles(heatFile);
+ }
+
+ protected Service createService(ToscaResourceStructure toscaResourceStructure,
+ VfResourceStructure vfResourceStructure) {
+
+ toscaResourceStructure.getServiceMetadata();
+
+ Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
+
+ Service service = new Service();
+
+ if (serviceMetadata != null) {
+
+ if (toscaResourceStructure.getServiceVersion() != null) {
+ service.setModelVersion(toscaResourceStructure.getServiceVersion());
+ }
+
+ service.setServiceType(serviceMetadata.getValue("serviceType"));
+ service.setServiceRole(serviceMetadata.getValue("serviceRole"));
+
+ service.setDescription(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ service.setModelName(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ service.setModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ service.setEnvironmentContext(serviceMetadata.getValue("environmentContext"));
+
+ if (vfResourceStructure != null)
+ service.setWorkloadContext(vfResourceStructure.getNotification().getWorkloadContext());
+
+ service.setModelInvariantUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ service.setCsar(toscaResourceStructure.getCatalogToscaCsar());
+ }
+
+
+ toscaResourceStructure.setCatalogService(service);
+ return service;
+ }
+
+ protected ServiceProxyResourceCustomization createServiceProxy(NodeTemplate nodeTemplate, Service service, ToscaResourceStructure toscaResourceStructure) {
+
+ Metadata spMetadata = nodeTemplate.getMetaData();
+
+ ServiceProxyResource spResource = new ServiceProxyResource();
+
+ spResource.setModelName(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ spResource.setModelInvariantUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ spResource.setModelUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ spResource.setModelVersion(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ spResource.setDescription(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+
+ ServiceProxyResourceCustomization spCustomizationResource = new ServiceProxyResourceCustomization();
+
+ Set<ServiceProxyResourceCustomization> serviceProxyCustomizationSet = new HashSet<>();
+
+ spCustomizationResource.setModelCustomizationUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ spCustomizationResource.setModelInstanceName(nodeTemplate.getName());
+ spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
+ spCustomizationResource.setSourceService(service);
+ spCustomizationResource.setServiceProxyResource(spResource);
+ spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
+ spCustomizationResource.setServiceProxyResource(spResource);
+ serviceProxyCustomizationSet.add(spCustomizationResource);
+
+
+ spResource.setServiceProxyCustomization(serviceProxyCustomizationSet);
+
+ toscaResourceStructure.setCatalogServiceProxyResource(spResource);
+
+ toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource);
+
+ return spCustomizationResource;
+ }
+
+ protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) {
+
+ Metadata metadata = nodeTemplate.getMetaData();
+
+ ConfigurationResource configResource = new ConfigurationResource();
+
+ configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ configResource.setToscaNodeType(nodeTemplate.getType());
+
+ ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
+
+ Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
+
+ configCustomizationResource.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
+
+ configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ configCustomizationResource.setServiceProxyResourceCustomization(spResourceCustomization);
+ configCustomizationResource.setConfigResourceCustomization(configCustomizationResource);
+ configCustomizationResource.setConfigurationResource(configResource);
+ configResourceCustomizationSet.add(configCustomizationResource);
+
+ configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+
+ toscaResourceStructure.setCatalogConfigurationResource(configResource);
+
+ toscaResourceStructure.setCatalogConfigurationResourceCustomization(configCustomizationResource);
+
+ return configCustomizationResource;
+ }
+
+
+ protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
+ ToscaCsar toscaCsar = new ToscaCsar();
+ if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) {
+ toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum());
+ } else {
+ toscaCsar.setArtifactChecksum(MANUAL_RECORD);
+ }
+ toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
+ toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName());
+ toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion());
+ toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription());
+ toscaCsar.setUrl(toscaResourceStructure.getToscaArtifact().getArtifactURL());
+
+ toscaResourceStructure.setCatalogToscaCsar(toscaCsar);
+ }
+
+ protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin,Service service) {
+
+ NetworkResourceCustomization networkResourceCustomization=networkCustomizationRepo.findOneByModelCustomizationUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ if(networkResourceCustomization==null){
+ networkResourceCustomization = createNetworkResourceCustomization(networkNodeTemplate,
+ toscaResourceStructure);
+
+ NetworkResource networkResource = findExistingNetworkResource(service,
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ if(networkResource == null)
+ networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate,
+ aicMax, aicMin);
+
+ networkResource.addNetworkResourceCustomization(networkResourceCustomization);
+ networkResourceCustomization.setNetworkResource(networkResource);
+ }
+ return networkResourceCustomization;
+ }
+
+ protected NetworkResource findExistingNetworkResource(Service service, String modelUUID) {
+ NetworkResource networkResource = null;
+ for(NetworkResourceCustomization networkCustom : service.getNetworkCustomizations()){
+ if (networkCustom.getNetworkResource() != null
+ && networkCustom.getNetworkResource().getModelUUID().equals(modelUUID)) {
+ networkResource = networkCustom.getNetworkResource();
+ }
+ }
+ if(networkResource==null)
+ networkResource = networkRepo.findResourceByModelUUID(modelUUID);
+
+ return networkResource;
+ }
+
+ protected NetworkResourceCustomization createNetworkResourceCustomization(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure) {
+ NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
+ networkResourceCustomization.setModelInstanceName(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ networkResourceCustomization.setModelCustomizationUUID(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+
+ networkResourceCustomization.setNetworkTechnology(
+ testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)));
+ networkResourceCustomization.setNetworkType(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)));
+ networkResourceCustomization.setNetworkRole(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)));
+ networkResourceCustomization.setNetworkScope(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)));
+ return networkResourceCustomization;
+ }
+
+ protected NetworkResource createNetworkResource(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin) {
+ NetworkResource networkResource = new NetworkResource();
+ String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
+ networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+
+ if ("true".equalsIgnoreCase(providerNetwork)) {
+ networkResource.setNeutronNetworkType(PROVIDER);
+ } else {
+ networkResource.setNeutronNetworkType(BASIC);
+ }
+
+ networkResource.setModelName(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+
+ networkResource.setModelInvariantUUID(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ networkResource.setModelUUID(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ networkResource.setModelVersion(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+
+ networkResource.setAicVersionMax(aicMax);
+ networkResource.setAicVersionMin(aicMin);
+ networkResource.setToscaNodeType(networkNodeTemplate.getType());
+ networkResource.setDescription(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ networkResource.setOrchestrationMode(HEAT);
+ networkResource.setHeatTemplate(heatTemplate);
+ return networkResource;
+ }
+
+ protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, Service service) {
+
+ CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = new CollectionNetworkResourceCustomization();
+
+ // **** Build Object to populate Collection_Resource table
+ CollectionResource collectionResource = new CollectionResource();
+
+ collectionResource
+ .setModelName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ collectionResource.setModelInvariantUUID(
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ collectionResource
+ .setModelUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ collectionResource
+ .setModelVersion(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ collectionResource
+ .setDescription(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ collectionResource.setToscaNodeType(networkNodeTemplate.getType());
+
+ toscaResourceStructure.setCatalogCollectionResource(collectionResource);
+
+ // **** Build object to populate Collection_Resource_Customization table
+ NetworkCollectionResourceCustomization ncfc = new NetworkCollectionResourceCustomization();
+
+ ncfc.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ "cr_function"));
+ ncfc.setRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ "cr_role"));
+ ncfc.setType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ "cr_type"));
+
+ ncfc.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ ncfc.setModelCustomizationUUID(
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>();
+ networkResourceCustomizationSet.add(collectionNetworkResourceCustomization);
+
+ ncfc.setNetworkResourceCustomization(networkResourceCustomizationSet);
+
+ ncfc.setCollectionResource(collectionResource);
+ toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc);
+
+ //*** Build object to populate the Instance_Group table
+ List<Group> groupList = toscaResourceStructure.getSdcCsarHelper()
+ .getGroupsOfOriginOfNodeTemplateByToscaGroupType(networkNodeTemplate,
+ "org.openecomp.groups.NetworkCollection");
+
+ List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
+
+ List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList = new ArrayList<CollectionResourceInstanceGroupCustomization>();
+
+ for (Group group : groupList) {
+
+ NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup();
+ Metadata instanceMetadata = group.getMetadata();
+ networkInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ networkInstanceGroup
+ .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ networkInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ networkInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ networkInstanceGroup.setToscaNodeType(group.getType());
+ networkInstanceGroup.setRole(SubType.SUB_INTERFACE.toString()); // Set
+ // Role
+ networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set
+ // type
+ networkInstanceGroup.setCollectionResource(collectionResource);
+
+ // ****Build object to populate
+ // Collection_Resource_Instance_Group_Customization table
+ CollectionResourceInstanceGroupCustomization crInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
+ crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup);
+ crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ crInstanceGroupCustomization.setModelCustomizationUUID(
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ String quantityName = instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+ String fixedQuantity = quantityName.replace("NetworkCollection", "Fixed");
+ if (toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ fixedQuantity + "_quantity") != null) {
+
+ crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ fixedQuantity + "_quantity")));
+ }
+
+ crInstanceGroupCustomization.setDescription(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
+ + "_network_collection_description"));
+ crInstanceGroupCustomization.setFunction(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
+ + "_network_collection_function"));
+ crInstanceGroupCustomization.setCollectionResourceCust(ncfc);
+ collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization);
+
+ networkInstanceGroup
+ .setCollectionInstanceGroupCustomizations(collectionResourceInstanceGroupCustomizationList);
+
+ networkInstanceGroupList.add(networkInstanceGroup);
+
+ //}
+
+ toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
+
+ List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL);
+
+ List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>();
+
+ //*****Build object to populate the NetworkResource table
+ NetworkResource networkResource = new NetworkResource();
+
+ for(NodeTemplate vlNodeTemplate : vlNodeList){
+
+ String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
+ vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+
+ if ("true".equalsIgnoreCase(providerNetwork)) {
+ networkResource.setNeutronNetworkType(PROVIDER);
+ } else {
+ networkResource.setNeutronNetworkType(BASIC);
+ }
+
+ networkResource.setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+
+ networkResource.setModelInvariantUUID(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ networkResource.setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ networkResource
+ .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+
+ networkResource.setAicVersionMax(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+
+ TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+
+ if (tempNetworkLookUp != null ) {
+
+ HeatTemplate heatTemplate = heatRepo
+ .findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
+ networkResource.setHeatTemplate(heatTemplate);
+
+ networkResource.setAicVersionMin(tempNetworkLookUp.getAicVersionMin());
+
+ }
+
+ networkResource.setToscaNodeType(vlNodeTemplate.getType());
+ networkResource
+ .setDescription(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ networkResource.setOrchestrationMode(HEAT);
+
+ // Build object to populate the
+ // Collection_Network_Resource_Customization table
+ for (NodeTemplate memberNode : group.getMemberNodes()) {
+ collectionNetworkResourceCustomization.setModelInstanceName(memberNode.getName());
+ }
+
+ collectionNetworkResourceCustomization.setModelCustomizationUUID(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ collectionNetworkResourceCustomization.setNetworkTechnology(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+ collectionNetworkResourceCustomization.setNetworkType(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+ collectionNetworkResourceCustomization.setNetworkRole(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+ collectionNetworkResourceCustomization.setNetworkScope(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+ collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup);
+ collectionNetworkResourceCustomization.setNetworkResource(networkResource);
+ collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc);
+
+ collectionNetworkResourceCustomizationList.add(collectionNetworkResourceCustomization);
+ }
+
+ }
+
+ return collectionNetworkResourceCustomization;
+ }
+
+ protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group,
+ VnfResourceCustomization vnfResourceCustomization) {
+
+ Metadata instanceMetadata = group.getMetadata();
+ // Populate InstanceGroup
+ VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
+
+ vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ vfcInstanceGroup.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ vfcInstanceGroup.setToscaNodeType(group.getType());
+ vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role
+ vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type
+
+ //Populate VNFCInstanceGroupCustomization
+ VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization();
+
+ vfcInstanceGroupCustom.setModelCustomizationUUID(vnfResourceCustomization.getModelCustomizationUUID());
+ vfcInstanceGroupCustom.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ vfcInstanceGroupCustom.setDescription(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ vfcInstanceGroupCustom.setFunction("FUNCTION");
+ vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
+ vfcInstanceGroupCustom.setVnfResourceCust(vnfResourceCustomization);
+
+ return vfcInstanceGroupCustom;
+
+ }
+
+ protected VFCInstanceGroup findExistingVnfcInstanceGroup(VnfResourceCustomization vnfResourceCustomization,
+ String modelUUID) {
+ VFCInstanceGroup vfcInstanceGroup = null;
+ List<VnfcInstanceGroupCustomization> vnfInstanceGroupCustomizations = vnfResourceCustomization
+ .getVnfcInstanceGroupCustomizations();
+ if(vnfInstanceGroupCustomizations != null){
+ for (VnfcInstanceGroupCustomization vnfcInstanceGroupCustom : vnfResourceCustomization
+ .getVnfcInstanceGroupCustomizations()) {
+ if (vnfcInstanceGroupCustom.getInstanceGroup() != null
+ && vnfcInstanceGroupCustom.getInstanceGroup().getModelUUID().equals(modelUUID)) {
+ vfcInstanceGroup = (VFCInstanceGroup)vnfcInstanceGroupCustom.getInstanceGroup();
+ }
+ }
+ }
+ if (vfcInstanceGroup == null)
+ vfcInstanceGroup = (VFCInstanceGroup) instanceGroupRepo.findByModelUUID(modelUUID);
+
+ return vfcInstanceGroup;
+ }
+
+ protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
+ IVfModuleData vfModuleData, VnfResourceCustomization vnfResource) {
+ VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource,
+ vfModuleData.getVfModuleModelCustomizationUUID());
+ if(vfModuleCustomization == null){
+ VfModule vfModule = findExistingVfModule(vnfResource,
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+ Metadata vfMetadata = group.getMetadata();
+ if(vfModule==null)
+ vfModule=createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata);
+
+ vfModuleCustomization = createVfModuleCustomzation(group, toscaResourceStructure, vfModule, vfModuleData);
+ setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization,
+ vfMetadata);
+ vfModuleCustomization.setVfModule(vfModule);
+ vfModule.getVfModuleCustomization().add(vfModuleCustomization);
+ vnfResource.getVfModuleCustomizations().add(vfModuleCustomization);
+ } else {
+ vfResourceStructure.setAlreadyDeployed(true);
+ }
+
+ return vfModuleCustomization;
+ }
+
+ protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
+ String vfModuleModelCustomizationUUID) {
+ VfModuleCustomization vfModuleCustomization = null;
+ for(VfModuleCustomization vfModuleCustom : vnfResource.getVfModuleCustomizations()){
+ if(vfModuleCustom.getModelCustomizationUUID().equalsIgnoreCase(vfModuleModelCustomizationUUID)){
+ vfModuleCustomization = vfModuleCustom;
+ }
+ }
+ if(vfModuleCustomization==null)
+ vfModuleCustomization = vfModuleCustomizationRepo
+ .findByModelCustomizationUUID(vfModuleModelCustomizationUUID);
+
+ return vfModuleCustomization;
+ }
+
+ protected VfModule findExistingVfModule(VnfResourceCustomization vnfResource, String modelUUID) {
+ VfModule vfModule = null;
+ for(VfModuleCustomization vfModuleCustom : vnfResource.getVfModuleCustomizations()){
+ if(vfModuleCustom.getVfModule() != null && vfModuleCustom.getVfModule().getModelUUID().equals(modelUUID)){
+ vfModule = vfModuleCustom.getVfModule();
+ }
+ }
+ if(vfModule==null)
+ vfModule = vfModuleRepo.findByModelUUID(modelUUID);
+
+ return vfModule;
+ }
+
+ protected VfModuleCustomization createVfModuleCustomzation(Group group,
+ ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) {
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+
+ vfModuleCustomization.setModelCustomizationUUID(vfModuleData.getVfModuleModelCustomizationUUID());
+
+ vfModuleCustomization.setVfModule(vfModule);
+
+ String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+ if (initialCount != null && initialCount.length() > 0) {
+ vfModuleCustomization.setInitialCount(Integer.valueOf(initialCount));
+ }
+
+ vfModuleCustomization.setInitialCount(Integer.valueOf(toscaResourceStructure.getSdcCsarHelper()
+ .getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT)));
+
+ String availabilityZoneCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT);
+ if (availabilityZoneCount != null && availabilityZoneCount.length() > 0) {
+ vfModuleCustomization.setAvailabilityZoneCount(Integer.valueOf(availabilityZoneCount));
+ }
+
+ vfModuleCustomization.setLabel(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL));
+
+ String maxInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES);
+ if (maxInstances != null && maxInstances.length() > 0) {
+ vfModuleCustomization.setMaxInstances(Integer.valueOf(maxInstances));
+ }
+
+ String minInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES);
+ if (minInstances != null && minInstances.length() > 0) {
+ vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
+ }
+ return vfModuleCustomization;
+ }
+
+ protected VfModule createVfModule(Group group, ToscaResourceStructure toscaResourceStructure,
+ IVfModuleData vfModuleData, Metadata vfMetadata) {
+ VfModule vfModule = new VfModule();
+ String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID();
+
+ if(vfModuleModelUUID == null) {
+ vfModuleModelUUID = testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+ } else if (vfModuleModelUUID.indexOf('.') > -1) {
+ vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf('.'));
+ }
+
+ vfModule.setModelInvariantUUID(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
+ vfModule.setModelName(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
+ vfModule.setModelUUID(vfModuleModelUUID);
+ vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
+ vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+
+ String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
+ if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) {
+ vfModule.setIsBase(true);
+ } else {
+ vfModule.setIsBase(false);
+ }
+ return vfModule;
+ }
+
+ protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure,
+ VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization,
+ Metadata vfMetadata) {
+ Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream()
+ .filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID()
+ .equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)))
+ .findFirst();
+
+ if (matchingObject.isPresent()) {
+ List<HeatFiles> heatFilesList = new ArrayList<>();
+ List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<HeatTemplate>();
+ List<HeatTemplate> heatChildTemplates = new ArrayList<HeatTemplate>();
+ HeatTemplate parentHeatTemplate = new HeatTemplate();
+ String parentArtifactType = null;
+ Set<String> artifacts = new HashSet<>(matchingObject.get().getVfModuleMetadata().getArtifacts());
+ for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+
+ List<HeatTemplate> childNestedHeatTemplates = new ArrayList<HeatTemplate>();
+
+ if (artifacts.contains(vfModuleArtifact.getArtifactInfo().getArtifactUUID())) {
+ checkVfModuleArtifactType(vfModule, vfModuleCustomization, heatFilesList, vfModuleArtifact,
+ childNestedHeatTemplates, parentHeatTemplate, vfResourceStructure);
+ }
+
+ if(vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)){
+ parentArtifactType = identifyParentOfNestedTemplate(matchingObject.get(), vfModuleArtifact);
+
+ if(!childNestedHeatTemplates.isEmpty()){
+
+ if (parentArtifactType != null && parentArtifactType.equalsIgnoreCase(ASDCConfiguration.HEAT_VOL)) {
+ volumeHeatChildTemplates.add(childNestedHeatTemplates.get(0));
+ } else {
+ heatChildTemplates.add(childNestedHeatTemplates.get(0));
+ }
+ }
+ }
+
+ }
+ if(!heatFilesList.isEmpty()){
+ vfModule.setHeatFiles(heatFilesList);
+ }
+
+
+ // Set all Child Templates related to HEAT_VOLUME
+ if(!volumeHeatChildTemplates.isEmpty()){
+ vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates);
+ }
+
+ // Set all Child Templates related to HEAT
+ if(!heatChildTemplates.isEmpty()){
+ vfModule.getVolumeHeatTemplate().setChildTemplates(heatChildTemplates);
+ }
+ }
+ }
+
+ protected void checkVfModuleArtifactType(VfModule vfModule, VfModuleCustomization vfModuleCustomization,
+ List<HeatFiles> heatFilesList, VfModuleArtifact vfModuleArtifact, List<HeatTemplate> nestedHeatTemplates,
+ HeatTemplate parentHeatTemplate, VfResourceStructure vfResourceStructure) {
+ if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT)) {
+ vfModuleArtifact.incrementDeployedInDB();
+ vfModule.setModuleHeatTemplate(vfModuleArtifact.getHeatTemplate());
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_VOL)) {
+ vfModule.setVolumeHeatTemplate(vfModuleArtifact.getHeatTemplate());
+ VfModuleArtifact volVfModuleArtifact = this.getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure, vfModuleArtifact);
+ vfModuleCustomization.setVolumeHeatEnv(volVfModuleArtifact.getHeatEnvironment());
+ vfModuleArtifact.incrementDeployedInDB();
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
+ if(vfModuleArtifact.getHeatEnvironment().getName().contains("volume")) {
+ vfModuleCustomization.setVolumeHeatEnv(vfModuleArtifact.getHeatEnvironment());
+ } else {
+ vfModuleCustomization.setHeatEnvironment(vfModuleArtifact.getHeatEnvironment());
+ }
+ vfModuleArtifact.incrementDeployedInDB();
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ARTIFACT)) {
+ heatFilesList.add(vfModuleArtifact.getHeatFiles());
+ vfModuleArtifact.incrementDeployedInDB();
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)) {
+ nestedHeatTemplates.add(vfModuleArtifact.getHeatTemplate());
+ vfModuleArtifact.incrementDeployedInDB();
+ }
+ }
+
+ protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, Service service) {
+ VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepo.findOneByModelCustomizationUUID(
+ vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ if(vnfResourceCustomization == null){
+ VnfResource vnfResource = findExistingVnfResource(service,
+ vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if(vnfResource==null)
+ vnfResource=createVnfResource(vfNodeTemplate);
+
+ vnfResourceCustomization = createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure,
+ vnfResource);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ vnfResource.getVnfResourceCustomizations().add(vnfResourceCustomization);
+
+ // Fetch VNFC Instance Group Info
+ List<Group> groupList = toscaResourceStructure.getSdcCsarHelper()
+ .getGroupsOfOriginOfNodeTemplateByToscaGroupType(vfNodeTemplate,
+ "org.openecomp.groups.VfcInstanceGroup");
+
+ for (Group group : groupList) {
+
+ VFCInstanceGroup vfcInstanceGroup = findExistingVnfcInstanceGroup(vnfResourceCustomization,
+ group.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ if(vfcInstanceGroup == null){
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(
+ vfNodeTemplate, group, vnfResourceCustomization);
+
+ vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
+ }
+ }
+
+ }
+ return vnfResourceCustomization;
+ }
+
+ protected VnfResource findExistingVnfResource(Service service, String modelUUID) {
+ VnfResource vnfResource = null;
+ for(VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()){
+ if (vnfResourceCustom.getVnfResources() != null
+ && vnfResourceCustom.getVnfResources().getModelUUID().equals(modelUUID)) {
+ vnfResource = vnfResourceCustom.getVnfResources();
+ }
+ }
+ if(vnfResource==null)
+ vnfResource = vnfRepo.findResourceByModelUUID(modelUUID);
+
+ return vnfResource;
+ }
+
+ protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) {
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName());
+
+ vnfResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
+ vnfResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, "nf_naming_code")));
+ vnfResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
+ vnfResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
+
+ vnfResourceCustomization.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN));
+
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
+ vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
+
+ CapabilityAssignments vnfCustomizationCapability = toscaResourceStructure.getSdcCsarHelper()
+ .getCapabilitiesOf(vfNodeTemplate);
+
+ if (vnfCustomizationCapability != null) {
+ CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(SCALABLE);
+
+ if (capAssign != null) {
+ vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
+ .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
+ .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ }
+
+ }
+
+ toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization);
+
+ return vnfResourceCustomization;
+ }
+
+ protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) {
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelInvariantUUID(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ vnfResource.setModelName(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ vnfResource.setModelUUID(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+
+ vnfResource.setModelVersion(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ vnfResource.setDescription(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfResource.setOrchestrationMode(HEAT);
+ vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
+ vnfResource.setAicVersionMax(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ vnfResource.setAicVersionMin(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+
+ return vnfResource;
+ }
+
+ protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, Service service) {
+ AllottedResourceCustomization allottedResourceCustomization = allottedCustomizationRepo
+ .findOneByModelCustomizationUUID(
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if(allottedResourceCustomization == null){
+ AllottedResource allottedResource = findExistingAllottedResource(service,
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if(allottedResource==null)
+ allottedResource=createAR(nodeTemplate);
+
+ toscaResourceStructure.setAllottedResource(allottedResource);
+ allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure);
+ allottedResourceCustomization.setAllottedResource(allottedResource);
+ allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization);
+ }
+ return allottedResourceCustomization;
+ }
+
+ protected AllottedResource findExistingAllottedResource(Service service, String modelUUID) {
+ AllottedResource allottedResource = null;
+ for(AllottedResourceCustomization allottedResourceCustom : service.getAllottedCustomizations()){
+ if (allottedResourceCustom.getAllottedResource() != null
+ && allottedResourceCustom.getAllottedResource().getModelUUID().equals(modelUUID)) {
+ allottedResource = allottedResourceCustom.getAllottedResource();
+ }
+ }
+ if(allottedResource==null)
+ allottedResource = allottedRepo.findResourceByModelUUID(modelUUID);
+
+ return allottedResource;
+ }
+
+ protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure) {
+ AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
+ allottedResourceCustomization.setModelCustomizationUUID(
+ testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName());
+
+
+ allottedResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
+ allottedResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code")));
+ allottedResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
+ allottedResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
+
+ List<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper().getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID());
+
+ if(vfcNodes != null){
+ for(NodeTemplate vfcNode : vfcNodes){
+
+ allottedResourceCustomization.setProvidingServiceModelUUID(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_uuid"));
+ allottedResourceCustomization.setProvidingServiceModelInvariantUUID(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_invariant_uuid"));
+ allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_name"));
+ }
+ }
+
+
+ CapabilityAssignments arCustomizationCapability = toscaResourceStructure.getSdcCsarHelper()
+ .getCapabilitiesOf(nodeTemplate);
+
+ if (arCustomizationCapability != null) {
+ CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE);
+
+ if (capAssign != null) {
+ allottedResourceCustomization.setMinInstances(
+ Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue(
+ capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ allottedResourceCustomization.setMaxInstances(
+ Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue(
+ capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ }
+ }
+ return allottedResourceCustomization;
+ }
+
+ protected AllottedResource createAR(NodeTemplate nodeTemplate) {
+ AllottedResource allottedResource = new AllottedResource();
+ allottedResource
+ .setModelUUID(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ allottedResource.setModelInvariantUUID(
+ testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ allottedResource
+ .setModelName(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ allottedResource
+ .setModelVersion(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ allottedResource.setToscaNodeType(testNull(nodeTemplate.getType()));
+ allottedResource.setSubcategory(
+ testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ allottedResource
+ .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ return allottedResource;
+ }
+
+ protected Set<HeatTemplateParam> extractHeatTemplateParameters(String yamlFile, String artifactUUID) {
+ // Scan the payload downloadResult and extract the HeatTemplate
+ // parameters
+ YamlEditor yamlEditor = new YamlEditor(yamlFile.getBytes());
+ return yamlEditor.getParameterList(artifactUUID);
+ }
+
+ protected String testNull(Object object) {
+
+ if (object == null) {
+ return null;
+ } else if (object.equals("NULL")) {
+ return null;
+ } else if (object instanceof Integer) {
+ return object.toString();
+ } else if (object instanceof String) {
+ return (String) object;
+ } else {
+ return "Type not recognized";
+ }
+ }
+
+ protected static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,
+ VfModuleArtifact heatNestedArtifact) {
+
+ if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null && vfModuleStructure
+ .getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
+ for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0)
+ .getArtifactInfo().getRelatedArtifacts()) {
+ if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
+ return ASDCConfiguration.HEAT;
+ }
+
+ }
+ }
+
+ if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null
+ && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()
+ .getRelatedArtifacts() != null) {
+ for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL)
+ .get(0).getArtifactInfo().getRelatedArtifacts()) {
+ if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
+ return ASDCConfiguration.HEAT_VOL;
+ }
+
+ }
+ }
+
+ // Does not belong to anything
+ return null;
+
+ }
+
+ protected static String createVNFName(VfResourceStructure vfResourceStructure) {
+
+ return vfResourceStructure.getNotification().getServiceName() + "/"
+ + vfResourceStructure.getResourceInstance().getResourceInstanceName();
+ }
+
+ protected static String createVfModuleName(VfModuleStructure vfModuleStructure) {
+
+ return createVNFName(vfModuleStructure.getParentVfResource()) + "::"
+ + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
+ }
+
+
+ protected static Timestamp getCurrentTimeStamp() {
+
+ return new Timestamp(new Date().getTime());
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java
similarity index 64%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java
index be5af5d..dcfeb10 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java
@@ -18,45 +18,53 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.tenantIsolation;
+package org.onap.so.asdc.tenantIsolation;
import java.net.MalformedURLException;
import java.net.URL;
-import org.openecomp.mso.asdc.tenantIsolation.AsdcPropertiesUtils;
-import org.openecomp.mso.client.aai.AAIProperties;
-import org.openecomp.mso.client.aai.AAIVersion;
-import org.openecomp.mso.properties.MsoJavaProperties;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.aai.AAIVersion;
+import org.springframework.context.ApplicationContext;
public class AaiClientPropertiesImpl implements AAIProperties {
- final MsoJavaProperties props;
+ private String aaiEndpoint;
+ private String auth;
+ private String key;
+ private static final String SYSTEM_NAME = "MSO";
+
public AaiClientPropertiesImpl() {
- this.props = AsdcPropertiesUtils.loadMsoProperties ();
+ ApplicationContext context = SpringContextHelper.getAppContext();
+ aaiEndpoint = context.getEnvironment().getProperty("mso.aai.endpoint");
+ this.auth = context.getEnvironment().getProperty("aai.auth");
+ this.key = context.getEnvironment().getProperty("mso.msoKey");
}
@Override
public URL getEndpoint() throws MalformedURLException {
- return new URL(props.getProperty("aai.endpoint", null));
+ ApplicationContext context = SpringContextHelper.getAppContext();
+ aaiEndpoint = context.getEnvironment().getProperty("mso.aai.endpoint");
+ return new URL(aaiEndpoint);
}
@Override
public String getSystemName() {
- return "MSO";
+ return SYSTEM_NAME;
}
@Override
public AAIVersion getDefaultVersion() {
return AAIVersion.LATEST;
}
-
+
@Override
public String getAuth() {
- return props.getProperty("aai.auth", null);
+ return this.auth;
}
@Override
public String getKey() {
- return props.getProperty("mso.msoKey", null);
+ return this.key;
}
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/DistributionStatus.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/DistributionStatus.java
similarity index 94%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/DistributionStatus.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/DistributionStatus.java
index 4d04bfa..d092712 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/DistributionStatus.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/DistributionStatus.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.tenantIsolation;
-
-public enum DistributionStatus {
-
- SUCCESS,
- FAILURE,
- TIMEOUT,
- INCOMPLETE
-}
+package org.onap.so.asdc.tenantIsolation;
+
+public enum DistributionStatus {
+
+ SUCCESS,
+ FAILURE,
+ TIMEOUT,
+ INCOMPLETE
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ToLog.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/SpringContextHelper.java
similarity index 62%
copy from asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ToLog.java
copy to asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/SpringContextHelper.java
index 59b3d68..5f30edd 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ToLog.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/SpringContextHelper.java
@@ -18,12 +18,24 @@
* ============LICENSE_END=========================================================
*/
+package org.onap.so.asdc.tenantIsolation;
-package org.openecomp.mso.asdc.util;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+@Component
+public class SpringContextHelper implements ApplicationContextAware {
+ private static ApplicationContext context;
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ context = applicationContext;
+ }
-public @interface ToLog {
-
+ public static ApplicationContext getAppContext() {
+ return context;
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
new file mode 100644
index 0000000..3f0392a
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
@@ -0,0 +1,194 @@
+/*-
+ * ============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.asdc.tenantIsolation;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
+import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WatchdogDistribution {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,WatchdogDistribution.class);
+
+ private AAIResourcesClient aaiClient;
+
+ @Autowired
+ private WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
+
+ @Autowired
+ private WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository;
+
+ @Autowired
+ private WatchdogServiceModVerIdLookupRepository watchdogModVerIdLookupRepository;
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Value("${mso.asdc.config.components.componentNames}")
+ private String[] componentNames;
+
+ public String getOverallDistributionStatus(String distributionId) throws Exception {
+ LOGGER.debug("Entered getOverallDistributionStatus method for distrubutionId: " + distributionId);
+
+ String status = null;
+ try {
+ WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findOne(distributionId);
+ if(watchdogDistributionStatus == null){
+ watchdogDistributionStatus = new WatchdogDistributionStatus();
+ watchdogDistributionStatus.setDistributionId(distributionId);
+ watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
+ }
+ String distributionStatus = watchdogDistributionStatus.getDistributionIdStatus();
+
+ if(DistributionStatus.TIMEOUT.name().equalsIgnoreCase(distributionStatus)) {
+ LOGGER.debug("Ignoring to update WatchdogDistributionStatus as distributionId: " + distributionId + " status is set to: " + distributionStatus);
+ return DistributionStatus.TIMEOUT.name();
+ } else {
+ List<WatchdogComponentDistributionStatus> results = watchdogCDStatusRepository.findByDistributionId(distributionId);
+ LOGGER.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: " + distributionId);
+
+ //*************************************************************************************************************************************************
+ //**** Compare config values verse DB watchdog component names to see if every component has reported status before returning final result back to ASDC
+ //**************************************************************************************************************************************************
+
+ List<WatchdogComponentDistributionStatus> cdStatuses = watchdogCDStatusRepository.findByDistributionId(distributionId);
+
+ boolean allComponentsComplete = true;
+
+ for(String name : componentNames ) {
+
+ boolean match = false;
+
+ for(WatchdogComponentDistributionStatus cdStatus: cdStatuses){
+ if(name.equals(cdStatus.getComponentName())){
+ LOGGER.debug("Found componentName " + name + " in the WatchDog Component DB");
+ match = true;
+ break;
+ }
+ }
+ if(!match){
+ LOGGER.debug(name + " has not be updated in the the WatchDog Component DB yet, so ending the loop");
+ allComponentsComplete = false;
+ break;
+ }
+ }
+
+
+ if(allComponentsComplete) {
+ LOGGER.debug("Components Size matched with the WatchdogComponentDistributionStatus results.");
+
+ for(WatchdogComponentDistributionStatus componentDist : results) {
+ String componentDistributionStatus = componentDist.getComponentDistributionStatus();
+ LOGGER.debug("Component status: " + componentDistributionStatus + " on componentName: " + componentDist.getComponentName());
+ if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_ERROR")) {
+ status = DistributionStatus.FAILURE.name();
+ break;
+ } else if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_OK")) {
+ status = DistributionStatus.SUCCESS.name();
+ } else {
+ throw new Exception("Invalid Component distribution status: " + componentDistributionStatus);
+ }
+ }
+
+ LOGGER.debug("Updating overall DistributionStatus to: " + status + " for distributionId: " + distributionId);
+
+ watchdogDistributionStatus.setDistributionIdStatus(status);
+ watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
+ } else {
+ LOGGER.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
+ status = DistributionStatus.INCOMPLETE.name();
+ return status;
+ }
+ }
+ }catch (Exception e) {
+ LOGGER.debug("Exception occurred on getOverallDistributionStatus : " + e.getMessage());
+ LOGGER.error(e);
+ throw new Exception(e);
+ }
+ LOGGER.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution");
+ return status;
+ }
+
+ public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception {
+ LOGGER.debug("Entered executePatchAAI method with distrubutionId: " + distributionId + " and distributionStatus: " + distributionStatus);
+
+ try {
+ WatchdogServiceModVerIdLookup lookup = watchdogModVerIdLookupRepository.findOneByDistributionId(distributionId);
+ String serviceModelVersionId = "";
+
+ if(lookup != null) {
+ serviceModelVersionId = lookup.getServiceModelVersionId();
+ }
+
+ LOGGER.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: " + distributionId + " and serviceModelVersionId: " + serviceModelVersionId);
+ LOGGER.debug("ASDC Notification ServiceModelInvariantUUID : " + serviceModelInvariantUUID);
+
+ if(serviceModelInvariantUUID == null || "".equals(serviceModelVersionId)) {
+ String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID;
+ LOGGER.debug(error);
+ throw new Exception(error);
+ }
+
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID, serviceModelVersionId);
+ aaiUri.depth(Depth.ZERO); //Do not return relationships if any
+ LOGGER.debug("Target A&AI Resource URI: " + aaiUri.build().toString());
+
+ Map<String, String> payload = new HashMap<>();
+ payload.put("distribution-status", distributionStatus);
+ getAaiClient().update(aaiUri, payload);
+
+ LOGGER.debug("A&AI UPDATE MODEL Version is success!");
+ } catch (Exception e) {
+ LOGGER.debug("Exception occurred on executePatchAAI : " + e.getMessage());
+ LOGGER.error(e);
+ throw new Exception(e);
+ }
+ }
+
+ public AAIResourcesClient getAaiClient() {
+ if(aaiClient == null) {
+ aaiClient = new AAIResourcesClient();
+ }
+ return aaiClient;
+ }
+
+ public void setAaiClient(AAIResourcesClient aaiClient) {
+ this.aaiClient = aaiClient;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
similarity index 63%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index 834ad60..ef5b889 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.util;
+package org.onap.so.asdc.util;
import java.util.List;
@@ -29,11 +29,12 @@
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.onap.sdc.tosca.parser.impl.SdcTypes;
import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.openecomp.mso.asdc.installer.IVfModuleData;
-import org.openecomp.mso.asdc.installer.ToscaResourceStructure;
+import org.onap.so.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.ToscaResourceStructure;
public class ASDCNotificationLogging {
@@ -97,6 +98,109 @@
buffer.append("Environment Context:");
buffer.append(csarHelper.getServiceMetadata().getValue("environmentContext"));
+
+ List<NodeTemplate> serviceProxyResourceList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
+
+ if(serviceProxyResourceList != null){
+
+ for (NodeTemplate serviceProxyNodeTemplate : serviceProxyResourceList) {
+
+ buffer.append(System.lineSeparator());
+ buffer.append(System.lineSeparator());
+ buffer.append("Service Proxy Properties:");
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Description:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+
+ buffer.append(System.lineSeparator());
+ buffer.append(System.lineSeparator());
+ buffer.append("Service Proxy Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Customization UUID:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Instance Name:");
+ buffer.append(serviceProxyNodeTemplate.getName());
+ buffer.append(System.lineSeparator());
+ buffer.append("Tosca Node Type:");
+ buffer.append(serviceProxyNodeTemplate.getType());
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+
+ }
+ }
+
+ List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
+
+ if(configurationNodeTemplatesList != null){
+ for (NodeTemplate configNodeTemplate : configurationNodeTemplatesList) {
+
+ buffer.append(System.lineSeparator());
+ buffer.append(System.lineSeparator());
+ buffer.append("Configuration Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Name:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Description:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Tosca Node Type:");
+ buffer.append(configNodeTemplate.getType());
+
+ buffer.append(System.lineSeparator());
+ buffer.append(System.lineSeparator());
+ buffer.append("Configuration Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Customization UUID:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Instance Name:");
+ buffer.append(configNodeTemplate.getName());
+ buffer.append(System.lineSeparator());
+ buffer.append("NFFunction:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFRole:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFType:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(System.lineSeparator());
+
+ }
+ }
+
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VNF Level Properties:");
@@ -148,6 +252,35 @@
buffer.append(System.lineSeparator());
buffer.append("MultiStageDesign:");
buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, "multi_stage_design"));
+ buffer.append(System.lineSeparator());
+
+ List<Group> groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(vfNodeTemplate, "org.openecomp.groups.VfcInstanceGroup");
+
+ if(groupList != null){
+ for (Group group : groupList) {
+ Metadata instanceMetadata = group.getMetadata();
+
+ buffer.append(System.lineSeparator());
+ buffer.append("VNFC Instance Group Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Name:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Type:");
+ buffer.append(vfNodeTemplate.getType());
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+ }
+
+ }
+
+
buffer.append(System.lineSeparator());
buffer.append("VF Module Properties:");
@@ -217,6 +350,127 @@
}
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Collection Resource Properties:");
+ buffer.append(System.lineSeparator());
+
+ List<NodeTemplate> networkCollectionList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
+
+ if (networkCollectionList != null) {
+ for (NodeTemplate crNode : networkCollectionList) {
+ buffer.append("Model Name:");
+ buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Description:");
+ buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Tosca Node Type:");
+ buffer.append(crNode.getType());
+ buffer.append(System.lineSeparator());
+ buffer.append("CR Function:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_function"));
+ buffer.append(System.lineSeparator());
+ buffer.append("CR Role:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_role"));
+ buffer.append(System.lineSeparator());
+ buffer.append("CR Type:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_type"));
+ buffer.append(System.lineSeparator());
+
+ List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(crNode, SdcTypes.VL);
+
+ for(NodeTemplate vlNodeTemplate : vlNodeList){
+
+ Metadata vlMetadata = vlNodeTemplate.getMetaData();
+
+ buffer.append(System.lineSeparator());
+ buffer.append("Network CR VL Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Name:");
+ buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("AIC Max Version:");
+ buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+ buffer.append(System.lineSeparator());
+ buffer.append("Description:");
+ buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Tosca Node Type:");
+ buffer.append(vlNodeTemplate.getType());
+ buffer.append(System.lineSeparator());
+
+ }
+
+ List<Group> groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(crNode, "org.openecomp.groups.NetworkCollection");
+
+ if(groupList != null){
+ for (Group group : groupList) {
+ Metadata instanceMetadata = group.getMetadata();
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Instance Group Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Name:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ }
+
+ }
+
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Collection Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Customization UUID:");
+ buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Instance Name:");
+ buffer.append(crNode.getName());
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Scope:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Role:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Type:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+ buffer.append(System.lineSeparator());
+ buffer.append("Network Technology:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+ buffer.append(System.lineSeparator());
+
+ }
+ }
+
List<NodeTemplate> allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources();
if(allottedResourceList != null){
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java
similarity index 92%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java
index 617eefb..965f8b7 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java
@@ -20,7 +20,7 @@
*/
-package org.openecomp.mso.asdc.util;
+package org.onap.so.asdc.util;
@@ -34,7 +34,7 @@
import java.util.List;
import java.util.Map;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.notification.INotificationData;
@@ -42,16 +42,16 @@
private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>();
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
+ protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, NotificationLogging.class);
+
private static InvocationHandler handler = (arg0, arg1, arg2) -> {
- List<Method> methods = objectMethodsToLog.get(arg0);
- if ((methods == null) || (methods.isEmpty())) {
- // Do nothing for now...
- return null;
- }
- methods.add(arg1);
- return arg1.invoke(arg0, arg2);
+ List<Method> methods = objectMethodsToLog.get(arg0);
+ if ((methods == null) || (methods.isEmpty())) {
+ // Do nothing for now...
+ return null;
+ }
+ methods.add(arg1);
+ return arg1.invoke(arg0, arg2);
};
public static InvocationHandler getHandler() {
@@ -158,7 +158,7 @@
private static <T> void methodToLog(T methodCall) {
//
}
-
+
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ToLog.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ToLog.java
similarity index 96%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ToLog.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/util/ToLog.java
index 59b3d68..1f67b9c 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ToLog.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ToLog.java
@@ -19,7 +19,7 @@
*/
-package org.openecomp.mso.asdc.util;
+package org.onap.so.asdc.util;
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
similarity index 98%
rename from asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java
rename to asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
index f6f1af5..fdeddf1 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.util;
+package org.onap.so.asdc.util;
import java.io.ByteArrayInputStream;
@@ -35,7 +35,7 @@
import org.yaml.snakeyaml.Yaml;
-import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
public class YamlEditor {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/ASDCControllerSingleton.java
deleted file mode 100644
index d5a8d0f..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/ASDCControllerSingleton.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc;
-
-
-import javax.annotation.PreDestroy;
-import javax.ejb.ConcurrencyManagement;
-import javax.ejb.ConcurrencyManagementType;
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Schedule;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-
-import org.openecomp.mso.asdc.client.ASDCGlobalController;
-import org.openecomp.mso.logger.MsoLogger;
-
-@Singleton(name = "ASDCController")
-@Lock(LockType.READ)
-@Startup
-@ConcurrencyManagement(ConcurrencyManagementType.CONTAINER)
-public class ASDCControllerSingleton {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
- private static boolean working = false;
-
- private ASDCGlobalController globalController = new ASDCGlobalController ();
-
- /**
- * Main Constructor of the ASDC Singleton
- */
- public ASDCControllerSingleton () {
- }
-
- @Schedule(second ="30", minute = "*", hour = "*", persistent = false)
- public void periodicControllerTask () {
- if (isWorking ()) {
- LOGGER.debug ("Another thread is already trying to init ASDC, cancel this periodic call");
- return;
- }
- try {
- setWorking (true);
-
- globalController.updateControllersConfigIfNeeded();
- globalController.checkInStoppedState();
-
- } finally {
- setWorking (false);
- }
- }
-
- @PreDestroy
- private void terminate () {
- globalController.closeASDC ();
- }
-
- private static synchronized boolean isWorking () {
- return ASDCControllerSingleton.working;
- }
-
- private static synchronized void setWorking (boolean working) {
- ASDCControllerSingleton.working = working;
- }
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
deleted file mode 100644
index 7cc6ab8..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client;
-
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJsonProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.onap.sdc.api.consumer.IConfiguration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class ASDCConfiguration implements IConfiguration {
-
- private MsoPropertiesFactory msoPropertiesFactory;
-
- // SHell command to obtain the same encryption, 128 bits key, key must be HEX
- // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd
-
- private String configKey;
-
- private MsoJsonProperties msoProperties;
-
- private String asdcControllerName;
- private String PASSWORD_ATTRIBUTE_NAME;
- private String KEY_STORE_PASSWORD;
-
- public static final String MSO_PROP_ASDC = "MSO_PROP_ASDC";
- public static final String PARAMETER_PATTERN = "asdc-connections";
- public static final String MSG_BUS_ADDRESS_ATTRIBUTE_NAME = "messageBusAddress";
- public static final String COMPONENT_NAMES_ADDRESS_ATTRIBUTE_NAME = "componentNames";
- public static final String WATCHDOG_TIMEOUT_NAME = "watchDogTimeout";
-
- public static final String CONSUMER_GROUP_ATTRIBUTE_NAME = "consumerGroup";
- public static final String CONSUMER_ID_ATTRIBUTE_NAME = "consumerId";
- public static final String ENVIRONMENT_NAME_ATTRIBUTE_NAME = "environmentName";
- public static final String POLLING_INTERVAL_ATTRIBUTE_NAME = "pollingInterval";
- public static final String RELEVANT_ARTIFACT_TYPES_ATTRIBUTE_NAME = "relevantArtifactTypes";
- public static final String USER_ATTRIBUTE_NAME = "user";
- public static final String ASDC_ADDRESS_ATTRIBUTE_NAME = "asdcAddress";
- public static final String POLLING_TIMEOUT_ATTRIBUTE_NAME = "pollingTimeout";
- public static final String ACTIVATE_SERVER_TLS_AUTH = "activateServerTLSAuth";
- public static final String KEY_STORE_PATH = "keyStorePath";
-
- public static final String HEAT="HEAT";
- public static final String HEAT_ARTIFACT="HEAT_ARTIFACT";
- public static final String HEAT_ENV="HEAT_ENV";
- public static final String HEAT_NESTED="HEAT_NESTED";
- public static final String HEAT_NET="HEAT_NET";
- public static final String HEAT_VOL="HEAT_VOL";
- public static final String OTHER="OTHER";
- public static final String TOSCA_CSAR="TOSCA_CSAR";
- public static final String VF_MODULES_METADATA="VF_MODULES_METADATA";
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
- private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT,
- HEAT_ARTIFACT,
- HEAT_ENV,
- HEAT_NESTED,
- HEAT_NET,
- HEAT_VOL,
- OTHER,
- TOSCA_CSAR,
- VF_MODULES_METADATA};
-
- public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
-
- /**
- * Default constructor, the mso.properties is searched in the classpath (for testing)
- * Or in /etc/ecomp/mso/config/mso.properties
- *
- * @param controllerName The controllerName of the config JSON tree
- * @throws ASDCParametersException in case of issues with the parameters
- * @throws IOException If the key file has not been loaded properly
- */
- public ASDCConfiguration (String controllerName) throws ASDCParametersException, IOException {
-
- Properties keyProp = new Properties ();
- this.asdcControllerName = controllerName;
-
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("config-key.properties"));
- configKey = (String) keyProp.get ("asdc.config.key");
-
- // This structure contains static values initialized by servlet initializer
- this.msoPropertiesFactory = new MsoPropertiesFactory ();
-
- refreshASDCConfig ();
-
- }
-
- @Override
- public java.lang.Boolean isUseHttpsWithDmaap() {
- return false;
- }
-
- @Override
- public boolean isConsumeProduceStatusTopic(){
- return true;
- }
-
- @Override
- public List<String> getMsgBusAddress(){
-
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (MSG_BUS_ADDRESS_ATTRIBUTE_NAME) != null) {
- List<String> msgAddressList = new ArrayList<>();
-
- Iterator<JsonNode> config = masterConfigNode.get(MSG_BUS_ADDRESS_ATTRIBUTE_NAME).elements();
-
- while( config.hasNext() ) {
- String key = (String)config.next().asText();
- msgAddressList.add(key);
- }
-
- if ("NULL".equals (msgAddressList) || msgAddressList.isEmpty ()) {
- return null;
- } else {
- return msgAddressList;
- }
- } else {
- return null;
- }
-
-
- }
-
- public String getAsdcControllerName () {
- return asdcControllerName;
- }
-
- private JsonNode getASDCControllerConfigJsonNode () {
- if (this.msoProperties.getJsonRootNode ().get (PARAMETER_PATTERN) != null) {
- return this.msoProperties.getJsonRootNode ().get (PARAMETER_PATTERN).get (this.asdcControllerName);
- } else {
- return null;
- }
-
- }
-
- /**
- * This method reload the config if needed.
- *
- * @return true if config has been reloaded, false otherwise
- * @throws ASDCParametersException In case the parameters validation fails
- * @throws MsoPropertiesException
- */
- public boolean refreshASDCConfig () throws ASDCParametersException {
-
- try {
- if (msoPropertiesFactory.propertiesHaveChanged (MSO_PROP_ASDC, msoProperties)) {
- msoProperties = msoPropertiesFactory.getMsoJsonProperties (MSO_PROP_ASDC);
-
- this.testAllParameters ();
- return true;
- } else {
- return false;
- }
- } catch (MsoPropertiesException e) {
- throw new ASDCParametersException ("mso.asdc.json not initialized properly, ASDC config cannot be reloaded",
- e);
- }
- }
-
- /**
- * This method is useful to check whether a mso properties config has been changed.
- *
- * @return true is a new config is availabe, false otherwise
- * @throws ASDCParametersException
- * @throws MsoPropertiesException
- */
- public boolean hasASDCConfigChanged () throws ASDCParametersException {
- try {
- return msoPropertiesFactory.propertiesHaveChanged (MSO_PROP_ASDC, msoProperties);
- } catch (MsoPropertiesException e) {
- throw new ASDCParametersException ("mso.asdc.json not initialized properly, ASDC config cannot be read", e);
- }
- }
-
- @Override
- public String getConsumerGroup () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (CONSUMER_GROUP_ATTRIBUTE_NAME) != null) {
- String config = masterConfigNode.get (CONSUMER_GROUP_ATTRIBUTE_NAME).asText ();
-
- if ("NULL".equals (config) || config.isEmpty ()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- }
-
- public int getWatchDogTimeout () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (WATCHDOG_TIMEOUT_NAME) != null) {
-
- return masterConfigNode.get (WATCHDOG_TIMEOUT_NAME).asInt ();
- } else {
- return 0;
- }
- }
-
- @Override
- public String getConsumerID () {
-
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (CONSUMER_ID_ATTRIBUTE_NAME) != null) {
- String config = masterConfigNode.get (CONSUMER_ID_ATTRIBUTE_NAME).asText ();
-
- if (config.isEmpty ()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- }
-
- @Override
- public String getEnvironmentName () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (ENVIRONMENT_NAME_ATTRIBUTE_NAME) != null) {
- String config = masterConfigNode.get (ENVIRONMENT_NAME_ATTRIBUTE_NAME).asText ();
-
- if (config.isEmpty ()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- }
-
- @Override
- public String getPassword () {
- Properties keyProp = new Properties ();
- try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("config-key.properties"));
- PASSWORD_ATTRIBUTE_NAME=(String) keyProp.get ("password.attribute.name");
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (PASSWORD_ATTRIBUTE_NAME) != null) {
- String config = this.msoProperties.getEncryptedProperty (masterConfigNode.get (PASSWORD_ATTRIBUTE_NAME),
- null,
- this.configKey);
-
- if (config.isEmpty ()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- } catch (IOException e) {
- msoLogger.debug("IOException occured", e);
- return null;
- }
- }
-
- @Override
- public int getPollingInterval () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (POLLING_INTERVAL_ATTRIBUTE_NAME) != null) {
- return masterConfigNode.get (POLLING_INTERVAL_ATTRIBUTE_NAME).asInt ();
- } else {
- return 0;
- }
- }
-
- @Override
- public List <String> getRelevantArtifactTypes () {
- // DO not return the Static List SUPPORTED_ARTIFACT_TYPES_LIST because the ASDC Client will try to modify it !!!
- return Arrays.asList(SUPPORTED_ARTIFACT_TYPES);
- }
-
- @Override
- public String getUser () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (USER_ATTRIBUTE_NAME) != null) {
- String config = masterConfigNode.get (USER_ATTRIBUTE_NAME).asText ();
-
- if (config.isEmpty ()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- }
-
- @Override
- public String getAsdcAddress () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (ASDC_ADDRESS_ATTRIBUTE_NAME) != null) {
- String config = masterConfigNode.get (ASDC_ADDRESS_ATTRIBUTE_NAME).asText ();
-
- if (config.isEmpty ()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- }
-
- @Override
- public int getPollingTimeout () {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode ();
- if (masterConfigNode != null && masterConfigNode.get (POLLING_TIMEOUT_ATTRIBUTE_NAME) != null) {
- return masterConfigNode.get (POLLING_TIMEOUT_ATTRIBUTE_NAME).asInt ();
- } else {
- return 0;
- }
- }
-
- @Override
- public boolean activateServerTLSAuth() {
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode();
- if (masterConfigNode != null && masterConfigNode.get(ACTIVATE_SERVER_TLS_AUTH) != null) {
- return masterConfigNode.get(ACTIVATE_SERVER_TLS_AUTH).asBoolean(false);
- } else {
- return false;
- }
- }
-
- @Override
- public String getKeyStorePassword() {
- Properties keyProp = new Properties ();
- try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("config-key.properties"));
- KEY_STORE_PASSWORD=(String) keyProp.get ("key.store.password");
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode();
- if (masterConfigNode != null && masterConfigNode.get(KEY_STORE_PASSWORD) != null) {
- String config = this.msoProperties.getEncryptedProperty(masterConfigNode.get(KEY_STORE_PASSWORD), null,
- this.configKey);
-
- if (config.isEmpty()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
- } catch (IOException e) {
- msoLogger.debug("IOException occured", e);
- return null;
- }
- }
-
- @Override
- public String getKeyStorePath() {
-
- JsonNode masterConfigNode = getASDCControllerConfigJsonNode();
- if (masterConfigNode != null && masterConfigNode.get(KEY_STORE_PATH) != null) {
- String config = masterConfigNode.get(KEY_STORE_PATH).asText();
-
- if (config.isEmpty()) {
- return null;
- } else {
- return config;
- }
- } else {
- return null;
- }
-
- }
-
- public void testAllParameters () throws ASDCParametersException {
-
- // Special case for this attribute that can be null from getConsumerGroup
- if (this.getConsumerGroup () == null
- && (getASDCControllerConfigJsonNode () == null
- || !"NULL".equals (getASDCControllerConfigJsonNode ().get (CONSUMER_GROUP_ATTRIBUTE_NAME).asText ()))) {
- throw new ASDCParametersException (CONSUMER_GROUP_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getConsumerID () == null || this.getConsumerID ().isEmpty ()) {
- throw new ASDCParametersException (CONSUMER_ID_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getEnvironmentName () == null || this.getEnvironmentName ().isEmpty ()) {
- throw new ASDCParametersException (ENVIRONMENT_NAME_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getAsdcAddress () == null || this.getAsdcAddress ().isEmpty ()) {
- throw new ASDCParametersException (ASDC_ADDRESS_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getPassword () == null || this.getPassword ().isEmpty ()) {
- throw new ASDCParametersException (PASSWORD_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getPollingInterval () == 0) {
- throw new ASDCParametersException (POLLING_INTERVAL_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getPollingTimeout () == 0) {
- throw new ASDCParametersException (POLLING_TIMEOUT_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getWatchDogTimeout() == 0) {
- throw new ASDCParametersException (WATCHDOG_TIMEOUT_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getRelevantArtifactTypes () == null || this.getRelevantArtifactTypes ().isEmpty ()) {
- throw new ASDCParametersException (RELEVANT_ARTIFACT_TYPES_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getUser () == null || this.getUser ().isEmpty ()) {
- throw new ASDCParametersException (USER_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- if (this.getMsgBusAddress() == null || this.getMsgBusAddress().isEmpty ()) {
- throw new ASDCParametersException (MSG_BUS_ADDRESS_ATTRIBUTE_NAME
- + " parameter cannot be found in config mso.properties");
- }
-
- }
-
- /**
- * This method triggers the MsoPropertiesFactory to get the ASDC config from the cache and extracts all controllers
- * defined.
- *
- * @return A list of controller Names defined in the cache config
- * @throws ASDCParametersException In cas of issues with the cache
- */
- public static List <String> getAllDefinedControllers () throws ASDCParametersException {
-
- MsoJsonProperties msoProp;
- try {
- List <String> result = new ArrayList<>();
- msoProp = new MsoPropertiesFactory ().getMsoJsonProperties (MSO_PROP_ASDC);
-
- if (msoProp.getJsonRootNode ().get (PARAMETER_PATTERN) != null) {
- Iterator <Entry <String, JsonNode>> it = msoProp.getJsonRootNode ()
- .get (PARAMETER_PATTERN)
- .fields();
-
- Entry <String, JsonNode> entry;
- while (it.hasNext ()) {
- entry = it.next ();
- result.add (entry.getKey ());
-
- }
- }
- return result;
- } catch (MsoPropertiesException e) {
- throw new ASDCParametersException ("Unable to get the JSON Properties in cache:" + MSO_PROP_ASDC, e);
- }
-
- }
-
- /**
- * The flag allows the client to receive metadata for all resources of the service regardless of the artifacts associated to them.
- * Setting the flag to false will preserve legacy behavior.
- */
- public boolean isFilterInEmptyResources() {
- return true;
- }
-
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
deleted file mode 100644
index 430bd10..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client;
-
-
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.openecomp.mso.asdc.client.exceptions.ASDCControllerException;
-import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJsonProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-
-
-public class ASDCGlobalController {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
- private Map <String,ASDCController> controllers = new HashMap<>();
-
- private MsoJsonProperties msoProp= null;
-
- private void loadControllers () throws ASDCParametersException {
-
- List<String> controllerNames = ASDCConfiguration.getAllDefinedControllers();
-
- StringBuilder controllerListLog = new StringBuilder("List of controllers loaded:");
- for (String controllerName : controllerNames) {
- controllers.put(controllerName, new ASDCController(controllerName));
- controllerListLog.append(controllerName);
- controllerListLog.append(";");
- }
- LOGGER.debug(controllerListLog.toString());
- }
-
- private boolean sameControllersDefined() throws ASDCParametersException {
- List<String> controllerNames = ASDCConfiguration.getAllDefinedControllers();
- if (controllerNames.size() == controllers.size()) {
- boolean areIdentical = true;
-
- for (String name:controllerNames) {
- if (!controllers.containsKey(name)) {
- areIdentical = false;
- break;
- }
- }
- return areIdentical;
-
- } else {
- return false;
- }
- }
-
- /**
- * Check that controllers list needs to be updated or not.
- * return true if the list has been updated
- */
- private boolean updateControllersListIfNeeded () {
- boolean updateNeeded=false;
- try {
-
- MsoPropertiesFactory msoPropFactory = new MsoPropertiesFactory();
- MsoJsonProperties newMsoProp;
-
- newMsoProp = msoPropFactory.getMsoJsonProperties(ASDCConfiguration.MSO_PROP_ASDC);
-
- if (msoPropFactory.propertiesHaveChanged(ASDCConfiguration.MSO_PROP_ASDC, msoProp) && !sameControllersDefined()) {
- updateNeeded = true;
- LOGGER.debug("List of ASDC controllers has been changed, trying to kill them");
- this.closeASDC();
-
- // Wait that all controllers are down before restarting, next pass will kill them all
- if (this.controllers.size() == 0) {
- msoProp = newMsoProp;
- this.loadControllers();
- }
- }
-
- } catch (ASDCParametersException e) {
- LOGGER.warn (MessageEnum.ASDC_LOAD_ASDC_CLIENT_EXC,
- "All ASDC Hosts",
- "All ASDC Envs", "ASDC", "", MsoLogger.ErrorCode.BusinessProcesssError, "ASDCParametersException in updateControllersListIfNeeded",
- e);
- } catch (MsoPropertiesException e) {
- LOGGER.warn (MessageEnum.ASDC_LOAD_ASDC_CLIENT_EXC,
- "All ASDC Hosts",
- "All ASDC Envs", "ASDC", "", MsoLogger.ErrorCode.BusinessProcesssError, "MsoPropertiesException in updateControllersListIfNeeded",
- e);
- }
- return updateNeeded;
-
-
- }
-
- /**
- * Checks for each controller if it is STOPPED and restart if it is the case.
- */
- public void checkInStoppedState () {
-
- for (ASDCController controller : controllers.values()) {
- if (ASDCControllerStatus.STOPPED.equals (controller.getControllerStatus ())) {
-
- // Try to restart just in case of issues
- try {
- controller.initASDC ();
- } catch (ASDCControllerException ec) {
- LOGGER.warn (MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC,
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "", MsoLogger.ErrorCode.BusinessProcesssError, "ASDCControllerException in checkInStoppedState",
- ec);
- } catch (ASDCParametersException ep) {
- LOGGER.warn (MessageEnum.ASDC_LOAD_ASDC_CLIENT_EXC,
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "", MsoLogger.ErrorCode.BusinessProcesssError, "ASDCParametersException in checkInStoppedState",
- ep);
- } catch (RuntimeException | IOException e) {
- LOGGER.error (MessageEnum.ASDC_SINGLETON_CHECKT_EXC,
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "", MsoLogger.ErrorCode.BusinessProcesssError, "RuntimeException in checkInStoppedState",
- e);
- }
- }
- }
- }
-
- public void closeASDC () {
- List<String> controllerToRemove = new LinkedList<>();
-
- for (ASDCController controller : controllers.values()) {
- try {
- controller.closeASDC ();
- controllerToRemove.add(controller.controllerName);
-
- } catch (RuntimeException e) {
- LOGGER.warn (MessageEnum.ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
- "RuntimeException",
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "closeASDC", MsoLogger.ErrorCode.BusinessProcesssError, "RuntimeException in closeASDC",
- e);
- } catch (ASDCControllerException e) {
- LOGGER.warn (MessageEnum.ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
- "ASDCControllerException",
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "closeASDC", MsoLogger.ErrorCode.BusinessProcesssError, "ASDCControllerException in closeASDC",
- e);
- }
- }
-
- // Now remove the ones properly closed
- for (String toRemove:controllerToRemove) {
- controllers.remove(toRemove);
- }
-
- }
-
- /**
- * Check whether the config has been changed
- */
- public boolean updateControllersConfigIfNeeded () {
- boolean listUpdated=updateControllersListIfNeeded();
- if (!listUpdated) {
-
- for (ASDCController controller : controllers.values()) {
- try {
- controller.updateConfigIfNeeded ();
- } catch (ASDCControllerException ec) {
- LOGGER.warn (MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC,
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "closeASDC", MsoLogger.ErrorCode.BusinessProcesssError, "ASDCControllerException in updateControllersConfigIfNeeded",
- ec);
- } catch (ASDCParametersException ep) {
- LOGGER.warn (MessageEnum.ASDC_LOAD_ASDC_CLIENT_EXC,
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "closeASDC", MsoLogger.ErrorCode.BusinessProcesssError, "ASDCParametersException in updateControllersConfigIfNeeded",
- ep);
- } catch (RuntimeException | IOException e) {
- LOGGER.error (MessageEnum.ASDC_SINGLETON_CHECKT_EXC,
- controller.getAddress (),
- controller.getEnvironment (), "ASDC", "closeASDC", MsoLogger.ErrorCode.BusinessProcesssError, "RuntimeException in updateControllersConfigIfNeeded",
- e);
- }
- }
- }
- return listUpdated;
- }
-
- public Map<String, ASDCController> getControllers() {
- return controllers;
- }
-
-
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfo.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfo.java
deleted file mode 100644
index b57792e..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfo.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client.test.emulators;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.onap.sdc.api.notification.IArtifactInfo;
-
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class JsonArtifactInfo implements IArtifactInfo {
-
- @JsonIgnore
- private Map<String,IArtifactInfo> artifactsMapByUUID = new HashMap<>();
-
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- public JsonArtifactInfo() {
-
- }
-
- public synchronized void addArtifactToUUIDMap (List<JsonArtifactInfo> artifactList) {
- for (JsonArtifactInfo artifact:artifactList) {
- artifactsMapByUUID.put(artifact.getArtifactUUID(), artifact);
- }
-
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
-
-
-
- public Map<String, IArtifactInfo> getArtifactsMapByUUID() {
- return artifactsMapByUUID;
- }
-
- @Override
- public String getArtifactChecksum() {
- return (String)attributesMap.get("artifactCheckSum");
- }
-
- @Override
- public String getArtifactDescription() {
- return (String)attributesMap.get("artifactDescription");
- }
-
- @Override
- public String getArtifactName() {
- return (String)attributesMap.get("artifactName");
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return (Integer)attributesMap.get("artifactTimeout");
- }
-
- @Override
- public String getArtifactType() {
- return (String)attributesMap.get("artifactType");
- }
-
- @Override
- public String getArtifactURL() {
- return (String)attributesMap.get("artifactURL");
- }
-
- @Override
- public String getArtifactUUID() {
- return (String)attributesMap.get("artifactUUID");
- }
-
- @Override
- public String getArtifactVersion() {
- return (String)attributesMap.get("artifactVersion");
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact () {
- return artifactsMapByUUID.get(attributesMap.get("generatedArtifact"));
- }
-
- @Override
- public List<IArtifactInfo> getRelatedArtifacts() {
- List<IArtifactInfo> listArtifacts = new LinkedList<>();
- List<String> uuidList = (List<String>)attributesMap.get("relatedArtifact");
- if (uuidList != null) {
- for(String uuid:uuidList) {
- listArtifacts.add(artifactsMapByUUID.get(uuid));
- }
- }
- return listArtifacts;
- }
-
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoDeserializer.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoDeserializer.java
deleted file mode 100644
index 66863b5..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoDeserializer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client.test.emulators;
-
-import java.io.IOException;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class JsonArtifactInfoDeserializer extends JsonDeserializer<List<JsonArtifactInfo>>{
-
- @Override
- public List<JsonArtifactInfo> deserialize(JsonParser jp, DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
- List<JsonArtifactInfo> jsonArtifactInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonArtifactInfo>>(){});
-
- // For each artifact add the list of artifact retrieved
- // This could be used later to index by UUID
- for (JsonArtifactInfo artifactInfo:jsonArtifactInfoList) {
- artifactInfo.addArtifactToUUIDMap(jsonArtifactInfoList);
- }
- return jsonArtifactInfoList;
- }
-
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationData.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationData.java
deleted file mode 100644
index 3eddb4a..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationData.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client.test.emulators;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-
-public class JsonNotificationData implements INotificationData {
-
- @JsonIgnore
- private static ObjectMapper mapper = new ObjectMapper();
-
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- @JsonProperty("serviceArtifacts")
- @JsonDeserialize(using=JsonArtifactInfoDeserializer.class)
- private List<IArtifactInfo> serviceArtifacts;
-
- @JsonProperty("resources")
- @JsonDeserialize(using=JsonResourceInfoDeserializer.class)
- private List<IResourceInstance> resourcesList;
-
- public JsonNotificationData() {
-
- }
-
- /**
- * Method instantiate a INotificationData implementation from a JSON file.
- *
- * @param notifFilePath The file path in String
- * @return A JsonNotificationData instance
- * @throws IOException in case of the file is not readable or not accessible
- */
- public static JsonNotificationData instantiateNotifFromJsonFile(String notifFilePath) throws IOException {
-
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(notifFilePath + "notif-structure.json");
-
- //String fileLocation = System.getProperty("mso.config.path") + "notif-structure.json";
-
- //String source = fileLocation;
- //InputStream is = IOUtils.toInputStream(source, "UTF-8");
-
- //String myString = IOUtils.toString(is, "UTF-8");
-
-
- //System.out.println(myString);
-
- if (is == null) {
- //throw new FileExistsException("Resource Path does not exist: "+notifFilePath);
- }
- return mapper.readValue(is, JsonNotificationData.class);
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
-
- @Override
- public String getWorkloadContext(){
- return (String)this.attributesMap.get("workloadContext");
- }
-
- @Override
- public void setWorkloadContext(java.lang.String arg0){
-
- }
-
- @Override
- public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
- return null;
- }
-
- @Override
- public String getDistributionID() {
- return (String)this.attributesMap.get("distributionID");
- }
-
- @Override
- public List<IResourceInstance> getResources() {
- return resourcesList;
- }
-
- @Override
- public List<IArtifactInfo> getServiceArtifacts() {
- return this.serviceArtifacts;
- }
-
- @Override
- public String getServiceDescription() {
- return (String)this.attributesMap.get("serviceDescription");
- }
-
- @Override
- public String getServiceInvariantUUID() {
- return (String)this.attributesMap.get("serviceInvariantUUID");
- }
-
- @Override
- public String getServiceName() {
- return (String)this.attributesMap.get("serviceName");
- }
-
- @Override
- public String getServiceUUID() {
- return (String)this.attributesMap.get("serviceUUID");
- }
-
- @Override
- public String getServiceVersion() {
- return (String)this.attributesMap.get("serviceVersion");
- }
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfo.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfo.java
deleted file mode 100644
index 6f26fd0..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfo.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client.test.emulators;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.IResourceInstance;
-
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-public class JsonResourceInfo implements IResourceInstance {
-
- @JsonIgnore
- private Map<String,Object> attributesMap = new HashMap<>();
-
- @JsonProperty("artifacts")
- @JsonDeserialize(using=JsonArtifactInfoDeserializer.class)
- private List<IArtifactInfo> artifacts;
-
- public JsonResourceInfo() {
-
- }
-
- @Override
- public List<IArtifactInfo> getArtifacts() {
- return artifacts;
- }
-
- @Override
- public String getResourceInstanceName() {
- return (String)attributesMap.get("resourceInstanceName");
- }
-
- @Override
- public String getResourceInvariantUUID() {
- return (String)attributesMap.get("resourceInvariantUUID");
- }
-
- @Override
- public String getResourceCustomizationUUID() {
- return (String)attributesMap.get("resourceCustomizationUUID");
- }
-
- @Override
- public String getResourceName() {
- return (String)attributesMap.get("resourceName");
- }
-
- @Override
- public String getResourceType() {
- return (String)attributesMap.get("resourceType");
- }
-
- @Override
- public String getResourceUUID() {
- return (String)attributesMap.get("resourceUUID");
- }
-
- @Override
- public String getResourceVersion() {
- return (String)attributesMap.get("resourceVersion");
- }
-
- @Override
- public String getSubcategory() {
- return (String)attributesMap.get("subCategory");
- }
-
- @Override
- public String getCategory() {
- return (String)attributesMap.get("category");
- }
-
- @SuppressWarnings("unused")
- @JsonAnySetter
- public final void setAttribute(String attrName, Object attrValue) {
- if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
- this.attributesMap.put(attrName,attrValue);
- }
- }
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoDeserializer.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoDeserializer.java
deleted file mode 100644
index 49908e7..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoDeserializer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.client.test.emulators;
-
-import java.io.IOException;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class JsonResourceInfoDeserializer extends JsonDeserializer<List<JsonResourceInfo>>{
-
- @Override
- public List<JsonResourceInfo> deserialize(JsonParser jp, DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
- List<JsonResourceInfo> jsonResourceInfoList = new ObjectMapper().readValue(jp, new TypeReference<List<JsonResourceInfo>>(){});
-
- return jsonResourceInfoList;
- }
-
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/healthcheck/HealthCheckHandler.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/healthcheck/HealthCheckHandler.java
deleted file mode 100644
index 2162607..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/healthcheck/HealthCheckHandler.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.healthcheck;
-
-
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
-
-import org.apache.http.HttpStatus;
-import org.openecomp.mso.HealthCheckUtils;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJsonProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.utils.UUIDChecker;
-
-
-@Path("/")
- public class HealthCheckHandler {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC);
- private static final String MSO_PROP_ASDC = "MSO_PROP_ASDC";
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static final String SUC_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
- private static final String NOT_FOUND = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Ready</title></head><body>Application Not Ready. Properties file missing or invalid or database Connection failed</body></html>";
-
- private static final Response OK_RESPONSE = Response.status (HttpStatus.SC_OK).entity (SUC_HTML).build ();
- private static final Response NOK_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE).entity (NOT_FOUND).build ();
-
- @HEAD
- @GET
- @Path("/healthcheck")
- @Produces("text/html")
- public Response healthcheck (@QueryParam("requestId") String requestId) {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck(msoLogger)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- MsoJsonProperties props = loadMsoProperties ();
- if (props == null) {
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application Not Ready");
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
-
- if (!healthCheck.catalogDBCheck (msoLogger, startTime)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
- msoLogger.debug("healthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- }
-
- private MsoJsonProperties loadMsoProperties () {
- MsoJsonProperties msoProperties;
- try {
- msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_PROP_ASDC);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.ASDC_PROPERTIES_NOT_FOUND, MSO_PROP_ASDC, "", "", MsoLogger.ErrorCode.DataError, "Exception - getMsoJsonProperties", e);
- return null;
- }
-
- if (msoProperties !=null && msoProperties.getJsonRootNode().elements().hasNext()) {
- return msoProperties;
- } else {
- msoLogger.error (MessageEnum.ASDC_PROPERTIES_NOT_FOUND , MSO_PROP_ASDC, "", "", MsoLogger.ErrorCode.DataError, "ASDC properties not found");
- return null;
- }
- }
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
deleted file mode 100644
index 9d986d9..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
+++ /dev/null
@@ -1,1272 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.installer.heat;
-
-import java.sql.SQLIntegrityConstraintViolationException;
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.Comparator;
-
-import org.hibernate.exception.ConstraintViolationException;
-import org.hibernate.exception.LockAcquisitionException;
-import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
-//import org.openecomp.generic.tosca.parser.model.Metadata;
-//import org.openecomp.generic.tosca.parser.model.NodeTemplate;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.IStatusData;
-import org.onap.sdc.api.notification.IVfModuleMetadata;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.Group;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.Property;
-import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.onap.sdc.toscaparser.api.parameters.Input;
-import org.onap.sdc.utils.DistributionStatusEnum;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.installer.ASDCElementInfo;
-import org.openecomp.mso.asdc.installer.BigDecimalVersion;
-import org.openecomp.mso.asdc.installer.IVfModuleData;
-import org.openecomp.mso.asdc.installer.IVfResourceInstaller;
-import org.openecomp.mso.asdc.installer.ToscaResourceStructure;
-import org.openecomp.mso.asdc.installer.VfModuleArtifact;
-import org.openecomp.mso.asdc.installer.VfModuleStructure;
-import org.openecomp.mso.asdc.installer.VfResourceStructure;
-import org.openecomp.mso.asdc.tenantIsolation.DistributionStatus;
-import org.openecomp.mso.asdc.tenantIsolation.WatchdogDistribution;
-import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
-import org.openecomp.mso.asdc.util.YamlEditor;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.AllottedResource;
-import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
-import org.openecomp.mso.db.catalog.beans.HeatFiles;
-import org.openecomp.mso.db.catalog.beans.HeatTemplate;
-import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
-import org.openecomp.mso.db.catalog.beans.NetworkResource;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
-import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
-import org.openecomp.mso.db.catalog.beans.VnfResCustomToVfModuleCustom;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatusDb;
-import org.openecomp.mso.requestsdb.WatchdogDistributionStatusDb;
-import org.openecomp.mso.requestsdb.WatchdogServiceModVerIdLookupDb;
-
-public class ToscaResourceInstaller {// implements IVfResourceInstaller {
-
- private MsoLogger logger;
-
- private static final Pattern lastDigit = Pattern.compile("(\\d+)$");
-
- public ToscaResourceInstaller() {
- logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC);
- }
-
- //@Override
- public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct)
- throws ArtifactInstallerException {
- boolean status = false;
- VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
- try {
- status = vfResourceStructure.isDeployedSuccessfully();
- } catch (RuntimeException e) {
- status = false;
- }
-
- try {
-
- String serviceUUID = vfResourceStruct.getNotification().getServiceUUID();
-
- if (status) {
- logger.info(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
- vfResourceStructure.getResourceInstance().getResourceInstanceName(),
- vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
- vfResourceStructure.getNotification().getServiceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()),
- vfResourceStructure.getNotification().getServiceUUID(),
- vfResourceStructure.getResourceInstance().getResourceName(),"", "");
- } else {
- logger.info(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- vfResourceStructure.getResourceInstance().getResourceInstanceName(),
- vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
- vfResourceStructure.getNotification().getServiceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()),
- vfResourceStructure.getNotification().getServiceUUID(),
- vfResourceStructure.getResourceInstance().getResourceName(),"", "");
- }
-
- return status;
-
- } catch (Exception e) {
- logger.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception - isResourceAlreadyDeployed");
- throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
- }
- }
-
- public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException {
-
- logger.debug("Entering installTheComponentStatus for distributionId " + iStatus.getDistributionID() + " and ComponentName " + iStatus.getComponentName());
-
- WatchdogComponentDistributionStatusDb wdComponentDistributionStatus = WatchdogComponentDistributionStatusDb.getInstance();
-
- WatchdogDistributionStatusDb wdDistributionStatus = WatchdogDistributionStatusDb.getInstance();
-
-
- try{
- //Check to make sure the distributionId exists in the Distribution Status table first. If not then we'll need to add it
- String distributionId = wdDistributionStatus.getWatchdogDistributionId(iStatus.getDistributionID());
-
- if(distributionId == null){
- // Insert the record into the parent table first - WatchDogDistributionStatus
- wdDistributionStatus.insertWatchdogDistributionId(iStatus.getDistributionID());
- }
-
- wdComponentDistributionStatus.insertWatchdogComponentDistributionStatus(iStatus.getDistributionID(), iStatus.getComponentName(), iStatus.getStatus().toString());
-
-
- WatchdogDistribution wd = new WatchdogDistribution();
-
- String distributionStatus = wd.getOverallDistributionStatus(iStatus.getDistributionID());
-
- logger.debug("Distribution status in installTheComponentStatus is : " + distributionStatus);
-
- }catch (Exception e){
- logger.debug("Exception caught in installTheComponentStatus " + e.getMessage());
- throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage());
- }
-
- }
-
-
- public void installTheResource(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
-
- logger.debug("installTheResource is called");
-
- VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
-
- for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) {
- case ASDCConfiguration.HEAT:
- case ASDCConfiguration.HEAT_VOL:
- case ASDCConfiguration.HEAT_NESTED:
- ToscaResourceInstaller.createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct, vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_ENV:
- ToscaResourceInstaller.createHeatEnvFromArtifact(vfResourceStructure, vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_ARTIFACT:
- ToscaResourceInstaller.createHeatFileFromArtifact(vfResourceStructure, vfModuleArtifact, toscaResourceStruct);
- break;
- case ASDCConfiguration.HEAT_NET:
- case ASDCConfiguration.OTHER:
- logger.warn(MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT, vfModuleArtifact.getArtifactInfo().getArtifactType()+"(Artifact Name:"+vfModuleArtifact.getArtifactInfo().getArtifactName()+")", "", "", MsoLogger.ErrorCode.DataError, "Artifact type not supported");
- break;
- default:
- break;
-
- }
- }
- // Those objects could be reused by different VfModule
-
-
-
- // PCLO: in case of deployment failure, use a string that will represent the type of artifact that failed...
- List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
-
- CatalogDatabase catalogDB = CatalogDatabase.getInstance();
-
- WatchdogServiceModVerIdLookupDb wdLookupDB = WatchdogServiceModVerIdLookupDb.getInstance();
-
- WatchdogDistributionStatusDb wdDistributionStatus = WatchdogDistributionStatusDb.getInstance();
-
- WatchdogComponentDistributionStatusDb wdComponentDistributionStatus = WatchdogComponentDistributionStatusDb.getInstance();
- // 2. Create the VFModules/VNFResource objects by linking them to the
- // objects created before and store them in Resource/module structure
- // Opening a DB transaction, starting from here
- try {
-
-
- createToscaCsar(toscaResourceStruct);
-
- catalogDB.saveToscaCsar(toscaResourceStruct.getCatalogToscaCsar());
-
- ToscaResourceInstaller.createService(toscaResourceStruct, vfResourceStruct);
-
- catalogDB.saveService(toscaResourceStruct.getCatalogService());
-
- wdLookupDB.insertWatchdogServiceModVerIdLookup(vfResourceStructure.getNotification().getDistributionID(), vfResourceStructure.getNotification().getServiceUUID());
-
- wdDistributionStatus.insertWatchdogDistributionId(vfResourceStructure.getNotification().getDistributionID());
-
-
- /* VNF POPULATION
- * ************************************************************************************************************
- */
-
- // Ingest (VNF) Data - 1707
- List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
- int outerLoop = 0;
- logger.debug("**vfMondeTEmplatesList.size()=" + vfNodeTemplatesList.size());
- for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
- logger.debug("nodeTemplate outerLoop=" + outerLoop++);
- // extract VF metadata
-
- Metadata metadata = nodeTemplate.getMetaData();
-
-
-
- //************************Flexware code*******************************************
-
- String serviceType = toscaResourceStruct.getCatalogService().getServiceType();
-
-
- if(serviceType != null && serviceType.equalsIgnoreCase("Flexware")){
-
- createVnfResource(nodeTemplate, toscaResourceStruct);
-
- // check for duplicate record already in the database
- VnfResource vnfResource = catalogDB.getVnfResource(toscaResourceStruct.getCatalogVnfResource().getModelName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- toscaResourceStruct.getCatalogVnfResource().getVersion()));
-
- if (vnfResource != null) {
- toscaResourceStruct.setVnfAlreadyInstalled(true);
- }
-
-
- if(!toscaResourceStruct.isVnfAlreadyInstalled()) {
-
- catalogDB.saveOrUpdateVnfResource(toscaResourceStruct.getCatalogVnfResource());
-
- }
-
-
- boolean saveVnfCustomization = catalogDB.saveVnfResourceCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization());
-
- if(saveVnfCustomization){
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogVfServiceToResourceCustomization());
- }
-
-
- }
-
-
- // *************************** END of FLEXWARE CODE ****************************************************
-
- String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY);
-
- if(!vfCustomizationCategory.equalsIgnoreCase("Allotted Resource")) // Do not treat Allotted Resources as VNF resources
- {
-
- String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("vfCustomizationUUID=" + vfCustomizationUUID);
-
-
- /* HEAT TABLE POPULATION
- * *******************************************************************************************************
- */
-
- int nextLoop = 0;
- for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
- logger.debug("vfResourceStructure.getVfModuleStructure() loop, nextLoop = " + nextLoop++);
- logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
-
- // Here we set the right db structure according to the Catalog
- // DB
-
- // We expect only one MAIN HEAT per VFMODULE
- // we can also obtain from it the Env ArtifactInfo, that's why
- // we
- // get the Main IArtifactInfo
-
- HeatTemplate heatMainTemplate = null;
- HeatEnvironment heatEnv;
-
- HeatTemplate heatVolumeTemplate = null;
- HeatEnvironment heatVolumeEnv;
-
-
- IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
-
-
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT)) {
-
- List<VfModuleArtifact> artifacts = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT);
- logger.debug("there are " + artifacts.size() + " artifacts");
- IArtifactInfo mainEnvArtifactInfo = null;
- for (VfModuleArtifact vfma : artifacts) {
- logger.debug("vmfa=" + vfma.toString());
- mainEnvArtifactInfo =
- vfma.getArtifactInfo().getGeneratedArtifact();
-
- // MAIN HEAT
- heatMainTemplate = (HeatTemplate) vfma.getCatalogObject();
-
- // Set HeatTemplateArtifactUUID to use later when setting the VfModule and NetworkResource
- toscaResourceStruct.setHeatTemplateUUID(heatMainTemplate.getArtifactUuid());
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo
- .createElementFromVfArtifactInfo(vfma.getArtifactInfo()));
-
- catalogDB.saveHeatTemplate(heatMainTemplate, heatMainTemplate.getParameters());
- // Indicate we have deployed it in the DB
- vfma.incrementDeployedInDB();
- }
-
-
- // VOLUME HEAT
- // We expect only one VOL HEAT per VFMODULE
- // we can also obtain from it the Env ArtifactInfo, that's why
- // we get the Volume IArtifactInfo
-
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_VOL)) {
- IArtifactInfo volEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0)
- .getArtifactInfo().getGeneratedArtifact();
-
- heatVolumeTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_VOL).get(0).getCatalogObject();
-
- // Set VolHeatTemplate ArtifactUUID to use later when setting the VfModule
- toscaResourceStruct.setVolHeatTemplateUUID(heatVolumeTemplate.getArtifactUuid());
-
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()));
-
- catalogDB.saveHeatTemplate(heatVolumeTemplate, heatVolumeTemplate.getParameters());
- // Indicate we have deployed it in the DB
- vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).incrementDeployedInDB();
-
- if (volEnvArtifactInfo != null) {
- heatVolumeEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
- .get(volEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
-
- // Set VolHeatTemplate ArtifactUUID to use later when setting the VfModule
- toscaResourceStruct.setVolHeatEnvTemplateUUID(heatVolumeEnv.getArtifactUuid());
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(volEnvArtifactInfo));
-
- catalogDB.saveHeatEnvironment(heatVolumeEnv);
- // Indicate we have deployed it in the DB
- vfResourceStructure.getArtifactsMapByUUID().get(volEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
- }
-
- }
-
- // NESTED HEAT
- // Here we expect many HEAT_NESTED template to be there
- // XXX FIX BY PCLO: Defect# -36643 -US666034 - check first if we really have nested heat templates
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_NESTED)) {
- for (VfModuleArtifact heatNestedArtifact : vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_NESTED)) {
-
- // Check if this nested is well referenced by the MAIN HEAT
- String parentArtifactType = ToscaResourceInstaller.identifyParentOfNestedTemplate(vfModuleStructure,heatNestedArtifact);
- HeatTemplate heatNestedTemplate = (HeatTemplate) heatNestedArtifact.getCatalogObject();
-
- if (parentArtifactType != null) {
-
- switch (parentArtifactType) {
- case ASDCConfiguration.HEAT:
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-
- catalogDB.saveNestedHeatTemplate (heatMainTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- break;
- case ASDCConfiguration.HEAT_VOL:
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
- catalogDB.saveNestedHeatTemplate (heatVolumeTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- break;
-
- default:
- break;
-
- }
- } else { // Assume it belongs to HEAT MAIN
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-
- catalogDB.saveNestedHeatTemplate (heatMainTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- }
- }
- }
-
- if (mainEnvArtifactInfo != null) {
- heatEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
- .get(mainEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
-
- // Set HeatEnvironmentArtifactUUID to use later when setting the VfModule
- toscaResourceStruct.setEnvHeatTemplateUUID(heatEnv.getArtifactUuid());
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(mainEnvArtifactInfo));
-
- catalogDB.saveHeatEnvironment(heatEnv);
- // Indicate we have deployed it in the DB
- vfResourceStructure.getArtifactsMapByUUID().get(mainEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
- }
-
- // here we expect one VFModule to be there
- //VfResourceInstaller.createVfModule(vfModuleStructure,heatMainTemplate, heatVolumeTemplate, heatEnv, heatVolumeEnv);
- //VfModule vfModule = vfModuleStructure.getCatalogVfModule();
-
- // Add this one for logging
- //artifactListForLogging.add(ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure));
-
- //catalogDB.saveOrUpdateVfModule(vfModule);
-
-
- // extract VF metadata
- createVnfResource(nodeTemplate, toscaResourceStruct);
-
- // check for duplicate record already in the database
- VnfResource vnfResource = catalogDB.getVnfResource(toscaResourceStruct.getCatalogVnfResource().getModelName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- toscaResourceStruct.getCatalogVnfResource().getVersion()));
-
- if (vnfResource != null) {
- toscaResourceStruct.setVnfAlreadyInstalled(true);
- }
-
-
- if(!toscaResourceStruct.isVnfAlreadyInstalled()) {
-
- catalogDB.saveOrUpdateVnfResource(toscaResourceStruct.getCatalogVnfResource());
-
- }
-
-
- catalogDB.saveVnfResourceCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization());
-
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogVfServiceToResourceCustomization());
-
-
- List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
- logger.debug("vfGroups:" + vfGroups.toString());
-
- vfGroups.sort((group1, group2) -> {
- //Field name1Field = group1.class.getDeclaredField("name");
- //name1Field.setAccessible(true);
- String thisName = group1.getName(); //(String) name1Field.get(group1);
- String thatName = group2.getName(); // (String) name1Field.get(group2);
-
- Matcher m = lastDigit.matcher(thisName);
- Matcher m2 = lastDigit.matcher(thatName);
-
- String thisDigit = "0";
- String thatDigit = "0";
- if (m.find()) {
- thisDigit = m.group();
- } else {
- return -1;
- }
- if (m2.find()) {
- thatDigit = m2.group();
- } else {
- return 1;
- }
-
- return new Integer(thisDigit).compareTo(new Integer(thatDigit));
- });
-
- logger.debug("vfGroupsAfter:" + vfGroups.toString());
-
-
- for(Group group : vfGroups){
-
-
- //boolean saveVFModule = createVFModule(group, nodeTemplate, toscaResourceStruct, vfMetadata);
- if (vfMetadata.getVfModuleModelCustomizationUUID() == null) {
- logger.debug("NULL 1");
- } else {
- logger.debug("vfMetadata.getMCU=" + vfMetadata.getVfModuleModelCustomizationUUID());
- }
- if (group.getMetadata() == null) {
- logger.debug("NULL 3");
- } else {
- logger.debug("group.getMetadata().getValue() = " + group.getMetadata().getValue("vfModuleModelCustomizationUUID"));
- }
- if (vfMetadata.getVfModuleModelCustomizationUUID().equals(group.getMetadata().getValue("vfModuleModelCustomizationUUID"))) {
- logger.debug("Found a match at " + vfMetadata.getVfModuleModelCustomizationUUID());
- createVFModule(group, nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata);
-
- catalogDB.saveOrUpdateVfModule(toscaResourceStruct.getCatalogVfModule());
-
- catalogDB.saveOrUpdateVfModuleCustomization(toscaResourceStruct.getCatalogVfModuleCustomization());
-
- catalogDB.saveVnfResourceToVfModuleCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization(), toscaResourceStruct.getCatalogVfModuleCustomization());
-
-
- } else {
- if(toscaResourceStruct.getCatalogVfModuleCustomization() != null){
- logger.debug("No match for " + toscaResourceStruct.getCatalogVfModuleCustomization().getModelCustomizationUuid());
- } else {
- logger.debug("No match for vfModuleModelCustomizationUUID");
- }
- }
-
- }
-
- } //Commented out to process VFModules each time
-
- // Here we expect many HEAT_TEMPLATE files to be there
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_ARTIFACT)) {
- for (VfModuleArtifact heatArtifact : vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_ARTIFACT)) {
-
- HeatFiles heatFile = (HeatFiles) heatArtifact.getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatArtifact.getArtifactInfo()));
-
- if(toscaResourceStruct.getCatalogVfModule() != null && heatFile != null){
- catalogDB.saveVfModuleToHeatFiles (toscaResourceStruct.getCatalogVfModule().getModelUUID(), heatFile);
- }
- // Indicate we will deploy it in the DB
- heatArtifact.incrementDeployedInDB();
- }
- }
-
- }
- }
- }
-
- /* END OF HEAT TABLE POPULATION
- * ***************************************************************************************************
- */
-
-
- // throw new ArtifactInstallerException("TESTING");
-
-
- List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
-
- if(allottedResourceList != null){
-
- for(NodeTemplate allottedNode : allottedResourceList){
-
- createAllottedResource(allottedNode, toscaResourceStruct);
-
- catalogDB.saveAllottedResource(toscaResourceStruct.getAllottedResource());
-
- catalogDB.saveAllottedResourceCustomization(toscaResourceStruct.getCatalogAllottedResourceCustomization());
-
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogAllottedServiceToResourceCustomization());
-
- }
- }
-
- // handle VF resource
- List<NodeTemplate> serviceVfList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
- if (serviceVfList != null) {
- for (NodeTemplate vfNode : serviceVfList) {
- createVnfResource(vfNode, toscaResourceStruct);
- catalogDB.saveVnfResource(toscaResourceStruct.getCatalogVnfResource());
- catalogDB.saveVnfResourceCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization());
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogVfServiceToResourceCustomization());
- }
- }
-
-
- List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList();
-
- if(nodeTemplatesVLList != null){
-
- for(NodeTemplate vlNode : nodeTemplatesVLList){
-
- String networkResourceModelName = vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
-
- List<TempNetworkHeatTemplateLookup> networkHeatTemplateLookup = catalogDB.getTempNetworkHeatTemplateLookup(networkResourceModelName);
-
- if(networkHeatTemplateLookup != null && networkHeatTemplateLookup.size() > 0 ){
-
- createNetworkResource(vlNode, toscaResourceStruct, networkHeatTemplateLookup.get(0));
-
- } else {
- logger.info(MessageEnum.ASDC_GENERAL_INFO,
- "No NetworkResourceName found in TempNetworkHeatTemplateLookup for" + networkResourceModelName, "ASDC",
- "createVfModuleStructures");
- createNetworkResource(vlNode, toscaResourceStruct, null);
- }
-
-
- catalogDB.saveNetworkResource(toscaResourceStruct.getCatalogNetworkResource());
-
- catalogDB.saveNetworkResourceCustomization(toscaResourceStruct.getCatalogNetworkResourceCustomization());
-
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogVlServiceToResourceCustomization());
-
- }
- }
-
-
- //createServiceToResourceCustomization(toscaResourceStruct.getCatalogService(), toscaResourceStruct.getCatalogVnfResourceCustomization(), toscaResourceStruct);
-
- // catalogDB.saveToscaCsar(toscaResourceStruct.getCatalogToscaCsar());
- wdComponentDistributionStatus.insertWatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), "SO", DistributionStatusEnum.COMPONENT_DONE_OK.name());
-
- catalogDB.commit();
- toscaResourceStruct.setSuccessfulDeployment();
-
- }catch(Exception e){
- logger.debug("Exception :",e);
-
- wdDistributionStatus.insertWatchdogDistributionId(vfResourceStructure.getNotification().getDistributionID());
-
- wdComponentDistributionStatus.insertWatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), "SO", DistributionStatusEnum.COMPONENT_DONE_ERROR.name());
-
- wdDistributionStatus.updateWatchdogDistributionIdStatus(vfResourceStruct.getNotification().getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
-
- Throwable dbExceptionToCapture = e;
- while (!(dbExceptionToCapture instanceof ConstraintViolationException || dbExceptionToCapture instanceof LockAcquisitionException)
- && (dbExceptionToCapture.getCause() != null)) {
- dbExceptionToCapture = dbExceptionToCapture.getCause();
- }
-
- if (dbExceptionToCapture instanceof ConstraintViolationException || dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED, vfResourceStructure.getResourceInstance().getResourceName(),
- vfResourceStructure.getNotification().getServiceVersion(), "", "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
- } else {
- String elementToLog = (artifactListForLogging.size() > 0 ? artifactListForLogging.get(artifactListForLogging.size()-1).toString() : "No element listed");
- logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback", e);
- catalogDB.rollback();
- throw new ArtifactInstallerException(
- "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
- }
-
- } finally {
- catalogDB.close();
- }
-
- }
-
-
- public static String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure, List<String> listTypes) {
- String newFileBody = filebody;
- for (VfModuleArtifact moduleArtifact:vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) {
-
- newFileBody = verifyTheFilePrefixInString(newFileBody,moduleArtifact.getArtifactInfo().getArtifactName());
- }
- }
- return newFileBody;
- }
-
- public static String verifyTheFilePrefixInString(final String body, final String filenameToVerify) {
-
- String needlePrefix = "file:///";
- String prefixedFilenameToVerify = needlePrefix+filenameToVerify;
-
- if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) {
- return body;
- }
-
- StringBuilder sb = new StringBuilder(body.length());
-
- int currentIndex = 0;
- int startIndex = 0;
-
- while (currentIndex != -1) {
- startIndex = currentIndex;
- currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex);
-
- if (currentIndex == -1) {
- break;
- }
-
- // We append from the startIndex up to currentIndex (start of File Name)
- sb.append(body.substring(startIndex, currentIndex));
- sb.append(filenameToVerify);
-
- currentIndex += prefixedFilenameToVerify.length();
- }
-
- sb.append(body.substring(startIndex));
-
- return sb.toString();
- }
-
-
- private static void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure,ToscaResourceStructure toscaResourceStruct,
- VfModuleArtifact vfModuleArtifact) {
- HeatTemplate heatTemplate = new HeatTemplate();
-
- // TODO Set the label
-// heatTemplate.setAsdcLabel("label");
- // Use the ResourceName of the ASDC template because the HEAT could be
- // reused
-// heatTemplate.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
- heatTemplate.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- List<String> typeList = new ArrayList<>();
- typeList.add(ASDCConfiguration.HEAT_NESTED);
- typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
-
- heatTemplate.setTemplateBody(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList));
- heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName());
-
- if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
- heatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
- } else {
- heatTemplate.setTimeoutMinutes(240);
- }
-
- //toscaResourceStruct.setHeatFilesUUID(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatTemplate.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
- heatTemplate.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
- heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatTemplate.setArtifactChecksum("MANUAL_RECORD");
- }
-
- Set<HeatTemplateParam> heatParam = ToscaResourceInstaller
- .extractHeatTemplateParameters(vfModuleArtifact.getResult(), vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatTemplate.setParameters(heatParam);
- //heatTemplate.setCreated(getCurrentTimeStamp());
-
- vfModuleArtifact.setCatalogObject(heatTemplate);
- }
-
- private static void createHeatEnvFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact) {
- HeatEnvironment heatEnvironment = new HeatEnvironment();
-
- heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName());
- // TODO Set the label
-// heatEnvironment.setAsdcLabel("Label");
-
- List<String> typeList = new ArrayList<>();
- typeList.add(ASDCConfiguration.HEAT);
- typeList.add(ASDCConfiguration.HEAT_VOL);
-
- heatEnvironment.setEnvironment(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList));
-// heatEnvironment.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatEnvironment.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
-// heatEnvironment.setAsdcResourceName(VfResourceInstaller.createVNFName(vfResourceStructure));
- heatEnvironment.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
- heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else{
- heatEnvironment.setArtifactChecksum("MANUAL_RECORD");
- }
- //heatEnvironment.setCreated(getCurrentTimeStamp());
-
- vfModuleArtifact.setCatalogObject(heatEnvironment);
-
- }
-
- private static void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact, ToscaResourceStructure toscaResourceStruct) {
-
- HeatFiles heatFile = new HeatFiles();
- // TODO Set the label
-// heatFile.setAsdcLabel("Label");
- heatFile.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatFile.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatFile.setFileBody(vfModuleArtifact.getResult());
- heatFile.setFileName(vfModuleArtifact.getArtifactInfo().getArtifactName());
- heatFile.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
-
- toscaResourceStruct.setHeatFilesUUID(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- //heatFile.setCreated(getCurrentTimeStamp());
-
-// heatFile.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
-
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
- heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatFile.setArtifactChecksum("MANUAL_RECORD");
- }
-
- vfModuleArtifact.setCatalogObject(heatFile);
-
- }
-
- private static void createService(ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure) {
-
- toscaResourceStructure.getServiceMetadata();
-
- Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
-
- Service service = new Service();
-
- // Service
- if(serviceMetadata != null) {
-
- if(toscaResourceStructure.getServiceVersion() != null){
- service.setVersion(toscaResourceStructure.getServiceVersion());
- }
-
- service.setServiceType(serviceMetadata.getValue("serviceType"));
- service.setServiceRole(serviceMetadata.getValue("serviceRole"));
-
- service.setDescription(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- service.setModelName(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- service.setModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- service.setEnvironmentContext(serviceMetadata.getValue("environmentContext"));
-
-
- if(vfResourceStructure != null){
- service.setWorkloadContext(vfResourceStructure.getNotification().getWorkloadContext());
- }
- //service.setVersion(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- service.setModelInvariantUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- service.setCategory(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- service.setToscaCsarArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
- //service.setCreated(getCurrentTimeStamp());
- }
-
- toscaResourceStructure.setCatalogService(service);
- }
-
- private static void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
-
- ToscaCsar toscaCsar = new ToscaCsar();
- if(toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null){
- toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum());
- } else {
- toscaCsar.setArtifactChecksum("MANUAL_RECORD");
- }
- toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
- toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName());
- toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion());
- toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription());
- toscaCsar.setUrl(toscaResourceStructure.getToscaArtifact().getArtifactURL());
-
- toscaResourceStructure.setCatalogToscaCsar(toscaCsar);
- }
-
- private static void createNetworkResource(NodeTemplate networkNodeTemplate, ToscaResourceStructure toscaResourceStructure, TempNetworkHeatTemplateLookup networkHeatTemplateLookup) {
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
-
- NetworkResource networkResource = new NetworkResource();
-
- String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
-
- if("true".equalsIgnoreCase(providerNetwork)){
- networkResource.setNeutronNetworkType("PROVIDER");
- } else {
- networkResource.setNeutronNetworkType("BASIC");
- }
-
- networkResource.setModelName(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
-
- networkResource.setModelInvariantUUID(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- networkResource.setModelUUID(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
- networkResource.setModelVersion(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
-
- networkResource.setAicVersionMax(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
- String aicVersionMin = networkHeatTemplateLookup != null ? networkHeatTemplateLookup.getAicVersionMin() : "2.5";
- networkResource.setAicVersionMin(aicVersionMin);
- networkResource.setToscaNodeType(networkNodeTemplate.getType());
- networkResource.setDescription(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- networkResource.setOrchestrationMode("HEAT");
- networkResource.setCategory(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- networkResource.setSubCategory(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
- //for tosca NS ,there is no heat for network VL
- String heatTemplateArtifactUUID = networkHeatTemplateLookup != null ? networkHeatTemplateLookup.getHeatTemplateArtifactUuid() : "null";
- networkResource.setHeatTemplateArtifactUUID(heatTemplateArtifactUUID);
-
- toscaResourceStructure.setCatalogNetworkResource(networkResource);
-
- networkResourceCustomization.setModelInstanceName(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- networkResourceCustomization.setModelCustomizationUuid(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- networkResourceCustomization.setNetworkResourceModelUuid(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
-
-
- networkResourceCustomization.setNetworkTechnology(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)));
- networkResourceCustomization.setNetworkType(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)));
- networkResourceCustomization.setNetworkRole(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)));
- networkResourceCustomization.setNetworkScope(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)));
-
- toscaResourceStructure.setCatalogNetworkResourceCustomization(networkResourceCustomization);
-
- ServiceToResourceCustomization serviceToResourceCustomization = new ServiceToResourceCustomization();
- serviceToResourceCustomization.setServiceModelUUID(toscaResourceStructure.getCatalogService().getModelUUID());
- serviceToResourceCustomization.setResourceModelCustomizationUUID(testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- serviceToResourceCustomization.setModelType("network");
-
- toscaResourceStructure.setCatalogVlServiceToResourceCustomization(serviceToResourceCustomization);
-
-
- }
-
- private static void createVFModule(Group group, NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, IVfModuleData vfModuleData) {
- VfModule vfModule = new VfModule();
-
- Metadata vfMetadata = group.getMetadata();
-
- String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID();
-
-
- if(vfModuleModelUUID != null && vfModuleModelUUID.contains(".")){
- vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf("."));
- }
-
-
- for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()){
-
- String vfModelUUID = vfModuleStructure.getVfModuleMetadata().getVfModuleModelUUID();
-
- if(vfModelUUID != null && vfModelUUID.equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))){
-
- List<String> artifacts = vfModuleStructure.getVfModuleMetadata().getArtifacts();
-
- for(String artifact: artifacts){
-
-
- for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
-
-
- if(artifact.equals(vfModuleArtifact.getArtifactInfo().getArtifactUUID())){
- //if(vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ARTIFACT)){
- if(vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT)){
- vfModule.setHeatTemplateArtifactUUId(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- }
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_VOL)){
- vfModule.setVolHeatTemplateArtifactUUId(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- }
- }
-
- }
-
-
- }
-
-
- }
-
-
- }
-
- vfModule.setModelInvariantUuid(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
- vfModule.setModelName(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
- vfModule.setModelUUID(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
- vfModule.setVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
- vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- //vfModule.setHeatTemplateArtifactUUId(toscaResourceStructure.getHeatTemplateUUID());
- //vfModule.setVolHeatTemplateArtifactUUId(toscaResourceStructure.getVolHeatTemplateUUID());
-
- vfModule.setVnfResourceModelUUId(toscaResourceStructure.getCatalogVnfResource().getModelUuid());
-
- String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
- if(vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)){
- vfModule.setIsBase(1);
- }else {
- vfModule.setIsBase(0);
- }
-
-
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setModelCustomizationUuid(vfModuleData.getVfModuleModelCustomizationUUID());
-
-
- vfModuleCustomization.setVfModuleModelUuid(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
-
- vfModuleCustomization.setHeatEnvironmentArtifactUuid(toscaResourceStructure.getEnvHeatTemplateUUID());
-
-
- vfModuleCustomization.setVolEnvironmentArtifactUuid(toscaResourceStructure.getVolHeatEnvTemplateUUID());
-
- String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
- if(initialCount != null && initialCount.length() > 0){
- vfModuleCustomization.setInitialCount(Integer.valueOf(initialCount));
- }
-
- vfModuleCustomization.setInitialCount(Integer.valueOf(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT)));
-
- String availabilityZoneCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT);
- if(availabilityZoneCount != null && availabilityZoneCount.length() > 0){
- vfModuleCustomization.setAvailabilityZoneCount(Integer.valueOf(availabilityZoneCount));
- }
-
-
- vfModuleCustomization.setLabel(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL));
-
- String maxInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES);
- if(maxInstances != null && maxInstances.length() > 0){
- vfModuleCustomization.setMaxInstances(Integer.valueOf(maxInstances));
- }
-
- String minInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES);
- if(minInstances != null && minInstances.length() > 0){
- vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
- }
-
- toscaResourceStructure.setCatalogVfModule(vfModule);
-
- toscaResourceStructure.setCatalogVfModuleCustomization(vfModuleCustomization);
-
- }
-
- private static void createVnfResourceToVfModuleCustomization(VnfResourceCustomization vnfResourceCustomization,
- VfModuleCustomization vfModuleCustomization,
- ToscaResourceStructure toscaResourceStructure) {
-
- VnfResCustomToVfModuleCustom vnfResCustomToVfModuleCustom = new VnfResCustomToVfModuleCustom();
-
- vnfResCustomToVfModuleCustom.setVfModuleCustModelCustomizationUuid(vfModuleCustomization.getModelCustomizationUuid());
- vnfResCustomToVfModuleCustom.setVnfResourceCustModelCustomizationUuid(vnfResourceCustomization.getModelCustomizationUuid());
-
- toscaResourceStructure.setCatalogVnfResCustomToVfModuleCustom(vnfResCustomToVfModuleCustom);
-
-
-
- }
-
-
- private static void createTempNetworkHeatTemplateLookup(NetworkResource networkResource,
- VfModule vfModule,
- ToscaResourceStructure toscaResourceStructure) {
-
- TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup();
-
- tempNetworkHeatTemplateLookup.setNetworkResourceModelName(networkResource.getModelName());
- tempNetworkHeatTemplateLookup.setHeatTemplateArtifactUuid(vfModule.getHeatTemplateArtifactUUId());
- tempNetworkHeatTemplateLookup.setAicVersionMin("1");
-
- toscaResourceStructure.setCatalogTempNetworkHeatTemplateLookup(tempNetworkHeatTemplateLookup);
-
-
-
- }
-
- private static void createVnfResource(NodeTemplate vfNodeTemplate, ToscaResourceStructure toscaResourceStructure) {
- VnfResource vnfResource = new VnfResource();
-
-
- //toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)
-
- vnfResource.setModelInvariantUuid(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- vnfResource.setModelName(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- vnfResource.setModelUuid(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
-
- vnfResource.setVersion(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- vnfResource.setDescription(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- vnfResource.setOrchestrationMode("HEAT");
- vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
- vnfResource.setAicVersionMax(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
- vnfResource.setAicVersionMin(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
- //vnfResource.setHeatTemplateArtifactUUId(toscaResourceStructure.getHeatTemplateUUID());
-
- // vfNodeTemplate.getProperties()
- toscaResourceStructure.setCatalogVnfResource(vnfResource);
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setModelCustomizationUuid(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName());
-
- vnfResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
- vnfResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFCODE)));
- vnfResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
- vnfResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
-
-
- vnfResourceCustomization.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, "multi_stage_design"));
-
-
- vnfResourceCustomization.setVnfResourceModelUuid(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
- vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
-
- //vnfResourceCustomization.setMultiStageDesign(vfNodeTemplate.getMetaData().getValue("multi_stage_design"));
- //vnfResourceCustomization.setMultiStageDesign(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT).trim());
-
-
- vnfResourceCustomization.setMaxInstances(Integer.getInteger(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
- vnfResourceCustomization.setMinInstances(Integer.getInteger(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
-
-
-
- toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization);
-
-
- ServiceToResourceCustomization serviceToResourceCustomization = new ServiceToResourceCustomization();
- serviceToResourceCustomization.setServiceModelUUID(toscaResourceStructure.getCatalogService().getModelUUID());
- serviceToResourceCustomization.setResourceModelCustomizationUUID(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- serviceToResourceCustomization.setModelType("vnf");
-
- toscaResourceStructure.setCatalogVfServiceToResourceCustomization(serviceToResourceCustomization);
-
-
- }
-
- private static void createAllottedResource(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure) {
- AllottedResource allottedResource = new AllottedResource();
-
- allottedResource.setModelUuid(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
- allottedResource.setModelInvariantUuid(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- allottedResource.setModelName(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- allottedResource.setModelVersion(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- allottedResource.setToscaNodeType(testNull(nodeTemplate.getType()));
- allottedResource.setSubcategory(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
- allottedResource.setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
-
- toscaResourceStructure.setAllottedResource(allottedResource);
-
- AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
- allottedResourceCustomization.setModelCustomizationUuid(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName());
- allottedResourceCustomization.setArModelUuid(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
-
-
- allottedResourceCustomization.setProvidingServiceModelInvariantUuid(toscaResourceStructure.getCatalogService().getModelInvariantUUID());
- allottedResourceCustomization.setProvidingServiceModelUuid(toscaResourceStructure.getCatalogService().getModelUUID());
- allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getCatalogService().getModelName());
- allottedResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
- allottedResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFCODE)));
- allottedResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
- allottedResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
- allottedResourceCustomization.setMinInstances(Integer.getInteger(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- allottedResourceCustomization.setMaxInstances(Integer.getInteger(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
- allottedResourceCustomization.setTargetNetworkRole(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
-
- toscaResourceStructure.setCatalogAllottedResourceCustomization(allottedResourceCustomization);
-
- ServiceToResourceCustomization serviceToResourceCustomization = new ServiceToResourceCustomization();
- serviceToResourceCustomization.setServiceModelUUID(toscaResourceStructure.getCatalogService().getModelUUID());
- serviceToResourceCustomization.setResourceModelCustomizationUUID(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- serviceToResourceCustomization.setModelType("allottedResource");
-
- toscaResourceStructure.setCatalogAllottedServiceToResourceCustomization(serviceToResourceCustomization);
-
- }
-
- private static Set<HeatTemplateParam> extractHeatTemplateParameters(String yamlFile, String artifactUUID) {
-
- // Scan the payload downloadResult and extract the HeatTemplate
- // parameters
- YamlEditor yamlEditor = new YamlEditor(yamlFile.getBytes());
- return yamlEditor.getParameterList(artifactUUID);
-
- }
-
- private static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,VfModuleArtifact heatNestedArtifact) {
-
- if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null
- && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
- for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0)
- .getArtifactInfo().getRelatedArtifacts()) {
- if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
- return ASDCConfiguration.HEAT;
- }
-
- }
- }
-
- if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null
- && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
- for (IArtifactInfo unknownArtifact:vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts()) {
- if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
- return ASDCConfiguration.HEAT_VOL;
- }
-
- }
- }
-
- // Does not belong to anything
- return null;
-
- }
-
- private static String testNull(Object object) {
-
-
- if(object == null){
- return null;
- }else if (object != null && object.equals("NULL")) {
- return null;
- }else if (object != null && object instanceof Integer) {
- return object.toString();
- } else if (object != null && object instanceof String) {
- return (String)object;
- } else {
- return "Type not recognized";
- }
- }
-
- private static String createVNFName(VfResourceStructure vfResourceStructure) {
-
- return vfResourceStructure.getNotification().getServiceName() + "/" + vfResourceStructure.getResourceInstance().getResourceInstanceName();
- }
-
- private static String createVfModuleName(VfModuleStructure vfModuleStructure) {
-
- return createVNFName(vfModuleStructure.getParentVfResource())+"::"+vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
- }
-
-
- private static Timestamp getCurrentTimeStamp() {
-
- return new Timestamp(new Date().getTime());
- }
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
deleted file mode 100644
index d227961..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
+++ /dev/null
@@ -1,790 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.installer.heat;
-
-import java.sql.Timestamp;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hibernate.exception.ConstraintViolationException;
-import org.hibernate.exception.LockAcquisitionException;
-import org.onap.sdc.api.notification.IArtifactInfo;
-
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.installer.ASDCElementInfo;
-import org.openecomp.mso.asdc.installer.BigDecimalVersion;
-import org.openecomp.mso.asdc.installer.IVfResourceInstaller;
-import org.openecomp.mso.asdc.installer.VfModuleArtifact;
-import org.openecomp.mso.asdc.installer.VfModuleStructure;
-import org.openecomp.mso.asdc.installer.VfResourceStructure;
-import org.openecomp.mso.asdc.util.YamlEditor;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
-import org.openecomp.mso.db.catalog.beans.HeatFiles;
-import org.openecomp.mso.db.catalog.beans.HeatTemplate;
-import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-public class VfResourceInstaller implements IVfResourceInstaller {
-
- private MsoLogger logger;
-
- public VfResourceInstaller() {
- logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC);
- }
-
- @Override
- public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct)
- throws ArtifactInstallerException {
-
- boolean status = false;
- VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
-
- try(CatalogDatabase db = CatalogDatabase.getInstance()) {
-
- String resourceType = vfResourceStruct.getResourceInstance().getResourceType();
- String category = vfResourceStruct.getResourceInstance().getCategory();
-
- // Check for duplicate VF Module that is not an Allotted Resource
- if(resourceType.equals("VF") && !category.equalsIgnoreCase("Allotted Resource")){
- logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "VNFResource",
- VfResourceInstaller.createVNFName(vfResourceStructure),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()), "", "");
-
- VnfResource vnfResource = db.getVnfResource(
- VfResourceInstaller.createVNFName(vfResourceStructure),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()));
-
- if (vnfResource != null) {
- status = true;
-
- }
-
- }
-
- // Check dup for VF Allotted Resource
- if(resourceType.equals("VF") && category.equalsIgnoreCase("Allotted Resource")){
- logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "AllottedResource",
- vfResourceStruct.getResourceInstance().getResourceInstanceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()), "", "");
-
- List<AllottedResourceCustomization> allottedResources = db.getAllAllottedResourcesByServiceModelUuid(vfResourceStruct.getNotification().getServiceUUID());
-
- if(allottedResources != null && allottedResources.size() > 0){
- for(AllottedResourceCustomization allottedResource : allottedResources){
-
- String existingAllottedResource = allottedResource.getModelCustomizationUuid();
- String notificationAllottedResource = vfResourceStruct.getResourceInstance().getResourceCustomizationUUID();
-
- if(existingAllottedResource.equals(notificationAllottedResource)){
- status=true;
- break;
- }
- }
-
- }
- }
-
- // Check Network for duplicates
- if(resourceType.equals("VL")){
- logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "NetworkResource",
- vfResourceStruct.getResourceInstance().getResourceInstanceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()), "", "");
-
- List<NetworkResourceCustomization> networkResources = db.getAllNetworksByServiceModelUuid(vfResourceStruct.getNotification().getServiceUUID());
-
- if(networkResources != null && networkResources.size() > 0){
- for(NetworkResourceCustomization networkResource : networkResources){
-
- String existingNetworkResource = networkResource.getModelCustomizationUuid();
- String notificationNetworkResource = vfResourceStruct.getResourceInstance().getResourceCustomizationUUID();
-
- if(existingNetworkResource.equals(notificationNetworkResource)){
- status=true;
- break;
- }
- }
-
- }
- }
-
- if (status) {
- logger.info(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
- vfResourceStructure.getResourceInstance().getResourceInstanceName(),
- vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
- vfResourceStructure.getNotification().getServiceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()),
- vfResourceStructure.getNotification().getServiceUUID(),
- vfResourceStructure.getResourceInstance().getResourceName(),"", "");
- } else {
- logger.info(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- vfResourceStructure.getResourceInstance().getResourceInstanceName(),
- vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
- vfResourceStructure.getNotification().getServiceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()),
- vfResourceStructure.getNotification().getServiceUUID(),
- vfResourceStructure.getResourceInstance().getResourceName(),"", "");
- }
-
- return status;
-
- } catch (Exception e) {
- logger.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, "", "", MsoLogger.ErrorCode.SchemaError, "Exception - isResourceAlreadyDeployed");
- throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
- }
- }
-
- @Override
- public void installTheResource(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
-
- // 1. Add the DB object list (Hashed) to be created from the HashMap
- // UUID
- // The DB objects will be stored in each VfModuleArtifact objects
- // Those objects could be reused by different VfModule
-
- VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
-
- for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) {
- case ASDCConfiguration.HEAT:
- case ASDCConfiguration.HEAT_VOL:
- case ASDCConfiguration.HEAT_NESTED:
- VfResourceInstaller.createHeatTemplateFromArtifact(vfResourceStructure, vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_ENV:
- VfResourceInstaller.createHeatEnvFromArtifact(vfResourceStructure, vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_ARTIFACT:
- VfResourceInstaller.createHeatFileFromArtifact(vfResourceStructure, vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_NET:
- case ASDCConfiguration.OTHER:
- logger.warn(MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT, vfModuleArtifact.getArtifactInfo().getArtifactType()+"(Artifact Name:"+vfModuleArtifact.getArtifactInfo().getArtifactName()+")", "", "", MsoLogger.ErrorCode.DataError, "Artifact type not supported");
- break;
- default:
- break;
-
- }
- }
-
- // in case of deployment failure, use a string that will represent the type of artifact that failed...
- List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
-
- CatalogDatabase catalogDB = CatalogDatabase.getInstance();
- // 2. Create the VFModules/VNFResource objects by linking them to the
- // objects created before and store them in Resource/module structure
- // Opening a DB transaction, starting from here
- try {
-
- VfResourceInstaller.createService(vfResourceStructure);
-
- String resourceType = vfResourceStructure.getResourceInstance().getResourceType();
- String resourceCategory = vfResourceStructure.getResourceInstance().getCategory();
-
- if("VF".equals(resourceType)){
-
- if(resourceCategory.equalsIgnoreCase("Allotted Resource")){
- VfResourceInstaller.createAllottedResourceCustomization(vfResourceStructure);
- catalogDB.saveAllottedResourceCustomization(vfResourceStructure.getCatalogResourceCustomization());
- } else {
- VfResourceInstaller.createVnfResource(vfResourceStructure);
- catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource());
- }
- }
-
- if("VL".equals(resourceType)){
- VfResourceInstaller.createNetworkResourceCustomization(vfResourceStructure);
- catalogDB.saveNetworkResourceCustomization(vfResourceStructure.getCatalogNetworkResourceCustomization());
- }
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure));
-
- //catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource());
- catalogDB.saveService(vfResourceStructure.getCatalogService());
-
- // Now that the service has been added we can populate the Service_to_AllottedResources table
- if("VF".equals(resourceType) && "Allotted Resource".equalsIgnoreCase(resourceCategory)){
- catalogDB.saveServiceToAllottedResources(vfResourceStructure.getCatalogServiceToAllottedResources());
- }
-
- // Now that the service has been added we can populate the Service_to_Network table
- if("VL".equals(resourceType)){
- catalogDB.saveServiceToNetworks(vfResourceStructure.getCatalogServiceToNetworks());
- }
-
- for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
-
- // Here we set the right db structure according to the Catalog
- // DB
-
- // We expect only one MAIN HEAT per VFMODULE
- // we can also obtain from it the Env ArtifactInfo, that's why
- // we
- // get the Main IArtifactInfo
-
- HeatTemplate heatMainTemplate = null;
- HeatEnvironment heatEnv = null;
-
- HeatTemplate heatVolumeTemplate = null;
- HeatEnvironment heatVolumeEnv = null;
-
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT)) {
- IArtifactInfo mainEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT)
- .get(0).getArtifactInfo().getGeneratedArtifact();
-
- // MAIN HEAT
- heatMainTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT).get(0).getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo
- .createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo()));
-
- catalogDB.saveHeatTemplate(heatMainTemplate, heatMainTemplate.getParameters());
- // Indicate we have deployed it in the DB
- vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).incrementDeployedInDB();
-
-
- // VOLUME HEAT
- // We expect only one VOL HEAT per VFMODULE
- // we can also obtain from it the Env ArtifactInfo, that's why
- // we get the Volume IArtifactInfo
-
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_VOL)) {
- IArtifactInfo volEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0)
- .getArtifactInfo().getGeneratedArtifact();
-
- heatVolumeTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_VOL).get(0).getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()));
-
- catalogDB.saveHeatTemplate(heatVolumeTemplate, heatVolumeTemplate.getParameters());
- // Indicate we have deployed it in the DB
- vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).incrementDeployedInDB();
-
- if (volEnvArtifactInfo != null) {
- heatVolumeEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
- .get(volEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(volEnvArtifactInfo));
-
- catalogDB.saveHeatEnvironment(heatVolumeEnv);
- // Indicate we have deployed it in the DB
- vfResourceStructure.getArtifactsMapByUUID().get(volEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
- }
-
- }
-
- // NESTED HEAT
- // Here we expect many HEAT_NESTED template to be there
- // check first if we really have nested heat templates
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_NESTED)) {
- for (VfModuleArtifact heatNestedArtifact : vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_NESTED)) {
-
- // Check if this nested is well referenced by the MAIN HEAT
- String parentArtifactType = VfResourceInstaller.identifyParentOfNestedTemplate(vfModuleStructure,heatNestedArtifact);
- HeatTemplate heatNestedTemplate = (HeatTemplate) heatNestedArtifact.getCatalogObject();
-
- if (parentArtifactType != null) {
-
- switch (parentArtifactType) {
- case ASDCConfiguration.HEAT:
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-
- catalogDB.saveNestedHeatTemplate (heatMainTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- break;
- case ASDCConfiguration.HEAT_VOL:
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
- catalogDB.saveNestedHeatTemplate (heatVolumeTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- break;
-
- default:
- break;
-
- }
- } else { // Assume it belongs to HEAT MAIN
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-
- catalogDB.saveNestedHeatTemplate (heatMainTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- }
- }
- }
-
- if (mainEnvArtifactInfo != null) {
- heatEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
- .get(mainEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(mainEnvArtifactInfo));
-
- catalogDB.saveHeatEnvironment(heatEnv);
- // Indicate we have deployed it in the DB
- vfResourceStructure.getArtifactsMapByUUID().get(mainEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
- }
-
- }
-
-
- // here we expect one VFModule to be there
-/* VfResourceInstaller.createVfModule(vfModuleStructure,heatMainTemplate, heatVolumeTemplate, heatEnv, heatVolumeEnv);
- VfModule vfModule = vfModuleStructure.getCatalogVfModule();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure));
-
- catalogDB.saveOrUpdateVfModule(vfModule);
-
- // Here we expect many HEAT_TEMPLATE files to be there
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_ARTIFACT)) {
- for (VfModuleArtifact heatArtifact : vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_ARTIFACT)) {
-
- HeatFiles heatFile = (HeatFiles) heatArtifact.getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatArtifact.getArtifactInfo()));
-
-
- catalogDB.saveVfModuleToHeatFiles (vfModule.getArtifactUuid(), heatFile);
- // Indicate we will deploy it in the DB
- heatArtifact.incrementDeployedInDB();
- }
- } */
-
- }
-
- catalogDB.commit();
- vfResourceStructure.setSuccessfulDeployment();
-
- } catch (Exception e) {
-
- Throwable dbExceptionToCapture = e;
- while (!(dbExceptionToCapture instanceof ConstraintViolationException || dbExceptionToCapture instanceof LockAcquisitionException)
- && (dbExceptionToCapture.getCause() != null)) {
- dbExceptionToCapture = dbExceptionToCapture.getCause();
- }
-
- if (dbExceptionToCapture instanceof ConstraintViolationException || dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED, vfResourceStructure.getResourceInstance().getResourceName(),
- vfResourceStructure.getNotification().getServiceVersion(), "", "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
- } else {
- String endEvent = "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.";
- String elementToLog = (artifactListForLogging.size() > 0 ? artifactListForLogging.get(artifactListForLogging.size()-1).toString() : "No element listed");
- logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback", e);
- catalogDB.rollback();
- throw new ArtifactInstallerException(
- "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
- }
-
- } finally {
- catalogDB.close();
- // Debug log the whole collection...
- logger.debug(artifactListForLogging.toString());
- }
-
- }
-
- private static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,VfModuleArtifact heatNestedArtifact) {
-
- if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null
- && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
- for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0)
- .getArtifactInfo().getRelatedArtifacts()) {
- if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
- return ASDCConfiguration.HEAT;
- }
-
- }
- }
-
- if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null
- && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
- for (IArtifactInfo unknownArtifact:vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts()) {
- if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
- return ASDCConfiguration.HEAT_VOL;
- }
-
- }
- }
-
- // Does not belong to anything
- return null;
-
- }
-
- private static void createVnfResource(VfResourceStructure vfResourceStructure) {
- VnfResource vnfResource = new VnfResource();
-
- vnfResource.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID());
- vnfResource.setDescription(vfResourceStructure.getNotification().getServiceDescription());
-
- vnfResource.setOrchestrationMode("HEAT");
- // Set the version but Version is stored into ASDC_SERVICE_MODEL_VERSION
- vnfResource.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfResourceStructure.getNotification().getServiceVersion()));
-// vnfResource.setVnfType(VfResourceInstaller.createVNFName(vfResourceStructure));
- vnfResource.setModelVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfResourceStructure.getResourceInstance().getResourceVersion()));
-
- vnfResource.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID());
- vnfResource.setModelVersion(vfResourceStructure.getResourceInstance().getResourceVersion());
-// vnfResource.setModelCustomizationName(vfResourceStructure.getResourceInstance().getResourceInstanceName());
-// vnfResource.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID());
- vnfResource.setModelName(vfResourceStructure.getResourceInstance().getResourceName());
-// vnfResource.setServiceModelInvariantUUID(vfResourceStructure.getNotification().getServiceInvariantUUID());
-
- //vnfResource.setCreated(getCurrentTimeStamp());
-
- vfResourceStructure.setCatalogVnfResource(vnfResource);
- }
-
- private static void createNetworkResourceCustomization(VfResourceStructure vfResourceStructure) {
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
-
- networkResourceCustomization.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID().trim());
-// networkResourceCustomization.setModelName(vfResourceStructure.getResourceInstance().getResourceName().trim());
- networkResourceCustomization.setModelInstanceName(vfResourceStructure.getResourceInstance().getResourceInstanceName().trim());
-// networkResourceCustomization.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID().trim());
-// networkResourceCustomization.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID().trim());
-// networkResourceCustomization.setModelVersion(vfResourceStructure.getResourceInstance().getResourceVersion().trim());
- //networkResourceCustomization.setCreated(getCurrentTimeStamp());
-
- vfResourceStructure.setCatalogNetworkResourceCustomization(networkResourceCustomization);
-
- ServiceToNetworks serviceNetworks = new ServiceToNetworks();
- serviceNetworks.setNetworkModelCustomizationUuid(networkResourceCustomization.getModelCustomizationUuid());
- serviceNetworks.setServiceModelUuid(vfResourceStructure.getNotification().getServiceUUID());
-
- vfResourceStructure.setCatalogServiceToNetworks(serviceNetworks);
-
- }
-
- private static void createAllottedResourceCustomization(VfResourceStructure vfResourceStructure) {
- AllottedResourceCustomization resourceCustomization = new AllottedResourceCustomization();
-
- resourceCustomization.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID().trim());
-// resourceCustomization.setModelName(vfResourceStructure.getResourceInstance().getResourceName().trim());
- resourceCustomization.setModelInstanceName(vfResourceStructure.getResourceInstance().getResourceInstanceName().trim());
-// resourceCustomization.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID().trim());
-// resourceCustomization.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID().trim());
- resourceCustomization.setVersion(vfResourceStructure.getResourceInstance().getResourceVersion().trim());
- //resourceCustomization.setCreated(getCurrentTimeStamp());
-
- vfResourceStructure.setCatalogResourceCustomization(resourceCustomization);
-
- ServiceToAllottedResources serviceAllottedResources = new ServiceToAllottedResources();
- serviceAllottedResources.setArModelCustomizationUuid(resourceCustomization.getModelCustomizationUuid());
- serviceAllottedResources.setServiceModelUuid(vfResourceStructure.getNotification().getServiceUUID());
-
- vfResourceStructure.setCatalogServiceToAllottedResources(serviceAllottedResources);
-
- }
-
- private static void createVfModule(VfModuleStructure vfModuleStructure,HeatTemplate heatMain, HeatTemplate heatVolume,HeatEnvironment heatEnv, HeatEnvironment heatVolumeEnv) {
- VfModule vfModule = new VfModule();
-// vfModule.setType(createVfModuleName(vfModuleStructure));
-// vfModule.setAsdcUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelUUID());
- vfModule.setDescription(vfModuleStructure.getVfModuleMetadata().getVfModuleModelDescription());
-
- if (vfModuleStructure.getVfModuleMetadata().isBase()) {
- vfModule.setIsBase(1);
- } else {
- vfModule.setIsBase(0);
- }
-
-// vfModule.setModelCustomizationUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelCustomizationUUID());
- vfModule.setModelInvariantUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelInvariantUUID());
- vfModule.setModelName(vfModuleStructure.getVfModuleMetadata().getVfModuleModelName());
-
- vfModule.setVersion(BigDecimalVersion.castAndCheckNotificationVersionToString(vfModuleStructure.getParentVfResource().getNotification().getServiceVersion()));
- vfModule.setModelVersion(BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfModuleStructure.getVfModuleMetadata().getVfModuleModelVersion()));
-
- Map<String,String> map = vfModuleStructure.getVfModuleMetadata().getProperties();
-
- if(map != null){
-
- if(map.get("vf_module_label") != null){
-// vfModule.setLabel(map.get("vf_module_label"));
- }
- if(map.get("initial_count") != null && map.get("initial_count").length() > 0){
-// vfModule.setInitialCount(Integer.parseInt(map.get("initial_count")));
- }
- if(map.get("min_vf_module_instances") != null && map.get("min_vf_module_instances").length() > 0){
-// vfModule.setMinInstances(Integer.parseInt(map.get("min_vf_module_instances")));
- }
- if(map.get("max_vf_module_instances") != null && map.get("max_vf_module_instances").length() > 0){
-// vfModule.setMaxInstances(Integer.parseInt(map.get("max_vf_module_instances")));
- }
-
- }
-
- vfModuleStructure.setCatalogVfModule(vfModule);
-
- VfResourceInstaller.createVfModuleLinks(vfModule, vfModuleStructure.getParentVfResource().getCatalogVnfResource(), heatMain,heatVolume, heatEnv,heatVolumeEnv);
- }
-
- private static void createVfModuleLinks(VfModule vfModule, VnfResource vnfResource, HeatTemplate heatMain,
- HeatTemplate heatVolume, HeatEnvironment heatEnv, HeatEnvironment heatVolumeEnv) {
-
- if (heatMain !=null) {
-// vfModule.setTemplateId(heatMain.getId());
- }
- if (heatEnv != null) {
-// vfModule.setEnvironmentId(heatEnv.getId());
- }
- if (heatVolume != null) {
-// vfModule.setVolTemplateId(heatVolume.getId());
- }
- if (heatVolumeEnv != null) {
-// vfModule.setVolEnvironmentId(heatVolumeEnv.getId());
- }
-
-// vfModule.setVnfResourceId(vnfResource.getId());
-
- }
-
-
- private static Set<HeatTemplateParam> extractHeatTemplateParameters(String yamlFile, String artifactUUID) {
-
- // Scan the payload downloadResult and extract the HeatTemplate
- // parameters
- YamlEditor yamlEditor = new YamlEditor(yamlFile.getBytes());
- return yamlEditor.getParameterList(artifactUUID);
-
- }
-
-
- public static String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure, List<String> listTypes) {
- String newFileBody = filebody;
- for (VfModuleArtifact moduleArtifact:vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) {
-
- newFileBody = verifyTheFilePrefixInString(newFileBody,moduleArtifact.getArtifactInfo().getArtifactName());
- }
- }
- return newFileBody;
- }
-
- public static String verifyTheFilePrefixInString(final String body, final String filenameToVerify) {
-
- String needlePrefix = "file:///";
- String prefixedFilenameToVerify = needlePrefix+filenameToVerify;
-
- if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) {
- return body;
- }
-
- StringBuilder sb = new StringBuilder(body.length());
-
- int currentIndex = 0;
- int startIndex = 0;
-
- while (currentIndex != -1) {
- startIndex = currentIndex;
- currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex);
-
- if (currentIndex == -1) {
- break;
- }
-
- // We append from the startIndex up to currentIndex (start of File Name)
- sb.append(body.substring(startIndex, currentIndex));
- sb.append(filenameToVerify);
-
- currentIndex += prefixedFilenameToVerify.length();
- }
-
- sb.append(body.substring(startIndex));
-
- return sb.toString();
- }
-
- private static void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact) {
- HeatTemplate heatTemplate = new HeatTemplate();
-
- // TODO Set the label
-// heatTemplate.setAsdcLabel("label");
- // Use the ResourceName of the ASDC template because the HEAT could be
- // reused
-// heatTemplate.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
- heatTemplate.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- List<String> typeList = new ArrayList<>();
- typeList.add(ASDCConfiguration.HEAT_NESTED);
- typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
-
- heatTemplate.setTemplateBody(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList));
- heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName());
-
- if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
- heatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
- } else {
- heatTemplate.setTimeoutMinutes(240);
- }
-
- heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatTemplate.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
- heatTemplate.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
- heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatTemplate.setArtifactChecksum("MANUAL_RECORD");
- }
-
- Set<HeatTemplateParam> heatParam = VfResourceInstaller
- .extractHeatTemplateParameters(vfModuleArtifact.getResult(), vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatTemplate.setParameters(heatParam);
- //heatTemplate.setCreated(getCurrentTimeStamp());
-
- vfModuleArtifact.setCatalogObject(heatTemplate);
- }
-
- private static void createHeatEnvFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact) {
- HeatEnvironment heatEnvironment = new HeatEnvironment();
-
- heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName());
- // TODO Set the label
-// heatEnvironment.setAsdcLabel("Label");
-
- List<String> typeList = new ArrayList<>();
- typeList.add(ASDCConfiguration.HEAT);
- typeList.add(ASDCConfiguration.HEAT_VOL);
-
- heatEnvironment.setEnvironment(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList));
-// heatEnvironment.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatEnvironment.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
-// heatEnvironment.setAsdcResourceName(VfResourceInstaller.createVNFName(vfResourceStructure));
- heatEnvironment.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
- heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else{
- heatEnvironment.setArtifactChecksum("MANUAL_RECORD");
- }
- //heatEnvironment.setCreated(getCurrentTimeStamp());
-
- vfModuleArtifact.setCatalogObject(heatEnvironment);
-
- }
-
- private static void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact) {
-
- HeatFiles heatFile = new HeatFiles();
- // TODO Set the label
-// heatFile.setAsdcLabel("Label");
- heatFile.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatFile.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatFile.setFileBody(vfModuleArtifact.getResult());
- heatFile.setFileName(vfModuleArtifact.getArtifactInfo().getArtifactName());
- heatFile.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
- //heatFile.setCreated(getCurrentTimeStamp());
-
-// heatFile.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName());
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){
- heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatFile.setArtifactChecksum("MANUAL_RECORD");
- }
-
- vfModuleArtifact.setCatalogObject(heatFile);
-
- }
-
- private static void createService(VfResourceStructure vfResourceStructure) {
-
- Service service = new Service();
- service.setDescription(vfResourceStructure.getNotification().getServiceDescription());
- service.setModelName(vfResourceStructure.getNotification().getServiceName());
- service.setModelUUID(vfResourceStructure.getNotification().getServiceUUID());
- service.setVersion(vfResourceStructure.getNotification().getServiceVersion());
- service.setModelInvariantUUID(vfResourceStructure.getNotification().getServiceInvariantUUID());
- //service.setCreated(getCurrentTimeStamp());
-
- vfResourceStructure.setCatalogService(service);
- }
-
-
- private static String createVNFName(VfResourceStructure vfResourceStructure) {
-
- return vfResourceStructure.getNotification().getServiceName() + "/" + vfResourceStructure.getResourceInstance().getResourceInstanceName();
- }
-
- private static String createVfModuleName(VfModuleStructure vfModuleStructure) {
-
- return createVNFName(vfModuleStructure.getParentVfResource())+"::"+vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
- }
-
-
- private static Timestamp getCurrentTimeStamp() {
-
- return new Timestamp(new Date().getTime());
- }
-
-
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AsdcPropertiesUtils.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AsdcPropertiesUtils.java
deleted file mode 100644
index 462ef0d..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AsdcPropertiesUtils.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.asdc.tenantIsolation;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class AsdcPropertiesUtils {
-
- public final static String MSO_ASDC_CLIENTS = "MSO_ASDC_CLIENTS";
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory ();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
- private static boolean noProperties = true;
-
- public synchronized static MsoJavaProperties loadMsoProperties () {
- MsoJavaProperties msoProperties;
- try {
- msoProperties = msoPropertiesFactory.getMsoJavaProperties (MSO_ASDC_CLIENTS);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.ASDC_PROPERTIES_NOT_FOUND, MSO_ASDC_CLIENTS, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO ASDC Clients Properties", e);
- return null;
- }
-
- if (msoProperties != null && msoProperties.size () > 0) {
- noProperties = false;
- msoLogger.info (MessageEnum.ASDC_PROPERTIES_LOAD_SUCCESS, "", "");
- return msoProperties;
- } else {
- msoLogger.error (MessageEnum.ASDC_PROPERTIES_NOT_FOUND, MSO_ASDC_CLIENTS, "", "", MsoLogger.ErrorCode.DataError, "No MSO ASDC Clients Properties found");
- return null;
- }
- }
-
- public synchronized static final boolean getNoPropertiesState() {
- return noProperties;
- }
-}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/WatchdogDistribution.java
deleted file mode 100644
index 6efcd64..0000000
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/WatchdogDistribution.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.tenantIsolation;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIResourcesClient;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.aai.entities.uri.Depth;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJsonProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatus;
-import org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatusDb;
-import org.openecomp.mso.requestsdb.WatchdogDistributionStatusDb;
-import org.openecomp.mso.requestsdb.WatchdogServiceModVerIdLookupDb;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class WatchdogDistribution {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
- private static final String MSO_PROP_ASDC = "MSO_PROP_ASDC";
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- private WatchdogDistributionStatusDb watchdogDistDb;
- private WatchdogComponentDistributionStatusDb watchdogCompDistDb;
- private WatchdogServiceModVerIdLookupDb watchdogSerlookupDb;
- private CatalogDatabase catalogDb;
- private AAIResourcesClient aaiClient;
- //protected ASDCConfiguration asdcConfig;
-
- public String getOverallDistributionStatus(String distributionId) throws MsoPropertiesException, Exception {
- LOGGER.debug("Entered getOverallDistributionStatus method for distrubutionId: " + distributionId);
-
- String status = null;
- try {
- String distributionStatus = getWatchdogDistDb().getWatchdogDistributionIdStatus(distributionId);
-
- if(DistributionStatus.TIMEOUT.name().equalsIgnoreCase(distributionStatus)) {
- LOGGER.debug("Ignoring to update WatchdogDistributionStatus as distributionId: " + distributionId + " status is set to: " + distributionStatus);
- return DistributionStatus.TIMEOUT.name();
- } else {
- List<WatchdogComponentDistributionStatus> results = getWatchdogCompDistDb().getWatchdogComponentDistributionStatus(distributionId);
- LOGGER.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: " + distributionId);
-
- MsoJsonProperties properties = msoPropertiesFactory.getMsoJsonProperties(MSO_PROP_ASDC);
-
- //*************************************************************************************************************************************************
- //**** Compare config values verse DB watchdog component names to see if every component has reported status before returning final result back to ASDC
- //**************************************************************************************************************************************************
-
- //List<String> configNames = asdcConfig.getComponentNames();
-
- List<String> dbNames = watchdogCompDistDb.getWatchdogComponentNames(distributionId);
-
- boolean allComponentsComplete = true;
-
- JsonNode masterConfigNode = properties.getJsonRootNode().get("componentNames");
-
- if (masterConfigNode != null) {
-
- Iterator<JsonNode> config = masterConfigNode.elements();
-
- while( config.hasNext() ) {
- String name = (String)config.next().asText();
-
- boolean match = false;
-
- for(String dbName: dbNames){
-
- if(name.equals(dbName)){
- LOGGER.debug("Found componentName " + name + " in the WatchDog Component DB");
- match = true;
- break;
- }
- }
-
- if(match==false){
- LOGGER.debug(name + " has not be updated in the the WatchDog Component DB yet, so ending the loop");
- allComponentsComplete = false;
- break;
- }
-
- }
-
- }
-
- if(allComponentsComplete) {
- //if(node.asInt() == results.size()) {
- LOGGER.debug("Components Size matched with the WatchdogComponentDistributionStatus results.");
-
- for(WatchdogComponentDistributionStatus componentDist : results) {
- String componentDistributionStatus = componentDist.getComponentDistributionStatus();
- LOGGER.debug("Component status: " + componentDistributionStatus + " on componentName: " + componentDist.getComponentName());
- if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_ERROR")) {
- status = DistributionStatus.FAILURE.name();
- break;
- } else if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_OK")) {
- status = DistributionStatus.SUCCESS.name();
- } else {
- throw new Exception("Invalid Component distribution status: " + componentDistributionStatus);
- }
- }
-
- LOGGER.debug("Updating overall DistributionStatus to: " + status + " for distributionId: " + distributionId);
- getWatchdogDistDb().updateWatchdogDistributionIdStatus(distributionId, status);
- } else {
- LOGGER.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
- status = DistributionStatus.INCOMPLETE.name();
- return status;
- }
- }
- } catch (MsoPropertiesException e) {
- String error = "Error occurred when trying to load MSOJson Properties.";
- LOGGER.debug(error);
- throw new MsoPropertiesException(e.getMessage());
- } catch (Exception e) {
- LOGGER.debug("Exception occurred on getOverallDistributionStatus : " + e.getMessage());
- throw new Exception(e);
- }
-
- LOGGER.debug("Exciting getOverallDistributionStatus method in WatchdogDistribution");
- return status;
- }
-
- public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception {
- LOGGER.debug("Entered executePatchAAI method with distrubutionId: " + distributionId + " and distributionStatus: " + distributionStatus);
-
- try {
- String serviceModelVersionId = getWatchdogSerlookupDb().getWatchdogServiceModVerId(distributionId);
- LOGGER.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: " + distributionId + " and serviceModelVersionId: " + serviceModelVersionId);
-
- LOGGER.debug("ASDC Notification ServiceModelInvariantUUID : " + serviceModelInvariantUUID);
-
- if(serviceModelInvariantUUID == null) {
- String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID;
- LOGGER.debug(error);
- throw new Exception(error);
- }
-
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID, serviceModelVersionId);
- aaiUri.depth(Depth.ZERO); //Do not return relationships if any
- LOGGER.debug("Target A&AI Resource URI: " + aaiUri.build().toString());
-
- Map<String, String> payload = new HashMap<>();
- payload.put("distribution-status", distributionStatus);
- getAaiClient().update(aaiUri, payload);
-
- LOGGER.debug("A&AI UPDATE MODEL Version is success!");
- } catch (Exception e) {
- LOGGER.debug("Exception occurred on executePatchAAI : " + e.getMessage());
- throw new Exception(e);
- }
- }
-
- public WatchdogDistributionStatusDb getWatchdogDistDb() {
- if(watchdogDistDb == null) {
- watchdogDistDb = WatchdogDistributionStatusDb.getInstance();
- }
- return watchdogDistDb;
- }
-
- public void setWatchdogDistDb(WatchdogDistributionStatusDb watchdogDistDb) {
- this.watchdogDistDb = watchdogDistDb;
- }
-
- public WatchdogComponentDistributionStatusDb getWatchdogCompDistDb() {
- if(watchdogCompDistDb == null) {
- watchdogCompDistDb = WatchdogComponentDistributionStatusDb.getInstance();
- }
- return watchdogCompDistDb;
- }
-
- public void setWatchdogCompDistDb(WatchdogComponentDistributionStatusDb watchdogCompDistDb) {
- this.watchdogCompDistDb = watchdogCompDistDb;
- }
-
- public WatchdogServiceModVerIdLookupDb getWatchdogSerlookupDb() {
- if(watchdogSerlookupDb == null) {
- watchdogSerlookupDb = WatchdogServiceModVerIdLookupDb.getInstance();
- }
- return watchdogSerlookupDb;
- }
-
- public void setWatchdogSerlookupDb(WatchdogServiceModVerIdLookupDb watchdogSerlookupDb) {
- this.watchdogSerlookupDb = watchdogSerlookupDb;
- }
-
- public CatalogDatabase getCatalogDb() {
- if(catalogDb == null) {
- catalogDb = CatalogDatabase.getInstance();
- }
- return catalogDb;
- }
-
- public void setCatalogDb(CatalogDatabase catalogDb) {
- this.catalogDb = catalogDb;
- }
-
- public AAIResourcesClient getAaiClient() {
- if(aaiClient == null) {
- aaiClient = new AAIResourcesClient();
- }
- return aaiClient;
- }
-
- public void setAaiClient(AAIResourcesClient aaiClient) {
- this.aaiClient = aaiClient;
- }
-
-}
diff --git a/asdc-controller/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/asdc-controller/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
new file mode 100644
index 0000000..a17b39d
--- /dev/null
+++ b/asdc-controller/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
@@ -0,0 +1 @@
+org.onap.so.asdc.tenantIsolation.AaiClientPropertiesImpl
\ No newline at end of file
diff --git a/asdc-controller/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties b/asdc-controller/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties
deleted file mode 100644
index 3745ddd..0000000
--- a/asdc-controller/src/main/resources/META-INF/services/org.openecomp.mso.client.RestProperties
+++ /dev/null
@@ -1 +0,0 @@
-org.openecomp.mso.asdc.tenantIsolation.AaiClientPropertiesImpl
\ No newline at end of file
diff --git a/asdc-controller/src/main/resources/application-local.yaml b/asdc-controller/src/main/resources/application-local.yaml
new file mode 100644
index 0000000..28900f4
--- /dev/null
+++ b/asdc-controller/src/main/resources/application-local.yaml
@@ -0,0 +1,83 @@
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+
+server-port: 8080
+ssl-enable: false
+
+
+
+# H2
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3306/catalogdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+
+ jpa:
+ show-sql: true
+ hibernate:
+ ddl-auto: validate
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+ security:
+ usercredentials:
+ -
+ username: asdc
+ password: '$2a$12$4R2QhxH7elzoZYoC.HJKTOHYDoaC9LbJD44Q9/tm4t/UzPF9Cgifi'
+ role: Asdc-Client
+ -
+ username: mso_admin
+ password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
+ role: ACTUATOR
+request:
+ datasource:
+ url: jdbc:mariadb://localhost:3306/requestdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ initialization-mode: never
+
+#Actuator
+management:
+ context-path: /manage
+
+
+mso:
+ logPath: logs
+ catalog:
+ db:
+ spring:
+ endpoint: "http://localhost:8090"
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ site-name: siteName
+ aai:
+ endpoint: https://localhost:8443
+ asdc-connections:
+ asdc-controller1:
+ user: msopreist
+ consumerGroup: msoasdc-id-local
+ consumerId: msoasdc-id-local
+ environmentName: Pre-IST
+ asdcAddress: localhost:8443
+ password: 658D6E9E0C087547284339181615C358
+ pollingInterval: 30
+ pollingTimeout: 30
+ relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
+ activateServerTLSAuth: false
+ keyStorePassword:
+ keyStorePath:
+ watchDogTimeout: 1
+ isFitlerInEmptyResources: true
+ messageBusAddress: localhost,localhost,localhost
+ asdc:
+ config:
+ key: 566B754875657232314F5548556D3665
+ components:
+ count: 3,
+ componentNames: SO,AAI,SDNC
+ scheduling:
+ enabled: false
diff --git a/asdc-controller/src/main/resources/application.yaml b/asdc-controller/src/main/resources/application.yaml
new file mode 100644
index 0000000..ced8ab7
--- /dev/null
+++ b/asdc-controller/src/main/resources/application.yaml
@@ -0,0 +1,45 @@
+
+server:
+ port: 8080
+
+spring:
+ datasource:
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ dbcp2:
+ initial-size: 5
+ max-total: 20
+ validation-query: select 1
+ test-on-borrow: true
+ jpa:
+ show-sql: true
+ hibernate:
+ dialect: org.hibernate.dialect.MySQL5Dialect
+ ddl-auto: validate
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+
+request:
+ datasource:
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ dbcp2:
+ initial-size: 5
+ max-total: 20
+ validation-query: select 1
+ test-on-borrow: true
+
+#Actuator
+management:
+ context-path: /manage
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
+
diff --git a/asdc-controller/src/main/resources/config-key.properties b/asdc-controller/src/main/resources/config-key.properties
deleted file mode 100644
index 66b3227..0000000
--- a/asdc-controller/src/main/resources/config-key.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ECOMP MSO
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-###
-
-asdc.config.key=566B754875657232314F5548556D3665
-password.attribute.name=password
-key.store.password=keyStorePassword
diff --git a/asdc-controller/src/main/resources/resource-examples/notif-structure.json b/asdc-controller/src/main/resources/resource-examples/notif-structure.json
index 16c46a5..35f9278 100644
--- a/asdc-controller/src/main/resources/resource-examples/notif-structure.json
+++ b/asdc-controller/src/main/resources/resource-examples/notif-structure.json
@@ -22,7 +22,7 @@
{
"resourceInstanceName": "resource-1",
"resourceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f134",
- "resourceCustomizationUUID": "6402d92d-0050-46a9-8202-623a46680ba7",
+ "resourceCustomizationUUID": "6402d92d-0050-46a9-8202-623a46680ba7",
"resourceName": "resourceName-1",
"resourceType": "VF",
"resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136",
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java
new file mode 100644
index 0000000..354b6da
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/ASDCPojoTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc;
+
+import org.junit.Test;
+import org.onap.so.asdc.client.FinalDistributionStatusMessage;
+import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
+import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
+import org.onap.so.asdc.client.test.emulators.JsonStatusData;
+import org.onap.so.asdc.client.test.emulators.JsonVfModuleMetaData;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.asdc.client.test.emulators.ResourceInfoImpl;
+import org.onap.so.asdc.installer.VfResourceStructure;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.impl.PojoClassFactory;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+public class ASDCPojoTest {
+ @Test
+ public void pojoStructure() {
+ test(PojoClassFactory.getPojoClass(FinalDistributionStatusMessage.class));
+ test(PojoClassFactory.getPojoClass(ArtifactInfoImpl.class));
+ test(PojoClassFactory.getPojoClass(NotificationDataImpl.class));
+ test(PojoClassFactory.getPojoClass(JsonVfModuleMetaData.class));
+ test(PojoClassFactory.getPojoClass(ResourceInfoImpl.class));
+ test(PojoClassFactory.getPojoClass(DistributionClientEmulator.class));
+ test(PojoClassFactory.getPojoClass(JsonStatusData.class));
+ test(PojoClassFactory.getPojoClass(VfResourceStructure.class));
+ }
+
+ private void test(PojoClass pojoClass) {
+ Validator validator = ValidatorBuilder.create()
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .build();
+ validator.validate(pojoClass);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java
new file mode 100644
index 0000000..9a7240c
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc;
+
+import static org.mockito.Mockito.reset;
+
+import org.junit.After;
+import org.junit.runner.RunWith;
+import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
+import org.onap.so.asdc.tenantIsolation.SpringContextHelper;
+import org.onap.so.asdc.tenantIsolation.WatchdogDistribution;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@ContextConfiguration(classes = SpringContextHelper.class, initializers = ConfigFileApplicationContextInitializer.class)
+@AutoConfigureWireMock(port = 0)
+public abstract class BaseTest {
+ @MockBean
+ protected VfResourceStructure vfResourceStructure;
+ @MockBean
+ protected ToscaResourceStructure toscaResourceStruct;
+ @SpyBean
+ protected WatchdogDistribution watchdogDistributionSpy;
+ @SpyBean
+ protected ToscaResourceInstaller toscaInstaller;
+
+ @Value("${wiremock.server.port}")
+ protected String wireMockPort;
+
+ @After
+ public void after() {
+ reset(vfResourceStructure);
+ reset(toscaResourceStruct);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
new file mode 100644
index 0000000..f7e6787
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test"})
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"}
+ )
+public class EmbeddedCatalogDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ return new MariaDB4jSpringService();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ //Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder
+ .create()
+ .username(datasourceUsername)
+ .password(datasourcePassword)
+ .url(config.getURL(databaseName))
+ .driverClassName(datasourceDriver)
+ .build();
+ }
+
+
+ @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/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
new file mode 100644
index 0000000..6d1bfcd
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.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.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test"})
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
+ basePackages = { "org.onap.so.db.request.data.repository" }
+ )
+public class EmbeddedRequestDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ return new MariaDB4jSpringService();
+ }
+
+
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "request.datasource")
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName2}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ //Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder
+ .create()
+ .username(datasourceUsername)
+ .password(datasourcePassword)
+ .url(config.getURL(databaseName))
+ .driverClassName(datasourceDriver)
+ .build();
+ }
+
+
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean
+ entityManagerFactory(
+ EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource
+ ) {
+ return builder
+ .dataSource(dataSource)
+ .packages("org.onap.so.db.request.beans")
+ .persistenceUnit("requestDB")
+ .build();
+ }
+
+
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory
+ entityManagerFactory
+ ) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java
new file mode 100644
index 0000000..4298f9c
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.asdc;
+
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Profile;
+
+@SpringBootApplication
+@Profile("test")
+@ComponentScan(basePackages = {"org.onap.so.asdc"}, excludeFilters = {
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
+ @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
+ @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+public class TestApplication {
+ public static void main(String... args) {
+ SpringApplication.run(TestApplication.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("server.name", "Springboot");
+ System.getProperties().setProperty("mso.config.path", "src/test/resources/");
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
new file mode 100644
index 0000000..ce8b664
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.asdc.client;
+
+
+
+import static org.junit.Assert.assertTrue;
+
+import javax.transaction.Transactional;
+
+import org.junit.Test;
+import org.onap.so.asdc.BaseTest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * THis class tests the ASDC Controller by using the ASDC Mock CLient
+ *
+ *
+ */
+public class ASDCConfigurationTest extends BaseTest {
+
+ @Autowired
+ private ASDCConfiguration config;
+
+ @Test
+ @Transactional
+ public void testInitASDCConfiguration() throws Exception {
+ assertTrue("msopreist".equals(config.getUser()));
+ assertTrue("msoasdc-id-local".equals(config.getConsumerGroup()));
+ assertTrue("msoasdc-id-local".equals(config.getConsumerID()));
+ assertTrue("Pre-IST".equals(config.getEnvironmentName()));
+ assertTrue("localhost:8443".equals(config.getAsdcAddress()));
+ assertTrue("msopreist".equals(config.getPassword()));
+ assertTrue(config.getPollingInterval() == 30);
+ assertTrue(config.getPollingTimeout() == 30);
+ assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+ assertTrue(config.getWatchDogTimeout() == 1);
+ }
+
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java
new file mode 100644
index 0000000..580220a
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerTest.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ASDCControllerTest extends BaseTest {
+ @Autowired
+ private ASDCController asdcController;
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void initASDCExceptionTest() throws Exception {
+ expectedException.expect(ASDCControllerException.class);
+
+ asdcController.changeControllerStatus(ASDCControllerStatus.IDLE);
+
+ try {
+ asdcController.initASDC();
+ } finally {
+ asdcController.closeASDC();
+ }
+ }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCElementInfoTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java
similarity index 94%
rename from asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCElementInfoTest.java
rename to asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java
index 6bb938c..fec3ae6 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCElementInfoTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCElementInfoTest.java
@@ -1,174 +1,174 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client;
-
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.UUID;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.notification.IVfModuleMetadata;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.installer.ASDCElementInfo;
-import org.openecomp.mso.asdc.installer.VfModuleStructure;
-import org.openecomp.mso.asdc.installer.VfResourceStructure;
-import org.openecomp.mso.asdc.installer.IVfModuleData;
-
-public class ASDCElementInfoTest {
-
- @Test
- public void createASDCElementInfoWithNullParameterTest() {
- ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
- ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
- ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
-
- elementInfoFromNullVfArtifact.addElementInfo(null, null);
- elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
- elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
-
- assertEquals(elementInfoFromNullVfArtifact.toString(), "");
- assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
- assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
-
- assertNotNull(elementInfoFromNullVfArtifact);
- assertNotNull(elementInfoFromNullVfModuleStructure);
- assertNotNull(elementInfoFromNullVfResourceStructure);
-
- assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
-
- assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
- assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
-
- assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
- assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
-
- assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
- }
-
- @Test
- public void createASDCElementInfoFromVfResourceTest() {
-
- String resourceInstanceName = "Resource 1";
-
- UUID generatedUUID = UUID.randomUUID();
-
- INotificationData notificationData = Mockito.mock(INotificationData.class);
- IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
-
- Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
- Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
-
- VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
-
- ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
-
- assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
- assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
-
- assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
- assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
-
- assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
- elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
- assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
- }
-
- @Test
- public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
-
- String resourceInstanceName = "Resource 1";
-
- UUID generatedUUID = UUID.randomUUID();
-
- INotificationData notificationData = Mockito.mock(INotificationData.class);
- IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
-
- Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
- Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
-
- VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
-
- // Create module structure now
-
- String vfModuleModelName = "Module Model XYZ";
-
- UUID generatedUUIDForModule = UUID.randomUUID();
-
- IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
- Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
- Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
- Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String> emptyList());
-
- VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
-
- ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
-
- assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
- assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
-
- assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
- assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
-
- assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
- elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
- assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
- }
-
- @Test
- public void createASDCElementInfoFromArtifact() {
- for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
- String generatedArtifactName = eVal + " 1";
- UUID generatedUUIDForArtifact = UUID.randomUUID();
-
- IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
- Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
- Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
-
- ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
-
- assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
- assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
-
- assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
- assertEquals(eVal, elementInfoFromArtifact.getType());
-
- assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
- elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
- assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
- }
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.asdc.client;
+
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.notification.IVfModuleMetadata;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.installer.ASDCElementInfo;
+import org.onap.so.asdc.installer.VfModuleStructure;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.asdc.installer.IVfModuleData;
+
+public class ASDCElementInfoTest {
+
+ @Test
+ public void createASDCElementInfoWithNullParameterTest() {
+ ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null);
+ ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null);
+ ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null);
+
+ elementInfoFromNullVfArtifact.addElementInfo(null, null);
+ elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue");
+ elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null);
+
+ assertEquals(elementInfoFromNullVfArtifact.toString(), "");
+ assertEquals(elementInfoFromNullVfModuleStructure.toString(), "");
+ assertEquals(elementInfoFromNullVfResourceStructure.toString(), "");
+
+ assertNotNull(elementInfoFromNullVfArtifact);
+ assertNotNull(elementInfoFromNullVfModuleStructure);
+ assertNotNull(elementInfoFromNullVfResourceStructure);
+
+ assertNotNull(ASDCElementInfo.EMPTY_INSTANCE);
+
+ assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE);
+ assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE);
+
+ assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), "");
+ assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), "");
+
+ assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType());
+ }
+
+ @Test
+ public void createASDCElementInfoFromVfResourceTest() {
+
+ String resourceInstanceName = "Resource 1";
+
+ UUID generatedUUID = UUID.randomUUID();
+
+ INotificationData notificationData = Mockito.mock(INotificationData.class);
+ IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
+
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
+ Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
+
+ VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
+
+ ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure);
+
+ assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName));
+ assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString()));
+
+ assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType()));
+ assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType());
+
+ assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
+ elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue");
+ assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue"));
+ }
+
+ @Test
+ public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException {
+
+ String resourceInstanceName = "Resource 1";
+
+ UUID generatedUUID = UUID.randomUUID();
+
+ INotificationData notificationData = Mockito.mock(INotificationData.class);
+ IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class);
+
+ Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName);
+ Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString());
+
+ VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance);
+
+ // Create module structure now
+
+ String vfModuleModelName = "Module Model XYZ";
+
+ UUID generatedUUIDForModule = UUID.randomUUID();
+
+ IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class);
+ Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName);
+ Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString());
+ Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections.<String> emptyList());
+
+ VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata);
+
+ ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure);
+
+ assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName));
+ assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString()));
+
+ assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType()));
+ assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType());
+
+ assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
+ elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue");
+ assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue"));
+ }
+
+ @Test
+ public void createASDCElementInfoFromArtifact() {
+ for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) {
+ String generatedArtifactName = eVal + " 1";
+ UUID generatedUUIDForArtifact = UUID.randomUUID();
+
+ IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class);
+ Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal);
+ Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName);
+ Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString());
+
+ ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo);
+
+ assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName));
+ assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString()));
+
+ assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType()));
+ assertEquals(eVal, elementInfoFromArtifact.getType());
+
+ assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
+ elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue");
+ assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue"));
+ }
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
new file mode 100644
index 0000000..97fa773
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client;
+
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.MockitoAnnotations;
+import org.onap.sdc.api.notification.IStatusData;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.client.test.emulators.JsonStatusData;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ASDCStatusCallBackTest extends BaseTest {
+ @Autowired
+ private ASDCStatusCallBack statusCallback;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void activateCallbackTest() throws Exception {
+ JsonStatusData statusData = new JsonStatusData();
+
+ doNothing().when(toscaInstaller).installTheComponentStatus(isA(JsonStatusData.class));
+
+ statusCallback.activateCallback(statusData);
+
+ verify(toscaInstaller, times(1)).installTheComponentStatus(statusData);
+ }
+
+ @Test
+ public void activateCallbackDoneErrorStatusTest() throws Exception {
+ IStatusData statusData = mock(IStatusData.class);
+
+ doReturn("distributionId").when(statusData).getDistributionID();
+ doReturn("componentName").when(statusData).getComponentName();
+ doReturn(DistributionStatusEnum.COMPONENT_DONE_ERROR).when(statusData).getStatus();
+ doNothing().when(toscaInstaller).installTheComponentStatus(isA(IStatusData.class));
+
+ statusCallback.activateCallback(statusData);
+
+ verify(toscaInstaller, times(1)).installTheComponentStatus(statusData);
+ }
+
+ @Test
+ public void activateCallbackExceptionTest() throws Exception {
+ IStatusData statusData = mock(IStatusData.class);
+
+ doReturn("distributionId").when(statusData).getDistributionID();
+ doReturn("componentName").when(statusData).getComponentName();
+ doReturn(DistributionStatusEnum.COMPONENT_DONE_OK).when(statusData).getStatus();
+ doThrow(ArtifactInstallerException.class).when(toscaInstaller).installTheComponentStatus(isA(IStatusData.class));
+
+ statusCallback.activateCallback(statusData);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/BigDecimalVersionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java
similarity index 95%
rename from asdc-controller/src/test/java/org/openecomp/mso/asdc/client/BigDecimalVersionTest.java
rename to asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java
index b395cee..4eb9ed5 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/BigDecimalVersionTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/BigDecimalVersionTest.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client;
+package org.onap.so.asdc.client;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import org.junit.Test;
-import org.openecomp.mso.asdc.installer.BigDecimalVersion;
+import org.onap.so.asdc.installer.BigDecimalVersion;
public class BigDecimalVersionTest {
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java
new file mode 100644
index 0000000..0c6476d
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/DistributionStatusMessageTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+public class DistributionStatusMessageTest {
+
+ @Test
+ public void distributionStatusMessageTest() {
+ String artifactUrl = "artifactUrl";
+ String consumerId = "consumerId";
+ String distributionId = "distributionId";
+ Long timestamp = 123L;
+ DistributionStatusMessage distributionStatusMessage = new DistributionStatusMessage(
+ artifactUrl, consumerId, distributionId, DistributionStatusEnum.DEPLOY_OK, timestamp);
+
+ assertEquals(artifactUrl, distributionStatusMessage.getArtifactURL());
+ assertEquals(consumerId, distributionStatusMessage.getConsumerID());
+ assertEquals(distributionId, distributionStatusMessage.getDistributionID());
+ assertEquals(DistributionStatusEnum.DEPLOY_OK, distributionStatusMessage.getStatus());
+ assertEquals(123L, distributionStatusMessage.getTimestamp());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/YamlTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java
similarity index 84%
rename from asdc-controller/src/test/java/org/openecomp/mso/asdc/client/YamlTest.java
rename to asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java
index 7179de7..ed761c7 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/YamlTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/YamlTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client;
+package org.onap.so.asdc.client;
import static org.junit.Assert.*;
@@ -31,10 +31,8 @@
import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
-
-import org.openecomp.mso.asdc.installer.heat.VfResourceInstaller;
-import org.openecomp.mso.asdc.util.YamlEditor;
-import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.asdc.util.YamlEditor;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
public class YamlTest {
@@ -152,14 +150,4 @@
assertTrue(check1);
assertTrue(check2);
}
-
- @Test
- public void VfResourceInstallerTest() throws Exception {
-
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami toto, est dans le bois: toto ici","toto")));
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami file:///toto, est dans le bois: file:///toto ici","toto")));
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami file:///toto, est dans le bois: toto ici","toto")));
- assertTrue("mon ami toto, est dans le bois: toto ici".equals(VfResourceInstaller.verifyTheFilePrefixInString("mon ami toto, est dans le bois: file:///toto ici","toto")));
-
- }
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java
new file mode 100644
index 0000000..e2aee60
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCControllerExceptionTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.exceptions;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import org.junit.Test;
+
+public class ASDCControllerExceptionTest {
+ private String exceptionMessage = "test message for exception";
+ private String throwableMessage = "separate throwable that caused asdcDownloadException";
+
+ @Test
+ public void asdcParametersExceptionTest() {
+ ASDCControllerException asdcDownloadException = new ASDCControllerException(exceptionMessage);
+
+ Exception expectedException = new Exception(exceptionMessage);
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+
+ @Test
+ public void asdcParametersExceptionThrowableTest() {
+ Throwable throwableCause = new Throwable(throwableMessage);
+ ASDCControllerException asdcDownloadException = new ASDCControllerException(exceptionMessage, throwableCause);
+
+ Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage));
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java
new file mode 100644
index 0000000..98deb52
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCDownloadExceptionTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.exceptions;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import org.junit.Test;
+
+public class ASDCDownloadExceptionTest {
+ private String exceptionMessage = "test message for exception";
+ private String throwableMessage = "separate throwable that caused asdcDownloadException";
+
+ @Test
+ public void asdcDownloadExceptionTest() {
+ ASDCDownloadException asdcDownloadException = new ASDCDownloadException(exceptionMessage);
+
+ Exception expectedException = new Exception(exceptionMessage);
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+
+ @Test
+ public void asdcDownloadExceptionThrowableTest() {
+ Throwable throwableCause = new Throwable(throwableMessage);
+ ASDCDownloadException asdcDownloadException = new ASDCDownloadException(exceptionMessage, throwableCause);
+
+ Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage));
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java
new file mode 100644
index 0000000..bac05bd
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ASDCParametersExceptionTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.exceptions;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import org.junit.Test;
+
+public class ASDCParametersExceptionTest {
+ private String exceptionMessage = "test message for exception";
+ private String throwableMessage = "separate throwable that caused asdcDownloadException";
+
+ @Test
+ public void asdcParametersExceptionTest() {
+ ASDCParametersException asdcDownloadException = new ASDCParametersException(exceptionMessage);
+
+ Exception expectedException = new Exception(exceptionMessage);
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+
+ @Test
+ public void asdcParametersExceptionThrowableTest() {
+ Throwable throwableCause = new Throwable(throwableMessage);
+ ASDCParametersException asdcDownloadException = new ASDCParametersException(exceptionMessage, throwableCause);
+
+ Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage));
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java
new file mode 100644
index 0000000..f222790
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/exceptions/ArtifactInstallerExceptionTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.exceptions;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import org.junit.Test;
+
+public class ArtifactInstallerExceptionTest {
+ private String exceptionMessage = "test message for exception";
+ private String throwableMessage = "separate throwable that caused asdcDownloadException";
+
+ @Test
+ public void asdcParametersExceptionTest() {
+ ArtifactInstallerException asdcDownloadException = new ArtifactInstallerException(exceptionMessage);
+
+ Exception expectedException = new Exception(exceptionMessage);
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+
+ @Test
+ public void asdcParametersExceptionThrowableTest() {
+ Throwable throwableCause = new Throwable(throwableMessage);
+ ArtifactInstallerException asdcDownloadException = new ArtifactInstallerException(exceptionMessage, throwableCause);
+
+ Exception expectedException = new Exception(exceptionMessage, new Throwable(throwableMessage));
+
+ assertThat(asdcDownloadException, sameBeanAs(expectedException));
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java
new file mode 100644
index 0000000..3dc3235
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImplTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.test.emulators;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.so.asdc.BaseTest;
+
+public class ArtifactInfoImplTest extends BaseTest {
+ @Mock
+ private IArtifactInfo iArtifactInfo;
+
+ @Test
+ public void convertToArtifactInfoImplTest() {
+ List<IArtifactInfo> list = new ArrayList<IArtifactInfo>();
+ list.add(iArtifactInfo);
+ assertEquals(1, ArtifactInfoImpl.convertToArtifactInfoImpl(list).size());
+ }
+
+ @Test
+ public void convertToArtifactInfoImplNullListTest() {
+ assertTrue(ArtifactInfoImpl.convertToArtifactInfoImpl(null).isEmpty());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java
new file mode 100644
index 0000000..38c2564
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulatorTest.java
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.test.emulators;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientDownloadResultImpl;
+import org.onap.sdc.impl.DistributionClientResultImpl;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.ASDCNotificationCallBack;
+import org.onap.so.asdc.client.ASDCStatusCallBack;
+import org.onap.so.asdc.client.DistributionStatusMessage;
+
+public class DistributionClientEmulatorTest {
+
+ private DistributionClientEmulator distClientEmulator;
+
+ @Before
+ public void before() {
+ distClientEmulator = new DistributionClientEmulator();
+ }
+
+ @Test
+ public void getDistributionMessageReceived() {
+ List<IDistributionStatusMessage> receivedMessages = distClientEmulator.getDistributionMessageReceived();
+ assertEquals(new LinkedList<>(), receivedMessages);
+
+ IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
+ distClientEmulator.sendDeploymentStatus(message);
+ assertEquals(message, receivedMessages.get(0));
+
+ IDistributionStatusMessage message2 = new DistributionStatusMessage("testArtifactUrl2", "testConsumerId2", "testDistributionId2", DistributionStatusEnum.DOWNLOAD_OK, 1234567);
+ distClientEmulator.sendDeploymentStatus(message2);
+ assertEquals(message2, receivedMessages.get(1));
+ }
+
+ @Test
+ public void sendDeploymentStatusPrimary() {
+ IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
+ IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message);
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void sendDeploymentStatusSecondary() {
+ IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
+ IDistributionClientResult result = distClientEmulator.sendDeploymentStatus(message, "test");
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void sendDownloadStatusPrimary() {
+ IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
+ IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message);
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void sendDownloadStatusSecondary() {
+ IDistributionStatusMessage message = new DistributionStatusMessage("testArtifactUrl", "testConsumerId", "testDistributionId", DistributionStatusEnum.DOWNLOAD_OK, 123456);
+ IDistributionClientResult result = distClientEmulator.sendDownloadStatus(message, "test");
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(message, distClientEmulator.getDistributionMessageReceived().get(0));
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void initPrimary() {
+ IDistributionClientResult result = distClientEmulator.init(new ASDCConfiguration(), new ASDCNotificationCallBack());
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void initSecondary() {
+ IDistributionClientResult result = distClientEmulator.init(new ASDCConfiguration(), new ASDCNotificationCallBack(), new ASDCStatusCallBack());
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void start() {
+ IDistributionClientResult result = distClientEmulator.start();
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void stop() {
+ IDistributionClientResult result = distClientEmulator.stop();
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void updateConfiguration() {
+ IDistributionClientResult result = distClientEmulator.updateConfiguration(new ASDCConfiguration());
+ IDistributionClientResult expectedResult = new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name());
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+
+ @Test
+ public void getResourcePath() {
+ String testResourcePath = "testResourcePath";
+ distClientEmulator = new DistributionClientEmulator(testResourcePath);
+ assertEquals(testResourcePath, distClientEmulator.getResourcePath());
+ }
+
+ @Test
+ public void setResourcePath() {
+ String testResourcePath = "testResourcePath";
+ distClientEmulator.setResourcePath(testResourcePath);
+ assertEquals(testResourcePath, distClientEmulator.getResourcePath());
+ }
+
+ @Test
+ public void downloadSuccess() throws IOException {
+ ArtifactInfoImpl info = new ArtifactInfoImpl();
+ info.setArtifactURL("mso.json");
+ info.setArtifactName("testArtifactName");
+
+ distClientEmulator.setResourcePath("src/test/resources/");
+
+ IDistributionClientDownloadResult result = distClientEmulator.download(info);
+
+ byte[] expectedInputStream = Files.readAllBytes(Paths.get(distClientEmulator.getResourcePath() + info.getArtifactURL()));
+ IDistributionClientDownloadResult expectedResult = new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(), info.getArtifactName(), expectedInputStream);
+
+ assertEquals(expectedResult.getDistributionActionResult(), result.getDistributionActionResult());
+ assertEquals(expectedResult.getDistributionMessageResult(), result.getDistributionMessageResult());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusDataTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java
similarity index 96%
rename from asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusDataTest.java
rename to asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java
index 7607832..5e2f1ad 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonStatusDataTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonStatusDataTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.asdc.client.test.emulators;
+package org.onap.so.asdc.client.test.emulators;
import org.junit.Test;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java
new file mode 100644
index 0000000..6da3a2c
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.asdc.client.test.emulators;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+
+import org.junit.Test;
+
+public class JsonVfModuleMetaDataTest {
+
+ @Test
+ public void attributesMapTest() {
+ JsonVfModuleMetaData vfModuleMetadata = new JsonVfModuleMetaData();
+ vfModuleMetadata.setAttribute("vfModuleModelDescription", "vfModuleModelDescription");
+ vfModuleMetadata.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID");
+ vfModuleMetadata.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID");
+ vfModuleMetadata.setAttribute("vfModuleModelName", "vfModuleModelName");
+ vfModuleMetadata.setAttribute("vfModuleModelUUID", "vfModuleModelUUID");
+ vfModuleMetadata.setAttribute("vfModuleModelVersion", "vfModuleModelVersion");
+ vfModuleMetadata.setAttribute("isBase", true);
+
+ assertEquals("vfModuleModelDescription", vfModuleMetadata.getVfModuleModelDescription());
+ assertEquals("vfModuleModelInvariantUUID", vfModuleMetadata.getVfModuleModelInvariantUUID());
+ assertEquals("vfModuleModelCustomizationUUID", vfModuleMetadata.getVfModuleModelCustomizationUUID());
+ assertEquals("vfModuleModelName", vfModuleMetadata.getVfModuleModelName());
+ assertEquals("vfModuleModelUUID", vfModuleMetadata.getVfModuleModelUUID());
+ assertEquals("vfModuleModelVersion", vfModuleMetadata.getVfModuleModelVersion());
+ assertEquals(true, vfModuleMetadata.isBase());
+ assertEquals(null, vfModuleMetadata.getArtifacts());
+ assertEquals(new HashMap<String, String>(), vfModuleMetadata.getProperties());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java
new file mode 100644
index 0000000..b1524e0
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/NotificationDataImplTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.test.emulators;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.so.asdc.BaseTest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class NotificationDataImplTest extends BaseTest {
+ @Autowired
+ private NotificationDataImpl notificationDataImpl;
+
+ @Mock
+ private ArtifactInfoImpl artifactInfoImpl;
+
+ private static final String NOTIFICATION_DATA_IMPL_STRING = "NotificationDataImpl [distributionID=distributionID, serviceName=serviceName, "
+ + "serviceVersion=serviceVersion, serviceUUID=serviceUUID, serviceDescription=serviceDescription, "
+ + "serviceInvariantUUID=serviceInvariantUUID, resources=null, serviceArtifacts=[artifactInfoImpl], workloadContext=workloadContext]";
+
+ @Test
+ public void toStringTest() {
+ List<ArtifactInfoImpl> relevantServiceArtifacts = new ArrayList<ArtifactInfoImpl>();
+ relevantServiceArtifacts.add(artifactInfoImpl);
+ notificationDataImpl.setDistributionID("distributionID");
+ notificationDataImpl.setServiceName("serviceName");
+ notificationDataImpl.setServiceVersion("serviceVersion");
+ notificationDataImpl.setServiceDescription("serviceDescription");
+ notificationDataImpl.setServiceUUID("serviceUUID");
+ notificationDataImpl.setServiceInvariantUUID("serviceInvariantUUID");
+ notificationDataImpl.setWorkloadContext("workloadContext");
+ notificationDataImpl.setServiceArtifacts(relevantServiceArtifacts);
+
+ assertEquals(NOTIFICATION_DATA_IMPL_STRING, notificationDataImpl.toString());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java
new file mode 100644
index 0000000..4236617
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImplTest.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.client.test.emulators;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.so.asdc.BaseTest;
+
+public class ResourceInfoImplTest extends BaseTest {
+ @Mock
+ private IResourceInstance iResourceInstance;
+
+ @Test
+ public void convertToJsonContainerTest() {
+ List<IResourceInstance> resources = new ArrayList<IResourceInstance>();
+ resources.add(iResourceInstance);
+ ResourceInfoImpl.convertToJsonContainer(resources);
+
+ assertEquals(1, ResourceInfoImpl.convertToJsonContainer(resources).size());
+ }
+
+ @Test
+ public void convertToJsonContainerNullListTest() {
+ assertTrue(ResourceInfoImpl.convertToJsonContainer(null).isEmpty());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
new file mode 100644
index 0000000..1944c3a
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -0,0 +1,183 @@
+/*-
+ * ============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.asdc.client.test.rest;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.core.Response;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.mockito.Spy;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResource;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResource;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+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.CollectionResourceInstanceGroupCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
+import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
+import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ASDCRestInterfaceTest extends BaseTest {
+ //ASDC Controller writes to this path
+ static {
+ System.setProperty("mso.config.path", "src/test/resources/");
+ }
+
+
+ @Autowired
+ private AllottedResourceRepository allottedRepo;
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private NetworkResourceRepository networkRepo;
+
+ @Autowired
+ private ASDCRestInterface asdcRestInterface;
+
+ private TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+
+ private HttpHeaders headers = new HttpHeaders();
+
+ @Spy
+ DistributionClientEmulator spyClient = new DistributionClientEmulator();
+
+ @LocalServerPort
+ private int port;
+
+
+ @Test
+ @Transactional
+ public void testAllottedResourceService() throws Exception {
+
+ stubFor(post(urlPathMatching("/aai/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "application/json")));
+
+ ObjectMapper mapper = new ObjectMapper();
+ NotificationDataImpl request = mapper.readValue(new File("src/test/resources/resource-examples/allottedresource/notif-portm.json"), NotificationDataImpl.class);
+ headers.add("resource-location", "src/test/resources/resource-examples/allottedresource/");
+ HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers);
+
+ ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), HttpMethod.POST,
+ entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ AllottedResource expectedService = new AllottedResource();
+ expectedService.setDescription("rege1802pnf");
+ expectedService.setModelInvariantUUID("b8f83c3f-077c-4e2c-b489-c66382060436");
+ expectedService.setModelName("rege1802pnf");
+ expectedService.setModelUUID("5b18c75e-2d08-4bf2-ad58-4ea704ec648d");
+ expectedService.setModelVersion("1.0");
+ expectedService.setSubcategory("Contrail Route");
+ expectedService.setToscaNodeType("org.openecomp.resource.pnf.Rege1802pnf");
+ Set<AllottedResourceCustomization> arCustomizationSet = new HashSet<AllottedResourceCustomization>();
+ AllottedResourceCustomization arCustomization = new AllottedResourceCustomization();
+ arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba");
+ arCustomization.setModelInstanceName("rege1802pnf 0");
+ arCustomizationSet.add(arCustomization);
+
+ arCustomization.setAllottedResource(expectedService);
+
+
+ expectedService.setAllotedResourceCustomization(arCustomizationSet);
+
+ AllottedResource actualResponse = allottedRepo.findResourceByModelUUID("5b18c75e-2d08-4bf2-ad58-4ea704ec648d");
+
+
+ if(actualResponse == null)
+ throw new Exception("No Allotted Resource Written to database");
+
+
+ assertThat(actualResponse, sameBeanAs(expectedService).ignoring("0x1.created").ignoring("0x1.allotedResourceCustomization.created"));
+ }
+
+ @Test
+ public void invokeASDCStatusDataNullTest() {
+ String request = "";
+ Response response = asdcRestInterface.invokeASDCStatusData(request);
+ assertNull(response);
+
+ }
+
+
+
+
+
+ protected String createURLWithPort(String uri) {
+ return "http://localhost:" + port + uri;
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
new file mode 100644
index 0000000..f5f7445
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.asdc.client.test.rest;
+
+import static org.junit.Assert.assertEquals;
+import javax.ws.rs.core.Response;
+import org.json.JSONException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.asdc.Application;
+import org.onap.so.asdc.BaseTest;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+public class HealthCheckTest extends BaseTest {
+
+ @LocalServerPort
+ private int port;
+
+ TestRestTemplate restTemplate = new TestRestTemplate();
+
+ HttpHeaders headers = new HttpHeaders();
+
+ @Test
+ public void testHealthcheck() throws JSONException {
+
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ ResponseEntity<String> response = restTemplate.exchange(
+ createURLWithPort("/manage/health"),
+ HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ }
+
+ private String createURLWithPort(String uri) {
+ return "http://localhost:" + port + uri;
+ }
+
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
new file mode 100644
index 0000000..6f07f44
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
@@ -0,0 +1,152 @@
+/*-
+ * ============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.asdc.client.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.Transactional;
+
+import org.junit.Test;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * This class tests the ASDC Controller by using the ASDC Mock CLient
+ *
+ *
+ */
+@Transactional
+public class ASDCConfigurationTest extends BaseTest {
+
+ @Autowired
+ private ASDCConfiguration config;
+
+ private List<String> msgBusAddressList = new ArrayList<String>();
+
+ private static final String MSO_PRE_IST = "msopreist";
+ private static final String MSO_ASDC_ID_LOCAL = "msoasdc-id-local";
+ private static final String PRE_IST = "Pre-IST";
+ private static final String ASDC_ADDRESS = "localhost:8443";
+
+ @Test
+ public void isUseHttpsWithDmaapTest() {
+ assertFalse(config.isUseHttpsWithDmaap());
+ }
+
+ @Test
+ public void isConsumeProduceStatusTopicTest() {
+ assertTrue(config.isConsumeProduceStatusTopic());
+ }
+
+ @Test
+ public void getUserTest() {
+ assertTrue(MSO_PRE_IST.equals(config.getUser()));
+ }
+
+ @Test
+ public void getConsumerGroupTest() {
+ assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerGroup()));
+ }
+
+ @Test
+ public void getConsumerIDTest() {
+ assertTrue(MSO_ASDC_ID_LOCAL.equals(config.getConsumerID()));
+ }
+
+ @Test
+ public void getEnvironmentNameTest() {
+ assertTrue(PRE_IST.equals(config.getEnvironmentName()));
+ }
+
+ @Test
+ public void getAsdcAddress() {
+ assertTrue(ASDC_ADDRESS.equals(config.getAsdcAddress()));
+ }
+
+ @Test
+ public void getPasswordTest() {
+ assertTrue(MSO_PRE_IST.equals(config.getPassword()));
+ }
+
+ @Test
+ public void getPollingIntervalTest() {
+ assertTrue(config.getPollingInterval() == 30);
+ }
+
+ @Test
+ public void getPollingTimeoutTest() {
+ assertTrue(config.getPollingTimeout() == 30);
+ }
+
+ @Test
+ public void getRelevantArtifactTypesTest() {
+ assertTrue(config.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
+ }
+
+ @Test
+ public void getWatchDogTimeoutTest() {
+ assertTrue(config.getWatchDogTimeout() == 1);
+ }
+
+ @Test
+ public void activateServerTLSAuthTest() {
+ assertFalse(config.activateServerTLSAuth());
+ }
+
+ @Test
+ public void getKeyStorePasswordTest() {
+ assertNull(config.getKeyStorePassword());
+ }
+
+ @Test
+ public void getKeyStorePathTest() {
+ assertNull(config.getKeyStorePath());
+ }
+
+ @Test
+ public void isFilterInEmptyResourcesTest() {
+ assertTrue(config.isFilterInEmptyResources());
+ }
+
+ @Test
+ public void setGetAsdcControllerNameTest() {
+ String asdcControllerName = "testAsdcControllerName";
+ config.setAsdcControllerName(asdcControllerName);
+ String actualAsdcControllerName = config.getAsdcControllerName();
+ assertEquals(asdcControllerName, actualAsdcControllerName);
+ }
+
+ @Test
+ public void getMsgBusAddressTest() {
+ msgBusAddressList.add("localhost");
+ msgBusAddressList.add("localhost");
+
+ List<String> actualMsgBusAddress = config.getMsgBusAddress();
+ assertEquals(msgBusAddressList, actualMsgBusAddress);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java
new file mode 100644
index 0000000..de0d2e0
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/ToscaResourceStructureTest.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.installer;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.so.asdc.client.exceptions.ASDCDownloadException;
+import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
+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.VnfResourceCustomization;
+
+public class ToscaResourceStructureTest {
+ private ArtifactInfoImpl artifactInfo;
+ private SdcCsarHelperImpl sdcCsarHelper;
+
+ private ToscaResourceStructure toscaResourceStructure;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void toscaResourceStructureBeanTest() {
+ artifactInfo = mock(ArtifactInfoImpl.class);
+ sdcCsarHelper = mock(SdcCsarHelperImpl.class);
+
+ toscaResourceStructure = new ToscaResourceStructure();
+ toscaResourceStructure.setHeatTemplateUUID("heatTemplateUUID");
+ toscaResourceStructure.setAllottedList(new ArrayList<NodeTemplate>());
+ toscaResourceStructure.setSdcCsarHelper(sdcCsarHelper);
+ toscaResourceStructure.setServiceMetadata(new Metadata(new HashMap<>()));
+ toscaResourceStructure.setCatalogService(new Service());
+ toscaResourceStructure.setNetworkTypes(new ArrayList<>());
+ toscaResourceStructure.setVfTypes(new ArrayList<>());
+ toscaResourceStructure.setCatalogResourceCustomization(new AllottedResourceCustomization());
+ toscaResourceStructure.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
+ toscaResourceStructure.setCatalogNetworkResource(new NetworkResource());
+ toscaResourceStructure.setCatalogVfModule(new VfModule());
+ toscaResourceStructure.setVnfResourceCustomization(new VnfResourceCustomization());
+ toscaResourceStructure.setVfModuleCustomization(new VfModuleCustomization());
+ toscaResourceStructure.setAllottedResource(new AllottedResource());
+ toscaResourceStructure.setAllottedResourceCustomization(new AllottedResourceCustomization());
+ toscaResourceStructure.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
+ toscaResourceStructure.setHeatFilesUUID("heatFilesUUID");
+ toscaResourceStructure.setToscaArtifact(artifactInfo);
+ toscaResourceStructure.setToscaCsar(new ToscaCsar());
+ toscaResourceStructure.setVnfAlreadyInstalled(true);
+ toscaResourceStructure.setVolHeatTemplateUUID("volHeatTemplateUUID");
+ toscaResourceStructure.setEnvHeatTemplateUUID("envHeatTemplateUUID");
+ toscaResourceStructure.setServiceVersion("serviceVersion");
+ toscaResourceStructure.setWorkloadPerformance("workloadPerformance");
+ toscaResourceStructure.setVfModule(new VfModule());
+ toscaResourceStructure.setTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
+ toscaResourceStructure.setSuccessfulDeployment();
+
+ assertEquals("heatTemplateUUID", toscaResourceStructure.getHeatTemplateUUID());
+ assertThat(toscaResourceStructure.getAllottedList(), sameBeanAs(new ArrayList<NodeTemplate>()));
+ assertEquals(sdcCsarHelper, toscaResourceStructure.getSdcCsarHelper());
+ assertThat(toscaResourceStructure.getServiceMetadata(), sameBeanAs(new Metadata(new HashMap<>())));
+ assertThat(toscaResourceStructure.getCatalogService(), sameBeanAs(new Service()));
+ assertThat(toscaResourceStructure.getNetworkTypes(), sameBeanAs(new ArrayList<>()));
+ assertThat(toscaResourceStructure.getVfTypes(), sameBeanAs(new ArrayList<>()));
+ assertThat(toscaResourceStructure.getCatalogResourceCustomization(), sameBeanAs(new AllottedResourceCustomization()));
+ assertThat(toscaResourceStructure.getCatalogNetworkResourceCustomization(), sameBeanAs(new NetworkResourceCustomization()));
+ assertThat(toscaResourceStructure.getCatalogNetworkResource(), sameBeanAs(new NetworkResource()));
+ assertThat(toscaResourceStructure.getCatalogVfModule(), sameBeanAs(new VfModule()));
+ assertThat(toscaResourceStructure.getVnfResourceCustomization(), sameBeanAs(new VnfResourceCustomization()));
+ assertThat(toscaResourceStructure.getVfModuleCustomization(), sameBeanAs(new VfModuleCustomization()));
+ assertThat(toscaResourceStructure.getAllottedResource(), sameBeanAs(new AllottedResource()));
+ assertThat(toscaResourceStructure.getAllottedResourceCustomization(), sameBeanAs(new AllottedResourceCustomization()));
+ assertThat(toscaResourceStructure.getCatalogTempNetworkHeatTemplateLookup(), sameBeanAs(new TempNetworkHeatTemplateLookup()));
+ assertEquals("heatFilesUUID", toscaResourceStructure.getHeatFilesUUID());
+ assertEquals(artifactInfo, toscaResourceStructure.getToscaArtifact());
+ assertThat(toscaResourceStructure.getToscaCsar(), sameBeanAs(new ToscaCsar()));
+ assertEquals(true, toscaResourceStructure.isVnfAlreadyInstalled());
+ assertEquals("volHeatTemplateUUID", toscaResourceStructure.getVolHeatTemplateUUID());
+ assertEquals("envHeatTemplateUUID", toscaResourceStructure.getEnvHeatTemplateUUID());
+ assertEquals("serviceVersion", toscaResourceStructure.getServiceVersion());
+ assertEquals("workloadPerformance", toscaResourceStructure.getWorkloadPerformance());
+ assertThat(toscaResourceStructure.getVfModule(), sameBeanAs(new VfModule()));
+ assertThat(toscaResourceStructure.getTempNetworkHeatTemplateLookup(), sameBeanAs(new TempNetworkHeatTemplateLookup()));
+ assertEquals(true, toscaResourceStructure.isDeployedSuccessfully());
+ }
+
+ @Test
+ public void updateResourceStructureExceptionTest() throws Exception {
+ expectedException.expect(ASDCDownloadException.class);
+
+ artifactInfo = mock(ArtifactInfoImpl.class);
+ toscaResourceStructure = new ToscaResourceStructure();
+
+ doReturn("artifactName").when(artifactInfo).getArtifactName();
+
+ toscaResourceStructure.updateResourceStructure(artifactInfo);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
new file mode 100644
index 0000000..d96e480
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -0,0 +1,479 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.installer.heat;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+
+import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.transaction.Transactional;
+
+import org.apache.commons.io.IOUtils;
+import org.hibernate.exception.LockAcquisitionException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl;
+import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.onap.sdc.toscaparser.api.CapabilityAssignment;
+import org.onap.sdc.toscaparser.api.CapabilityAssignments;
+import org.onap.sdc.toscaparser.api.Group;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.ASDCConfiguration;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
+import org.onap.so.asdc.client.test.emulators.JsonStatusData;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.asdc.installer.VfModuleArtifact;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+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.ExternalServiceToInternalServiceRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ToscaResourceInstallerTest extends BaseTest {
+ @Autowired
+ private ToscaResourceInstaller toscaInstaller;
+ @Autowired
+ private WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository;
+ @Autowired
+ private AllottedResourceRepository allottedRepo;
+ @Autowired
+ private AllottedResourceCustomizationRepository allottedCustomizationRepo;
+ @Autowired
+ private ServiceRepository serviceRepo;
+ @Autowired
+ private ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository;
+ @Mock
+ private SdcCsarHelperImpl sdcCsarHelper;
+ @Mock
+ private Metadata metadata;
+ @Mock
+ private ArtifactInfoImpl artifactInfo;
+ @Mock
+ private List<Group> vfGroups;
+ @Mock
+ private IResourceInstance resourceInstance;
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ private NotificationDataImpl notificationData;
+ private JsonStatusData statusData;
+ private static final String MSO = "SO";
+
+ private AllottedResource allottedResource;
+ private AllottedResourceCustomization allottedResourceCustomization;
+ private Service catalogService;
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+
+ notificationData = new NotificationDataImpl();
+ statusData = new JsonStatusData();
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedTest() throws Exception {
+ notificationData.setServiceName("serviceName");
+ notificationData.setServiceVersion("123456");
+ notificationData.setServiceUUID("serviceUUID");
+ notificationData.setDistributionID("testStatusSuccessTosca");
+
+ WatchdogComponentDistributionStatus expectedComponentDistributionStatus =
+ new WatchdogComponentDistributionStatus(notificationData.getDistributionID(), MSO);
+ expectedComponentDistributionStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+
+ doReturn(true).when(vfResourceStructure).isDeployedSuccessfully();
+ doReturn(notificationData).when(vfResourceStructure).getNotification();
+ doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance();
+ doReturn("resourceInstanceName").when(resourceInstance).getResourceInstanceName();
+ doReturn("resourceCustomizationUUID").when(resourceInstance).getResourceCustomizationUUID();
+ doReturn("resourceName").when(resourceInstance).getResourceName();
+
+ toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure);
+
+ WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId(notificationData.getDistributionID()), MSO);
+
+ verify(vfResourceStructure, times(3)).getResourceInstance();
+ verify(vfResourceStructure, times(5)).getNotification();
+ assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedComponentDistributionStatus)
+ .ignoring("createTime")
+ .ignoring("modifyTime"));
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedFalseTest() throws Exception {
+ notificationData.setServiceName("serviceName");
+ notificationData.setServiceVersion("123456");
+ notificationData.setServiceUUID("serviceUUID");
+ notificationData.setDistributionID("testStatusSuccess");
+
+ doThrow(RuntimeException.class).when(vfResourceStructure).isDeployedSuccessfully();
+ doReturn(notificationData).when(vfResourceStructure).getNotification();
+ doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance();
+ doReturn("resourceInstanceName").when(resourceInstance).getResourceInstanceName();
+ doReturn("resourceCustomizationUUID").when(resourceInstance).getResourceCustomizationUUID();
+ doReturn("resourceName").when(resourceInstance).getResourceName();
+
+ toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure);
+
+ verify(vfResourceStructure, times(3)).getResourceInstance();
+ verify(vfResourceStructure, times(4)).getNotification();
+ }
+
+ @Test
+ public void isResourceAlreadyDeployedExceptionTest() throws ArtifactInstallerException {
+ expectedException.expect(ArtifactInstallerException.class);
+
+ toscaInstaller.isResourceAlreadyDeployed(vfResourceStructure);
+ }
+
+ @Test
+ public void installTheComponentStatusTest() throws Exception {
+ String distributionId = "testStatusSuccessTosca";
+ String componentName = "testComponentName";
+
+ statusData = spy(JsonStatusData.class);
+ doReturn(distributionId).when(statusData).getDistributionID();
+ doReturn(componentName).when(statusData).getComponentName();
+
+ WatchdogComponentDistributionStatus expectedWatchdogComponentDistributionStatus =
+ new WatchdogComponentDistributionStatus(distributionId, componentName);
+ expectedWatchdogComponentDistributionStatus.setComponentDistributionStatus(statusData.getStatus().toString());
+
+ WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(statusData.getDistributionID(),
+ statusData.getComponentName());
+
+ toscaInstaller.installTheComponentStatus(statusData);
+
+ WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId("testStatusSuccessTosca"), statusData.getComponentName());
+
+ assertEquals(statusData.getDistributionID(), cdStatus.getDistributionId());
+ assertEquals(statusData.getComponentName(), cdStatus.getComponentName());
+ assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedWatchdogComponentDistributionStatus)
+ .ignoring("createTime")
+ .ignoring("modifyTime"));
+ }
+
+ @Test
+ public void installTheComponentStatusExceptionTest() throws ArtifactInstallerException {
+ expectedException.expect(ArtifactInstallerException.class);
+
+ statusData = spy(JsonStatusData.class);
+ doReturn(null).when(statusData).getStatus();
+
+ toscaInstaller.installTheComponentStatus(statusData);
+ }
+
+ @Test
+ @Ignore
+ @Transactional
+ public void installTheResourceTest() throws Exception {
+ notificationData.setDistributionID("testStatusSuccessTosca");
+ notificationData.setServiceVersion("123456");
+ notificationData.setServiceUUID("5df8b6de-2083-11e7-93ae-92361f002671");
+ notificationData.setWorkloadContext("workloadContext");
+
+ HashMap<String, VfModuleArtifact> vfModuleArtifacts = mock(HashMap.class);
+ CapabilityAssignments capabilityAssignments = mock(CapabilityAssignments.class);
+ CapabilityAssignment capabilityAssignment = mock(CapabilityAssignment.class);
+
+ vfResourceStructure = spy(new VfResourceStructure(notificationData, resourceInstance));
+
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelName("modelName");
+ vnfResource.setModelVersion("1.1");
+ vnfResource.setModelUUID("modelUUID");
+ vnfResource.setOrchestrationMode("orchestrationMode");
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ vnfResourceCustomization.setModelCustomizationUUID("vnfResCustModelCustomizationUUID");
+ vnfResourceCustomization.setModelInstanceName("modelInstanceName");
+
+ AllottedResource allottedResource = new AllottedResource();
+ allottedResource.setModelUUID("serviceMetadataValue");
+ allottedResource.setModelInvariantUUID("modelInvariantUUID");
+ allottedResource.setModelName("modelName");
+ allottedResource.setModelVersion("1.1");
+
+ AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
+ allottedResourceCustomization.setAllottedResource(allottedResource);
+ allottedResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
+ allottedResourceCustomization.setModelInstanceName("modelInstanceName");
+
+ Service catalogService = new Service();
+ catalogService.setServiceType("serviceType");
+ catalogService.setModelUUID("5df8b6de-2083-11e7-93ae-92361f002672");
+ catalogService.setModelInvariantUUID("modelInvariantUUID");
+ catalogService.setModelName("modelName");
+ catalogService.setModelVersion("modelVersion");
+ catalogService.getVnfCustomizations().add(vnfResourceCustomization);
+
+ Iterator artifactIterator = mock(Iterator.class);
+ Iterator nodeTemplateIterator = mock(Iterator.class);
+ IDistributionClientDownloadResult clientResult = mock(IDistributionClientDownloadResult.class);
+ doReturn(IOUtils.toByteArray(
+ new FileInputStream(
+ new File(
+ getClass().getClassLoader().getResource("resource-examples/simpleTest.yaml").getFile())
+ ))).when(clientResult).getArtifactPayload();
+ VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult);
+ Collection<VfModuleArtifact> vfModuleArtifactsValues = mock(Collection.class);
+
+ NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeTemplateList = new ArrayList<>();
+ nodeTemplateList.add(nodeTemplate);
+
+ HeatTemplate heatTemplate = new HeatTemplate();
+ heatTemplate.setArtifactUuid("ff874603-4222-11e7-9252-005056850d2e");
+ heatTemplate.setArtifactChecksum("MANUAL RECORD");
+ heatTemplate.setTemplateBody("templateBody");
+ heatTemplate.setTemplateName("module_mns_zrdm3frwl01exn_01_rgvm_1.yml");
+ heatTemplate.setVersion("1");
+
+ NetworkResource networkResource = new NetworkResource();
+ networkResource.setAicVersionMin("aicVersionMin");
+ networkResource.setModelUUID("modelUUID");
+ networkResource.setOrchestrationMode("orchestrationMode");
+ networkResource.setModelVersion("modelVersion");
+ networkResource.setNeutronNetworkType("neutronNetworkType");
+ networkResource.setAicVersionMax("aicVersionMax");
+ networkResource.setModelName("CONTRAIL30_GNDIRECT");
+ networkResource.setModelInvariantUUID("modelInvariantUUID");
+ networkResource.setHeatTemplate(heatTemplate);
+
+ NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
+ networkResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
+ networkResourceCustomization.setModelInstanceName("modelInstanceName");
+ networkResourceCustomization.setNetworkResource(networkResource);
+
+ WatchdogServiceModVerIdLookup expectedModVerIdLookup = new WatchdogServiceModVerIdLookup(notificationData.getDistributionID(), notificationData.getServiceUUID());
+ WatchdogDistributionStatus expectedDistributionStatus = new WatchdogDistributionStatus(notificationData.getDistributionID());
+ WatchdogComponentDistributionStatus expectedComponentDistributionStatus = new WatchdogComponentDistributionStatus(notificationData.getDistributionID(), MSO);
+ expectedComponentDistributionStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+
+ doReturn(sdcCsarHelper).when(toscaResourceStruct).getSdcCsarHelper();
+ doReturn("metadataPropertyValue").when(sdcCsarHelper).getMetadataPropertyValue(any(Metadata.class), any(String.class));
+ doReturn("ntPropertyLeafValue").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(any(NodeTemplate.class), any(String.class));
+ doReturn("true").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+ doReturn("1").when(sdcCsarHelper).getCapabilityPropertyLeafValue(any(CapabilityAssignment.class), any(String.class));
+ doReturn(vfGroups).when(sdcCsarHelper).getVfModulesByVf(any(String.class));
+ doReturn(capabilityAssignments).when(sdcCsarHelper).getCapabilitiesOf(any(NodeTemplate.class));
+ doReturn(capabilityAssignment).when(capabilityAssignments).getCapabilityByName(any(String.class));
+
+ doReturn(catalogService).when(toscaResourceStruct).getCatalogService();
+
+ doReturn(artifactInfo).when(toscaResourceStruct).getToscaArtifact();
+ doReturn("artifactChecksum").when(artifactInfo).getArtifactChecksum();
+ doReturn("artifactUUID").when(artifactInfo).getArtifactUUID();
+ doReturn("artifactName").when(artifactInfo).getArtifactName();
+ doReturn("1.0").when(artifactInfo).getArtifactVersion();
+ doReturn("artifactDescription").when(artifactInfo).getArtifactDescription();
+ doReturn("artifactURL").when(artifactInfo).getArtifactURL();
+
+ doReturn(metadata).when(toscaResourceStruct).getServiceMetadata();
+ doReturn("serviceMetadataValue").when(metadata).getValue(any(String.class));
+ doReturn("CONTRAIL30_GNDIRECT").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+
+ doReturn("serviceVersion").when(toscaResourceStruct).getServiceVersion();
+ doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVfList();
+ doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVlList();
+ doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources();
+ doReturn(metadata).when(nodeTemplate).getMetaData();
+ doReturn("model_instance_name").when(nodeTemplate).getName();
+ doReturn(false).when(toscaResourceStruct).isVnfAlreadyInstalled();
+ doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization();
+ doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource();
+ doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization();
+
+ doReturn(vfModuleArtifacts).when(vfResourceStructure).getArtifactsMapByUUID();
+ when(vfModuleArtifacts.values()).thenReturn(vfModuleArtifactsValues);
+ when(vfModuleArtifactsValues.iterator()).thenReturn(artifactIterator);
+ when(artifactIterator.hasNext()).thenReturn(true, false);
+ when(artifactIterator.next()).thenReturn(vfModuleArtifact);
+ when(artifactInfo.getArtifactType()).thenReturn(ASDCConfiguration.OTHER);
+ when(nodeTemplateIterator.hasNext()).thenReturn(true, false);
+
+ doReturn(networkResource).when(toscaResourceStruct).getCatalogNetworkResource();
+ doReturn(networkResourceCustomization).when(toscaResourceStruct).getCatalogNetworkResourceCustomization();
+
+ doNothing().when(toscaResourceStruct).setSuccessfulDeployment();
+
+ toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure);
+
+ AllottedResource actualAllottedResource = allottedRepo.findResourceByModelUUID(allottedResource.getModelUUID());
+ AllottedResourceCustomization actualAllottedResourceCustomization = allottedCustomizationRepo.findOne(allottedResourceCustomization.getModelCustomizationUUID());
+ Service actualService = serviceRepo.findByServiceType(catalogService.getServiceType());
+ WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId(notificationData.getDistributionID()), MSO);
+
+ verify(toscaResourceStruct, times(1)).setSuccessfulDeployment();
+ assertThat(actualAllottedResource,
+ sameBeanAs(allottedResource));
+ assertThat(actualAllottedResourceCustomization, sameBeanAs(allottedResourceCustomization)
+ .ignoring("created"));
+ assertThat(actualService, sameBeanAs(catalogService)
+ .ignoring("created")
+ .ignoring("networkCustomizations.0x1.created")
+ .ignoring("networkCustomizations.0x1.networkResource.created"));
+ assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedComponentDistributionStatus)
+ .ignoring("createTime")
+ .ignoring("modifyTime"));
+ }
+
+
+ @Test
+ public void installTheResourceExceptionTest() throws Exception {
+ expectedException.expect(ArtifactInstallerException.class);
+
+ notificationData.setDistributionID("testStatusFailureTosca");
+ notificationData.setServiceVersion("123456");
+ notificationData.setServiceUUID("serviceUUID");
+ notificationData.setWorkloadContext("workloadContext");
+
+ doReturn(notificationData).when(vfResourceStructure).getNotification();
+ doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance();
+
+ toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure);
+ }
+
+ @Test
+ public void installTheResourceDBExceptionTest() throws Exception {
+ notificationData.setDistributionID("testStatusSuccessTosca");
+ notificationData.setServiceVersion("123456");
+ notificationData.setServiceUUID("serviceUUID");
+ notificationData.setWorkloadContext("workloadContext");
+
+ doReturn(notificationData).when(vfResourceStructure).getNotification();
+ doReturn(resourceInstance).when(vfResourceStructure).getResourceInstance();
+ doThrow(LockAcquisitionException.class).when(toscaResourceStruct).getToscaArtifact();
+
+ toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure);
+ }
+
+ @Test
+ public void verifyTheFilePrefixInStringTest() {
+ String body = "abcabcabcfile:///testfile.txtabcbabacbcabc";
+ String filenameToVerify = "testfile.txt";
+ String expectedFileBody = "abcabcabctestfile.txtabcbabacbcabc";
+
+ String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify);
+
+ assertEquals(expectedFileBody, newFileBody);
+ }
+
+ @Test
+ public void verifyTheFilePrefixInStringNullBodyTest() {
+ String body = null;
+ String filenameToVerify = "testfile.txt";
+
+ String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify);
+
+ assertEquals(body, newFileBody);
+ }
+
+ @Test
+ public void verifyTheFilePrefixInStringEmptyBodyTest() {
+ String body = "";
+ String filenameToVerify = "testfile.txt";
+
+ String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify);
+
+ assertEquals(body, newFileBody);
+ }
+
+ @Test
+ public void verifyTheFilePrefixInStringNullFilenameTest() {
+ String body = "abcabcabcfile:///testfile.txtabcbabacbcabc";
+ String filenameToVerify = null;
+
+ String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify);
+
+ assertEquals(body, newFileBody);
+ }
+
+ @Test
+ public void verifyTheFilePrefixInStringEmptyFilenameTest() {
+ String body = "abcabcabcfile:///testfile.txtabcbabacbcabc";
+ String filenameToVerify = "";
+
+ String newFileBody = toscaInstaller.verifyTheFilePrefixInString(body, filenameToVerify);
+
+ assertEquals(body, newFileBody);
+ }
+
+ private WatchdogComponentDistributionStatus getWatchdogCDStatusWithName(List<WatchdogComponentDistributionStatus> watchdogComponentDistributionStatuses, String componentName) {
+ WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = new WatchdogComponentDistributionStatus();
+ for(WatchdogComponentDistributionStatus watchdogComponentDistributionStatus : watchdogComponentDistributionStatuses) {
+ if(componentName.equals(watchdogComponentDistributionStatus.getComponentName())) {
+ actualWatchdogComponentDistributionStatus = watchdogComponentDistributionStatus;
+ break;
+ }
+ }
+ return actualWatchdogComponentDistributionStatus;
+ }
+
+
+
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java
new file mode 100644
index 0000000..a20f6de
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.asdc.tenantIsolation;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.client.aai.AAIVersion;
+
+public class AaiClientPropertiesImplTest extends BaseTest {
+
+ private static final String SYSTEM_NAME = "MSO";
+ private static final String LOCAL_HOST = "http://localhost:";
+
+ @BeforeClass
+ public static void setup() throws Exception {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void getEndpointTest() throws Exception {
+ AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl();
+ String aaiEndpoint = aaiClientPropertiesImpl.getEndpoint().toString();
+ assertEquals(LOCAL_HOST + wireMockPort, aaiEndpoint);
+ }
+
+ @Test
+ public void getSystemNameTest() {
+ AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl();
+ assertEquals(SYSTEM_NAME, aaiClientPropertiesImpl.getSystemName());
+ }
+
+ @Test
+ public void getDefaultVersionTest() {
+ AaiClientPropertiesImpl aaiClientPropertiesImpl = new AaiClientPropertiesImpl();
+ assertEquals(AAIVersion.LATEST, aaiClientPropertiesImpl.getDefaultVersion());
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
new file mode 100644
index 0000000..b72e079
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.tenantIsolation;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.HashMap;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.db.catalog.beans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class WatchdogDistributionTest extends BaseTest {
+ @Autowired
+ private WatchdogDistribution watchdogDistribution;
+
+ @Mock
+ private AAIResourcesClient aaiResourceClient;
+
+ private static final String SUCCESS_TEST = "watchdogTestStatusSuccess";
+ private static final String FAILURE_TEST = "watchdogTestStatusFailure";
+ private static final String TIMEOUT_TEST = "watchdogTestStatusTimeout";
+ private static final String INCOMPLETE_TEST = "watchdogTestStatusIncomplete";
+ private static final String EXCEPTION_TEST = "watchdogTestStatusException";
+ private static final String NULL_TEST = "watchdogTestStatusNull";
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void getOverallDistributionStatusTimeoutTest() throws Exception {
+ String status = watchdogDistribution.getOverallDistributionStatus(TIMEOUT_TEST);
+ assertEquals(DistributionStatus.TIMEOUT.toString(), status);
+ }
+
+ @Test
+ public void getOverallDistributionStatusSuccessTest() throws Exception {
+ String status = watchdogDistribution.getOverallDistributionStatus(SUCCESS_TEST);
+ assertEquals(DistributionStatus.SUCCESS.toString(), status);
+ }
+
+ @Test
+ public void getOverallDistributionStatusFailureTest() throws Exception {
+ String status = watchdogDistribution.getOverallDistributionStatus(FAILURE_TEST);
+ assertEquals(DistributionStatus.FAILURE.toString(), status);
+ }
+
+ @Test
+ public void getOverallDistributionStatusIncompleteTest() throws Exception {
+ String status = watchdogDistribution.getOverallDistributionStatus(INCOMPLETE_TEST);
+ assertEquals(DistributionStatus.INCOMPLETE.toString(), status);
+ }
+
+ @Test
+ public void getOverallDistributionStatusInvalidComponentExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ watchdogDistribution.getOverallDistributionStatus(EXCEPTION_TEST);
+ }
+
+ @Test
+ public void getOverallDistributionStatusNewStatusTest() throws Exception {
+ String status = watchdogDistribution.getOverallDistributionStatus("newDistrubutionStatus");
+ assertEquals(DistributionStatus.INCOMPLETE.toString(), status);
+ }
+
+ @Test
+ public void getOverallDistributionStatusExceptionTest() throws Exception {
+ expectedException.expect(Exception.class);
+ watchdogDistribution.getOverallDistributionStatus(null);
+ }
+
+ @Test
+ public void executePatchAAITest() throws Exception {
+ Service service = new Service();
+ service.setModelInvariantUUID("9647dfc4-2083-11e7-93ae-92361f002671");
+
+ doReturn(aaiResourceClient).when(watchdogDistributionSpy).getAaiClient();
+ doNothing().when(aaiResourceClient).update(isA(AAIResourceUri.class), isA(HashMap.class));
+
+ watchdogDistribution.executePatchAAI(SUCCESS_TEST, service.getModelInvariantUUID(), DistributionStatus.SUCCESS.toString());
+
+ verify(aaiResourceClient, times(1)).update(any(AAIResourceUri.class), any(HashMap.class));
+ }
+
+ @Test
+ public void executePatchAAINullDistrubutionIdTest() throws Exception {
+ expectedException.expect(Exception.class);
+ watchdogDistribution.executePatchAAI(null, "", DistributionStatus.SUCCESS.toString());
+ }
+
+ @Test
+ public void executePatchAAINullServiceTest() throws Exception {
+ expectedException.expect(Exception.class);
+ watchdogDistribution.executePatchAAI(NULL_TEST, null, DistributionStatus.SUCCESS.toString());
+ }
+
+ @Test
+ public void getSetAaiClientTest() {
+ aaiResourceClient = watchdogDistribution.getAaiClient();
+ watchdogDistribution.setAaiClient(aaiResourceClient);
+ AAIResourcesClient aaiResourceClient2 = watchdogDistribution.getAaiClient();
+ assertEquals(aaiResourceClient, aaiResourceClient2);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java
similarity index 94%
rename from asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java
rename to asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java
index 3351392..3abc2e7 100644
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/util/ASDCNotificationLoggingTest.java
@@ -1,186 +1,186 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.util.tests;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-import org.openecomp.mso.asdc.installer.IVfModuleData;
-import org.openecomp.mso.asdc.installer.VfModuleMetaData;
-import org.openecomp.mso.asdc.util.ASDCNotificationLogging;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-
-public class ASDCNotificationLoggingTest {
- @Test
- public void dumpASDCNotificationTestForNull() throws Exception {
- INotificationData asdcNotification = iNotificationDataObject();
-
- String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
-
- assertTrue(!result.equalsIgnoreCase("NULL"));
- }
-
- private INotificationData iNotificationDataObject() {
- INotificationData iNotification = new INotificationData() {
-
- @Override
- public String getServiceVersion() {
- return "DistributionID";
- }
-
- @Override
- public String getServiceUUID() {
- return "12343254";
- }
-
- @Override
- public String getServiceName() {
- return "servername";
- }
-
- @Override
- public String getServiceInvariantUUID() {
- return "ServiceInvariantUUID";
- }
-
- @Override
- public String getServiceDescription() {
- return "Description";
- }
-
- @Override
- public List<IArtifactInfo> getServiceArtifacts() {
- return new ArrayList();
- }
-
- @Override
- public List<IResourceInstance> getResources() {
- return new ArrayList();
- }
-
- @Override
- public String getDistributionID() {
- return "23434";
- }
-
- @Override
- public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
- return null;
- }
-
- @Override
- public String getWorkloadContext() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setWorkloadContext(String arg0) {
- // TODO Auto-generated method stub
-
- }
- };
- return iNotification;
- }
-
- @Test
- public void dumpASDCNotificationTest() throws Exception {
- INotificationData asdcNotification = iNotificationDataObject();
- String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
-
- assertTrue(!result.equalsIgnoreCase("NULL"));
- }
-
- @Test
- public void dumpVfModuleMetaDataListTest() {
- INotificationData asdcNotification = iNotificationDataObject();
- List<IVfModuleData> list = new ArrayList<>();
- list.add(new VfModuleMetaData());
- String result = null;
- try {
- result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);
- } catch (Exception e) {
- }
-
- assertTrue(result == null);
-
- }
-
- public IArtifactInfo getIArtifactInfo() {
- return new IArtifactInfo() {
-
- @Override
- public List<IArtifactInfo> getRelatedArtifacts() {
- return null;
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact() {
- return null;
- }
-
- @Override
- public String getArtifactVersion() {
- return "version";
- }
-
- @Override
- public String getArtifactUUID() {
- return "123";
- }
-
- @Override
- public String getArtifactURL() {
- return "url";
- }
-
- @Override
- public String getArtifactType() {
- return "type";
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return 12;
- }
-
- @Override
- public String getArtifactName() {
- return "name";
- }
-
- @Override
- public String getArtifactDescription() {
- return "desc";
- }
-
- @Override
- public String getArtifactChecksum() {
- return "true";
- }
- };
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.util;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.so.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.VfModuleMetaData;
+import org.onap.so.asdc.util.ASDCNotificationLogging;
+
+public class ASDCNotificationLoggingTest {
+ @Test
+ public void dumpASDCNotificationTestForNull() throws Exception {
+ INotificationData asdcNotification = iNotificationDataObject();
+
+ String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
+
+ assertTrue(!result.equalsIgnoreCase("NULL"));
+ }
+
+ private INotificationData iNotificationDataObject() {
+ INotificationData iNotification = new INotificationData() {
+
+ @Override
+ public String getServiceVersion() {
+ return "DistributionID";
+ }
+
+ @Override
+ public String getServiceUUID() {
+ return "12343254";
+ }
+
+ @Override
+ public String getServiceName() {
+ return "servername";
+ }
+
+ @Override
+ public String getServiceInvariantUUID() {
+ return "ServiceInvariantUUID";
+ }
+
+ @Override
+ public String getServiceDescription() {
+ return "Description";
+ }
+
+ @Override
+ public List<IArtifactInfo> getServiceArtifacts() {
+ return new ArrayList();
+ }
+
+ @Override
+ public List<IResourceInstance> getResources() {
+ return new ArrayList();
+ }
+
+ @Override
+ public String getDistributionID() {
+ return "23434";
+ }
+
+ @Override
+ public IArtifactInfo getArtifactMetadataByUUID(String arg0) {
+ return null;
+ }
+
+ @Override
+ public String getWorkloadContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setWorkloadContext(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+ };
+ return iNotification;
+ }
+
+ @Test
+ public void dumpASDCNotificationTest() throws Exception {
+ INotificationData asdcNotification = iNotificationDataObject();
+ String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);
+
+ assertTrue(!result.equalsIgnoreCase("NULL"));
+ }
+
+ @Test
+ public void dumpVfModuleMetaDataListTest() {
+ INotificationData asdcNotification = iNotificationDataObject();
+ List<IVfModuleData> list = new ArrayList<>();
+ list.add(new VfModuleMetaData());
+ String result = null;
+ try {
+ result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);
+ } catch (Exception e) {
+ }
+
+ assertTrue(result == null);
+
+ }
+
+ public IArtifactInfo getIArtifactInfo() {
+ return new IArtifactInfo() {
+
+ @Override
+ public List<IArtifactInfo> getRelatedArtifacts() {
+ return null;
+ }
+
+ @Override
+ public IArtifactInfo getGeneratedArtifact() {
+ return null;
+ }
+
+ @Override
+ public String getArtifactVersion() {
+ return "version";
+ }
+
+ @Override
+ public String getArtifactUUID() {
+ return "123";
+ }
+
+ @Override
+ public String getArtifactURL() {
+ return "url";
+ }
+
+ @Override
+ public String getArtifactType() {
+ return "type";
+ }
+
+ @Override
+ public Integer getArtifactTimeout() {
+ return 12;
+ }
+
+ @Override
+ public String getArtifactName() {
+ return "name";
+ }
+
+ @Override
+ public String getArtifactDescription() {
+ return "desc";
+ }
+
+ @Override
+ public String getArtifactChecksum() {
+ return "true";
+ }
+ };
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java
new file mode 100644
index 0000000..8bd11d9
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/util/NotificationLoggingTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+
+public class NotificationLoggingTest {
+ private NotificationDataImpl notificationData;
+
+ @Before
+ public void before() {
+ notificationData = new NotificationDataImpl();
+ }
+
+ @Test
+ public void logNotificationTest() {
+ notificationData.setDistributionID("distributionID");
+ notificationData.setServiceVersion("123456");
+ notificationData.setServiceUUID("serviceUUID");
+ notificationData.setWorkloadContext("workloadContext");
+
+ String response = NotificationLogging.logNotification(notificationData);
+
+ assertTrue(response.contains("ASDC Notification"));
+ assertTrue(response.contains("ResourcesType not recognized"));
+ assertTrue(response.contains("ServiceNameNULL"));
+ assertTrue(response.contains("ServiceUUIDserviceUUID"));
+ assertTrue(response.contains("ResourcesImplNULL"));
+ assertTrue(response.contains("ServiceArtifactsType not recognized"));
+ assertTrue(response.contains("ServiceDescriptionNULL"));
+ assertTrue(response.contains("DistributionIDdistributionID"));
+ assertTrue(response.contains("ServiceInvariantUUIDNULL"));
+ assertTrue(response.contains("WorkloadContextworkloadContext"));
+ }
+
+ @Test
+ public void logNotificationNullTest() {
+ notificationData = null;
+
+ String response = NotificationLogging.logNotification(notificationData);
+
+ assertEquals("NULL", response);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java
new file mode 100644
index 0000000..2a77664
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingRunner.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.asdc.utils;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.antlr.v4.runtime.CharStreams;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.tree.ParseTree;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+public class ASDCLoggingRunner
+{
+ public static void main( String[] args) throws Exception
+ {
+ String content = new String(Files.readAllBytes(Paths.get("src/test/resources/Heat_Nested_Notification.txt")));
+
+ ASDCLoggingLexer lexer = new ASDCLoggingLexer(CharStreams.fromString(content));
+
+ CommonTokenStream tokens = new CommonTokenStream(lexer);
+
+ ASDCLoggingParser parser = new ASDCLoggingParser(tokens);
+
+ ParseTree tree = parser.doc();
+
+ System.out.println(TreeUtils.printTree(tree, parser)); // print LISP-style tree
+
+ ASDCLoggingVisitorImpl v = new ASDCLoggingVisitorImpl();
+
+ JsonNode node = v.visit(tree);
+
+ System.out.println(node.toString());
+
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java
new file mode 100644
index 0000000..51036e2
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java
@@ -0,0 +1,104 @@
+/*-
+ * ============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.asdc.utils;
+
+import java.util.ArrayDeque;
+import java.util.Deque;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ContainerNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.base.CaseFormat;
+
+
+public class ASDCLoggingVisitorImpl extends ASDCLoggingBaseVisitor<ContainerNode> {
+
+ private final ObjectMapper mapper = new ObjectMapper();
+ private ObjectNode doc;
+ private Deque<ContainerNode> nodeStore = new ArrayDeque<>();
+
+ @Override
+ public ContainerNode visitDoc(ASDCLoggingParser.DocContext ctx) {
+ doc = mapper.createObjectNode();
+ nodeStore.addFirst(doc);
+ this.visitChildren(ctx);
+ return doc;
+ }
+
+ @Override
+ public ContainerNode visitValue(ASDCLoggingParser.ValueContext ctx) {
+
+ return this.visitChildren(ctx);
+
+ }
+ @Override
+ public ContainerNode visitSimplePair(ASDCLoggingParser.SimplePairContext ctx) {
+ ObjectNode node = mapper.createObjectNode();
+ ((ObjectNode)nodeStore.peekFirst()).put(this.toLowerCamel(ctx.key().getText()), ctx.keyValue().getText());
+
+ return node;
+ }
+
+ @Override
+ public ContainerNode visitComplexPair(ASDCLoggingParser.ComplexPairContext ctx) {
+ ContainerNode container = nodeStore.peekFirst();
+ if (container.isArray()) {
+ ArrayNode array = (ArrayNode) container;
+ ObjectNode node = mapper.createObjectNode();
+ array.add(node);
+ nodeStore.addFirst(node);
+ } else {
+ nodeStore.addFirst(((ObjectNode)nodeStore.peekFirst()).putObject(this.toLowerCamel(ctx.key().getText())));
+ }
+ this.visitChildren(ctx);
+ return nodeStore.removeFirst();
+
+
+ }
+
+ @Override
+ public ContainerNode visitList(ASDCLoggingParser.ListContext ctx) {
+ nodeStore.addFirst(((ObjectNode)nodeStore.peekFirst()).putArray(this.keyMapper(ctx.listName().getText())));
+ this.visitChildren(ctx);
+ return nodeStore.removeFirst();
+ }
+
+ private String keyMapper(String key) {
+ if ("Service Artifacts List".equals(key)) {
+ return "serviceArtifacts";
+ } else if ("Resource Instances List".equals(key)) {
+ return "resources";
+ } else if ("Resource Artifacts List".equals(key)) {
+ return "artifacts";
+ } else {
+ return key;
+ }
+ }
+
+ private String toLowerCamel(String key) {
+ String result = key.replaceAll("\\s", "");
+ if ("ServiceArtifactsInfo".equals(result)) {
+ return "artifactInfo";
+ }
+ return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, result);
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java
new file mode 100644
index 0000000..c4a84c0
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreePrinterListener.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.utils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.RuleContext;
+import org.antlr.v4.runtime.misc.Utils;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.ParseTreeListener;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.antlr.v4.runtime.tree.Trees;
+
+public class TreePrinterListener implements ParseTreeListener {
+ private final List<String> ruleNames;
+ private final StringBuilder builder = new StringBuilder();
+ Map<RuleContext,ArrayList<String>> stack = new HashMap<RuleContext,ArrayList<String>>();
+
+ public TreePrinterListener(Parser parser) {
+ this.ruleNames = Arrays.asList(parser.getRuleNames());
+ }
+
+ public TreePrinterListener(List<String> ruleNames) {
+ this.ruleNames = ruleNames;
+ }
+
+ @Override
+ public void visitTerminal(TerminalNode node) {
+ String text = Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false);
+ if(text.startsWith(" ") || text.endsWith(" ")){
+ text = "'" + text + "'";
+ }
+ stack.get(node.getParent()).add(text);
+ }
+
+ @Override
+ public void visitErrorNode(ErrorNode node) {
+ stack.get(node.getParent()).add(Utils.escapeWhitespace(Trees.getNodeText(node, ruleNames), false));
+ }
+
+ @Override
+ public void enterEveryRule(ParserRuleContext ctx) {
+ if(!stack.containsKey(ctx.parent)){
+ stack.put(ctx.parent, new ArrayList<String>());
+ }
+ if(!stack.containsKey(ctx)){
+ stack.put(ctx, new ArrayList<String>());
+ }
+
+ final StringBuilder sb = new StringBuilder();
+ int ruleIndex = ctx.getRuleIndex();
+ String ruleName;
+ if (ruleIndex >= 0 && ruleIndex < ruleNames.size()) {
+ ruleName = ruleNames.get(ruleIndex);
+ }
+ else {
+ ruleName = Integer.toString(ruleIndex);
+ }
+ sb.append(ruleName);
+ stack.get(ctx).add(sb.toString());
+ }
+
+ @Override
+ public void exitEveryRule(ParserRuleContext ctx) {
+ ArrayList<String> ruleStack = stack.remove(ctx);
+ StringBuilder sb = new StringBuilder();
+ boolean brackit =ruleStack.size()>1;
+ if(brackit){
+ sb.append("(");
+ }
+ sb.append(ruleStack.get(0));
+ for(int i=1; i<ruleStack.size(); i++){
+ sb.append(" ");
+ sb.append(ruleStack.get(i));
+ }
+ if(brackit){
+ sb.append(")");
+ }
+ if(sb.length() < 80){
+ stack.get(ctx.parent).add(sb.toString());
+ }else{
+ // Current line is too long, regenerate it using 1 line per item.
+ sb.setLength(0);
+ if(brackit){
+ sb.append("(");
+ }
+ if(!ruleStack.isEmpty()){
+ sb.append(ruleStack.remove(0)).append("\r\n");
+ }
+ while(!ruleStack.isEmpty()){
+ sb.append(indent(ruleStack.remove(0))).append("\r\n");
+ }
+ if(brackit){
+ sb.append(")");
+ }
+ stack.get(ctx.parent).add(sb.toString());
+ }
+ if(ctx.parent == null){
+ builder.append(sb.toString());
+ }
+ }
+
+ static String indent(String input){
+ return " " + input.replaceAll("\r\n(.)","\r\n $1");
+ }
+
+ @Override
+ public String toString() {
+ return builder.toString();
+ }
+
+
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java
new file mode 100644
index 0000000..8de9f36
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/TreeUtils.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.asdc.utils;
+
+import java.util.Arrays;
+
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.antlr.v4.runtime.tree.ParseTreeWalker;
+
+
+public class TreeUtils {
+
+ /**
+ * Print the tree, splitting at appropriate points, instead of rendering a single long line.
+ * @param parseTree
+ * @param parser
+ * @return
+ */
+ public static String printTree(final ParseTree parseTree, final Parser parser){
+ final TreePrinterListener listener = new TreePrinterListener(Arrays.asList(parser.getRuleNames()));
+ ParseTreeWalker.DEFAULT.walk(listener, parseTree);
+ return listener.toString();
+ }
+
+ public static String normalizeWhiteSpace(String input){
+ return input.replaceAll("\\s+", " ").replaceAll("([^\\w])\\s+", "$1");
+ }
+}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCConfigurationTest.java
deleted file mode 100644
index 5e2184a..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCConfigurationTest.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client;
-
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-/**
- * THis class tests the ASDC Controller by using the ASDC Mock CLient
- *
- *
- */
-public class ASDCConfigurationTest {
-
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public final String ASDC_PROP = ASDCConfigurationTest.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public final String ASDC_PROP2 = ASDCConfigurationTest.class.getClassLoader().getResource("mso2.json").toString().substring(5);
- public final String ASDC_PROP3 = ASDCConfigurationTest.class.getClassLoader().getResource("mso3.json").toString().substring(5);
- public final String ASDC_PROP_BAD = ASDCConfigurationTest.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
- public final String ASDC_PROP_WITH_NULL = ASDCConfigurationTest.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
- public final String ASDC_PROP_DOUBLE_CONFIG = ASDCConfigurationTest.class.getClassLoader().getResource("mso-two-configs.json").toString().substring(5);
- public final String ASDC_PROP4_WITH_TLS = ASDCConfigurationTest.class.getClassLoader().getResource("mso4-with-TLS.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareBeforeAllTests() {
- msoPropertiesFactory.removeAllMsoProperties();
- }
-
- @Before
- public final void prepareBeforeEachTest () throws MsoPropertiesException {
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @After
- public final void cleanAfterEachTest () {
- msoPropertiesFactory.removeAllMsoProperties();
- }
-
- @Test
- public final void testTheInit() throws ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
- assertFalse(asdcConfig.activateServerTLSAuth());
-
- }
-
- @Test
- public final void testAllParametersMethod() throws ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- // No exception should be raised
- asdcConfig.testAllParameters();
- }
-
- @Test
- public final void testTheRefreshConfigFalseCase() throws ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- // No update should be done as we use the mso.properties located in the resource folder for testing
- assertFalse(asdcConfig.hasASDCConfigChanged());
- assertFalse(asdcConfig.refreshASDCConfig());
-
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
- msoPropertiesFactory.removeAllMsoProperties();
-
- try {
- asdcConfig.refreshASDCConfig();
- fail("Should have thrown an ASDCParametersException because config does not exist anymore!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
- }
-
- try {
- asdcConfig.hasASDCConfigChanged();
- fail("Should have thrown an ASDCParametersException because config does not exist anymore!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be read")));
- }
-
- }
-
-
- @Test
- @Ignore // 1802 merge
- public final void testToChangeTheFileAndRefresh () throws ASDCParametersException, IOException, MsoPropertiesException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP2);
- msoPropertiesFactory.reloadMsoProperties();
-
- // SHould be the same file untouched just a different file name, there should be no difference between them
- // In a normal case a different Filename should force the system to reload the config but not here as we have changed the filename by reflection
- assertFalse(asdcConfig.hasASDCConfigChanged());
- assertFalse(asdcConfig.refreshASDCConfig());
-
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
- // Set another file that has some attributes changed
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
- msoPropertiesFactory.reloadMsoProperties();
-
- // SHould be the same file untouched just a different file name, so new config
- assertTrue(asdcConfig.hasASDCConfigChanged());
- assertTrue(asdcConfig.refreshASDCConfig());
-
- assertNotNull(asdcConfig.getUser());
- assertTrue("User".equals(asdcConfig.getUser()));
-
- assertNotNull(asdcConfig.getPassword());
- assertTrue("ThePassword".equals(asdcConfig.getPassword()));
-
- assertNotNull(asdcConfig.getConsumerGroup());
- assertTrue("consumerGroup".equals(asdcConfig.getConsumerGroup()));
-
- assertNotNull(asdcConfig.getConsumerID());
- assertTrue("consumerId".equals(asdcConfig.getConsumerID()));
-
- assertNotNull(asdcConfig.getEnvironmentName());
- assertTrue("environmentName".equals(asdcConfig.getEnvironmentName()));
-
- // only this field has been changed
- assertNotNull(asdcConfig.getAsdcAddress());
- assertTrue("hostname1".equals(asdcConfig.getAsdcAddress()));
-
- assertNotNull(asdcConfig.getPollingInterval());
- assertTrue(asdcConfig.getPollingInterval() == 10);
-
- assertNotNull(asdcConfig.getPollingTimeout());
- assertTrue(asdcConfig.getPollingTimeout() == 30);
-
- assertNotNull(asdcConfig.getRelevantArtifactTypes());
- assertTrue(asdcConfig.getRelevantArtifactTypes().size() == ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST.size());
-
-
- // reload the good property file for other test cases
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
-
- }
-
- @Test
- @Ignore // 1802 merge
- public final void testAllParametersCheck () throws ASDCParametersException, IOException, MsoPropertiesException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
- msoPropertiesFactory.reloadMsoProperties();
- // SHould be a bad file, it should raise an exception
- try {
- asdcConfig.refreshASDCConfig();
- fail("Should have thrown an ASDCControllerException because one param is missing!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("consumerGroup parameter cannot be found in config mso.properties")));
- }
-
-
- // reload the good property file for other test cases
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(asdcConfig.refreshASDCConfig());
-
- }
-
- @Test
- public final void testConsumerGroupWithNULL () throws MsoPropertiesException, ASDCParametersException, IOException {
- ASDCConfiguration asdcConfig = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_NULL);
- msoPropertiesFactory.reloadMsoProperties();
-
- asdcConfig.refreshASDCConfig();
- assertTrue(asdcConfig.getConsumerGroup()==null);
-
- // reload the good property file for other test cases
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(asdcConfig.refreshASDCConfig());
-
-
- }
-
- @Test
- @Ignore // 1802 merge
- public final void testGetAllDefinedControllers() throws MsoPropertiesException, ASDCParametersException, IOException {
- List<String> listControllers = ASDCConfiguration.getAllDefinedControllers();
-
- assertTrue(listControllers.size()==1);
- assertTrue("asdc-controller1".equals(listControllers.get(0)));
-
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
- assertTrue(asdcConfiguration.getAsdcControllerName().equals("asdc-controller1"));
-
-
- // Try to reload a wrong Json file
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
- msoPropertiesFactory.reloadMsoProperties();
-
- listControllers = ASDCConfiguration.getAllDefinedControllers();
- assertTrue(listControllers.size()==0);
-
- }
-
- @Test
- public final void testABadInit() throws MsoPropertiesException {
- msoPropertiesFactory.removeAllMsoProperties();
-
- try {
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
- fail("Should have thrown an ASDCParametersException because prop factory is empty!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
- } catch (IOException e) {
- fail("Should have thrown an ASDCParametersException, not IOException because file is corrupted!");
- }
- }
-
- @Test
- public final void testFileDoesNotExist() throws MsoPropertiesException, ASDCParametersException, IOException {
-
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.removeAllMsoProperties();
-
- try {
- asdcConfiguration.refreshASDCConfig();
- fail("Should have thrown an ASDCParametersException because factory is empty!");
- } catch (ASDCParametersException e) {
- assertTrue(e.getMessage().contains(("mso.asdc.json not initialized properly, ASDC config cannot be reloaded")));
- }
- }
-
- @Test
- public final void testWithTLS () throws ASDCParametersException, IOException, MsoPropertiesException {
- ASDCConfiguration asdcConfiguration = new ASDCConfiguration("asdc-controller1");
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP4_WITH_TLS);
- msoPropertiesFactory.reloadMsoProperties();
-
- asdcConfiguration.refreshASDCConfig();
-
- assertTrue(asdcConfiguration.activateServerTLSAuth());
- assertTrue("/test".equals(asdcConfiguration.getKeyStorePath()));
- assertTrue("ThePassword".equals(asdcConfiguration.getKeyStorePassword()));
- }
-
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCControllerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCControllerTest.java
deleted file mode 100644
index f8f1816..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCControllerTest.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client;
-
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.codec.binary.Base64;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.consumer.INotificationCallback;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.impl.mock.DistributionClientStubImpl;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.ASDCController;
-import org.openecomp.mso.asdc.client.ASDCControllerStatus;
-import org.openecomp.mso.asdc.client.exceptions.ASDCControllerException;
-import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.installer.heat.VfResourceInstaller;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-
-
-/**
- * THis class tests the ASDC Controller by using the ASDC Mock CLient
- *
- *
- */
-public class ASDCControllerTest {
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
-
- private static INotificationData iNotif;
-
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
-
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
-
- private static IArtifactInfo artifactInfo1;
-
- private static IResourceInstance resource1;
-
- private static VfResourceInstaller vnfInstaller;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString().substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString().substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException, NoSuchAlgorithmException, ArtifactInstallerException {
-
- heatExample = new String(Files.readAllBytes(Paths.get(ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
-
- iNotif= Mockito.mock(INotificationData.class);
-
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(ASDCControllerTest.heatExampleMD5HashBase64);
-
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL()).thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
-
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
-
- // Create fake resource Instance
- resource1 = Mockito.mock (IResourceInstance.class);
- Mockito.when (resource1.getResourceType ()).thenReturn ("VF");
- Mockito.when (resource1.getResourceName ()).thenReturn ("resourceName");
- Mockito.when (resource1.getArtifacts ()).thenReturn (listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<> ();
- resources.add (resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample+"badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
- vnfInstaller = Mockito.mock(VfResourceInstaller.class);
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill () throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
-
- }
-
- @Test
- public final void testTheInitWithASDCStub() throws ASDCControllerException, ASDCParametersException, IOException {
-
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl());
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
- }
-
- @Test
- public final void testTheNotificationWithASDCStub() throws ASDCControllerException, ASDCParametersException, IOException {
-
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
- asdcController.initASDC();
- // try to send a notif, this should fail internally, we just want to ensure that in case of crash, controller status goes to IDLE
- asdcController.treatNotification(iNotif);
-
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
-
- }
-
- @Test
- public final void testASecondInit() throws ASDCControllerException, ASDCParametersException, IOException {
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
- asdcController.initASDC();
- // try to send a notif, this should fail internally, we just want to ensure that in case of crash, controller status goes to IDLE
-
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
-
- try {
- asdcController.initASDC();
- fail("ASDCControllerException should have been raised for the init");
- } catch (ASDCControllerException e) {
- assertTrue("The controller is already initialized, call the closeASDC method first".equals(e.getMessage()));
- }
-
- // No changes expected on the controller state
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
- }
-
- @Test
- @Ignore // 1802 merge
- public final void testInitCrashWithMockitoClient() throws ASDCParametersException, IOException {
-
- IDistributionClient distributionClient;
- // First case for init method
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenThrow(new RuntimeException("ASDC Client not initialized"));
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(unsuccessfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(unsuccessfulClientInitResult);
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // This should return an exception
- try {
- asdcController.initASDC();
- fail("ASDCControllerException should have been raised for the init");
- } catch (ASDCControllerException e) {
- assertTrue("Initialization of the ASDC Controller failed with reason: null".equals(e.getMessage()));
- }
-
- assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
-
- // Second case for start method
-
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(unsuccessfulClientInitResult);
-
- // This should return an exception
- try {
- asdcController.initASDC();
- fail("ASDCControllerException should have been raised for the init");
- } catch (ASDCControllerException e) {
- assertTrue("Startup of the ASDC Controller failed with reason: null".equals(e.getMessage()));
- }
-
- assertTrue(asdcController.getControllerStatus() == ASDCControllerStatus.STOPPED);
- assertTrue(asdcController.getNbOfNotificationsOngoing()== 0);
- }
-
- @Test
- public final void testTheStop() throws ASDCControllerException, ASDCParametersException, IOException {
-
- ASDCController asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
-
- asdcController.closeASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.STOPPED);
-
-
- asdcController = new ASDCController("asdc-controller1",new DistributionClientStubImpl(),vnfInstaller);
- asdcController.initASDC();
- asdcController.closeASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.STOPPED);
- }
-
- @Test
- @Ignore // 1802 merge
- public final void testConfigRefresh () throws ASDCParametersException, ASDCControllerException, IOException, MsoPropertiesException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // it should not raise any exception even if controller is not yet initialized
- asdcController.updateConfigIfNeeded();
-
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertFalse(asdcController.updateConfigIfNeeded());
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
- msoPropertiesFactory.reloadMsoProperties();
- // It should fail if it tries to refresh the config as the init will now fail
- assertTrue(asdcController.updateConfigIfNeeded());
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
-
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
- }
-
- @Test
- @Ignore // 1802 merge
- public final void testConfigRefreshWhenBusy () throws IOException, MsoPropertiesException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, ASDCParametersException, ASDCControllerException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // it should not raise any exception even if controller is not yet initialized
- asdcController.updateConfigIfNeeded();
-
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertFalse(asdcController.updateConfigIfNeeded());
-
- // Simulate a BUSY case by reflection
- Field controllerStatus;
- controllerStatus = ASDCController.class.getDeclaredField("controllerStatus");
- controllerStatus.setAccessible(true);
- controllerStatus.set(asdcController,ASDCControllerStatus.BUSY);
-
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP3);
- msoPropertiesFactory.reloadMsoProperties();
- // It should fail if it tries to refresh the config as the init will now fail
- try {
- asdcController.updateConfigIfNeeded();
- fail ("ASDCControllerException should have been raised");
- } catch (ASDCControllerException e) {
- assertTrue("Cannot close the ASDC controller as it's currently in BUSY state".equals(e.getMessage()));
- }
-
- // Try it a second time to see if we still see the changes
- try {
- asdcController.updateConfigIfNeeded();
- fail ("ASDCControllerException should have been raised");
- } catch (ASDCControllerException e) {
- assertTrue("Cannot close the ASDC controller as it's currently in BUSY state".equals(e.getMessage()));
- }
-
- // Revert to Idle by reflection
- controllerStatus.set(asdcController,ASDCControllerStatus.IDLE);
- controllerStatus.setAccessible(false);
-
- // This should work now, controller should be restarted
- assertTrue(asdcController.updateConfigIfNeeded());
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
- }
-
-
- @Test
- @Ignore // 1802 merge
- public final void testBadConfigRefresh () throws ASDCParametersException, ASDCControllerException, IOException, MsoPropertiesException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- // it should not raise any exception even if controller is not yet initialized
- asdcController.updateConfigIfNeeded();
-
- asdcController.initASDC();
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.IDLE);
- assertFalse(asdcController.updateConfigIfNeeded());
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_BAD);
- msoPropertiesFactory.reloadMsoProperties();
- // It should fail if it tries to refresh the config as the init will now fail
- try {
- asdcController.updateConfigIfNeeded();
- fail ("ASDCParametersException should have been raised");
- } catch (ASDCParametersException ep) {
- assertTrue("consumerGroup parameter cannot be found in config mso.properties".equals(ep.getMessage()));
- }
-
- // This should stop the controller, as it can't work with a bad config file
- assertTrue(asdcController.getControllerStatus()== ASDCControllerStatus.STOPPED);
-
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- msoPropertiesFactory.reloadMsoProperties();
- }
-
- @Test
- @Ignore // 1802 merge
- public final void testConfigAccess () throws ASDCControllerException, ASDCParametersException, IOException {
- IDistributionClient distributionClient;
- distributionClient = Mockito.mock(IDistributionClient.class);
- Mockito.when(distributionClient.download(artifactInfo1)).thenReturn(downloadResult);
- Mockito.when(distributionClient.init(any(ASDCConfiguration.class),any(INotificationCallback.class))).thenReturn(successfulClientInitResult);
- Mockito.when(distributionClient.start()).thenReturn(successfulClientInitResult);
-
-
- ASDCController asdcController = new ASDCController("asdc-controller1",distributionClient,vnfInstaller);
-
- assertTrue("Unknown".equals(asdcController.getAddress()));
- assertTrue("Unknown".equals(asdcController.getEnvironment()));
-
- asdcController.initASDC();
-
- assertTrue("hostname".equals(asdcController.getAddress()));
- assertTrue("environmentName".equals(asdcController.getEnvironment()));
-
- }
-
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCGlobalControllerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCGlobalControllerTest.java
deleted file mode 100644
index c301b05..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/ASDCGlobalControllerTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client;
-
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.codec.binary.Base64;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.ASDCGlobalController;
-import org.openecomp.mso.asdc.client.exceptions.ASDCControllerException;
-import org.openecomp.mso.asdc.client.exceptions.ASDCParametersException;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-
-
-/**
- * THis class tests the ASDC Controller by using the ASDC Mock CLient
- *
- *
- */
-public class ASDCGlobalControllerTest {
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
-
- private static INotificationData iNotif;
-
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
-
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
-
- private static IArtifactInfo artifactInfo1;
-
- private static IResourceInstance resource1;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString().substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString().substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader().getResource("mso-with-NULL.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_DOUBLE = MsoJavaProperties.class.getClassLoader().getResource("mso-two-configs.json").toString().substring(5);
- public static final String ASDC_PROP_WITH_DOUBLE2 = MsoJavaProperties.class.getClassLoader().getResource("mso-two-configs2.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException, NoSuchAlgorithmException, ArtifactInstallerException {
-
- heatExample = new String(Files.readAllBytes(Paths.get(ASDCGlobalControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
-
- iNotif= Mockito.mock(INotificationData.class);
-
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(ASDCGlobalControllerTest.heatExampleMD5HashBase64);
-
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL()).thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
-
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
-
- // Create fake resource Instance
- resource1 = Mockito.mock (IResourceInstance.class);
- Mockito.when (resource1.getResourceType ()).thenReturn ("VF");
- Mockito.when (resource1.getResourceName ()).thenReturn ("resourceName");
- Mockito.when (resource1.getArtifacts ()).thenReturn (listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<> ();
- resources.add (resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample+"badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult ()).thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill () throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
- }
-
- @Test
- public final void testUpdateControllersConfigIfNeeded() throws ASDCControllerException, ASDCParametersException, IOException, MsoPropertiesException {
-
- ASDCGlobalController asdcGlobalController = new ASDCGlobalController();
- assertTrue(asdcGlobalController.getControllers().size()==0);
-
- // first init
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==1);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
-
- // Add a second one
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_DOUBLE);
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==2);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller2") != null);
- // Check that update does nothing
- assertFalse(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==2);
-
- // Change the second one name
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP_WITH_DOUBLE2);
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==2);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller2B") != null);
-
-
- }
-
- @Test
- public final void testCloseASDC() {
-
- ASDCGlobalController asdcGlobalController = new ASDCGlobalController();
- assertTrue(asdcGlobalController.getControllers().size()==0);
-
- // first init
- assertTrue(asdcGlobalController.updateControllersConfigIfNeeded());
- assertTrue(asdcGlobalController.getControllers().size()==1);
- assertTrue(asdcGlobalController.getControllers().get("asdc-controller1") != null);
-
- asdcGlobalController.closeASDC();
- assertTrue(asdcGlobalController.getControllers().size()==0);
-
-
- }
-
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoTest.java
deleted file mode 100644
index 22d5471..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonArtifactInfoTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client.test.emulators;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class JsonArtifactInfoTest {
- JsonArtifactInfo jsonArtifactInfo = new JsonArtifactInfo();
-
- List<JsonArtifactInfo> artifactList = new ArrayList<>();
-
- @Test
- public final void addArtifactToUUIDMap()
- {
- jsonArtifactInfo.addArtifactToUUIDMap(artifactList);
- }
-
- @Test
- public final void setAttribute()
- {
- jsonArtifactInfo.setAttribute("artifactName", "test");
- }
-
-
- @Test
- public final void getArtifactDescription()
- {
- final String artifactDescription = jsonArtifactInfo.getArtifactDescription();
- final String artifactName = jsonArtifactInfo.getArtifactName();
- final String artifactChecksumfinal = jsonArtifactInfo.getArtifactChecksum();
- final String artifactChecksum = jsonArtifactInfo.getArtifactChecksum();
- final Integer artifactTimeout = jsonArtifactInfo.getArtifactTimeout();
- final String artifactType = jsonArtifactInfo.getArtifactType();
- final String artifactURL = jsonArtifactInfo.getArtifactURL();
- final String artifactUUID = jsonArtifactInfo.getArtifactUUID();
- final String artifactVersion = jsonArtifactInfo.getArtifactVersion();
- jsonArtifactInfo.getGeneratedArtifact();
- jsonArtifactInfo.getRelatedArtifacts();
-
- }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java
deleted file mode 100644
index 596b2b2..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonNotificationDataTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client.test.emulators;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-public class JsonNotificationDataTest {
-
- @Test
- public void setAttributeTest()
- {
- JsonNotificationData jsonNotificationData = new JsonNotificationData();
- jsonNotificationData.setWorkloadContext("test");
- jsonNotificationData.setAttribute("distributionID","test");
- jsonNotificationData.setAttribute("workloadContext","test");
- String getWorkloadContextVal = jsonNotificationData.getWorkloadContext();
- assertEquals("test",getWorkloadContextVal);
- }
-
- @Test
- public void getAttributeTest()
- {
- JsonNotificationData jsonNotificationData = new JsonNotificationData();
- jsonNotificationData.setAttribute("workloadContext","test");;
- jsonNotificationData.getArtifactMetadataByUUID("test");
- jsonNotificationData.getDistributionID();
- jsonNotificationData.getResources();
- jsonNotificationData.getServiceArtifacts();
- jsonNotificationData.getServiceDescription();
- jsonNotificationData.getServiceInvariantUUID();
- jsonNotificationData.getServiceName();
- jsonNotificationData.getServiceUUID();
- jsonNotificationData.getServiceVersion();
- String getWorkloadContextVal = jsonNotificationData.getWorkloadContext();
- assertEquals("test",getWorkloadContextVal);
- }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoTest.java
deleted file mode 100644
index ab884fe..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonResourceInfoTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client.test.emulators;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class JsonResourceInfoTest {
-
-
- @Test
- public void setAttributeTest()
- {
- JsonResourceInfo jsonResourceInfo = new JsonResourceInfo();
- jsonResourceInfo.setAttribute("resourceInstanceName","resourceInstanceName");
- String resourceInstanceName = jsonResourceInfo.getResourceInstanceName();
- assertEquals(resourceInstanceName,"resourceInstanceName");
- }
-
- @Test
- public void getAttributeTest()
- {
- JsonResourceInfo jsonResourceInfo = new JsonResourceInfo();
- String resourceInstanceName = jsonResourceInfo.getResourceInstanceName();
- assertEquals(resourceInstanceName,null);
- }
-
- @Test
- public void getAttributeTestOthers()
- {
- JsonResourceInfo jsonResourceInfo = new JsonResourceInfo();
- String resourceInvariantUUID = jsonResourceInfo.getResourceInvariantUUID();
- jsonResourceInfo.getResourceName();
- jsonResourceInfo.getResourceType();
- jsonResourceInfo.getResourceUUID();
- jsonResourceInfo.getResourceVersion();
- jsonResourceInfo.getSubcategory();
- jsonResourceInfo.getCategory();
- jsonResourceInfo.getResourceCustomizationUUID();
- jsonResourceInfo.getArtifacts();
- assertEquals(resourceInvariantUUID,null);
- }
-
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java
deleted file mode 100644
index 02dc843..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/test/emulators/JsonVfModuleMetaDataTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.asdc.client.test.emulators;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class JsonVfModuleMetaDataTest {
-
- @Test
- public void setGetAttributeTest()
- {
- JsonVfModuleMetaData jsonVfModuleMetaDataTest = new JsonVfModuleMetaData();
- jsonVfModuleMetaDataTest.setAttribute("vfModuleModelVersion",new String("test"));
- jsonVfModuleMetaDataTest.setAttribute("isBase",new Boolean(true));
- jsonVfModuleMetaDataTest.getArtifacts();
- jsonVfModuleMetaDataTest.getProperties();
- jsonVfModuleMetaDataTest.getVfModuleModelDescription();
- jsonVfModuleMetaDataTest.getVfModuleModelInvariantUUID();
- jsonVfModuleMetaDataTest.getVfModuleModelCustomizationUUID();
- jsonVfModuleMetaDataTest.getVfModuleModelName();
- jsonVfModuleMetaDataTest.getVfModuleModelUUID();
- jsonVfModuleMetaDataTest.getVfModuleModelVersion();
- Boolean baseVal = jsonVfModuleMetaDataTest.isBase();
- assertEquals(baseVal, true);
- }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java
deleted file mode 100644
index ebcae50..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/ToscaResourceInstallerTest.java
+++ /dev/null
@@ -1,674 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.installer.heat.tests;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.tuple.Pair;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.client.ASDCControllerTest;
-import org.openecomp.mso.asdc.installer.ToscaResourceStructure;
-import org.openecomp.mso.asdc.installer.VfResourceStructure;
-import org.openecomp.mso.asdc.installer.heat.ToscaResourceInstaller;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.AllottedResource;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.NetworkResource;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
-import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
-import org.openecomp.mso.db.catalog.beans.VnfResCustomToVfModuleCustom;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.tosca.parser.impl.FilterType;
-import org.onap.sdc.tosca.parser.impl.SdcTypes;
-import org.onap.sdc.toscaparser.api.CapabilityAssignment;
-import org.onap.sdc.toscaparser.api.CapabilityAssignments;
-import org.onap.sdc.toscaparser.api.Group;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.RequirementAssignments;
-import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.onap.sdc.toscaparser.api.parameters.Input;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-
-import mockit.Mock;
-import mockit.MockUp;
-
-public class ToscaResourceInstallerTest {
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
-
- private static INotificationData iNotif;
-
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
-
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
-
- private static IDistributionClient distributionClient;
-
- private static IArtifactInfo artifactInfo1;
-
- private static IResourceInstance resource1;
-
- private static VfResourceStructure vrs;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString()
- .substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString()
- .substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString()
- .substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
- .toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader()
- .getResource("mso-with-NULL.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException,
- NoSuchAlgorithmException, ArtifactInstallerException {
-
- heatExample = new String(Files.readAllBytes(Paths.get(
- ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
-
- iNotif = Mockito.mock(INotificationData.class);
-
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum())
- .thenReturn(ToscaResourceInstallerTest.heatExampleMD5HashBase64);
-
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL())
- .thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
-
- distributionClient = Mockito.mock(IDistributionClient.class);
-
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
-
- // Create fake resource Instance
- resource1 = Mockito.mock(IResourceInstance.class);
- // Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
- Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<>();
- resources.add(resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
- vrs = new VfResourceStructure(iNotif, resource1);
- try {
- vrs.addArtifactToStructure(distributionClient, artifactInfo1, downloadResult);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- try {
- vrs.createVfModuleStructures();
- } catch (ArtifactInstallerException e) {
- e.printStackTrace();
- }
- vrs.getNotification();
- vrs.getArtifactsMapByUUID();
- vrs.getCatalogNetworkResourceCustomization();
- vrs.getCatalogResourceCustomization();
- vrs.getCatalogService();
- vrs.getCatalogServiceToAllottedResources();
- vrs.getCatalogServiceToNetworks();
- vrs.getCatalogVnfResource();
- vrs.getResourceInstance();
- vrs.getVfModulesStructureList();
- vrs.getVfModuleStructure();
- vrs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
- vrs.setCatalogResourceCustomization(new AllottedResourceCustomization());
- vrs.setCatalogService(new Service());
- vrs.setCatalogServiceToAllottedResources(new ServiceToAllottedResources());
- vrs.setCatalogServiceToNetworks(new ServiceToNetworks());
- vrs.setCatalogVnfResource(new VnfResource());
- vrs.setSuccessfulDeployment();
-
- AllottedResourceCustomization arc = new AllottedResourceCustomization();
- arc.setModelCustomizationUuid("modelCustomizationUuid");
- List<AllottedResourceCustomization> allottedResources = new ArrayList<>();
- allottedResources.add(arc);
-
- NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- nrc.setModelCustomizationUuid("modelCustomizationUuid");
- List<NetworkResourceCustomization> networkResources = new ArrayList<>();
- networkResources.add(nrc);
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<AllottedResourceCustomization> getAllAllottedResourcesByServiceModelUuid(
- String serviceModelUuid) {
- return allottedResources;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) {
- return networkResources;
- }
- };
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill() throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
-
- }
-
- @Test
- public void isResourceAlreadyDeployedAllotedResourceTest() {
- Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getCategory()).thenReturn("Allotted Resource");
- ToscaResourceInstaller tri = new ToscaResourceInstaller();
-
- try {
- tri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
- }
-
- @Test(expected=Exception.class)
- @Ignore // 1802 merge
- public void installTheResourceTest() {
-
- /*
- * COMMENTED OUT BECAUSE IT DOES NOT COMPILE IN ONAP JENKINS BUILD
- *
- ToscaResourceStructure trs = new ToscaResourceStructure();
- trs.getAllottedResource();
- trs.getAllottedList();
- trs.getCatalogAllottedResourceCustomization();
- trs.getCatalogAllottedServiceToResourceCustomization();
- trs.getCatalogNetworkResource();
- trs.getCatalogNetworkResourceCustomization();
- trs.getCatalogResourceCustomization();
- trs.getCatalogService();
- trs.getCatalogTempNetworkHeatTemplateLookup();
- trs.getCatalogToscaCsar();
- trs.getCatalogVfModule();
- trs.getCatalogVfModuleCustomization();
- trs.getCatalogVfModuleToHeatFiles();
- trs.getCatalogVfServiceToResourceCustomization();
- trs.getCatalogVlServiceToResourceCustomization();
- trs.getCatalogVnfResCustomToVfModuleCustom();
- trs.getCatalogVnfResource();
- trs.getCatalogVnfResourceCustomization();
- trs.getEnvHeatTemplateUUID();
- trs.getHeatFilesUUID();
- trs.getHeatTemplateUUID();
- trs.getNetworkTypes();
- trs.getSdcCsarHelper();
- trs.getServiceMetadata();
- trs.getServiceToResourceCustomization();
- trs.getServiceVersion();
- trs.getToscaArtifact();
- trs.getVfTypes();
- trs.getVolHeatEnvTemplateUUID();
- trs.getVolHeatTemplateUUID();
-
- NodeTemplate nodeTemplate = Mockito.mock(NodeTemplate.class);
- List<NodeTemplate> alnt = new ArrayList<>();
- trs.setAllottedList(alnt);
- trs.setAllottedResource(new AllottedResource());
- trs.setCatalogAllottedResourceCustomization(new AllottedResourceCustomization());
- trs.setCatalogAllottedServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setCatalogNetworkResource(new NetworkResource());
- trs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
- trs.setCatalogResourceCustomization(new AllottedResourceCustomization());
- trs.setCatalogService(new Service());
- trs.setCatalogTempNetworkHeatTemplateLookup(new TempNetworkHeatTemplateLookup());
- trs.setCatalogToscaCsar(new ToscaCsar());
- trs.setCatalogVfModule(new VfModule());
- trs.setCatalogVfModuleCustomization(new VfModuleCustomization());
- trs.setCatalogVfModuleToHeatFiles(new VfModuleToHeatFiles());
- trs.setCatalogVfServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setCatalogVlServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setCatalogVnfResCustomToVfModuleCustom(new VnfResCustomToVfModuleCustom());
- trs.setCatalogVnfResource(new VnfResource());
- trs.setCatalogVnfResourceCustomization(new VnfResourceCustomization());
- trs.setEnvHeatTemplateUUID("envHeatTemplateUUID");
- trs.setHeatFilesUUID("heatFilesUUID");
- trs.setHeatTemplateUUID("heatTemplateUUID");
- trs.setNetworkTypes(alnt);
- trs.setVolHeatTemplateUUID("volHeatTemplateUUID");
- trs.setSdcCsarHelper(new ISdcCsarHelper() {
-
- @Override
- public List<NodeTemplate> getGroupMembersFromTopologyTemplate(String arg0) {
- return null;
- }
-
- @Override
- public List<Map<String, Object>> getGroupsOfOriginOfNodeTemplate(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<Map<String,Map<String,Object>>> getGroupsOfTopologyTemplateByToscaGroupType(String arg0) {
- return null;
- }
-
- @Override
- public List<Map<String,Map<String,Object>>> getGroupsOfTopologyTemplate() {
- return null;
- }
-
- @Override
- public List<Map<String,Map<String,Object>>> getPoliciesOfTargetByToscaPolicyType(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<Map<String,Map<String,Object>>> getPoliciesOfTarget(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public NodeTemplate getNodeTemplateByName(String arg0) {
- return null;
- }
-
- @Override
- public List<Map<String,Object>> getPolicyTargetsFromOrigin(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getPolicyTargetsFromTopologyTemplate(String arg0) {
- return null;
- }
-
- @Override
- public List<Map<String,Object>> getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<Map<String,Object>> getPoliciesOfOriginOfNodeTemplate(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<Map<String,Map<String,Object>>> getPoliciesOfTopologyTemplateByToscaPolicyType(String arg0) {
- return null;
- }
-
- @Override
- public List<Map<String,Map<String,Object>>> getPoliciesOfTopologyTemplate() {
- return null;
- }
-
- ////////////////////////////////
-
- @Override
- public boolean hasTopology(NodeTemplate arg0) {
- return false;
- }
-
- @Override
- public NodeTemplate getVnfConfig(String arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getVfcListByVf(String arg0) {
- return null;
- }
-
- @Override
- public List<Group> getVfModulesByVf(String arg0) {
- return null;
- }
-
- @Override
- public String getTypeOfNodeTemplate(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceVlList() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceVfList() {
- return null;
- }
-
- @Override
- public String getServiceSubstitutionMappingsTypeName() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceNodeTemplatesByType(String arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceNodeTemplates() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getServiceNodeTemplateBySdcType(SdcTypes arg0) {
- return null;
- }
-
- @Override
- public Map<String, Object> getServiceMetadataProperties() {
- return null;
- }
-
- @Override
- public Metadata getServiceMetadata() {
- return null;
- }
-
- @Override
- public List<Input> getServiceInputs() {
- return null;
- }
-
- @Override
- public Object getServiceInputLeafValueOfDefaultAsObject(String arg0) {
- return null;
- }
-
- @Override
- public String getServiceInputLeafValueOfDefault(String arg0) {
- return null;
- }
-
- @Override
- public String getNodeTemplatePropertyLeafValue(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public Object getNodeTemplatePropertyAsObject(NodeTemplate arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<Pair<NodeTemplate, NodeTemplate>> getNodeTemplatePairsByReqName(List<NodeTemplate> arg0,
- List<NodeTemplate> arg1, String arg2) {
- return null;
- }
-
- @Override
- public String getNodeTemplateCustomizationUuid(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getNodeTemplateChildren(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getNodeTemplateBySdcType(NodeTemplate arg0, SdcTypes arg1) {
- return null;
- }
-
- @Override
- public String getMetadataPropertyValue(Metadata arg0, String arg1) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getMembersOfVfModule(NodeTemplate arg0, Group arg1) {
- return null;
- }
-
- @Override
- public String getGroupPropertyLeafValue(Group arg0, String arg1) {
- return null;
- }
-
- @Override
- public Object getGroupPropertyAsObject(Group arg0, String arg1) {
- return null;
- }
-
- @Override
- public Map<String, Map<String, Object>> getCpPropertiesFromVfcAsObject(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public Map<String, Map<String, Object>> getCpPropertiesFromVfc(NodeTemplate arg0) {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getCpListByVf(String arg0) {
- return null;
- }
-
- @Override
- public String getConformanceLevel() {
- return null;
- }
-
- @Override
- public List<NodeTemplate> getAllottedResources() {
- return null;
- }
-
- @Override
- public Map<String, String> filterNodeTemplatePropertiesByValue(NodeTemplate arg0, FilterType arg1,
- String arg2) {
- return null;
- }
-
- @Override
- public CapabilityAssignments getCapabilitiesOf(NodeTemplate arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getCapabilityPropertyLeafValue(CapabilityAssignment arg0, String arg1) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Metadata getNodeTemplateMetadata(NodeTemplate arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public RequirementAssignments getRequirementsOf(NodeTemplate arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Map<String, String> getServiceMetadataAllProperties() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public NodeTemplate getServiceNodeTemplateByNodeName(String arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- });
- // trs.setServiceMetadata(new Metadata(new HashMap<>()));
- trs.setServiceToResourceCustomization(new ServiceToResourceCustomization());
- trs.setServiceVersion("1.0");
- trs.setToscaArtifact(new IArtifactInfo() {
-
- @Override
- public List<IArtifactInfo> getRelatedArtifacts() {
- return null;
- }
-
- @Override
- public IArtifactInfo getGeneratedArtifact() {
- return null;
- }
-
- @Override
- public String getArtifactVersion() {
- return null;
- }
-
- @Override
- public String getArtifactUUID() {
- return null;
- }
-
- @Override
- public String getArtifactURL() {
- return null;
- }
-
- @Override
- public String getArtifactType() {
- return null;
- }
-
- @Override
- public Integer getArtifactTimeout() {
- return null;
- }
-
- @Override
- public String getArtifactName() {
- return null;
- }
-
- @Override
- public String getArtifactDescription() {
- return null;
- }
-
- @Override
- public String getArtifactChecksum() {
- return null;
- }
- });
- trs.setVfTypes(alnt);
- trs.setVnfAlreadyInstalled(true);
- trs.setVolHeatEnvTemplateUUID("volHeatEnvTemplateUUID");
- trs.isVnfAlreadyInstalled();
-
- try{
- trs.updateResourceStructure(artifactInfo1);
-
- }catch(Exception e){}
-
- ToscaResourceInstaller tri = new ToscaResourceInstaller();
-
- try {
- tri.installTheResource(trs, vrs);
- } catch (ArtifactInstallerException e) {
- }
- */
- }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java
deleted file mode 100644
index 82c2e82..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/heat/tests/VfResourceInstallerTest.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.installer.heat.tests;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.codec.binary.Base64;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException;
-import org.openecomp.mso.asdc.client.ASDCControllerTest;
-import org.openecomp.mso.asdc.installer.VfResourceStructure;
-import org.openecomp.mso.asdc.installer.heat.VfResourceInstaller;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources;
-import org.openecomp.mso.db.catalog.beans.ServiceToNetworks;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-
-import mockit.Mock;
-import mockit.MockUp;
-
-public class VfResourceInstallerTest {
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static String heatExample;
- private static String heatExampleMD5HashBase64;
-
- private static INotificationData iNotif;
-
- private static IDistributionClientDownloadResult downloadResult;
- private static IDistributionClientDownloadResult downloadCorruptedResult;
-
- private static IDistributionClientResult successfulClientInitResult;
- private static IDistributionClientResult unsuccessfulClientInitResult;
-
- private static IDistributionClient distributionClient;
-
- private static IArtifactInfo artifactInfo1;
-
- private static IResourceInstance resource1;
-
- private static VfResourceStructure vrs;
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString()
- .substring(5);
- public static final String ASDC_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json").toString()
- .substring(5);
- public static final String ASDC_PROP3 = MsoJavaProperties.class.getClassLoader().getResource("mso3.json").toString()
- .substring(5);
- public static final String ASDC_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
- .toString().substring(5);
- public static final String ASDC_PROP_WITH_NULL = MsoJavaProperties.class.getClassLoader()
- .getResource("mso-with-NULL.json").toString().substring(5);
-
- @BeforeClass
- public static final void prepareMockNotification() throws MsoPropertiesException, IOException, URISyntaxException,
- NoSuchAlgorithmException, ArtifactInstallerException {
-
- heatExample = new String(Files.readAllBytes(Paths.get(
- ASDCControllerTest.class.getClassLoader().getResource("resource-examples/autoscaling.yaml").toURI())));
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5Hash = md.digest(heatExample.getBytes());
- heatExampleMD5HashBase64 = Base64.encodeBase64String(md5Hash);
-
- iNotif = Mockito.mock(INotificationData.class);
-
- // Create fake ArtifactInfo
- artifactInfo1 = Mockito.mock(IArtifactInfo.class);
- Mockito.when(artifactInfo1.getArtifactChecksum()).thenReturn(VfResourceInstallerTest.heatExampleMD5HashBase64);
-
- Mockito.when(artifactInfo1.getArtifactName()).thenReturn("artifact1");
- Mockito.when(artifactInfo1.getArtifactType()).thenReturn(ASDCConfiguration.HEAT);
- Mockito.when(artifactInfo1.getArtifactURL())
- .thenReturn("https://localhost:8080/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- Mockito.when(artifactInfo1.getArtifactUUID()).thenReturn("UUID1");
- Mockito.when(artifactInfo1.getArtifactDescription()).thenReturn("testos artifact1");
-
- distributionClient = Mockito.mock(IDistributionClient.class);
-
- // Now provision the NotificationData mock
- List<IArtifactInfo> listArtifact = new ArrayList<>();
- listArtifact.add(artifactInfo1);
-
- // Create fake resource Instance
- resource1 = Mockito.mock(IResourceInstance.class);
-// Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getResourceName()).thenReturn("resourceName");
- Mockito.when(resource1.getArtifacts()).thenReturn(listArtifact);
-
- List<IResourceInstance> resources = new ArrayList<>();
- resources.add(resource1);
-
- Mockito.when(iNotif.getResources()).thenReturn(resources);
- Mockito.when(iNotif.getDistributionID()).thenReturn("distributionID1");
- Mockito.when(iNotif.getServiceName()).thenReturn("serviceName1");
- Mockito.when(iNotif.getServiceUUID()).thenReturn("serviceNameUUID1");
- Mockito.when(iNotif.getServiceVersion()).thenReturn("1.0");
-
- downloadResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadResult.getArtifactPayload()).thenReturn(heatExample.getBytes());
- Mockito.when(downloadResult.getDistributionActionResult()).thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadResult.getDistributionMessageResult()).thenReturn("Success");
-
- downloadCorruptedResult = Mockito.mock(IDistributionClientDownloadResult.class);
- Mockito.when(downloadCorruptedResult.getArtifactPayload()).thenReturn((heatExample + "badone").getBytes());
- Mockito.when(downloadCorruptedResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
- Mockito.when(downloadCorruptedResult.getDistributionMessageResult()).thenReturn("Success");
-
- vrs = new VfResourceStructure(iNotif, resource1);
- try {
- vrs.addArtifactToStructure(distributionClient, artifactInfo1, downloadResult);
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- try {
- vrs.createVfModuleStructures();
- } catch (ArtifactInstallerException e) {
- e.printStackTrace();
- }
- vrs.getNotification();
- vrs.getArtifactsMapByUUID();
- vrs.getCatalogNetworkResourceCustomization();
- vrs.getCatalogResourceCustomization();
- vrs.getCatalogService();
- vrs.getCatalogServiceToAllottedResources();
- vrs.getCatalogServiceToNetworks();
- vrs.getCatalogVnfResource();
- vrs.getResourceInstance();
- vrs.getVfModulesStructureList();
- vrs.getVfModuleStructure();
- vrs.setCatalogNetworkResourceCustomization(new NetworkResourceCustomization());
- vrs.setCatalogResourceCustomization(new AllottedResourceCustomization());
- vrs.setCatalogService(new Service());
- vrs.setCatalogServiceToAllottedResources(new ServiceToAllottedResources());
- vrs.setCatalogServiceToNetworks(new ServiceToNetworks());
- vrs.setCatalogVnfResource(new VnfResource());
- vrs.setSuccessfulDeployment();
-
- AllottedResourceCustomization arc= new AllottedResourceCustomization();
- arc.setModelCustomizationUuid("modelCustomizationUuid");
- List<AllottedResourceCustomization> allottedResources = new ArrayList<>();
- allottedResources.add(arc);
-
- NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- nrc.setModelCustomizationUuid("modelCustomizationUuid");
- List<NetworkResourceCustomization> networkResources = new ArrayList<>();
- networkResources.add(nrc);
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<AllottedResourceCustomization> getAllAllottedResourcesByServiceModelUuid(String serviceModelUuid) {
- return allottedResources;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<NetworkResourceCustomization> getAllNetworksByServiceModelUuid(String serviceModelUuid) {
- return networkResources;
- }
- };
-
- // Mock now the ASDC distribution client behavior
- successfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(successfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.SUCCESS);
-
- unsuccessfulClientInitResult = Mockito.mock(IDistributionClientResult.class);
- Mockito.when(unsuccessfulClientInitResult.getDistributionActionResult())
- .thenReturn(DistributionActionResultEnum.GENERAL_ERROR);
-
- }
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill() throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
-
- }
-
- @Test
- public void isResourceAlreadyDeployedAllotedResourceTest() {
-
- Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getCategory()).thenReturn("Allotted Resource");
- VfResourceInstaller vfri = new VfResourceInstaller();
-
- try {
- vfri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
-
- }
-
- @Test
- public void isResourceAlreadyDeployedTest() {
-
- Mockito.when(resource1.getResourceType()).thenReturn("VF");
- Mockito.when(resource1.getCategory()).thenReturn("Not Allotted Resource");
- VfResourceInstaller vfri = new VfResourceInstaller();
-
- try {
- vfri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
-
- }
- @Test
- public void isResourceAlreadyDeployedDuplicateNtwrkTest() {
-
- Mockito.when(resource1.getResourceType()).thenReturn("VL");
- Mockito.when(resource1.getCategory()).thenReturn("Not Allotted Resource");
- VfResourceInstaller vfri = new VfResourceInstaller();
-
- try {
- vfri.isResourceAlreadyDeployed(vrs);
- } catch (ArtifactInstallerException e) {
- }
-
- }
-
- @Test(expected=Exception.class)
- public void installTheResourceTest() {
- VfResourceInstaller vfri = new VfResourceInstaller();
- try {
- vfri.installTheResource(vrs);
- } catch (ArtifactInstallerException e) {
- }
- }
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImplTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImplTest.java
deleted file mode 100644
index f61488b..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImplTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.tenantIsolation;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class AaiClientPropertiesImplTest {
-
- private static final String ASDC_CLIENTS_PROP =
- MsoJavaProperties.class.getClassLoader().getResource("mso.asdc.clients.properties").toString().substring(5);
-
- @Test
- public void testGetEndpoint() throws Exception {
-
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(AsdcPropertiesUtils.MSO_ASDC_CLIENTS, this.ASDC_CLIENTS_PROP);
-
- AaiClientPropertiesImpl aaiPropertiesImpl = new AaiClientPropertiesImpl();
- String aaiEndpoint = aaiPropertiesImpl.getEndpoint().toString();
-
- assertEquals("AAI endpoint", "http://localhost:28090", aaiEndpoint);
-
- }
-
-}
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/tenantIsolation/WatchdogDistributionTest.java
deleted file mode 100644
index 2e5c4c8..0000000
--- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/tenantIsolation/WatchdogDistributionTest.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.asdc.tenantIsolation;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openecomp.mso.asdc.client.ASDCConfiguration;
-import org.openecomp.mso.client.aai.AAIResourcesClient;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatus;
-import org.openecomp.mso.requestsdb.WatchdogComponentDistributionStatusDb;
-import org.openecomp.mso.requestsdb.WatchdogDistributionStatusDb;
-import org.openecomp.mso.requestsdb.WatchdogServiceModVerIdLookupDb;
-
-public class WatchdogDistributionTest {
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.asdc.json").toString().substring(5);
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- @Before
- public final void initBeforeEachTest() throws MsoPropertiesException {
- // load the config
- msoPropertiesFactory.removeAllMsoProperties();
- msoPropertiesFactory.initializeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC, ASDC_PROP);
- }
-
- @AfterClass
- public static final void kill () throws MsoPropertiesException {
-
- msoPropertiesFactory.removeMsoProperties(ASDCConfiguration.MSO_PROP_ASDC);
- }
-
- @Test
- @Ignore // 1802 merge
- public void testGetOverallDistributionStatusSuccess() {
- WatchdogDistribution distribution = new WatchdogDistribution();
- WatchdogDistributionStatusDb watchdogDisdb = mock(WatchdogDistributionStatusDb.class);
- WatchdogComponentDistributionStatusDb watchdogComp = mock(WatchdogComponentDistributionStatusDb.class);
-
- distribution.setWatchdogDistDb(watchdogDisdb);
- distribution.setWatchdogCompDistDb(watchdogComp);
- try {
- WatchdogComponentDistributionStatus watchDogDisStatus1 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus1.setComponentDistributionStatus("SUCCESS");
- watchDogDisStatus1.setComponentName("AAI");
-
- WatchdogComponentDistributionStatus watchDogDisStatus2 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus2.setComponentDistributionStatus("SUCCESS");
- watchDogDisStatus2.setComponentName("APP");
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<>();
- results.add(watchDogDisStatus1);
- results.add(watchDogDisStatus2);
-
- when(watchdogDisdb.getWatchdogDistributionIdStatus(any(String.class))).thenReturn(null);
- when(watchdogComp.getWatchdogComponentDistributionStatus(any(String.class))).thenReturn(results);
- doNothing().when(watchdogDisdb).updateWatchdogDistributionIdStatus(any(String.class), any(String.class));
-
- String result = distribution.getOverallDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7fe");
-
- assertEquals("SUCCESS", result);
- } catch (Exception e) {
- fail("Unexpected result");
- }
- }
-
- @Test
- @Ignore // 1802 merge
- public void testGetOverallDistributionStatusFailure() {
- WatchdogDistribution distribution = new WatchdogDistribution();
- WatchdogDistributionStatusDb watchdogDisdb = mock(WatchdogDistributionStatusDb.class);
- WatchdogComponentDistributionStatusDb watchdogComp = mock(WatchdogComponentDistributionStatusDb.class);
-
- distribution.setWatchdogDistDb(watchdogDisdb);
- distribution.setWatchdogCompDistDb(watchdogComp);
-
- try {
- WatchdogComponentDistributionStatus watchDogDisStatus1 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus1.setComponentDistributionStatus("SUCCESS");
- watchDogDisStatus1.setComponentName("AAI");
-
- WatchdogComponentDistributionStatus watchDogDisStatus2 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus2.setComponentDistributionStatus("FAILURE");
- watchDogDisStatus2.setComponentName("APP");
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<>();
- results.add(watchDogDisStatus1);
- results.add(watchDogDisStatus2);
-
- when(watchdogDisdb.getWatchdogDistributionIdStatus(any(String.class))).thenReturn(null);
- when(watchdogComp.getWatchdogComponentDistributionStatus(any(String.class))).thenReturn(results);
- doNothing().when(watchdogDisdb).updateWatchdogDistributionIdStatus(any(String.class), any(String.class));
-
- String result = distribution.getOverallDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7fe");
-
- assertEquals("FAILURE", result);
- } catch (Exception e) {
- fail("Unexpected result");
- }
- }
-
- @Test
- public void testGetOverallDistributionStatusException() {
- WatchdogDistribution distribution = new WatchdogDistribution();
- WatchdogDistributionStatusDb watchdogDisdb = mock(WatchdogDistributionStatusDb.class);
- WatchdogComponentDistributionStatusDb watchdogComp = mock(WatchdogComponentDistributionStatusDb.class);
-
- distribution.setWatchdogDistDb(watchdogDisdb);
- distribution.setWatchdogCompDistDb(watchdogComp);
- try {
- WatchdogComponentDistributionStatus watchDogDisStatus1 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus1.setComponentDistributionStatus("SUCCESS");
- watchDogDisStatus1.setComponentName("AAI");
-
- WatchdogComponentDistributionStatus watchDogDisStatus2 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus2.setComponentDistributionStatus("TESTING");
- watchDogDisStatus2.setComponentName("APP");
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<>();
- results.add(watchDogDisStatus1);
- results.add(watchDogDisStatus2);
-
- when(watchdogDisdb.getWatchdogDistributionIdStatus(any(String.class))).thenReturn(null);
- when(watchdogComp.getWatchdogComponentDistributionStatus(any(String.class))).thenReturn(results);
- doNothing().when(watchdogDisdb).updateWatchdogDistributionIdStatus(any(String.class), any(String.class));
-
- distribution.getOverallDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7fe");
-
- } catch (Exception e) {
- assertTrue(e.getMessage().contains("Invalid Component distribution status:"));
- }
- }
-
- @Test
- @Ignore // 1802 merge
- public void testGetOverallDistributionStatusIncomplete() {
- WatchdogDistribution distribution = new WatchdogDistribution();
- WatchdogDistributionStatusDb watchdogDisdb = mock(WatchdogDistributionStatusDb.class);
- WatchdogComponentDistributionStatusDb watchdogComp = mock(WatchdogComponentDistributionStatusDb.class);
-
- distribution.setWatchdogDistDb(watchdogDisdb);
- distribution.setWatchdogCompDistDb(watchdogComp);
- try {
- WatchdogComponentDistributionStatus watchDogDisStatus1 = new WatchdogComponentDistributionStatus();
- watchDogDisStatus1.setComponentDistributionStatus("SUCCESS");
- watchDogDisStatus1.setComponentName("AAI");
-
- List<WatchdogComponentDistributionStatus> results = new ArrayList<>();
- results.add(watchDogDisStatus1);
-
- when(watchdogDisdb.getWatchdogDistributionIdStatus(any(String.class))).thenReturn(null);
- when(watchdogComp.getWatchdogComponentDistributionStatus(any(String.class))).thenReturn(results);
-
- String result = distribution.getOverallDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7fe");
-
- assertEquals("INCOMPLETE", result);
- } catch (Exception e) {
- fail("Unexpected result");
- }
- }
-
- @Test
- public void testGetOverallDistributionStatusTimeout() {
- WatchdogDistribution distribution = new WatchdogDistribution();
- WatchdogDistributionStatusDb watchdogDisdb = mock(WatchdogDistributionStatusDb.class);
-
- distribution.setWatchdogDistDb(watchdogDisdb);
- try {
- when(watchdogDisdb.getWatchdogDistributionIdStatus(any(String.class))).thenReturn("timeout");
-
- String result = distribution.getOverallDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7fe");
-
- assertEquals("TIMEOUT", result);
- } catch (Exception e) {
- fail("Unexpected result");
- }
- }
-
- @Test
- @Ignore // 1802 merge
- public void testExecutePatchAAI() throws Exception {
- WatchdogDistribution distribution = new WatchdogDistribution();
- WatchdogServiceModVerIdLookupDb serviceLookupDb = mock(WatchdogServiceModVerIdLookupDb.class);
- CatalogDatabase catalogDb = mock(CatalogDatabase.class);
- AAIResourcesClient aaiClient = mock(AAIResourcesClient.class);
-
- Service service = new Service();
- service.setModelInvariantUUID("modelInvariantUUID");
-
- when(serviceLookupDb.getWatchdogServiceModVerId(any(String.class))).thenReturn("ff3514e3-5a33-55df");
- when(catalogDb.getServiceByModelUUID(any(String.class))).thenReturn(service);
- doNothing().when(aaiClient).update(any(AAIResourceUri.class), any(Object.class));
-
- distribution.setAaiClient(aaiClient);
- distribution.setCatalogDb(catalogDb);
- distribution.setWatchdogSerlookupDb(serviceLookupDb);
- distribution.executePatchAAI("ff3514e3-5a33-55df-13ab-12abad84e7fe", "model-id", "SUCCESS");
-
- verify(aaiClient, times(1)).update(any(AAIResourceUri.class), any(Object.class));
- }
-
- @Test
- @Ignore // 1802 merge
- public void testExecutePatchAAIException() throws Exception {
- WatchdogDistribution distribution = new WatchdogDistribution();
- CatalogDatabase catalogDb = mock(CatalogDatabase.class);
- WatchdogServiceModVerIdLookupDb serviceLookupDb = mock(WatchdogServiceModVerIdLookupDb.class);
-
- when(serviceLookupDb.getWatchdogServiceModVerId(any(String.class))).thenReturn("ff3514e3-5a33-55df");
- when(catalogDb.getServiceByModelUUID(any(String.class))).thenReturn(null);
-
- try {
- distribution.setCatalogDb(catalogDb);
- distribution.setWatchdogSerlookupDb(serviceLookupDb);
- distribution.executePatchAAI("ff3514e3-5a33-55df-13ab-12abad84e7fe", "model-id", "SUCCESS");
- } catch(Exception e) {
- assertTrue(e.getMessage().contains("No Service found with serviceModelVersionId:"));
- }
- }
-}
diff --git a/asdc-controller/src/test/resources/ASDC/.gitignore b/asdc-controller/src/test/resources/ASDC/.gitignore
new file mode 100644
index 0000000..e54786b
--- /dev/null
+++ b/asdc-controller/src/test/resources/ASDC/.gitignore
@@ -0,0 +1 @@
+/*.csar
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
new file mode 100644
index 0000000..99ca630
--- /dev/null
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -0,0 +1,88 @@
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+
+server-port: 8080
+ssl-enable: false
+
+
+
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/catalogdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ initialization-mode: never
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+ security:
+ usercredentials:
+ -
+ username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: Asdc-Client
+
+mariaDB4j:
+ dataDir:
+ port: 3307
+ databaseName: catalogdb
+ databaseName2: requestdb
+
+request:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/requestdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+
+
+#Actuator
+management:
+ endpoints:
+ enabled-by-default: false
+ endpoint:
+ info:
+ enabled: true
+
+mso:
+ logPath: logs
+ catalog:
+ db:
+ spring:
+ endpoint: "http://localhost:"
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ site-name: siteName
+ asdc-connections:
+ asdc-controller1:
+ user: msopreist
+ consumerGroup: msoasdc-id-local
+ consumerId: msoasdc-id-local
+ environmentName: Pre-IST
+ asdcAddress: localhost:8443
+ password: 658D6E9E0C087547284339181615C358
+ pollingInterval: 30
+ pollingTimeout: 30
+ relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
+ activateServerTLSAuth: false
+ keyStorePassword:
+ keyStorePath:
+ watchDogTimeout: 1
+ isFilterInEmptyResources: true
+ messageBusAddress: localhost,localhost
+ asdc:
+ config:
+ key: 566B754875657232314F5548556D3665
+ components:
+ count: 3,
+ componentNames: SO,AAI,SDNC
+ scheduling:
+ enabled: false
+ aai:
+ endpoint: http://localhost:${wiremock.server.port}
diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql
new file mode 100644
index 0000000..681ee3b
--- /dev/null
+++ b/asdc-controller/src/test/resources/data.sql
@@ -0,0 +1,64 @@
+use catalogdb;
+
+insert into heat_template(artifact_uuid, name, version, description, body, timeout_minutes, artifact_checksum, creation_timestamp) values ('ff874603-4222-11e7-9252-005056850d2e', 'module_mns_zrdm3frwl01exn_01_rgvm_1.yml', '1', 'created from csar', 'heat_template_version: 2013-05-23 description: heat template that creates TEST VNF parameters: TEST_server_name: type: string label: TEST server name description: TEST server name TEST_image_name: type: string label: image name description: TEST image name TEST_flavor_name: type: string label: TEST flavor name description: flavor name of TEST instance TEST_Role_net_name: type: string label: TEST network name description: TEST network name TEST_vnf_id: type: string label: TEST VNF Id description: TEST VNF Id resources:TEST: type: OS::Nova::Server properties: name: { get_param: TEST_server_name } image: { get_param: TEST_image_name } flavor: { get_param: TEST_flavor_name } networks: - port: { get_resource: TEST_port_0} metadata: vnf_id: {get_param: TEST_vnf_id} TEST_port_0: type: OS::Neutron::Port properties: network: { get_param: TEST_Role_net_name }', '60', 'MANUAL RECORD', '2017-01-21 23:26:56');
+
+insert into temp_network_heat_template_lookup(network_resource_model_name, heat_template_artifact_uuid, aic_version_min, aic_version_max) values
+('CONTRAIL30_GNDIRECT', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('MSO_Example', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('ExtVL', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('AIC30_CONTRAIL_BASIC', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3'),
+('CONTRAIL30_BASIC', 'ff874603-4222-11e7-9252-005056850d2e', '3', '3');
+
+insert into network_resource(model_uuid, model_name, model_invariant_uuid, description, heat_template_artifact_uuid, neutron_network_type, model_version, tosca_node_type, aic_version_min, aic_version_max, orchestration_mode, creation_timestamp) values
+('10b36f65-f4e6-4be6-ae49-9596dc1c47fc', 'CONTRAIL30_GNDIRECT', 'ce4ff476-9641-4e60-b4d5-b4abbec1271d', 'Contrail 30 GNDIRECT NW', 'ff874603-4222-11e7-9252-005056850d2e', 'BASIC', '1.0', '', '3.0', '', 'HEAT', '2017-01-17 20:35:05');
+
+insert into network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, creation_timestamp, network_resource_model_uuid) values
+('3bdbb104-476c-483e-9f8b-c095b3d308ac', 'CONTRAIL30_GNDIRECT 9', '', '', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c47fc');
+
+
+
+INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES
+('TENANT_OAM_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL);
+INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES
+('SRIOV_PROVIDER_NETWORK', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL);
+
+
+--------START Request DB INSERTS --------
+insert into requestdb.watchdog_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS) values
+('watchdogTestStatusSuccess', 'SUCCESS'),
+('watchdogTestStatusFailure', 'FAILURE'),
+('watchdogTestStatusTimeout', 'TIMEOUT'),
+('watchdogTestStatusIncomplete', 'INCOMPLETE'),
+('watchdogTestStatusException', 'EXCEPTION'),
+('watchdogTestStatusNull', 'NULL'),
+('testStatusSuccessTosca', 'SUCCESS'),
+('testStatusFailureTosca', 'FAILURE'),
+('testStatusTimeoutTosca', 'TIMEOUT'),
+('testStatusIncompleteTosca', 'INCOMPLETE'),
+('testStatusExceptionTosca', 'EXCEPTION'),
+('testStatusNullTosca', 'NULL');
+
+--WatchdogDistrubutionTest
+insert into requestdb.watchdog_per_component_distribution_status(DISTRIBUTION_ID, COMPONENT_NAME, COMPONENT_DISTRIBUTION_STATUS) values
+('watchdogTestStatusSuccess', 'SO', 'COMPONENT_DONE_OK'),
+('watchdogTestStatusSuccess', 'AAI', 'COMPONENT_DONE_OK'),
+('watchdogTestStatusSuccess', 'SDNC', 'COMPONENT_DONE_OK'),
+('watchdogTestStatusFailure', 'SO', 'COMPONENT_DONE_ERROR'),
+('watchdogTestStatusFailure', 'AAI', 'COMPONENT_DONE_ERROR'),
+('watchdogTestStatusFailure', 'SDNC', 'COMPONENT_DONE_ERROR'),
+('watchdogTestStatusException', 'SO', 'COMPONENT_MALFORMED'),
+('watchdogTestStatusException', 'AAI', 'COMPONENT_MALFORMED'),
+('watchdogTestStatusException', 'SDNC', 'COMPONENT_MALFORMED'),
+('testStatusSuccessTosca', 'SO', 'COMPONENT_DONE_OK'),
+('testStatusSuccessTosca', 'AAI', 'COMPONENT_DONE_OK'),
+('testStatusSuccessTosca', 'SDNC', 'COMPONENT_DONE_OK'),
+('testStatusFailureTosca', 'SO', 'COMPONENT_DONE_ERROR'),
+('testStatusFailureTosca', 'AAI', 'COMPONENT_DONE_ERROR'),
+('testStatusFailureTosca', 'SDNC', 'COMPONENT_DONE_ERROR'),
+('testStatusExceptionTosca', 'SO', 'COMPONENT_MALFORMED'),
+('testStatusExceptionTosca', 'AAI', 'COMPONENT_MALFORMED'),
+('testStatusExceptionTosca', 'SDNC', 'COMPONENT_MALFORMED');
+
+insert into requestdb.watchdog_service_mod_ver_id_lookup(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID) values
+('watchdogTestStatusSuccess', '5df8b6de-2083-11e7-93ae-92361f002671'),
+('watchdogTestStatusNull', '00000000-0000-0000-0000-000000000000');
diff --git a/asdc-controller/src/test/resources/logback-test.xml b/asdc-controller/src/test/resources/logback-test.xml
index a23395f..d74de50 100644
--- a/asdc-controller/src/test/resources/logback-test.xml
+++ b/asdc-controller/src/test/resources/logback-test.xml
@@ -1,47 +1,39 @@
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<configuration >
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
- </encoder>
- </appender>
+<configuration>
- <logger name="com.att.eelf.audit" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
+ %logger{1024} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+
+ <logger name="com.att.ecomp.audit" level="info" additivity="false">
<appender-ref ref="STDOUT" />
- </logger>
+ </logger>
- <logger name="com.att.eelf.error" level="trace" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <root level="info">
- <appender-ref ref="STDOUT" />
- </root>
-
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
-</configuration>
+ <logger name="org.onap" level="${so.log.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" />
+ </root>
+
+
+</configuration>
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/mso-with-NULL.json b/asdc-controller/src/test/resources/mso-with-NULL.json
index df215e6..aeb740f 100644
--- a/asdc-controller/src/test/resources/mso-with-NULL.json
+++ b/asdc-controller/src/test/resources/mso-with-NULL.json
@@ -9,9 +9,9 @@
"password": "1c551b8b5ab91fcd5a0907b11c304199",
"watchDogTimeout": "300",
"messageBusAddress": [
- "uebsb91sfdc.it.att.com",
- "uebsb92sfdc.it.att.com",
- "uebsb93sfdc.it.att.com"
+ "localhost",
+ "localhost",
+ "localhost"
],
"pollingInterval":10,
"pollingTimeout":30
diff --git a/asdc-controller/src/test/resources/mso.asdc.clients.properties b/asdc-controller/src/test/resources/mso.asdc.clients.properties
index e434dca..05c4c0d 100644
--- a/asdc-controller/src/test/resources/mso.asdc.clients.properties
+++ b/asdc-controller/src/test/resources/mso.asdc.clients.properties
@@ -1,3 +1,3 @@
# This is a chef generated properties file! Manual updates will be overridden next chef-client run, ensure desired changes are in mso-config chef cookbook or chef env file.
# tenant isolation
-aai.endpoint=http://localhost:28090
+aai.endpoint=http://localhost:8089
diff --git a/asdc-controller/src/test/resources/mso.asdc.json b/asdc-controller/src/test/resources/mso.asdc.json
index cbc18e8..2112f8e 100644
--- a/asdc-controller/src/test/resources/mso.asdc.json
+++ b/asdc-controller/src/test/resources/mso.asdc.json
@@ -1,5 +1,5 @@
-
-{
- "components.count": 2
-}
-
+
+{
+ "components.count": 2
+}
+
diff --git a/asdc-controller/src/test/resources/mso.json b/asdc-controller/src/test/resources/mso.json
index 6b6b98c..6d3f7a3 100644
--- a/asdc-controller/src/test/resources/mso.json
+++ b/asdc-controller/src/test/resources/mso.json
@@ -9,9 +9,9 @@
"password": "1c551b8b5ab91fcd5a0907b11c304199",
"watchDogTimeout": "300",
"messageBusAddress": [
- "uebsb91sfdc.it.att.com",
- "uebsb92sfdc.it.att.com",
- "uebsb93sfdc.it.att.com"
+ "localhost",
+ "localhost",
+ "localhost"
],
"pollingInterval":10,
"pollingTimeout":30
diff --git a/asdc-controller/src/test/resources/mso4-with-TLS.json b/asdc-controller/src/test/resources/mso4-with-TLS.json
index 825ad5b..e1b32b7 100644
--- a/asdc-controller/src/test/resources/mso4-with-TLS.json
+++ b/asdc-controller/src/test/resources/mso4-with-TLS.json
@@ -12,9 +12,9 @@
"activateServerTLSAuth": true,
"watchDogTimeout": "300",
"messageBusAddress": [
- "uebsb91sfdc.it.att.com",
- "uebsb92sfdc.it.att.com",
- "uebsb93sfdc.it.att.com"
+ "localhost",
+ "localhost",
+ "localhost"
],
"keyStorePassword":"1c551b8b5ab91fcd5a0907b11c304199",
"keyStorePath": "/test"
diff --git a/asdc-controller/src/test/resources/resource-examples/TempNetworkHeat/notification.json b/asdc-controller/src/test/resources/resource-examples/TempNetworkHeat/notification.json
new file mode 100644
index 0000000..68bdd25
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/TempNetworkHeat/notification.json
@@ -0,0 +1,21 @@
+{
+ "distributionID": "e0d3c4b3-bae6-42cd-808c-385bb2ccf6de",
+ "resources": [],
+ "serviceArtifacts": [
+ {
+ "artifactChecksum": "MjI4ZmU3MGM1ZWM5MGQ4YjJkZDczMGUzZDMxN2M4NjY=",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactName": "service-AdigVpeTenantOamNetworkIst-csar.csar",
+ "artifactTimeout": "0",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "service-AdigVpeTenantOamNetworkIst-csar.csar",
+ "artifactUUID": "a218128c-4751-49d0-a74b-f502860033e5",
+ "artifactVersion": "2"
+ }
+ ],
+ "serviceDescription": "ADIG vPE Tenant OAM Network_IST",
+ "serviceInvariantUUID": "f905cea1-3a41-4233-b2d2-be453751b871",
+ "serviceName": "ADIG vPE Tenant OAM Network_IST",
+ "serviceUUID": "0bfd24c7-de9d-4297-8cb5-6f9d4a6c20d8",
+ "serviceVersion": "2.0"
+}
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/TempNetworkHeat/service-AdigVpeTenantOamNetworkIst-csar.csar b/asdc-controller/src/test/resources/resource-examples/TempNetworkHeat/service-AdigVpeTenantOamNetworkIst-csar.csar
new file mode 100644
index 0000000..2828043
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/TempNetworkHeat/service-AdigVpeTenantOamNetworkIst-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/allottedresource/notif-portm.json b/asdc-controller/src/test/resources/resource-examples/allottedresource/notif-portm.json
new file mode 100644
index 0000000..fd8ac7b
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/allottedresource/notif-portm.json
@@ -0,0 +1,36 @@
+{
+ "serviceName": "service1104",
+ "serviceInvariantUUID": "ebcef23d-2ca3-474f-9381-3a15709538f5",
+ "serviceUUID": "9825d984-dfb0-4d2a-b5bd-3abcf477c4dc",
+ "serviceVersion": "1.0",
+ "serviceArtifacts":
+ [{
+ "artifactName": "service-Service1104-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "service-Service1104-csar.csar",
+ "artifactChecksum": "ZDc1MTcxMzk4ODk4N2U5MzMxOTgwMzYzZTI0MTg5Y2U\u003d",
+ "artifactDescription": "TOSCA representation of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "123456-35a8-467f-b440-d0f6226b3516",
+ "artifactVersion": "5.0"
+ }],
+ "resources":
+ [
+ {
+ "resourceInstanceName": "testALTS 0",
+ "resourceInvariantUUID": "51c7fb99-642a-4c02-8d8d-e206fc170b6d",
+ "resourceCustomizationUUID": "364a5635-f63b-45f3-9c3d-14993d996e35",
+ "resourceName": "resourceName-1",
+ "resourceType": "VF",
+ "resourceUUID": "a81db5a3-7c23-4376-8c42-ec610aaea135",
+ "resourceVersion": "2.0",
+ "category": "Allotted Resource",
+ "subcategory": "Common Network Resources",
+ "artifacts":
+ []
+ }
+
+ ],
+ "serviceDescription": "sdfsf",
+ "distributionID": "35120a87-1f82-4276-9735-f6de5a244d65"
+}
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/allottedresource/service-Service1104-csar.csar b/asdc-controller/src/test/resources/resource-examples/allottedresource/service-Service1104-csar.csar
new file mode 100644
index 0000000..c8a4476
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/allottedresource/service-Service1104-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/moduleTest/base_TEST.env b/asdc-controller/src/test/resources/resource-examples/moduleTest/base_TEST.env
new file mode 100644
index 0000000..c72f906
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/moduleTest/base_TEST.env
@@ -0,0 +1,6 @@
+parameters:
+ TEST_Role_net_name:
+ TEST_flavor_name:
+ TEST_image_name:
+ TEST_server_name:
+ TEST_vnf_id:
diff --git a/asdc-controller/src/test/resources/resource-examples/moduleTest/base_TEST.yaml b/asdc-controller/src/test/resources/resource-examples/moduleTest/base_TEST.yaml
new file mode 100644
index 0000000..84f757c
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/moduleTest/base_TEST.yaml
@@ -0,0 +1,44 @@
+heat_template_version: 2013-05-23
+
+description: heat template that creates TEST VNF
+
+parameters:
+ TEST_server_name:
+ type: string
+ label: TEST server name
+ description: TEST server name
+ TEST_image_name:
+ type: string
+ label: image name
+ description: TEST image name
+ TEST_flavor_name:
+ type: string
+ label: TEST flavor name
+ description: flavor name of TEST instance
+
+ TEST_Role_net_name:
+ type: string
+ label: TEST network name
+ description: TEST network name
+ TEST_vnf_id:
+ type: string
+ label: TEST VNF Id
+ description: TEST VNF Id
+
+resources:
+
+ TEST:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: TEST_server_name }
+ image: { get_param: TEST_image_name }
+ flavor: { get_param: TEST_flavor_name }
+ networks:
+ - port: { get_resource: TEST_port_0}
+ metadata:
+ vnf_id: {get_param: TEST_vnf_id}
+
+ TEST_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: TEST_Role_net_name }
diff --git a/asdc-controller/src/test/resources/resource-examples/moduleTest/notif-structure.json b/asdc-controller/src/test/resources/resource-examples/moduleTest/notif-structure.json
new file mode 100644
index 0000000..b2f11c4
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/moduleTest/notif-structure.json
@@ -0,0 +1,67 @@
+{
+ "serviceName": "testALTS1",
+ "serviceInvariantUUID": "155006dc-f0b4-4d6d-b217-72c75e819cdb",
+ "serviceUUID": "3e56620a-1566-4268-8629-58aae07df9e5",
+ "serviceVersion": "2.0",
+ "serviceArtifacts":
+ [{
+ "artifactName": "service-Testalts1-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "service-Testalts1-csar.csar",
+ "artifactChecksum": "NTdjNDdiMTU5YjVkNzQxYjNkZWQ2N2M5YTdiYjQ3MGI=",
+ "artifactDescription": "TOSCA representation of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "9e2c10dc-a3a6-4799-b0a9-a128fbf7a9b1",
+ "artifactVersion": "2.0"
+ }],
+ "resources":
+ [
+ {
+ "resourceInstanceName": "testALTS 0",
+ "resourceInvariantUUID": "51c7fb99-642a-4c02-8d8d-e206fc170b6d",
+ "resourceCustomizationUUID": "364a5635-f63b-45f3-9c3d-14993d996e35",
+ "resourceName": "resourceName-1",
+ "resourceType": "VF",
+ "resourceUUID": "a81db5a3-7c23-4376-8c42-ec610aaea135",
+ "resourceVersion": "2.0",
+ "category": "Network L4+",
+ "subcategory": "Common Network Resources",
+ "artifacts":
+ [
+ {
+ "artifactChecksum": "ZGY5NzliMTI4NDA4NGYyOWIyYTA4N2NmYzZiYWU5MmM=",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactName": "testalts0_modules.json",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "testalts0_modules.json",
+ "artifactUUID": "68be0190-fb74-408e-81db-d90a5e3aecb5",
+ "artifactTimeout": 0,
+ "artifactVersion": "2.0"
+ },
+ {
+ "artifactChecksum": "MDJlOTUwMDY0YzU3YjRjZTM0ZmZmYTM5NTE5ZThkNDI=",
+ "artifactDescription": "created from csar",
+ "artifactName": "base_TEST.yaml",
+ "artifactTimeout": 120,
+ "artifactType": "HEAT",
+ "artifactURL": "base_TEST.yaml",
+ "artifactUUID": "d7c1d4ca-3fdc-4880-86dc-90ca724fbcd7",
+ "artifactVersion": "2.0",
+ "generatedArtifact": "57f6520b-fa65-4544-90de-95c8190c2e6c"
+ },
+ {
+ "artifactChecksum": "YWQ2MmE0Y2NjNGE4YmJlOTk0YmZhYmIxYTc1YWZkY2M=",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactName": "base_TEST.env",
+ "artifactTimeout": 0,
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "base_TEST.env",
+ "artifactUUID": "57f6520b-fa65-4544-90de-95c8190c2e6c",
+ "artifactVersion": "1.0"
+ }
+ ]
+ }
+ ],
+ "serviceDescription": "ALTS service",
+ "distributionID": "03f016c8-7d8e-412b-901d-e96c7c66459b"
+}
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/moduleTest/service-Testalts1-csar.csar b/asdc-controller/src/test/resources/resource-examples/moduleTest/service-Testalts1-csar.csar
new file mode 100644
index 0000000..3d29ab8
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/moduleTest/service-Testalts1-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/moduleTest/testalts0_modules.json b/asdc-controller/src/test/resources/resource-examples/moduleTest/testalts0_modules.json
new file mode 100644
index 0000000..4dfb97d
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/moduleTest/testalts0_modules.json
@@ -0,0 +1,25 @@
+[
+ {
+ "vfModuleModelName": "Testalts..base_TEST..module-0",
+ "vfModuleModelInvariantUUID": "2cec5cc9-9b83-46ff-948e-1c0bd726d1ce",
+ "vfModuleModelVersion": "2",
+ "vfModuleModelUUID": "a3253fe9-2877-489d-9a41-dd3f38d4b4c1",
+ "vfModuleModelCustomizationUUID": "2d1c5862-7555-48d9-8aa9-1a34b5b70f6a",
+ "isBase": true,
+ "artifacts": [
+ "d7c1d4ca-3fdc-4880-86dc-90ca724fbcd7",
+ "57f6520b-fa65-4544-90de-95c8190c2e6c"
+ ],
+ "properties": {
+ "min_vf_module_instances": "1",
+ "vf_module_label": "base_TEST",
+ "max_vf_module_instances": "1",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Base",
+ "availability_zone_count": "",
+ "volume_group": "false",
+ "initial_count": "1"
+ }
+ }
+]
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt b/asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt
new file mode 100644
index 0000000..5b6d9e4
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/Notification_MultipleModules.txt
@@ -0,0 +1,302 @@
+DistributionID:a2872f55-8628-4486-8548-7b132c9a47db
+ServiceName:Vf zrdm5bpxmc02092017-Service
+ServiceVersion:1.0
+ServiceUUID:bad955c3-29b2-4a27-932e-28e942cc6480
+ServiceInvariantUUID:b16a9398-ffa3-4041-b78c-2956b8ad9c7b
+ServiceDescription:Demo
+
+
+
+Service Artifacts List:
+{
+Service Artifacts Info:
+ArtifactName:service-VfZrdm5bpxmc02092017Service-csar.csar
+ArtifactVersion:1
+ArtifactType:TOSCA_CSAR
+ArtifactDescription:TOSCA definition package of the asset
+ArtifactTimeout:0
+ArtifactURL:service-VfZrdm5bpxmc02092017Service-csar.csar
+ArtifactUUID:396cfd49-0f4b-4fec-9f33-0fd7e90d5a22
+ArtifactChecksum:MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+
+}
+
+Resource Instances List:
+{
+Resource Instance Info:
+ResourceInstanceName:Vf zrdm5bpxmc02092017-VF 0
+ResourceCustomizationUUID:96c23a4a-6887-4b2c-9cce-1e4ea35eaade
+ResourceInvariantUUID:23122c9b-dd7f-483f-bf0a-e069303db2f7
+ResourceName:Vf zrdm5bpxmc02092017-VF
+ResourceType:VF
+ResourceUUID:14ba5d1e-3862-407c-a236-1cbaebccce77
+ResourceVersion:1.0
+Category:Generic
+SubCategory:Network Elements
+Resource Artifacts List:
+{
+Service Artifacts Info:
+ArtifactName:pxmc_mmn_volume.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.env
+ArtifactUUID:c1ae6284-48d9-4437-a195-b2cf2ba23070
+ArtifactChecksum:NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+,
+Service Artifacts Info:
+ArtifactName:pxmc_base.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.env
+ArtifactUUID:6dd99c31-c52e-4c45-b99b-d223c877a296
+ArtifactChecksum:OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:vfzrdm5bpxmc02092017vf0_modules.json
+ArtifactVersion:1
+ArtifactType:VF_MODULES_METADATA
+ArtifactDescription:Auto-generated VF Modules information artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/vfzrdm5bpxmc02092017vf0_modules.json
+ArtifactUUID:e3b82cd6-485e-4d56-8d2c-17ccf6a59533
+ArtifactChecksum:MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:pxmc_vmt.yaml
+ArtifactVersion:1
+ArtifactType:HEAT
+ArtifactDescription:created from csar
+ArtifactTimeout:120
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.yaml
+ArtifactUUID:ad12ab80-5419-4346-a5d7-dac2fc15575f
+ArtifactChecksum:ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE=
+GeneratedArtifact:{Service Artifacts Info:
+ArtifactName:pxmc_vmt.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.env
+ArtifactUUID:bc1640f1-69f0-4760-8fc3-3318ec2ff129
+ArtifactChecksum:MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+}
+RelatedArtifacts:{
+Service Artifacts Info:
+ArtifactName:user_data_zrdm5bpxmc02vmt001.txt
+ArtifactVersion:1
+ArtifactType:HEAT_ARTIFACT
+ArtifactDescription:created from csar
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02vmt001.txt
+ArtifactUUID:53acdabe-689f-45e5-8578-f1514d3529da
+ArtifactChecksum:MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:pxmc_mmn.yaml
+ArtifactVersion:1
+ArtifactType:HEAT
+ArtifactDescription:created from csar
+ArtifactTimeout:120
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.yaml
+ArtifactUUID:b8bca13b-811f-44ab-9d27-45b842c664d8
+ArtifactChecksum:YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE=
+GeneratedArtifact:{Service Artifacts Info:
+ArtifactName:pxmc_mmn.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.env
+ArtifactUUID:e88ce0b9-1496-4d03-ab1d-6d8d79bfc737
+ArtifactChecksum:ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+}
+RelatedArtifacts:{
+Service Artifacts Info:
+ArtifactName:user_data_zrdm5bpxmc02mmn001.txt
+ArtifactVersion:1
+ArtifactType:HEAT_ARTIFACT
+ArtifactDescription:created from csar
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02mmn001.txt
+ArtifactUUID:5bc62c72-5f7a-40bc-a167-1a4fed9afdef
+ArtifactChecksum:OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:pxmc_mmn.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn.env
+ArtifactUUID:e88ce0b9-1496-4d03-ab1d-6d8d79bfc737
+ArtifactChecksum:ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:pxmc_vmt.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_vmt.env
+ArtifactUUID:bc1640f1-69f0-4760-8fc3-3318ec2ff129
+ArtifactChecksum:MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+,
+Service Artifacts Info:
+ArtifactName:user_data_zrdm5bpxmc02mmn001.txt
+ArtifactVersion:1
+ArtifactType:HEAT_ARTIFACT
+ArtifactDescription:created from csar
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02mmn001.txt
+ArtifactUUID:5bc62c72-5f7a-40bc-a167-1a4fed9afdef
+ArtifactChecksum:OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:pxmc_base.yaml
+ArtifactVersion:1
+ArtifactType:HEAT
+ArtifactDescription:created from csar
+ArtifactTimeout:120
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.yaml
+ArtifactUUID:7e7f7356-11bd-4f2f-bbbc-5c10954e3189
+ArtifactChecksum:YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM=
+GeneratedArtifact:{Service Artifacts Info:
+ArtifactName:pxmc_base.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_base.env
+ArtifactUUID:6dd99c31-c52e-4c45-b99b-d223c877a296
+ArtifactChecksum:OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+}
+RelatedArtifacts:{
+}
+,
+Service Artifacts Info:
+ArtifactName:user_data_zrdm5bpxmc02vmt001.txt
+ArtifactVersion:1
+ArtifactType:HEAT_ARTIFACT
+ArtifactDescription:created from csar
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/user_data_zrdm5bpxmc02vmt001.txt
+ArtifactUUID:53acdabe-689f-45e5-8578-f1514d3529da
+ArtifactChecksum:MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+,
+Service Artifacts Info:
+ArtifactName:pxmc_mmn_volume.yaml
+ArtifactVersion:2
+ArtifactType:HEAT_VOL
+ArtifactDescription:created from csar
+ArtifactTimeout:120
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.yaml
+ArtifactUUID:2f372a02-df1b-46ca-b81e-822e3f406965
+ArtifactChecksum:MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI=
+GeneratedArtifact:{Service Artifacts Info:
+ArtifactName:pxmc_mmn_volume.env
+ArtifactVersion:2
+ArtifactType:HEAT_ENV
+ArtifactDescription:Auto-generated HEAT Environment deployment artifact
+ArtifactTimeout:0
+ArtifactURL:/sdc/v1/catalog/services/VfZrdm5bpxmc02092017Service/1.0/resourceInstances/vfzrdm5bpxmc02092017vf0/artifacts/pxmc_mmn_volume.env
+ArtifactUUID:c1ae6284-48d9-4437-a195-b2cf2ba23070
+ArtifactChecksum:NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU=
+GeneratedArtifact:{NULL
+}
+RelatedArtifacts:{
+}
+
+
+}
+RelatedArtifacts:{
+}
+
+
+
+}
+
+
+
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json
new file mode 100644
index 0000000..37b7987
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/ServiceResponse.json
@@ -0,0 +1,458 @@
+{
+ "modelName": "Vf zrdm5bpxmc02092017-Service",
+ "description": "Demo",
+ "modelUUID": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "modelInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "serviceType": "",
+ "serviceRole": "",
+ "environmentContext": "General_Revenue-Bearing",
+ "networkCustomizations": [],
+ "vnfCustomizations": [
+ {
+ "modelCustomizationUuid": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade",
+ "modelInstanceName": "Vf zrdm5bpxmc02092017-VF 0",
+ "multiStageDesign": "false",
+ "vnfResources": {
+ "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelName": "Vf zrdm5bpxmc02092017-VF",
+ "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf",
+ "description": "Demo",
+ "orchestrationMode": "HEAT",
+ "modelVersion": "1.0",
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7"
+ },
+ "vfModuleCustomizations": [
+ {
+ "modelCustomizationUuid": "074c64d0-7e13-4bcc-8bdb-ea922331102d",
+ "label": "pxmc_base",
+ "minInstances": 1,
+ "maxInstances": 1,
+ "initialCount": 1,
+ "heatEnvironment": {
+ "artifactUuid": "6dd99c31-c52e-4c45-b99b-d223c877a296",
+ "name": "pxmc_base.env",
+ "description": "Auto-generated HEAT Environment deployment artifact",
+ "environment": "parameters:\n vnf_name: \n",
+ "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg=",
+ "version": "2"
+ },
+ "vfModule": {
+ "modelUUID": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46",
+ "modelInvariantUUID": "f7a867f2-596b-4f4a-a128-421e825a6190",
+ "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_base..module-0",
+ "modelVersion": "1",
+ "isBase": 1,
+ "moduleHeatTemplate": {
+ "artifactUuid": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189",
+ "templateName": "pxmc_base.yaml",
+ "templateBody": "heat_template_version: 2015-04-30\n\nparameters:\n\n## GLOBAL//Basic Parameters\n vnf_name:\n type: string\n description: Unique name for this VF instance\n# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC\n\nresources:\n\n## MSP RSG//Resource:SecurityGroup\n sec_grp_msp_0:\n type: OS::Neutron::SecurityGroup\n properties:\n description: Security Group for PXMC\n name:\n str_replace:\n template: VF_NAME_sec_grp_msp\n params:\n VF_NAME: { get_param: vnf_name }\n rules:\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n\noutputs:\n\n sec_grp_msp_id:\n description: uuid of the security group\n value: {get_resource: sec_grp_msp_0 }\n",
+ "timeoutMinutes": 120,
+ "version": "1",
+ "description": "created from csar",
+ "artifactChecksum": "YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM=",
+ "parameters": [
+ {
+ "heatTemplateArtifactUuid": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189",
+ "paramName": "vnf_name",
+ "required": true,
+ "paramType": "string"
+ }
+ ],
+ "childTemplates": [],
+ "heatTemplate": "heat_template_version: 2015-04-30\n\nparameters:\n\n## GLOBAL//Basic Parameters\n vnf_name:\n type: string\n description: Unique name for this VF instance\n# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC\n\nresources:\n\n## MSP RSG//Resource:SecurityGroup\n sec_grp_msp_0:\n type: OS::Neutron::SecurityGroup\n properties:\n description: Security Group for PXMC\n name:\n str_replace:\n template: VF_NAME_sec_grp_msp\n params:\n VF_NAME: { get_param: vnf_name }\n rules:\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"egress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"132\", \"ethertype\": \"IPv4\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"0.0.0.0/0\", \"protocol\": \"icmp\", \"ethertype\": \"IPv4\"}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"tcp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"udp\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"132\", \"ethertype\": \"IPv6\", \"port_range_max\": 65535, \"port_range_min\": 0}\n - {\"direction\": \"ingress\", \"remote_ip_prefix\": \"::/0\", \"protocol\": \"58\", \"ethertype\": \"IPv6\"}\n\noutputs:\n\n sec_grp_msp_id:\n description: uuid of the security group\n value: {get_resource: sec_grp_msp_0 }\n"
+ },
+ "heatFiles": [],
+ "vnfResources": {
+ "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelName": "Vf zrdm5bpxmc02092017-VF",
+ "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf",
+ "description": "Demo",
+ "orchestrationMode": "HEAT",
+ "modelVersion": "1.0",
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7"
+ },
+ "modelInvariantUuid": "f7a867f2-596b-4f4a-a128-421e825a6190",
+ "base": true
+ }
+ },
+ {
+ "modelCustomizationUuid": "5336a98e-0966-4e59-b6e6-c8162804a024",
+ "label": "pxmc_vmt",
+ "minInstances": 0,
+ "initialCount": 0,
+ "heatEnvironment": {
+ "artifactUuid": "bc1640f1-69f0-4760-8fc3-3318ec2ff129",
+ "name": "pxmc_vmt.env",
+ "description": "Auto-generated HEAT Environment deployment artifact",
+ "environment": "parameters:\n cinder_delete_on_termination_false: \n cinder_delete_on_termination_true: \n oam_protected_net_name: \n sec_grp_msp_id: \n vf_module_id: \n vmt_block_device_names: \n vmt_flavor_name: \n vmt_name_0: \n vmt_oam_protected_ip_0: \n vmt_volume_image_name_0: \n vmt_volume_image_name_1: \n vmt_volume_name_0: \n vmt_volume_name_1: \n vmt_volume_size_0: \n vmt_volume_size_1: \n vnf_id: \n",
+ "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY=",
+ "version": "2"
+ },
+ "vfModule": {
+ "modelUUID": "4d4423e2-17e8-455a-b9ae-7e4ab71b9cdc",
+ "modelInvariantUUID": "1e099992-6222-41a9-acde-5a8abb690775",
+ "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_vmt..module-1",
+ "modelVersion": "1",
+ "isBase": 0,
+ "moduleHeatTemplate": {
+ "artifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "templateName": "pxmc_vmt.yaml",
+ "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant\n\nparameters:\n vmt_name_0:\n type: string\n label: MSP VMT server names\n description: name of the MSP VMT instances\n# vmt_image_name:\n# type: string\n# label: MSP VMT image name\n# description: MSP VMT image name\n vmt_flavor_name:\n type: string\n label: MSP VMT flavor name\n description: MSP VMT flavor name\n# availability_zone_0:\n# type: string\n# label: MSP VMT availability zones\n# description: MSP VMT availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n vmt_oam_protected_ip_0:\n type: string\n label: MSP VMT OAM IP Addresses\n description: MSP VMT OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP VMT OAM net name\n description: MSP VMT OAM net name\n vmt_block_device_names:\n type: comma_delimited_list\n label: MSP VMT Block Device Names\n description: MSP VMT Block Device Names\n vmt_volume_name_0:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_name_1:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_size_0:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_size_1:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_image_name_0:\n type: string\n label: Mobisupport MSP VMT VDA Cinder Volume image name\n description: Mobisupport MSP VMT VDA Cinder Volume image name\n vmt_volume_image_name_1:\n type: string\n label: Mobisupport MSP VMT VDB Cinder Volume image name\n description: Mobisupport MSP VMT VDB Cinder Volume image name\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP VMT VNF ID\n description: MSP VMT VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF Module instance\n\nresources:\n################ Cinder Volumes ##############################\n vmt_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_0}\n size: {get_param: vmt_volume_size_0}\n image: {get_param: vmt_volume_image_name_0}\n\n vmt_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_1}\n size: {get_param: vmt_volume_size_1}\n image: {get_param: vmt_volume_image_name_1}\n\n################ Ports ##############################\n vmt_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: vmt_oam_protected_ip_0}}]\n security_groups: [{get_param: sec_grp_msp_id}]\n replacement_policy: AUTO\n\n################### Servers #########################\n vmt_zrdm5bpxmc02vmt_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: vmt_name_0}\n# image: {get_param: vmt_image_name}\n flavor: {get_param: vmt_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2: \n - device_name: {get_param: [vmt_block_device_names, 0]}\n volume_id: {get_resource: vmt_volume_0}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: 0\n - device_name: {get_param: [vmt_block_device_names, 1]}\n volume_id: {get_resource: vmt_volume_1}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: -1\n networks:\n - port: {get_resource: vmt_oam_protected_0_port}\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02vmt001.txt\n\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n",
+ "timeoutMinutes": 120,
+ "version": "1",
+ "description": "created from csar",
+ "artifactChecksum": "ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE=",
+ "parameters": [
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_name_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vf_module_id",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "sec_grp_msp_id",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_volume_name_1",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_volume_name_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_block_device_names",
+ "required": true,
+ "paramType": "comma_delimited_list"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_flavor_name",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vnf_id",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "oam_protected_net_name",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_volume_image_name_1",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_volume_image_name_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_oam_protected_ip_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_volume_size_0",
+ "required": true,
+ "paramType": "number"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "cinder_delete_on_termination_false",
+ "required": true,
+ "paramType": "boolean"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "vmt_volume_size_1",
+ "required": true,
+ "paramType": "number"
+ },
+ {
+ "heatTemplateArtifactUuid": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "paramName": "cinder_delete_on_termination_true",
+ "required": true,
+ "paramType": "boolean"
+ }
+ ],
+ "childTemplates": [],
+ "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant\n\nparameters:\n vmt_name_0:\n type: string\n label: MSP VMT server names\n description: name of the MSP VMT instances\n# vmt_image_name:\n# type: string\n# label: MSP VMT image name\n# description: MSP VMT image name\n vmt_flavor_name:\n type: string\n label: MSP VMT flavor name\n description: MSP VMT flavor name\n# availability_zone_0:\n# type: string\n# label: MSP VMT availability zones\n# description: MSP VMT availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n vmt_oam_protected_ip_0:\n type: string\n label: MSP VMT OAM IP Addresses\n description: MSP VMT OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP VMT OAM net name\n description: MSP VMT OAM net name\n vmt_block_device_names:\n type: comma_delimited_list\n label: MSP VMT Block Device Names\n description: MSP VMT Block Device Names\n vmt_volume_name_0:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_name_1:\n type: string\n label: Mobisupport MSP VMT Cinder Volume names\n description: Mobisupport MSP VMT Cinder Volume names\n vmt_volume_size_0:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_size_1:\n type: number\n label: Mobisupport MSP VMT Cinder Volume sizes\n description: Mobisupport MSP VMT Cinder Volume sizes\n vmt_volume_image_name_0:\n type: string\n label: Mobisupport MSP VMT VDA Cinder Volume image name\n description: Mobisupport MSP VMT VDA Cinder Volume image name\n vmt_volume_image_name_1:\n type: string\n label: Mobisupport MSP VMT VDB Cinder Volume image name\n description: Mobisupport MSP VMT VDB Cinder Volume image name\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP VMT VNF ID\n description: MSP VMT VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF Module instance\n\nresources:\n################ Cinder Volumes ##############################\n vmt_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_0}\n size: {get_param: vmt_volume_size_0}\n image: {get_param: vmt_volume_image_name_0}\n\n vmt_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: vmt_volume_name_1}\n size: {get_param: vmt_volume_size_1}\n image: {get_param: vmt_volume_image_name_1}\n\n################ Ports ##############################\n vmt_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: vmt_oam_protected_ip_0}}]\n security_groups: [{get_param: sec_grp_msp_id}]\n replacement_policy: AUTO\n\n################### Servers #########################\n vmt_zrdm5bpxmc02vmt_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: vmt_name_0}\n# image: {get_param: vmt_image_name}\n flavor: {get_param: vmt_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2: \n - device_name: {get_param: [vmt_block_device_names, 0]}\n volume_id: {get_resource: vmt_volume_0}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: 0\n - device_name: {get_param: [vmt_block_device_names, 1]}\n volume_id: {get_resource: vmt_volume_1}\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n boot_index: -1\n networks:\n - port: {get_resource: vmt_oam_protected_0_port}\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02vmt001.txt\n\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n"
+ },
+ "heatFiles": [],
+ "vnfResources": {
+ "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelName": "Vf zrdm5bpxmc02092017-VF",
+ "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf",
+ "description": "Demo",
+ "orchestrationMode": "HEAT",
+ "modelVersion": "1.0",
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7"
+ },
+ "modelInvariantUuid": "1e099992-6222-41a9-acde-5a8abb690775",
+ "base": false
+ }
+ },
+ {
+ "modelCustomizationUuid": "e38906fa-717c-49b0-b391-e6ec12b50c4a",
+ "label": "pxmc_mmn",
+ "minInstances": 0,
+ "initialCount": 0,
+ "heatEnvironment": {
+ "artifactUuid": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737",
+ "name": "pxmc_mmn.env",
+ "description": "Auto-generated HEAT Environment deployment artifact",
+ "environment": "parameters:\n cinder_delete_on_termination_false: \n cinder_delete_on_termination_true: \n mmn_arch_volume_id_2: \n mmn_backup_volume_id_3: \n mmn_block_device_names: \n mmn_data_volume_id_1: \n mmn_flavor_name: \n mmn_misc_volume_id_4: \n mmn_name_0: \n mmn_oam_protected_ip_0: \n mmn_volume_image_name_0: \n mmn_volume_name_0: \n mmn_volume_size_0: \n oam_protected_net_name: \n sec_grp_msp_id: \n vf_module_id: \n vnf_id: \n",
+ "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ=",
+ "version": "2"
+ },
+ "vfModule": {
+ "modelUUID": "a8cb1182-9b6d-46f8-b06b-ded4fe69e10d",
+ "modelInvariantUUID": "8e53c069-b2f0-437a-9c00-21cbc5c8f081",
+ "modelName": "VfZrdm5bpxmc02092017Vf..pxmc_mmn..module-2",
+ "modelVersion": "1",
+ "isBase": 0,
+ "volumeHeatTemplate": {
+ "artifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "templateName": "pxmc_mmn_volume.yaml",
+ "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant\n\nparameters:\n mmn_volume_name_1:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_2:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_3:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_4:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_size_1:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_2:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_3:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_4:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\nresources:\n mmn_data_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_1}\n size: {get_param: mmn_volume_size_1}\n \n mmn_arch_volume_2:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_2}\n size: {get_param: mmn_volume_size_2}\n \n mmn_backup_volume_3:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_3}\n size: {get_param: mmn_volume_size_3}\n \n mmn_misc_volume_4:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_4}\n size: {get_param: mmn_volume_size_4}\n\noutputs:\n mmn_data_volume_id_1:\n description: msp mmn data volume 1\n value: {get_resource: mmn_data_volume_1}\n \n mmn_arch_volume_id_2:\n description: msp mn arch volume 2\n value: {get_resource: mmn_arch_volume_2}\n \n mmn_backup_volume_id_3:\n description: msp mn backup volume 3\n value: {get_resource: mmn_backup_volume_3}\n \n mmn_misc_volume_id_4:\n description: msp mn volume 4\n value: {get_resource: mmn_misc_volume_4}\n",
+ "timeoutMinutes": 120,
+ "version": "2",
+ "description": "created from csar",
+ "artifactChecksum": "MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI=",
+ "parameters": [
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_name_2",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_size_2",
+ "required": true,
+ "paramType": "number"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_name_1",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_size_1",
+ "required": true,
+ "paramType": "number"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_name_4",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_name_3",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_size_4",
+ "required": true,
+ "paramType": "number"
+ },
+ {
+ "heatTemplateArtifactUuid": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "paramName": "mmn_volume_size_3",
+ "required": true,
+ "paramType": "number"
+ }
+ ],
+ "childTemplates": [],
+ "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant\n\nparameters:\n mmn_volume_name_1:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_2:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_3:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_name_4:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n\n mmn_volume_size_1:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_2:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_3:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\n mmn_volume_size_4:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n\nresources:\n mmn_data_volume_1:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_1}\n size: {get_param: mmn_volume_size_1}\n \n mmn_arch_volume_2:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_2}\n size: {get_param: mmn_volume_size_2}\n \n mmn_backup_volume_3:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_3}\n size: {get_param: mmn_volume_size_3}\n \n mmn_misc_volume_4:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_4}\n size: {get_param: mmn_volume_size_4}\n\noutputs:\n mmn_data_volume_id_1:\n description: msp mmn data volume 1\n value: {get_resource: mmn_data_volume_1}\n \n mmn_arch_volume_id_2:\n description: msp mn arch volume 2\n value: {get_resource: mmn_arch_volume_2}\n \n mmn_backup_volume_id_3:\n description: msp mn backup volume 3\n value: {get_resource: mmn_backup_volume_3}\n \n mmn_misc_volume_id_4:\n description: msp mn volume 4\n value: {get_resource: mmn_misc_volume_4}\n"
+ },
+ "moduleHeatTemplate": {
+ "artifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "templateName": "pxmc_mmn.yaml",
+ "templateBody": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus vMSP MMN stack.\n\nparameters:\n mmn_name_0:\n type: string\n label: MSP MMN server names\n description: name of the MSP MMN instances\n mmn_flavor_name:\n type: string\n label: MSP MMN flavor name\n description: MSP MMN flavor name\n# mmn_image_name:\n# type: string\n# label: MSP MMN image name\n# description: MSP MMN image name\n# availability_zone_0:\n# type: string\n# label: MSP MMN availability zones\n# description: MSP MMN availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n mmn_oam_protected_ip_0:\n type: string\n label: MSP MMN OAM IP Addresses\n description: MSP MMN OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP MMN OAM net name\n description: MSP MMN OAM net name\n mmn_volume_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n mmn_volume_size_0:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n mmn_volume_image_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume image name\n description: Mobisupport MSP MMN Cinder Volume image name\n mmn_data_volume_id_1:\n type: string\n label: MSP MMN Volume id 1\n description: MSP MMN Volume id 1\n mmn_arch_volume_id_2:\n type: string\n label: MSP MMN Volume id 2\n description: MSP MMN Volume id 2\n mmn_backup_volume_id_3:\n type: string\n label: MSP MMN Volume id 3\n description: MSP MMN Volume id 3\n mmn_misc_volume_id_4:\n type: string\n label: MSP MMN Volume id 4\n description: MSP MMN Volume id 4\n mmn_block_device_names:\n type: comma_delimited_list\n label: MSP MMN Block Device Names\n description: MSP MMN Block Device Names\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP MMN VNF ID\n description: MSP MMN VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF module instance\n\nresources:\n################ Cinder Volume ########################\n mmn_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_0}\n size: {get_param: mmn_volume_size_0}\n image: {get_param: mmn_volume_image_name_0}\n\n################ Server ##############################\n mmn_zrdm5bpxmc02mmn_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: mmn_name_0}\n# image: {get_param: mmn_image_name}\n flavor: {get_param: mmn_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2:\n - device_name: { get_param: [mmn_block_device_names, 0] }\n volume_id: { get_resource: mmn_volume_0 }\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n networks:\n - port: { get_resource: mmn_oam_protected_0_port }\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02mmn001.txt\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n\n################ Ports ##############################\n mmn_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: mmn_oam_protected_ip_0}}]\n security_groups: [{ get_param: sec_grp_msp_id }]\n replacement_policy: AUTO\n\n################ Volume Attachment ##############################\n volume_attachment_vdb:\n type: OS::Cinder::VolumeAttachment\n depends_on: mmn_zrdm5bpxmc02mmn_0\n properties:\n volume_id: { get_param: mmn_data_volume_id_1 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdb\n\n volume_attachment_vdc:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdb\n properties:\n volume_id: { get_param: mmn_arch_volume_id_2 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdc\n\n volume_attachment_vdd:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdc\n properties:\n volume_id: { get_param: mmn_backup_volume_id_3 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdd\n\n volume_attachment_vde:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdd\n properties:\n volume_id: { get_param: mmn_misc_volume_id_4 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vde\n",
+ "timeoutMinutes": 120,
+ "version": "1",
+ "description": "created from csar",
+ "artifactChecksum": "YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE=",
+ "parameters": [
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "vnf_id",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_block_device_names",
+ "required": true,
+ "paramType": "comma_delimited_list"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_name_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_arch_volume_id_2",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_volume_image_name_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "cinder_delete_on_termination_false",
+ "required": true,
+ "paramType": "boolean"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_oam_protected_ip_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_data_volume_id_1",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_backup_volume_id_3",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "vf_module_id",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "sec_grp_msp_id",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_volume_size_0",
+ "required": true,
+ "paramType": "number"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "cinder_delete_on_termination_true",
+ "required": true,
+ "paramType": "boolean"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_volume_name_0",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "oam_protected_net_name",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_misc_volume_id_4",
+ "required": true,
+ "paramType": "string"
+ },
+ {
+ "heatTemplateArtifactUuid": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "paramName": "mmn_flavor_name",
+ "required": true,
+ "paramType": "string"
+ }
+ ],
+ "childTemplates": [],
+ "heatTemplate": "heat_template_version: 2015-04-30\n\ndescription: HOT creates Nimbus vMSP MMN stack.\n\nparameters:\n mmn_name_0:\n type: string\n label: MSP MMN server names\n description: name of the MSP MMN instances\n mmn_flavor_name:\n type: string\n label: MSP MMN flavor name\n description: MSP MMN flavor name\n# mmn_image_name:\n# type: string\n# label: MSP MMN image name\n# description: MSP MMN image name\n# availability_zone_0:\n# type: string\n# label: MSP MMN availability zones\n# description: MSP MMN availability zones\n sec_grp_msp_id:\n type: string\n label: security group id\n description: the id of security group\n mmn_oam_protected_ip_0:\n type: string\n label: MSP MMN OAM IP Addresses\n description: MSP MMN OAM IP Addresses\n oam_protected_net_name:\n type: string\n label: MSP MMN OAM net name\n description: MSP MMN OAM net name\n mmn_volume_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume names\n description: Mobisupport MSP MMN Cinder Volume names\n mmn_volume_size_0:\n type: number\n label: Mobisupport MSP MMN Cinder Volume sizes\n description: Mobisupport MSP MMN Cinder Volume sizes\n mmn_volume_image_name_0:\n type: string\n label: Mobisupport MSP MMN Cinder Volume image name\n description: Mobisupport MSP MMN Cinder Volume image name\n mmn_data_volume_id_1:\n type: string\n label: MSP MMN Volume id 1\n description: MSP MMN Volume id 1\n mmn_arch_volume_id_2:\n type: string\n label: MSP MMN Volume id 2\n description: MSP MMN Volume id 2\n mmn_backup_volume_id_3:\n type: string\n label: MSP MMN Volume id 3\n description: MSP MMN Volume id 3\n mmn_misc_volume_id_4:\n type: string\n label: MSP MMN Volume id 4\n description: MSP MMN Volume id 4\n mmn_block_device_names:\n type: comma_delimited_list\n label: MSP MMN Block Device Names\n description: MSP MMN Block Device Names\n cinder_delete_on_termination_true:\n type: boolean\n description: delete cinder volume upon instances termination\n cinder_delete_on_termination_false:\n type: boolean\n description: keep cinder volume upon instances termination\n vnf_id:\n type: string\n label: MSP MMN VNF ID\n description: MSP MMN VNF ID\n vf_module_id:\n type: string\n description: Unique ID for this VF module instance\n\nresources:\n################ Cinder Volume ########################\n mmn_volume_0:\n type: OS::Cinder::Volume\n properties:\n name: {get_param: mmn_volume_name_0}\n size: {get_param: mmn_volume_size_0}\n image: {get_param: mmn_volume_image_name_0}\n\n################ Server ##############################\n mmn_zrdm5bpxmc02mmn_0:\n type: OS::Nova::Server\n properties:\n name: {get_param: mmn_name_0}\n# image: {get_param: mmn_image_name}\n flavor: {get_param: mmn_flavor_name}\n# availability_zone: {get_param: availability_zone_0}\n block_device_mapping_v2:\n - device_name: { get_param: [mmn_block_device_names, 0] }\n volume_id: { get_resource: mmn_volume_0 }\n delete_on_termination: {get_param: cinder_delete_on_termination_true}\n networks:\n - port: { get_resource: mmn_oam_protected_0_port }\n config_drive: \"True\"\n user_data_format: RAW\n user_data:\n get_file: user_data_zrdm5bpxmc02mmn001.txt\n metadata:\n vnf_id: {get_param: vnf_id}\n vf_module_id {get_param: vf_module_id}\n \"evacuation_policy\": \"Evacuation\"\n\n################ Ports ##############################\n mmn_oam_protected_0_port:\n type: OS::Neutron::Port\n properties:\n network: {get_param: oam_protected_net_name}\n fixed_ips: [{\"ip_address\": {get_param: mmn_oam_protected_ip_0}}]\n security_groups: [{ get_param: sec_grp_msp_id }]\n replacement_policy: AUTO\n\n################ Volume Attachment ##############################\n volume_attachment_vdb:\n type: OS::Cinder::VolumeAttachment\n depends_on: mmn_zrdm5bpxmc02mmn_0\n properties:\n volume_id: { get_param: mmn_data_volume_id_1 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdb\n\n volume_attachment_vdc:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdb\n properties:\n volume_id: { get_param: mmn_arch_volume_id_2 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdc\n\n volume_attachment_vdd:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdc\n properties:\n volume_id: { get_param: mmn_backup_volume_id_3 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vdd\n\n volume_attachment_vde:\n type: OS::Cinder::VolumeAttachment\n depends_on: volume_attachment_vdd\n properties:\n volume_id: { get_param: mmn_misc_volume_id_4 }\n instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}\n mountpoint: /dev/vde\n"
+ },
+ "heatFiles": [],
+ "vnfResources": {
+ "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelName": "Vf zrdm5bpxmc02092017-VF",
+ "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf",
+ "description": "Demo",
+ "orchestrationMode": "HEAT",
+ "modelVersion": "1.0",
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7"
+ },
+ "modelInvariantUuid": "8e53c069-b2f0-437a-9c00-21cbc5c8f081",
+ "base": false
+ }
+ }
+ ],
+ "vnfResource": {
+ "modelUuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelInvariantUuid": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelName": "Vf zrdm5bpxmc02092017-VF",
+ "toscaNodeType": "org.openecomp.resource.vf.VfZrdm5bpxmc02092017Vf",
+ "description": "Demo",
+ "orchestrationMode": "HEAT",
+ "modelVersion": "1.0",
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7"
+ }
+ }
+ ],
+ "allotedCustomizations": [],
+ "recipes": {
+
+ },
+ "csar": {
+ "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22",
+ "name": "service-VfZrdm5bpxmc02092017Service-csar.csar",
+ "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=",
+ "url": "service-VfZrdm5bpxmc02092017Service-csar.csar",
+ "description": "TOSCA definition package of the asset",
+ "version": "1"
+ }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json
new file mode 100644
index 0000000..3a7b361
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/notif-structure.json
@@ -0,0 +1,96 @@
+{
+ "serviceName": "Vf zrdm5bpxmc02092017-Service",
+ "serviceInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "serviceUUID": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "serviceVersion": "1.0",
+ "serviceArtifacts":
+ [{
+ "artifactName": "service-VfZrdm5bpxmc02092017Service-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "service-VfZrdm5bpxmc02092017Service-csar.csar",
+ "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE=",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22",
+ "artifactVersion": "1"
+ }],
+ "resources":
+ [
+ {
+ "resourceInstanceName": "Vf zrdm5bpxmc02092017-VF 0",
+ "resourceInvariantUUID": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "resourceCustomizationUUID": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade",
+ "resourceName": "Vf zrdm5bpxmc02092017-VF",
+ "resourceType": "VF",
+ "resourceUUID": "14ba5d1e-3862-407c-a236-1cbaebccce77",
+ "resourceVersion": "1.0",
+ "category": "Generic",
+ "subcategory": "Network Elements",
+ "artifacts":
+ [
+ {
+ "artifactChecksum": "NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU=",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactName": "pxmc_mmn_volume.env",
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "pxmc_mmn_volume.env",
+ "artifactUUID": "c1ae6284-48d9-4437-a195-b2cf2ba23070",
+ "artifactTimeout": 0,
+ "artifactVersion": "2"
+ },
+ {
+ "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg==",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactName": "pxmc_base.env",
+ "artifactTimeout": 0,
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "pxmc_base.env",
+ "artifactUUID": "6dd99c31-c52e-4c45-b99b-d223c877a296",
+ "artifactVersion": "2.0"
+ },
+ {
+ "artifactChecksum": "MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ=",
+ "artifactDescription": "created from csar",
+ "artifactName": "user_data_zrdm5bpxmc02vmt001.txt",
+ "artifactTimeout": 0,
+ "artifactType": "HEAT_ARTIFACT",
+ "artifactURL": "user_data_zrdm5bpxmc02vmt001.txt",
+ "artifactUUID": "53acdabe-689f-45e5-8578-f1514d3529da",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactChecksum": "MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU=",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactName": "vfzrdm5bpxmc02092017vf0_modules.json",
+ "artifactTimeout": 0,
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "vfzrdm5bpxmc02092017vf0_modules.json",
+ "artifactUUID": "e3b82cd6-485e-4d56-8d2c-17ccf6a59533",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactChecksum": "YWQ2MmE0Y2NjNGE4YmJlOTk0YmZhYmIxYTc1YWZkY2M=",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactName": "base_TEST.env",
+ "artifactTimeout": 0,
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "base_TEST.env",
+ "artifactUUID": "57f6520b-fa65-4544-90de-95c8190c2e6c",
+ "artifactVersion": "1.0"
+ },
+ {
+ "artifactChecksum": "YWQ2MmE0Y2NjNGE4YmJlOTk0YmZhYmIxYTc1YWZkY2M=",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactName": "base_TEST.env",
+ "artifactTimeout": 0,
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "base_TEST.env",
+ "artifactUUID": "57f6520b-fa65-4544-90de-95c8190c2e6c",
+ "artifactVersion": "1.0"
+ }
+ ]
+ }
+ ],
+ "serviceDescription": "Demo",
+ "distributionID": "a2872f55-8628-4486-8548-7b132c9a47db"
+}
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env
new file mode 100644
index 0000000..42d736e
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.env
@@ -0,0 +1,2 @@
+parameters:
+ vnf_name:
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml
new file mode 100644
index 0000000..3e98047
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_base.yaml
@@ -0,0 +1,45 @@
+heat_template_version: 2015-04-30
+
+parameters:
+
+## GLOBAL//Basic Parameters
+ vnf_name:
+ type: string
+ description: Unique name for this VF instance
+# For manual spinups, value must be in the ENV file. Must be removed from ENV before uploading to ASDC
+
+resources:
+
+## MSP RSG//Resource:SecurityGroup
+ sec_grp_msp_0:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ description: Security Group for PXMC
+ name:
+ str_replace:
+ template: VF_NAME_sec_grp_msp
+ params:
+ VF_NAME: { get_param: vnf_name }
+ rules:
+ - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "udp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "132", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "egress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "icmp", "ethertype": "IPv4"}
+ - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "tcp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "udp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "132", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "egress", "remote_ip_prefix": "::/0", "protocol": "58", "ethertype": "IPv6"}
+ - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "tcp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "udp", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "132", "ethertype": "IPv4", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "ingress", "remote_ip_prefix": "0.0.0.0/0", "protocol": "icmp", "ethertype": "IPv4"}
+ - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "tcp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "udp", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "132", "ethertype": "IPv6", "port_range_max": 65535, "port_range_min": 0}
+ - {"direction": "ingress", "remote_ip_prefix": "::/0", "protocol": "58", "ethertype": "IPv6"}
+
+outputs:
+
+ sec_grp_msp_id:
+ description: uuid of the security group
+ value: {get_resource: sec_grp_msp_0 }
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env
new file mode 100644
index 0000000..42599e6
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.env
@@ -0,0 +1,18 @@
+parameters:
+ cinder_delete_on_termination_false:
+ cinder_delete_on_termination_true:
+ mmn_arch_volume_id_2:
+ mmn_backup_volume_id_3:
+ mmn_block_device_names:
+ mmn_data_volume_id_1:
+ mmn_flavor_name:
+ mmn_misc_volume_id_4:
+ mmn_name_0:
+ mmn_oam_protected_ip_0:
+ mmn_volume_image_name_0:
+ mmn_volume_name_0:
+ mmn_volume_size_0:
+ oam_protected_net_name:
+ sec_grp_msp_id:
+ vf_module_id:
+ vnf_id:
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml
new file mode 100644
index 0000000..d1b0ce8
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn.yaml
@@ -0,0 +1,152 @@
+heat_template_version: 2015-04-30
+
+description: HOT creates Nimbus vMSP MMN stack.
+
+parameters:
+ mmn_name_0:
+ type: string
+ label: MSP MMN server names
+ description: name of the MSP MMN instances
+ mmn_flavor_name:
+ type: string
+ label: MSP MMN flavor name
+ description: MSP MMN flavor name
+# mmn_image_name:
+# type: string
+# label: MSP MMN image name
+# description: MSP MMN image name
+# availability_zone_0:
+# type: string
+# label: MSP MMN availability zones
+# description: MSP MMN availability zones
+ sec_grp_msp_id:
+ type: string
+ label: security group id
+ description: the id of security group
+ mmn_oam_protected_ip_0:
+ type: string
+ label: MSP MMN OAM IP Addresses
+ description: MSP MMN OAM IP Addresses
+ oam_protected_net_name:
+ type: string
+ label: MSP MMN OAM net name
+ description: MSP MMN OAM net name
+ mmn_volume_name_0:
+ type: string
+ label: Mobisupport MSP MMN Cinder Volume names
+ description: Mobisupport MSP MMN Cinder Volume names
+ mmn_volume_size_0:
+ type: number
+ label: Mobisupport MSP MMN Cinder Volume sizes
+ description: Mobisupport MSP MMN Cinder Volume sizes
+ mmn_volume_image_name_0:
+ type: string
+ label: Mobisupport MSP MMN Cinder Volume image name
+ description: Mobisupport MSP MMN Cinder Volume image name
+ mmn_data_volume_id_1:
+ type: string
+ label: MSP MMN Volume id 1
+ description: MSP MMN Volume id 1
+ mmn_arch_volume_id_2:
+ type: string
+ label: MSP MMN Volume id 2
+ description: MSP MMN Volume id 2
+ mmn_backup_volume_id_3:
+ type: string
+ label: MSP MMN Volume id 3
+ description: MSP MMN Volume id 3
+ mmn_misc_volume_id_4:
+ type: string
+ label: MSP MMN Volume id 4
+ description: MSP MMN Volume id 4
+ mmn_block_device_names:
+ type: comma_delimited_list
+ label: MSP MMN Block Device Names
+ description: MSP MMN Block Device Names
+ cinder_delete_on_termination_true:
+ type: boolean
+ description: delete cinder volume upon instances termination
+ cinder_delete_on_termination_false:
+ type: boolean
+ description: keep cinder volume upon instances termination
+ vnf_id:
+ type: string
+ label: MSP MMN VNF ID
+ description: MSP MMN VNF ID
+ vf_module_id:
+ type: string
+ description: Unique ID for this VF module instance
+
+resources:
+################ Cinder Volume ########################
+ mmn_volume_0:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: mmn_volume_name_0}
+ size: {get_param: mmn_volume_size_0}
+ image: {get_param: mmn_volume_image_name_0}
+
+################ Server ##############################
+ mmn_zrdm5bpxmc02mmn_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: mmn_name_0}
+# image: {get_param: mmn_image_name}
+ flavor: {get_param: mmn_flavor_name}
+# availability_zone: {get_param: availability_zone_0}
+ block_device_mapping_v2:
+ - device_name: { get_param: [mmn_block_device_names, 0] }
+ volume_id: { get_resource: mmn_volume_0 }
+ delete_on_termination: {get_param: cinder_delete_on_termination_true}
+ networks:
+ - port: { get_resource: mmn_oam_protected_0_port }
+ config_drive: "True"
+ user_data_format: RAW
+ user_data:
+ get_file: user_data_zrdm5bpxmc02mmn001.txt
+ metadata:
+ vnf_id: {get_param: vnf_id}
+ vf_module_id {get_param: vf_module_id}
+ "evacuation_policy": "Evacuation"
+
+################ Ports ##############################
+ mmn_oam_protected_0_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_protected_net_name}
+ fixed_ips: [{"ip_address": {get_param: mmn_oam_protected_ip_0}}]
+ security_groups: [{ get_param: sec_grp_msp_id }]
+ replacement_policy: AUTO
+
+################ Volume Attachment ##############################
+ volume_attachment_vdb:
+ type: OS::Cinder::VolumeAttachment
+ depends_on: mmn_zrdm5bpxmc02mmn_0
+ properties:
+ volume_id: { get_param: mmn_data_volume_id_1 }
+ instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}
+ mountpoint: /dev/vdb
+
+ volume_attachment_vdc:
+ type: OS::Cinder::VolumeAttachment
+ depends_on: volume_attachment_vdb
+ properties:
+ volume_id: { get_param: mmn_arch_volume_id_2 }
+ instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}
+ mountpoint: /dev/vdc
+
+ volume_attachment_vdd:
+ type: OS::Cinder::VolumeAttachment
+ depends_on: volume_attachment_vdc
+ properties:
+ volume_id: { get_param: mmn_backup_volume_id_3 }
+ instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}
+ mountpoint: /dev/vdd
+
+ volume_attachment_vde:
+ type: OS::Cinder::VolumeAttachment
+ depends_on: volume_attachment_vdd
+ properties:
+ volume_id: { get_param: mmn_misc_volume_id_4 }
+ instance_uuid: { get_resource: mmn_zrdm5bpxmc02mmn_0}
+ mountpoint: /dev/vde
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env
new file mode 100644
index 0000000..d5f1628
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.env
@@ -0,0 +1,9 @@
+parameters:
+ mmn_volume_name_1: "data-mn-v-vdb"
+ mmn_volume_name_2: "arch-mn-v-vdc"
+ mmn_volume_name_3: "backup-mn-v-vdd"
+ mmn_volume_name_4: "misc-mn-v-vde"
+ mmn_volume_size_1: 20
+ mmn_volume_size_2: 20
+ mmn_volume_size_3: 50
+ mmn_volume_size_4: 20
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml
new file mode 100644
index 0000000..debb8a9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_mmn_volume.yaml
@@ -0,0 +1,86 @@
+heat_template_version: 2015-04-30
+
+description: HOT creates MSP MMN Cinder Volumes under MobiSupport Tenant
+
+parameters:
+ mmn_volume_name_1:
+ type: string
+ label: Mobisupport MSP MMN Cinder Volume names
+ description: Mobisupport MSP MMN Cinder Volume names
+
+ mmn_volume_name_2:
+ type: string
+ label: Mobisupport MSP MMN Cinder Volume names
+ description: Mobisupport MSP MMN Cinder Volume names
+
+ mmn_volume_name_3:
+ type: string
+ label: Mobisupport MSP MMN Cinder Volume names
+ description: Mobisupport MSP MMN Cinder Volume names
+
+ mmn_volume_name_4:
+ type: string
+ label: Mobisupport MSP MMN Cinder Volume names
+ description: Mobisupport MSP MMN Cinder Volume names
+
+ mmn_volume_size_1:
+ type: number
+ label: Mobisupport MSP MMN Cinder Volume sizes
+ description: Mobisupport MSP MMN Cinder Volume sizes
+
+ mmn_volume_size_2:
+ type: number
+ label: Mobisupport MSP MMN Cinder Volume sizes
+ description: Mobisupport MSP MMN Cinder Volume sizes
+
+ mmn_volume_size_3:
+ type: number
+ label: Mobisupport MSP MMN Cinder Volume sizes
+ description: Mobisupport MSP MMN Cinder Volume sizes
+
+ mmn_volume_size_4:
+ type: number
+ label: Mobisupport MSP MMN Cinder Volume sizes
+ description: Mobisupport MSP MMN Cinder Volume sizes
+
+resources:
+ mmn_data_volume_1:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: mmn_volume_name_1}
+ size: {get_param: mmn_volume_size_1}
+
+ mmn_arch_volume_2:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: mmn_volume_name_2}
+ size: {get_param: mmn_volume_size_2}
+
+ mmn_backup_volume_3:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: mmn_volume_name_3}
+ size: {get_param: mmn_volume_size_3}
+
+ mmn_misc_volume_4:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: mmn_volume_name_4}
+ size: {get_param: mmn_volume_size_4}
+
+outputs:
+ mmn_data_volume_id_1:
+ description: msp mmn data volume 1
+ value: {get_resource: mmn_data_volume_1}
+
+ mmn_arch_volume_id_2:
+ description: msp mn arch volume 2
+ value: {get_resource: mmn_arch_volume_2}
+
+ mmn_backup_volume_id_3:
+ description: msp mn backup volume 3
+ value: {get_resource: mmn_backup_volume_3}
+
+ mmn_misc_volume_id_4:
+ description: msp mn volume 4
+ value: {get_resource: mmn_misc_volume_4}
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env
new file mode 100644
index 0000000..0f0e6da
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.env
@@ -0,0 +1,17 @@
+parameters:
+ cinder_delete_on_termination_false:
+ cinder_delete_on_termination_true:
+ oam_protected_net_name:
+ sec_grp_msp_id:
+ vf_module_id:
+ vmt_block_device_names:
+ vmt_flavor_name:
+ vmt_name_0:
+ vmt_oam_protected_ip_0:
+ vmt_volume_image_name_0:
+ vmt_volume_image_name_1:
+ vmt_volume_name_0:
+ vmt_volume_name_1:
+ vmt_volume_size_0:
+ vmt_volume_size_1:
+ vnf_id:
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml
new file mode 100644
index 0000000..2e04c61
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/pxmc_vmt.yaml
@@ -0,0 +1,128 @@
+heat_template_version: 2015-04-30
+
+description: HOT creates Nimbus MSP VMT stack under MobiSupport Tenant
+
+parameters:
+ vmt_name_0:
+ type: string
+ label: MSP VMT server names
+ description: name of the MSP VMT instances
+# vmt_image_name:
+# type: string
+# label: MSP VMT image name
+# description: MSP VMT image name
+ vmt_flavor_name:
+ type: string
+ label: MSP VMT flavor name
+ description: MSP VMT flavor name
+# availability_zone_0:
+# type: string
+# label: MSP VMT availability zones
+# description: MSP VMT availability zones
+ sec_grp_msp_id:
+ type: string
+ label: security group id
+ description: the id of security group
+ vmt_oam_protected_ip_0:
+ type: string
+ label: MSP VMT OAM IP Addresses
+ description: MSP VMT OAM IP Addresses
+ oam_protected_net_name:
+ type: string
+ label: MSP VMT OAM net name
+ description: MSP VMT OAM net name
+ vmt_block_device_names:
+ type: comma_delimited_list
+ label: MSP VMT Block Device Names
+ description: MSP VMT Block Device Names
+ vmt_volume_name_0:
+ type: string
+ label: Mobisupport MSP VMT Cinder Volume names
+ description: Mobisupport MSP VMT Cinder Volume names
+ vmt_volume_name_1:
+ type: string
+ label: Mobisupport MSP VMT Cinder Volume names
+ description: Mobisupport MSP VMT Cinder Volume names
+ vmt_volume_size_0:
+ type: number
+ label: Mobisupport MSP VMT Cinder Volume sizes
+ description: Mobisupport MSP VMT Cinder Volume sizes
+ vmt_volume_size_1:
+ type: number
+ label: Mobisupport MSP VMT Cinder Volume sizes
+ description: Mobisupport MSP VMT Cinder Volume sizes
+ vmt_volume_image_name_0:
+ type: string
+ label: Mobisupport MSP VMT VDA Cinder Volume image name
+ description: Mobisupport MSP VMT VDA Cinder Volume image name
+ vmt_volume_image_name_1:
+ type: string
+ label: Mobisupport MSP VMT VDB Cinder Volume image name
+ description: Mobisupport MSP VMT VDB Cinder Volume image name
+ cinder_delete_on_termination_true:
+ type: boolean
+ description: delete cinder volume upon instances termination
+ cinder_delete_on_termination_false:
+ type: boolean
+ description: keep cinder volume upon instances termination
+ vnf_id:
+ type: string
+ label: MSP VMT VNF ID
+ description: MSP VMT VNF ID
+ vf_module_id:
+ type: string
+ description: Unique ID for this VF Module instance
+
+resources:
+################ Cinder Volumes ##############################
+ vmt_volume_0:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: vmt_volume_name_0}
+ size: {get_param: vmt_volume_size_0}
+ image: {get_param: vmt_volume_image_name_0}
+
+ vmt_volume_1:
+ type: OS::Cinder::Volume
+ properties:
+ name: {get_param: vmt_volume_name_1}
+ size: {get_param: vmt_volume_size_1}
+ image: {get_param: vmt_volume_image_name_1}
+
+################ Ports ##############################
+ vmt_oam_protected_0_port:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_protected_net_name}
+ fixed_ips: [{"ip_address": {get_param: vmt_oam_protected_ip_0}}]
+ security_groups: [{get_param: sec_grp_msp_id}]
+ replacement_policy: AUTO
+
+################### Servers #########################
+ vmt_zrdm5bpxmc02vmt_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vmt_name_0}
+# image: {get_param: vmt_image_name}
+ flavor: {get_param: vmt_flavor_name}
+# availability_zone: {get_param: availability_zone_0}
+ block_device_mapping_v2:
+ - device_name: {get_param: [vmt_block_device_names, 0]}
+ volume_id: {get_resource: vmt_volume_0}
+ delete_on_termination: {get_param: cinder_delete_on_termination_true}
+ boot_index: 0
+ - device_name: {get_param: [vmt_block_device_names, 1]}
+ volume_id: {get_resource: vmt_volume_1}
+ delete_on_termination: {get_param: cinder_delete_on_termination_true}
+ boot_index: -1
+ networks:
+ - port: {get_resource: vmt_oam_protected_0_port}
+ config_drive: "True"
+ user_data_format: RAW
+ user_data:
+ get_file: user_data_zrdm5bpxmc02vmt001.txt
+
+ metadata:
+ vnf_id: {get_param: vnf_id}
+ vf_module_id {get_param: vf_module_id}
+ "evacuation_policy": "Evacuation"
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar b/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar
new file mode 100644
index 0000000..69b1c23
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/service-VfZrdm5bpxmc02092017Service-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json
new file mode 100644
index 0000000..0dd1193
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/testStructure.json
@@ -0,0 +1,217 @@
+{
+ "distributionID": "a2872f55-8628-4486-8548-7b132c9a47db",
+ "serviceName": "Vf zrdm5bpxmc02092017-Service",
+ "serviceVersion": "1.0",
+ "serviceUUID": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "serviceInvariantUUID": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "serviceDescription": "Demo",
+ "serviceArtifacts": [
+ {
+ "artifactName": "service-VfZrdm5bpxmc02092017Service-csar.csar",
+ "artifactVersion": "1",
+ "artifactType": "TOSCA_CSAR",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": "0",
+ "artifactURL": "service-VfZrdm5bpxmc02092017Service-csar.csar",
+ "artifactUUID": "396cfd49-0f4b-4fec-9f33-0fd7e90d5a22",
+ "artifactChecksum": "MWQ3Y2FmMWExNDQyYWI2N2YwNjEwZGUzN2IzMzI3NjE="
+ }
+ ],
+ "resources": [
+ {
+ "resourceInstanceName": "Vf zrdm5bpxmc02092017-VF 0",
+ "resourceCustomizationUUID": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade",
+ "resourceInvariantUUID": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "resourceName": "Vf zrdm5bpxmc02092017-VF",
+ "resourceType": "VF",
+ "resourceUUID": "14ba5d1e-3862-407c-a236-1cbaebccce77",
+ "resourceVersion": "1.0",
+ "category": "Generic",
+ "subCategory": "Network Elements",
+ "artifacts": [
+ {
+ "artifactName": "pxmc_mmn_volume.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_mmn_volume.env",
+ "artifactUUID": "c1ae6284-48d9-4437-a195-b2cf2ba23070",
+ "artifactChecksum": "NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU="
+ },
+ {
+ "artifactName": "pxmc_base.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_base.env",
+ "artifactUUID": "6dd99c31-c52e-4c45-b99b-d223c877a296",
+ "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg="
+ },
+ {
+ "artifactName": "vfzrdm5bpxmc02092017vf0_modules.json",
+ "artifactVersion": "1",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "vfzrdm5bpxmc02092017vf0_modules.json",
+ "artifactUUID": "e3b82cd6-485e-4d56-8d2c-17ccf6a59533",
+ "artifactChecksum": "MjY0NzcxMjJkZGI4YzQ1MDU2NjhkNWYyM2IwNmYzYmU="
+ },
+ {
+ "artifactName": "pxmc_vmt.yaml",
+ "artifactVersion": "1",
+ "artifactType": "HEAT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "120",
+ "artifactURL": "pxmc_vmt.yaml",
+ "artifactUUID": "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "artifactChecksum": "ODE0YTRiYzc2YzkxOTliZjJhNjc0M2RhMWU4M2VlZmE=",
+ "generatedArtifact": {
+ "artifactInfo": {
+ "artifactName": "pxmc_vmt.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_vmt.env",
+ "artifactUUID": "bc1640f1-69f0-4760-8fc3-3318ec2ff129",
+ "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY="
+ }
+ },
+ "relatedArtifacts": [{
+ "artifactInfo": {
+ "artifactName": "user_data_zrdm5bpxmc02vmt001.txt",
+ "artifactVersion": "1",
+ "artifactType": "HEAT_ARTIFACT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "0",
+ "artifactURL": "user_data_zrdm5bpxmc02vmt001.txt",
+ "artifactUUID": "53acdabe-689f-45e5-8578-f1514d3529da",
+ "artifactChecksum": "MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ="
+ }
+ }]
+ },
+ {
+ "artifactName": "pxmc_mmn.yaml",
+ "artifactVersion": "1",
+ "artifactType": "HEAT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "120",
+ "artifactURL": "pxmc_mmn.yaml",
+ "artifactUUID": "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "artifactChecksum": "YmNiYTU5YTM4ODVhYTlhODc5NGMwNWZkZjI5MTRmNTE=",
+ "generatedArtifact": {
+ "artifactInfo": {
+ "artifactName": "pxmc_mmn.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_mmn.env",
+ "artifactUUID": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737",
+ "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ="
+ }
+ },
+ "relatedArtifacts": [{
+ "artifactInfo": {
+ "artifactName": "user_data_zrdm5bpxmc02mmn001.txt",
+ "artifactVersion": "1",
+ "artifactType": "HEAT_ARTIFACT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "0",
+ "artifactURL": "user_data_zrdm5bpxmc02mmn001.txt",
+ "artifactUUID": "5bc62c72-5f7a-40bc-a167-1a4fed9afdef",
+ "artifactChecksum": "OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU="
+ }
+ }]
+ },
+ {
+ "artifactName": "pxmc_mmn.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_mmn.env",
+ "artifactUUID": "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737",
+ "artifactChecksum": "ZGI1NzI2Y2FmYjFhOTM2ZDYwNzg1YWRhZjBmMTk2OTQ="
+ },
+ {
+ "artifactName": "pxmc_vmt.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_vmt.env",
+ "artifactUUID": "bc1640f1-69f0-4760-8fc3-3318ec2ff129",
+ "artifactChecksum": "MjdkYzY5ZGU0ZTlkZDlhNzI2ZGVhMjk1ODVhZTg1NTY="
+ },
+ {
+ "artifactName": "user_data_zrdm5bpxmc02mmn001.txt",
+ "artifactVersion": "1",
+ "artifactType": "HEAT_ARTIFACT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "0",
+ "artifactURL": "user_data_zrdm5bpxmc02mmn001.txt",
+ "artifactUUID": "5bc62c72-5f7a-40bc-a167-1a4fed9afdef",
+ "artifactChecksum": "OTMxMjk5Mzc1YmIxMzRlYmRlZWJhMjg0MWQ4YTI1NWU="
+ },
+ {
+ "artifactName": "pxmc_base.yaml",
+ "artifactVersion": "1",
+ "artifactType": "HEAT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "120",
+ "artifactURL": "pxmc_base.yaml",
+ "artifactUUID": "7e7f7356-11bd-4f2f-bbbc-5c10954e3189",
+ "artifactChecksum": "YThkNGFhZjAwNmM4NzMzODc0YzNhYTUxOTljNGQwNmM=",
+ "generatedArtifact": {
+ "artifactInfo": {
+ "artifactName": "pxmc_base.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_base.env",
+ "artifactUUID": "6dd99c31-c52e-4c45-b99b-d223c877a296",
+ "artifactChecksum": "OGM2MWIzZTA2OTc5YjQwNTM1NGVhODA0YTFkNzM4ZTg="
+ }
+ }
+ },
+ {
+ "artifactName": "user_data_zrdm5bpxmc02vmt001.txt",
+ "artifactVersion": "1",
+ "artifactType": "HEAT_ARTIFACT",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "0",
+ "artifactURL": "user_data_zrdm5bpxmc02vmt001.txt",
+ "artifactUUID": "53acdabe-689f-45e5-8578-f1514d3529da",
+ "artifactChecksum": "MzJmZjgyZWYwOTBjMTg5M2ExNWZhMmMwNzc1NWY1YjQ="
+ },
+ {
+ "artifactName": "pxmc_mmn_volume.yaml",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_VOL",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": "120",
+ "artifactURL": "pxmc_mmn_volume.yaml",
+ "artifactUUID": "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "artifactChecksum": "MzA5MGY5ODQ0NDY5MDhiMDM3YjFlNGIwNzJkNjFhOTI=",
+ "generatedArtifact": {
+ "artifactInfo": {
+ "artifactName": "pxmc_mmn_volume.env",
+ "artifactVersion": "2",
+ "artifactType": "HEAT_ENV",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": "0",
+ "artifactURL": "pxmc_mmn_volume.env",
+ "artifactUUID": "c1ae6284-48d9-4437-a195-b2cf2ba23070",
+ "artifactChecksum": "NmEyZjc1Y2UwZDMwYjFhNGRlMTMzN2JhNzdiMThjMGU="
+ }
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt b/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt
new file mode 100644
index 0000000..93a8ab9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02mmn001.txt
@@ -0,0 +1,412 @@
+#cloud-config
+# \hbrief cloud-init main template for MSP config
+# \hversion 0.0.11
+# \hdate 2016-05-09
+# \brief cloud-init template for MSP config
+# \version 0.2.57
+# \date 2016-09-19
+# Configuration created for MSP SLES_12 MMN
+
+chpasswd:
+ list: |
+ root:Ericsson
+ miepadm:miep1234
+
+ expire: False
+
+users:
+
+bootcmd:
+
+ - [ sh, -xc, "echo \"#################################################################\" > /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# * * * Cloud-init configuration is in progress * * * #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# The system will reboot shortly and then be accessible #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"#################################################################\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "if [ -f /etc/issue.orig ]; then cp /etc/issue.orig /etc/issue; fi" ]
+ - [ sh, -xc, "if [ ! -f /etc/issue.orig ]; then cp /etc/issue /etc/issue.orig; cp /etc/issue.ci /etc/issue; fi" ]
+ - [ sh, -xc, "/bin/sed -i 's/^DHCLIENT_SET_DEFAULT_ROUTE=\"yes\".*/DHCLIENT_SET_DEFAULT_ROUTE=\"no\"/' /etc/sysconfig/network/dhcp" ]
+ - [ sh, -xc, "/bin/sed -i 's/^NETCONFIG_DNS_POLICY=.*/NETCONFIG_DNS_POLICY=\"STATIC\"/' /etc/sysconfig/network/config" ]
+
+runcmd:
+ - [ sh, -xc, "chage -M 99999 root;rm -f /etc/shadow-" ]
+ - [ sh, -xc, "chage -M 99999 miepadm;rm -f /etc/shadow-" ]
+ - [ sh, -xc, "sed -i 's/^GRUB_TIMEOUT.*/GRUB_TIMEOUT=0/' /etc/default/grub" ]
+ - [ sh, -xc, "echo GRUB_FORCE_HIDDEN_MENU=true >> /etc/default/grub" ]
+ - [ sh, -xc, "/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg" ]
+ - [ sh, -xc, "sed -i 's/^.*:.*/admin:6041A28W2rLq6/' /opt/miep/tools/lighttpd/lighttpd_auth.properties" ]
+ - [ sh, -xc, "sed -i 's/^.*=.*/admin=709e17d2a62751a051fa2072f0976334/' /opt/miep/register/conf/auth.properties" ]
+ - [ sh, -xc, "sed -i 's/kernel\\.unknown_nmi_panic.*//' /etc/sysctl.conf" ]
+ - [ sh, -xc, "sed -i 's/kernel\\.panic_on_unrecovered_nmi.*//' /etc/sysctl.conf" ]
+ - [ sh, -xc, "echo \" kernel.unknown_nmi_panic=1\n kernel.panic_on_unrecovered_nmi=1\n\n\" >> /etc/sysctl.conf" ]
+ - [ sh, -xc, "sed -i 's/^\\(IRQBALANCE_ARGS=\\).*$/\\1\"--hintpolicy ignore\"/' /etc/sysconfig/irqbalance" ]
+ - [ sh, -xc, "sed -i 's/^ListenAddress.*/ListenAddress 107.112.138.70/' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i 's/^ClientAliveCountMax.*/ClientAliveCountMax '0'/g' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i 's/^PermitRootLogin.*/PermitRootLogin 'no'/g' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i 's/^#UseDNS.*/UseDNS 'no'/g' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "echo auth optional pam_faildelay.so delay=5000000 >> /etc/pam.d/sshd" ]
+ - [ sh, -xc, "echo trap2sink 127.0.0.1 >> /etc/snmp/snmpd.conf" ]
+ - [ sh, -xc, "sed -i 's/^agentaddress.*/agentaddress 107.112.138.70/' /etc/snmp/snmpd.conf" ]
+ - [ sh, -xc, "sed -i 's/^ IP=.*/ IP=\"107.112.138.70\"/' /opt/miep/snmp/tools/agentmonitor.sh" ]
+ - [ sh, -xc, "sed -i 's/^ SNMPCOMMUNITY=.*/ SNMPCOMMUNITY=\"SNOS-PE\"/' /opt/miep/snmp/tools/agentmonitor.sh" ]
+ - [ sh, -xc, "sed -i 's/^ IP=.*/ IP=\"107.112.138.70\"/' /opt/miep/snmp/tools/agentmonitor_sle12.sh" ]
+ - [ sh, -xc, "sed -i 's/^ SNMPCOMMUNITY=.*/ SNMPCOMMUNITY=\"SNOS-PE\"/' /opt/miep/snmp/tools/agentmonitor_sle12.sh" ]
+ - [ sh, -xc, "/sbin/yast2 dns edit nameserver1=155.165.194.100" ]
+ - [ sh, -xc, "/usr/sbin/wicked ifdown all; /usr/sbin/wicked ifup --timeout 60 eth0; /usr/sbin/wicked ifup --timeout 60 all" ]
+ - [ sh, -xc, "mkdir -p /opt/miep/tools" ]
+ - [ sh, -xc, "wget --directory-prefix=/opt/miep/tools http://107.112.138.71/miit/zrdm5bpxtc02/custom-files/zrdm5bpxtc02/AttMspCust.tgz" ]
+ - [ sh, -xc, "export TERM=vt220 ; yast keyboard set layout=english-us" ]
+ - [ sh, -xc, "sed -i 's/YPSAddress.*/YPSAddress\"\tvalue=\"https:\\/\\/yps.ericsson.net\\/YPServer\" \\/>/' /opt/miep/etc/license/SentinelCloudRuntime.properties" ]
+
+ - [ sh, -xc, "umask 027 ; /opt/miep/tools/mnsetup/initmn.sh firstinstall 2>&1 | tee /opt/miep/tools/mnsetup/firstinstall.log" ]
+ - [ sh, -xc, "chown root:root /opt/miep/tools/AttMspCust.tgz" ]
+ - [ sh, -xc, "chmod 440 /opt/miep/tools/AttMspCust.tgz" ]
+ - [ sh, -xc, "mkdir -p /opt/miep/tools/AttMspCust" ]
+ - [ sh, -xc, "chown root:root /opt/miep/tools/AttMspCust" ]
+ - [ sh, -xc, "tar xfz /opt/miep/tools/AttMspCust.tgz -C /opt/miep/tools/AttMspCust" ]
+ - [ sh, -xc, "/opt/miep/tools/AttMspCust/CloudInit/cloudCron.sh 107.112.138.71" ]
+ - [ sh, -xc, "mkdir -p /opt/miep/etc/certs/manifest/ca/" ]
+ - [ sh, -xc, "chown -R miepadm:miepgrp /opt/miep/etc/certs/manifest/" ]
+ - [ sh, -xc, "mkdir -p /opt/miep/etc/certs/origin_server_ssl/server_cert" ]
+ - [ sh, -xc, "chown -R miepadm:miepgrp /opt/miep/etc/certs/origin_server_ssl/server_cert" ]
+ - [ sh, -xc, "sed -i 's/KexAlgorithms/#KexAlgorithms/g' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "wget --directory-prefix=/opt/miep/tools/AttMspCust/CloudInit/msacerts -e robots=off -r -l1 --no-parent -R '*html*' http://107.112.138.71/miit/zrdm5bpxtc02/custom-files/zrdm5bpxtc02/msacerts" ]
+ - [ sh, -xc, "mv /opt/miep/tools/AttMspCust/CloudInit/msacerts/107.112.138.71/miit/zrdm5bpxtc02/custom-files/zrdm5bpxtc02/msacerts/* /opt/miep/tools/AttMspCust/CloudInit/msacerts/" ]
+ - [ sh, -xc, "mv /opt/miep/tools/AttMspCust/CloudInit/msacerts/keystore* /opt/miep/tools/AttMspCust/CloudInit/msacerts/.keystore_`hostname`_gno" ]
+ - [ sh, -xc, "rm -rf /opt/miep/tools/AttMspCust/CloudInit/msacerts/107.112.138.71" ]
+ - [ sh, -xc, "sed -i 's/PASS_MAX_DAYS 60/PASS_MAX_DAYS 99999/' /etc/login.defs" ]
+ - [ sh, -xc, "sleep 61s" ]
+ - [ sh, -xc, "mkdir -p /usr/java/default/bin/ && ln -s /usr/bin/java /usr/java/default/bin/" ]
+
+timezone: 'PST8PDT'
+
+write_files:
+ - content: |
+ H4sIANk1vFkAA41Sy27bMBC88ysW8TViKaWNC92MAkV9KOIi+QFKWllE+RBIyo9+fZeW7DqxDHR10c4OZ3aXXEDnQgxwjrdOBWiVRmgw1F5VGECCHUyFHlx7YltpMIsuk03jMQS2gPdhZN8ruyUd5yF2CG/fNp/WGwhDFY4houEA6whkZEhNH28EhoANyAiVcxGiMvgI+w4tWAfJGwL6HXpqzCP4wVoy4zciLxaCkVrD6BkeqZXzbLW0UOHooyyVZZOGkzciD8mvebi2TU6vRxvloWQL+l9vstW4CIDvg9bZr0Fq1Spssh/TsgBeO+fjJadzLC+WXNCXT07a1VKn7V7ybcoYOYQeayU1Oe2eYVo6BlaW+exJ1e+esytwyl1fyfo3Yy0KUZbiimaRbNr2Cja1DLH32KpDKhTJ6lSgfVpHL2NCiwvq3RDpSib86YKfXhdLU2QzAS+rn2msz7A6jzXLo3WJJc/zgudPX/lSAPzxjflS9QdTi8IYK0TO97Lf7rlxFd1w3zmLnAabY85hmZPmHn5PeWS8b+2D+M7E/2xtZM5ht639w+8pjwzG/gJrL8X/3wMAAA==
+ path: /etc/hosts
+ owner: root:root
+ permissions: '0644'
+ encoding: 'gzip+base64'
+ - content: |
+ ################################################################################
+ ## /etc/ntp.conf
+ ##
+ ## Sample NTP configuration file.
+ ## See package 'ntp-doc' for documentation, Mini-HOWTO and FAQ.
+ ## Copyright (c) 1998 S.u.S.E. GmbH Fuerth, Germany.
+ ##
+ ## Author: Michael Andres, <ma@suse.de>
+ ## Michael Skibbe, <mskibbe@suse.de>
+ ##
+ ################################################################################
+
+ ##
+ ## Radio and modem clocks by convention have addresses in the
+ ## form 127.127.t.u, where t is the clock type and u is a unit
+ ## number in the range 0-3.
+ ##
+ ## Most of these clocks require support in the form of a
+ ## serial port or special bus peripheral. The particular
+ ## device is normally specified by adding a soft link
+ ## /dev/device-u to the particular hardware device involved,
+ ## where u correspond to the unit number above.
+ ##
+ ## Generic DCF77 clock on serial port (Conrad DCF77)
+ ## Address: 127.127.8.u
+ ## Serial Port: /dev/refclock-u
+ ##
+ ## (create soft link /dev/refclock-0 to the particular ttyS?)
+ ##
+ # server 127.127.8.0 mode 5 prefer
+ server 135.144.38.211 prefer
+ server 155.165.201.253 prefer
+
+ ##
+ ## Undisciplined Local Clock. This is a fake driver intended for backup
+ ## and when no outside source of synchronized time is available.
+ ##
+ server 127.127.1.0 # local clock (LCL)
+ fudge 127.127.1.0 stratum 10 # LCL is unsynchronized
+
+ ##
+ ## Add external Servers using
+ ## # rcntp addserver <yourserver>
+ ##
+
+ ##
+ ## Miscellaneous stuff
+ ##
+
+ driftfile /var/lib/ntp/drift/ntp.drift # path for drift file
+
+ logfile /var/log/ntp # alternate log file
+ # logconfig =syncstatus + sysevents
+ # logconfig =all
+
+ # statsdir /tmp/ # directory for statistics files
+ # filegen peerstats file peerstats type day enable
+ # filegen loopstats file loopstats type day enable
+ # filegen clockstats file clockstats type day enable
+
+ #
+ # Authentication stuff
+ #
+ keys /etc/ntp.keys # path for keys file
+ trustedkey 1 # define trusted keys
+ requestkey 1 # key (7) for accessing server variables
+ controlkey 1
+
+ # by default act only as a basic NTP client
+ restrict default kod nomodify notrap nopeer noquery
+ restrict -6 default kod nomodify notrap nopeer noquery
+ #
+ # allow NTP messages only from the loopback
+ restrict 127.0.0.1
+ restrict ::1
+ path: /etc/ntp.conf
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ # default <OAM GW> - -
+ default 107.112.136.1 - -
+ path: /etc/sysconfig/network/routes
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+ <trapDestCfg xmlns="http://www.ericsson.com/esa">
+ <managerDefinition snmpVersion="v2c" active="yes">
+ <ip>107.239.72.10</ip>
+ <port>162</port>
+ <securityName>v1v2ReadWriteSecName</securityName>
+ <securityLevel>noAuthNoPriv</securityLevel>
+ </managerDefinition>
+ <managerDefinition snmpVersion="v2c" active="yes">
+ <ip>135.207.171.152</ip>
+ <port>162</port>
+ <securityName>v1v2ReadWriteSecName</securityName>
+ <securityLevel>noAuthNoPriv</securityLevel>
+ </managerDefinition>
+ </trapDestCfg>
+ path: /opt/miep/tools/AttMspCust/CloudInit/trapDestCfg.xml
+ owner: root:root
+ permissions: '0755'
+ - content: |
+ [
+ {
+ "networkname": "OAM"
+ },
+ {
+ "networkname": "Internal"
+ },
+ {
+ "networkname": "Access"
+ },
+ {
+ "networkname": "dmz_untrust"
+ },
+ {
+ "networkname": "dmz_trust"
+ },
+ {
+ "networkname": "dmz_trust1"
+ },
+ {
+ "networkname": "dmz_untrust1"
+ },
+ {
+ "networkname": "Internet"
+ },
+ {
+ "networkname": "ControlPlaneSig"
+ },
+ {
+ "networkname": "AccessIngress"
+ },
+ {
+ "networkname": "InternetIngress"
+ }
+ ]
+ path: /opt/miep/init/networknames.json
+ owner: miepadm:miepgrp
+ permissions: '0644'
+ - content: |
+ BOOTPROTO='static'
+ IPADDR='107.112.138.70'
+ BROADCAST='107.112.143.255'
+ NETMASK='255.255.248.0'
+ NETWORK='107.112.136.0'
+ STARTMODE='onboot'
+ DEVICE='eth0'
+ USERCONTROL='no'
+ NAME='OAM'
+ DEFROUTE='yes'
+ CHECK_DUPLICATE_IP='yes'
+ SEND_GRATUITOUS_ARP='yes'
+ path: /etc/sysconfig/network/ifcfg-eth0
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ path: /etc/udev/rules.d/10-local.rules
+ encoding: b64
+ owner: root:root
+ permissions: '0640'
+ - content: |
+ #
+ # VERSION: <Auto generated by 1.0.2.3>
+ #
+ # This file contains the variable definitions to pull RMS Input Files from the PCRF.
+
+ # The PCRF_PRIMARY variable specifies the Primary IP the MSP should use to connect to the PCRF.
+
+ PCRF_PRIMARY=107.122.136.120
+
+ # The PCRF_SECONDARY variable specifies the Secondary IP the MSP should use to connect to the PCRF.
+
+ PCRF_SECONDARY=107.122.136.121
+
+ # The PCRF_USER variable specifies the user value to use when performing the secure ftp transfer.
+
+ PCRF_USER=msp
+
+ # The PCRF_PASS variable specifies the password value to use when performing the secure ftp transfer.
+
+ PCRF_PASS=@TTmsp123
+
+ # The PCRF_DIR variable specifies the directory on the PCRF server where the RMS Input Files are located.
+ # This is the directory the secure ftp transfer will change to before pulling the RPM Input File.
+
+ PCRF_DIR=/home/msp/downloads
+
+ # The PCRF_PROMPT variable specifies the sftp prompt string that MSP can expect the PCRF server to
+ # display as a prompt when remotely connecting to the PCRF server using sftp.
+
+ PCRF_PROMPT=sftp>
+ MSA_GROUP_NAME=
+ path: /appl/rms/cfg/pcrf.cfg
+ owner: root:root
+ permissions: '0755'
+ - content: |
+ #
+ # reserved values
+ #
+ 255 local
+ 254 main
+ 253 default
+ 0 unspec
+ #
+ # local
+ #
+ #1 inr.ruhep
+ path: /etc/iproute2/rt_tables
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ ### /etc/resolv.conf file autogenerated by netconfig!
+ #
+ # Before you change this file manually, consider to define the
+ # static DNS configuration using the following variables in the
+ # /etc/sysconfig/network/config file:
+ # NETCONFIG_DNS_STATIC_SEARCHLIST
+ # NETCONFIG_DNS_STATIC_SERVERS
+ # NETCONFIG_DNS_FORWARDER
+ # or disable DNS configuration updates via netconfig by setting:
+ # NETCONFIG_DNS_POLICY=''
+ #
+ # See also the netconfig(8) manual page and other documentation.
+ #
+ # Note: Manual change of this file disables netconfig too, but
+ # may get lost when this file contains comments or empty lines
+ # only, the netconfig settings are same with settings in this
+ # file and in case of a "netconfig update -f" call.
+ #
+ ### Please remove (at least) this line when you modify the file!
+ nameserver 155.165.194.100
+ nameserver 155.165.201.100
+ search wapgw.mobilephone.net
+ options attempts:1
+ options timeout:6
+ path: /etc/resolv.conf
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ MN_OAM_IPADDR=107.112.138.70
+ SNMP_IPADDR=107.239.72.10
+ SNMP_PORT=162
+ MN_SERVER_GROUPNAME=rdm5b
+ STORAGE_TYPE=CINDER
+ SUPPORT_LANG_LIST={"en":"English"}
+ AUTOSTART=Y
+ AUTODBPATCH=Y
+ PRODUCT=MSP
+ MN_TO_OTHER_NODE_NETWORK=OAM
+ path: /opt/miep/tools/mnsetup/init.properties
+ owner: root:root
+ permissions: '0640'
+ - content: |
+ CAE_PASSWORD=wapwap12
+ MSA_PASSWORD=wapwap12
+ CAPLOG_PASSWORD=wapwap12
+ TRACELOG_PASSWORD=wapwap12
+ path: /opt/miep/tools/mnsetup/init.properties.sec
+ owner: root:root
+ permissions: '0640'
+ - content: |
+ 107.112.138.59 zrdm5bpxtc02adm001 zrdm5bpxtc02adm001-oam
+ path: /var/tmp/adm_hosts
+ owner: root:root
+ permissions: '0644'
+ - content: WwogewogICJwYXJlbnQiIDogInJkbTViIiwKICAiZ3JvdXBzIiA6IFsKICAgewogICAgImdyb3VwbmFtZSIgOiAienJkbTVicHh0YzAyIiwKICAgICJkaXNwbGF5bmFtZSIgOiAienJkbTVicHh0YzAyIiwKICAgICJkZXNjcmlwdGlvbiIgOiAienJkbTVicHh0YzAyIgogICB9CiAgXQogfSwKIHsKICAicGFyZW50IiA6ICJ6cmRtNWJweHRjMDIiLAogICJncm91cHMiIDogWwogICB7CiAgICAiZ3JvdXBuYW1lIiA6ICJ6cmRtNWJweHRjMDItVFMiLAogICAgImRpc3BsYXluYW1lIiA6ICJ6cmRtNWJweHRjMDItVFMiLAogICAgImRlc2NyaXB0aW9uIiA6ICJ6cmRtNWJweHRjMDItVFMiCiAgIH0KICBdCiB9Cl0K
+ path: /opt/miep/msaapp/apps/clusteradmin/clusters.json
+ encoding: b64
+ owner: msausr:msagrp
+ permissions: '0640'
+ - content: |
+ . /opt/miep/tools/AttMspCust/CloudInit/helpers.sh
+ cd /opt/miep/tools/msa
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set apsLicenseCustomerId '946935'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set apsLicenseUserId 'AT&T_Customer_Test_Lab2_vMSP_Nimbus'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set prsPrefixLookupTable '2606:ae00:af00::/41=64'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set prsDiamRealm 'zrdm5bpxtc02.msp.sd'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set htsHttpClientIpRangesBlacklist '172.26.14.0/25,172.26.17.0/24,107.103.114.0/25,107.103.113.0/25,107.103.112.160/29,107.103.121.0/24,107.103.122.0/24,fd00:2600:2600:100::/64,2606:ae00:b800:3441::/64,2606:ae00:b800:3442::/64'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_host '172.21.196.7'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_user 'cn=virNimbusV2L,ou=Users,ou=Administration,o=Cingular'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_pwd 'MSPLab'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_secondhost '155.165.172.23'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_seconduser 'cn=virNimbusV2L,ou=Users,ou=Administration,o=Cingular'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set attLdapPool_secondpwd 'MSPLab'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02 -m cast set idfMspIpAddr ''
+ ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set prsDiamMessageTimeout 16000
+ ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set prsDiamSlowPeerAlarmLimit 16000
+ ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set prsDiameterServerListenerAddressList '0.0.0.0:3868'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set ltmi.keyServerUpdateHostList 'zrdm5bpxtc02mts001,zrdm5bpxtc02mts002'
+ ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set omsNsIntrusionDetection 1
+ ./msaconfigctrl.sh -g zrdm5bpxtc02-TS -m cast set telGroup1FTPTargetServerName zrdm5bpxtc02adm001.wapgw.mobilephone.net
+ $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set externalnodeip='172.26.39.6' where servergrpid= '0' and vgindex= 'VG011'\""
+ $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set servingdestaddrranges='172.26.39.6/32' where servergrpid= '0' and vgindex= 'VG011'\""
+ $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set externalnodeip='fc00:a:a::700' where servergrpid= '0' and vgindex= 'VG013'\""
+ $SU -s $BASH - postgres -c "psql -d msa -c \"set search_path = msa,msp; update msp.virtualgateway set servingdestaddrranges='fc00:a:a::700/128' where servergrpid= '0' and vgindex= 'VG013'\""
+ path: /opt/miep/tools/AttMspCust/CloudInit/install_msa_zone.sh
+ owner: root:root
+ permissions: '0755'
+ - content: |
+ H4sIAJ4ywFkAA6ScTWOiyNPA7/VVclgwshMPz0EEjExAge5GuUUdNUIy2d0kvnz6f1WDCAjo5DlkNpF+Kbrr5VfV7ao/ujAb/VL2xsNGffHfp4Nw9ZfK/vr3ofv813I27mrdv7ebF6G8JY/x0uhNvG53ok+Wyu+76K+v/ifjv1QG//y34cqD4SjDKQ9/dNb3wf5pbLjvX6+92e6d/dCMhx/P64/p9u0/4y3++WPTs9XJrKd2+X77sHs6/Ibjr+G/xtu/P939X8v5z39f4rH9a6Wqm+k6Oq7DXd/V9Z3y9Luz/j+YmCrzj113sI4fuGVPuOXcGd5ve8D2KxZbrs803VN9W8QWD3hvPBn0ss/TPk+g6gFTdTZZKz+xExPcdrmyTP/24gcm3Mfsd3tiFdri3+kkIGcZ+dwyfTF6eFJ7Y4+rVqFRSYKpkpiT7ezoHPnOZbGCEsFlg8bOmmCsux8bnjY2zJ3Ddl8edzkEItKFmUxY0hsLrqRrQCKbloGfh57wbaZoK2qcDuROfJPfyb+pL5j84Ulpb9w0qLASzxfQM5jiW5NEt3isXAyWNsranF/P84TLhNILfKsH3OfuiMU9hynL6DQrEz3L47Swus5Vd8pU25yqvuUpmzFT9hNfTVae0jNpSwH31JbbZlpjXxW6r4jsoSb4cfd1+bnUA9knMHtMgJVtH664nfgr714cl8PeRzS1V2KIv1s9ZxaODtP7yOWqvmKvycfsTRxxG0dMdflUAU1nvHaxLHzHQSh6uEEiSPUAt9Do7x2DHxwjPq0Z1Deu0Qmfo4RJshLCtXjSGwq+d0i9Ad93Mh8uNyMzeZuj2M+hRSJe7ZivB+CC5MphCnOq2NFUFcwX9srHFw/47m7e2b/NAu096uyTRSfZLBQ9Wbwm28W9+zV/AW0775T0oPJKwvV44hRfiysfKz/u4bPNhKs+rALu3T0xkwZhgdob4t6v5DZZPds3zluHSvQ0VaIJvkrgmxqfqvRakQU4wZ1joJE0NKDn551KGC702FNti3ExFqblTGDbx9lrHpR3I5yqFsdXC3Ahrdy4cNLJAHqNDc4zy/eVr+sJ7xVfz1hOXWXeUZNFgnYR4R9TZb+Zbe3VMlYZRy19DtWX5dRB6c6dKwPauOA4qW5BbkyGido2O3XKG1xIZOkO7hgtuCufAXXmew+VyEMj4rRN7NKcba72nnyRrBhPGMc1Q+e8wz74OVw8yLcP38cITPxMyG3du2yhOlsH/SNa7PkZlPeca+gjNugbfFJhxxeRxaweOhRbR8l030SFM7ofqY9M28KVxmdfINyVh3aCTgYlln4iVQNQbLQHdzRV1OKCkXcqxYaJ5QoPd8pXiwpGwQryWS4Divzs5IBoMf0VU6KVbyX0me2pPY/HPUBHaqNnFqwSztIBBrKRx4/FicrSQDZbKbydPHK1c0kqMgeKcFAMcafB0oAr/SIu7NTLTD3gpJ0aWq0tyAExhRaz4iez2eUsU1QqrrhBIPQ0apPKD3Sx6IgDerQYfz4X9z4clqGrPIe9T3zn+o4VCdH1OQIn/fny+x/6gdMvbT8o4T8jU/taDvl6OdxslgNdecbfce28EVjiGE1H6yD01qNBH39+u4OX3+vnqbNevAp0gepHFPpJhJ3mB/0lCvT3aCg+l8NkOwt3659rUH7+fJEP5aiBtQxwts085J8jy/+NHc7vPein0gzdzfxlqYyGdoK/w+9ZqL1FKMEMZ32eeutlJ/lvXpRmaHVo5vmbq2Bb7CheI5QOX0W+DtDMJP7PtZTm7H1edPY89ZOnl372eqUfKY1cJ7hhIfEHlSfSmSUudIcrgMoSuxR4A4rUXMn+rjaMxRDV32L0bGsex6x/cLfYPhZwflBSaXxYREOv3iboM8gMqIqBJ8PCzxbnQWhgVQzIhnJ7obj5pORQWmdkDzXSPCDZSXNgJiQU3iZ+QhjkPqHhPFL4pzU5NSpJUB2M7aFefLMkVZMkkmohM2XHYeaOVvdi5rRhScISMsFtzFQeoLTVgOZaZMZ4h9P1O9ipNmJlEoXM9E/ACnfIkmMfF0nEexPRuBytTj5BuEVM1LmlE+WEBPPwhMjj8WXTbBTuAl9YIkDFOwUbih2ojb7gSeBDISo3eWe5E1VFyj5/UuFSTQeXSkbSlLXzHF+AVd851zYDDYjAs5q0nDy62TMCDNbgqxSZNV0MIkRcV0Xv+zUPxQFBPMHfV2xovThJr0M+EQd/n4e2upC8nQ7gg1oitkw8P+JmvvKobE53TLtVlyqgPmQuvLCVsTZhMSen4iDVVYk+myTfQcioTPcoKolYBLgbGKGsx8vZzhiQbyXuJKQwihyAKMgFRuFYmH/kbEB1qvrwh84GSkryHWcDBW+TOxvUShFizBSo0lcdDzR4nrpXwd2pQSGovF/VO7WiUYLGppCfNEUgMxkFB8PMLmS1nuohf57yJeZaHNV+B1+VB0VjQn1QvZQb0wElmA90lym2jevGw0B3gJkE4O6ECV1nmE9VYQwHMlGJCJlxIIQPlJhR/iUVDieAwgypcvnoVAi+Mavle2xojyl1mjZOAim14co7ONOIErTQQq/EoxVLcGpS822suNv46MpdQyXCbQ9Qkqm6Wcm4KesKHFV6WxKdiM3yhbefbEe78UBnI9N6QrIzR5bLsaMlDNJKPwCfC+6U39sIhB9NYl9nJmZ2qESegotWbvOMoJZaLbDuvctGOweDTRgnXo3DpW0ULPGD8GStCZo20b38HAoPSmHPnQiucZ7EdyLU3pdDEaP4ygypZnE8dca+rAtF0SglQNfuMpk2xqouDA1tw+W+2f/hZD9+rGHajL9TiolPABeF8TRRdVFhrkXqS3uBJoO52V6gyWDO9iKz/vqoTuEQKEUqGspXViao2kiWyKeD+K/JAUPB5yxUExiZ+83pj9TJnhsWZ/PjJJBZTsobw+epfVwOkX4hpHpUZPOEaiqXHdGgyHOdUqXiZGg7NXUYOVtWuCiK+lTo7A0tZTk41S3Q05YKFHLVG6wzq4xklkkZrzR7qLH75rVAq+RoK6jFpo+mzhPfRX7QuEy6Cn7BNwUlrlzWIso7gtu7TGt3aUw1kCfRVFM+fqwr5qXwgaqeWjBu+XrND7oeKFbgo8mjCwDyAaSVmc2bFasks9ZMXA+UTrpDW1hxqQ0UTdo9UrWLCnrvNrfaLDY51+5AMaWjLT+oeGwV18OyI/QLn5S0YM7FlrilkaySwNkPlMRHs61araCapOn3x0c9/VGiMTM1wD9oJyzTR7+IvkAWqxi3eDncXUSunO6glJTXhX6qeBQjeJXqoC5BPxe75f7jdloEJlMVd4LquiW6g/Mqk9+jIl/B/WuuMdOcI0+j2uVzmhQKMRIXNLYMtEQWyChFRc3RYWzMMDGrDCKlEbJOBRW3TttGVTL50NmOuu7W0dzUtZeeFdbh/wkgAyg51MtG5Z2oOwiAyklAmjIF0vv0hlnERkAlrXQuGJsyAShtZZ341f2vbj+UZu8e3e1CcbbOFyeH04BDXPkQ5y0FbeiJ33uHjhO2sfp0NNWxNdqTdgaqODNECcTw/RVfZLsCd64x6owN75hlN6aQSlPO6KTC5eshY8lJWsyzlIuHFzCGymahMq04cgUuLnKFe/IPrgD0xjj7lYZtgwLSytZ8qEjiV11ZioyYVnKqIuvCS3ozqknggoJgjBbTw8VEG2D9HS7m3knVuKkTnefkUkFVrFNcvBg00Mfzjp9klbDN/NVN5OvDRefmd8Y4wjzVRicsa3J37LUXRwHodlYm2kZV0VvKa4XtBVo4zJ9tlhbvLIcZ1TWg0rsrZy1pJkZ1ri4naBdIKaYwAhMzPLP3mJNdrK58bg1I0QonR5cHR3DJjhhUH/aTOEKSI1UfaY7R/3KQTlO9Qe91LEY2yDsdJ7H73/xexOeGTt3gyiS2ERGdNR/2jstHHTbPobdmw2QbhdoxCnSXtmyerkXaobKAuCMr96hJP+FjO8ga3pcb0nEEOVZXsGwnKB/1ZC3ClOcdsn6NvpODiu7ISo/gUOMMmbiWdUJnmEYL0yofDB77XWfrUdy0xriyPD8UvDQkcusuundqI/hR4x6FBCmFj5TWA0ajC1FeNIZUMVX9yVSxMW4UDomMLqo6xdk99ulxpvYGgNxUOLvyagbS8d0jGxGAMStZFY+uJD5BOto5y1X2UWXW4is5yDmogPjaiIsOGh3Fi9KHJbUVAhMzlA5nFrznTl4TJQqRIVVLYArJKRNCRIQJKy8crpY1FpRLIhaiZaYWedRsTFI+UNkunkPaoJykkZe+MGWqTVvR++LNV6nMzEJr+zxMPiMIdmtcSOfk3qsdL+NEhPEjcc4GCLbpGrIOlw6ATibg+6iWK8sDoCa7Bhog6CEdfLI+ujOOFsi7fGuuG0WuSkznm+mM5I2cCuGTl8JMJ0nLbHRQEkrLrBznwvXapPSRaEjhNCU69Fi4jceT8kHrjOgz0DMHpMrxbsxmKlllpS2cG5fMOw2BXI1WknAwkpNiOduu4jKTDsbUMcZbkhDqRRzdsiaY1DuqgyS2xyiM2EelpIaZy1pbWRc4zWru0E8aI1MIfuhj2PtNZ9sH90UXPu+2DN6HW8TVcAvjeZh8jsysvHjoH0YmZogxX4N7XGhUOmzsfG2BAUUZG10UmQ5IGwfqNg8E53dyj92dy2a7sRHfu0ez26xMpXotyHdHZ+Fgopp2IBxm/Q5CeXfM1vK+R12b4vnFxSBZkc9OHetMcbdrbWz095lU6L336bE2mkIAoo7cWq5yXFz3gJb7HmkllFPySiUlhy0+HIN/OGy9Rl35O/uBT/xnJ9Mj0woqGa4VWjrueXadBxNbX2y8QNjp9ZesfgVn3KFoze/Okfvq6UnK4HBTDtFWk4ErRcyt03GP3sF5kcrl1hzlQu7ecwhHein7TnPPt5RbuE8Y3cZIHwNfjMr6QO/oY9qe6QAC96zrGmaaqJ4pvp5yIbUDMxd3W0XCVspHfAZK1i0H6SQLIJEdUlS+HdahNgX4E1iHevCu4eoLUM36QA2t3wzrA539moJLTLAOEAWXQ+tz1uFV8S+OYCqLCTKA8jjxUl3XcNSrg5b6ANs2i08HIlyRA+Mu7KoDpUAPVey3rt3K0typInSPSlCS7mE5aaT7Ghx2LhcUTtuUEn1dp6NmzIc9NTq3K8VYyGHb0AZU7RmZ7hfmUOrizU7mbx4SPJ2477+iDgWc/fusIz4XHY5QgilSuCOePA1QXVByMos7qQvck4uYUn0Zmek+DJVP0NuoXnZzL8AsRh43TfJLR82Uj2oOhSIWRj/VP10BzAzNwQA0oguGtYRfugeSkXoO6sKkmguJnyBvqytOg1uicqCMSA0ZoVcBnSJVC+EX1gJS2EYvZYk4meBuECuWBzNOg9VSPqSYXxVNSubrDMMeVYXb4B1K9P7maot7r0rv7fAOZ3o/WeXlACcELodD8tz4OZRMG2G0v/ZeLUobvVno/jsLl5jtu5xS6ZSrL3JxqI46pEtDcqFSSxz4FP6PpwEqZI9SQdMA2atVK0W4daPjyJS3cwazqZuMwNI3s87HJkJjqVL7bdAOLdR+G7RDC7XfBu3QQu23QTu0UPtt0A4t1H4btEMLtd8G7dBC7bdBO7RQ+23QDg0rnEmSQntfadkpaKH226AdWqj9CrTTLqFk0ELtt0E7rDX3KO+LX1L7bdAOLdR+G7RDC7XfBu3QQu0ZU1+5vQgtt69uuw8BjbevnCNdKDO1JzVbn5p7MeQaoQjb6Nqecb+JUDQ3eEAjigLC5HKZvbQeHvJkoUq+9Q6YlCmyUxnWG2Et4ODl4lZZupHmJdHKe8iGx/dgnO/YC0dcoG/e0Gg4jXeh1Jh193VU30K0mC1yuq5gW372xQVcTE7ZDQaYnTN4yC4rVzqV+oDS/K6no+nLQYnkPqOp//7r1YLTHdIamr+teg6y5nYesXbAtlKbBw3VcTpVrQ50BvUyR7VXxK9/lQJK36W4pFqzcXdSUD9//6LQybnzMB0QBRR2jnWDe3degqYCB92b37vKYmi9RwPdeQ5dBHIEC1P9iobiv3Mif6HiaaE8luf+p/wyhfFiw7wyXl8YJw8GdK2vGc7LTramOK4ZyA/rgysvhdSAebmWX+brxB8Q1dL9qEpZvbY+vfJiUSl2m2qKy3ALfLeyN9wC363sDUze5i8W8yWQtxTBlbuoY+/oZo6sqkMRzEteuIGt4+V71DHXs9dEGT3qyeIF9GMUUnZXQ/StQJ7zOORAXjXxK0BeyDcbgdyT33JoAvJcKrgRyNFSDhmQu/OOliyHyd8zlHjege43gfzMUd8F8pw74btAnvM4fBfIcx6H7wJ5Pil8F8hL57zfAvJ8cPgukOc8Dt8F8nyBoQ3ItVuq6PBdIM/XDL4B5ONSFR2+C+SSx4m94LtAnrM2fBfIcx6H7wJ5zuPwXSDPeRy+C+Q5j+f1qAqQd68Bec7jUAvkInDYFSDPeRxksVt1DbNLVx9vB/Kcx6H7TSDPORu+C+R5W/gukOdsDU1AflFirgB5zuPwB0DO18J0vZFpbWeH7tp+0SeLR/8d0FVl4av7p9XyNILDuaTGPSqphe726aX/OjJ7O4yNH8/T9w3+92t+ca5xiubQetfllqsu0HrX5ZarLnCN7K9edQF516Wv1t91KV11cZDwCvh8MnEoNazedbnlqgtc1OmLd11uueoCrXddbrnqAq13XW656gKtd11uueoCpbsuiMe76n2Xa9dd4Op9l2vXXaD1vgvfZbGjpWoO1Tsvy5fFo/MnVXMo3nl5fA6Xm9HQfl8O9B19o3LRoW9PanHdPZjTNZhivtlyD8Y3EIf1WcfJHQv5FQnvcAO9N8E7upeuc4Qb6L0d3uFM72K0z+g991ajwWzN7nXMN9T3Xy86buHudN6bD1h3L6jx+krNN8x5BK3fMG8AtMo5TsOMzl0QavunrYkE39fcLd81MDdE1Yt1Dfx4mGw9FbX04BxxB7azXEKouTRzSxH8Tv7fOAyz48IxVloQeH89x4AUxj3FWftCsJFh7sdbMvFRZ2QJi22bB3eM8v3qBnHjOy/0P57D7vqUZ42M/7V3Js2JJEkUvr+/0hcWYdY6zEGIpZApQUACgpuEppAAqcusplqIXz8RmWRm7OER2dY2NtaHOhViJ/35889fjHZ8lWI2v2lzUQp7V3OgvMFXPPeAPWXrR8XuaOe5I2T31GZXo+Z4f8OFd5sJVPuXSf/2QtTUqvBuGoxwVaANYBXme77XOm3x3iIH1ZfZBSbtL8f5S8m37+dQlVt5oc0MHWkVtWCu5dvAuq/K9y66iyMn3m9O46/G53jeOE1u+Rv/R/7vNmulkO1eZHJf/vatF/3jPK9WVxxxkVW9oLHhWkog7STAtZTg3Em4OmcrBSm2AVC6amyMTklzhBAo/bcxa5tZa9QWmXSQoPTs6W5VvZl/uRACpRuZdIRA6UbMBSFQugFzGX0iBEo3Yi4w3Gsy73aXg+lu0e4e163j+9OKXQLfl68v35ZfOkpu2M9ysubsa7287abb4XL/tNr8WH91MdysBo2Xx7tjkNUuPAjirHbBaUec1S447SBZ7V9Jry9Z7cLfoLLaW6c/X1ZEq11w2hFntQtOO+KsdsFpR5zVLjjtiLPaBacdgVa7LtpRB1LP7gyxkHoJ3OBBSigyueVp58wpFV1bN2QfRiXbC7d40T6ebZB69uMDGVIff25W4x858S2667j+dX8ryV0FfzM8gMyi47fpgWnqc6LpZcOF12iKQ7GSWEEZz9llLhsGXC5zr8+a1X71sxwMwITAU2iEMmwB9LQFu29PccbPnbvnj/4v9nI7Se/Qysc2Nl1N6jVGrAgvWIM7Oo+R7rKYFquip+lqVp3Tm0aSrplqm3bs4rRvEqcwCO5Ob/rVHbCGfZekfe6aMsGx3i2ZXDTdOUqPnvCGTtJOdzNs/nh+6xat1C7BW3fIw0JGvS17CfZpwcTK3EMW4Xl+3I39jnq6rjaC6Eztt9jFlGnr7Wli9+7bMifWV3WzpK2vymem3gbqG2gS3yr93jP49oIvLzk9UmxiUwoaKXhrOG6k5CDkDjovwu379KZ5n/avRuy7At7Z8X/3WbuUhSFkil769smoC38/KuEOUZ1E7bQiJiRA4tFRAOmn5HxgjYgVSLfy6BCA9MaC10ULkH6r8+jsFz09TdDb0oD0ikfPn+250JWgAukqj86q8SCTTHDf0Hmnh6wAQ/PrXep+sLx9bL6WSR2ZXwtpN/GmofUP6h9pzwqKQ64tPN40RoPun8/D4/7frJKtV53XTWv5n82qUzwYojdIF8Prn0xGdsA05Ovz++Bjs2pyntoJpRuZdIRA6UYmHSFQutGGRwiU/jk2MOmQ/ujM4xiulzMLlK4x6exT2qI9+1yveOSdAUInMehwQegkBh0uCF1wRuwMOlwQetUuOBh0uCB0K4O+EDxsGBS8fkcu7Y3y3lywusn4z/T4vs+u1b0KiyeI9I/1R/csaWwIKt0n0met48d63n3jiYBbvtDwbcwEK9PVfC3C9ke6J6NlMYL709PnFvtGtg98T/MXh9OZQP31QhTssCj236b7Kacy/IIdFsWuz35nlWC/XJ3yixPKq1MsF4O6oPp31AXVE9QF1fuoC6p3UBdUl+Y4cVwM6oLqB9QF1S++vQdUv3JxMagLqj+iBqieq37UBdV34P78lcGfJ3MxqAuqP6AuqL5AXVC92M+KB9Uf4ADV2+Nev+HlYmAH1XMzw8vFQALVmY5kj3wO4mJQPt1YLqbMr54djutirS5IrMOg1sPEOgxqXdbVGoeviHUY1LpXrLNqNfj5wqo3k9MNPD1ujqPB3XHTOp5fvt3l6MpbTluQAHY41Pt0dWqwyvWLm1gv74vd4n358fQ4bmxL2pUbw3CvmBI2TBGh5mUxjwg1L38v4FHzk9S3YYoINS+LeUSoeVnMI0LNy2IeEWpeFvOIUPOymAdRzds3ShFAtZuhdgRQ7eaNUtgFOXGjFLY8GPJGKcrrvia+OzTPug4PM0377b+Sh8mGvgUPcxn8DX7yq9Dz+7JRkntv/+TD/JMP8zfmw3z+D+fD9P66fJhPo4D/P8qHCSDb//qcf3adzFjxFpls1wU8TjQFLwr4HGwfXzZNEUi2tzQBr/FRHmBdB9sRSLbrYDsCyXYdbEcOoSeqILWR7fqzgpVsT3bp8Pq85WcktZPd8v3I1N7vFdFZLosifv00G6YPr0F4FDcno+ayhq+kwgbKkDkZ2I/3oq2kJrCBMuSVVNhAGTInAxsoQ+ZkYANlyJwMbKAMmZOBDZQhczKQdlJjVlIRnAejindo6j10JRXSTmrMSiqkndSYlVSYFb3t4mJYTUU43a6spiJCzVdZMVzMI1fzCftBnfnBdNuv7uppNTs+f3Ewn2LFu3U1xYpHoJLXHxCBSl4X8ghU8vozRKCS14U8ApW8LuQRqOT1Z4tAJa8LeQQq+cqKb18+KeP8IigzBoFKXhfyUENjzm4lr98JrDuqbaIVj0Alb9pjDVPyupBHoJLXhTzKR6cpeV3II1DJZ9K4KQp5BCp59hu6k4U8qEo+tVnxcCr5JsGKR6CS12+HQCWvC/nCp6Uq+VwCjgQhj0Alrwt5FPe6W7aWb/7NUR1sl7kg1Vo7vhzXwl6acd8V4Ta74rIj3GZXXHaE2+yKyw7VZr/EiTqDHCWXHeE2u+Kyo25wY8YF1QpurPjq2ODG/NyHOsGNTE8SoBknMwMKNONkZkCBZpzMDCjQjJOZAQWacTIzsj9pgWa46n3crEZaT86FOighMk6hXvn2sbY7BKV+LG1361NO9QdEBN0uw+2IoNtluB0RdLvOmYfS7TLcrnHmBLpdhtsRQbfLD4oIul2G2325iya6XYbbEUG3y3A7+FMe74PodnM+TAjdLn1SfVjpdvYa12a6XcvJ8dLtTPHvdcVfCHp1vkmh2+XbIIJul+F2RNDtMtyOmic28bzBeic2pdXegenEpoo/10/WLtn8irc3bdCGnb/JSxtpGXbxeUr2068kTbgsSGFfgrXPfsdfV6f725sdE27jEYbHw/1bZWaSzgMRjl5+bMC5+cF+G3wLgOntAz9zsNNjOkPtQaGOHbIO55F9rItB92HBv//NriR9ivN8846HvQ+sIE+ZYuUf39RuaFaChImT9LH5MmLKdvDwxuQthB8Kl0JM3j3O+9fJTI2t0Ef5F12h5E+aD0256yd5H27eU7OsRyTzRadcHJ/ydjGVY/vZ9WHCe2/or5ldI85Xp3Fj+cQ37ycpj6qYsY58cztdJK3kvG1OUj7vyG4n991BwRFlbgRigyPKB0RscESZG1Hq6tDgCFNuc1hwRJkbYcttJkmALDcCscER5bO1zP39wRHlG4zY4IjsGfez85IigyPK3AjEBEdkP7CiA+bnHbTvq30kc+frQnug5N74GFr9hBbo3gof+LCr1t2scZxMF6fvWROXVqeHK/+HgQgKxYytUfPE6N/L+WZCim+4at7zS2Cv/zXujU7ZcZJNODbCrC3TDf/0im1aEFokZ8HJdJTojPI2kdOZ/LjMybTBrswey3WBS+WxFp7ySPLsKs36b9ae9q/n/JTtvKbCGCxlK0LZd0Lov79P2XXy+7Lx+pCqYSKm3W7jmCrPrzZkkeZnbvrbSPbSoFSg/LXzk2my8/QEr/J0lx5MuhOnhFUi9oV6Gaz23D0/NCe9pDFLl0OeqTXeJ+1xmn1C2e0o+7zBexiOnBziHgZihj9SCUDM8Eea/cD1FEl7GIgZ/kizH8QMfwx5QYHDH3nPPWT4czZ9UogZ/kizHxCGP9kPTAAquDAvpOHyAGPiiC3rQXfE9H5TFeaJt2lFHrx3PZ/z46QPg+QxsxMblyPqzf8nFR7U7PQWDQTvMV/WmEcFS4XAEcxgnpxllgoLU8qEKcaif/fKbebFcLB/ag0+NvPLIhz80RWeAgT9NAm5EfP4D4MuLJWoZEMmfHJQXLVN/ReMVJZclcqilH9HlJ4LRdMlAxOlN7vlgSKZxWpEo9kbD8O24GHK3pctJd4j42kNFanTzU78k6doUt8lzXFS1kuyH1N7tvyDW0msXu7O4/6iOTvcsT5qfR6fFx3+JcpuZ7qGqLnNNifUboSC6ITajVAQnVC7EQqiE2o3Qp38AynmA0Qn1G6EguiE2t9QEJ1Qu38JohOaGaHGmA8QnVC7EWrkH9qGa6cYdPvzuRgAsEoGU8CtMsdxAVeDPOffnvZnOvbmTj1HjM/mHthF9hv7+XbTQU6rZS5Pzs/p/ycVIn6drBORx/us2Ii80m4EIW1DCNs462EboPZWVggL9BOCLYUIZuGx9TmC1UeKSEew6ssQ6QjeiudfUBzBKvhWmzTi1uoIjpjK350sjqDMkcY4gtVLLuc4gY6gsJcU6QhWhiAiHUF1jhPuCFalwezL+R3Bqi8jnadmcATN3GCII1gZgoh0BC35UQGOYPVSEeEIbqVPCpGOYGUIItIR5EzM8/Cz9KNIjqAFF5Zyel3VywTgZZc6dX8zvHqhKl+R1QtV+YqsXmiEZEUJ1au12OdRHwh3BpX9RbSualYt2NrlA7VqQXyzoqoWoudYRdUCdY5lrVoQ33l9jsVEaNNTtVDayLFVC8IvMa5qIXqOVVQtRM+x1OtkfNVC9ByrqB+InmOZ+eqYqoXoOZalXkRULUTNsQ7CJ4XoOVZRtRA9xyqqFkLmWMaqpcx5XVWrY65acl5xTNWC2HRFVS2ITVdU1WJ9VjOyal0CDqPmWVJsFoJzs1S3EJRIH6dbCN0uDHQLYS9zRLcQul3ocQurdazcLYRuFwZmi0G3CwPdQuivOdAthH/k4HELEc1N2vxJOjdZuIXwFRuvW4hobrJwCy38Q4BbiGhusni2iOYm7ftZVG6SP+NJ78Z+fjfZLUQMNym5hdDtQoJbKFLfhjxzd+wwexN30owLxslIyIwLpiFX0IwLpiFX0IwLwpBrHRMY8AVCYIA7qh3GrPaQqHb4Bl56pIVSwQzzzcAKBt/Ay1vB4Bt4eedd8A28TPMuKc4evoGXt4LBN/DyVjD4Bl7eCoboXPuigrlzFykVDNG59kUFQ3SufVHBEJ1rr9XNaPKflD/prGCIzrWX5npRufbFHSE617546fANvLwVDL6Bl6P3ysN34D3eytd7wTfw8vZeMFuGAb0XzJZhm957QWq+mt50eb33QtF8Uc7UM1YumJovX++VsXRF5QIN1XBULtBQDUflAg3VcFQumJoveu+VlDxMjcoFGqrhqFygoRqOyoWaJ7I09PMvgiuXyg2GVy7UPJHl+B01T2RJl6h5IkvBgcSfyPLWRc0TWaRz7S+ohqNNNlYunbcPrVxV7kFs5YLQfOXHmTggQ2P/BfeZioT+CyGQobH/QghkaOy/YGvAhP5r5+y/YIMMx+krrf+CsQHb/Nh+zJp5/zXYPw2PvzbzT8vcC3Rcw3xyD/flqLiGcOUWixLouIZl7pVzYiRcwzL3ynMwhMHXsYhSNS+G63MvFIOvlhfXsMy9QMc1Si9fnnuBjmtYLsCg4xqWuRfouIZl7uXg7YkH/4KOa1D4BzeuYZl7gY5rWOZeoOMalrkX6LiGZe5l5mHywVfapxz869w7IB38CzquYZl75dcHefAln6bu672gNV8nP2wo9V6IgQ2l2gJT8xXUe4GOa3TMvRe8g68vT++FqOwLMfoCsYtd5SeIfHbZCl7sKgsSYhe7yr0uiRMLWewq+zIph3NhijaxLHaVrRXUgBBSPohYmBC72FXudSF2sUvbx4k+YMegqwMP2Omh7gE7S9Q9YCc7t7rWATuE/W5fPLdlnkU/YGeAugfsFOepORe7Ws54bkrf7Y7nhtykuRa7pqvTz2qxq9zrkq4PymKXFL50OVlA3z6G1XMyhIgYt49BXz+2bB8LHEhk1h6MNxIbM7X8Cf/3L/wXSFgwha/GAAA=
+ path: /opt/miep/etc/license/Cloud_Entitlement.combine
+ owner: msausr:msagrp
+ permissions: '0755'
+ encoding: 'gzip+base64'
+ - content: |
+ *.* @135.207.171.57:1538
+ *.* @155.165.162.48:1532
+ path: /etc/rsyslog.d/remote.conf
+ owner: root:root
+ permissions: '0600'
+
+scripts_per_once:
+
+power_state:
+ mode: reboot
+ message: Server will reboot now
+ timeout: 5
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt b/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt
new file mode 100644
index 0000000..4c8f7c0
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/user_data_zrdm5bpxmc02vmt001.txt
@@ -0,0 +1,289 @@
+#cloud-config
+# \hbrief cloud-init main template for MSP config
+# \hversion 0.0.11
+# \hdate 2016-05-09
+# \brief cloud-init template for MSP config
+# \version 0.2.57
+# \date 2016-09-19
+# Configuration created for MSP SLES_12 VMT
+
+chpasswd:
+ list: |
+ root:Ericsson
+ miepadm:miep1234
+
+ expire: False
+
+users:
+
+bootcmd:
+
+ - [ sh, -xc, "echo \"#################################################################\" > /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# * * * Cloud-init configuration is in progress * * * #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# The system will reboot shortly and then be accessible #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"# #\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "echo \"#################################################################\" >> /etc/issue.ci" ]
+ - [ sh, -xc, "if [ -f /etc/issue.orig ]; then cp /etc/issue.orig /etc/issue; fi" ]
+ - [ sh, -xc, "if [ ! -f /etc/issue.orig ]; then cp /etc/issue /etc/issue.orig; cp /etc/issue.ci /etc/issue; fi" ]
+ - [ sh, -xc, "/bin/sed -i 's/^DHCLIENT_SET_DEFAULT_ROUTE=\"yes\".*/DHCLIENT_SET_DEFAULT_ROUTE=\"no\"/' /etc/sysconfig/network/dhcp" ]
+ - [ sh, -xc, "/bin/sed -i 's/^NETCONFIG_DNS_POLICY=.*/NETCONFIG_DNS_POLICY=\"STATIC\"/' /etc/sysconfig/network/config" ]
+
+runcmd:
+ - [ sh, -xc, "chage -M 99999 root;rm -f /etc/shadow-" ]
+ - [ sh, -xc, "chage -M 99999 miepadm;rm -f /etc/shadow-" ]
+ - [ sh, -xc, "sed -i 's/^ListenAddress.*/ListenAddress 107.112.138.71/' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i 's/^ClientAliveCountMax.*/ClientAliveCountMax 300/g' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i 's/^ClientAliveInterval.*/ClientAliveInterval 10/g' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "sed -i '/KexAlgorithms/s/^/# /' /etc/ssh/sshd_config" ]
+ - [ sh, -xc, "mkdir /opt/miep/tools/miit/www/sles" ]
+ - [ sh, -xc, "rm -f /etc/sysconfig/network/ifcfg-eth1" ]
+ - [ sh, -xc, "mkdir /shared_nfs_datastore" ]
+ - [ sh, -xc, "mount -t ext4 /dev/vdb /shared_nfs_datastore" ]
+ - [ sh, -xc, "mkdir -p /shared_nfs_datastore/miit" ]
+ - [ sh, -xc, "cp -pr /opt/miep/tools/miit/* /shared_nfs_datastore/miit" ]
+ - [ sh, -xc, "rm -rf /opt/miep/tools/miit" ]
+ - [ sh, -xc, "rm -f /etc/udev/rules.d/70-persistent-net.rules" ]
+ - [ sh, -xc, "ln -s /shared_nfs_datastore/miit /opt/miep/tools/miit" ]
+ - [ sh, -xc, "chown -R miepadm:miepgrp /shared_nfs_datastore/miit" ]
+ - [ sh, -xc, "chown -R miepadm:miepgrp /opt/miep/tools/miit" ]
+ - [ sh, -xc, "mkdir -p /opt/miep/tools/miit/www/sles" ]
+ - [ sh, -xc, "mount -o loop /shared_nfs_datastore/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso /opt/miep/tools/miit/www/sles" ]
+ - [ sh, -xc, "/usr/bin/zypper ar /opt/miep/tools/miit/www/sles nfsrpms" ]
+ - [ sh, -xc, "/usr/bin/zypper lr" ]
+ - [ sh, -xc, "/usr/bin/zypper --non-interactive install -y nfs-kernel-server" ]
+ - [ sh, -xc, "/usr/bin/zypper --non-interactive install -y expect" ]
+ - [ sh, -xc, "/usr/bin/zypper --non-interactive install -y dos2unix" ]
+ - [ sh, -xc, "echo '//shared_nfs_datastore 107.112.136.0/21(rw,no_root_squash,sync,subtree_check)' >> /etc/exports" ]
+ - [ sh, -xc, "echo '/dev/vdb /shared_nfs_datastore ext4 acl 1 1' >> /etc/fstab" ]
+ - [ sh, -xc, "echo '@reboot /var/tmp/hostnamefix.sh > /var/tmp/hostnamefix.log' | /usr/bin/crontab -u root -" ]
+ - [ sh, -xc, "systemctl enable nfsserver.service" ]
+ - [ sh, -xc, "systemctl enable rpcbind.service" ]
+ - [ sh, -xc, "systemctl enable apache2.service" ]
+ - [ sh, -xc, "chkconfig mount_sles on" ]
+ - [ sh, -xc, "resize2fs /dev/vdb 200G" ]
+ - [ sh, -xc, "sed -i 's/PASS_MAX_DAYS 60/PASS_MAX_DAYS 99999/' /etc/login.defs" ]
+ - [ sh, -xc, "sleep 61s" ]
+ - [ sh, -xc, "su - miepadm -c \"ssh-keygen -t rsa -q -N '' -f ~/.ssh/id_rsa\"" ]
+
+timezone: 'PST8PDT'
+
+write_files:
+ - content: |
+ H4sIANk1vFkAA41Sy27bMBC88ysW8TViKaWNC92MAkV9KOIi+QFKWllE+RBIyo9+fZeW7DqxDHR10c4OZ3aXXEDnQgxwjrdOBWiVRmgw1F5VGECCHUyFHlx7YltpMIsuk03jMQS2gPdhZN8ruyUd5yF2CG/fNp/WGwhDFY4houEA6whkZEhNH28EhoANyAiVcxGiMvgI+w4tWAfJGwL6HXpqzCP4wVoy4zciLxaCkVrD6BkeqZXzbLW0UOHooyyVZZOGkzciD8mvebi2TU6vRxvloWQL+l9vstW4CIDvg9bZr0Fq1Spssh/TsgBeO+fjJadzLC+WXNCXT07a1VKn7V7ybcoYOYQeayU1Oe2eYVo6BlaW+exJ1e+esytwyl1fyfo3Yy0KUZbiimaRbNr2Cja1DLH32KpDKhTJ6lSgfVpHL2NCiwvq3RDpSib86YKfXhdLU2QzAS+rn2msz7A6jzXLo3WJJc/zgudPX/lSAPzxjflS9QdTi8IYK0TO97Lf7rlxFd1w3zmLnAabY85hmZPmHn5PeWS8b+2D+M7E/2xtZM5ht639w+8pjwzG/gJrL8X/3wMAAA==
+ path: /etc/hosts
+ owner: root:root
+ permissions: '0644'
+ encoding: 'gzip+base64'
+ - content: |
+ ################################################################################
+ ## /etc/ntp.conf
+ ##
+ ## Sample NTP configuration file.
+ ## See package 'ntp-doc' for documentation, Mini-HOWTO and FAQ.
+ ## Copyright (c) 1998 S.u.S.E. GmbH Fuerth, Germany.
+ ##
+ ## Author: Michael Andres, <ma@suse.de>
+ ## Michael Skibbe, <mskibbe@suse.de>
+ ##
+ ################################################################################
+
+ ##
+ ## Radio and modem clocks by convention have addresses in the
+ ## form 127.127.t.u, where t is the clock type and u is a unit
+ ## number in the range 0-3.
+ ##
+ ## Most of these clocks require support in the form of a
+ ## serial port or special bus peripheral. The particular
+ ## device is normally specified by adding a soft link
+ ## /dev/device-u to the particular hardware device involved,
+ ## where u correspond to the unit number above.
+ ##
+ ## Generic DCF77 clock on serial port (Conrad DCF77)
+ ## Address: 127.127.8.u
+ ## Serial Port: /dev/refclock-u
+ ##
+ ## (create soft link /dev/refclock-0 to the particular ttyS?)
+ ##
+ # server 127.127.8.0 mode 5 prefer
+ server 135.144.38.211 prefer
+ server 155.165.201.253 prefer
+
+ ##
+ ## Undisciplined Local Clock. This is a fake driver intended for backup
+ ## and when no outside source of synchronized time is available.
+ ##
+ server 127.127.1.0 # local clock (LCL)
+ fudge 127.127.1.0 stratum 10 # LCL is unsynchronized
+
+ ##
+ ## Add external Servers using
+ ## # rcntp addserver <yourserver>
+ ##
+
+ ##
+ ## Miscellaneous stuff
+ ##
+
+ driftfile /var/lib/ntp/drift/ntp.drift # path for drift file
+
+ logfile /var/log/ntp # alternate log file
+ # logconfig =syncstatus + sysevents
+ # logconfig =all
+
+ # statsdir /tmp/ # directory for statistics files
+ # filegen peerstats file peerstats type day enable
+ # filegen loopstats file loopstats type day enable
+ # filegen clockstats file clockstats type day enable
+
+ #
+ # Authentication stuff
+ #
+ keys /etc/ntp.keys # path for keys file
+ trustedkey 1 # define trusted keys
+ requestkey 1 # key (7) for accessing server variables
+ controlkey 1
+
+ # by default act only as a basic NTP client
+ restrict default kod nomodify notrap nopeer noquery
+ restrict -6 default kod nomodify notrap nopeer noquery
+ #
+ # allow NTP messages only from the loopback
+ restrict 127.0.0.1
+ restrict ::1
+ path: /etc/ntp.conf
+ owner: root:root
+ permissions: '0640'
+ - content: |
+ default 107.112.136.1 - -
+ path: /etc/sysconfig/network/routes
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+ <trapDestCfg xmlns="http://www.ericsson.com/esa">
+ <managerDefinition snmpVersion="v2c" active="yes">
+ <ip>107.239.72.10</ip>
+ <port>162</port>
+ <securityName>v1v2ReadWriteSecName</securityName>
+ <securityLevel>noAuthNoPriv</securityLevel>
+ </managerDefinition>
+ <managerDefinition snmpVersion="v2c" active="yes">
+ <ip>135.207.171.152</ip>
+ <port>162</port>
+ <securityName>v1v2ReadWriteSecName</securityName>
+ <securityLevel>noAuthNoPriv</securityLevel>
+ </managerDefinition>
+ </trapDestCfg>
+ path: /opt/miep/tools/AttMspCust/CloudInit/trapDestCfg.xml
+ owner: root:root
+ permissions: '0755'
+ - content: |
+ BOOTPROTO='static'
+ IPADDR='107.112.138.71'
+ BROADCAST='107.112.143.255'
+ NETMASK='255.255.248.0'
+ NETWORK='107.112.136.0'
+ STARTMODE='onboot'
+ DEVICE='eth0'
+ USERCONTROL='no'
+ NAME='OAM'
+ DEFROUTE='yes'
+ CHECK_DUPLICATE_IP='yes'
+ SEND_GRATUITOUS_ARP='yes'
+ path: /etc/sysconfig/network/ifcfg-eth0
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ path: /etc/udev/rules.d/10-local.rules
+ encoding: b64
+ owner: root:root
+ permissions: '0640'
+ - content: |
+ #!/bin/bash
+ ### BEGIN INIT INFO
+ # Provides: mount_sles
+ # Required-Start: network
+ # Required-Stop: network
+ # Should-Start:
+ # Should-Stop:
+ # Default-Start: 3 5
+ # Default-Stop: 0 1 2 6
+ # Short-Description: Mount SLES iso file
+ ### END INIT INFO
+ echo Mount SLES ISO image
+ mount -o loop /shared_nfs_datastore/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso /opt/miep/tools/miit/www/sles
+ path: /etc/init.d/mount_sles
+ owner: root:root
+ permissions: '0755'
+ - content: |
+ grep -qs preserve_hostname /etc/cloud/cloud.cfg
+ if [ $? -eq 0 ] ; then
+ sed -i 's/preserve_hostname: .*/preserve_hostname: true/' /etc/cloud/cloud.cfg
+ fi
+
+ /bin/hostname | grep -qs novalocal
+ if [ $? -eq 0 ] ; then
+ newHostname=$(/bin/hostname | sed -e 's/.novalocal//')
+ hostnamectl set-hostname $newHostname
+ fi
+ /usr/bin/crontab -u root -l | grep -v hostnamefix.sh | /usr/bin/crontab -u root -
+ path: /var/tmp/hostnamefix.sh
+ owner: root:root
+ permissions: '0755'
+ - content: |
+ ### /etc/resolv.conf file autogenerated by netconfig!
+ #
+ # Before you change this file manually, consider to define the
+ # static DNS configuration using the following variables in the
+ # /etc/sysconfig/network/config file:
+ # NETCONFIG_DNS_STATIC_SEARCHLIST
+ # NETCONFIG_DNS_STATIC_SERVERS
+ # NETCONFIG_DNS_FORWARDER
+ # or disable DNS configuration updates via netconfig by setting:
+ # NETCONFIG_DNS_POLICY=''
+ #
+ # See also the netconfig(8) manual page and other documentation.
+ #
+ # Note: Manual change of this file disables netconfig too, but
+ # may get lost when this file contains comments or empty lines
+ # only, the netconfig settings are same with settings in this
+ # file and in case of a "netconfig update -f" call.
+ #
+ ### Please remove (at least) this line when you modify the file!
+ nameserver 155.165.194.100
+ nameserver 155.165.201.100
+ search wapgw.mobilephone.net
+ options attempts:1
+ options timeout:6
+ path: /etc/resolv.conf
+ owner: root:root
+ permissions: '0644'
+ - content: |
+ *.* @135.207.171.57:1538
+ *.* @155.165.162.48:1532
+ path: /etc/rsyslog.d/remote.conf
+ owner: root:root
+ permissions: '0600'
+ - content: |
+ H4sIANjbQlkAA5WUUW/aMBSF3/0rjqKgtEyUlodNYmonSulaCQqCqnsYE0kTByyCHcWGjAH/fU5CWqJB1PEC5J6c+/n42qTb/37/2O1cG1I5aindGXXnE9tzFIX1qbKoeJV1rfJQ6VVGln0RiKlBCHVnwmMyDJz12TnZpP9R0/qxsswr0xpzC8ieGqmT3YR5ZeDmBuZm329HdoRkLdtJyzejvTGMavJJa4xP4YsIK+8VujxPK5ojZX25u722PR+12XYa0TARbZ14DmsTRowrmJ93VlaRMyei3oT7cqKhHKlERG1CmI+fML+hxiku8QtfoWaUEwAFnLw54AkquaVAfzOppEFoIGki14qJZH9oOU5jZ9mnzTNPONxLKOAEgXB1gB4SYwj/LQMwCTPvaID4jByJr+oe5vd0P4LPAirXUtFFdR9jKtGlAnYgRHh5IkfjWJDj+oIxNa7HcTyuS93DsHE62gJpEetUvGWv5NITIVTDSLhUSozSeSsu3JeSRivm6m3b/wDPntEI2YDul91yFVvRJpz0G2e6q96Z848vtDMc9ofNA3u9h56I+fE1FmTLMFtdyjwctG8fn+7egaPQfWV6ZEpxoyXnehI0b8nMH+PN3UtpD0QF1tag1X7oNN5ZndDRhcbHWf8PNrcvhT0Q5bBlZ+el9wy9D5IJns9OQQ8jUYx+5KLE19bHFnURKn0uaFjvjQZfLq4mz/1+d1TFFtmFFO9f2OKfK8IgO5DCDUnIX5FnXVGsBQAA
+ path: /opt/miep/tools/miit/vmtTools/statusCheck.sh
+ owner: miepadm:miepgrp
+ permissions: '0755'
+ encoding: 'gzip+base64'
+ - content: |
+ H4sIAKm9hFkAA9VWbW/aMBD+3PyKUxSUrVPiUama1CmdEOsLEqxodPvSVmAlBqwmcRQfUKj632c7EKCMDrVVtX6AxM69PM/d2XfNi7N27fI8sInIkCScZQSFiKV65UjGCV7qlW31eczaFIdKcExzgklGHMmRpTRhtpUzOYoxsFNxkuciV/JMUp5KpHFMkYs0sPs0lkrSAt6HK/BmYDtVG27gK+CQpRYAsHAowNZGOwxHGfySdMCOfFLu+HIIVwunN3BVQ2x12uFIYkbDWyV8Y4MxdMcRqhYw5VGvFyqBU11ddodCogxKGm6x4RobzYuz00bzJLDLz57UGLxeRJGB+6mSVKLK1KucV1qVjtvzYzEovJ90aqXy79alp9ZPKlnQ52thOXijsFAjV1/KBc4BFGgsS3uNuMxiOv3w0bo3a/AUh2t0narjXqcuQLFrG3a9I9AJPT4G575ZFNUDMa86FA/Ww6pJVR3brO5gcxlhbdaaibQIhDEJyW3Ec/Ay+GtFTyaTZeESHSSReLq45XL7+ZokkTRkOUpLBTJUEDbOCnE2wv4CdzrVMtO2fBzM5kXkfAMvZfB5pYpWQq8KbBNBJJhMXdQlok5AUZIQRi9ApvgjzeFu3J+9Gj/wSVud0EbK8flUuYRUIFAY05hHBqT2qjgvLjGmr7B5DKxtadz3dZ5fpVJ2YQJ2q1MD49IY2szYOnqYp3ALdp4iy0Na/W/xPw0/FwJD+i7B37KpQpSz/XeJ3lnvnc/nsCv0xw53KnuFfigmKXg/QWOjUXKkn4N8l56glRMRaeUvh4c7KRgqtlNAsSGABZott1JHaULRzEORZDFDFsGE4xDYfHoyPXpPPR5PUZiP9FX1b3NyFIZMyv4ojqdFWED3SmWwsWLQdEyrZPDInaFiPK4NJOr3otawuMOJMqQcl/1aDUvd+sWP08YZHByTiI1JqtAXfmFvOQrNCfB0oGctEKnWBMWbSgYTytH3i4En3Mz3sqGQeixGkcGBOc2+M4n1/sC/S+LXoLbkolkWrVB1QjVPd8OyW4NqaPN4d/UXFX49yz0x7kAZhR5SHoNX3Sra07I668XfW54I1TXX5rLHVWf9AdB7+rd1DAAA
+ path: /opt/miep/tools/miit/vmtTools/siteSetup.sh
+ owner: miepadm:miepgrp
+ permissions: '0755'
+ encoding: 'gzip+base64'
+
+scripts_per_once:
+
+power_state:
+ mode: reboot
+ message: Server will reboot now
+ timeout: 5
diff --git a/asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json b/asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json
new file mode 100644
index 0000000..c8a8508
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/multipleModules/vfzrdm5bpxmc02092017vf0_modules.json
@@ -0,0 +1,75 @@
+[
+ {
+ "vfModuleModelName": "VfZrdm5bpxmc02092017Vf..pxmc_base..module-0",
+ "vfModuleModelInvariantUUID": "f7a867f2-596b-4f4a-a128-421e825a6190",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelUUID": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46",
+ "vfModuleModelCustomizationUUID": "074c64d0-7e13-4bcc-8bdb-ea922331102d",
+ "isBase": true,
+ "artifacts": [
+ "7e7f7356-11bd-4f2f-bbbc-5c10954e3189",
+ "6dd99c31-c52e-4c45-b99b-d223c877a296"
+ ],
+ "properties": {
+ "min_vf_module_instances": "1",
+ "vf_module_label": "pxmc_base",
+ "max_vf_module_instances": "1",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Base",
+ "availability_zone_count": "",
+ "volume_group": "false",
+ "initial_count": "1"
+ }
+ },
+ {
+ "vfModuleModelName": "VfZrdm5bpxmc02092017Vf..pxmc_vmt..module-1",
+ "vfModuleModelInvariantUUID": "1e099992-6222-41a9-acde-5a8abb690775",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelUUID": "4d4423e2-17e8-455a-b9ae-7e4ab71b9cdc",
+ "vfModuleModelCustomizationUUID": "5336a98e-0966-4e59-b6e6-c8162804a024",
+ "isBase": false,
+ "artifacts": [
+ "ad12ab80-5419-4346-a5d7-dac2fc15575f",
+ "53acdabe-689f-45e5-8578-f1514d3529da",
+ "bc1640f1-69f0-4760-8fc3-3318ec2ff129"
+ ],
+ "properties": {
+ "min_vf_module_instances": "0",
+ "vf_module_label": "pxmc_vmt",
+ "max_vf_module_instances": "",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Expansion",
+ "availability_zone_count": "",
+ "volume_group": "false",
+ "initial_count": "0"
+ }
+ },
+ {
+ "vfModuleModelName": "VfZrdm5bpxmc02092017Vf..pxmc_mmn..module-2",
+ "vfModuleModelInvariantUUID": "8e53c069-b2f0-437a-9c00-21cbc5c8f081",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelUUID": "a8cb1182-9b6d-46f8-b06b-ded4fe69e10d",
+ "vfModuleModelCustomizationUUID": "e38906fa-717c-49b0-b391-e6ec12b50c4a",
+ "isBase": false,
+ "artifacts": [
+ "2f372a02-df1b-46ca-b81e-822e3f406965",
+ "5bc62c72-5f7a-40bc-a167-1a4fed9afdef",
+ "b8bca13b-811f-44ab-9d27-45b842c664d8",
+ "c1ae6284-48d9-4437-a195-b2cf2ba23070",
+ "e88ce0b9-1496-4d03-ab1d-6d8d79bfc737"
+ ],
+ "properties": {
+ "min_vf_module_instances": "0",
+ "vf_module_label": "pxmc_mmn",
+ "max_vf_module_instances": "",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Expansion",
+ "availability_zone_count": "",
+ "volume_group": "true",
+ "initial_count": "0"
+ }
+ }
+]
\ No newline at end of file
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
new file mode 100644
index 0000000..f8f32b7
--- /dev/null
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -0,0 +1,1039 @@
+
+--------START Catalog DB SCHEMA --------
+use catalogdb;
+
+create table `allotted_resource` (
+ `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `tosca_node_type` varchar(200) default null,
+ `subcategory` varchar(200) default null,
+ `description` varchar(1200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `allotted_resource_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `model_instance_name` varchar(200) not null,
+ `providing_service_model_uuid` varchar(200) default null,
+ `providing_service_model_invariant_uuid` varchar(200) default null,
+ `providing_service_model_name` varchar(200) default null,
+ `target_network_role` varchar(200) default null,
+ `nf_type` varchar(200) default null,
+ `nf_role` varchar(200) default null,
+ `nf_function` varchar(200) default null,
+ `nf_naming_code` varchar(200) default null,
+ `min_instances` int(11) default null,
+ `max_instances` int(11) default null,
+ `ar_model_uuid` varchar(200) not null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_customization_uuid`),
+ key `fk_allotted_resource_customization__allotted_resource1_idx` (`ar_model_uuid`),
+ constraint `fk_allotted_resource_customization__allotted_resource1` foreign key (`ar_model_uuid`) references `allotted_resource` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `heat_environment` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(100) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `body` longtext not null,
+ `artifact_checksum` varchar(200) not null default 'manual record',
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+create table `heat_files` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(200) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `body` longtext not null,
+ `artifact_checksum` varchar(200) not null default 'manual record',
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `heat_template` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(200) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `body` longtext not null,
+ `timeout_minutes` int(11) default null,
+ `artifact_checksum` varchar(200) not null default 'manual record',
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+create table `heat_nested_template` (
+ `parent_heat_template_uuid` varchar(200) not null,
+ `child_heat_template_uuid` varchar(200) not null,
+ `provider_resource_file` varchar(100) default null,
+ primary key (`parent_heat_template_uuid`,`child_heat_template_uuid`),
+ key `fk_heat_nested_template__heat_template2_idx` (`child_heat_template_uuid`),
+ constraint `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` foreign key (`child_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` foreign key (`parent_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `heat_template_params` (
+ `heat_template_artifact_uuid` varchar(200) not null,
+ `param_name` varchar(100) not null,
+ `is_required` bit(1) not null,
+ `param_type` varchar(20) default null,
+ `param_alias` varchar(45) default null,
+ primary key (`heat_template_artifact_uuid`,`param_name`),
+ constraint `fk_heat_template_params__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+create table `network_recipe` (
+ `id` int(11) not null auto_increment,
+ `model_name` varchar(20) not null,
+ `action` varchar(50) not null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `network_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `service_type` varchar(45) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `version_str` varchar(20) not null,
+ primary key (`id`),
+ unique key `uk_rl4f296i0p8lyokxveaiwkayi` (`model_name`,`action`,`version_str`)
+) engine=innodb auto_increment=178 default charset=latin1;
+
+
+
+
+create table `temp_network_heat_template_lookup` (
+ `network_resource_model_name` varchar(200) not null,
+ `heat_template_artifact_uuid` varchar(200) not null,
+ `aic_version_min` varchar(20) not null,
+ `aic_version_max` varchar(20) default null,
+ primary key (`network_resource_model_name`),
+ key `fk_temp_network_heat_template_lookup__heat_template1_idx` (`heat_template_artifact_uuid`),
+ constraint `fk_temp_network_heat_template_lookup__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+create table `network_resource` (
+ `model_uuid` varchar(200) not null,
+ `model_name` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) default null,
+ `description` varchar(1200) default null,
+ `heat_template_artifact_uuid` varchar(200) not null,
+ `neutron_network_type` varchar(20) default null,
+ `model_version` varchar(20) default null,
+ `tosca_node_type` varchar(200) default null,
+ `aic_version_min` varchar(20) not null,
+ `aic_version_max` varchar(20) default null,
+ `orchestration_mode` varchar(20) default 'heat',
+ `resource_category` varchar(20) default null,
+ `resource_sub_category` varchar(20) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`),
+ key `fk_network_resource__temp_network_heat_template_lookup1_idx` (`model_name`),
+ key `fk_network_resource__heat_template1_idx` (`heat_template_artifact_uuid`),
+ constraint `fk_network_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade,
+ constraint `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` foreign key (`model_name`) references `temp_network_heat_template_lookup` (`network_resource_model_name`) on delete no action on update no action
+) engine=innodb default charset=latin1;
+
+
+
+
+
+create table `network_resource_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `model_instance_name` varchar(200) not null,
+ `network_technology` varchar(45) default null,
+ `network_type` varchar(45) default null,
+ `network_role` varchar(200) default null,
+ `network_scope` varchar(45) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `network_resource_model_uuid` varchar(200) not null,
+ primary key (`model_customization_uuid`),
+ key `fk_network_resource_customization__network_resource1_idx` (`network_resource_model_uuid`),
+ constraint `fk_network_resource_customization__network_resource1` foreign key (`network_resource_model_uuid`) references `network_resource` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+
+create table `tosca_csar` (
+ `artifact_uuid` varchar(200) not null,
+ `name` varchar(200) not null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `artifact_checksum` varchar(200) not null,
+ `url` varchar(200) not null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`artifact_uuid`)
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `service` (
+ `model_uuid` varchar(200) not null,
+ `model_name` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `tosca_csar_artifact_uuid` varchar(200) default null,
+ `service_type` varchar(200) default null,
+ `service_role` varchar(200) default null,
+ `environment_context` varchar(200) default null,
+ `workload_context` varchar(200) default null,
+ `service_category` varchar(200) default null,
+ primary key (`model_uuid`),
+ key `fk_service__tosca_csar1_idx` (`tosca_csar_artifact_uuid`),
+ constraint `fk_service__tosca_csar1` foreign key (`tosca_csar_artifact_uuid`) references `tosca_csar` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+create table `service_recipe` (
+ `id` int(11) not null auto_increment,
+ `action` varchar(50) not null,
+ `version_str` varchar(20) default null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `service_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `service_timeout_interim` int(11) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `service_model_uuid` varchar(200) not null,
+ primary key (`id`),
+ unique key `uk_7fav5dkux2v8g9d2i5ymudlgc` (`service_model_uuid`,`action`),
+ key `fk_service_recipe__service1_idx` (`service_model_uuid`),
+ constraint `fk_service_recipe__service1` foreign key (`service_model_uuid`) references `service` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb auto_increment=86 default charset=latin1;
+
+
+
+create table `vnf_resource` (
+ `orchestration_mode` varchar(20) not null default 'heat',
+ `description` varchar(1200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `model_uuid` varchar(200) not null,
+ `aic_version_min` varchar(20) default null,
+ `aic_version_max` varchar(20) default null,
+ `model_invariant_uuid` varchar(200) default null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) default null,
+ `tosca_node_type` varchar(200) default null,
+ `resource_category` varchar(200) default null,
+ `resource_sub_category` varchar(200) default null,
+ `heat_template_artifact_uuid` varchar(200) default null,
+ primary key (`model_uuid`),
+ key `fk_vnf_resource__heat_template1` (`heat_template_artifact_uuid`),
+ constraint `fk_vnf_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `vf_module` (
+ `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) default null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `description` varchar(1200) default null,
+ `is_base` int(11) not null,
+ `heat_template_artifact_uuid` varchar(200) default null,
+ `vol_heat_template_artifact_uuid` varchar(200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `vnf_resource_model_uuid` varchar(200) not null,
+ primary key (`model_uuid`,`vnf_resource_model_uuid`),
+ key `fk_vf_module__vnf_resource1_idx` (`vnf_resource_model_uuid`),
+ key `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`heat_template_artifact_uuid`),
+ key `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`vol_heat_template_artifact_uuid`),
+ constraint `fk_vf_module__heat_template_art_uuid__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module__vol_heat_template_art_uuid__heat_template2` foreign key (`vol_heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+/*!40101 set @saved_cs_client = @@character_set_client */;
+/*!40101 set character_set_client = utf8 */;
+create table `vf_module_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `label` varchar(200) default null,
+ `initial_count` int(11) default '0',
+ `min_instances` int(11) default '0',
+ `max_instances` int(11) default null,
+ `availability_zone_count` int(11) default null,
+ `heat_environment_artifact_uuid` varchar(200) default null,
+ `vol_environment_artifact_uuid` varchar(200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `vf_module_model_uuid` varchar(200) not null,
+ primary key (`model_customization_uuid`),
+ key `fk_vf_module_customization__vf_module1_idx` (`vf_module_model_uuid`),
+ key `fk_vf_module_customization__heat_env__heat_environment1_idx` (`heat_environment_artifact_uuid`),
+ key `fk_vf_module_customization__vol_env__heat_environment2_idx` (`vol_environment_artifact_uuid`),
+ constraint `fk_vf_module_customization__heat_env__heat_environment1` foreign key (`heat_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module_customization__vf_module1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module_customization__vol_env__heat_environment2` foreign key (`vol_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+/*!40101 set character_set_client = @saved_cs_client */;
+
+--
+-- table structure for table `vf_module_to_heat_files`
+--
+
+
+/*!40101 set @saved_cs_client = @@character_set_client */;
+/*!40101 set character_set_client = utf8 */;
+create table `vf_module_to_heat_files` (
+ `vf_module_model_uuid` varchar(200) not null,
+ `heat_files_artifact_uuid` varchar(200) not null,
+ primary key (`vf_module_model_uuid`,`heat_files_artifact_uuid`),
+ key `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`heat_files_artifact_uuid`),
+ constraint `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` foreign key (`heat_files_artifact_uuid`) references `heat_files` (`artifact_uuid`) on delete cascade on update cascade,
+ constraint `fk_vf_module_to_heat_files__vf_module__model_uuid1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1 comment='il fait ce qu''il dit';
+/*!40101 set character_set_client = @saved_cs_client */;
+
+--
+-- table structure for table `vnf_components`
+--
+
+
+/*!40101 set @saved_cs_client = @@character_set_client */;
+/*!40101 set character_set_client = utf8 */;
+create table `vnf_components` (
+ `vnf_id` int(11) not null,
+ `component_type` varchar(20) not null,
+ `heat_template_id` int(11) default null,
+ `heat_environment_id` int(11) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`vnf_id`,`component_type`)
+) engine=innodb default charset=latin1;
+/*!40101 set character_set_client = @saved_cs_client */;
+
+--
+-- table structure for table `vnf_components_recipe`
+--
+
+
+
+create table `vnf_components_recipe` (
+ `id` int(11) not null auto_increment,
+ `vnf_type` varchar(200) default null,
+ `vnf_component_type` varchar(45) not null,
+ `action` varchar(50) not null,
+ `service_type` varchar(45) default null,
+ `version` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `vnf_component_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `creation_timestamp` datetime default current_timestamp,
+ `vf_module_model_uuid` varchar(200) default null,
+ primary key (`id`),
+ unique key `uk_4dpdwddaaclhc11wxsb7h59ma` (`vf_module_model_uuid`,`vnf_component_type`,`action`,`version`)
+) engine=innodb auto_increment=26 default charset=latin1;
+
+
+
+
+create table `vnf_recipe` (
+ `id` int(11) not null auto_increment,
+ `vnf_type` varchar(200) default null,
+ `action` varchar(50) not null,
+ `service_type` varchar(45) default null,
+ `version_str` varchar(20) not null,
+ `description` varchar(1200) default null,
+ `orchestration_uri` varchar(256) not null,
+ `vnf_param_xsd` varchar(2048) default null,
+ `recipe_timeout` int(11) default null,
+ `creation_timestamp` datetime default current_timestamp,
+ `vf_module_id` varchar(100) default null,
+ primary key (`id`),
+ unique key `uk_f3tvqau498vrifq3cr8qnigkr` (`vf_module_id`,`action`,`version_str`)
+) engine=innodb auto_increment=10006 default charset=latin1;
+
+
+
+
+
+
+
+
+create table `vnf_resource_customization` (
+ `model_customization_uuid` varchar(200) not null,
+ `model_instance_name` varchar(200) not null,
+ `min_instances` int(11) default null,
+ `max_instances` int(11) default null,
+ `availability_zone_max_count` int(11) default null,
+ `nf_type` varchar(200) default null,
+ `nf_role` varchar(200) default null,
+ `nf_function` varchar(200) default null,
+ `nf_naming_code` varchar(200) default null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ `vnf_resource_model_uuid` varchar(200) not null,
+ `multi_stage_design` varchar(20) default null,
+ primary key (`model_customization_uuid`),
+ key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`),
+ constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+
+
+create table `vnf_res_custom_to_vf_module_custom` (
+ `vnf_resource_cust_model_customization_uuid` varchar(200) not null,
+ `vf_module_cust_model_customization_uuid` varchar(200) not null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`vnf_resource_cust_model_customization_uuid`,`vf_module_cust_model_customization_uuid`),
+ key `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`vf_module_cust_model_customization_uuid`),
+ constraint `fk_vnf_res_custom_to_vf_module_custom__vf_module_customization1` foreign key (`vf_module_cust_model_customization_uuid`) references `vf_module_customization` (`model_customization_uuid`) on delete cascade on update cascade,
+ constraint `fk_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` foreign key (`vnf_resource_cust_model_customization_uuid`) references `vnf_resource_customization` (`model_customization_uuid`) on delete cascade on update cascade
+) engine=innodb default charset=latin1;
+
+
+create table if not exists external_service_to_internal_model_mapping (
+id int(11) not null auto_increment,
+service_name varchar(200) not null,
+product_flavor varchar(200) null,
+subscription_service_type varchar(200) not null,
+service_model_uuid varchar(200) not null,
+primary key (id),
+unique index uk_external_service_to_internal_model_mapping
+(service_name asc, product_flavor asc, service_model_uuid asc));
+
+create table if not exists `collection_resource` (
+ model_uuid varchar(200) not null,
+ model_name varchar(200) not null,
+ model_invariant_uuid varchar(200) not null,
+ model_version varchar(20) not null,
+ tosca_node_type varchar(200) not null,
+ description varchar(200),
+ creation_timestamp datetime not null default current_timestamp,
+ primary key (`model_uuid`)
+)engine=innodb default charset=latin1;
+
+create table if not exists `collection_resource_customization` (
+ model_customization_uuid varchar(200) not null,
+ model_instance_name varchar(200) not null,
+ role varchar(200) NULL,
+ object_type varchar(200) not null,
+ function varchar(200) NULL,
+ collection_resource_type varchar(200) NULL,
+ creation_timestamp datetime not null default current_timestamp,
+ cr_model_uuid varchar(200) not null,
+ primary key (`model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+create table if not exists `instance_group` (
+ model_uuid varchar(200) not null,
+ model_name varchar(200) not null,
+ model_invariant_uuid varchar(200) not null,
+ model_version varchar(20) not null,
+ tosca_node_type varchar(200) NULL,
+ role varchar(200) not null,
+ object_type varchar(200) not null,
+ creation_timestamp datetime not null default current_timestamp,
+ cr_model_uuid varchar(200) NULL,
+ instance_group_type varchar(200) not null,
+ primary key (`model_uuid`)
+)engine=innodb default charset=latin1;
+
+create table if not exists `collection_resource_instance_group_customization` (
+ `collection_resource_customization_model_uuid` varchar(200) not null,
+ `instance_group_model_uuid` varchar(200) not null,
+ `function` varchar(200) null,
+ `description` varchar(1200) null,
+ `subinterface_network_quantity` int(11) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`collection_resource_customization_model_uuid`, `instance_group_model_uuid`),
+ index `fk_collection_resource_instance_group_customization__instan_idx` (`instance_group_model_uuid` asc),
+ constraint `fk_collection_resource_instance_group_customization__collecti1`
+ foreign key (`collection_resource_customization_model_uuid`)
+ references `collection_resource_customization` (`model_customization_uuid`)
+ on delete cascade
+ on update cascade,
+ constraint `fk_collection_resource_instance_group_customization__instance1`
+ foreign key (`instance_group_model_uuid`)
+ references `instance_group` (`model_uuid`)
+ on delete cascade
+ on update cascade)
+engine = innodb
+default character set = latin1;
+
+create table if not exists `vnfc_instance_group_customization` (
+ `vnf_resource_customization_model_uuid` varchar(200) not null,
+ `instance_group_model_uuid` varchar(200) not null,
+ `function` varchar(200) null,
+ `description` varchar(1200) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`vnf_resource_customization_model_uuid`, `instance_group_model_uuid`),
+ index `fk_vnfc_instance_group_customization__instance_group1_idx` (`instance_group_model_uuid` asc),
+ constraint `fk_vnfc_instance_group_customization__vnf_resource_customizat1`
+ foreign key (`vnf_resource_customization_model_uuid`)
+ references `vnf_resource_customization` (`model_customization_uuid`)
+ on delete cascade
+ on update cascade,
+ constraint `fk_vnfc_instance_group_customization__instance_group1`
+ foreign key (`instance_group_model_uuid`)
+ references `instance_group` (`model_uuid`)
+ on delete cascade
+ on update cascade)
+engine = innodb
+default character set = latin1;
+
+ create table if not exists `configuration`
+ ( `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `tosca_node_type` varchar(200) not null,
+ `description` varchar(1200) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`))
+ engine = innodb auto_increment = 20654
+ default character set = latin1;
+
+ create table if not exists `service_proxy` (
+ `model_uuid` varchar(200) not null,
+ `model_invariant_uuid` varchar(200) not null,
+ `model_version` varchar(20) not null,
+ `model_name` varchar(200) not null,
+ `description` varchar(1200) null,
+ `creation_timestamp` datetime not null default current_timestamp,
+ primary key (`model_uuid`))
+ engine = innodb auto_increment = 20654
+ default character set = latin1;
+
+create table if not exists `service_proxy_customization` (
+`model_customization_uuid` varchar(200) not null,
+`model_instance_name` varchar(200) not null,
+`tosca_node_type` varchar(200) not null,
+`source_service_model_uuid` varchar(200) not null,
+`creation_timestamp` datetime not null default current_timestamp,
+`service_proxy_model_uuid` varchar(200) not null,
+primary key (`model_customization_uuid`),
+index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc),
+index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc),
+constraint`fk_spr_customization__service_proxy_resource1`
+foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`)
+on delete cascade on update cascade,
+constraint `fk_service_proxy_resource_customization__service1`
+foreign key (`source_service_model_uuid`) references `service`
+(`model_uuid`) on delete cascade on update cascade)
+engine = innodb
+auto_increment = 20654
+default character set = latin1;
+
+create table if not exists `configuration_customization` (
+`model_customization_uuid` varchar(200) not null,
+`model_instance_name` varchar(200) not null,
+`configuration_type` varchar(200) null,
+`configuration_role` varchar(200) null,
+`configuration_function` varchar(200) null,
+`creation_timestamp` datetime not null default current_timestamp,
+`configuration_model_uuid` varchar(200) not null,
+`service_proxy_customization_model_customization_uuid` varchar(200) null,
+`configuration_customization_model_customization_uuid` varchar(200) null,
+primary key (`model_customization_uuid`),
+index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc),
+index `fk_configuration_customization__service_proxy_customization_idx`
+(`service_proxy_customization_model_customization_uuid` asc),
+index `fk_configuration_customization__configuration_customization_idx`
+(`configuration_customization_model_customization_uuid` asc),
+constraint `fk_configuration_resource_customization__configuration_resour1`
+foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`)
+on delete cascade on update cascade,
+constraint `fk_configuration_customization__service_proxy_customization1` foreign
+key (`service_proxy_customization_model_customization_uuid`) references
+`service_proxy_customization` (`model_customization_uuid`)
+on delete cascade on update cascade, constraint
+`fk_configuration_customization__configuration_customization1` foreign
+key (`configuration_customization_model_customization_uuid`) references
+`configuration_customization` (`model_customization_uuid`)
+on delete cascade on update cascade)
+engine = innodb
+auto_increment =20654
+default character set = latin1;
+
+
+create table `service_proxy_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+create table `configuration_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+create table if not exists `collection_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+create table `network_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+create table `vnf_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+create table `allotted_resource_customization_to_service` (
+ `service_model_uuid` varchar(200) not null,
+ `resource_model_customization_uuid` varchar(200) not null,
+ primary key (`service_model_uuid`,`resource_model_customization_uuid`)
+)engine=innodb default charset=latin1;
+
+
+
+
+create table ar_recipe (
+ ID INT(11) not null auto_increment,
+ MODEL_NAME VARCHAR(200) NOT NULL,
+ `ACTION` VARCHAR(200) NOT NULL,
+ VERSION_STR VARCHAR(200) NOT NULL,
+ SERVICE_TYPE VARCHAR(200),
+ DESCRIPTION VARCHAR(200),
+ ORCHESTRATION_URI VARCHAR(200) NOT NULL,
+ AR_PARAM_XSD VARCHAR(200),
+ RECIPE_TIMEOUT INT(10),
+ CREATION_TIMESTAMP DATETIME NOT NULL default current_timestamp,
+ primary key (ID),
+ unique key `uk_ar_recipe` (`model_name`,`action`,`version_str`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+alter table collection_resource_customization
+add foreign key ( cr_model_uuid)
+references collection_resource(model_uuid)
+on delete cascade;
+
+alter table vnf_resource_customization
+add column
+instance_group_model_uuid varchar(200);
+
+alter table network_resource_customization
+add column
+instance_group_model_uuid varchar(200);
+
+
+alter table network_resource_customization
+add foreign key ( instance_group_model_uuid)
+references instance_group(model_uuid)
+on delete cascade;
+
+alter table collection_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+alter table allotted_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+
+alter table vnf_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+
+alter table network_resource_customization_to_service
+add foreign key (service_model_uuid)
+references service(model_uuid)
+on delete cascade;
+
+
+alter table network_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references network_resource_customization(model_customization_uuid)
+on delete cascade;
+
+alter table vnf_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references vnf_resource_customization(model_customization_uuid)
+on delete cascade;
+
+alter table allotted_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references allotted_resource_customization(model_customization_uuid)
+on delete cascade;
+
+alter table collection_resource_customization_to_service
+add foreign key (resource_model_customization_uuid)
+references collection_resource_customization(model_customization_uuid)
+on delete cascade;
+
+
+create table if not exists `collection_network_resource_customization` (
+`model_customization_uuid` varchar(200) not null,
+`model_instance_name` varchar(200) not null,
+`network_technology` varchar(45) null,
+`network_type` varchar(45) null,
+`network_role` varchar(200) null,
+`network_scope` varchar(45) null,
+`creation_timestamp` datetime not null default current_timestamp,
+`network_resource_model_uuid` varchar(200) not null, `instance_group_model_uuid` varchar(200) null,
+`crc_model_customization_uuid` varchar(200) not null, primary key
+(`model_customization_uuid`, `crc_model_customization_uuid`),
+index `fk_collection_net_resource_customization__network_resource1_idx`
+(`network_resource_model_uuid` asc), index
+`fk_collection_net_resource_customization__instance_group1_idx`
+(`instance_group_model_uuid` asc), index
+`fk_col_net_res_customization__collection_res_customization_idx`
+(`crc_model_customization_uuid` asc), constraint
+`fk_collection_net_resource_customization__network_resource10` foreign
+key (`network_resource_model_uuid`) references
+`network_resource` (`model_uuid`) on delete cascade on
+update cascade, constraint
+`fk_collection_net_resource_customization__instance_group10` foreign key
+(`instance_group_model_uuid`) references `instance_group`
+(`model_uuid`) on delete cascade on update cascade, constraint
+`fk_collection_network_resource_customization__collection_reso1` foreign
+key (`crc_model_customization_uuid`) references
+`collection_resource_customization`
+(`model_customization_uuid`) on delete cascade on update cascade) engine
+= innodb default character set = latin1;
+
+CREATE TABLE IF NOT EXISTS `rainy_day_handler_macro` (
+`id` INT(11) NOT NULL AUTO_INCREMENT,
+`FLOW_NAME` VARCHAR(200) NOT NULL,
+`SERVICE_TYPE` VARCHAR(200) NOT NULL,
+`VNF_TYPE` VARCHAR(200) NOT NULL,
+`ERROR_CODE` VARCHAR(200) NOT NULL,
+`WORK_STEP` VARCHAR(200) NOT NULL,
+`POLICY` VARCHAR(200) NOT NULL,
+PRIMARY KEY (`id`))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `northbound_request_ref_lookup` (
+`id` INT(11) NOT NULL AUTO_INCREMENT,
+`REQUEST_SCOPE` VARCHAR(200) NOT NULL,
+`ACTION` VARCHAR(200) NOT NULL,
+`MACRO_ACTION` VARCHAR(200) NOT NULL,
+`IS_ALACARTE` TINYINT(1) NOT NULL DEFAULT 0,
+`IS_TOPLEVELFLOW` TINYINT(1) NOT NULL DEFAULT 0,
+`MIN_API_VERSION` DOUBLE NOT NULL,
+`MAX_API_VERSION` DOUBLE NULL,
+PRIMARY KEY (`id`),
+UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `orchestration_flow_reference` (
+`id` INT(11) NOT NULL AUTO_INCREMENT,
+`COMPOSITE_ACTION` VARCHAR(200) NOT NULL,
+`SEQ_NO` INT(11) NOT NULL,
+`FLOW_NAME` VARCHAR(200) NOT NULL,
+`FLOW_VERSION` DOUBLE NOT NULL,
+`NB_REQ_REF_LOOKUP_ID` INT(11) NOT NULL,
+PRIMARY KEY (`id`),
+INDEX `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID` ASC),
+UNIQUE INDEX `UK_orchestration_flow_reference` (`COMPOSITE_ACTION` ASC, `FLOW_NAME` ASC, `SEQ_NO` ASC, `NB_REQ_REF_LOOKUP_ID` ASC),
+CONSTRAINT `fk_orchestration_flow_reference__northbound_request_ref_look1`
+FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` (`id`)
+ON DELETE CASCADE ON UPDATE CASCADE)
+ENGINE = InnoDB DEFAULT CHARACTER SET = latin1;
+
+--------START Request DB SCHEMA --------
+CREATE DATABASE requestdb;
+USE requestdb;
+
+
+CREATE TABLE `active_requests` (
+ `REQUEST_ID` varchar(45) NOT NULL,
+ `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL,
+ `SERVICE_INSTANCE_ID` varchar(50) NOT NULL,
+ `SUBSCRIBER_NAME` varchar(200) DEFAULT NULL,
+ `REQUEST_URI` varchar(255) DEFAULT NULL,
+ `SERVICE_TYPE` varchar(65) NOT NULL,
+ `REQUEST_ACTION` varchar(45) NOT NULL,
+ `NOTIFICATION_URL` varchar(255) DEFAULT NULL,
+ `REQUEST_ID_IN_PROGRESS` varchar(45) DEFAULT NULL,
+ `START_TIME` datetime DEFAULT NULL,
+ `MODIFY_TIME` datetime DEFAULT NULL,
+ `COMPLETION_TIME` datetime DEFAULT NULL,
+ `RESPONSE_CODE` varchar(20) DEFAULT NULL,
+ `RESPONSE_BODY` longtext,
+ `STATUS` varchar(25) DEFAULT NULL,
+ `SERVICE_REQUEST_TIMEOUT` datetime DEFAULT NULL,
+ `FINAL_ERROR_CODE` varchar(20) DEFAULT NULL,
+ `FINAL_ERROR_MESSAGE` varchar(2000) DEFAULT NULL,
+ `ORDER_NUMBER` varchar(45) DEFAULT NULL,
+ `SOURCE` varchar(20) DEFAULT NULL,
+ `RESPONSE_STATUS` varchar(25) DEFAULT NULL,
+ `ORDER_VERSION` varchar(20) DEFAULT NULL,
+ `LAST_MODIFIED_BY` varchar(20) DEFAULT NULL,
+ `MOCARS_TICKET_NUM` varchar(200) DEFAULT NULL,
+ `REQUEST_BODY` longtext,
+ `REQUEST_SUB_ACTION` varchar(45) DEFAULT NULL,
+ `SDNC_CALLBACK_BPEL_URL` varchar(255) DEFAULT NULL,
+ `FEATURE_TYPE` varchar(255) DEFAULT NULL,
+ `FEATURE_INSTANCE_ID` varchar(255) DEFAULT NULL,
+ `REQUEST_TYPE` varchar(255) DEFAULT NULL,
+ `INTERIM_COMPLETION_TIME` datetime DEFAULT NULL,
+ `INTERIM_STAGE_COMPLETION` int(11) DEFAULT NULL,
+ `SERVICE_NAME_VERSION_ID` varchar(50) DEFAULT NULL,
+ `GLOBAL_SUBSCRIBER_ID` varchar(255) DEFAULT NULL,
+ `SERVICE_ID` varchar(50) DEFAULT NULL,
+ `SERVICE_VERSION` varchar(10) DEFAULT NULL,
+ `CORRELATOR` varchar(50) DEFAULT NULL,
+ PRIMARY KEY (`REQUEST_ID`),
+ UNIQUE KEY `UK_f0hdk7xbw5mb2trnxx0fvlh3x` (`CLIENT_REQUEST_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `infra_active_requests` (
+ `REQUEST_ID` varchar(45) NOT NULL,
+ `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL,
+ `ACTION` varchar(45) DEFAULT NULL,
+ `REQUEST_STATUS` varchar(20) DEFAULT NULL,
+ `STATUS_MESSAGE` longtext DEFAULT NULL,
+ `PROGRESS` bigint(20) DEFAULT NULL,
+ `START_TIME` datetime DEFAULT NULL,
+ `END_TIME` datetime DEFAULT NULL,
+ `SOURCE` varchar(45) DEFAULT NULL,
+ `VNF_ID` varchar(45) DEFAULT NULL,
+ `VNF_NAME` varchar(80) DEFAULT NULL,
+ `VNF_TYPE` varchar(200) DEFAULT NULL,
+ `SERVICE_TYPE` varchar(45) DEFAULT NULL,
+ `AIC_NODE_CLLI` varchar(11) DEFAULT NULL,
+ `TENANT_ID` varchar(45) DEFAULT NULL,
+ `PROV_STATUS` varchar(20) DEFAULT NULL,
+ `VNF_PARAMS` longtext,
+ `VNF_OUTPUTS` longtext,
+ `REQUEST_BODY` longtext,
+ `RESPONSE_BODY` longtext,
+ `LAST_MODIFIED_BY` varchar(100) DEFAULT NULL,
+ `MODIFY_TIME` datetime DEFAULT NULL,
+ `REQUEST_TYPE` varchar(20) DEFAULT NULL,
+ `VOLUME_GROUP_ID` varchar(45) DEFAULT NULL,
+ `VOLUME_GROUP_NAME` varchar(45) DEFAULT NULL,
+ `VF_MODULE_ID` varchar(45) DEFAULT NULL,
+ `VF_MODULE_NAME` varchar(200) DEFAULT NULL,
+ `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
+ `AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
+ `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CALLBACK_URL` varchar(200) DEFAULT NULL,
+ `CORRELATOR` varchar(80) DEFAULT NULL,
+ `NETWORK_ID` varchar(45) DEFAULT NULL,
+ `NETWORK_NAME` varchar(80) DEFAULT NULL,
+ `NETWORK_TYPE` varchar(80) DEFAULT NULL,
+ `REQUEST_SCOPE` varchar(20) NOT NULL DEFAULT 'unknown',
+ `REQUEST_ACTION` varchar(45) NOT NULL DEFAULT 'unknown',
+ `SERVICE_INSTANCE_ID` varchar(45) DEFAULT NULL,
+ `SERVICE_INSTANCE_NAME` varchar(80) DEFAULT NULL,
+ `REQUESTOR_ID` varchar(50) DEFAULT NULL,
+ `CONFIGURATION_ID` varchar(45) DEFAULT NULL,
+ `CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
+ `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
+ `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`REQUEST_ID`),
+ UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `archived_infra_requests` (
+ `REQUEST_ID` varchar(45) NOT NULL,
+ `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL,
+ `ACTION` varchar(45) DEFAULT NULL,
+ `REQUEST_STATUS` varchar(20) DEFAULT NULL,
+ `STATUS_MESSAGE` longtext DEFAULT NULL,
+ `PROGRESS` bigint(20) DEFAULT NULL,
+ `START_TIME` datetime DEFAULT NULL,
+ `END_TIME` datetime DEFAULT NULL,
+ `SOURCE` varchar(45) DEFAULT NULL,
+ `VNF_ID` varchar(45) DEFAULT NULL,
+ `VNF_NAME` varchar(80) DEFAULT NULL,
+ `VNF_TYPE` varchar(200) DEFAULT NULL,
+ `SERVICE_TYPE` varchar(45) DEFAULT NULL,
+ `AIC_NODE_CLLI` varchar(11) DEFAULT NULL,
+ `TENANT_ID` varchar(45) DEFAULT NULL,
+ `PROV_STATUS` varchar(20) DEFAULT NULL,
+ `VNF_PARAMS` longtext,
+ `VNF_OUTPUTS` longtext,
+ `REQUEST_BODY` longtext,
+ `RESPONSE_BODY` longtext,
+ `LAST_MODIFIED_BY` varchar(100) DEFAULT NULL,
+ `MODIFY_TIME` datetime DEFAULT NULL,
+ `REQUEST_TYPE` varchar(20) DEFAULT NULL,
+ `VOLUME_GROUP_ID` varchar(45) DEFAULT NULL,
+ `VOLUME_GROUP_NAME` varchar(45) DEFAULT NULL,
+ `VF_MODULE_ID` varchar(45) DEFAULT NULL,
+ `VF_MODULE_NAME` varchar(200) DEFAULT NULL,
+ `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
+ `AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
+ `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CALLBACK_URL` varchar(200) DEFAULT NULL,
+ `CORRELATOR` varchar(80) DEFAULT NULL,
+ `NETWORK_ID` varchar(45) DEFAULT NULL,
+ `NETWORK_NAME` varchar(80) DEFAULT NULL,
+ `NETWORK_TYPE` varchar(80) DEFAULT NULL,
+ `REQUEST_SCOPE` varchar(20) NOT NULL DEFAULT 'unknown',
+ `REQUEST_ACTION` varchar(45) NOT NULL DEFAULT 'unknown',
+ `SERVICE_INSTANCE_ID` varchar(45) DEFAULT NULL,
+ `SERVICE_INSTANCE_NAME` varchar(80) DEFAULT NULL,
+ `REQUESTOR_ID` varchar(50) DEFAULT NULL,
+ `CONFIGURATION_ID` varchar(45) DEFAULT NULL,
+ `CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
+ `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
+ `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`REQUEST_ID`),
+ UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d72h` (`CLIENT_REQUEST_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `site_status` (
+ `SITE_NAME` varchar(255) NOT NULL,
+ `STATUS` bit(1) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`SITE_NAME`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `watchdog_distributionid_status` (
+ `DISTRIBUTION_ID` varchar(45) NOT NULL,
+ `DISTRIBUTION_ID_STATUS` varchar(45) DEFAULT NULL,
+ `CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`DISTRIBUTION_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `watchdog_per_component_distribution_status` (
+ `DISTRIBUTION_ID` varchar(45) NOT NULL,
+ `COMPONENT_NAME` varchar(45) NOT NULL,
+ `COMPONENT_DISTRIBUTION_STATUS` varchar(45) DEFAULT NULL,
+ `CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`DISTRIBUTION_ID`,`COMPONENT_NAME`),
+ CONSTRAINT `fk_watchdog_component_distribution_status_watchdog_distributi1` FOREIGN KEY (`DISTRIBUTION_ID`) REFERENCES `watchdog_distributionid_status` (`DISTRIBUTION_ID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `watchdog_service_mod_ver_id_lookup` (
+ `DISTRIBUTION_ID` varchar(45) NOT NULL,
+ `SERVICE_MODEL_VERSION_ID` varchar(45) NOT NULL,
+ `CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODIFY_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`DISTRIBUTION_ID`,`SERVICE_MODEL_VERSION_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `activate_operational_env_service_model_distribution_status` (
+ `OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
+ `SERVICE_MODEL_VERSION_ID` varchar(45) NOT NULL,
+ `REQUEST_ID` varchar(45) NOT NULL,
+ `SERVICE_MOD_VER_FINAL_DISTR_STATUS` varchar(45) DEFAULT NULL,
+ `RECOVERY_ACTION` varchar(30) DEFAULT NULL,
+ `RETRY_COUNT_LEFT` int(11) DEFAULT NULL,
+ `WORKLOAD_CONTEXT` varchar(80) NOT NULL,
+ `CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `activate_operational_env_per_distributionid_status` (
+ `DISTRIBUTION_ID` varchar(45) NOT NULL,
+ `DISTRIBUTION_ID_STATUS` varchar(45) DEFAULT NULL,
+ `DISTRIBUTION_ID_ERROR_REASON` varchar(250) DEFAULT NULL,
+ `CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
+ `SERVICE_MODEL_VERSION_ID` varchar(45) NOT NULL,
+ `REQUEST_ID` varchar(45) NOT NULL,
+ PRIMARY KEY (`DISTRIBUTION_ID`),
+ KEY `fk_activate_op_env_per_distributionid_status__aoesmds1_idx` (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`),
+ CONSTRAINT `fk_activate_op_env_per_distributionid_status__aoesmds1` FOREIGN KEY (`OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`) REFERENCES `activate_operational_env_service_model_distribution_status` (`OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+create table operation_status (
+ SERVICE_ID varchar(255) not null,
+ OPERATION_ID varchar(255) not null,
+ SERVICE_NAME varchar(255),
+ OPERATION_TYPE varchar(255),
+ USER_ID varchar(255),
+ RESULT varchar(255),
+ OPERATION_CONTENT varchar(255),
+ PROGRESS varchar(255),
+ REASON varchar(255),
+ OPERATE_AT datetime NOT NULL,
+ FINISHED_AT datetime NOT NULL,
+ primary key (SERVICE_ID,OPERATION_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+create table resource_operation_status (
+ SERVICE_ID varchar(255) not null,
+ OPERATION_ID varchar(255) not null,
+ RESOURCE_TEMPLATE_UUID varchar(255) not null,
+ OPER_TYPE varchar(255),
+ RESOURCE_INSTANCE_ID varchar(255),
+ JOB_ID varchar(255),
+ STATUS varchar(255),
+ PROGRESS varchar(255),
+ ERROR_CODE varchar(255) ,
+ STATUS_DESCRIPOTION varchar(255) ,
+ primary key (SERVICE_ID,OPERATION_ID,RESOURCE_TEMPLATE_UUID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+create table if not exists model_recipe (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_ID` INT(11),
+ `ACTION` VARCHAR(40),
+ `SCHEMA_VERSION` VARCHAR(40),
+ `DESCRIPTION` VARCHAR(40),
+ `ORCHESTRATION_URI` VARCHAR(20),
+ `MODEL_PARAM_XSD` VARCHAR(20),
+ `RECIPE_TIMEOUT` INT(11),
+ `CREATION_TIMESTAMP` datetime not null default current_timestamp,
+ PRIMARY KEY (`ID`),
+ CONSTRAINT uk1_model_recipe UNIQUE (`MODEL_ID`, `ACTION`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+create table if not exists model (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_ID` VARCHAR(40),
+ `MODEL_CUSTOMIZATION_NAME` VARCHAR(40),
+ `MODEL_INVARIANT_ID` VARCHAR(40),
+ `MODEL_NAME` VARCHAR(40),
+ `MODEL_TYPE` VARCHAR(20),
+ `MODEL_VERSION` VARCHAR(20),
+ `MODEL_VERSION_ID` VARCHAR(40),
+ `CREATION_TIMESTAMP` datetime not null default current_timestamp,
+ `RECIPE` INT(11),
+ PRIMARY KEY (`ID`),
+ CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`),
+ FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+ALTER TABLE `catalogdb`.`vnf_recipe`
+CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
\ No newline at end of file