1 /* Copyright 2016-2017, Huawei Technologies Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 $.getJSON("./conf/dataconfig.json", function (jsonData){
18 url.overlay = jsonData.url +":"+ jsonData.port + "/org.openo.sdno.overlayvpnservice";
19 url.underlay = jsonData.url +":"+ jsonData.port + "/org.openo.sdno.l3vpnservice";
20 console.log("URL = " + JSON.stringify(url));
23 function loadUnderlayData() {
24 var requestUrl = "/openoapi/sdnol3vpn/v1/l3vpns";
29 contentType: "application/json",
30 success: function (jsonobj) {
31 alert("loading underlay data");
32 //TODO: Update the table
34 error: function (xhr, ajaxOptions, thrownError) {
35 //alert("Error on getting underlay data : " + xhr.responseText);
39 function deleteUnderlayData(objectId) {
40 var requestUrl = "/openoapi/sdnol3vpn/v1/l3vpns/" + objectId;
45 contentType: "application/json",
46 success: function (jsonobj) {
47 alert("deleting underlay data");
48 //TODO: Update the table
50 error: function (xhr, ajaxOptions, thrownError) {
51 alert("Error on deleting underlay data : " + xhr.responseText);
55 function loadOverlayData() {
56 var requestUrl = "/openoapi/sdnooverlayvpn/v1/site2dc-vpn";
61 contentType: "application/json",
62 success: function (jsonobj) {
63 alert("loading Overlay data...");
64 //TODO: Update the table
66 error: function (xhr, ajaxOptions, thrownError) {
67 //alert("Error on getting Overlayvpn data : " + xhr.responseText);
71 function refressTpDataTable(overlayTable, TpTable) {
72 alert("refesssing Tp data table");
75 $.fn.serializeObject = function () {
77 var a = this.serializeArray();
78 $.each(a, function () {
79 if (o[this.name] !== undefined) {
80 if (!o[this.name].push) {
81 o[this.name] = [o[this.name]];
83 o[this.name].push(this.value || '');
85 o[this.name] = this.value || '';
90 $('#createUnderlay').click(function () {
91 var formData = JSON.stringify($("#underlayForm").serializeObject());
93 var jsonobj = JSON.parse(formData);
94 var requestUrl = "/openoapi/sdnol3vpn/v1/l3vpns";
99 contentType: "application/json",
102 success: function (jsonobj) {
103 alert("Details saved successfully!!!");
104 //var data = [jsonobj.name,jsonobj.hostName,jsonobj.productName,jsonobj.vendor,jsonobj.description];
105 //TODO: update the table
107 error: function (xhr, ajaxOptions, thrownError) {
108 alert("Error on page : " + xhr.responseText);
112 $('.underlayNameLink').click(function () {
113 alert("coming here");
114 var data = $(this).parent().parent().parent().find('td:last').find('div:last').html();
116 var jsonObj = JSON.parse(data);
117 for (var i = 0; i < jsonObj.length; i++) {
118 var obj = jsonObj[i];
119 var rowData = [obj.tpName, obj.peName, obj.vlanId, obj.siteCidr, obj.ip];
120 $('#underlayTpDataTable').DataTable();
121 $('#underlayTpDataTable').dataTable().fnAddData(rowData);