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.sshapicall;
 
  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);
 
 228     @Test(expected = SvcLogicException.class)
 
 229     public void testWithInvalidURI() throws SvcLogicException {
 
 230         SvcLogicContext ctx = new SvcLogicContext();
 
 231         ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
 
 232         ctx.setAttribute("tmp.sdn-circuit-req-row[0].source-uid", "APIDOC-123");
 
 233         ctx.setAttribute("tmp.sdn-circuit-req-row[0].action", "delete");
 
 234         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-timestamp", "2016-09-09 16:30:35.0");
 
 235         ctx.setAttribute("tmp.sdn-circuit-req-row[0].request-status", "New");
 
 236         ctx.setAttribute("tmp.sdn-circuit-req-row[0].processing-status", "New");
 
 237         ctx.setAttribute("tmp.sdn-circuit-req-row[0].service-clfi", "testClfi1");
 
 238         ctx.setAttribute("tmp.sdn-circuit-req-row[0].clci", "clci");
 
 240         Map<String, String> p = new HashMap<String, String>();
 
 241         p.put("templateFileName", "src/test/resources/test-template.json");
 
 242         p.put("restapiUrl", "http://echo.  getpostman.com");
 
 243         p.put("restapiUser", "user1");
 
 244         p.put("restapiPassword", "abc123");
 
 245         p.put("format", "json");
 
 246         p.put("httpMethod", "post");
 
 247         p.put("responsePrefix", "response");
 
 248         p.put("skipSending", "false");
 
 250         RestapiCallNode rcn = new RestapiCallNode();
 
 251         rcn.sendRequest(p, ctx);
 
 255     public void testVpnJsonTemplate() throws SvcLogicException {
 
 256         SvcLogicContext ctx = new SvcLogicContext();
 
 257         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 258         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 260         Map<String, String> p = new HashMap<String, String>();
 
 261         p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
 
 262         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services");
 
 263         p.put("restapiUser", "admin");
 
 264         p.put("restapiPassword", "admin123");
 
 265         p.put("format", "json");
 
 266         p.put("httpMethod", "post");
 
 267         p.put("responsePrefix", "restapi-result");
 
 268         p.put("skipSending", "true");
 
 270         RestapiCallNode rcn = new RestapiCallNode();
 
 271         rcn.sendRequest(p, ctx);
 
 275     public void testSiteJsonTemplate() throws SvcLogicException {
 
 276         SvcLogicContext ctx = new SvcLogicContext();
 
 277         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 278         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 280         ctx.setAttribute("prop.l3vpn.site1_name", "10000000-0000-0000-0000-000000000002");
 
 281         ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003");
 
 282         ctx.setAttribute("prop.l3vpn.entry1-id", "1");
 
 283         ctx.setAttribute("prop.l3vpn.sna1_name", "10000000-0000-0000-0000-000000000004");
 
 284         ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e");
 
 285         ctx.setAttribute("prop.l3vpn.ac1_id", "a8098c1a-f86e-11da-bd1a-00112444be1b");
 
 286         ctx.setAttribute("prop.l3vpn.ac1-peer-ip", "192.168.1.1");
 
 287         ctx.setAttribute("prop.l3vpn.ac1-ip", "192.168.1.2");
 
 288         ctx.setAttribute("prop.l3vpn.sna1_svlan", "100");
 
 289         ctx.setAttribute("prop.l3vpn.ac1_protocol", "static");
 
 290         ctx.setAttribute("prop.l3vpn.sna1-route.ip-prefix", "192.168.1.1/24");
 
 291         ctx.setAttribute("prop.l3vpn.sna1-route.next-hop", "192.168.1.4");
 
 293         ctx.setAttribute("prop.l3vpn.site2_name", "10000000-0000-0000-0000-000000000005");
 
 294         ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006");
 
 295         ctx.setAttribute("prop.l3vpn.entry2-id", "1");
 
 296         ctx.setAttribute("prop.l3vpn.sna2_name", "10000000-0000-0000-0000-000000000007");
 
 297         ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a");
 
 298         ctx.setAttribute("prop.l3vpn.ac2_id", "a8098c1a-f86e-11da-bd1a-00112444be1c");
 
 299         ctx.setAttribute("prop.l3vpn.ac2-peer-ip", "192.168.1.6");
 
 300         ctx.setAttribute("prop.l3vpn.ac2-ip", "192.168.1.5");
 
 301         ctx.setAttribute("prop.l3vpn.sna2_svlan", "200");
 
 302         ctx.setAttribute("prop.l3vpn.ac2_protocol", "bgp");
 
 303         ctx.setAttribute("prop.l3vpn.peer2-ip", "192.168.1.7");
 
 304         ctx.setAttribute("prop.l3vpn.ac2_protocol_bgp_as", "200");
 
 306         Map<String, String> p = new HashMap<String, String>();
 
 307         p.put("templateFileName", "src/test/resources/l3smsitetemplate.json");
 
 308         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/sites");
 
 309         p.put("restapiUser", "admin");
 
 310         p.put("restapiPassword", "admin123");
 
 311         p.put("format", "json");
 
 312         p.put("httpMethod", "post");
 
 313         p.put("responsePrefix", "restapi-result");
 
 314         p.put("skipSending", "true");
 
 316         RestapiCallNode rcn = new RestapiCallNode();
 
 317         rcn.sendRequest(p, ctx);
 
 321     public void testVrfJsonTemplate() throws SvcLogicException {
 
 322         SvcLogicContext ctx = new SvcLogicContext();
 
 323         ctx.setAttribute("prop.l3vpn.vrf1-id", "10000000-0000-0000-0000-000000000007");
 
 324         ctx.setAttribute("prop.l3vpn.vpn-policy1-id", "10000000-0000-0000-0000-000000000003");
 
 325         ctx.setAttribute("prop.l3vpn.pe1_id", "a8098c1a-f86e-11da-bd1a-00112444be1e");
 
 326         ctx.setAttribute("prop.l3vpn.vrf2-id", "10000000-0000-0000-0000-000000000009");
 
 327         ctx.setAttribute("prop.l3vpn.vpn-policy2-id", "10000000-0000-0000-0000-000000000006");
 
 328         ctx.setAttribute("prop.l3vpn.pe2_id", "a8098c1a-f86e-11da-bd1a-00112444be1a");
 
 330         Map<String, String> p = new HashMap<String, String>();
 
 331         p.put("templateFileName", "src/test/resources/l3smvrftemplate.json");
 
 332         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vrf-attributes");
 
 333         p.put("restapiUser", "admin");
 
 334         p.put("restapiPassword", "admin123");
 
 335         p.put("format", "json");
 
 336         p.put("httpMethod", "post");
 
 337         p.put("responsePrefix", "restapi-result");
 
 338         p.put("skipSending", "true");
 
 340         RestapiCallNode rcn = new RestapiCallNode();
 
 341         rcn.sendRequest(p, ctx);
 
 345     public void testDeleteVpnJsonTemplate() throws SvcLogicException {
 
 346         SvcLogicContext ctx = new SvcLogicContext();
 
 347         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 348         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 350         Map<String, String> p = new HashMap<String, String>();
 
 351         //p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
 
 352         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services"
 
 353             + "/vpnservice=10000000-0000-0000-0000-000000000001");
 
 354         p.put("restapiUser", "admin");
 
 355         p.put("restapiPassword", "admin123");
 
 356         p.put("format", "json");
 
 357         p.put("httpMethod", "delete");
 
 358         p.put("responsePrefix", "restapi-result");
 
 359         p.put("skipSending", "true");
 
 361         RestapiCallNode rcn = new RestapiCallNode();
 
 362         rcn.sendRequest(p, ctx);
 
 366     public void testL2DciTemplate() throws SvcLogicException {
 
 367         SvcLogicContext ctx = new SvcLogicContext();
 
 368         ctx.setAttribute("prop.dci-connects.id", "Id1");
 
 369         ctx.setAttribute("prop.dci-connects.name", "Name1");
 
 370         ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1");
 
 371         ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2");
 
 372         ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1");
 
 373         ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2");
 
 374         ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1");
 
 375         ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2");
 
 376         ctx.setAttribute("prop.dci-connects.vni", "1");
 
 378         Map<String, String> p = new HashMap<String, String>();
 
 379         p.put("templateFileName", "src/test/resources/l2-dci-connects-template.json");
 
 380         p.put("restapiUrl", "http://echo.getpostman.com");
 
 381         p.put("restapiUser", "user1");
 
 382         p.put("restapiPassword", "abc123");
 
 383         p.put("format", "json");
 
 384         p.put("httpMethod", "post");
 
 385         p.put("responsePrefix", "response");
 
 386         p.put("skipSending", "true");
 
 388         RestapiCallNode rcn = new RestapiCallNode();
 
 389         rcn.sendRequest(p, ctx);
 
 393     public void testL3DciTemplate() 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_length", "2");
 
 398         ctx.setAttribute("prop.dci-connects.local_networks[0]", "NetId1");
 
 399         ctx.setAttribute("prop.dci-connects.local_networks[1]", "NetId2");
 
 400         ctx.setAttribute("prop.dci-connects.evpn_irts[0]", "100:1");
 
 401         ctx.setAttribute("prop.dci-connects.evpn_erts[0]", "100:2");
 
 402         ctx.setAttribute("prop.dci-connects.evpn_irts[1]", "200:1");
 
 403         ctx.setAttribute("prop.dci-connects.evpn_erts[1]", "200:2");
 
 404         ctx.setAttribute("prop.dci-connects.vni", "1");
 
 406         Map<String, String> p = new HashMap<String, String>();
 
 407         p.put("templateFileName", "src/test/resources/l3-dci-connects-template.json");
 
 408         p.put("restapiUrl", "http://echo.getpostman.com");
 
 409         p.put("restapiUser", "user1");
 
 410         p.put("restapiPassword", "abc123");
 
 411         p.put("format", "json");
 
 412         p.put("httpMethod", "post");
 
 413         p.put("responsePrefix", "response");
 
 414         p.put("skipSending", "true");
 
 416         RestapiCallNode rcn = new RestapiCallNode();
 
 417         rcn.sendRequest(p, ctx);
 
 422     public void testControllerTokenTemplate() throws SvcLogicException {
 
 423         SvcLogicContext ctx = new SvcLogicContext();
 
 424         ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.user", "admin");
 
 425         ctx.setAttribute("prop.sdncRestApi.thirdpartySdnc.password", "admin123");
 
 427         Map<String, String> p = new HashMap<String, String>();
 
 428         p.put("templateFileName", "src/test/resources/actokentemplate.json");
 
 429         p.put("restapiUrl", "https://ipwan:18002/controller/v2/tokens");
 
 430         p.put("format", "json");
 
 431         p.put("httpMethod", "post");
 
 432         p.put("responsePrefix", "restapi-result");
 
 433         p.put("skipSending", "true");
 
 435         RestapiCallNode rcn = new RestapiCallNode();
 
 436         rcn.sendRequest(p, ctx);
 
 441     public void testDeleteNoneAsContentType() throws SvcLogicException {
 
 442         SvcLogicContext ctx = new SvcLogicContext();
 
 444         Map<String, String> p = new HashMap<String, String>();
 
 445         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 446         p.put("restapiUser", "user1");
 
 447         p.put("restapiPassword", "pwd1");
 
 448         p.put("httpMethod", "delete");
 
 449         p.put("format", "none");
 
 450         p.put("skipSending", "true");
 
 452         RestapiCallNode rcn = new RestapiCallNode();
 
 453         rcn.sendRequest(p, ctx);
 
 457     public void testPostNoneAsContentType() throws SvcLogicException {
 
 458         SvcLogicContext ctx = new SvcLogicContext();
 
 459         ctx.setAttribute("prop.l3vpn.name", "10000000-0000-0000-0000-000000000001");
 
 460         ctx.setAttribute("prop.l3vpn.topology", "point_to_point");
 
 462         Map<String, String> p = new HashMap<String, String>();
 
 463         p.put("templateFileName", "src/test/resources/l3smvpntemplate.json");
 
 464         p.put("restapiUrl", "http://ipwan:18002/restconf/data/huawei-ac-net-l3vpn-svc:l3vpn-svc-cfg/vpn-services");
 
 465         p.put("restapiUser", "admin");
 
 466         p.put("restapiPassword", "admin123");
 
 467         p.put("format", "none");
 
 468         p.put("httpMethod", "post");
 
 469         p.put("responsePrefix", "restapi-result");
 
 470         p.put("skipSending", "true");
 
 472         RestapiCallNode rcn = new RestapiCallNode();
 
 473         rcn.sendRequest(p, ctx);
 
 477     public void testDeleteOAuthType() throws SvcLogicException {
 
 478         SvcLogicContext ctx = new SvcLogicContext();
 
 480         Map<String, String> p = new HashMap<String, String>();
 
 481         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 482         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 483         p.put("oAuthConsumerSecret", "secret");
 
 484         p.put("oAuthSignatureMethod", "plainTEXT");
 
 485         p.put("oAuthVersion", "1.0");
 
 486         p.put("httpMethod", "delete");
 
 487         p.put("format", "none");
 
 488         p.put("skipSending", "true");
 
 490         RestapiCallNode rcn = new RestapiCallNode();
 
 491         rcn.sendRequest(p, ctx);
 
 495     public void testDeleteAuthTypeBasic() throws SvcLogicException {
 
 496         SvcLogicContext ctx = new SvcLogicContext();
 
 498         Map<String, String> p = new HashMap<String, String>();
 
 499         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 500         p.put("authType", "basic");
 
 501         p.put("restapiUser", "admin");
 
 502         p.put("restapiPassword", "admin123");
 
 503         p.put("httpMethod", "delete");
 
 504         p.put("format", "none");
 
 505         p.put("skipSending", "true");
 
 507         RestapiCallNode rcn = new RestapiCallNode();
 
 508         rcn.sendRequest(p, ctx);
 
 512     public void testDeleteAuthTypeDigest() throws SvcLogicException {
 
 513         SvcLogicContext ctx = new SvcLogicContext();
 
 515         Map<String, String> p = new HashMap<String, String>();
 
 516         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 517         p.put("authType", "digest");
 
 518         p.put("restapiUser", "admin");
 
 519         p.put("restapiPassword", "admin123");
 
 520         p.put("httpMethod", "delete");
 
 521         p.put("format", "none");
 
 522         p.put("skipSending", "true");
 
 524         RestapiCallNode rcn = new RestapiCallNode();
 
 525         rcn.sendRequest(p, ctx);
 
 529     public void testDeleteAuthTypeOAuth() throws SvcLogicException {
 
 530         SvcLogicContext ctx = new SvcLogicContext();
 
 532         Map<String, String> p = new HashMap<String, String>();
 
 533         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 534         p.put("authType", "oauth");
 
 535         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 536         p.put("oAuthConsumerSecret", "secret");
 
 537         p.put("oAuthSignatureMethod", "plainTEXT");
 
 538         p.put("oAuthVersion", "1.0");
 
 539         p.put("httpMethod", "delete");
 
 540         p.put("format", "none");
 
 541         p.put("skipSending", "true");
 
 543         RestapiCallNode rcn = new RestapiCallNode();
 
 544         rcn.sendRequest(p, ctx);
 
 548     public void testDeleteAuthTypeNoneOAuth() throws SvcLogicException {
 
 549         SvcLogicContext ctx = new SvcLogicContext();
 
 551         Map<String, String> p = new HashMap<String, String>();
 
 552         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 553         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 554         p.put("oAuthConsumerSecret", "secret");
 
 555         p.put("oAuthSignatureMethod", "plainTEXT");
 
 556         p.put("oAuthVersion", "1.0");
 
 557         p.put("httpMethod", "delete");
 
 558         p.put("format", "none");
 
 559         p.put("skipSending", "true");
 
 561         RestapiCallNode rcn = new RestapiCallNode();
 
 562         rcn.sendRequest(p, ctx);
 
 565     public void testDeleteAuthTypeNoneBasic() throws SvcLogicException {
 
 566         SvcLogicContext ctx = new SvcLogicContext();
 
 568         Map<String, String> p = new HashMap<String, String>();
 
 569         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 570         p.put("restapiUser", "admin");
 
 571         p.put("restapiPassword", "admin123");
 
 572         p.put("httpMethod", "delete");
 
 573         p.put("format", "none");
 
 574         p.put("skipSending", "true");
 
 576         RestapiCallNode rcn = new RestapiCallNode();
 
 577         rcn.sendRequest(p, ctx);
 
 580     @Test(expected = SvcLogicException.class)
 
 581     public void testInvalidDeleteAuthTypeOAuth() throws SvcLogicException {
 
 582         SvcLogicContext ctx = new SvcLogicContext();
 
 584         Map<String, String> p = new HashMap<String, String>();
 
 585         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 586         p.put("authType", "oauth");
 
 587         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 588         p.put("oAuthConsumerSecret", "secret");
 
 589         p.put("httpMethod", "delete");
 
 590         p.put("format", "none");
 
 591         p.put("skipSending", "true");
 
 593         RestapiCallNode rcn = new RestapiCallNode();
 
 594         rcn.sendRequest(p, ctx);
 
 597     @Test(expected = SvcLogicException.class)
 
 598     public void testInvalidDeleteAuthTypeBasic() throws SvcLogicException {
 
 599         SvcLogicContext ctx = new SvcLogicContext();
 
 601         Map<String, String> p = new HashMap<String, String>();
 
 602         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 603         p.put("authType", "basic");
 
 604         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 605         p.put("oAuthConsumerSecret", "secret");
 
 606         p.put("httpMethod", "delete");
 
 607         p.put("format", "none");
 
 608         p.put("skipSending", "true");
 
 610         RestapiCallNode rcn = new RestapiCallNode();
 
 611         rcn.sendRequest(p, ctx);
 
 614     @Test(expected = SvcLogicException.class)
 
 615     public void testInvalidDeleteAuthTypeDigest() throws SvcLogicException {
 
 616         SvcLogicContext ctx = new SvcLogicContext();
 
 618         Map<String, String> p = new HashMap<String, String>();
 
 619         p.put("restapiUrl", "https://echo.getpostman.com/delete");
 
 620         p.put("authType", "digest");
 
 621         p.put("oAuthConsumerKey", "f2a1ed52710d4533bde25be6da03b6e3");
 
 622         p.put("oAuthConsumerSecret", "secret");
 
 623         p.put("httpMethod", "delete");
 
 624         p.put("format", "none");
 
 625         p.put("skipSending", "true");
 
 627         RestapiCallNode rcn = new RestapiCallNode();
 
 628         rcn.sendRequest(p, ctx);