1 /* Copyright 2016, 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 function loadUnderlayData(){
\r
18 var requestUrl = "http://localhost:8080/org.openo.sdno.l3vpnservice/openoapi/sdnol3vpn/v1/l3vpns";
\r
23 contentType : "application/json",
\r
24 success : function(jsonobj) {
\r
25 alert("loading underlay data");
\r
26 //TODO: Update the table
\r
28 error : function(xhr, ajaxOptions, thrownError) {
\r
29 alert("Error on getting underlay data : " + xhr.responseText);
\r
33 function deleteUnderlayData(objectId){
\r
34 var requestUrl = "http://localhost:8080/org.openo.sdno.l3vpnservice/openoapi/sdnol3vpn/v1/l3vpns/"+objectId;
\r
39 contentType : "application/json",
\r
40 success : function(jsonobj) {
\r
41 alert("deleting underlay data");
\r
42 //TODO: Update the table
\r
44 error : function(xhr, ajaxOptions, thrownError) {
\r
45 alert("Error on deleting underlay data : " + xhr.responseText);
\r
49 function loadOverlayData(){
\r
50 var requestUrl = "http://localhost:8080/org.openo.sdno.overlayvpnservice/openoapi/sdnooverlayvpn/v1/site2dc-vpn";
\r
55 contentType : "application/json",
\r
56 success : function(jsonobj) {
\r
57 alert("loading Overlay data...");
\r
58 //TODO: Update the table
\r
60 error : function(xhr, ajaxOptions, thrownError) {
\r
61 alert("Error on getting Overlayvpn data : " + xhr.responseText);
\r
65 function refressTpDataTable(overlayTable,TpTable){
\r
66 alert("refesssing Tp data table");
\r
69 $.fn.serializeObject = function() {
\r
71 var a = this.serializeArray();
\r
72 $.each(a, function() {
\r
73 if (o[this.name] !== undefined) {
\r
74 if (!o[this.name].push) {
\r
75 o[this.name] = [ o[this.name] ];
\r
77 o[this.name].push(this.value || '');
\r
79 o[this.name] = this.value || '';
\r
84 $('#createUnderlay').click(function(){
\r
85 var formData = JSON.stringify($("#underlayForm").serializeObject());
\r
87 var jsonobj = JSON.parse(formData);
\r
88 var requestUrl = "http://localhost:8080/org.openo.sdno.l3vpnservice/openoapi/sdnol3vpn/v1/l3vpns";
\r
93 contentType : "application/json",
\r
96 success : function(jsonobj) {
\r
97 alert("Details saved successfully!!!");
\r
98 //var data = [jsonobj.name,jsonobj.hostName,jsonobj.productName,jsonobj.vendor,jsonobj.description];
\r
99 //TODO: update the table
\r
101 error : function(xhr, ajaxOptions, thrownError) {
\r
102 alert("Error on page : " + xhr.responseText);
\r
106 $('.underlayNameLink').click(function(){
\r
107 alert("coming here");
\r
108 var data = $(this).parent().parent().parent().find('td:last').find('div:last').html();
\r
110 var jsonObj = JSON.parse(data);
\r
111 for(var i = 0; i < jsonObj.length; i++) {
\r
112 var obj = jsonObj[i];
\r
113 var rowData = [obj.tpName,obj.peName,obj.vlanId,obj.siteCidr,obj.ip];
\r
114 $('#underlayTpDataTable').DataTable();
\r
115 $('#underlayTpDataTable').dataTable().fnAddData(rowData);
\r