summaryrefslogtreecommitdiffstats
path: root/vbd/gui/module/src/main/resources/vpp/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'vbd/gui/module/src/main/resources/vpp/controllers')
-rw-r--r--vbd/gui/module/src/main/resources/vpp/controllers/bdm.bridgedomain.controller.js18
-rw-r--r--vbd/gui/module/src/main/resources/vpp/controllers/bdm.controller.js541
-rw-r--r--vbd/gui/module/src/main/resources/vpp/controllers/bdm.interface.controller.js17
-rw-r--r--vbd/gui/module/src/main/resources/vpp/controllers/bdm.vpp.controller.js14
-rw-r--r--vbd/gui/module/src/main/resources/vpp/controllers/inventory.controller.js253
-rw-r--r--vbd/gui/module/src/main/resources/vpp/controllers/vpp.controller.js64
6 files changed, 0 insertions, 907 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
deleted file mode 100644
index ea65afbc9..000000000
--- a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.bridgedomain.controller.js
+++ /dev/null
@@ -1,18 +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.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
deleted file mode 100644
index f88162ef6..000000000
--- a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.controller.js
+++ /dev/null
@@ -1,541 +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.controller('bdmCtrl', ['$scope', '$rootScope','$filter', 'dataService', 'toastService', function ($scope, $rootScope, filter, dataService, toastService) {
-
- }]);
-
- vpp.register.controller('TableController', ['$scope', '$rootScope','$filter', 'dataService', 'toastService', 'bdmInterfaceService',
- function ($scope, $rootScope, filter, dataService, toastService, bdmInterfaceService) {
- $scope.interfaceList = [];
- $scope.unassignedInterfaceList = [];
- $scope.assignedInterfaces = [];
-
- var vm = this;
-
- vm.updateAssignment = function(receivedInterface) {
- if (receivedInterface.assigned){
- receivedInterface.vbdName = $scope.selectedBd['topology-id'];
- vm.assignInterface($scope.selectedBd, receivedInterface);
-
- } else {
- vm.unassignInterface(receivedInterface);
- }
- };
-
- vm.assignInterface = function(bridgeDomain, interface) {
- var interfaceObject = bdmInterfaceService.createObj(interface['tp-id'], interface['tp-id']);
-
- var successCallback = function() {
- toastService.showToast('Interface assigned');
- $scope.assignedInterfaces.push(interface);
-
- $scope.$emit('INTERFACE_CHANGED', interface);
- };
-
- var errorCallback = function() {
- toastService.showToast('Unable to assign interface');
- };
-
- bdmInterfaceService.add(interfaceObject, bridgeDomain['topology-id'], interface.vppName, successCallback, errorCallback);
- };
-
- vm.unassignInterface = function(interface) {
- var interfaceObject = bdmInterfaceService.createObj(interface['tp-id'], interface['tp-id']);
-
- var successCallback = function() {
- toastService.showToast('Interface unassigned');
- $scope.assignedInterfaces.splice($scope.assignedInterfaces.indexOf(interface), 1);
- interface.vbdName = '';
-
- $scope.$emit('INTERFACE_CHANGED', interface);
- };
-
- var errorCallback = function() {
- toastService.showToast('Unable to unassign interface');
- };
-
- bdmInterfaceService.delete(interfaceObject, interface.vbdName, interface.vppName, successCallback, errorCallback);
-
- };
-
- $scope.$on('BUILD_INTERFACES_TABLE', function(event) {
- $scope.interfaceList = [];
- $scope.unassignedInterfaceList = [];
- $scope.assignedInterfaces = $scope.getAssignedInterfaces();
-
- $scope.assignedInterfacesFlat = [];
-
- var getAssignedInterfacesFlat = function() {
- var keys = Object.keys($scope.assignedInterfaces);
-
- if(keys.length) {
- keys.forEach(function (k) {
- if($scope.assignedInterfaces[k]) {
- $scope.assignedInterfaces[k].forEach(function(ai) {
- checkAndPushIntoArray($scope.assignedInterfacesFlat, ai);
- });
- }
- });
- }
- };
-
- var checkAndPushIntoArray = function(array, item) {
- var check = array.some(function(i) {
- return i['tp-id'] === item['tp-id'] && i.vppName === item.vppName;
- });
-
- if(!check) {
- array.push(item);
- }
- };
-
- getAssignedInterfacesFlat();
-
- dataService.vpps.forEach(function(vpp){
- vpp.interfaces.forEach(function(interface){
- var interfaceObject = bdmInterfaceService.createObj(interface.name, interface.name);
-
- var check = $scope.assignedInterfacesFlat.some(function (ai) {
- return interfaceObject['tp-id'] === ai['tp-id'] && vpp.name === ai.vppName;
- });
-
- if(!check) {
- interfaceObject.vppName = vpp.name;
- checkAndPushIntoArray($scope.unassignedInterfaceList, interfaceObject);
- }
- });
- });
-
- if($scope.selectedBd) {
- $scope.interfaceList = $scope.assignedInterfaces[$scope.selectedBd['topology-id']] ? $scope.assignedInterfaces[$scope.selectedBd['topology-id']].concat($scope.unassignedInterfaceList) : $scope.unassignedInterfaceList;
- }
-
- $scope.interfaceDisplayList = [].concat($scope.interfaceList);
- });
-
- $scope.$on('INIT_INTERFACES_TABLE', function(event) {
- $scope.interfaceList = [];
- $scope.unassignedInterfaceList = [];
- $scope.assignedInterfaces = [];
- $scope.assignedInterfacesFlat = [];
- });
-
-
-
- }]);
-
- vpp.register.controller('BridgeDomainsController', ['$scope', '$rootScope','$filter', 'dataService', 'bdmBridgeDomainService', 'toastService', '$mdDialog', 'bdmTunnelService',
- function($scope, $rootScope, $filter, dataService, bdmBridgeDomainService, toastService, $mdDialog, bdmTunnelService) {
- $scope.bridgeDomainList = [];
- $scope.showOverlay = true;
-
- $scope.loadBridgeDomains = function(bridgeDomain, successCallback) {
- bdmBridgeDomainService.get(function(data) {
- $scope.bridgeDomainList = data;
-
- if(bridgeDomain) {
- $scope.selectedBd = $scope.bridgeDomainList.filter(function(bd) {
- return bd['topology-id'] === bridgeDomain['topology-id'];
- })[0];
-
- $scope.showTopology($scope.selectedBd);
- }
-
- successCallback();
-
- }, function(data,status) {
- //error callback
- console.log(status);
- });
- };
-
- $scope.getInterfacesForBridgeDomain = function(bridgeDomain) {
- var interfaceList = [];
-
- if(bridgeDomain.node) {
- bridgeDomain.node.forEach(function (n) {
- if (n['termination-point']) {
- n['termination-point'].forEach(function (tp) {
- tp.vppName = n['node-id'];
- tp.vbdName = bridgeDomain['topology-id'];
- tp.assigned = true;
-
- interfaceList.push(tp);
- });
- }
- });
- }
-
- return interfaceList;
- };
-
- $scope.getAssignedInterfaces = function() {
- var interfaces = [];
-
- $scope.bridgeDomainList.forEach(function(bd) {
- var bdCopy = {};
- angular.copy(bd, bdCopy);
-
- interfaces[bdCopy['topology-id']] = $scope.getInterfacesForBridgeDomain(bdCopy);
- });
-
- return interfaces;
- };
-
- $scope.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, bridgeDomain) {
- vm.waiting = false;
- if (status === 'success') {
- $scope.reload(bridgeDomain);
- 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
-
- var obj = bdmBridgeDomainService.createObj(vm.bd.name);
-
- bdmBridgeDomainService.add(obj,
- function(data) {
- vm.isDone('success', obj);
- },
- function() {
- vm.isDone('failed');
- });
-
- };
- },
- controllerAs: 'NewBdDialogCtrl',
- templateUrl: $scope.view_path + 'new-bd-dialog.html',
- parent: angular.element(document.body),
- clickOutsideToClose:false
- })
- };
-
- $scope.removeBd = function() {
- if($scope.selectedBd['topology-id']) {
- var successCallback = function(success) {
- $scope.selectedBd = null;
- $scope.loadBridgeDomains(null, function() {
- $scope.$broadcast('INIT_INTERFACES_TABLE');
- $scope.clearTopologies();
- });
-
- };
- bdmBridgeDomainService.remove($scope.selectedBd['topology-id'], function(){successCallback(true)}, function(){successCallback(false)});
- }
- };
-
- $scope.bdChanged = function() {
- $scope.loadBridgeDomains($scope.selectedBd, function() {
- $scope.$broadcast('BUILD_INTERFACES_TABLE');
-
- $scope.showTopology($scope.selectedBd);
- });
-
- };
-
- nx.graphic.Icons.registerIcon("bd", "src/app/vpp/assets/images/bd1.svg", 45, 45);
- nx.graphic.Icons.registerIcon("interf", "src/app/vpp/assets/images/interf.svg", 45, 45);
-
- $scope.showOverlayTopology = function(bridgeDomain) {
- var bdCopy = {};
- angular.copy(bridgeDomain, bdCopy);
-
- $scope.bridgeDomainsTopo = new nx.graphic.Topology({
- adaptive: true,
- scalable: true,
- theme: 'blue',
- enableGradualScaling: true,
- nodeConfig: {
- color: '#414040',
- label: 'model.label',
- scale: 'model.scale',
- iconType: function (vertex) {
- var type = vertex.get().type;
- if (type === 'bd') {
- return 'bd'
- } else {
- return 'interf';
- }
- }
- },
- linkConfig: {
- label: 'model.label',
- linkType: 'parallel',
- color: function (link) {
- if (link.getData().type === 'tunnel') {
- return '#00FF00';
- } else {
- return '#ffffff';
- }
- },
- width: function (link) {
- if (link.getData().type === 'tunnel') {
- return 5;
- }
- }
- },
- showIcon: true,
- dataProcessor: 'force',
- autoLayout: true,
- enableSmartNode: false,
- tooltipManagerConfig: {
- nodeTooltipContentClass: 'TooltipNode',
- linkTooltipContentClass: 'TooltipLink'
- }
- });
-
- $scope.overlayNextApp = new nx.ui.Application;
-
- var bdNode = {
- "data": bdCopy,
- "type": "bd",
- "label": bdCopy['topology-id']
- };
-
- var nodes = [].concat(bdNode);
- var links = [];
-
- _.forEach($scope.getInterfacesForBridgeDomain(bdCopy), function(tp, index){
- var ifNode = {
- "data": tp,
- "type": "interf",
- "label": tp['tp-id']
- };
- nodes.push(ifNode);
- links.push({source: 0, target: nodes.length-1});
- });
-
-
- $scope.bridgeDomainsTopo.data({
- nodes: nodes,
- links: links
- });
-
- $scope.overlayNextApp.container(document.getElementById('overlay-next-app'));
- $scope.bridgeDomainsTopo.attach($scope.overlayNextApp);
- };
-
- $scope.fillOverlayTopology = function(bridgeDomain) {
- var bdCopy = {};
- angular.copy(bridgeDomain, bdCopy);
-
- var bdNode = {
- "data": bdCopy,
- "type": "bd",
- "label": bdCopy['topology-id']
- };
-
- var nodes = [].concat(bdNode);
- var links = [];
-
- _.forEach($scope.getInterfacesForBridgeDomain(bdCopy), function(tp, index){
- var ifNode = {
- "data": tp,
- "type": "interf",
- "label": tp['tp-id']
- };
- nodes.push(ifNode);
- links.push({source: 0, target: nodes.length-1});
- });
-
-
- $scope.bridgeDomainsTopo.data({
- nodes: nodes,
- links: links
- });
-
- };
-
- $scope.showUnderTopology = function(bridgeDomain) {
- //var bdCopy = {};
- //angular.copy(bridgeDomain, bdCopy);
-
- $scope.underlayTopo = new nx.graphic.Topology({
- adaptive: true,
- scalable: true,
- theme:'blue',
- enableGradualScaling:true,
- nodeConfig: {
- color: '#414040',
- label: 'model.label',
- scale: 'model.scale',
- iconType: function(vertex) {
- var type = vertex.get().type;
- if (type === 'bd') {
- return 'bd';
- } else if (type==='vpp') {
- return 'switch';
- } else {
- return 'interf';
- }
- }
- },
- linkConfig: {
- label: 'model.label',
- linkType: 'parallel',
- color: function(link) {
- if (link.getData().type === 'tunnel') {
- return '#00FF00';
- } else {
- return '#ffffff';
- }
- },
- width: function(link) {
- if (link.getData().type === 'tunnel') {
- return 5;
- }
- }
- },
- showIcon: true,
- enableSmartNode: false
- });
-
- $scope.underlayNextApp = new nx.ui.Application;
-
- $scope.fillUnderlayTopology(bridgeDomain);
-
- $scope.underlayNextApp.container(document.getElementById('underlay-next-app'));
- $scope.underlayTopo.attach($scope.underlayNextApp);
- };
-
- $scope.fillUnderlayTopology = function(bridgeDomain) {
- var bdCopy = {};
- angular.copy(bridgeDomain, bdCopy);
-
- var nodes = [];
- var links = [];
-
- _.forEach(bdCopy.node, function(node, index){
- var i = index + 1;
-
- nodes.push({
- label: node['node-id'],
- x: (-1+(2*(i%2)))*((i+1)/2 * 500),
- y: 700,
- scale: 1.25,
- type: 'vpp'
- });
-
-
- bdmTunnelService.get(
- bdCopy['topology-id'],
- function(data) {
- //success
- console.log(data);
-
- var link = data;
- var sourceNode = link[0].source['source-node'];
- var targetNode = link[0].destination['dest-node'];
-
- links.push({
- source: _.findIndex(nodes, {label: sourceNode, type: 'vpp'}),
- target: _.findIndex(nodes, {label: targetNode, type: 'vpp'}),
- type: 'tunnel'
- });
-
- $scope.underlayTopo.data({
- nodes: nodes,
- links: links
- });
-
- }, function(res) {
- $scope.underlayTopo.data({
- nodes: nodes,
- links: links
- });
- });
- });
-
-
- $scope.underlayTopo.data({
- nodes: nodes,
- links: links
- });
- };
-
- $scope.reload = function(bridgeDomain) {
- $scope.loadBridgeDomains(bridgeDomain, function() {
- $scope.$broadcast('BUILD_INTERFACES_TABLE');
-
- $scope.showTopology($scope.selectedBd);
- });
-
- };
-
- $scope.toggleUnderlay = function() {
- $scope.showOverlay = !$scope.showOverlay;
-
- $scope.reload($scope.selectedBd);
- };
-
- $scope.showTopology = function(bridgeDomain) {
- if($scope.showOverlay) {
- if(!$scope.bridgeDomainsTopo) {
- $scope.showOverlayTopology(bridgeDomain);
- }
- else {
- $scope.fillOverlayTopology(bridgeDomain);
- }
- } else {
- if(!$scope.underlayTopo) {
- $scope.showUnderTopology(bridgeDomain);
- }
- else {
- $scope.fillUnderlayTopology(bridgeDomain);
- }
- }
- };
-
- $scope.clearTopologies = function() {
- if($scope.bridgeDomainsTopo) {
- $scope.bridgeDomainsTopo.data({
- nodes: [],
- links: []
- });
- }
-
- if($scope.bridgeDomainsTopo) {
- $scope.underlayTopo.data({
- nodes: [],
- links: []
- });
- }
- };
-
- $scope.$on('INTERFACE_CHANGED', function(event, data) {
- bdmBridgeDomainService.getOne($scope.selectedBd['topology-id'],
- function(bdData) {
- $scope.fillOverlayTopology(bdData);
- },
- function() {
- console.log('error getting vbd');
- });
- });
-
- $scope.loadBridgeDomains(null, function() {});
- }]);
-}); \ 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
deleted file mode 100644
index 5aa68a9dc..000000000
--- a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.interface.controller.js
+++ /dev/null
@@ -1,17 +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.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
deleted file mode 100644
index 44a4b0cf2..000000000
--- a/vbd/gui/module/src/main/resources/vpp/controllers/bdm.vpp.controller.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'], function(vpp) {
- vpp.register.controller('bdmCtrl', ['$scope', '$rootScope','$filter', 'dataService', 'toastService', function ($scope, $rootScope, filter, dataService, toastService) {
-
- }]);
-
-}); \ No newline at end of file
diff --git a/vbd/gui/module/src/main/resources/vpp/controllers/inventory.controller.js b/vbd/gui/module/src/main/resources/vpp/controllers/inventory.controller.js
deleted file mode 100644
index 6d994c152..000000000
--- a/vbd/gui/module/src/main/resources/vpp/controllers/inventory.controller.js
+++ /dev/null
@@ -1,253 +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.controller('InventoryTableController', ['$scope', '$rootScope','$filter', 'toastService', 'VppService', '$mdDialog', 'dataService',
- function($scope, $rootScope, filter, toastService, VppService, $mdDialog, dataService) {
-
- $scope.getVppList = function() {
- $scope.initVppList();
-
- VppService.getVppList(
- // success callback
- function(data) {
- $scope.vppList = data;
- $scope.displayVppList = [].concat($scope.vppList);
- dataService.vpps = $scope.vppList;
-
- $scope.$broadcast('RELOAD_VPP_TABLE');
-
- //for vppList access in BDM
- dataService.vpps = $scope.vppList;
- },
- // error callback
- function(res) {
- console.warn("Can't load VPPs from controller. Nothing is mounted, or other error", res);
- }
- );
- };
-
- $scope.initVppList = function() {
- $scope.vppList = [];
- $scope.displayVppList = [];
- };
-
- $scope.addVppShowForm = function() {
- $mdDialog.show({
- controller: function() {
- var vm = this;
- vm.vpp = {};
- //function called when the cancel button ( 'x' in the top right) is clicked
- vm.close = function() {
- $mdDialog.cancel();
- };
-
- vm.finished = function(successful) {
- if (successful) {
- vm.close();
- vm.waiting = false;
- toastService.showToast('New VPP added!');
- $scope.getVppList();
- } else {
- vm.waiting = false;
- toastService.showToast('Error adding new VPP');
- }
- };
-
- //function called when the update button is clicked
- vm.updateConfig = function() {
- vm.waiting = true;
- VppService.mountVpp(vm.vpp.name, vm.vpp.ip, vm.vpp.port, vm.vpp.un, vm.vpp.pw, vm.finished);
- };
- },
- controllerAs: 'NewVppDialogCtrl',
- templateUrl: $scope.view_path + 'new-vpp-dialog.html',
- parent: angular.element(document.body),
- clickOutsideToClose:false
- })
- };
-
- $scope.editVppShowForm = function(vppObject) {
-
- $mdDialog.show({
- controller: function() {
- var vm = this;
-
- vm.vpp = {
- name: vppObject.name,
- status: vppObject.status,
- ip: vppObject.ipAddress,
- port: vppObject.port
- };
-
- //function called when the cancel button ( 'x' in the top right) is clicked
- vm.close = function() {
- $mdDialog.cancel();
- };
-
- vm.finishedUpdating = function(successful) {
- if (successful) {
- vm.close();
- vm.waiting = false;
- toastService.showToast('VPP configuration updated!');
- $scope.getVppList();
- } else {
- vm.waiting = false;
- toastService.showToast('Error configuring VPP');
- }
- };
-
- vm.finishedDeleting = function(successful) {
- if (successful) {
- VppService.mountVpp(vm.vpp.name, vm.vpp.ip, vm.vpp.port, vm.vpp.un, vm.vpp.pw, vm.finishedUpdating);
- $scope.getVppList();
- } else {
- vm.waiting = false;
- toastService.showToast('Error configuring VPP');
- }
- };
-
- //function called when the update button is clicked
- vm.updateConfig = function() {
- //VppService.editVpp(vm.vpp.name, vm.vpp.ip, vm.vpp.port, vm.vpp.un, vm.vpp.pw, vm.finishedUpdating);
- VppService.deleteVpp(vm.vpp, vm.finishedDeleting);
- };
- },
- controllerAs: 'ConfigVppDialogCtrl',
- templateUrl: $scope.view_path + 'config-vpp-dialog.html',
- parent: angular.element(document.body),
- clickOutsideToClose:true
- });
- };
-
- $scope.deleteVpp = function(vppObject) {
-
- var finished = function(successful) {
- if (successful) {
- toastService.showToast('Removed VPP!');
- $scope.getVppList();
- } else {
- toastService.showToast('Error removing VPP');
- }
- };
-
- VppService.deleteVpp(vppObject, finished);
- };
-
- $scope.getVppList();
- }]);
-
- vpp.register.controller('InventoryDetailController', ['$scope', '$rootScope','$filter', 'toastService', 'dataService',
- function($scope, $rootScope, filter, toastService, dataService) {
- $scope.displayInterfaceList = [].concat($scope.selectedVpp.interfaces);
- $scope.vppList = dataService.vpps;
-
- $scope.viewTopology = function(vpp) {
-
- var vm = this;
-
- $scope.topo = new nx.graphic.Topology({
- height: 400,
- width: 800,
- scalable: true,
- theme:'blue',
- enableGradualScaling:true,
- nodeConfig: {
- color: '#ffffff',
- label: 'model.label',
- scale: 'model.scale',
- iconType: function(vertex) {
- var type = vertex.get().type;
- if (type === 'bd') {
- return 'bd'
- } else if (type === 'vpp') {
- return 'switch'
- } else {
- return 'interf';
- }
- }
- },
- linkConfig: {
- label: 'model.label',
- linkType: 'parallel',
- color: function(link) {
- if (link.getData().type === 'tunnel') {
- return '#ffffff';
- } else {
- return '#ffffff';
- }
- },
- width: function(link) {
- if (link.getData().type === 'tunnel') {
- return 5;
- }
- }
- },
- showIcon: true,
- dataProcessor: 'force',
- autoLayout: true,
- enableSmartNode: false,
- tooltipManagerConfig: {
- nodeTooltipContentClass: 'TooltipNode',
- linkTooltipContentClass: 'TooltipLink'
- }
- });
- $scope.app = new nx.ui.Application;
-
- vm.vpp = vpp;
- vm.vpp.type = 'vpp';
- vm.vpp.label = vm.vpp.name;
-
- var nodes = [].concat(vm.vpp);
- var links = [];
-
- _.forEach(vm.vpp.interfaces, function(interf, index){
- interf.label = interf.name;
- interf.scale = 0.5;
- nodes.push(interf);
- links.push({source: 0, target: index + 1});
- });
-
- $scope.topo.data({
- nodes: nodes,
- links: links
- });
-
- $scope.app.container(document.getElementById('next-vpp-topo'));
- $scope.topo.attach($scope.app);
-
- };
-
- $scope.fillTopologyData = function(vpp) {
- var nodes = [].concat(vpp);
- var links = [];
- vpp.type = 'vpp';
- vpp.label = vpp.name;
-
- _.forEach(vpp.interfaces, function(interf, index){
- interf.label = interf.name;
- interf.scale = 0.5;
- nodes.push(interf);
- links.push({source: 0, target: index + 1});
- });
-
- $scope.topo.data({
- nodes: nodes,
- links: links
- });
- };
-
- $scope.$watch('selectedVpp', function() {
- $scope.fillTopologyData($scope.selectedVpp);
- });
-
- $scope.viewTopology($scope.selectedVpp);
-
- }]);
-}); \ 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
deleted file mode 100644
index 5bd2c955e..000000000
--- a/vbd/gui/module/src/main/resources/vpp/controllers/vpp.controller.js
+++ /dev/null
@@ -1,64 +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
- */
-
-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',
- 'app/vpp/services/bdm.tunnel.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.selectedVpp = null;
-
- $scope.setMainView = function(viewName) {
- $scope.mainView = viewName;
- };
-
- $scope.selectVpp = function(vpp) {
- $scope.selectedVpp = vpp;
- $scope.$broadcast('RELOAD_SELECTED_VPP');
- };
-
- // filter used in inventory to filter interfaceList of vxlan_tunnel interfaces
- $scope.filterRemoveVxlanIf = function (item) {
- return (item.name && item.name.indexOf('vxlan') !== 0) || (item['tp-id'] && item['tp-id'].indexOf('vxlan') !== 0);
- };
-
- // filter used in inventory to return vxlan_tunnel interfaces
- $scope.filterGetVxlanIf = function (item) {
- return (item.name && item.name.indexOf('vxlan') === 0) || (item['tp-id'] && item['tp-id'].indexOf('vxlan') === 0);
- };
-
- }]);
-
-
-});
-
-