diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2016-09-28 10:19:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@open-o.org> | 2016-09-28 10:19:58 +0000 |
commit | 43fce8bc293fb8c7adeb5ee163069de027a5a1c5 (patch) | |
tree | 8d16d86001a4798a36573fc065406b084b4a8b92 /openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js | |
parent | 36dc93eed5add344b62a08720d67b5e082f8e160 (diff) | |
parent | 5cba4bb121a736e3801d1f436263ff818a68a389 (diff) |
Merge "Changes for the LCM integration and new GSO design"
Diffstat (limited to 'openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js')
-rw-r--r-- | openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/rest.js | 77 |
1 files changed, 76 insertions, 1 deletions
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;
+}
|