aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csarbin32098 -> 4622 bytes
-rw-r--r--test/csit/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csarbin32098 -> 4622 bytes
-rw-r--r--test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csarbin4600 -> 4622 bytes
-rw-r--r--test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/WebhookDefinition.java5
-rw-r--r--test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/Webhooks.java45
5 files changed, 41 insertions, 9 deletions
diff --git a/test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar b/test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar
index 29e08c162..0960b20aa 100644
--- a/test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar
+++ b/test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar
Binary files differ
diff --git a/test/csit/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar b/test/csit/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar
index 29e08c162..0960b20aa 100644
--- a/test/csit/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar
+++ b/test/csit/plans/vnfsdk-refrepo/sanity-check/enterprise2DC.csar
Binary files differ
diff --git a/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar b/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar
index f18d52d60..0960b20aa 100644
--- a/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar
+++ b/test/csit/tests/vnfsdk-marketplace/provision/enterprise2DC.csar
Binary files differ
diff --git a/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/WebhookDefinition.java b/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/WebhookDefinition.java
index 60592b3f0..304971572 100644
--- a/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/WebhookDefinition.java
+++ b/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/WebhookDefinition.java
@@ -74,6 +74,11 @@ public class WebhookDefinition {
return body.isBinary() ? null : body.asString();
}
+ public String getBase64BodyAsString() {
+ return body.asString();
+ }
+
+
@JsonIgnore
public byte[] getBinaryBody() {
return body.asBytes();
diff --git a/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/Webhooks.java b/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/Webhooks.java
index e1e172668..78fb735d2 100644
--- a/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/Webhooks.java
+++ b/test/mocks/sniroemulator/src/main/java/org/onap/integration/test/mocks/sniroemulator/extension/Webhooks.java
@@ -51,6 +51,9 @@ public class Webhooks extends PostServeAction {
private final ScheduledExecutorService scheduler;
private final HttpClient httpClient;
+ private String tunnelResourceId = "NONE";
+ private String brgResourceId = "NONE";
+ private String vgResourceId = "NONE";
public Webhooks() {
scheduler = Executors.newScheduledThreadPool(10);
@@ -73,14 +76,37 @@ public class Webhooks extends PostServeAction {
@Override
public void run() {
JsonNode node = Json.node(serveEvent.getRequest().getBodyAsString());
+ // set callback url from SO request
String callBackUrl = node.get("requestInfo").get("callbackUrl").asText();
notifier.info("!!! Call Back Url : \n" + callBackUrl);
definition.withUrl(callBackUrl);
+
+ // set servicesResourceIds for each resource from SO request placement Demand
+ //System.out.println ("PI: \n" + node.textValue());
+ JsonNode placementDemandList = node.get("placementInfo").get("demandInfo").get("placementDemand");
+ if (placementDemandList !=null && placementDemandList.isArray()){
+ for (int i=0;i<placementDemandList.size();i++){
+ JsonNode resourceInfo = placementDemandList.get(i);
+ String resourceModuleName = resourceInfo.get("resourceModuleName").asText();
+ if (resourceModuleName.toLowerCase().matches("(.*)tunnel(.*)")){
+ tunnelResourceId = resourceInfo.get("serviceResourceId").asText();
+ } else if (resourceModuleName.toLowerCase().matches("(.*)brg(.*)")) {
+ brgResourceId = resourceInfo.get("serviceResourceId").asText();
+ }else {
+ vgResourceId = resourceInfo.get("serviceResourceId").asText();
+ }
+ }
+ }
+
+ String stubbedBodyStr = definition.getBase64BodyAsString();
+ String newBodyStr = stubbedBodyStr.replace("TUNNEL-RESOURCE-ID-REPLACE",tunnelResourceId).replace("VGW-RESOURCE-ID-REPLACE",vgResourceId).replace("BRG-RESOURCE-ID-REPLACE",brgResourceId);
+
+ definition.withBody(newBodyStr);
+ notifier.info("SNIRO Async Callback response:\n" + definition.getBody());
+
HttpUriRequest request = buildRequest(definition);
try {
- // notifier.info("This is a request: \n" + Json.prettyPrint(serveEvent.getRequest().getBodyAsString()));
-
HttpResponse response = httpClient.execute(request);
notifier.info(
String.format("Webhook %s request to %s returned status %s\n\n%s",
@@ -90,13 +116,13 @@ public class Webhooks extends PostServeAction {
EntityUtils.toString(response.getEntity())
)
);
- System.out.println(String.format("Webhook %s request to %s returned status %s\n\n%s",
- definition.getMethod(),
- definition.getUrl(),
- response.getStatusLine(),
- EntityUtils.toString(response.getEntity())
- )
- );
+ //System.out.println(String.format("Webhook %s request to %s returned status %s\n\n%s",
+ // definition.getMethod(),
+ // definition.getUrl(),
+ // response.getStatusLine(),
+ // EntityUtils.toString(response.getEntity())
+ // )
+ //);
} catch (IOException e) {
e.printStackTrace();
throwUnchecked(e);
@@ -114,6 +140,7 @@ public class Webhooks extends PostServeAction {
definition.getUrl().toString()
);
+
for (HttpHeader header: definition.getHeaders().all()) {
request.addHeader(header.key(), header.firstValue());
}