2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
 
   7  * ================================================================================
 
   8  * Licensed under the Apache License, Version 2.0 (the "License");
 
   9  * you may not use this file except in compliance with the License.
 
  10  * You may obtain a copy of the License at
 
  12  *      http://www.apache.org/licenses/LICENSE-2.0
 
  14  * Unless required by applicable law or agreed to in writing, software
 
  15  * distributed under the License is distributed on an "AS IS" BASIS,
 
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  17  * See the License for the specific language governing permissions and
 
  18  * limitations under the License.
 
  19  * ============LICENSE_END=========================================================
 
  22 package jtest.org.onap.ccsdk.sli.plugins.restapicall;
 
  24 import java.util.HashMap;
 
  27 import org.junit.Test;
 
  28 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 
  29 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 
  30 import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode;
 
  31 import org.slf4j.Logger;
 
  32 import org.slf4j.LoggerFactory;
 
  34 public class TestRestapiCallNode {
 
  36     private static final Logger log = LoggerFactory.getLogger(TestRestapiCallNode.class);
 
  40     public void testDelete() throws SvcLogicException {
 
  41         SvcLogicContext ctx = new SvcLogicContext();
 
  43         Map<String, String> p = new HashMap<String, String>();
 
  44         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
  45         p.put("restapiUser", "user1");
 
  46         p.put("restapiPassword", "pwd1");
 
  47         p.put("httpMethod", "delete");
 
  48         p.put("skipSending", "true");
 
  50         RestapiCallNode rcn = new RestapiCallNode();
 
  51         rcn.sendRequest(p, ctx);
 
  55     public void testJsonSdwanVpnTopologyTemplate() throws SvcLogicException {
 
  56         SvcLogicContext ctx = new SvcLogicContext();
 
  58         ctx.setAttribute("prop.topology", "topoType");
 
  60         ctx.setAttribute("prop.roles_length", "1");
 
  61         ctx.setAttribute("prop.roles[0]", "role1");
 
  63         ctx.setAttribute("prop.siteAttachement_length", "2");
 
  65         ctx.setAttribute("prop.siteAttachement[0].siteId", "site1");
 
  66         ctx.setAttribute("prop.siteAttachement[0].roles_length", "0");
 
  67         ctx.setAttribute("prop.siteAttachement[0].roles[0]", "role1");
 
  68         ctx.setAttribute("prop.siteAttachement[0].roles[1]", "role3");
 
  70         ctx.setAttribute("prop.siteAttachement[1].siteId", "site2");
 
  71         ctx.setAttribute("prop.siteAttachement[1].roles_length", "1");
 
  72         ctx.setAttribute("prop.siteAttachement[1].roles[0]", "role2");
 
  74         Map<String, String> p = new HashMap<String, String>();
 
  75         p.put("templateFileName", "src/test/resources/sdwan-vpn-topology.json");
 
  76         p.put("restapiUrl", "http://echo.getpostman.com");
 
  77         p.put("restapiUser", "user1");
 
  78         p.put("restapiPassword", "abc123");
 
  79         p.put("format", "json");
 
  80         p.put("httpMethod", "post");
 
  81         p.put("responsePrefix", "response");
 
  82         p.put("skipSending", "true");
 
  84         RestapiCallNode rcn = new RestapiCallNode();
 
  85         rcn.sendRequest(p, ctx);
 
  89     public void testJsonSdwanSiteTemplate() throws SvcLogicException {
 
  90         SvcLogicContext ctx = new SvcLogicContext();
 
  92         ctx.setAttribute("prop.name", "site1");
 
  95         Map<String, String> p = new HashMap<String, String>();
 
  96         p.put("templateFileName", "src/test/resources/sdwan-site.json");
 
  97         p.put("restapiUrl", "http://echo.getpostman.com");
 
  98         p.put("restapiUser", "user1");
 
  99         p.put("restapiPassword", "abc123");
 
 100         p.put("format", "json");
 
 101         p.put("httpMethod", "post");
 
 102         p.put("responsePrefix", "response");
 
 103         p.put("skipSending", "true");
 
 105         RestapiCallNode rcn = new RestapiCallNode();
 
 106         rcn.sendRequest(p, ctx);
 
 110     public void testJsonTemplate() throws SvcLogicException {
 
 111         SvcLogicContext ctx = new SvcLogicContext();
 
 112         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "3");
 
 113         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 114         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 115         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 116         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 117         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 118         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 119         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 120         ctx.setAttribute("tmp.sdn-circuit-req-row[1].source-uid", "APIDOC-123");
 
 121         ctx.setAttribute("tmp.sdn-circuit-req-row[1].action", "delete");
 
 122         ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-timestamp", "2016-09-09 16:30:35.0");
 
 123         ctx.setAttribute("tmp.sdn-circuit-req-row[1].request-status", "New");
 
 124         ctx.setAttribute("tmp.sdn-circuit-req-row[1].processing-status", "New");
 
 125         ctx.setAttribute("tmp.sdn-circuit-req-row[1].service-clfi", "testClfi1");
 
 126         ctx.setAttribute("tmp.sdn-circuit-req-row[1].clci", "clci");
 
 127         ctx.setAttribute("tmp.sdn-circuit-req-row[2].source-uid", "APIDOC-123");
 
 128         ctx.setAttribute("tmp.sdn-circuit-req-row[2].action", "delete");
 
 129         ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-timestamp", "2016-09-09 16:30:35.0");
 
 130         ctx.setAttribute("tmp.sdn-circuit-req-row[2].request-status", "New");
 
 131         ctx.setAttribute("tmp.sdn-circuit-req-row[2].processing-status", "New");
 
 132         ctx.setAttribute("tmp.sdn-circuit-req-row[2].service-clfi", "testClfi1");
 
 133         ctx.setAttribute("tmp.sdn-circuit-req-row[2].clci", "clci");
 
 135         Map<String, String> p = new HashMap<String, String>();
 
 136         p.put("templateFileName", "src/test/resources/test-template.json");
 
 137         p.put("restapiUrl", "http://echo.getpostman.com");
 
 138         p.put("restapiUser", "user1");
 
 139         p.put("restapiPassword", "abc123");
 
 140         p.put("format", "json");
 
 141         p.put("httpMethod", "post");
 
 142         p.put("responsePrefix", "response");
 
 143         p.put("skipSending", "true");
 
 145         RestapiCallNode rcn = new RestapiCallNode();
 
 146         rcn.sendRequest(p, ctx);
 
 150     public void testInvalidRepeatTimes() throws SvcLogicException {
 
 151         SvcLogicContext ctx = new SvcLogicContext();
 
 152         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "a");
 
 153         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 154         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 155         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 156         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 157         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 158         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 159         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 161         Map<String, String> p = new HashMap<String, String>();
 
 162         p.put("templateFileName", "src/test/resources/test-template.json");
 
 163         p.put("restapiUrl", "http://echo.getpostman.com");
 
 164         p.put("restapiUser", "user1");
 
 165         p.put("restapiPassword", "abc123");
 
 166         p.put("format", "json");
 
 167         p.put("httpMethod", "post");
 
 168         p.put("responsePrefix", "response");
 
 169         p.put("skipSending", "true");
 
 171         RestapiCallNode rcn = new RestapiCallNode();
 
 172         rcn.sendRequest(p, ctx);
 
 175     @Test(expected = SvcLogicException.class)
 
 176     public void testInvalidTemplatePath() throws SvcLogicException {
 
 177         SvcLogicContext ctx = new SvcLogicContext();
 
 178         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
 
 179         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 180         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 181         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 182         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 183         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 184         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 185         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 187         Map<String, String> p = new HashMap<String, String>();
 
 188         p.put("templateFileName", "src/test/resourcess/test-template.json");
 
 189         p.put("restapiUrl", "http://echo.getpostman.com");
 
 190         p.put("restapiUser", "user1");
 
 191         p.put("restapiPassword", "abc123");
 
 192         p.put("format", "json");
 
 193         p.put("httpMethod", "post");
 
 194         p.put("responsePrefix", "response");
 
 195         p.put("skipSending", "true");
 
 197         RestapiCallNode rcn = new RestapiCallNode();
 
 198         rcn.sendRequest(p, ctx);
 
 201     @Test(expected = SvcLogicException.class)
 
 202     public void testWithoutSkipSending() throws SvcLogicException {
 
 203         SvcLogicContext ctx = new SvcLogicContext();
 
 204         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
 
 205         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 206         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 207         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 208         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 209         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 210         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 211         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 213         Map<String, String> p = new HashMap<String, String>();
 
 214         p.put("templateFileName", "src/test/resources/test-template.json");
 
 215         p.put("restapiUrl", "http://echo.getpostman.com");
 
 216         p.put("restapiUser", "user1");
 
 217         p.put("restapiPassword", "abc123");
 
 218         p.put("format", "json");
 
 219         p.put("httpMethod", "post");
 
 220         p.put("responsePrefix", "response");
 
 221         p.put("skipSending", "false");
 
 223         RestapiCallNode rcn = new RestapiCallNode();
 
 224         rcn.sendRequest(p, ctx);
 
 227     @Test(expected = SvcLogicException.class)
 
 228     public void testFormData() throws SvcLogicException {
 
 229         SvcLogicContext ctx = new SvcLogicContext();
 
 230         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
 
 231         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 232         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 233         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 234         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 235         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 236         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 237         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 239         Map<String, String> p = new HashMap<String, String>();
 
 240         p.put("templateFileName", "src/test/resources/test-template.json");
 
 241         p.put("restapiUrl", "http://echo.getpostman.com");
 
 242         p.put("restapiUser", "user1");
 
 243         p.put("restapiPassword", "abc123");
 
 244         p.put("format", "json");
 
 245         p.put("httpMethod", "post");
 
 246         p.put("responsePrefix", "response");
 
 247         p.put("skipSending", "false");
 
 248         p.put("multipartFormData", "true");
 
 249         p.put("multipartFile", "src/test/resources/test-template.json");
 
 251         RestapiCallNode rcn = new RestapiCallNode();
 
 252         rcn.sendRequest(p, ctx);
 
 255     @Test(expected = SvcLogicException.class)
 
 256     public void testWithInvalidURI() throws SvcLogicException {
 
 257         SvcLogicContext ctx = new SvcLogicContext();
 
 258         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
 
 259         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 260         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 261         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 262         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 263         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 264         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 265         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 267         Map<String, String> p = new HashMap<String, String>();
 
 268         p.put("templateFileName", "src/test/resources/test-template.json");
 
 269         p.put("restapiUrl", "http://echo.  getpostman.com");
 
 270         p.put("restapiUser", "user1");
 
 271         p.put("restapiPassword", "abc123");
 
 272         p.put("format", "json");
 
 273         p.put("httpMethod", "post");
 
 274         p.put("responsePrefix", "response");
 
 275         p.put("skipSending", "false");
 
 277         RestapiCallNode rcn = new RestapiCallNode();
 
 278         rcn.sendRequest(p, ctx);
 
 282     public void testVpnJsonTemplate() throws SvcLogicException {
 
 283         SvcLogicContext ctx = new SvcLogicContext();
 
 284         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 285         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 287         Map<String, String> p = new HashMap<String, String>();
 
 288         p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
 
 289         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services");
 
 290         p.put("restapiUser", "admin");
 
 291         p.put("restapiPassword", "admin123");
 
 292         p.put("format", "json");
 
 293         p.put("httpMethod", "post");
 
 294         p.put("responsePrefix", "restapi-result");
 
 295         p.put("skipSending", "true");
 
 297         RestapiCallNode rcn = new RestapiCallNode();
 
 298         rcn.sendRequest(p, ctx);
 
 302     public void testSiteJsonTemplate() throws SvcLogicException {
 
 303         SvcLogicContext ctx = new SvcLogicContext();
 
 304         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 305         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 307         ctx.setAttribute("prop.l3vpn.site1_name", "10000000-0000-0000-0000-000000000002");
 
 308         ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003");
 
 309         ctx.setAttribute("prop.l3vpn.entry1-id", "1");
 
 310         ctx.setAttribute("prop.l3vpn.sna1_name", "10000000-0000-0000-0000-000000000004");
 
 311         ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e");
 
 312         ctx.setAttribute("prop.l3vpn.ac1_id", "a8098c1a-f86e-11da-bd1a-00112444be1b");
 
 313         ctx.setAttribute("prop.l3vpn.ac1-peer-ip", "192.168.1.1");
 
 314         ctx.setAttribute("prop.l3vpn.ac1-ip", "192.168.1.2");
 
 315         ctx.setAttribute("prop.l3vpn.sna1_svlan", "100");
 
 316         ctx.setAttribute("prop.l3vpn.ac1_protocol", "static");
 
 317         ctx.setAttribute("prop.l3vpn.sna1-route.ip-prefix", "192.168.1.1/24");
 
 318         ctx.setAttribute("prop.l3vpn.sna1-route.next-hop", "192.168.1.4");
 
 320         ctx.setAttribute("prop.l3vpn.site2_name", "10000000-0000-0000-0000-000000000005");
 
 321         ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006");
 
 322         ctx.setAttribute("prop.l3vpn.entry2-id", "1");
 
 323         ctx.setAttribute("prop.l3vpn.sna2_name", "10000000-0000-0000-0000-000000000007");
 
 324         ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a");
 
 325         ctx.setAttribute("prop.l3vpn.ac2_id", "a8098c1a-f86e-11da-bd1a-00112444be1c");
 
 326         ctx.setAttribute("prop.l3vpn.ac2-peer-ip", "192.168.1.6");
 
 327         ctx.setAttribute("prop.l3vpn.ac2-ip", "192.168.1.5");
 
 328         ctx.setAttribute("prop.l3vpn.sna2_svlan", "200");
 
 329         ctx.setAttribute("prop.l3vpn.ac2_protocol", "bgp");
 
 330         ctx.setAttribute("prop.l3vpn.peer2-ip", "192.168.1.7");
 
 331         ctx.setAttribute("prop.l3vpn.ac2_protocol_bgp_as", "200");
 
 333         Map<String, String> p = new HashMap<String, String>();
 
 334         p.put("templateFileName", "src/test/resources/l3smsitetemplate.json");
 
 335         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/sites");
 
 336         p.put("restapiUser", "admin");
 
 337         p.put("restapiPassword", "admin123");
 
 338         p.put("format", "json");
 
 339         p.put("httpMethod", "post");
 
 340         p.put("responsePrefix", "restapi-result");
 
 341         p.put("skipSending", "true");
 
 343         RestapiCallNode rcn = new RestapiCallNode();
 
 344         rcn.sendRequest(p, ctx);
 
 348     public void testVrfJsonTemplate() throws SvcLogicException {
 
 349         SvcLogicContext ctx = new SvcLogicContext();
 
 350         ctx.setAttribute("prop.l3vpn.vrf1-id", "10000000-0000-0000-0000-000000000007");
 
 351         ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003");
 
 352         ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e");
 
 353         ctx.setAttribute("prop.l3vpn.vrf2-id", "10000000-0000-0000-0000-000000000009");
 
 354         ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006");
 
 355         ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a");
 
 357         Map<String, String> p = new HashMap<String, String>();
 
 358         p.put("templateFileName", "src/test/resources/l3smvrftemplate.json");
 
 359         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vrf-attributes");
 
 360         p.put("restapiUser", "admin");
 
 361         p.put("restapiPassword", "admin123");
 
 362         p.put("format", "json");
 
 363         p.put("httpMethod", "post");
 
 364         p.put("responsePrefix", "restapi-result");
 
 365         p.put("skipSending", "true");
 
 367         RestapiCallNode rcn = new RestapiCallNode();
 
 368         rcn.sendRequest(p, ctx);
 
 372     public void testDeleteVpnJsonTemplate() throws SvcLogicException {
 
 373         SvcLogicContext ctx = new SvcLogicContext();
 
 374         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 375         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 377         Map<String, String> p = new HashMap<String, String>();
 
 378         //p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
 
 379         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services"
 
 380             + "/vpnservice=10000000-0000-0000-0000-000000000001");
 
 381         p.put("restapiUser", "admin");
 
 382         p.put("restapiPassword", "admin123");
 
 383         p.put("format", "json");
 
 384         p.put("httpMethod", "delete");
 
 385         p.put("responsePrefix", "restapi-result");
 
 386         p.put("skipSending", "true");
 
 388         RestapiCallNode rcn = new RestapiCallNode();
 
 389         rcn.sendRequest(p, ctx);
 
 393     public void testL2DciTemplate() throws SvcLogicException {
 
 394         SvcLogicContext ctx = new SvcLogicContext();
 
 395         ctx.setAttribute("prop.dci-connects.id", "Id1");
 
 396         ctx.setAttribute("prop.dci-connects.name", "Name1");
 
 397         ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1");
 
 398         ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2");
 
 399         ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1");
 
 400         ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2");
 
 401         ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1");
 
 402         ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2");
 
 403         ctx.setAttribute("prop.dci-connects.vni", "1");
 
 405         Map<String, String> p = new HashMap<String, String>();
 
 406         p.put("templateFileName", "src/test/resources/l2-dci-connects-template.json");
 
 407         p.put("restapiUrl", "http://echo.getpostman.com");
 
 408         p.put("restapiUser", "user1");
 
 409         p.put("restapiPassword", "abc123");
 
 410         p.put("format", "json");
 
 411         p.put("httpMethod", "post");
 
 412         p.put("responsePrefix", "response");
 
 413         p.put("skipSending", "true");
 
 415         RestapiCallNode rcn = new RestapiCallNode();
 
 416         rcn.sendRequest(p, ctx);
 
 420     public void testL3DciTemplate() throws SvcLogicException {
 
 421         SvcLogicContext ctx = new SvcLogicContext();
 
 422         ctx.setAttribute("prop.dci-connects.id", "Id1");
 
 423         ctx.setAttribute("prop.dci-connects.name", "Name1");
 
 424         ctx.setAttribute("prop.dci-connects.local_networks_length", "2");
 
 425         ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1");
 
 426         ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2");
 
 427         ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1");
 
 428         ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2");
 
 429         ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1");
 
 430         ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2");
 
 431         ctx.setAttribute("prop.dci-connects.vni", "1");
 
 433         Map<String, String> p = new HashMap<String, String>();
 
 434         p.put("templateFileName", "src/test/resources/l3-dci-connects-template.json");
 
 435         p.put("restapiUrl", "http://echo.getpostman.com");
 
 436         p.put("restapiUser", "user1");
 
 437         p.put("restapiPassword", "abc123");
 
 438         p.put("format", "json");
 
 439         p.put("httpMethod", "post");
 
 440         p.put("responsePrefix", "response");
 
 441         p.put("skipSending", "true");
 
 443         RestapiCallNode rcn = new RestapiCallNode();
 
 444         rcn.sendRequest(p, ctx);
 
 449     public void testControllerTokenTemplate() throws SvcLogicException {
 
 450         SvcLogicContext ctx = new SvcLogicContext();
 
 451         ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.user", "admin");
 
 452         ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.password", "admin123");
 
 454         Map<String, String> p = new HashMap<String, String>();
 
 455         p.put("templateFileName", "src/test/resources/actokentemplate.json");
 
 456         p.put("restapiUrl", "https://ipwan:18002/controller/v2/tokens");
 
 457         p.put("format", "json");
 
 458         p.put("httpMethod", "post");
 
 459         p.put("responsePrefix", "restapi-result");
 
 460         p.put("skipSending", "true");
 
 462         RestapiCallNode rcn = new RestapiCallNode();
 
 463         rcn.sendRequest(p, ctx);
 
 468     public void testDeleteNoneAsContentType() throws SvcLogicException {
 
 469         SvcLogicContext ctx = new SvcLogicContext();
 
 471         Map<String, String> p = new HashMap<String, String>();
 
 472         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 473         p.put("restapiUser", "user1");
 
 474         p.put("restapiPassword", "pwd1");
 
 475         p.put("httpMethod", "delete");
 
 476         p.put("format", "none");
 
 477         p.put("skipSending", "true");
 
 479         RestapiCallNode rcn = new RestapiCallNode();
 
 480         rcn.sendRequest(p, ctx);
 
 484     public void testPostNoneAsContentType() throws SvcLogicException {
 
 485         SvcLogicContext ctx = new SvcLogicContext();
 
 486         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 487         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 489         Map<String, String> p = new HashMap<String, String>();
 
 490         p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
 
 491         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services");
 
 492         p.put("restapiUser", "admin");
 
 493         p.put("restapiPassword", "admin123");
 
 494         p.put("format", "none");
 
 495         p.put("httpMethod", "post");
 
 496         p.put("responsePrefix", "restapi-result");
 
 497         p.put("skipSending", "true");
 
 499         RestapiCallNode rcn = new RestapiCallNode();
 
 500         rcn.sendRequest(p, ctx);
 
 504     public void testDeleteOAuthType() throws SvcLogicException {
 
 505         SvcLogicContext ctx = new SvcLogicContext();
 
 507         Map<String, String> p = new HashMap<String, String>();
 
 508         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 509         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 510         p.put("oAuthConsumerSecret", "secret");
 
 511         p.put("oAuthSignatureMethod", "plainTEXT");
 
 512         p.put("oAuthVersion", "1.0");
 
 513         p.put("httpMethod", "delete");
 
 514         p.put("format", "none");
 
 515         p.put("skipSending", "true");
 
 517         RestapiCallNode rcn = new RestapiCallNode();
 
 518         rcn.sendRequest(p, ctx);
 
 522     public void testDeleteAuthTypeBasic() throws SvcLogicException {
 
 523         SvcLogicContext ctx = new SvcLogicContext();
 
 525         Map<String, String> p = new HashMap<String, String>();
 
 526         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 527         p.put("authType", "basic");
 
 528         p.put("restapiUser", "admin");
 
 529         p.put("restapiPassword", "admin123");
 
 530         p.put("httpMethod", "delete");
 
 531         p.put("format", "none");
 
 532         p.put("skipSending", "true");
 
 534         RestapiCallNode rcn = new RestapiCallNode();
 
 535         rcn.sendRequest(p, ctx);
 
 539     public void testDeleteAuthTypeDigest() throws SvcLogicException {
 
 540         SvcLogicContext ctx = new SvcLogicContext();
 
 542         Map<String, String> p = new HashMap<String, String>();
 
 543         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 544         p.put("authType", "digest");
 
 545         p.put("restapiUser", "admin");
 
 546         p.put("restapiPassword", "admin123");
 
 547         p.put("httpMethod", "delete");
 
 548         p.put("format", "none");
 
 549         p.put("skipSending", "true");
 
 551         RestapiCallNode rcn = new RestapiCallNode();
 
 552         rcn.sendRequest(p, ctx);
 
 556     public void testDeleteAuthTypeOAuth() throws SvcLogicException {
 
 557         SvcLogicContext ctx = new SvcLogicContext();
 
 559         Map<String, String> p = new HashMap<String, String>();
 
 560         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 561         p.put("authType", "oauth");
 
 562         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 563         p.put("oAuthConsumerSecret", "secret");
 
 564         p.put("oAuthSignatureMethod", "plainTEXT");
 
 565         p.put("oAuthVersion", "1.0");
 
 566         p.put("httpMethod", "delete");
 
 567         p.put("format", "none");
 
 568         p.put("skipSending", "true");
 
 570         RestapiCallNode rcn = new RestapiCallNode();
 
 571         rcn.sendRequest(p, ctx);
 
 575     public void testDeleteAuthTypeNoneOAuth() throws SvcLogicException {
 
 576         SvcLogicContext ctx = new SvcLogicContext();
 
 578         Map<String, String> p = new HashMap<String, String>();
 
 579         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 580         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 581         p.put("oAuthConsumerSecret", "secret");
 
 582         p.put("oAuthSignatureMethod", "plainTEXT");
 
 583         p.put("oAuthVersion", "1.0");
 
 584         p.put("httpMethod", "delete");
 
 585         p.put("format", "none");
 
 586         p.put("skipSending", "true");
 
 588         RestapiCallNode rcn = new RestapiCallNode();
 
 589         rcn.sendRequest(p, ctx);
 
 592     public void testDeleteAuthTypeNoneBasic() throws SvcLogicException {
 
 593         SvcLogicContext ctx = new SvcLogicContext();
 
 595         Map<String, String> p = new HashMap<String, String>();
 
 596         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 597         p.put("restapiUser", "admin");
 
 598         p.put("restapiPassword", "admin123");
 
 599         p.put("httpMethod", "delete");
 
 600         p.put("format", "none");
 
 601         p.put("skipSending", "true");
 
 603         RestapiCallNode rcn = new RestapiCallNode();
 
 604         rcn.sendRequest(p, ctx);
 
 607     @Test(expected = SvcLogicException.class)
 
 608     public void testInvalidDeleteAuthTypeOAuth() throws SvcLogicException {
 
 609         SvcLogicContext ctx = new SvcLogicContext();
 
 611         Map<String, String> p = new HashMap<String, String>();
 
 612         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 613         p.put("authType", "oauth");
 
 614         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 615         p.put("oAuthConsumerSecret", "secret");
 
 616         p.put("httpMethod", "delete");
 
 617         p.put("format", "none");
 
 618         p.put("skipSending", "true");
 
 620         RestapiCallNode rcn = new RestapiCallNode();
 
 621         rcn.sendRequest(p, ctx);
 
 624     @Test(expected = SvcLogicException.class)
 
 625     public void testInvalidDeleteAuthTypeBasic() throws SvcLogicException {
 
 626         SvcLogicContext ctx = new SvcLogicContext();
 
 628         Map<String, String> p = new HashMap<String, String>();
 
 629         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 630         p.put("authType", "basic");
 
 631         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 632         p.put("oAuthConsumerSecret", "secret");
 
 633         p.put("httpMethod", "delete");
 
 634         p.put("format", "none");
 
 635         p.put("skipSending", "true");
 
 637         RestapiCallNode rcn = new RestapiCallNode();
 
 638         rcn.sendRequest(p, ctx);
 
 641     @Test(expected = SvcLogicException.class)
 
 642     public void testInvalidDeleteAuthTypeDigest() throws SvcLogicException {
 
 643         SvcLogicContext ctx = new SvcLogicContext();
 
 645         Map<String, String> p = new HashMap<String, String>();
 
 646         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 647         p.put("authType", "digest");
 
 648         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 649         p.put("oAuthConsumerSecret", "secret");
 
 650         p.put("httpMethod", "delete");
 
 651         p.put("format", "none");
 
 652         p.put("skipSending", "true");
 
 654         RestapiCallNode rcn = new RestapiCallNode();
 
 655         rcn.sendRequest(p, ctx);