diff options
Diffstat (limited to 'vbd/gui/module')
13 files changed, 434 insertions, 296 deletions
diff --git a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.bridgedomain.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.bridgedomain.controller.js new file mode 100644 index 000000000..ea65afbc9 --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.bridgedomain.controller.js @@ -0,0 +1,18 @@ +/* + * 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.controller('bdmBridgeDomainCtrl', ['$scope', '$rootScope', '$timeout' ,'dataService', 'toastService', '$mdSidenav', '$mdDialog', + function ($scope, $rootScope, $timeout ,dataService, toastService, $mdSidenav, $mdDialog) { + + }]); + + +}); diff --git a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.controller.js new file mode 100644 index 000000000..02c9879a8 --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.controller.js @@ -0,0 +1,127 @@ +/* + * 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.controller('bdmCtrl', ['$scope', '$rootScope','$filter', 'dataService', 'toastService', function ($scope, $rootScope, filter, dataService, toastService) { + + }]); + + + vpp.register.controller('TableController', ['$scope', '$rootScope','$filter', 'dataService', 'toastService', function ($scope, $rootScope, filter, dataService, toastService) { + var vm = this; + vm.rowCollection = dataService.tableContent; + vm.displayedCollection = [].concat(vm.rowCollection); + vm.updateAssignment = function(receivedInterface) { + var interf = _.find(dataService.interfaces, {name: receivedInterface.name, 'phys-address': receivedInterface['phys-address']}); + angular.copy(receivedInterface, interf); + if (interf.assigned){ + interf['v3po:l2']['bridge-domain'] = dataService.selectedBd.name; + } else { + interf['v3po:l2']['bridge-domain'] = ''; + } + dataService.injectBridgeDomainsTopoElements(); + dataService.buildTableContent(); + var previouslyChangedInterface = _.find(dataService.changedInterfaces, {name: interf.name, 'phys-address': interf['phys-address']}); + if (!previouslyChangedInterface) { + dataService.changedInterfaces.push(interf); + } + console.log(dataService.changedInterfaces); + }; + }]); + + vpp.register.controller('BridgeDomainsController', function(dataService, $location, $mdDialog, toastService) { + var vm = this; + vm.dataService = dataService; + + dataService.nextApp.container(document.getElementById('bridge-domains-next-app')); + dataService.bridgeDomainsTopo.attach(dataService.nextApp); + + window.addEventListener('resize', function () { + if ($location.path() === '/bridgedomains') { + dataService.topo.adaptToContainer(); + } + }); + + vm.bridgedomains = dataService.bridgedomains; + vm.selectedBd = dataService.selectedBd; + + dataService.bridgeDomainsTopo.on('clickNode',function(topo,node) { + console.log(node); + }); + + vm.bdChanged = function() { + dataService.injectBridgeDomainsTopoElements(); + dataService.buildTableContent(); + }; + + vm.addBd = function() { + //show dialog + $mdDialog.show({ + controller: function() { + var vm = this; + vm.bd = {}; + vm.waiting = false; + + //function called when the cancel button ( 'x' in the top right) is clicked + vm.close = function() { + $mdDialog.cancel(); + }; + + vm.isDone = function(status) { + vm.waiting = false; + if (status === 'success') { + dataService.bridgedomains.push(vm.bd); + dataService.selectedBd.name = vm.bd.name; + dataService.injectBridgeDomainsTopoElements(); + dataService.buildTableContent(); + vm.close(); + } + }; + + //function called when the update button is clicked + vm.updateConfig = function() { + vm.waiting = true; + //send a POST with the entered content in the form field + + }; + }, + controllerAs: 'NewBdDialogCtrl', + templateUrl: 'templates/new-bd-dialog.html', + parent: angular.element(document.body), + clickOutsideToClose:false + }) + }; + + vm.deploy = function() { + + }; + + vm.removeBd = function() { + if(vm.selectedBd.name) { + var successCallback = function(success) { + if (success) { + console.log(vm.bridgedomains); + _.remove(vm.bridgedomains, { + name: vm.selectedBd.name + }); + toastService.showToast('Bridge Domain Removed!'); + vm.selectedBd.name = ''; + dataService.clearInjectedInterfacesInBridgeDomainTopo(); + dataService.injectBdIntoBridgeDomainsTopo(); + dataService.tableContent.length = 0; + } else { + toastService.showToast('Error removing Bridge Domain!'); + + } + }; + + //... removeBdFromOdl(vm.selectedBd.name, successCallback); + } + }; + }); +});
\ No newline at end of file diff --git a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.interface.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.interface.controller.js new file mode 100644 index 000000000..5aa68a9dc --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.interface.controller.js @@ -0,0 +1,17 @@ +/* + * 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.controller('bdmInterfaceCtrl', ['$scope', '$rootScope', '$timeout' ,'dataService', 'toastService', '$mdSidenav', '$mdDialog', + function ($scope, $rootScope, $timeout ,dataService, toastService, $mdSidenav, $mdDialog) { + + }]); + + +});
\ No newline at end of file diff --git a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.vpp.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.vpp.controller.js new file mode 100644 index 000000000..5ef5c3c6a --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/controllers/bdm.vpp.controller.js @@ -0,0 +1,17 @@ +/* + * 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.controller('bdmVppCtrl', ['$scope', '$rootScope', '$timeout' ,'dataService', 'toastService', '$mdSidenav', '$mdDialog', + function ($scope, $rootScope, $timeout ,dataService, toastService, $mdSidenav, $mdDialog) { + + }]); + + +}); diff --git a/vbd/gui/module/src/main/resources/vpp/vpp.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/inventory.controller.js index acb7d0a5c..f447bd0fb 100644 --- a/vbd/gui/module/src/main/resources/vpp/vpp.controller.js +++ b/vbd/gui/module/src/main/resources/vpp/controllers/inventory.controller.js @@ -6,75 +6,23 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -var modules = ['app/vpp/vpp.module', - 'app/vpp/vpp.services', - ]; - - -define(modules, function(vpp) { - - vpp.register.controller('vppCtrl', ['$scope', '$rootScope', '$timeout' ,'dataService', 'toastService', '$mdSidenav', '$mdDialog', - function ($scope, $rootScope, $timeout ,dataService, toastService, $mdSidenav, $mdDialog) { - $rootScope['section_logo'] = 'src/app/vpp/assets/images/vpp.gif'; - $scope.view_path = 'src/app/vpp/views/'; - - $scope.mainView = "inventory"; - - $scope.setMainView = function(viewName) { - $scope.mainView = viewName; - }; - }]); +define(['app/vpp/vpp.module'], function(vpp) { vpp.register.controller('InventoryTableController', ['$scope', '$rootScope','$filter', 'toastService', 'VppService', '$mdDialog', 'dataService', 'VppInterfaceService', function($scope, $rootScope, filter, toastService, VppService, $mdDialog, dataService, VppInterfaceService) { - $scope.initTable = - - $scope.getInterfaces = function(index) { - VppInterfaceService.getInterfaceList( - $scope.vppList[index].name, - //success callback - function(data) { - var interfaces = data['interfaces-state'].interface; - var vpp = $scope.vppList[index]; - vpp.interfaces = []; - - interfaces.forEach(function(i){ - if (i.name != 'local0') { - vpp.interfaces.push(i); - } - }); - console.log($scope.vppList); - angular.copy($scope.vppList, dataService.vpps); - }, - //error callback - function(res) { - console.error(res); - } - ) - }; - $scope.getVppList = function() { $scope.initVppList(); VppService.getVppList( // success callback function(data) { - if(data.topology.length || data.topology[0].node.length) { - data.topology[0].node.forEach(function(n) { - if(n['node-id'] !== 'controller-config') { - var vppObj = VppService.createObj(n['node-id'], n['netconf-node-topology:host'], n['netconf-node-topology:port'], null, null, n['netconf-node-topology:connection-status']); - $scope.vppList.push(vppObj); - $scope.getInterfaces($scope.vppList.length - 1); //pass index. - } - }); - } - + $scope.vppList = data; $scope.$broadcast('RELOAD_VPP_TABLE'); }, // error callback function(res) { - console.error(res); + console.warn("Can't load VPPs from controller. Nothing is mounted, or other error", res); } ); }; @@ -280,7 +228,7 @@ define(modules, function(vpp) { }; $scope.getVppList(); - }]); + }]); vpp.register.controller('InventoryTableDefinitonController', ['$scope', function($scope) { @@ -292,7 +240,6 @@ define(modules, function(vpp) { $scope.gridOptions = { expandableRowTemplate: $scope.view_path + 'inventory-table-interfaces-subgrid.tpl.html', - expandableRowHeight: 150, //subGridVariable will be available in subGrid scope expandableRowScope: { subGridVariable: 'subGridScopeVariable' @@ -319,9 +266,9 @@ define(modules, function(vpp) { $scope.gridOptions.data = $scope.vppList.map(function(item) { item.subGridOptions = { columnDefs: [ - { name:"Name", field:"name" }, - {name:"Mac Address", field: "phys-address"}, - {name:"Oper. Status", fiels: "oper-status"} + { name:"name" }, + { name:"phys-address"}, + { name:"oper-status"} ], data: item.interfaces }; @@ -331,119 +278,4 @@ define(modules, function(vpp) { }); }]); - - vpp.register.controller('TableController', ['$scope', '$rootScope','$filter', 'dataService', 'toastService', function ($scope, $rootScope, filter, dataService, toastService) { - var vm = this; - vm.rowCollection = dataService.tableContent; - vm.displayedCollection = [].concat(vm.rowCollection); - vm.updateAssignment = function(receivedInterface) { - var interf = _.find(dataService.interfaces, {name: receivedInterface.name, 'phys-address': receivedInterface['phys-address']}); - angular.copy(receivedInterface, interf); - if (interf.assigned){ - interf['v3po:l2']['bridge-domain'] = dataService.selectedBd.name; - } else { - interf['v3po:l2']['bridge-domain'] = ''; - } - dataService.injectBridgeDomainsTopoElements(); - dataService.buildTableContent(); - var previouslyChangedInterface = _.find(dataService.changedInterfaces, {name: interf.name, 'phys-address': interf['phys-address']}); - if (!previouslyChangedInterface) { - dataService.changedInterfaces.push(interf); - } - console.log(dataService.changedInterfaces); - }; - }]); - - vpp.register.controller('BridgeDomainsController', function(dataService, $location, $mdDialog, toastService) { - var vm = this; - vm.dataService = dataService; - - dataService.nextApp.container(document.getElementById('bridge-domains-next-app')); - dataService.bridgeDomainsTopo.attach(dataService.nextApp); - - window.addEventListener('resize', function () { - if ($location.path() === '/bridgedomains') { - dataService.topo.adaptToContainer(); - } - }); - - vm.bridgedomains = dataService.bridgedomains; - vm.selectedBd = dataService.selectedBd; - - dataService.bridgeDomainsTopo.on('clickNode',function(topo,node) { - console.log(node); - }); - - vm.bdChanged = function() { - dataService.injectBridgeDomainsTopoElements(); - dataService.buildTableContent(); - }; - - vm.addBd = function() { - //show dialog - $mdDialog.show({ - controller: function() { - var vm = this; - vm.bd = {}; - vm.waiting = false; - - //function called when the cancel button ( 'x' in the top right) is clicked - vm.close = function() { - $mdDialog.cancel(); - }; - - vm.isDone = function(status) { - vm.waiting = false; - if (status === 'success') { - dataService.bridgedomains.push(vm.bd); - dataService.selectedBd.name = vm.bd.name; - dataService.injectBridgeDomainsTopoElements(); - dataService.buildTableContent(); - vm.close(); - } - }; - - //function called when the update button is clicked - vm.updateConfig = function() { - vm.waiting = true; - //send a POST with the entered content in the form field - - }; - }, - controllerAs: 'NewBdDialogCtrl', - templateUrl: 'templates/new-bd-dialog.html', - parent: angular.element(document.body), - clickOutsideToClose:false - }) - }; - - vm.deploy = function() { - - }; - - vm.removeBd = function() { - if(vm.selectedBd.name) { - var successCallback = function(success) { - if (success) { - console.log(vm.bridgedomains); - _.remove(vm.bridgedomains, { - name: vm.selectedBd.name - }); - toastService.showToast('Bridge Domain Removed!'); - vm.selectedBd.name = ''; - dataService.clearInjectedInterfacesInBridgeDomainTopo(); - dataService.injectBdIntoBridgeDomainsTopo(); - dataService.tableContent.length = 0; - } else { - toastService.showToast('Error removing Bridge Domain!'); - - } - }; - - //... removeBdFromOdl(vm.selectedBd.name, successCallback); - } - }; - }); -}); - - +});
\ No newline at end of file diff --git a/vbd/gui/module/src/main/resources/vpp/controllers/vpp.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/vpp.controller.js new file mode 100644 index 000000000..6b2dde830 --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/controllers/vpp.controller.js @@ -0,0 +1,48 @@ +/* + * 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 + */ + +var modules = [ + // module + 'app/vpp/vpp.module', + // services + 'app/vpp/services/vpp.services', + 'app/vpp/services/inventory.service', + 'app/vpp/services/bdm.service', + 'app/vpp/services/bdm.bridgedomain.service', + 'app/vpp/services/bdm.interface.service', + 'app/vpp/services/bdm.vpp.service', + //controllers + 'app/vpp/controllers/inventory.controller', + 'app/vpp/controllers/bdm.controller', + 'app/vpp/controllers/bdm.bridgedomain.controller', + 'app/vpp/controllers/bdm.vpp.controller', + 'app/vpp/controllers/bdm.interface.controller' +]; + + +define(modules, function(vpp) { + + vpp.controller('vppCtrl', ['$scope', '$rootScope', '$timeout', 'toastService', '$mdSidenav', '$mdDialog', + function ($scope, $rootScope, $timeout, toastService, $mdSidenav, $mdDialog) { + + $rootScope['section_logo'] = 'src/app/vpp/assets/images/vpp.gif'; + $scope.view_path = 'src/app/vpp/views/'; + + $scope.mainView = "inventory"; + + $scope.setMainView = function(viewName) { + $scope.mainView = viewName; + }; + + + }]); + + +}); + + 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 new file mode 100644 index 000000000..9316cbff7 --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/services/bdm.bridgedomain.service.js @@ -0,0 +1,14 @@ +/* + * 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('bdmBridgeDomainService', 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.interface.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.interface.service.js new file mode 100644 index 000000000..9dca2d29d --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/services/bdm.interface.service.js @@ -0,0 +1,14 @@ +/* + * 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('bdmInterfaceService', 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.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.service.js new file mode 100644 index 000000000..5d6592787 --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/services/bdm.service.js @@ -0,0 +1,14 @@ +/* + * 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.vpp.service.js b/vbd/gui/module/src/main/resources/vpp/services/bdm.vpp.service.js new file mode 100644 index 000000000..5a23d831c --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/services/bdm.vpp.service.js @@ -0,0 +1,14 @@ +/* + * 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('bdmVppService', function(VPPRestangular, VPPRestangularXml) { + var s = {}; + + 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 new file mode 100644 index 000000000..a90354fb4 --- /dev/null +++ b/vbd/gui/module/src/main/resources/vpp/services/inventory.service.js @@ -0,0 +1,142 @@ +/* + * 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) { + //if(data.topology.length || data.topology[0].node.length) { + 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; + }); + // add promise to array + promiseList.push(promise); + // when promise is resolved, push vpp into vppList + promise.then(function () { + vppList.push(vppObj); + }) + } + 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) { + 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); + }); + }; + + return s; + }); +});
\ No newline at end of file diff --git a/vbd/gui/module/src/main/resources/vpp/vpp.services.js b/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js index 49337b109..70b1631f7 100644 --- a/vbd/gui/module/src/main/resources/vpp/vpp.services.js +++ b/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js @@ -159,102 +159,6 @@ define(['app/vpp/vpp.module', 'next'], function(vpp) { }); - vpp.register.factory('VppService', function(VPPRestangular, VPPRestangularXml) { - 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; - }; - - s.createObj = function(name, ipAddress, port, username, password, status) { - return new Vpp(name, ipAddress, port, username, password, status); - }; - - s.getVppList = function(successCallback, errorCallback) { - var restObj = VPPRestangular.one('restconf').one('operational').one('network-topology:network-topology').one('topology').one('topology-netconf'); - - restObj.get().then(function(data) { - successCallback(data); - }, 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) { - var s = {}; - - s.getInterfaceList = function(vppName,successCallback, errorCallback) { - 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'); - - restObj.get().then(function(data) { - successCallback(data); - }, function(res) { - errorCallback(res); - }); - }; - - return s; - }); });
\ No newline at end of file diff --git a/vbd/gui/module/src/main/resources/vpp/vpp.module.js b/vbd/gui/module/src/main/resources/vpp/vpp.module.js index 7d6ed8568..56a1852de 100644 --- a/vbd/gui/module/src/main/resources/vpp/vpp.module.js +++ b/vbd/gui/module/src/main/resources/vpp/vpp.module.js @@ -26,7 +26,7 @@ define(['angularAMD', 'app/routingConfig', 'ui-bootstrap', 'Restangular', 'angul service : $provide.service }; - NavHelperProvider.addControllerUrl('app/vpp/vpp.controller'); + NavHelperProvider.addControllerUrl('app/vpp/controllers/vpp.controller'); NavHelperProvider.addToMenu('vpp', { "link": "#/vpp/index", "active": "main.vpp", @@ -108,29 +108,6 @@ define(['angularAMD', 'app/routingConfig', 'ui-bootstrap', 'Restangular', 'angul }) .accentPalette('odl-orange'); - // $stateProvider.state('main.vpp.inventory', { - // url: '/inventory', - // access: access.admin, - // views: { - // '': { - // controller: 'InventoryController', - // controllerAs: 'InventoryCtrl', - // templateUrl: 'src/app/vpp/views/inventory.html' - // } - // } - // }); - - // $stateProvider.state('main.vpp.bridgedomains', { - // url: '/bridgedomains', - // access: access.admin, - // views: { - // '': { - // controller: 'BridgeDomainsController', - // controllerAs: 'BridgeDomainsCtrl', - // templateUrl: 'src/app/vpp/views/bridge-domains.html' - // } - // } - // }); }); return vpp; |