From 15690ba3b20215498ae05fb77fc9bd113a233f05 Mon Sep 17 00:00:00 2001 From: Geora Barsky Date: Thu, 2 Nov 2017 00:57:47 -0400 Subject: Sniro Emulator - Fix SO CallBack with Resource IDs Modify SNIRO emulator to pick up serviceResourceId from SO request Change-Id: Ib0bc23cb87ed5e49bb0dde351661527c404199bc JIRA-ID: INT-317 Signed-off-by: Geora Barsky --- .../sniroemulator/extension/WebhookDefinition.java | 5 +++ .../mocks/sniroemulator/extension/Webhooks.java | 45 +++++++++++++++++----- 2 files changed, 41 insertions(+), 9 deletions(-) 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