From 73353537994c067cd6eea24545efc53df08b4a1a Mon Sep 17 00:00:00 2001 From: Daniel Malachovsky Date: Thu, 11 Feb 2016 14:13:09 +0100 Subject: Underlay added - bd manager rewritten - underlay topo functional - lot of cleaning Change-Id: I48e259aaf341eb0a1c09e6b25dd411d525d854c1 Signed-off-by: Varun Seereeram Signed-off-by: Daniel Malachovsky --- .../main/resources/vpp/services/vpp.services.js | 236 +-------------------- 1 file changed, 1 insertion(+), 235 deletions(-) (limited to 'vbd/gui/module/src/main/resources/vpp/services/vpp.services.js') 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 index 1e9d20b23..19cee135b 100644 --- a/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js +++ b/vbd/gui/module/src/main/resources/vpp/services/vpp.services.js @@ -30,251 +30,17 @@ define(['app/vpp/vpp.module', 'next'], function(vpp) { } }); - vpp.register.service('dataService', ['$timeout', function($timeout) { + vpp.register.service('dataService', ['$timeout', 'bdmTunnelService',function($timeout, bdmTunnelService) { var self = this; - 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); - - this.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' - } - }); - this.nextApp = new nx.ui.Application; - this.bridgedomainsLoaded = false; - this.vpps = []; - this.tableContent = []; - this.originalAssignments = []; this.interfaces = []; - this.injectedInterfaces = []; - this.bridgedomains = []; - this.changedInterfaces = []; this.selectedBd = { name: '' }; - this.generateInterfaces = function() { - self.interfaces.length = 0; - _.forEach(this.vpps, function(vpp) { - _.forEach(vpp.interfaces, function(interf) { - interf.vppName = vpp.name; - interf.label = vpp.name+'/'+interf.name; - interf.scale = 0.5; - self.interfaces.push(interf); - }); - }); - console.log(this.interfaces); - }; - - this.buildAssignedInterfaces = function() { - this.originalAssignments.length = 0; - _.forEach(this.bridgedomains, function(bd){ - var bdName = bd['topology-id']; - var nodes = bd.node; - if (nodes) { - _.forEach(nodes, function(vpp) { - var vppName = vpp['node-id']; - var tps = vpp['termination-point']; - if (tps) { - _.forEach(tps, function(tp) { - tp.vppName = vppName; - tp.vbd = bdName; - self.originalAssignments.push(tp); - }) - } - }) - } - }); - - console.log('Assigned Interfaces: '); - console.log(this.originalAssignments); - }; - - this.buildTableContent = function() { - this.tableContent.length = 0; - angular.copy(this.interfaces,this.tableContent); - - - //Makes assignements based on previously changed interfaces, or assignments retrieved from ODL - _.forEach(this.tableContent, function(interf) { - var matchedChangedInterface = _.find(self.changedInterfaces, { - name: interf.name, - vppName: interf.vppName - }); - - var matchedOriginalAssignment = _.find(self.originalAssignments, { - 'vbridge-topology:user-interface': interf.name, - vppName: interf.vppName - }); - - if (matchedChangedInterface) { - interf.assigned = matchedChangedInterface.assigned; - interf.vbd = matchedChangedInterface.vbd; - } else if (matchedOriginalAssignment) { - interf.assigned = true; - interf.vbd = matchedOriginalAssignment.vbd; - } else { - interf.assigned = false; - interf.vbd = ''; - } - }); - - _.remove(self.tableContent, function(interf){ - var isAssigned = interf.assigned === true; - var isNotCorrectBd = !(interf.vbd === self.selectedBd.name); - return(isAssigned && isNotCorrectBd); - }); - - //_.forEach(this.originalAssignments, function(origAssignment) { - // if (origAssignment.vbd === self.selectedBd.name) { - // var matchedInterface = _.find(self.tableContent, { - // name: origAssignment['vbridge-topology:user-interface'], - // vppName: origAssignment.vppName - // }); - // if (matchedInterface) { - // matchedInterface.assigned = true; - // matchedInterface.vbd = origAssignment.vbd; - // } else { - // console.error('Interface "'+origAssignment['vbridge-topology:user-interface']+'" on VPP "'+origAssignment.vppName+'" in vBD "'+origAssignment.vbd+'" was not found at mount point!'); - // } - // } else { - // _.remove(self.tableContent, { - // name: origAssignment['vbridge-topology:user-interface'], - // vppName: origAssignment.vppName - // }); - // } - //}); - // - //_.forEach(this.changedInterfaces, function(changedInterface) { - // - // var matchedInterface = _.find(self.tableContent, { - // name: changedInterface.name, - // vppName: changedInterface.vppName - // }); - // - // if (matchedInterface) { - // if (changedInterface.assigned) { - // if (changedInterface.vbd === self.selectedBd.name) { - // matchedInterface.assigned = true; - // matchedInterface.vbd = changedInterface.vbd; - // } - // else { - // _.remove(self.tableContent, { - // name: changedInterface.name, - // vppName: changedInterface.vppName - // }); - // } - // } else { - // matchedInterface.assigned = false; - // matchedInterface.vbd = ''; - // } - // } - //}); - - //.. - - //_.remove(self.tableContent, { - // name: origAssignment['vbridge-topology:user-interface'], - // vppName: origAssignment.vppName - //}); - - this.injectBridgeDomainsTopoElements(); - - }; - - - this.clearTopology = function() { - this.bridgeDomainsTopo.clear(); - this.injectedInterfaces.length = 0; - - }; - - //this.generateUnassignedInterfaces = function() { - // this.unassignedInterfaces.length = 0; - // for (var x=0; x