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