summaryrefslogtreecommitdiffstats
path: root/vbd/gui/module/src/main/resources/vpp/services
diff options
context:
space:
mode:
Diffstat (limited to 'vbd/gui/module/src/main/resources/vpp/services')
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/bdm.bridgedomain.service.js89
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/bdm.interface.service.js74
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/bdm.service.js14
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/bdm.tunnel.service.js25
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/bdm.vpp.service.js106
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/inventory.service.js154
-rw-r--r--vbd/gui/module/src/main/resources/vpp/services/vpp.services.js48
7 files changed, 0 insertions, 510 deletions
diff --git a/vbd/gui/module/src/main/resources/vpp/services/bdm.bridgedomain.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.bridgedomain.service.js
deleted file mode 100644
index e0fcee68f..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/bdm.bridgedomain.service.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module'], function(vpp) {
- vpp.register.factory('bdmBridgeDomainService', function(VPPRestangular) {
- var s = {};
-
- var BridgeDomain = function(topologyId) {
- this['topology-id'] = topologyId || null;
- this['topology-types'] = {
- 'vbridge-topology:vbridge-topology': {}
- };
- this['underlay-topology'] = [
- {
- 'topology-ref': 'topology-netconf'
- }
- ];
- this['vbridge-topology:tunnel-type'] = 'tunnel-type-vxlan';
- this['vbridge-topology:vxlan'] = {
- 'vni': '1'
- };
- this['vbridge-topology:flood'] = "true",
- this['vbridge-topology:forward'] = "true",
- this['vbridge-topology:learn'] = "true",
- this['vbridge-topology:unknown-unicast-flood'] = "true",
- this['vbridge-topology:arp-termination'] = "false"
- };
-
- s.createObj = function(topologyId) {
- return new BridgeDomain(topologyId);
- };
-
- s.add = function(bridgeDomain, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bridgeDomain['topology-id']);
- var dataObj = {'topology': [bridgeDomain]};
-
- restObj.customPUT(dataObj).then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.get = function(successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology');
- var bridgeDomainList = [];
-
- restObj.get().then(function(data) {
- if(data['network-topology'].topology) {
- bridgeDomainList = data['network-topology'].topology.filter(function (topology) {
- if (topology['topology-types'] && topology['topology-types']['vbridge-topology:vbridge-topology']) {
- return topology['topology-types']['vbridge-topology:vbridge-topology'] !== undefined;
- }
- });
- }
- successCallback(bridgeDomainList);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.getOne = function(bdId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bdId);
-
- restObj.get().then(function(data) {
- successCallback(data.topology[0]);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.remove = function(bdName,successCallback,errorCallback) {
- //http://localhost:8181/restconf/config/network-topology:network-topology/topology/testBD
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bdName);
-
- restObj.remove().then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- return s;
- });
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/services/bdm.interface.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.interface.service.js
deleted file mode 100644
index 5fc907b7f..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/bdm.interface.service.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module'], function(vpp) {
- vpp.register.factory('bdmInterfaceService', function(VPPRestangular, bdmVppService) {
- var s = {};
-
- var Interface = function(tpId, interfaceName) {
- this['tp-id'] = tpId || null;
- this['vbridge-topology:user-interface'] = interfaceName;
- };
-
- s.createObj = function(tpId, interfaceName) {
- return new Interface(tpId, interfaceName);
- };
-
- s.add = function(interf, bridgeDomainId, vppId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology')
- .one('topology').one(bridgeDomainId).one('node').one(vppId).one('termination-point').one(encodeURIComponent(interf['tp-id']));
-
- var dataObj = {'termination-point': [interf]};
-
- var write = function() {
- restObj.customPUT(dataObj).then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- var errorCallback = function() {};
-
- bdmVppService.checkAndWriteVpp(bridgeDomainId, vppId, write, errorCallback);
-
-
- };
-
- s.delete = function(interf, bridgeDomainId, vppId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology')
- .one('topology').one(bridgeDomainId).one('node').one(vppId).one('termination-point').one(encodeURIComponent(interf['tp-id']));
-
- restObj.remove().then(function(data) {
- bdmVppService.checkAndDeleteVpp(bridgeDomainId, vppId,
- function() {
- successCallback(data);
- },
- function() {
-
- }
- );
-
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.get = function(bridgeDomainId, vppId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology')
- .one('topology').one(bridgeDomainId).one('node').one(vppId);
-
- restObj.get().then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- return s;
- });
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/services/bdm.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.service.js
deleted file mode 100644
index 5d6592787..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/bdm.service.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module', 'next'], function(vpp) {
- vpp.register.factory('bdmService', function(VPPRestangular, VPPRestangularXml) {
- var s = {};
-
- return s;
- });
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/services/bdm.tunnel.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.tunnel.service.js
deleted file mode 100644
index 7c8f1492f..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/bdm.tunnel.service.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module'], function(vpp) {
- vpp.register.factory('bdmTunnelService', function(VPPRestangular) {
- var s = {};
-
- s.get = function(bridgeDomainId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('operational').one('network-topology:network-topology')
- .one('topology').one(bridgeDomainId);
-
- restObj.get().then(function(data) {
- successCallback(data.topology[0].link);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- return s;
- });
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/services/bdm.vpp.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.vpp.service.js
deleted file mode 100644
index a86fa06fc..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/bdm.vpp.service.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module'], function(vpp) {
- vpp.register.factory('bdmVppService', function(VPPRestangular) {
- var s = {};
-
- var Vpp = function(nodeId, vppId) {
- this['node-id'] = nodeId || null;
- this['supporting-node'] = [
- {
- 'topology-ref': 'topology-netconf',
- 'node-ref': vppId
- }
- ];
- this['netconf-node-topology:pass-through'] = {};
- };
-
- s.createObj = function(nodeId, vppId) {
- return new Vpp(nodeId, vppId);
- };
-
- s.add = function(vpp, bridgeDomainId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bridgeDomainId).one('node').one(vpp['node-id']);
- var dataObj = {'node': [vpp]};
-
- restObj.customPUT(dataObj).then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.get = function(bridgeDomainId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bridgeDomainId);
-
- return restObj.get().then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.getOne = function(bridgeDomainId, vppId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bridgeDomainId).one('node').one(vppId);
-
- return restObj.get().then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.delete = function(bridgeDomainId, vppId, successCallback, errorCallback) {
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one(bridgeDomainId).one('node').one(vppId);
-
- return restObj.remove().then(function(data) {
- successCallback(data);
- }, function(res) {
- errorCallback(res.data, res.status);
- });
- };
-
- s.checkAndWriteVpp = function(bridgeDomainId, vppId, successCallback, errorCallback) {
- s.getOne(bridgeDomainId, vppId,
- function() {
- successCallback();
- }, function() {
- var vppObject = s.createObj(vppId, vppId);
-
- s.add(vppObject, bridgeDomainId, function() {
- successCallback();
- }, function() {
- errorCallback();
- });
- }
- );
- };
-
- s.checkAndDeleteVpp = function(bridgeDomainId, vppId, successCallback, errorCallback) {
- s.getOne(bridgeDomainId, vppId,
- function(data) {
- if(!data['termination-point']) {
- s.delete(bridgeDomainId, vppId,
- function(){
- successCallback();
- },
- function() {
- errorCallback();
- }
- );
- }
- },
- function() {
- errorCallback();
- }
- );
- };
-
- return s;
- });
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/services/inventory.service.js b/vbd/gui/module/src/main/resources/vpp/services/inventory.service.js
deleted file mode 100644
index 6181ce678..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/inventory.service.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module', 'next'], function(vpp) {
- vpp.register.factory('VppService', function(VPPRestangular, VPPRestangularXml, VppInterfaceService, $q) {
- var s = {};
-
- var Vpp = function(name, ipAddress, port, username, password, status) {
- this.name = name || null;
- this.ipAddress = ipAddress || null;
- this.port = port || null;
- this.username = username || null;
- this.password = password || null;
- this.status = status || null;
- this.interfaces = [];
- };
-
- s.createObj = function(name, ipAddress, port, username, password, status) {
- return new Vpp(name, ipAddress, port, username, password, status);
- };
-
- s.getVppList = function(successCallback, errorCallback) {
- var vppList = [];
- var promiseList = [];
- var restObj = VPPRestangular.one('restconf').one('operational').one('network-topology:network-topology').one('topology').one('topology-netconf');
-
- restObj.get().then(function(data) {
- data.topology[0].node.forEach(function(n) {
- if(n['node-id'] !== 'controller-config') {
- //create new object
- var vppObj = s.createObj(n['node-id'], n['netconf-node-topology:host'], n['netconf-node-topology:port'], null, null, n['netconf-node-topology:connection-status']);
- // register a promise
- if (vppObj.status === 'connected') {
- var promise = VppInterfaceService.getInterfaceListByVppName(n['node-id'],
- function (interfaceList) {
- vppObj.interfaces = interfaceList;
- },
- function (error) { }
- );
- // add promise to array
- promiseList.push(promise);
- // when promise is resolved, push vpp into vppList
- promise.then(
- function () {
- vppList.push(vppObj);
- },
- function() {
- console.warn('error');
- }
- )
- }
- else {
- vppList.push(vppObj);
- }
-
- }
- });
-
- // when all promises are resolved, call success callback
- $q.all(promiseList).then(function () {
- successCallback(vppList);
- });
- }, function(res) {
- errorCallback(res);
- });
- };
-
- s.deleteVpp = function(vpp, finishedSuccessfullyCallback) {
- console.log(vpp);
- var restObj = VPPRestangular.one('restconf').one('config').one('network-topology:network-topology').one('topology').one('topology-netconf').one('node').one('controller-config').one('yang-ext:mount').one('config:modules').one('module').one('odl-sal-netconf-connector-cfg:sal-netconf-connector').one(vpp.name);
-
- restObj.remove().then(function() {
- finishedSuccessfullyCallback(true);
- }, function(res) {
- finishedSuccessfullyCallback(false);
- });
- };
-
- s.mountVpp = function(name,ip,port,un,pw,finishedSuccessfullyCallback) {
-
- var postData = '\
- <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">\
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>\
- <name>'+name+'</name>\
- <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">'+ip+'</address>\
- <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">'+port+'</port>\
- <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">'+un+'</username>\
- <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">'+pw+'</password>\
- <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>\
- <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">\
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>\
- <name>global-event-executor</name>\
- </event-executor>\
- <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">\
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>\
- <name>binding-osgi-broker</name>\
- </binding-registry>\
- <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">\
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>\
- <name>dom-broker</name>\
- </dom-registry>\
- <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">\
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>\
- <name>global-netconf-dispatcher</name>\
- </client-dispatcher>\
- <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">\
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>\
- <name>global-netconf-processing-executor</name>\
- </processing-executor>\
- </module>';
-
- var restObj = VPPRestangularXml.one('restconf').one('config').one('opendaylight-inventory:nodes').one('node').one('controller-config').one('yang-ext:mount');
-
- restObj.post('config:modules', postData).then(function() {
- finishedSuccessfullyCallback(true);
- }, function(res) {
- finishedSuccessfullyCallback(false);
- });
- };
-
- return s;
- });
-
- vpp.register.factory('VppInterfaceService', function(VPPRestangular, $q) {
- var s = {};
-
- s.getInterfaceListByVppName = function(vppName, successCallback, errorCallback) {
- var interfaceList = [];
- var restObj = VPPRestangular.one('restconf').one('operational').one('network-topology:network-topology').one('topology').one('topology-netconf').one('node').one(vppName).one('yang-ext:mount').one('ietf-interfaces:interfaces-state');
-
- return restObj.get().then(
- function(data) {
- if (data['interfaces-state'].interface) {
- interfaceList = data['interfaces-state'].interface.filter(function(i) {
- if (i.name != 'local0') {
- return i;
- }
- });
- }
- successCallback(interfaceList);
- },
- function(res) {
- errorCallback(res);
- }
- );
- };
-
- return s;
- });
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js b/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js
deleted file mode 100644
index 19cee135b..000000000
--- a/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-define(['app/vpp/vpp.module', 'next'], function(vpp) {
-
- vpp.register.factory('VPPRestangular', function(Restangular, ENV) {
- return Restangular.withConfig(function(RestangularConfig) {
- RestangularConfig.setBaseUrl(ENV.getBaseURL("MD_SAL"));
- });
- });
-
- vpp.register.factory('VPPRestangularXml', function(Restangular, ENV) {
- return Restangular.withConfig(function(RestangularConfig) {
- RestangularConfig.setBaseUrl(ENV.getBaseURL("MD_SAL"));
- RestangularConfig.setDefaultHeaders({ "Content-Type": "application/xml" }, { "Accept": "application/xml" });
- });
- });
-
- vpp.register.service('toastService', function($mdToast) {
- this.showToast = function(content) {
- var toast = $mdToast.simple()
- .content(content)
- .action('OK')
- .position('bottom right');
- $mdToast.show(toast);
- }
- });
-
- vpp.register.service('dataService', ['$timeout', 'bdmTunnelService',function($timeout, bdmTunnelService) {
-
- var self = this;
-
- this.vpps = [];
- this.interfaces = [];
- this.selectedBd = {
- name: ''
- };
-
-
- }]);
-
-
-
-}); \ No newline at end of file