Merge "Added l2-dci json template and updated l3-dci"
authorDan Timoney <dtimoney@att.com>
Thu, 28 Sep 2017 10:37:17 +0000 (10:37 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 28 Sep 2017 10:37:17 +0000 (10:37 +0000)
restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json [new file with mode: 0644]
restapi-call-node/provider/src/main/resources/l3-dci-connects-template.json
restapi-call-node/provider/src/test/java/jtest/org/onap/ccsdk/sli/plugins/restapicall/TestRestapiCallNode.java
restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json [new file with mode: 0644]
restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json [new file with mode: 0644]

diff --git a/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json b/restapi-call-node/provider/src/main/resources/l2-dci-connects-template.json
new file mode 100644 (file)
index 0000000..f180756
--- /dev/null
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : SDN-C
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+{
+  "l2-dci-connect": {
+    "id": ${prop.dci-connects.id},
+    "name": ${prop.dci-connects.name},
+    "description": ${prop.dci-connects.description},
+    "network_id": ${prop.dci-connects.local_networks[0]},
+    "evpn_irts": ${prop.dci-connects.evpn_irts},
+    "evpn_erts": ${prop.dci-connects.evpn_erts},
+    "vni": ${prop.dci-connects.vni}
+  }
+}
index 3f0e203..c011b07 100644 (file)
 
 {
   "l3-dci-connect": {
-    "id": "${prop.l3-dci-connects.id}",
-    "name": "${prop.l3-dci-connects.name}",
-    "description": "${prop.l3-dci-connects.description}",
-    "router_id": "${prop.l3-dci-connects.router_id}",
+    "id": ${prop.dci-connects.id},
+    "name": ${prop.dci-connects.name},
+    "description": ${prop.dci-connects.description},
+    "router_id": ${prop.dci-connects.router_id},
     "firewall_enable": false,
-    "local_networks": ["${prop.l3-dci-connects.local_networks}"],
+    "local_networks": ${prop.dci-connects.local_networks},
     "local_network_all": false,
-    "evpn_irts": ["${prop.l3-dci-connects.evpn_irts}"],
-    "evpn_erts": ["${prop.l3-dci-connects.evpn_erts}"],
-    "l3_vni": "${prop.l3-dci-connects.l3_vni}"
+    "evpn_irts": ${prop.dci-connects.evpn_irts},
+    "evpn_erts": ${prop.dci-connects.evpn_erts},
+    "l3_vni": ${prop.dci-connects.vni}
   }
 }
index 2d3b401..1dcc97b 100644 (file)
@@ -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<String, String> p = new HashMap<String, String>();
+        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<String, String> p = new HashMap<String, String>();
+        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);
+
+    }
 }
diff --git a/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json b/restapi-call-node/provider/src/test/resources/l2-dci-connects-template.json
new file mode 100644 (file)
index 0000000..f180756
--- /dev/null
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : SDN-C
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+{
+  "l2-dci-connect": {
+    "id": ${prop.dci-connects.id},
+    "name": ${prop.dci-connects.name},
+    "description": ${prop.dci-connects.description},
+    "network_id": ${prop.dci-connects.local_networks[0]},
+    "evpn_irts": ${prop.dci-connects.evpn_irts},
+    "evpn_erts": ${prop.dci-connects.evpn_erts},
+    "vni": ${prop.dci-connects.vni}
+  }
+}
diff --git a/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json b/restapi-call-node/provider/src/test/resources/l3-dci-connects-template.json
new file mode 100644 (file)
index 0000000..c011b07
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 Intel Corp. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+{
+  "l3-dci-connect": {
+    "id": ${prop.dci-connects.id},
+    "name": ${prop.dci-connects.name},
+    "description": ${prop.dci-connects.description},
+    "router_id": ${prop.dci-connects.router_id},
+    "firewall_enable": false,
+    "local_networks": ${prop.dci-connects.local_networks},
+    "local_network_all": false,
+    "evpn_irts": ${prop.dci-connects.evpn_irts},
+    "evpn_erts": ${prop.dci-connects.evpn_erts},
+    "l3_vni": ${prop.dci-connects.vni}
+  }
+}