aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-flows/src
diff options
context:
space:
mode:
authoreeginux <henry.xie@est.tech>2019-04-05 16:49:07 +0000
committereeginux <henry.xie@est.tech>2019-04-05 16:49:07 +0000
commitc0908b5a8acee321086286c0cf33c412caaae29c (patch)
tree569f888c01a63fc763f4d0ac8ce0fb9f6af0f34c /bpmn/so-bpmn-infrastructure-flows/src
parent10ef4462e14cfc57a0d3b074569e9b209186d5f1 (diff)
Change to use OAM IPAddress
Change to use ipaddress-v4/6-oam for the config deploy Add more assertions to the integration test Issue-ID: SO-1506 Change-Id: I5ba45b055569f90f91308b6e9d4bd85a1d4e99fe Signed-off-by: eeginux <henry.xie@est.tech>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src')
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java91
2 files changed, 89 insertions, 10 deletions
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
index a4de95e4fa..bf4a015e36 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java
@@ -53,9 +53,9 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase {
@Rule
public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule();
- private final List<String> messagesDelivered = new ArrayList<>();
private final CountDownLatch allRequestsDelivered = new CountDownLatch(1);
private final AtomicReference<StreamObserver<ExecutionServiceOutput>> responseObserverRef = new AtomicReference<>();
+ private final List<ExecutionServiceInput> detailedMessages = new ArrayList<>();
@PostConstruct
public void start() throws IOException {
@@ -71,7 +71,7 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase {
StreamObserver<ExecutionServiceInput> requestObserver = new StreamObserver<ExecutionServiceInput>() {
@Override
public void onNext(ExecutionServiceInput message) {
- messagesDelivered.add(message.getActionIdentifiers().getActionName());
+ detailedMessages.add(message);
logger.info("Message received: {}", message);
ExecutionServiceOutput executionServiceOutput = ExecutionServiceOutput.newBuilder()
.setActionIdentifiers(message.getActionIdentifiers())
@@ -103,8 +103,8 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase {
}
- public List<String> getMessagesDelivered() {
- return this.messagesDelivered;
+ public List<ExecutionServiceInput> getDetailedMessages(){
+ return this.detailedMessages;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index 897ab037f2..2b1dc384a1 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -23,18 +23,26 @@ package org.onap.so.bpmn.infrastructure.process;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+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.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static org.assertj.core.api.Assertions.fail;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import com.google.protobuf.Struct;
+import com.google.protobuf.Value;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Test;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.so.BaseBPMNTest;
import org.onap.so.GrpcNettyServer;
import org.onap.so.bpmn.mock.FileUtil;
@@ -55,6 +63,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
private String testBusinessKey;
private String requestObject;
private String responseObject;
+ private String msoRequestId;
@Autowired
private GrpcNettyServer grpcNettyServer;
@@ -82,7 +91,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* Create mso-request-id.
*/
- String msoRequestId = UUID.randomUUID().toString();
+ msoRequestId = UUID.randomUUID().toString();
variables.put("mso-request-id", msoRequestId);
@@ -99,6 +108,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
public void workflow_validInput_expectedOuput() {
mockCatalogDb();
+ mockRequestDb();
mockAai();
mockDmaapForPnf();
@@ -111,7 +121,6 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
if (!execution.isSuspended() && !execution.isEnded()) {
try {
-
runtimeService.signal(execution.getId());
} catch (Exception e) {
logger.info(e.getMessage(), e);
@@ -140,8 +149,73 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
assertThat(pi).isEnded();
- List<String> messagesDelivered = grpcNettyServer.getMessagesDelivered();
- assertThat(messagesDelivered).containsSequence("config-assign", "config-deploy");
+ List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
+ assertThat(detailedMessages).hasSize(2);
+ try {
+ checkConfigAssign(detailedMessages.get(0));
+ checkConfigDeploy(detailedMessages.get(1));
+ } catch(Exception e){
+ e.printStackTrace();
+ fail("ConfigAssign/deploy request exception", e);
+ }
+ }
+
+ private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
+ ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+
+ /**
+ * the fields of actionIdentifiers should match the one in the response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
+ */
+ assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).matches("config-assign");
+ assertThat(actionIdentifiers.getMode()).matches("sync");
+
+ CommonHeader commonHeader = executionServiceInput.getCommonHeader();
+ assertThat(commonHeader.getOriginatorId()).matches("SO");
+ assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+
+ Struct payload = executionServiceInput.getPayload();
+ Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
+
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
+
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ }
+
+ private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
+ ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+
+ /**
+ * the fields of actionIdentifiers should match the one in the response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
+ */
+ assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).matches("config-deploy");
+ assertThat(actionIdentifiers.getMode()).matches("async");
+
+ CommonHeader commonHeader = executionServiceInput.getCommonHeader();
+ assertThat(commonHeader.getOriginatorId()).matches("SO");
+ assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+
+ Struct payload = executionServiceInput.getPayload();
+ Struct requeststruct = payload.getFieldsOrThrow("config-deploy-request").getStructValue();
+
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
+
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).matches("68dc9a92-214c-11e7-93ae-92361f002680");
+
+ /**
+ * IP addresses match the OAM ip addresses from AAI.
+ */
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).matches("1.1.1.1");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).matches("::/128");
}
/**
@@ -174,8 +248,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
+ " \"pnf-id\":\"testtest\",\n"
+ " \"in-maint\":true,\n"
+ " \"resource-version\":\"1541720264047\",\n"
- + " \"pnf-ipv4-address\":\"1.1.1.1\",\n"
- + " \"pnf-ipv6-address\":\"ipv6\"\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n"
+ + " \"ipaddress-v6-oam\":\"::/128\"\n"
+ "}";
/**
@@ -258,4 +332,9 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
"/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
.willReturn(okJson(catalogdbClientResponse)));
}
+
+ private void mockRequestDb() {
+ wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")).willReturn(ok()));
+ }
+
}