summaryrefslogtreecommitdiffstats
path: root/restapi-call-node/provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'restapi-call-node/provider/src/test')
-rw-r--r--restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestRestapiCallNode.java55
-rw-r--r--restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestXmlJsonUtil.java2
-rw-r--r--restapi-call-node/provider/src/test/resources/sdwan-site.json10
-rw-r--r--restapi-call-node/provider/src/test/resources/sdwan-vpn-topology.json23
4 files changed, 89 insertions, 1 deletions
diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestRestapiCallNode.java
index 5c6c4e279..4008c56c7 100644
--- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestRestapiCallNode.java
+++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestRestapiCallNode.java
@@ -52,6 +52,61 @@ public class TestRestapiCallNode {
}
@Test
+ public void testJsonSdwanVpnTopologyTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ ctx.setAttribute("prop.topology", "topoType");
+
+ ctx.setAttribute("prop.roles_length", "1");
+ ctx.setAttribute("prop.roles[0]", "role1");
+
+ ctx.setAttribute("prop.siteAttachement_length", "2");
+
+ ctx.setAttribute("prop.siteAttachement[0].siteId", "site1");
+ ctx.setAttribute("prop.siteAttachement[0].roles_length", "0");
+ ctx.setAttribute("prop.siteAttachement[0].roles[0]", "role1");
+ ctx.setAttribute("prop.siteAttachement[0].roles[1]", "role3");
+
+ ctx.setAttribute("prop.siteAttachement[1].siteId", "site2");
+ ctx.setAttribute("prop.siteAttachement[1].roles_length", "1");
+ ctx.setAttribute("prop.siteAttachement[1].roles[0]", "role2");
+
+ Map<String, String> p = new HashMap<String, String>();
+ p.put("templateFileName", "src/test/resources/sdwan-vpn-topology.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
+ public void testJsonSdwanSiteTemplate() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ ctx.setAttribute("prop.name", "site1");
+
+
+ Map<String, String> p = new HashMap<String, String>();
+ p.put("templateFileName", "src/test/resources/sdwan-site.json");
+ p.put("restapiUrl", "http://echo.getpostman.com");
+ p.put("restapiUser", "user1");
+ p.put("restapiPassword", "abc123");
+ p.put("format", "json");
+ p.put("httpMethod", "post");
+ p.put("responsePrefix", "response");
+ p.put("skipSending", "true");
+
+ RestapiCallNode rcn = new RestapiCallNode();
+ rcn.sendRequest(p, ctx);
+ }
+
+ @Test
public void testJsonTemplate() throws SvcLogicException {
SvcLogicContext ctx = new SvcLogicContext();
ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3");
diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestXmlJsonUtil.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestXmlJsonUtil.java
index bd9ff1c98..31fa2f9f9 100644
--- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestXmlJsonUtil.java
+++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/sshapicall/TestXmlJsonUtil.java
@@ -254,7 +254,7 @@ public class TestXmlJsonUtil {
"}\r\n" +
"";
- String xmlout = XmlJsonUtil.removeEmptyStructJson(xmlin);
+ String xmlout = XmlJsonUtil.removeEmptyStructJson(null, xmlin);
log.info(xmlout);
Assert.assertEquals(xmloutexpected, xmlout);
diff --git a/restapi-call-node/provider/src/test/resources/sdwan-site.json b/restapi-call-node/provider/src/test/resources/sdwan-site.json
new file mode 100644
index 000000000..238ec7642
--- /dev/null
+++ b/restapi-call-node/provider/src/test/resources/sdwan-site.json
@@ -0,0 +1,10 @@
+{
+ "sites": [
+ {
+ "name": ${prop.name},
+ "controlPoints": []
+ }
+ ]
+}
+
+
diff --git a/restapi-call-node/provider/src/test/resources/sdwan-vpn-topology.json b/restapi-call-node/provider/src/test/resources/sdwan-vpn-topology.json
new file mode 100644
index 000000000..4260d2fc1
--- /dev/null
+++ b/restapi-call-node/provider/src/test/resources/sdwan-vpn-topology.json
@@ -0,0 +1,23 @@
+{
+ "vpnId": ${prop.vpn1Id},
+ "areas": [
+ {
+ "name": "area1",
+ "areaType": "leaf",
+ "topologyType": ${prop.topology},
+ "siteAttachements": [${repeat:prop.siteAttachement_length:
+ {
+ "siteId": ${prop.siteAttachement[${1}].siteId},
+ "role": [${repeat:prop.siteAttachement[${1}].roles_length:
+ ${prop.siteAttachement[${1}].roles[${2}]},
+ }
+ ],
+ "workMode": "with-interconnection",
+ "sitePriority": "active",
+ "borders": "null"
+ },
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file