From 59f762556c4cecf8f59e780f6dd5072d85ccabfe Mon Sep 17 00:00:00 2001 From: Gaurav Agrawal Date: Thu, 28 Sep 2017 15:20:37 +0530 Subject: Added l2-dci json template and updated l3-dci Following changes are included: 1) Added l2-dci template 2) Updated l3-dci template to handle paramaters generically for l2 and l3 3) Leaf-List handling 4) Added testcases for l2 and l3 template. Change-Id: I3142ae35286ea3c55927bedf5a071aaff5b15401 Issue-Id: SDNC-103 Signed-off-by: Gaurav Agrawal --- .../plugins/restapicall/TestRestapiCallNode.java | 57 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'restapi-call-node/provider/src/test/java') diff --git a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java index 2d3b4010..1dcc97bc 100644 --- a/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java +++ b/restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java @@ -23,7 +23,6 @@ package jtest.org.onap.ccsdk.sli.plugins.restapicall; import java.util.HashMap; import java.util.Map; - import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -255,4 +254,60 @@ public class TestRestapiCallNode { RestapiCallNode rcn = new RestapiCallNode(); rcn.sendRequest(p, ctx); } + + @Test + public void testL2DciTemplate() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("prop.dci-connects.id", "Id1"); + ctx.setAttribute("prop.dci-connects.name", "Name1"); + ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1"); + ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2"); + ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1"); + ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2"); + ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1"); + ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2"); + ctx.setAttribute("prop.dci-connects.vni", "1"); + + Map p = new HashMap(); + p.put("templateFileName", "src/test/resources/l2-dci-connects-template.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 testL3DciTemplate() throws SvcLogicException { + SvcLogicContext ctx = new SvcLogicContext(); + ctx.setAttribute("prop.dci-connects.id", "Id1"); + ctx.setAttribute("prop.dci-connects.name", "Name1"); + ctx.setAttribute("prop.dci-connects.local_networks_length", "2"); + ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1"); + ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2"); + ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1"); + ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2"); + ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1"); + ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2"); + ctx.setAttribute("prop.dci-connects.vni", "1"); + + Map p = new HashMap(); + p.put("templateFileName", "src/test/resources/l3-dci-connects-template.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); + + } } -- cgit 1.2.3-korg