Merge "Update sdc test"
diff --git a/test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar b/test/csit/plans/vnfsdk-marketplace/sanity-check/enterprise2DC.csar
index 29e08c1..0960b20 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 29e08c1..0960b20 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 f18d52d..0960b20 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 60592b3..3049715 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 @@
         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 e1e1726..78fb735 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 @@
 
     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 @@
                 @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 @@
                                 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 @@
                 definition.getUrl().toString()
         );
 
+
         for (HttpHeader header: definition.getHeaders().all()) {
             request.addHeader(header.key(), header.firstValue());
         }