summaryrefslogtreecommitdiffstats
path: root/appc-config
diff options
context:
space:
mode:
authorLori Keighron <lk2924@att.com>2019-02-11 17:21:37 -0500
committerTakamune Cho <takamune.cho@att.com>2019-02-14 16:28:17 +0000
commitc751a9532c263b542f7f420071c545844fa56dc7 (patch)
tree3336fee3eef71604bf9b4e7740446e6dec094c3a /appc-config
parent796ca12ab0fba32db8b4a0dff4cc4e972652c35d (diff)
Check vm-capabilites on vnf-level OS requests
New per-vm capabilities checking is introduced for vnf-level OpenStack actions Additional changes per initial review. Additional changes in TestVnfc.java per second review. Change-Id: Idd1d834df076c1e525f596b788b69ed63ba9e66b Issue-ID: APPC-1380 Signed-off-by: Lori Keighron <lk2924@att.com>
Diffstat (limited to 'appc-config')
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java4
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java20
2 files changed, 22 insertions, 2 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java
index db5791305..276301ed3 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowSequenceGenerator.java
@@ -131,6 +131,10 @@ class FlowSequenceGenerator {
flowSequence = output.toString();
log.info("MultistepSequenceGenerator-Output: " + flowSequence);
+ if (!flowSequence.contains("transactions")) {
+ throw new Exception("No transactions were generated for this request");
+ }
+
} else if (sequenceType.equalsIgnoreCase(EXTERNAL)) {
//String input = collectInputParams(localContext);
// flowSequnce = ""; //get it from the External interface calling the Rest End point - TBD
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java
index 533de5840..1846a0922 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowSequenceGeneratorTest.java
@@ -166,12 +166,28 @@ public class FlowSequenceGeneratorTest {
when(ctx.getAttribute(VNF_ID)).thenReturn("some-vnf-id");
Map<String, String> map = new HashMap<>();
- map.put("restResponse", "{'output':{'dummy-json-object':'some-param'}}".replaceAll("'", "\""));
+ map.put("restResponse", "{'output':{'transactions':[{'transaction-id':'1','payload':''}]}}".replaceAll("'", "\""));
when(restExecutor.execute(any(Transaction.class), eq(localCtx))).thenReturn(map);
String flowSequence = flowSequenceGenerator.getFlowSequence(inParams, ctx, localCtx);
- Assert.assertEquals("{'dummy-json-object':'some-param'}".replaceAll("'", "\""), flowSequence);
+ //Assert.assertEquals("{'dummy-json-object':'some-param'}".replaceAll("'", "\""), flowSequence);
+ Assert.assertEquals("{'transactions':[{'transaction-id':'1','payload':''}]}".replaceAll("'", "\""), flowSequence);
+ }
+
+ @Test
+ public void sequence_type_is_runtime_but_no_transactions_generated() throws Exception {
+ when(localCtx.getAttribute(SEQUENCE_TYPE)).thenReturn(RUNTIME);
+ when(ctx.getAttribute(VNF_TYPE)).thenReturn("some-vnf-type");
+ when(ctx.getAttribute(VNF_ID)).thenReturn("some-vnf-id");
+
+ Map<String, String> map = new HashMap<>();
+ // {"status":{"code":450,"message":"Request is not supported"}}
+ map.put("restResponse", "{'output':{'status':{'code':450,'message':'Request is not supported'}}}".replaceAll("'", "\""));
+ when(restExecutor.execute(any(Transaction.class), eq(localCtx))).thenReturn(map);
+ expectedException.expectMessage("No transactions were generated for this request");
+
+ String flowSequence = flowSequenceGenerator.getFlowSequence(inParams, ctx, localCtx);
}
@Test