aboutsummaryrefslogtreecommitdiffstats
path: root/demo-ui/app/services
diff options
context:
space:
mode:
authorSteven Saunders <steve@llantz9470.cablelabs.com>2015-08-12 08:48:07 -0600
committerSteven Saunders <steve@khiatt8460b.cablelabs.com>2015-08-12 18:21:36 -0600
commite8a4652f70284c414ceafc086669dfd4b935573d (patch)
treeedfa339167fee1863505f7a39b5b3cab431b3eee /demo-ui/app/services
parented73dbf357aff41edcbab401a94e5fbc266d9391 (diff)
Add demo-ui folder. This folder contains HTML/CSS/Javascript code for the VCPE Demo UI. The Demo UI allows you to CRUD CoS instances, and EPL instances, and will also display information about EVCs and UNIs that were created as well
Change-Id: I32eea1121c21e0b451efc057a0c0f30fe5601cd5 Signed-off-by: Steven Saunders <steve@llantz9470.cablelabs.com>
Diffstat (limited to 'demo-ui/app/services')
-rw-r--r--demo-ui/app/services/cosServices.js64
-rw-r--r--demo-ui/app/services/dbg.js54
-rw-r--r--demo-ui/app/services/eplServices.js64
-rw-r--r--demo-ui/app/services/mefServices.js71
-rw-r--r--demo-ui/app/services/model.js61
5 files changed, 314 insertions, 0 deletions
diff --git a/demo-ui/app/services/cosServices.js b/demo-ui/app/services/cosServices.js
new file mode 100644
index 0000000..c650b6d
--- /dev/null
+++ b/demo-ui/app/services/cosServices.js
@@ -0,0 +1,64 @@
+(function(){
+
+ var cosServices = function ($http, dbg) {
+
+ var _cosBasePath = "/cosmgr/webapi/cos"
+ var _cosUrl = "unset";
+
+ var setCosUrl = function (cosMgrCfg) {
+ dbg.p("in setCosUrl");
+ _cosUrl = "http://"+cosMgrCfg.ip+":"+cosMgrCfg.port+_cosBasePath;
+ dbg.p(_cosUrl);
+ }
+
+ var getCosUrl = function () {
+ dbg.p("in getCosUrl");
+ return _cosUrl;
+ }
+
+ var getCosList = function() {
+ dbg.p("in cosServices.getCosList()",2);
+ var url = _cosUrl+ "/list;"
+ dbg.p("GET: " + url , 2);
+ return $http.get(url)
+ .then(function(response){ return response.data; });
+ };
+ var createCos = function(cos) {
+ dbg.p("in cosServices.createCos()",2)
+ var url = _cosUrl;
+ dbg.p("POST: " + url, 2);
+ dbg.pj(cos);
+ return $http.post(url, cos)
+ .then(function(response){ return response.data; });
+ };
+ var updateCos = function(cos) {
+ dbg.p("in cosServices.updateCos()",2)
+ var url = _cosUrl + "/" + cos.id;
+ dbg.p("PUT: " + url, 2);
+ dbg.pj(cos);
+ return $http.put(url, cos)
+ .then(function(response){ return response.data; });
+ };
+ var deleteCos = function(cos) {
+ dbg.p("in cosServices.deleteCos()",2)
+ var url = _cosUrl + "/" + cos.id;
+ dbg.p("DELELE: " + url, 2);
+ dbg.pj(cos);
+ return $http.delete(url)
+ .then(function(response){ return response.data; });
+ };
+
+ return { // public API
+ setCosUrl : setCosUrl,
+ getCosUrl : getCosUrl,
+ createCos : createCos,
+ getCosList : getCosList,
+ deleteCos : deleteCos,
+ updateCos : updateCos
+ };
+ };
+
+ var module = angular.module("vcpe");
+ module.factory("cosServices", cosServices);
+
+}()); \ No newline at end of file
diff --git a/demo-ui/app/services/dbg.js b/demo-ui/app/services/dbg.js
new file mode 100644
index 0000000..1e12523
--- /dev/null
+++ b/demo-ui/app/services/dbg.js
@@ -0,0 +1,54 @@
+(function(){
+
+ var dbg = function ($log) {
+
+ var dbgFlag = true;
+
+ var on = function() { dbgFlag = true; };
+ var off = function() { dbgFlag = false; };
+
+ var p = function(str, tab, emphasize) {
+ if ( dbgFlag )
+ {
+ var tabStr = "";
+ if (tab) {
+ for (var i = 0; i < tab; i++ )
+ tabStr += " ";
+ }
+ var preStr = "... " + tabStr;
+ var postStr = "";
+ if ( emphasize ) {
+ preStr = tabStr + "####################### ";
+ postStr = " ####################### ";
+ }
+ $log.info(preStr + str + postStr);
+ }
+ };
+
+ var pj = function(obj) {
+ if ( dbgFlag )
+ $log.info(JSON.stringify(obj,null,3))
+ };
+
+ var e = function(eMsg) {
+ $log.error("!! ERROR: " + eMsg);
+ }
+
+ var w = function(eMsg) {
+ $log.warn("!! WARNIING: " + eMsg);
+ }
+
+ return { // Public API
+ on : on, // squelch DBG printing
+ off : off, // enable DBG printing
+ p : p, // print a debug string
+ pj : pj, // print JSON version of an object
+ w : w, // print an warning msg
+ e : e // print an error msg
+ };
+ };
+
+ var module = angular.module("vcpe");
+ module.factory("dbg", dbg);
+
+}()); \ No newline at end of file
diff --git a/demo-ui/app/services/eplServices.js b/demo-ui/app/services/eplServices.js
new file mode 100644
index 0000000..20fb7af
--- /dev/null
+++ b/demo-ui/app/services/eplServices.js
@@ -0,0 +1,64 @@
+(function(){
+
+ var eplServices = function ($http, dbg) {
+
+ var _eplBasePath = "/svcmgr/webapi/svc/epl"
+ var _eplUrl = "unset";
+
+ var setEplUrl = function (eplMgrCfg) {
+ dbg.p("in setEplUrl");
+ _eplUrl = "http://"+eplMgrCfg.ip+":"+eplMgrCfg.port+_eplBasePath;
+ dbg.p(_eplUrl);
+ }
+
+ var getEplUrl = function () {
+ dbg.p("in setEplUrl");
+ return _eplUrl;
+ }
+
+ var getEplList = function() {
+ dbg.p("in eplServices.getEplList()",2);
+ var url = _eplUrl+ "/list;"
+ dbg.p("GET: " + url , 2);
+ return $http.get(url)
+ .then(function(response){ return response.data; });
+ };
+ var createEpl = function(epl) {
+ dbg.p("in eplServices.createEpl()",2)
+ var url = _eplUrl;
+ dbg.p("POST: " + url, 2);
+ dbg.pj(epl);
+ return $http.post(url, epl)
+ .then(function(response){ return response.data; });
+ };
+ var updateEpl = function(epl) {
+ dbg.p("in eplServices.updateEpl()",2)
+ var url = _eplUrl + "/" + epl.id;
+ dbg.p("PUT: " + url, 2);
+ dbg.pj(epl);
+ return $http.put(url, epl)
+ .then(function(response){ return response.data; });
+ };
+ var deleteEpl = function(epl) {
+ dbg.p("in eplServices.deleteEpl()",2)
+ var url = _eplUrl + "/" + epl.id;
+ dbg.p("DELELE: " + url, 2);
+ dbg.pj(epl);
+ return $http.delete(url)
+ .then(function(response){ return response.data; });
+ };
+
+ return { // public API
+ setEplUrl : setEplUrl,
+ getEplUrl : getEplUrl,
+ createEpl : createEpl,
+ getEplList : getEplList,
+ deleteEpl : deleteEpl,
+ updateEpl : updateEpl
+ };
+ };
+
+ var module = angular.module("vcpe");
+ module.factory("eplServices", eplServices);
+
+}()); \ No newline at end of file
diff --git a/demo-ui/app/services/mefServices.js b/demo-ui/app/services/mefServices.js
new file mode 100644
index 0000000..798ceb3
--- /dev/null
+++ b/demo-ui/app/services/mefServices.js
@@ -0,0 +1,71 @@
+(function(){
+
+ var mefServices = function ($http, dbg) {
+
+ var _evcBasePath = "/evcmgr/webapi/evc"
+ var _evcUrl = "unset";
+
+ var _uniBasePath = "/restconf/operational/cl-vcpe-mef:unis/uni"
+ var _uniUrl = "unset";
+
+ var _evcPathBasePath = "/restconf/operational/cl-vcpe-mef:evcs"
+ var _evcPathUrl = "unset";
+
+ //
+ // Configuration services
+ //
+
+ var setEvcUrl = function (evcMgrCfg) {
+ dbg.p("in setEvcUrl");
+ _evcUrl = "http://"+evcMgrCfg.ip+":"+evcMgrCfg.port+_evcBasePath;
+ dbg.p(_evcUrl);
+ }
+
+ var setUniUrl = function (uniMgrCfg) {
+ dbg.p("in setUniUrl");
+ _uniUrl = "http://"+uniMgrCfg.ip+":"+uniMgrCfg.port+_uniBasePath;
+ dbg.p(_uniUrl);
+ }
+
+ var setEvcPathUrl = function (evcPathMgrCfg) {
+ dbg.p("in setEvcPathUrl");
+ _evcPathUrl = "http://"+evcPathMgrCfg.ip+":"+evcPathMgrCfg.port+_evcPathBasePath;
+ dbg.p(_evcPathUrl);
+ }
+
+ //
+ // REST services
+ //
+
+ var getEvc = function(evcId) {
+ dbg.p("in mefServices.getEvc()",2)
+ var url = _evcUrl + "/" + evcId;
+ dbg.p("GET: " + url, 2);
+ return $http.get(url)
+ .then(function(response){ return response.data; });
+ };
+
+ var getUni = function(uniId) {
+ dbg.p("in mefServices.getUni()",2)
+ var url = _uniUrl + "/" + uniId;
+ dbg.p("GET: " + url, 2);
+ // return $http.get(url)
+ // .then(function(response){ return response.data; });
+ return $http({method: 'GET', url: url,
+ headers: {'Authorization': 'Basic YWRtaW46YWRtaW4='}})
+ .then(function(response){ return response.data; });
+ };
+
+ return { // public API
+ setEvcUrl : setEvcUrl,
+ setUniUrl : setUniUrl,
+ setEvcPathUrl : setEvcPathUrl,
+ getEvc : getEvc,
+ getUni : getUni
+ };
+ };
+
+ var module = angular.module("vcpe");
+ module.factory("mefServices", mefServices);
+
+}()); \ No newline at end of file
diff --git a/demo-ui/app/services/model.js b/demo-ui/app/services/model.js
new file mode 100644
index 0000000..c41794b
--- /dev/null
+++ b/demo-ui/app/services/model.js
@@ -0,0 +1,61 @@
+//
+// For data that must be shared accross controllers
+//
+
+(function(){
+var model = function ($log, dbg) {
+
+ var _shared = {
+ availableUnis : [],
+ currentEpl : null
+ };
+
+ var getAvailableUnis = function () {
+ return _shared.availableUnis;
+ }
+
+ var setAvailableUnis = function (availableUnis) {
+ dbg.p("in model:setAvailableUnis");
+ _shared.availableUnis = availableUnis;
+ dbg.pj(_shared.availableUnis);
+ }
+
+ // var getCurrentEplId = function () {
+ // // dbg.p("in model:getCurrentEplId, returning: "+_shared.currentEplId);
+ // return _shared.currentEplId;
+ // }
+
+ // var setCurrentEplId = function (currentEplId) {
+ // // dbg.p("in model:setCurrentEplId, setting to: "+currentEplId);
+ // _shared.currentEplId = currentEplId;
+ // }
+
+ var getCurrentEpl = function () {
+ dbg.p("in model:getCurrentEpl:");
+ //dbg.pj(_shared.currentEpl);
+ return _shared.currentEpl;
+ }
+
+ var setCurrentEpl = function (currentEpl) {
+ // dbg.p("in model:setCurrentEplId, setting to: "+currentEplId);
+ dbg.p("in model:setCurrentEpl");
+ //dbg.pj(currentEpl);
+ _shared.currentEpl = currentEpl;
+ }
+
+
+ var dumpShareDdata = function() { dbg.pj(_shared); };
+
+ return { // Public API
+ getAvailableUnis : getAvailableUnis,
+ setAvailableUnis : setAvailableUnis,
+ getCurrentEpl : getCurrentEpl,
+ setCurrentEpl : setCurrentEpl,
+ dumpShareDdata : dumpShareDdata
+ };
+ };
+
+ var module = angular.module("vcpe");
+ module.factory("model", model);
+
+}()); \ No newline at end of file