summaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/pom.xml30
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/Application.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java16
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java46
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java207
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java2
-rw-r--r--asdc-controller/src/main/resources/application-local.yaml22
-rw-r--r--asdc-controller/src/main/resources/application.yaml19
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java3
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java52
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java33
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java157
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java4
-rw-r--r--asdc-controller/src/test/resources/ASDC/TestBB.bpmn53
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml27
-rw-r--r--asdc-controller/src/test/resources/schema.sql65
28 files changed, 292 insertions, 481 deletions
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 9eb9a3aa8b..50fbdd447b 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so</groupId>
@@ -151,10 +151,6 @@
<version>1.5.16</version>
</dependency>
<dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
@@ -196,13 +192,13 @@
<dependency>
<groupId>org.onap.sdc.sdc-tosca</groupId>
<artifactId>sdc-tosca</artifactId>
- <version>1.4.62</version>
+ <version>1.4.8</version>
</dependency>
- <!--dependency>
+ <dependency>
<groupId>org.onap.sdc.jtosca</groupId>
<artifactId>jtosca</artifactId>
- <version>1.4.4</version>
- </dependency-->
+ <version>1.4.8</version>
+ </dependency>
<dependency>
<groupId>org.onap.so</groupId>
<artifactId>common</artifactId>
@@ -241,11 +237,7 @@
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>
@@ -259,13 +251,15 @@
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-spring-legacy</artifactId>
- <version>1.0.5</version>
+ <artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-registry-prometheus</artifactId>
- <version>1.0.5</version>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.interceptor</groupId>
+ <artifactId>javax.interceptor-api</artifactId>
</dependency>
</dependencies>
</project>
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
index bd3b2d1c54..2f56668c74 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
@@ -22,8 +22,10 @@ package org.onap.so.asdc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = { "org.onap.so" })
+@EnableScheduling
public class Application {
private static final String MSO_CONFIG_PATH = "mso.config.path";
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
index 48f0990bf3..953c517702 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
@@ -24,7 +24,7 @@ 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.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
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
index da2fb2e8be..c623552113 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
@@ -25,7 +25,7 @@ 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.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
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
index 8276826456..5710905660 100644
--- 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
@@ -102,10 +102,9 @@ public class ASDCConfiguration implements IConfiguration {
this.asdcControllerName = asdcControllerName;
}
-
@Override
public java.lang.Boolean isUseHttpsWithDmaap() {
- return false;
+ return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithDmaap", true);
}
@Override
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index bcc2e15a7d..ca1d0331fd 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.nio.file.Paths;
import java.util.List;
import org.onap.sdc.api.IDistributionClient;
@@ -54,7 +55,7 @@ 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;
@@ -64,7 +65,7 @@ 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;
@@ -355,7 +356,7 @@ public class ASDCController {
+ artifact.getArtifactUUID ()
+ ")");
- String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName();
+ String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
// make parent directory
File file = new File(filePath);
File fileParent = file.getParentFile();
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
index 248d94d530..d2ac8e7c2d 100644
--- 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
@@ -56,7 +56,8 @@ public final class ASDCStatusCallBack implements IStatusCallback {
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 ());
+ WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findById(iStatus.getDistributionID ())
+ .orElseGet( () -> null);
if(watchdogDistributionStatus==null){
watchdogDistributionStatus = new WatchdogDistributionStatus();
watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID ());
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
index 1d07656012..596ad16d34 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
@@ -90,8 +90,9 @@ public class DistributionClientEmulator implements IDistributionClient {
byte[] inputStream=null;
try {
inputStream = getData(filename);
- } catch (IOException e) {
- logger.debug("InputStream is NULL for:"+ resourcePath + filename);
+ } catch (IOException e) {
+
+ logger.error("IOException in DistributionClientEmulator.download() method :",e);
}
return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),inputStream);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index c7c6ecacc0..6ddc2a8bdd 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -21,6 +21,7 @@
package org.onap.so.asdc.installer;
import java.io.File;
+import java.nio.file.Paths;
import java.util.List;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -41,7 +42,6 @@ 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;
@@ -82,9 +82,7 @@ public class ToscaResourceStructure {
private CollectionResourceCustomization catalogCollectionResourceCustomization;
private NetworkCollectionResourceCustomization catalogNetworkCollectionResourceCustomization;
-
- private ServiceProxyResource catalogServiceProxyResource;
-
+
private ServiceProxyResourceCustomization catalogServiceProxyResourceCustomization;
private ConfigurationResource catalogConfigurationResource;
@@ -126,7 +124,7 @@ public class ToscaResourceStructure {
LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
- String filePath = System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName();
+ String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
File spoolFile = new File(filePath);
@@ -442,14 +440,6 @@ public class ToscaResourceStructure {
this.catalogNetworkCollectionResourceCustomization = catalogNetworkCollectionResourceCustomization;
}
- public ServiceProxyResource getCatalogServiceProxyResource() {
- return catalogServiceProxyResource;
- }
-
- public void setCatalogServiceProxyResource(ServiceProxyResource catalogServiceProxyResource) {
- this.catalogServiceProxyResource = catalogServiceProxyResource;
- }
-
public ServiceProxyResourceCustomization getCatalogServiceProxyResourceCustomization() {
return catalogServiceProxyResourceCustomization;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 0fde1332d6..cd9a121ddb 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -20,11 +20,17 @@
package org.onap.so.asdc.installer.bpmn;
-import java.io.*;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
-import java.util.zip.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
@@ -33,14 +39,13 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
-import org.apache.http.impl.client.HttpClientBuilder;
-
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
+import org.apache.http.entity.mime.FormBodyPartBuilder;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
-import org.apache.http.entity.mime.FormBodyPartBuilder;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -58,7 +63,7 @@ public class BpmnInstaller {
public void installBpmn(String csarFilePath) {
LOGGER.info("Deploying BPMN files from " + csarFilePath);
try {
- ZipInputStream csarFile = new ZipInputStream(new FileInputStream(csarFilePath));
+ ZipInputStream csarFile = new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()));
ZipEntry entry = csarFile.getNextEntry();
while (entry != null) {
@@ -102,7 +107,7 @@ public class BpmnInstaller {
csarFilePath,
"",
"",
- ex.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC reading CSAR with workflows failed");
+ ex.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC reading CSAR with workflows failed");
}
return;
}
@@ -131,23 +136,23 @@ public class BpmnInstaller {
return workflowsInCsar;
}
- protected HttpResponse sendDeploymentRequest(String bpmnFileName) throws Exception {
+ protected HttpResponse sendDeploymentRequest(String bpmnFileName) throws Exception {
HttpClient client = HttpClientBuilder.create().build();
- String deploymentUri = this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH;
+ URI deploymentUri = new URI(this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH);
HttpPost post = new HttpPost(deploymentUri);
RequestConfig requestConfig =
RequestConfig.custom().setSocketTimeout(1000000).setConnectTimeout(1000).setConnectionRequestTimeout(1000).build();
post.setConfig(requestConfig);
- HttpEntity requestEntity = buildMimeMultipart(bpmnFileName);
+ HttpEntity requestEntity = buildMimeMultipart(bpmnFileName);
post.setEntity(requestEntity);
return client.execute(post);
}
protected HttpEntity buildMimeMultipart(String bpmnFileName) throws Exception {
- FileInputStream bpmnFileStream = new FileInputStream (System.getProperty("mso.config.path") + "/ASDC" + "/" + bpmnFileName);
+ FileInputStream bpmnFileStream = new FileInputStream (Paths.get(System.getProperty("mso.config.path"),"ASDC", bpmnFileName).normalize().toString());
byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream);
- HttpEntity requestEntity = MultipartEntityBuilder.create()
+ HttpEntity requestEntity = MultipartEntityBuilder.create()
.addPart(FormBodyPartBuilder.create()
.setName("deployment-name")
.setBody(new StringBody("MSO Sample 1", ContentType.TEXT_PLAIN))
@@ -179,14 +184,19 @@ public class BpmnInstaller {
return requestEntity;
}
- protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException {
- String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + fileName;
- BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath));
+ /* protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException */
+ protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) {
+ String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", fileName).normalize().toString();
+ /* BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); */
+ try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath))){
byte[] bytesIn = new byte[4096];
int read = 0;
while ((read = zipIn.read(bytesIn)) != -1) {
outputStream.write(bytesIn, 0, read);
}
- outputStream.close();
+ /* outputStream.close(); */
+ } catch (IOException e) {
+ LOGGER.error("Unable to open file.", e);
+ }
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index aa1e1a8bd9..7951e9be76 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -34,17 +34,14 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.gson.Gson;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.api.notification.IStatusData;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
+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;
@@ -85,7 +82,6 @@ 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;
@@ -111,7 +107,6 @@ 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.ServiceProxyResourceRepository;
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;
@@ -132,6 +127,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
@Component
public class ToscaResourceInstaller {
@@ -151,6 +149,7 @@ public class ToscaResourceInstaller {
protected static final String MSO = "SO";
+
@Autowired
protected ServiceRepository serviceRepo;
@@ -161,9 +160,6 @@ public class ToscaResourceInstaller {
protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
@Autowired
- protected ServiceProxyResourceRepository serviceProxyRepo;
-
- @Autowired
protected CollectionResourceRepository collectionRepo;
@Autowired
@@ -284,9 +280,9 @@ public class ToscaResourceInstaller {
@Transactional(rollbackFor = { ArtifactInstallerException.class })
public void installTheResource(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct)
- throws ArtifactInstallerException {
+ throws ArtifactInstallerException {
VfResourceStructure vfResourceStructure = vfResourceStruct;
- extractHeatInformation(toscaResourceStruct, vfResourceStructure);
+ extractHeatInformation(toscaResourceStruct, vfResourceStructure);
// PCLO: in case of deployment failure, use a string that will represent
// the type of artifact that failed...
@@ -295,10 +291,23 @@ public class ToscaResourceInstaller {
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);
+ }
+
processResourceSequence(toscaResourceStruct, service);
processVFResources(toscaResourceStruct, service, vfResourceStructure);
- processAllottedResources(toscaResourceStruct, service);
+ List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
+ processAllottedResources(toscaResourceStruct, service, allottedResourceList);
processNetworks(toscaResourceStruct, service);
// process Network Collections
processNetworkCollections(toscaResourceStruct, service);
@@ -473,8 +482,8 @@ public class ToscaResourceInstaller {
Service service) throws ArtifactInstallerException {
List <NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper ().getServiceVlList ();
- if (nodeTemplatesVLList != null) {
- for (NodeTemplate vlNode : nodeTemplatesVLList) {
+ if (nodeTemplatesVLList != null) {
+ for (NodeTemplate vlNode : nodeTemplatesVLList) {
String networkResourceModelName = vlNode.getMetaData ().getValue (SdcPropertyNames.PROPERTY_NAME_NAME);
TempNetworkHeatTemplateLookup tempNetworkLookUp =
@@ -495,32 +504,29 @@ public class ToscaResourceInstaller {
} else {
throw new ArtifactInstallerException ("No HeatTemplate found for artifactUUID: "
+ tempNetworkLookUp.getHeatTemplateArtifactUuid ());
- }
- } else {
+ }
+ } else {
NetworkResourceCustomization networkCustomization = createNetwork (vlNode,
toscaResourceStruct,
null,
null,
null,
service);
- networkCustomization.setResourceInput(getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID()));
- service.getNetworkCustomizations().add (networkCustomization);
+ service.getNetworkCustomizations().add (networkCustomization);
logger.debug ("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
- + networkResourceModelName);
- }
-
- }
- }
+ + networkResourceModelName);
+ }
+
+ }
+ }
}
- protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException {
- List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
-
+ protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service,
+ List<NodeTemplate> allottedResourceList) {
if (allottedResourceList != null) {
- for (NodeTemplate allottedNode : allottedResourceList) {
- AllottedResourceCustomization allottedResource = createAllottedResource(allottedNode, toscaResourceStruct, service);
- allottedResource.setResourceInput(getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID()));
- service.getAllottedCustomizations().add(allottedResource);
+ for (NodeTemplate allottedNode : allottedResourceList) {
+ service.getAllottedCustomizations()
+ .add(createAllottedResource(allottedNode, toscaResourceStruct, service));
}
}
}
@@ -540,7 +546,7 @@ public class ToscaResourceInstaller {
for (NodeTemplate spNode : serviceProxyResourceList) {
serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
- ServiceProxyResource serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getServiceProxyResource().getModelUUID());
+ ServiceProxyResourceCustomization serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getModelCustomizationUUID());
if(serviceProxyResource == null){
@@ -622,9 +628,9 @@ public class ToscaResourceInstaller {
logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
+ " matches vfNotificationResource CustomizationUUID");
- processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, vfCustomizationUUID);
- }
- else {
+ processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
+ vfCustomizationCategory);
+ } else {
logger.debug("Notification VF ResourceCustomizationUUID: "
+ vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
+ "Tosca VF Customization UUID: " + vfCustomizationUUID);
@@ -634,41 +640,59 @@ public class ToscaResourceInstaller {
protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
- Service service, NodeTemplate nodeTemplate, String vfCustomizationUUID)
- throws Exception {
- logger.debug("processVfModules for vfCustomizationUUID: " + vfCustomizationUUID);
+ Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) throws Exception {
- VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+ logger.debug("VF Category is : " + vfCustomizationCategory);
- if (vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure().isEmpty()) {
- Set<CvnfcCustomization> existingCvnfcSet = new HashSet<CvnfcCustomization>();
- Set<VnfcCustomization> existingVnfcSet = new HashSet<VnfcCustomization>();
+ if(vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure().isEmpty())
+ {
- 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();
-
- logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID());
-
- Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream()
- .peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID")))
- .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID()))
- .findFirst();
- if (matchingObject.isPresent()) {
- VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct,
- vfResourceStructure, vfMetadata, vnfResource,service, existingCvnfcSet, existingVnfcSet);
- vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
- } else {
- throw new Exception("Cannot find matching VFModule Customization in Csar for Vf_Modules_Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID());
+ String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper()
+ .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+
+ IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
+
+ // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before comparing their VF Modules UUID's
+ logger.debug("Checking if Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() +
+ " matches Tosca VF Customization UUID: " + vfCustomizationUUID);
+
+ if(vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())){
+
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfNotificationResource CustomizationUUID");
+
+ VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+
+ Set<CvnfcCustomization> existingCvnfcSet = new HashSet<CvnfcCustomization>();
+ Set<VnfcCustomization> existingVnfcSet = new HashSet<VnfcCustomization>();
+
+ 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();
+
+ logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID());
+
+ Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream()
+ .peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID")))
+ .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID()))
+ .findFirst();
+ if(matchingObject.isPresent()){
+ VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct,
+ vfResourceStructure,vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet);
+ vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
+ }else
+ throw new Exception("Cannot find matching VFModule Customization in Csar for Vf_Modules_Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID());
+
}
+ service.getVnfCustomizations().add(vnfResource);
+ } else{
+ logger.debug("Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " +
+ "Tosca VF Customization UUID: " + vfCustomizationUUID);
}
}
-
- vnfResource.setResourceInput(getResourceInput(toscaResourceStruct, vnfResource.getModelCustomizationUUID()));
- service.getVnfCustomizations().add(vnfResource);
}
public void processWatchdog(String distributionId, String servideUUID) {
@@ -891,28 +915,23 @@ public class ToscaResourceInstaller {
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.setModelName(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ spCustomizationResource.setModelInvariantUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ spCustomizationResource.setModelUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ spCustomizationResource.setModelVersion(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ spCustomizationResource.setDescription(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+
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);
- toscaResourceStructure.setCatalogServiceProxyResource(spResource);
toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource);
@@ -942,7 +961,7 @@ public class ToscaResourceInstaller {
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.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
configCustomizationResource.setConfigResourceCustomization(configCustomizationResource);
configCustomizationResource.setConfigurationResource(configResource);
configResourceCustomizationSet.add(configCustomizationResource);
@@ -1304,7 +1323,7 @@ public class ToscaResourceInstaller {
}
protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group,
- VnfResourceCustomization vnfResourceCustomization) {
+ VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) {
Metadata instanceMetadata = group.getMetadata();
// Populate InstanceGroup
@@ -1324,7 +1343,17 @@ public class ToscaResourceInstaller {
vfcInstanceGroupCustom.setModelCustomizationUUID(vnfResourceCustomization.getModelCustomizationUUID());
vfcInstanceGroupCustom.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vfcInstanceGroupCustom.setDescription(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- vfcInstanceGroupCustom.setFunction("FUNCTION");
+
+ String getInputName = null;
+ String groupProperty = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, "vfc_instance_group_function");
+ if (groupProperty != null) {
+ int getInputIndex = groupProperty.indexOf("{get_input=");
+ if (getInputIndex > -1) {
+ getInputName = groupProperty.substring(getInputIndex+11, groupProperty.length()-1);
+ }
+ }
+ vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName));
+
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
vfcInstanceGroupCustom.setVnfResourceCust(vnfResourceCustomization);
@@ -1518,18 +1547,18 @@ public class ToscaResourceInstaller {
return configResource;
}
- protected ServiceProxyResource findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelUUID) {
- ServiceProxyResource serviceProxyResource = null;
+ protected ServiceProxyResourceCustomization findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelCustomizationUUID) {
+ ServiceProxyResourceCustomization serviceProxyResourceCustomization = null;
for(ServiceProxyResourceCustomization serviceProxyResourceCustom : serviceProxyList){
- if (serviceProxyResourceCustom.getServiceProxyResource() != null
- && serviceProxyResourceCustom.getServiceProxyResource().getModelUUID().equals(modelUUID)) {
- serviceProxyResource = serviceProxyResourceCustom.getServiceProxyResource();
+ if (serviceProxyResourceCustom != null
+ && serviceProxyResourceCustom.getModelCustomizationUUID().equals(modelCustomizationUUID)) {
+ serviceProxyResourceCustomization = serviceProxyResourceCustom;
}
}
- if(serviceProxyResource==null)
- serviceProxyResource = serviceProxyRepo.findResourceByModelUUID(modelUUID);
+ if(serviceProxyResourceCustomization==null)
+ serviceProxyResourceCustomization = serviceProxyCustomizationRepo.findResourceByModelCustomizationUUID(modelCustomizationUUID);
- return serviceProxyResource;
+ return serviceProxyResourceCustomization;
}
protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
@@ -1747,7 +1776,7 @@ public class ToscaResourceInstaller {
for (Group group : groupList) {
- VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(vfNodeTemplate, group, vnfResourceCustomization);
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(vfNodeTemplate, group, vnfResourceCustomization, toscaResourceStructure);
vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
}
@@ -1836,7 +1865,7 @@ public class ToscaResourceInstaller {
}
protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate,
- ToscaResourceStructure toscaResourceStructure, Service service) throws ArtifactInstallerException {
+ ToscaResourceStructure toscaResourceStructure, Service service) {
AllottedResourceCustomization allottedResourceCustomization = allottedCustomizationRepo
.findOneByModelCustomizationUUID(
nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
@@ -1853,8 +1882,6 @@ public class ToscaResourceInstaller {
allottedResourceCustomization.setAllottedResource(allottedResource);
allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization);
}
-
- allottedResourceCustomization.setResourceInput(getResourceInput(toscaResourceStructure, allottedResourceCustomization.getModelCustomizationUUID()));
return allottedResourceCustomization;
}
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
index 3f0392a04f..8c9fb62f31 100644
--- 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
@@ -68,7 +68,8 @@ public class WatchdogDistribution {
String status = null;
try {
- WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findOne(distributionId);
+ WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findById(distributionId)
+ .orElseGet( () -> null);
if(watchdogDistributionStatus == null){
watchdogDistributionStatus = new WatchdogDistributionStatus();
watchdogDistributionStatus.setDistributionId(distributionId);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index ae95cbb9fe..24304ba28c 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -28,8 +28,8 @@ 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.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
+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.elements.Metadata;
diff --git a/asdc-controller/src/main/resources/application-local.yaml b/asdc-controller/src/main/resources/application-local.yaml
index 28900f4f95..1b21d8b571 100644
--- a/asdc-controller/src/main/resources/application-local.yaml
+++ b/asdc-controller/src/main/resources/application-local.yaml
@@ -8,7 +8,7 @@ ssl-enable: false
# H2
spring:
datasource:
- url: jdbc:mariadb://localhost:3306/catalogdb
+ jdbc-url: jdbc:mariadb://localhost:3306/catalogdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
@@ -33,7 +33,7 @@ spring:
role: ACTUATOR
request:
datasource:
- url: jdbc:mariadb://localhost:3306/requestdb
+ jdbc-url: jdbc:mariadb://localhost:3306/requestdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
@@ -41,8 +41,19 @@ request:
initialization-mode: never
#Actuator
-management:
- context-path: /manage
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ 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.
mso:
@@ -63,10 +74,11 @@ mso:
consumerId: msoasdc-id-local
environmentName: Pre-IST
asdcAddress: localhost:8443
- password: 658D6E9E0C087547284339181615C358
+ password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4
pollingInterval: 30
pollingTimeout: 30
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
+ useHttpsWithDmaap: true
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
diff --git a/asdc-controller/src/main/resources/application.yaml b/asdc-controller/src/main/resources/application.yaml
index ced8ab78fc..e95e85a4f1 100644
--- a/asdc-controller/src/main/resources/application.yaml
+++ b/asdc-controller/src/main/resources/application.yaml
@@ -4,7 +4,7 @@ server:
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
@@ -23,19 +23,17 @@ spring:
request:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ jdbc-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
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
metrics:
se-global-registry: false
export:
@@ -43,3 +41,4 @@ management:
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/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
index f7e678731e..27b6c0ab53 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
@@ -25,7 +25,7 @@ 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.jdbc.DataSourceBuilder;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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
index 6d1bfcdb8f..2827f8721e 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
@@ -25,7 +25,7 @@ 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.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
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
index ce8b664bda..16bd97b409 100644
--- 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
@@ -52,7 +52,8 @@ public class ASDCConfigurationTest extends BaseTest {
assertTrue(config.getPollingInterval() == 30);
assertTrue(config.getPollingTimeout() == 30);
assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size());
- assertTrue(config.getWatchDogTimeout() == 1);
+ assertTrue(config.getWatchDogTimeout() == 1);
+ assertTrue(config.isUseHttpsWithDmaap() == true);
}
}
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
index 97fa773fd5..ba95a6ea24 100644
--- 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
@@ -20,7 +20,7 @@
package org.onap.so.asdc.client;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
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
index e61957d8c2..546c4e2458 100644
--- 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
@@ -27,73 +27,40 @@ 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.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
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.boot.web.server.LocalServerPort;
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;
@@ -116,6 +83,16 @@ public class ASDCRestInterfaceTest extends BaseTest {
@LocalServerPort
private int port;
+
+ @Rule
+ public TemporaryFolder folder= new TemporaryFolder();
+
+
+ @Before
+ public void setUp() {
+ //ASDC Controller writes to this path
+ System.setProperty("mso.config.path", folder.getRoot().toString());
+ }
@Test
@Transactional
@@ -148,7 +125,6 @@ public class ASDCRestInterfaceTest extends BaseTest {
AllottedResourceCustomization arCustomization = new AllottedResourceCustomization();
arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba");
arCustomization.setModelInstanceName("rege1802pnf 0");
- arCustomization.setResourceInput("{}");
arCustomizationSet.add(arCustomization);
arCustomization.setAllottedResource(expectedService);
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
index f5f7445771..cd2c3ee7e6 100644
--- 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
@@ -27,7 +27,7 @@ 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.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
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
index 6f07f44e2b..db797cff29 100644
--- 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
@@ -55,7 +55,7 @@ public class ASDCConfigurationTest extends BaseTest {
@Test
public void isUseHttpsWithDmaapTest() {
- assertFalse(config.isUseHttpsWithDmaap());
+ assertTrue(config.isUseHttpsWithDmaap());
}
@Test
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
index 535434db32..c572097103 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
@@ -21,13 +21,16 @@
package org.onap.so.asdc.installer.bpmn;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import javax.transaction.Transactional;
@@ -40,39 +43,45 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
-import org.onap.so.asdc.BaseTest;
-import org.onap.so.asdc.installer.bpmn.BpmnInstaller;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.junit.rules.TemporaryFolder;
@Transactional
-public class BpmnInstallerTest extends BaseTest {
+public class BpmnInstallerTest {
- @Autowired
- private BpmnInstaller bpmnInstaller;
+ private BpmnInstaller bpmnInstaller = new BpmnInstaller();
+ @Rule
+ public TemporaryFolder folder= new TemporaryFolder();
+
@Before
public void init() throws Exception {
- System.setProperty("mso.config.path", "src/test/resources");
+ System.setProperty("mso.config.path", folder.getRoot().toString());
}
@Test
public void buildMimeMultiPart_Test() throws Exception {
-
+ Path tempDirectoryPath = Paths.get(folder.getRoot().toString(), "ASDC");
+ Path tempFilePath = Paths.get(tempDirectoryPath.toAbsolutePath().toString(), "TestBB.bpmn");
+ Files.createDirectories(tempDirectoryPath);
+ Files.createFile(tempFilePath);
HttpEntity entity = bpmnInstaller.buildMimeMultipart("TestBB.bpmn");
- String mimeMultipartBodyFilePath = System.getProperty("mso.config.path") + "/mime-multipart-body.txt";
+ String mimeMultipartBodyFilePath = "src/test/resources" + "/mime-multipart-body.txt";
File mimeMultipartBody = new File(mimeMultipartBodyFilePath);
InputStream expectedContent = new FileInputStream(mimeMultipartBody);
- assertThat(IOUtils.contentEquals(expectedContent, entity.getContent()));
+ assertThat(IOUtils.contentEquals(expectedContent, entity.getContent()));
+
+ IOUtils.closeQuietly(expectedContent);
}
@Test
public void installBpmn_Test() throws Exception {
HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, ""));
HttpClient httpClient = mock(HttpClient.class);
- String csarPath = System.getProperty("mso.config.path") + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar";
+ String csarPath = "src/test/resources" + "/resource-examples/WorkflowBpmn/service-CxSvc-csar.csar";
doReturn(response).when(httpClient).execute(any(HttpPost.class));
bpmnInstaller.installBpmn(csarPath);
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index 89bfe07374..9ab4c5ecb2 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -25,7 +25,7 @@ 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.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -221,161 +221,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
@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(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);
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
index b72e079e9e..cfce0f6a17 100644
--- 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
@@ -21,8 +21,8 @@
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.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
diff --git a/asdc-controller/src/test/resources/ASDC/TestBB.bpmn b/asdc-controller/src/test/resources/ASDC/TestBB.bpmn
deleted file mode 100644
index 47d1f6e649..0000000000
--- a/asdc-controller/src/test/resources/ASDC/TestBB.bpmn
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
- <bpmn:process id="TestBB" name="TestBB" isExecutable="true">
- <bpmn:startEvent id="StartEvent_1" name="Start">
- <bpmn:outgoing>SequenceFlow_1owu825</bpmn:outgoing>
- </bpmn:startEvent>
- <bpmn:endEvent id="EndEvent_06wodhm" name="End">
- <bpmn:incoming>SequenceFlow_1gwcdup</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1owu825" sourceRef="StartEvent_1" targetRef="FisrtTask" />
- <bpmn:sequenceFlow id="SequenceFlow_1gwcdup" sourceRef="FisrtTask" targetRef="EndEvent_06wodhm" />
- <bpmn:scriptTask id="FisrtTask" name="FirstTask" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1owu825</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1gwcdup</bpmn:outgoing>
- <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-DoCreateVnf createVnf = new DoCreateVnf()
-createVnf.preProcessRequest(execution)]]></bpmn:script>
- </bpmn:scriptTask>
- </bpmn:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TestBB">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
- <dc:Bounds x="217" y="171" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="223" y="207" width="23" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_06wodhm_di" bpmnElement="EndEvent_06wodhm">
- <dc:Bounds x="630" y="171" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="638" y="207" width="19" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1owu825_di" bpmnElement="SequenceFlow_1owu825">
- <di:waypoint xsi:type="dc:Point" x="253" y="189" />
- <di:waypoint xsi:type="dc:Point" x="390" y="189" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="322" y="174" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1gwcdup_di" bpmnElement="SequenceFlow_1gwcdup">
- <di:waypoint xsi:type="dc:Point" x="490" y="189" />
- <di:waypoint xsi:type="dc:Point" x="630" y="189" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="560" y="174" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0u50zcm_di" bpmnElement="FisrtTask">
- <dc:Bounds x="390" y="149" width="100" height="80" />
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 9cfc500618..caaa5dd3b4 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -7,12 +7,11 @@ ssl-enable: false
spring:
datasource:
- url: jdbc:mariadb://localhost:3307/catalogdb
+ jdbc-url: jdbc:mariadb://localhost:3307/catalogdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
+ initialization-mode: always
jpa:
generate-ddl: false
show-sql: false
@@ -36,19 +35,26 @@ mariaDB4j:
request:
datasource:
- url: jdbc:mariadb://localhost:3307/requestdb
+ jdbc-url: jdbc:mariadb://localhost:3307/requestdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
#Actuator
-management:
+management:
endpoints:
- enabled-by-default: false
- endpoint:
- info:
- enabled: true
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ 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.
mso:
adapters:
@@ -70,10 +76,11 @@ mso:
consumerId: msoasdc-id-local
environmentName: Pre-IST
asdcAddress: localhost:8443
- password: 658D6E9E0C087547284339181615C358
+ password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4
pollingInterval: 30
pollingTimeout: 30
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
+ useHttpsWithDmaap: true
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 9254780291..17423f8434 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -520,36 +520,29 @@ default character set = latin1;
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 `service_proxy_customization` (
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `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,
+ `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ 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,
@@ -563,19 +556,13 @@ create table if not exists `configuration_customization` (
`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
+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
@@ -938,6 +925,7 @@ CREATE TABLE `infra_active_requests` (
`CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
+ `REQUEST_URL` varchar(500) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`),
UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -987,6 +975,7 @@ CREATE TABLE `archived_infra_requests` (
`CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
+ `REQUEST_URL` varchar(500) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`),
UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d72h` (`CLIENT_REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;