SDN controller issues
authorseshukm <seshu.kumar.m@huawei.com>
Thu, 20 Apr 2017 07:02:32 +0000 (12:32 +0530)
committerseshukm <seshu.kumar.m@huawei.com>
Thu, 20 Apr 2017 07:08:28 +0000 (12:38 +0530)
IssueId : CLIENT-197

Change-Id: I047cd82c9c9fd2db3f63b52468e18810ec30b12a
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
extsys/src/main/webapp/extsys/sdncontroller/index.html
extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js [new file with mode: 0644]
extsys/src/main/webapp/extsys/sdncontroller/templates/controller.html
resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/neRest.js

index 1a0d84f..942a86b 100644 (file)
@@ -37,7 +37,7 @@
        <link href="/openoui/extsys/sdncontroller/css/style.css" rel="stylesheet"/>\r
     <script src="/openoui/extsys/sdncontroller/js/app.js"></script>\r
     <script src="/openoui/extsys/sdncontroller/js/rest.js"></script>\r
-    <script src="/openoui/framework/browser/js/DataService.js"></script>\r
+    <script src="/openoui/extsys/sdncontroller/js/DataService.js"></script>\r
     <script src="/openoui/thirdparty/js/mustache.js"></script>\r
 \r
 \r
diff --git a/extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js b/extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js
new file mode 100644 (file)
index 0000000..f374bbd
--- /dev/null
@@ -0,0 +1,80 @@
+app.factory("DataService", function($http, $log) {
+    return {
+        /**
+         *
+         * @param url - url of the service
+         * @param data - data as an object (used as query string in url)
+         * @returns {*}
+         */
+        get: function (url, data) {
+            if(data) {
+                url += "?";
+                for(key in data){
+                    url += key+ "=" + data[key];
+                }
+            }
+            return $http({
+                url: url,
+                method: 'GET',
+                data: null,
+                headers: {'Content-Type': 'application/json'}
+            }).then(function (response) {
+                return response.data;
+            });
+        },
+        /**
+         *
+         * @param url - url of the service
+         * @param data - data as an object (used for post method)
+         * @returns {*}
+         */
+        post: function (url, data) {
+            return $http({
+                url: url,
+                method: 'POST',
+                data: data,
+                headers: {'Content-Type': 'application/json '}
+            }).then(function (response) {
+                console.log("Response : ");
+                $log.info(response.data);
+                return response.data;
+            });
+        },
+        /**
+         * TODO - To Check for Delete
+         * @param url
+         * @param data
+         * @returns {*}
+         */
+        delete: function (url) {
+            return $http({
+                url: url,
+                method: 'DELETE',
+                data: null,
+                headers: {'Content-Type': 'application/json '}
+            }).then(function (response) {
+                console.log("Response : ");
+                $log.info(response.data);
+                return response.data;
+            });
+        },
+        /**
+         *
+         * @param url
+         * @param data
+         */
+        put: function (url, data) {
+            return $http({
+                url: url,
+                method: 'PUT',
+                data: data,
+                headers: {'Content-Type': 'application/json '}
+            }).then(function (response) {
+                console.log("Response : ");
+                $log.info(response.data);
+                return response.data;
+            });
+        }
+
+    }
+})
\ No newline at end of file
index 3e914d0..1aab2bd 100644 (file)
@@ -80,7 +80,7 @@
         <div class="modal-content">\r
             <div class="modal-header">\r
                 <button type="button" class="close" data-dismiss="modal">&times;</button>\r
-                <h5 class="modal-title">Modal Header</h5>\r
+                <h5 class="modal-title">>Add Controller</h5>\r
             </div>\r
             <form  name="extsysForm" method="post">\r
                 <div class="modal-body">\r
index 8556421..a15ad4f 100644 (file)
@@ -26,7 +26,7 @@ app.factory("neDataService", function($http, DataService, $log, siteDataService)
                 });\r
         },\r
         getNECtrlDDList : function () {\r
-           // var url = "http://10.229.36.183:18008";\r
+            var url = "";\r
             url += "/openoapi/extsys/v1/sdncontrollers";\r
             return DataService.get(url)\r
                 .then(function(response){\r