aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/pom.xml4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/Application.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java9
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java24
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java1
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java17
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java34
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java76
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java46
-rw-r--r--asdc-controller/src/test/resources/data.sql4
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csarbin96149 -> 96150 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env37
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml460
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json111
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csarbin0 -> 115651 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json25
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml1
19 files changed, 829 insertions, 31 deletions
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 8317b660a6..60c517d944 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -16,8 +16,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<antlr.version>4.7.1</antlr.version>
<java.version>1.8</java.version>
- <sdc.tosca.version>1.5.0</sdc.tosca.version>
- <jtosca.version>1.5.0</jtosca.version>
+ <sdc.tosca.version>1.5.1</sdc.tosca.version>
+ <jtosca.version>1.5.1</jtosca.version>
</properties>
<build>
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 a05eeea466..eb2957c6f8 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,6 +22,8 @@ package org.onap.so.asdc;
import javax.annotation.PostConstruct;
import org.onap.so.asdc.activity.DeployActivitySpecs;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -32,7 +34,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
public class Application {
-
+ private static final Logger logger = LoggerFactory.getLogger(Application.class);
private static final String MSO_CONFIG_PATH = "mso.config.path";
private static final String LOGS_DIR = "logs_dir";
@@ -55,6 +57,7 @@ public class Application {
try {
deployActivitySpecs.deployActivities();
} catch (Exception e) {
+ logger.warn("{} {}", "Exception on deploying activitySpecs: ", e.getMessage());
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 164d32dd66..d3e14ac1b5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -26,6 +26,7 @@ import com.google.common.base.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
import org.onap.so.asdc.activity.beans.ActivitySpec;
import org.onap.so.asdc.activity.beans.Input;
import org.onap.so.asdc.activity.beans.Output;
@@ -53,14 +54,16 @@ public class DeployActivitySpecs {
protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class);
-
+ @Transactional
public void deployActivities() throws Exception {
String hostname = env.getProperty(SDC_ENDPOINT);
+ logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname);
if (hostname == null || hostname.isEmpty()) {
return;
}
List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll();
for (org.onap.so.db.catalog.beans.ActivitySpec activitySpecFromCatalog : activitySpecsFromCatalog) {
+ logger.debug("{} {}", "Attempting to create activity ", activitySpecFromCatalog.getName());
ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog);
String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec);
if (activitySpecId != null) {
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 2eace7587f..60abdc33ef 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
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -57,9 +57,10 @@ public class ASDCConfiguration implements IConfiguration {
public static final String TOSCA_CSAR = "TOSCA_CSAR";
public static final String WORKFLOW = "WORKFLOW";
public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA";
+ public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT";
- private static final String[] SUPPORTED_ARTIFACT_TYPES =
- {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA};
+ private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET,
+ HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, WORKFLOW};
public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST =
Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
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 b1fde550b4..a1cfeb22e4 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
@@ -791,24 +791,24 @@ public class ASDCController {
errorMessage = e.getMessage();
logger.error("Exception occurred", e);
}
+ }
- if (!hasVFResource) {
+ if (!hasVFResource) {
- logger.debug("No resources found for Service: " + iNotif.getServiceUUID());
+ logger.debug("No resources found for Service: " + iNotif.getServiceUUID());
- logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
- try {
- this.deployResourceStructure(resourceStructure, toscaResourceStructure);
- } catch (ArtifactInstallerException e) {
- deployStatus = DistributionStatusEnum.DEPLOY_ERROR;
- errorMessage = e.getMessage();
- logger.error("Exception occurred", e);
- }
+ logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
+ try {
+ this.deployResourceStructure(resourceStructure, toscaResourceStructure);
+ } catch (ArtifactInstallerException e) {
+ deployStatus = DistributionStatusEnum.DEPLOY_ERROR;
+ errorMessage = e.getMessage();
+ logger.error("Exception occurred", e);
}
- this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus,
- errorMessage);
}
+ this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus,
+ errorMessage);
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
logger.error(Strings.repeat("{} ", 6), MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index 5ae57e4133..eed04f933d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -117,6 +117,7 @@ public class VfResourceStructure extends ResourceStructure {
case ASDCConfiguration.HEAT_ARTIFACT:
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
+ case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
break;
case ASDCConfiguration.VF_MODULES_METADATA:
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 8c2d0b81f2..1cc76f70bb 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
@@ -35,6 +35,7 @@ import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import com.google.common.base.Strings;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
@@ -46,6 +47,7 @@ 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.impl.client.HttpClientBuilder;
+import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -64,6 +66,9 @@ public class BpmnInstaller {
@Autowired
private Environment env;
+ @Autowired
+ private ASDCConfiguration asdcConfig;
+
public void installBpmn(String csarFilePath) {
logger.info("Deploying BPMN files from {}", csarFilePath);
try {
@@ -142,7 +147,7 @@ public class BpmnInstaller {
protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception {
FileInputStream bpmnFileStream = new FileInputStream(
- Paths.get(System.getProperty("mso.config.path"), "ASDC", version, bpmnFileName).normalize().toString());
+ Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString());
byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream);
HttpEntity requestEntity =
@@ -196,4 +201,14 @@ public class BpmnInstaller {
logger.error("Unable to open file.", e);
}
}
+
+ private String getMsoConfigPath() {
+ String msoConfigPath = System.getProperty("mso.config.path");
+ if (msoConfigPath == null) {
+ logger.info("Unable to find the system property mso.config.path, use the default configuration");
+ msoConfigPath = StringUtils.defaultString(asdcConfig.getPropertyOrNull("mso.config.defaultpath"));
+ }
+ logger.info("MSO config path is: {}", msoConfigPath);
+ return msoConfigPath;
+ }
}
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 f3f46e39d7..bd5f0d0dbc 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
@@ -81,6 +81,7 @@ 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.InstanceGroup;
import org.onap.so.db.catalog.beans.InstanceGroupType;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
@@ -1156,6 +1157,7 @@ public class ToscaResourceInstaller {
break;
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
+ case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
logger.warn(Strings.repeat("{} ", 4), MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
+ vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
@@ -1266,6 +1268,8 @@ public class ToscaResourceInstaller {
vfModuleArtifact.getArtifactInfo().getArtifactUUID());
heatTemplate.setParameters(heatParam);
vfModuleArtifact.setHeatTemplate(heatTemplate);
+ } else {
+ vfModuleArtifact.setHeatTemplate(existingHeatTemplate);
}
}
@@ -1294,6 +1298,8 @@ public class ToscaResourceInstaller {
heatEnvironment.setArtifactChecksum(MANUAL_RECORD);
}
vfModuleArtifact.setHeatEnvironment(heatEnvironment);
+ } else {
+ vfModuleArtifact.setHeatEnvironment(existingHeatEnvironment);
}
}
@@ -1318,7 +1324,8 @@ public class ToscaResourceInstaller {
heatFile.setArtifactChecksum(MANUAL_RECORD);
}
vfModuleArtifact.setHeatFiles(heatFile);
-
+ } else {
+ vfModuleArtifact.setHeatFiles(existingHeatFiles);
}
}
@@ -1810,16 +1817,25 @@ public class ToscaResourceInstaller {
VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) {
Metadata instanceMetadata = group.getMetadata();
- // Populate InstanceGroup
+
+ InstanceGroup existingInstanceGroup =
+ instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
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
+ if (existingInstanceGroup == null) {
+ // Populate InstanceGroup
+ 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
+ } else {
+ vfcInstanceGroup = (VFCInstanceGroup) existingInstanceGroup;
+ }
// Populate VNFCInstanceGroupCustomization
VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization();
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
new file mode 100644
index 0000000000..81977da278
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.asdc.activity;
+
+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.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.activity.DeployActivitySpecs;
+import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpHeaders;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.ws.rs.core.MediaType;
+
+public class DeployActivitySpecsITTest extends BaseTest {
+ @Mock
+ protected Environment env;
+
+ @Value("${wiremock.server.port}")
+ private String wiremockPort;
+
+ @Autowired
+ private DeployActivitySpecs deployActivitySpecs;
+
+ @Test
+ public void deployActivitySpecsIT_Test() throws Exception {
+ ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
+ activitySpecCreateResponse.setId("testActivityId");
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+
+ ObjectMapper mapper = new ObjectMapper();
+ String body = mapper.writeValueAsString(activitySpecCreateResponse);
+
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body)));
+
+ when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090");
+
+ String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions";
+
+ wireMockServer.stubFor(
+ put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value())));
+
+ deployActivitySpecs.deployActivities();
+ assertTrue(activitySpecCreateResponse.getId().equals("testActivityId"));
+ }
+}
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 ac107f6449..2c520a3bba 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,11 +27,15 @@ 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 static org.junit.Assert.assertTrue;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
import java.util.Set;
import javax.transaction.Transactional;
import javax.ws.rs.core.Response;
@@ -45,11 +49,15 @@ 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.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
import org.onap.so.db.catalog.data.repository.WorkflowRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -75,6 +83,9 @@ public class ASDCRestInterfaceTest extends BaseTest {
private WorkflowRepository workflowRepo;
@Autowired
+ private ToscaCsarRepository toscaCsarRepo;
+
+ @Autowired
private ASDCRestInterface asdcRestInterface;
private TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
@@ -244,6 +255,41 @@ public class ASDCRestInterfaceTest extends BaseTest {
}
+
+ @Test
+ public void test_Vcpe_Infra_Distribution() throws Exception {
+ wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
+
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value())));
+
+ String resourceLocation = "src/test/resources/resource-examples/vcpe-infra/";
+
+ ObjectMapper mapper = new ObjectMapper();
+ NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demovcpeinfra-notification.json"),
+ NotificationDataImpl.class);
+ headers.add("resource-location", resourceLocation);
+ 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());
+
+ Optional<ToscaCsar> toscaCsar = toscaCsarRepo.findById("144606d8-a505-4ba0-90a9-6d1c6219fc6b");
+ assertTrue(toscaCsar.isPresent());
+ assertEquals("service-Demovcpeinfra-csar.csar", toscaCsar.get().getName());
+
+ Optional<Service> service = serviceRepo.findById("8a77cbbb-9850-40bb-a42f-7aec8e3e6ab7");
+ assertTrue(service.isPresent());
+ assertEquals("demoVCPEInfra", service.get().getModelName());
+
+ Optional<NetworkResource> networkResource = networkRepo.findById("89789b26-a46b-4cee-aed0-d46e21f93a5e");
+ assertTrue(networkResource.isPresent());
+ assertEquals("Generic NeutronNet", networkResource.get().getModelName());
+ }
+
protected String createURLWithPort(String uri) {
return "http://localhost:" + port + uri;
}
diff --git a/asdc-controller/src/test/resources/data.sql b/asdc-controller/src/test/resources/data.sql
index 47e6c4c982..bc97b1e54a 100644
--- a/asdc-controller/src/test/resources/data.sql
+++ b/asdc-controller/src/test/resources/data.sql
@@ -21,12 +21,14 @@ INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_
('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);
+INSERT INTO temp_network_heat_template_lookup(NETWORK_RESOURCE_MODEL_NAME, HEAT_TEMPLATE_ARTIFACT_UUID, AIC_VERSION_MIN, AIC_VERSION_MAX) VALUES
+('Generic NeutronNet', 'ff874603-4222-11e7-9252-005056850d2e', '3.0', NULL);
insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null);
insert into workflow(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values
-('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
+('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
('ff2ae348-214a-11e7-93ae-92361f002671', '1');
diff --git a/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar b/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar
index 260ff86916..9803d9cd2d 100644
--- a/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar
+++ b/asdc-controller/src/test/resources/resource-examples/vFW/service-Vfw.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env
new file mode 100644
index 0000000000..85d3ea19a3
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.env
@@ -0,0 +1,37 @@
+parameters:
+ cloud_env: "PUT THE CLOUD PROVIDED HERE (openstack or rackspace)"
+ cpe_public_net_cidr: "10.2.0.0/24"
+ cpe_public_net_id: "zdfw1cpe01_public"
+ cpe_public_subnet_id: "zdfw1cpe01_sub_public"
+ cpe_signal_net_cidr: "10.4.0.0/24"
+ cpe_signal_net_id: "zdfw1cpe01_private"
+ cpe_signal_subnet_id: "zdfw1cpe01_sub_private"
+ dcae_collector_ip: "10.0.4.1"
+ dcae_collector_port: "8081"
+ demo_artifacts_version: "1.4.0"
+ install_script_version: "1.4.0"
+ key_name: "vaaa_key"
+ mr_ip_addr: "10.0.11.1"
+ mr_ip_port: "3904"
+ nexus_artifact_repo: "https://nexus.onap.org"
+ onap_private_net_cidr: "10.0.0.0/16"
+ onap_private_net_id: "PUT THE ONAP PRIVATE NETWORK NAME HERE"
+ onap_private_subnet_id: "PUT THE ONAP PRIVATE SUBNETWORK NAME HERE"
+ pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN"
+ public_net_id: "PUT THE PUBLIC NETWORK ID HERE"
+ vaaa_name_0: "zdcpe1cpe01aaa01"
+ vaaa_private_ip_0: "10.4.0.4"
+ vaaa_private_ip_1: "10.0.101.2"
+ vcpe_flavor_name: "PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED)"
+ vcpe_image_name: "PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED)"
+ vdhcp_name_0: "zdcpe1cpe01dhcp01"
+ vdhcp_private_ip_0: "10.4.0.1"
+ vdhcp_private_ip_1: "10.0.101.1"
+ vdns_name_0: "zdcpe1cpe01dns01"
+ vdns_private_ip_0: "10.2.0.1"
+ vdns_private_ip_1: "10.0.101.3"
+ vf_module_id: "vCPE_Intrastructure"
+ vnf_id: "vCPE_Infrastructure_demo_app"
+ vweb_name_0: "zdcpe1cpe01web01"
+ vweb_private_ip_0: "10.2.0.10"
+ vweb_private_ip_1: "10.0.101.40"
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml
new file mode 100644
index 0000000000..9f3bf27492
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/base_vcpe_infra.yaml
@@ -0,0 +1,460 @@
+##########################################################################
+#
+#==================LICENSE_START==========================================
+#
+#
+# Copyright 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============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+##########################################################################
+
+heat_template_version: 2013-05-23
+
+description: Heat template to deploy vCPE Infrastructue emlements (vAAA, vDHCP, vDNS_DHCP, webServer)
+
+##############
+# #
+# PARAMETERS #
+# #
+##############
+
+parameters:
+ vcpe_image_name:
+ type: string
+ label: Image name or ID
+ description: Image to be used for compute instance
+ vcpe_flavor_name:
+ type: string
+ label: Flavor
+ description: Type of instance (flavor) to be used
+ public_net_id:
+ type: string
+ label: Public network name or ID
+ description: Public network that enables remote connection to VNF
+ onap_private_net_id:
+ type: string
+ label: ONAP management network name or ID
+ description: Private network that connects ONAP components and the VNF
+ onap_private_subnet_id:
+ type: string
+ label: ONAP management sub-network name or ID
+ description: Private sub-network that connects ONAP components and the VNF
+ onap_private_net_cidr:
+ type: string
+ label: ONAP private network CIDR
+ description: The CIDR of the protected private network
+ cpe_signal_net_id:
+ type: string
+ label: vAAA private network name or ID
+ description: Private network that connects vAAA with vDNSs
+ cpe_signal_subnet_id:
+ type: string
+ label: CPE Signal subnet
+ description: CPE Signal subnet
+ cpe_signal_net_cidr:
+ type: string
+ label: vAAA private network CIDR
+ description: The CIDR of the vAAA private network
+ cpe_public_net_id:
+ type: string
+ label: vCPE Public network (emulates internet) name or ID
+ description: Private network that connects vGW to emulated internet
+ cpe_public_subnet_id:
+ type: string
+ label: CPE Public subnet
+ description: CPE Public subnet
+ cpe_public_net_cidr:
+ type: string
+ label: vCPE public network CIDR
+ description: The CIDR of the vCPE public
+ vaaa_private_ip_0:
+ type: string
+ label: vAAA private IP address towards the CPE_SIGNAL private network
+ description: Private IP address that is assigned to the vAAA to communicate with the vCPE components
+ vaaa_private_ip_1:
+ type: string
+ label: vAAA private IP address towards the ONAP management network
+ description: Private IP address that is assigned to the vAAA to communicate with ONAP components
+ vdns_private_ip_0:
+ type: string
+ label: vDNS private IP address towards the CPE_PUBLIC private network
+ description: Private IP address that is assigned to the vDNS to communicate with the vCPE components
+ vdns_private_ip_1:
+ type: string
+ label: vDNS private IP address towards the ONAP management network
+ description: Private IP address that is assigned to the vDNS to communicate with ONAP components
+ vdhcp_private_ip_0:
+ type: string
+ label: vDHCP private IP address towards the CPE_SIGNAL private network
+ description: Private IP address that is assigned to the vDHCP to communicate with the vCPE components
+ vdhcp_private_ip_1:
+ type: string
+ label: vDNS private IP address towards the ONAP management network
+ description: Private IP address that is assigned to the vDHCP to communicate with ONAP components
+ vweb_private_ip_0:
+ type: string
+ label: vWEB private IP address towards the CPE_PUBLIC private network
+ description: Private IP address that is assigned to the vWEB to communicate with the vGWs
+ vweb_private_ip_1:
+ type: string
+ label: vWEB private IP address towards the ONAP management network
+ description: Private IP address that is assigned to the vWEB to communicate with ONAP components
+ vaaa_name_0:
+ type: string
+ label: vAAA name
+ description: Name of the vAAA
+ vdns_name_0:
+ type: string
+ label: vDNS name
+ description: Name of the vDNS
+ vdhcp_name_0:
+ type: string
+ label: vDHCP name
+ description: Name of the vDHCP
+ vweb_name_0:
+ type: string
+ label: vWEB name
+ description: Name of the vWEB
+ vnf_id:
+ type: string
+ label: VNF ID
+ description: The VNF ID is provided by ONAP
+ vf_module_id:
+ type: string
+ label: vFirewall module ID
+ description: The vAAA Module ID is provided by ONAP
+ dcae_collector_ip:
+ type: string
+ label: DCAE collector IP address
+ description: IP address of the DCAE collector
+ dcae_collector_port:
+ type: string
+ label: DCAE collector port
+ description: Port of the DCAE collector
+ mr_ip_addr:
+ type: string
+ label: Message Router IP address
+ description: IP address of the Message Router that for vDHCP configuration
+ mr_ip_port:
+ type: string
+ label: Message Router Port
+ description: IP port of the Message Router that for vDHCP configuration
+ key_name:
+ type: string
+ label: Key pair name
+ description: Public/Private key pair name
+ pub_key:
+ type: string
+ label: Public key
+ description: Public key to be installed on the compute instance
+ install_script_version:
+ type: string
+ label: Installation script version number
+ description: Version number of the scripts that install the vFW demo app
+ demo_artifacts_version:
+ type: string
+ label: Artifacts version used in demo vnfs
+ description: Artifacts (jar, tar.gz) version used in demo vnfs
+ nexus_artifact_repo:
+ type: string
+ description: Root URL for the Nexus repository for Maven artifacts.
+ default: "https://nexus.onap.org"
+ cloud_env:
+ type: string
+ label: Cloud environment
+ description: Cloud environment (e.g., openstack, rackspace)
+
+#############
+# #
+# RESOURCES #
+# #
+#############
+
+resources:
+
+ random-str:
+ type: OS::Heat::RandomString
+ properties:
+ length: 4
+
+ my_keypair:
+ type: OS::Nova::KeyPair
+ properties:
+ name:
+ str_replace:
+ template: base_rand
+ params:
+ base: { get_param: key_name }
+ rand: { get_resource: random-str }
+ public_key: { get_param: pub_key }
+ save_private_key: false
+
+
+ # Virtual AAA server Instantiation
+ vaaa_private_0_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: cpe_signal_net_id }
+ fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vaaa_private_ip_0 }}]
+
+ vaaa_private_1_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: onap_private_net_id }
+ fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vaaa_private_ip_1 }}]
+
+ vaaa_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: vcpe_image_name }
+ flavor: { get_param: vcpe_flavor_name }
+ name: { get_param: vaaa_name_0 }
+ key_name: { get_resource: my_keypair }
+ networks:
+ - network: { get_param: public_net_id }
+ - port: { get_resource: vaaa_private_0_port }
+ - port: { get_resource: vaaa_private_1_port }
+ metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+ user_data_format: RAW
+ user_data:
+ str_replace:
+ params:
+ __dcae_collector_ip__: { get_param: dcae_collector_ip }
+ __dcae_collector_port__: { get_param: dcae_collector_port }
+ __cpe_signal_net_ipaddr__: { get_param: vaaa_private_ip_0 }
+ __oam_ipaddr__: { get_param: vaaa_private_ip_1 }
+ __oam_cidr__: { get_param: onap_private_net_cidr }
+ __cpe_signal_net_cidr__: { get_param: cpe_signal_net_cidr }
+ __demo_artifacts_version__ : { get_param: demo_artifacts_version }
+ __install_script_version__ : { get_param: install_script_version }
+ __cloud_env__ : { get_param: cloud_env }
+ __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
+ template: |
+ #!/bin/bash
+
+ # Create configuration files
+ mkdir /opt/config
+ echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
+ echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
+ echo "__cpe_signal_net_ipaddr__" > /opt/config/cpe_signal_net_ipaddr.txt
+ echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
+ echo "__oam_cidr__" > /opt/config/oam_cidr.txt
+ echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt
+ echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+ echo "__install_script_version__" > /opt/config/install_script_version.txt
+ echo "__cloud_env__" > /opt/config/cloud_env.txt
+ echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
+
+ # Download and run install script
+ apt-get update
+ apt-get -y install unzip
+ if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
+ curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip
+ unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_aaa_install.sh
+ cd /opt
+ chmod +x v_aaa_install.sh
+ ./v_aaa_install.sh
+
+
+ # Virtual DNS Instantiation
+ vdns_private_0_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: cpe_public_net_id }
+ fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vdns_private_ip_0 }}]
+
+ vdns_private_1_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: onap_private_net_id }
+ fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
+
+ vdns_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: vcpe_image_name }
+ flavor: { get_param: vcpe_flavor_name }
+ name: { get_param: vdns_name_0 }
+ key_name: { get_resource: my_keypair }
+ networks:
+ - network: { get_param: public_net_id }
+ - port: { get_resource: vdns_private_0_port }
+ - port: { get_resource: vdns_private_1_port }
+ metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+ user_data_format: RAW
+ user_data:
+ str_replace:
+ params:
+ __oam_ipaddr__ : { get_param: vdns_private_ip_1 }
+ __cpe_public_net_ipaddr__: { get_param: vdns_private_ip_0 }
+ __oam_cidr__: { get_param: onap_private_net_cidr }
+ __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr }
+ __demo_artifacts_version__ : { get_param: demo_artifacts_version }
+ __install_script_version__ : { get_param: install_script_version }
+ __cloud_env__ : { get_param: cloud_env }
+ __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
+ template: |
+ #!/bin/bash
+
+ # Create configuration files
+ mkdir /opt/config
+ echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
+ echo "__cpe_public_net_ipaddr__" > /opt/config/cpe_public_net_ipaddr.txt
+ echo "__oam_cidr__" > /opt/config/oam_cidr.txt
+ echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt
+ echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+ echo "__install_script_version__" > /opt/config/install_script_version.txt
+ echo "__cloud_env__" > /opt/config/cloud_env.txt
+ echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
+
+ # Download and run install script
+ apt-get update
+ apt-get -y install unzip
+ if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
+ curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip
+ unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_dns_install.sh
+ cd /opt
+ chmod +x v_dns_install.sh
+ ./v_dns_install.sh
+
+
+ # Virtual DHCP Instantiation
+ vdhcp_private_0_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: cpe_signal_net_id }
+ fixed_ips: [{"subnet": { get_param: cpe_signal_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_0 }}]
+
+ vdhcp_private_1_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: onap_private_net_id }
+ fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdhcp_private_ip_1 }}]
+
+ vdhcp_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: vcpe_image_name }
+ flavor: { get_param: vcpe_flavor_name }
+ name: { get_param: vdhcp_name_0 }
+ key_name: { get_resource: my_keypair }
+ networks:
+ - network: { get_param: public_net_id }
+ - port: { get_resource: vdhcp_private_0_port }
+ - port: { get_resource: vdhcp_private_1_port }
+ metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+ user_data_format: RAW
+ user_data:
+ str_replace:
+ params:
+ __oam_ipaddr__ : { get_param: vdhcp_private_ip_1 }
+ __cpe_signal_ipaddr__ : { get_param: vdhcp_private_ip_0 }
+ __oam_cidr__ : { get_param: onap_private_net_cidr }
+ __cpe_signal_net_cidr__ : { get_param: cpe_signal_net_cidr }
+ __mr_ip_addr__ : { get_param: mr_ip_addr }
+ __mr_ip_port__ : { get_param: mr_ip_port }
+ __demo_artifacts_version__ : { get_param: demo_artifacts_version }
+ __install_script_version__ : { get_param: install_script_version }
+ __cloud_env__ : { get_param: cloud_env }
+ __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
+ template: |
+ #!/bin/bash
+
+ # Create configuration files
+ mkdir /opt/config
+ echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
+ echo "__cpe_signal_ipaddr__" > /opt/config/cpe_signal_ipaddr.txt
+ echo "__oam_cidr__" > /opt/config/oam_cidr.txt
+ echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt
+ echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt
+ echo "__mr_ip_port__" > /opt/config/mr_ip_port.txt
+ echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+ echo "__install_script_version__" > /opt/config/install_script_version.txt
+ echo "__cloud_env__" > /opt/config/cloud_env.txt
+ echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
+
+ # Download and run install script
+ apt-get update
+ apt-get -y install unzip
+ if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
+ curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip
+ unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_dhcp_install.sh
+ cd /opt
+ chmod +x v_dhcp_install.sh
+ ./v_dhcp_install.sh
+
+ # vWEB instantiaion
+ vweb_private_0_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: cpe_public_net_id }
+ fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vweb_private_ip_0 }}]
+
+ vweb_private_1_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: onap_private_net_id }
+ fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vweb_private_ip_1 }}]
+
+
+ vweb_0:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: vcpe_image_name }
+ flavor: { get_param: vcpe_flavor_name }
+ name: { get_param: vweb_name_0 }
+ key_name: { get_resource: my_keypair }
+ networks:
+ - network: { get_param: public_net_id }
+ - port: { get_resource: vweb_private_0_port }
+ - port: { get_resource: vweb_private_1_port }
+ metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+ user_data_format: RAW
+ user_data:
+ str_replace:
+ params:
+ __oam_ipaddr__ : { get_param: vweb_private_ip_1 }
+ __cpe_public_ipaddr__: { get_param: vweb_private_ip_0 }
+ __oam_cidr__: { get_param: onap_private_net_cidr }
+ __cpe_public_net_cidr__: { get_param: cpe_public_net_cidr }
+ __demo_artifacts_version__ : { get_param: demo_artifacts_version }
+ __install_script_version__ : { get_param: install_script_version }
+ __cloud_env__ : { get_param: cloud_env }
+ __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
+ template: |
+ #!/bin/bash
+
+ # Create configuration files
+ mkdir /opt/config
+ echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt
+ echo "__cpe_public_ipaddr__" > /opt/config/cpe_public_ipaddr.txt
+ echo "__oam_cidr__" > /opt/config/oam_cidr.txt
+ echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt
+ echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+ echo "__install_script_version__" > /opt/config/install_script_version.txt
+ echo "__cloud_env__" > /opt/config/cloud_env.txt
+ echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
+
+ # Download and run install script
+ apt-get update
+ apt-get -y install unzip
+ if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
+ curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip
+ unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_web_install.sh
+ cd /opt
+ chmod +x v_web_install.sh
+ ./v_web_install.sh
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json
new file mode 100644
index 0000000000..61468a74f7
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/demovcpeinfra-notification.json
@@ -0,0 +1,111 @@
+{
+ "distributionID": "e61f72f2-eee9-4c46-bf76-ae24414c6396",
+ "serviceName": "demoVCPEInfra",
+ "serviceVersion": "1.0",
+ "serviceUUID": "8a77cbbb-9850-40bb-a42f-7aec8e3e6ab7",
+ "serviceDescription": "catalog service description",
+ "serviceInvariantUUID": "21c102b6-c3e6-49ca-8021-83c105a191fa",
+ "resources": [{
+ "resourceInstanceName": "CPE_PUBLIC",
+ "resourceName": "Generic NeutronNet",
+ "resourceVersion": "1.0",
+ "resoucreType": "VL",
+ "resourceUUID": "67bf9c77-aa78-4fab-99f4-3939a6d42348",
+ "resourceInvariantUUID": "8917e73c-88cf-42ed-8b33-6ea8ad080285",
+ "resourceCustomizationUUID": "4b3bd88b-6351-4564-b1de-e01021cdb79b",
+ "category": "Generic",
+ "subcategory": "Network Elements",
+ "artifacts": []
+ }, {
+ "resourceInstanceName": "vCPE_infra bf35304f-e92f 0",
+ "resourceName": "vCPE_infra bf35304f-e92f",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "9a91c854-86fb-4072-8d4d-94dc0e96a311",
+ "resourceInvariantUUID": "dcd9cb6c-1634-4424-86e6-b03baed3e10a",
+ "resourceCustomizationUUID": "01564fe7-0541-4d92-badc-464cc35f83ba",
+ "category": "Generic",
+ "subcategory": "Abstract",
+ "artifacts": [{
+ "artifactName": "vf-license-model.xml",
+ "artifactType": "VF_LICENSE",
+ "artifactURL": "vf-license-model.xml",
+ "artifactChecksum": "ODc4YjdjY2M5MDE1NDcxN2JhYTA2MjdiNGUxODE2MTM=",
+ "artifactDescription": "VF license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "7fbbb913-0309-4a8b-8596-a1faf84886e8",
+ "artifactVersion": "1"
+ }, {
+ "artifactName": "vcpe_infrabf35304fe92f0_modules.json",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "vcpe_infrabf35304fe92f0_modules.json",
+ "artifactChecksum": "OGQ2MTI5YjZjYTFlYzUyOTYyOTY4YWZkYTQxYzViYzg=",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactTimeout": 120,
+ "artifactUUID": "518b313a-4484-4cfd-92f0-0b23e2a415fd",
+ "artifactVersion": "1"
+ }, {
+ "artifactName": "base_vcpe_infra.yaml",
+ "artifactType": "HEAT",
+ "artifactURL": "base_vcpe_infra.yaml",
+ "artifactChecksum": "ZGEyNDgwNmEzZDk3ODU3ZDg3YTg1MDc0NmU1ZTMwYmI=",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": 120,
+ "artifactUUID": "183353d4-2b50-4dc1-aecc-f2818f666b70",
+ "artifactVersion": "2"
+ }, {
+ "artifactName": "vendor-license-model.xml",
+ "artifactType": "VENDOR_LICENSE",
+ "artifactURL": "vendor-license-model.xml",
+ "artifactChecksum": "OTJhOTQyNTczZGRiYTJlM2M0MDQxZTdlMTE3NDE5YTQ=",
+ "artifactDescription": " Vendor license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "7f4577e5-9f89-4c8e-985e-500e58425276",
+ "artifactVersion": "1"
+ }, {
+ "artifactName": "base_vcpe_infra.env",
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "base_vcpe_infra.env",
+ "artifactChecksum": "ZmQxYTM1Yjg0ODJmN2I0OWE4OWMxN2NjOGEwMTM5NTY=",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": 120,
+ "artifactUUID": "1e9e20c7-6801-4a6c-a270-c8f5cec034c0",
+ "artifactVersion": "2",
+ "generatedFromUUID": "183353d4-2b50-4dc1-aecc-f2818f666b70"
+ }
+ ]
+ }, {
+ "resourceInstanceName": "CPE_SIGNAL",
+ "resourceName": "Generic NeutronNet",
+ "resourceVersion": "1.0",
+ "resoucreType": "VL",
+ "resourceUUID": "67bf9c77-aa78-4fab-99f4-3939a6d42348",
+ "resourceInvariantUUID": "8917e73c-88cf-42ed-8b33-6ea8ad080285",
+ "resourceCustomizationUUID": "803e0da3-6c40-4a4f-918b-7f3484de61ff",
+ "category": "Generic",
+ "subcategory": "Network Elements",
+ "artifacts": []
+ }
+ ],
+ "serviceArtifacts": [{
+ "artifactName": "service-Demovcpeinfra-template.yml",
+ "artifactType": "TOSCA_TEMPLATE",
+ "artifactURL": "service-Demovcpeinfra-template.yml",
+ "artifactChecksum": "ZDY3ZGY4ZTM4ZDA3ZjY4M2Y2MDgxNzI0MDE3NjkzODM=",
+ "artifactDescription": "TOSCA representation of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "a4180154-1279-47d5-acbc-392e87d3fc7f",
+ "artifactVersion": "1"
+ }, {
+ "artifactName": "service-Demovcpeinfra-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "service-Demovcpeinfra-csar.csar",
+ "artifactChecksum": "NjlhMDk2YzNlNTI5OTg3MzE2ZmUzYjI5MTY2M2Y5YmU=",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "144606d8-a505-4ba0-90a9-6d1c6219fc6b",
+ "artifactVersion": "1"
+ }
+ ],
+ "workloadContext": "Production"
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar
new file mode 100644
index 0000000000..841c681088
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json
new file mode 100644
index 0000000000..d005a09730
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vcpe_infrabf35304fe92f0_modules.json
@@ -0,0 +1,25 @@
+[
+ {
+ "vfModuleModelName": "VcpeInfraBf35304fE92f..base_vcpe_infra..module-0",
+ "vfModuleModelInvariantUUID": "e9a09595-26cd-4929-89e6-a79a02d3ef8f",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelUUID": "4555cb57-7dc6-4680-912f-84739fc8d03e",
+ "vfModuleModelCustomizationUUID": "354b1e83-47db-4af1-8af4-9c14b03b482d",
+ "isBase": true,
+ "artifacts": [
+ "183353d4-2b50-4dc1-aecc-f2818f666b70",
+ "1e9e20c7-6801-4a6c-a270-c8f5cec034c0"
+ ],
+ "properties": {
+ "min_vf_module_instances": "1",
+ "vf_module_label": "base_vcpe_infra",
+ "max_vf_module_instances": "1",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Base",
+ "availability_zone_count": "",
+ "volume_group": "false",
+ "initial_count": "1"
+ }
+ }
+] \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml
new file mode 100644
index 0000000000..4c6a44d46b
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>4c24f75d-4191-4447-9b61</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>af63f5c36c93451c99640c1b63ae5bc9</entitlement-pool-invariant-uuid><entitlement-pool-uuid>187EE1211F1A437CBCC6032B60841846</entitlement-pool-uuid><version>1.0</version><name>4e401c4f-0679-46a0-b7f1</name><description>vendor entitlement pool</description><increments/><manufacturer-reference-number>111111</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-05-10T00:00:00Z</start-date><expiry-date>2020-05-09T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>22353211-5524-4b26-af02</name><description>vendor license key group</description><type>Universal</type><increments/><manufacturerReferenceNumber>11111</manufacturerReferenceNumber><license-key-group-invariant-uuid>4e872234ca73482da2d4efc0a7da9e06</license-key-group-invariant-uuid><license-key-group-uuid>65C063A5402146DC9CEDDB7D99F9BA1A</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-05-10T00:00:00Z</start-date><expiry-date>2020-05-09T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml
new file mode 100644
index 0000000000..cc13fa4fea
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>4c24f75d-4191-4447-9b61</vendor-name><vf-id>b9cd64d6d4dc4a93953193ac0bc09619</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>4e401c4f-0679-46a0-b7f1</name><description>vendor entitlement pool</description><increments/><entitlement-pool-invariant-uuid>af63f5c36c93451c99640c1b63ae5bc9</entitlement-pool-invariant-uuid><entitlement-pool-uuid>187EE1211F1A437CBCC6032B60841846</entitlement-pool-uuid><manufacturer-reference-number>111111</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-05-10T00:00:00Z</start-date><expiry-date>2020-05-09T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>22353211-5524-4b26-af02</name><description>vendor license key group</description><type>Universal</type><increments/><license-key-group-invariant-uuid>4e872234ca73482da2d4efc0a7da9e06</license-key-group-invariant-uuid><license-key-group-uuid>65C063A5402146DC9CEDDB7D99F9BA1A</license-key-group-uuid><manufacturer-reference-number>11111</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-05-10T00:00:00Z</start-date><expiry-date>2020-05-09T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>9bc21ea0-5bcd-44d6-93f0</name><feature-group-uuid>f7fdb15660df4254b520797c59297b24</feature-group-uuid><part-number>123abc456</part-number><description>vendor feature group</description></feature-group></feature-group-list></vf-license-model> \ No newline at end of file