From 5cba4bb121a736e3801d1f436263ff818a68a389 Mon Sep 17 00:00:00 2001 From: Seshu-Kumar-M Date: Wed, 28 Sep 2016 17:49:37 +0800 Subject: Changes for the LCM integration and new GSO design Change-Id: I319237a9386cea88fae887c73ae2feff217f6f85 Signed-off-by: Seshu-Kumar-M --- .../src/main/webapp/lifecyclemgr/js/rest.js | 77 +++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) (limited to 'openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js') diff --git a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js index 680ad113..bc4d216a 100644 --- a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js +++ b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js @@ -78,4 +78,79 @@ $(function () { return o; }; -}) \ No newline at end of file + $('#createNS').click(function(){ + var formData = JSON.stringify($("#neForm").serializeObject()); + var jsonobj = JSON.parse(formData); + var newJson = {"managedElement": jsonobj}; + formData = JSON.stringify(newJson); + var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/managed-elements"; + $ + .ajax({ + type : "POST", + url : requestUrl, + contentType : "application/json", + dataType : "json", + data : formData, + success : function(jsonResp) { + alert("NS saved successfully!!!"); + jsonobj["id"]= jsonResp.managedElement.id; + $('#ne').bootstrapTable("append", jsonobj); + $('#vmAppDialog').removeClass('in').css('display','none'); + + }, + error : function(xhr, ajaxOptions, thrownError) { + alert("Error on page : " + xhr.responseText); + } + }); + }); +}) + +/*******************************************Get Service**********************************************/ +function loadGetServiceData(url){ + return JSON.parse('[{"serviceId":"1111","serviceName":"siteToDC","description":"siteToDC","createTime":"xxxxxx","creator":"XXXX","serviceType":"GSO","templateName":"xxxxxx","inputParameters":{"POP-1-0-0.vFW-moc":"xxx","POP-1-0-0.vCPE-moc":"xxx"}},{"serviceId":"2222","serviceName":"siteToDC","description":"siteToDC","createTime":"xxxxxx","creator":"XXXX","serviceType":"GSO","templateName":"xxxxxx","inputParameters":{"POP-1-0-0.vFW-moc":"xxx1","POP-1-0-0.vCPE-moc":"xxx1"}}]'); + + // TODO authenticate the url. + var requestUrl = url + "/openoapi/sdnobrs/v1/topological-links"; + $ + .ajax({ + type : "GET", + url : requestUrl, + contentType : "application/json", + success : function(jsonobj) { + // TODO return according to the json data received. + return jsonobj; + }, + error : function(xhr, ajaxOptions, thrownError) { + alert("Error on getting link data : " + xhr.responseText); + } + }); +} + +/*********************************************Get Service Details********************************************/ +function loadServiceDetails(url, serviceId){ + return JSON.parse('[{"id":"12345", "name":"sdno"}, {"id":"23456", "name":"gso"},{"id":"12345", "name":"nfvo"}]'); + //return JSON.parse('{"sdno":[{"id":"12345", "name":"SDNO"}], "nfvo":[{"id":"12345", "name":"SDNO"}]}'); + //return JSON.parse('"nfvo":[{"id":"12345", "name":"SDNO"}]}'); + // TODO authenticate the url. + var requestUrl = url + "/openoapi/lifecyclemgr/v1/services/toposequence/" + serviceId; + $ + .ajax({ + type : "GET", + url : requestUrl, + contentType : "application/json", + success : function(jsonobj) { + // TODO return according to the json data received. + return jsonobj; + }, + error : function(xhr, ajaxOptions, thrownError) { + alert("Error on getting link data : " + xhr.responseText); + } + }); +} + +function anchorClick(serviceId){ + var url = ""; + var jsonData = loadServiceDetails(url, serviceId); + //TODO populate the modal according to json response + return true; +} -- cgit 1.2.3-korg