Skip to content

Commit ab0f0cb

Browse files
authored
Merge pull request #4 from CiscoDevNet/dev
Merging updated Pathman SR with new features related to user experience, bug fixes etc.
2 parents c1d7d99 + 4a36895 commit ab0f0cb

954 files changed

Lines changed: 470214 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
*.pyc
33
*.xcodeproj
44
client-src/pathman_sr/node_modules/
5-
client-src/pathman_sr/src/vendor/
6-
client/
5+
client-src/pathman_sr/src/vendor/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenDaylight Pathman SR App [![Creative Commons License](dcloud.png)](https://github.com/CiscoDevNet/pathman-sr/tree/master/dCloud)
1+
# OpenDaylight Pathman SR App <a style="float:right " href="https://dcloud.cisco.com/"><img src="dcloud.png" alt="IMAGE ALT TEXT HERE" align="right"/></a>
22

33
![](demo/pahtmanlogo.png)
44

@@ -128,7 +128,7 @@ npm install gulp -g
128128
Assuming you are currently in the root directory of the project, navigate to *client-src/pathman-sr/* directory with *cd*:
129129

130130
```
131-
cd client-src/pathman-sr
131+
cd client-src/pathman_sr
132132
```
133133

134134
All GUI files are located in here.

client-src/pathman_sr/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"requirejs": "~2.1.22",
1414
"restangular": "1.5.2",
1515
"angular-material-data-table": "~0.9.11",
16-
"NeXt": "~0.9.1",
16+
"NeXt": "~0.10.0",
1717
"jquery": "latest"
1818
},
1919
"authors": [

client-src/pathman_sr/gulpfile.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ var gulp = require('gulp'),
55
prefixer = require('gulp-autoprefixer'),
66
uglify = require('gulp-uglify'),
77
less = require('gulp-less'),
8-
//sourcemaps = require('gulp-sourcemaps'),
98
rigger = require('gulp-rigger'),
109
cssmin = require('gulp-minify-css'),
1110
rename = require('gulp-rename'),
1211
del = require('del'),
1312
browserSync = require("browser-sync"),
1413
htmlmin = require("gulp-htmlmin"),
14+
runSequence = require("run-sequence"),
1515
reload = browserSync.reload;
1616

1717
var config = {
@@ -57,39 +57,35 @@ var path = {
5757
};
5858

5959
gulp.task('clean', function () {
60-
del([path.clean], {force: true});
60+
return del([path.clean], {force: true});
6161
});
6262

6363
gulp.task('js:build', function () {
64-
gulp.src(path.src.js)
64+
return gulp.src(path.src.js)
6565
.pipe(rigger())
66-
//.pipe(sourcemaps.init())
6766
.pipe(uglify())
68-
//.pipe(sourcemaps.write())
6967
.pipe(rename(path.fileNames.jsMinified))
7068
.pipe(gulp.dest(path.build.js))
7169
.pipe(reload({stream: true}));
7270
});
7371

7472
gulp.task('style:build', function () {
75-
gulp.src(path.src.style)
76-
//.pipe(sourcemaps.init())
73+
return gulp.src(path.src.style)
7774
.pipe(less({
7875
includePaths: ['src/style/'],
7976
outputStyle: 'compressed',
80-
sourceMap: true,
77+
sourceMap: false,
8178
errLogToConsole: true
8279
}))
8380
.pipe(prefixer())
8481
.pipe(cssmin())
85-
//.pipe(sourcemaps.write())
8682
.pipe(rename(path.fileNames.cssMinified))
8783
.pipe(gulp.dest(path.build.css))
8884
.pipe(reload({stream: true}));
8985
});
9086

9187
gulp.task('image:build', function () {
92-
gulp.src(path.src.img)
88+
return gulp.src(path.src.img)
9389
.pipe(gulp.dest(path.build.img))
9490
.pipe(reload({stream: true}));
9591
});
@@ -102,45 +98,49 @@ gulp.task('html:build', function(){
10298
.pipe(gulp.dest(path.build.index));
10399

104100
// build templates
105-
gulp.src(path.src.templates)
101+
return gulp.src(path.src.templates)
106102
.pipe(gulp.dest(path.build.templates))
107103
.pipe(reload({stream: true}));
108104
});
109105

110106
gulp.task('vendor:build', function(){
111-
gulp.src(path.src.vendor)
107+
return gulp.src(path.src.vendor)
112108
.pipe(gulp.dest(path.build.vendor))
113109
});
114110

115-
gulp.task('build', [
116-
'html:build', // compile index.html
117-
'js:build', // assemble and minify js
118-
'style:build', // assemble and minify less/css
119-
'image:build', // just copy images
120-
'vendor:build' // copy vendor files
121-
]);
111+
gulp.task('build-full', function(){
112+
return runSequence(
113+
"clean",
114+
["html:build", "js:build", "style:build", "image:build", "vendor:build"]
115+
);
116+
});
122117

118+
gulp.task('build', function(){
119+
return runSequence(
120+
"clean",
121+
["html:build", "js:build", "style:build", "image:build"]
122+
);
123+
});
123124

124125
gulp.task('watch', function(){
125126
watch([path.watch.index, path.watch.templates], function(event, cb) {
126-
gulp.start('html:build');
127+
return runSequence("html:build");
127128
});
128129
watch([path.watch.style], function(event, cb) {
129-
gulp.start('style:build');
130+
return runSequence("style:build");
130131
});
131132
watch([path.watch.js], function(event, cb) {
132-
gulp.start('js:build');
133+
return runSequence("js:build");
133134
});
134135
watch([path.watch.img], function(event, cb) {
135-
gulp.start('image:build');
136+
return runSequence("image:build");
136137
});
137138
watch([path.watch.vendor], function(event, cb) {
138-
gulp.start('vendor:build');
139+
return runSequence("vendor:build");
139140
});
140141
});
141142

142143

143-
gulp.task('default', ['clean'], function(){
144-
gulp.start('build');
145-
gulp.start('watch');
144+
gulp.task('default', function(){
145+
return runSequence("build-full", "watch");
146146
});

client-src/pathman_sr/src/app/controllers/path-setup.controller.js

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414
$scope.onTabSelected = onTabSelected;
1515
$scope.clearCurrentPath = clearCurrentPath;
1616
$scope.getNodeNamesOnly = getNodeNamesOnly;
17+
$scope.countTotalByMetrics = countTotalByMetrics;
1718

1819
$scope.HelpersService = HelpersService;
19-
$scope.validCostMetrics = ['igp', 'hops'];
20+
$scope.validCostMetrics = ['igp', 'hops', 'te'];
2021
$scope.autoPathFormLoadingStatus = false;
2122
$scope.computedPaths = [];
2223
$scope.computedMetrics = [];
2324
$scope.manualPath = [];
2425
$scope.manualPathMetrics = [];
26+
$scope.manualPathMetricsTotal = {};
2527

2628
$scope.nodeFilter = {
2729
"pcepEnabled": {
@@ -47,7 +49,8 @@
4749

4850
var node = data.nodeData,
4951
foundIndex, neighbors, errObj, lastIndex,
50-
prevHop, currentLink, currentLinkModel;
52+
prevHop, currentLink, currentLinkModel,
53+
metricName, metricType;
5154

5255
foundIndex = ($scope.manualPath.findIndex(findRouterByName, {"node": node}));
5356

@@ -60,18 +63,60 @@
6063
if(foundIndex == 0){
6164
$scope.manualPath = [];
6265
$scope.manualPathMetrics = [];
66+
67+
for ( metricName in $scope.manualPathMetricsTotal) {
68+
if( $scope.manualPathMetricsTotal.hasOwnProperty( metricName ) ) {
69+
$scope.manualPathMetricsTotal[metricName] = 0;
70+
}
71+
}
72+
6373
}
64-
// if it's the last point (destination)
74+
// if it's the last point (current destination)
6575
else if(foundIndex == lastIndex){
76+
77+
for ( metricName in $scope.manualPathMetricsTotal) {
78+
if( $scope.manualPathMetricsTotal.hasOwnProperty( metricName ) ) {
79+
80+
metricType = $scope.manualPathMetrics[lastIndex - 1].type;
81+
82+
$scope.manualPathMetricsTotal[metricName] =
83+
$scope.manualPathMetricsTotal[metricName] - $scope.manualPathMetrics[lastIndex - 1].metric[metricName][metricType];
84+
85+
}
86+
}
87+
6688
$scope.manualPath.splice(lastIndex, 1);
6789
$scope.manualPathMetrics.splice(lastIndex - 1);
6890
}
91+
6992
// intermediate
7093
else{
7194
$scope.manualPath.splice(foundIndex + 1);
7295
$scope.manualPathMetrics.splice(foundIndex);
7396

97+
for ( metricName in $scope.manualPathMetricsTotal) {
98+
if( $scope.manualPathMetricsTotal.hasOwnProperty( metricName ) ) {
99+
$scope.manualPathMetricsTotal[metricName] = 0;
100+
}
101+
}
102+
103+
$scope.manualPathMetrics.forEach(function(metric){
104+
105+
for ( metricName in metric.metric) {
106+
if( metric.metric.hasOwnProperty( metricName ) ) {
107+
108+
metricType = metric.type;
109+
110+
$scope.manualPathMetricsTotal[metricName] =
111+
$scope.manualPathMetricsTotal[metricName] + metric.metric[metricName][metricType];
112+
113+
}
114+
}
115+
116+
});
117+
74118
}
119+
75120
}
76121
// otherwise (if node is new to the path)...
77122
else{
@@ -98,10 +143,38 @@
98143
currentLinkModel = currentLink.model().getData();
99144

100145
if(currentLinkModel.source == prevHop.name){
101-
$scope.manualPathMetrics.push(currentLinkModel.sourceTraffic);
146+
147+
metricType = "tx";
148+
149+
$scope.manualPathMetrics.push({
150+
metric: angular.copy(currentLinkModel.metric),
151+
type: metricType
152+
});
153+
154+
155+
102156
}
103157
else{
104-
$scope.manualPathMetrics.push(currentLinkModel.targetTraffic);
158+
159+
metricType = "rx";
160+
161+
$scope.manualPathMetrics.push({
162+
metric: angular.copy(currentLinkModel.metric),
163+
type: metricType
164+
});
165+
}
166+
167+
// add up to total
168+
for ( metricName in currentLinkModel.metric) {
169+
if( currentLinkModel.metric.hasOwnProperty( metricName ) ) {
170+
171+
if(!$scope.manualPathMetricsTotal.hasOwnProperty(metricName))
172+
$scope.manualPathMetricsTotal[metricName] = 0;
173+
174+
$scope.manualPathMetricsTotal[metricName] =
175+
$scope.manualPathMetricsTotal[metricName] + currentLinkModel.metric[metricName][metricType];
176+
177+
}
105178
}
106179

107180
$scope.manualPath.push(node);
@@ -177,7 +250,6 @@
177250

178251
// when a user is updating the path
179252
if(SharedDataService.data.pathSetupUpdateData.mode == "update"){
180-
console.log(SharedDataService.data.pathSetupUpdateData);
181253

182254
$scope.psForm = {
183255
"source": SharedDataService.data.pathSetupUpdateData.pathDetails.source,
@@ -449,6 +521,7 @@
449521

450522
$scope.manualPath = [];
451523
$scope.manualPathMetrics = [];
524+
$scope.manualPathMetricsTotal = {};
452525
NextTopologyService.clearPathLayer(topo);
453526

454527
}
@@ -467,6 +540,10 @@
467540
return namesOnly;
468541
}
469542

543+
function countTotalByMetrics(){
544+
545+
}
546+
470547
};
471548

472549
PathSetupCtrl.$inject = ["$scope", "PathListService", "NextTopologyService", "SharedDataService", "ErrorHandlerService", "HelpersService"];

client-src/pathman_sr/src/app/controllers/pathman.controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848

4949
// record the topology data
5050
SharedDataService.data.topologyData = data;
51+
52+
console.log(SharedDataService.data.topologyData);
53+
54+
5155
// render topology
5256
SharedDataService.data.nxTopology.data(SharedDataService.data.topologyData);
5357
// topology initialized = true

client-src/pathman_sr/src/app/services/helpers.service.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@
5454
};
5555
}
5656

57-
function arraySum(arr){
57+
function arraySum(arr, callback){
5858
var total = 0;
59-
arr.forEach(function(el){
60-
total += el;
59+
arr.forEach(function(el, index){
60+
61+
if(callback === undefined)
62+
total += el;
63+
else
64+
total += callback(el, index, arr)
6165
});
6266
return total;
6367
}

client-src/pathman_sr/src/app/services/next-topology.service.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,8 @@
314314
"pathWidth": 3,
315315
"links": pathLinkList,
316316
"arrow": "cap",
317-
"pathStyle": {
318-
"fill": pathColor
319-
}
317+
"sourceNode": hopList[0],
318+
"color": pathColor
320319
});
321320

322321
// add the path

0 commit comments

Comments
 (0)