Skip to content

Commit 7e38d2f

Browse files
author
Alexei Zverev
committed
New TE metrics and new format of links
1 parent 6ca41d3 commit 7e38d2f

923 files changed

Lines changed: 428848 additions & 19 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/

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

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

1819
$scope.HelpersService = HelpersService;
1920
$scope.validCostMetrics = ['igp', 'hops'];
@@ -22,6 +23,7 @@
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,69 @@
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+
console.log(metricType, $scope.manualPathMetricsTotal[metricName],
83+
$scope.manualPathMetrics[lastIndex - 1],
84+
$scope.manualPathMetrics[lastIndex - 1].metric[metricName][metricType]);
85+
86+
$scope.manualPathMetricsTotal[metricName] =
87+
$scope.manualPathMetricsTotal[metricName] - $scope.manualPathMetrics[lastIndex - 1].metric[metricName][metricType];
88+
89+
}
90+
}
91+
6692
$scope.manualPath.splice(lastIndex, 1);
6793
$scope.manualPathMetrics.splice(lastIndex - 1);
94+
95+
console.log("last", $scope.manualPathMetricsTotal, $scope.manualPathMetrics);
96+
6897
}
98+
6999
// intermediate
70100
else{
71101
$scope.manualPath.splice(foundIndex + 1);
72102
$scope.manualPathMetrics.splice(foundIndex);
73103

104+
for ( metricName in $scope.manualPathMetricsTotal) {
105+
if( $scope.manualPathMetricsTotal.hasOwnProperty( metricName ) ) {
106+
$scope.manualPathMetricsTotal[metricName] = 0;
107+
}
108+
}
109+
110+
$scope.manualPathMetrics.forEach(function(metric){
111+
112+
for ( metricName in metric.metric) {
113+
if( metric.metric.hasOwnProperty( metricName ) ) {
114+
console.log("metricName", metricName);
115+
console.log("metricType", metricType);
116+
metricType = metric.type;
117+
118+
$scope.manualPathMetricsTotal[metricName] =
119+
$scope.manualPathMetricsTotal[metricName] + metric.metric[metricName][metricType];
120+
121+
}
122+
}
123+
124+
console.log(metric);
125+
});
126+
74127
}
128+
75129
}
76130
// otherwise (if node is new to the path)...
77131
else{
@@ -98,10 +152,38 @@
98152
currentLinkModel = currentLink.model().getData();
99153

100154
if(currentLinkModel.source == prevHop.name){
101-
$scope.manualPathMetrics.push(currentLinkModel.sourceTraffic);
155+
156+
metricType = "tx";
157+
158+
$scope.manualPathMetrics.push({
159+
metric: angular.copy(currentLinkModel.metric),
160+
type: metricType
161+
});
162+
163+
164+
102165
}
103166
else{
104-
$scope.manualPathMetrics.push(currentLinkModel.targetTraffic);
167+
168+
metricType = "rx";
169+
170+
$scope.manualPathMetrics.push({
171+
metric: angular.copy(currentLinkModel.metric),
172+
type: metricType
173+
});
174+
}
175+
176+
// add up to total
177+
for ( metricName in currentLinkModel.metric) {
178+
if( currentLinkModel.metric.hasOwnProperty( metricName ) ) {
179+
180+
if(!$scope.manualPathMetricsTotal.hasOwnProperty(metricName))
181+
$scope.manualPathMetricsTotal[metricName] = 0;
182+
183+
$scope.manualPathMetricsTotal[metricName] =
184+
$scope.manualPathMetricsTotal[metricName] + currentLinkModel.metric[metricName][metricType];
185+
186+
}
105187
}
106188

107189
$scope.manualPath.push(node);
@@ -449,6 +531,7 @@
449531

450532
$scope.manualPath = [];
451533
$scope.manualPathMetrics = [];
534+
$scope.manualPathMetricsTotal = {};
452535
NextTopologyService.clearPathLayer(topo);
453536

454537
}
@@ -467,6 +550,10 @@
467550
return namesOnly;
468551
}
469552

553+
function countTotalByMetrics(){
554+
555+
}
556+
470557
};
471558

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

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/templates/link-details-panel.tpl.html

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,37 @@ <h2>
6464

6565
<tr md-row>
6666
<td md-cell>
67-
Metric (A &rarr; B)
67+
IGP Metric (A &rarr; B)
6868
</td>
6969
<td md-cell>
70-
{{ linkData.sourceTraffic }}
70+
{{ linkData.metric.igp.rx }}
7171
</td>
7272
</tr>
7373

7474
<tr md-row>
7575
<td md-cell>
76-
Metric (B &rarr; A)
76+
IGP Metric (B &rarr; A)
7777
</td>
7878
<td md-cell>
79-
{{ linkData.targetTraffic }}
79+
{{ linkData.metric.igp.tx }}
80+
</td>
81+
</tr>
82+
83+
<tr md-row>
84+
<td md-cell>
85+
TE Metric (A &rarr; B)
86+
</td>
87+
<td md-cell>
88+
{{ linkData.metric.te.rx }}
89+
</td>
90+
</tr>
91+
92+
<tr md-row>
93+
<td md-cell>
94+
TE Metric (B &rarr; A)
95+
</td>
96+
<td md-cell>
97+
{{ linkData.metric.te.tx }}
8098
</td>
8199
</tr>
82100

client-src/pathman_sr/src/app/templates/link-list-panel.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h2>
3838
flex>
3939
<h3>{{ link.source }} &harr; {{ link.target }}</h3>
4040
<p>
41-
IGP: {{ link.sourceTraffic }} / {{ link.targetTraffic }}
41+
IGP: {{ link.metric.igp.rx }} / {{ link.metric.igp.tx }}, TE: {{ link.metric.te.rx }} / {{ link.metric.te.tx }}
4242
</p>
4343
</div>
4444
<md-divider ng-if="!$last"></md-divider>

client-src/pathman_sr/src/app/templates/path-setup-panel.tpl.html

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,29 @@ <h2>
216216

217217
<tr md-row>
218218
<td md-cell>
219-
IGP cost:
219+
Total IGP cost:
220220
</td>
221221
<td md-cell>
222-
{{ HelpersService.arraySum(manualPathMetrics) }}
222+
<span ng-show="manualPathMetricsTotal.hasOwnProperty('igp')">
223+
{{ manualPathMetricsTotal.igp }}
224+
</span>
225+
<span ng-show="!manualPathMetricsTotal.hasOwnProperty('igp')">
226+
0
227+
</span>
228+
</td>
229+
</tr>
230+
231+
<tr md-row>
232+
<td md-cell>
233+
Total TE cost:
234+
</td>
235+
<td md-cell>
236+
<span ng-show="manualPathMetricsTotal.hasOwnProperty('te')">
237+
{{ manualPathMetricsTotal.te }}
238+
</span>
239+
<span ng-show="!manualPathMetricsTotal.hasOwnProperty('te')">
240+
0
241+
</span>
223242
</td>
224243
</tr>
225244

@@ -261,7 +280,8 @@ <h2>
261280
<th md-column><span>#</span></th>
262281
<th md-column><span>Source</span></th>
263282
<th md-column><span>Destination</span></th>
264-
<th md-column>Cost</th>
283+
<th md-column>IGP</th>
284+
<th md-column>TE</th>
265285
</tr>
266286
</thead>
267287

@@ -280,10 +300,19 @@ <h2>
280300
<i>Click to pick</i>
281301
</div>
282302
</td>
283-
<!-- Cost -->
303+
<!-- IGP cost -->
304+
<td md-cell>
305+
<div ng-show="manualPath[index+1]">
306+
{{ manualPathMetrics[index].metric.igp[manualPathMetrics[index].type] }}
307+
</div>
308+
<div ng-hide="manualPath[index+1]">
309+
N/A
310+
</div>
311+
</td>
312+
<!-- TE cost -->
284313
<td md-cell>
285314
<div ng-show="manualPath[index+1]">
286-
{{ manualPathMetrics[index] }}
315+
{{ manualPathMetrics[index].metric.te[manualPathMetrics[index].type] }}
287316
</div>
288317
<div ng-hide="manualPath[index+1]">
289318
N/A

client/pathman_sr/css/style.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/pathman_sr/index.html

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!DOCTYPE html>
2+
<html lang="en" ng-app="pathmanApp">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="shortcut icon" href="media/img/favicon.ico" type="image/vnd.microsoft.icon">
7+
<title>Pathman Segment Routing</title>
8+
9+
<!-- Vendor CSS -->
10+
<link rel="stylesheet" href="vendor/angular-material/angular-material.min.css">
11+
<link rel="stylesheet" href="vendor/angular-material-data-table/dist/md-data-table.min.css">
12+
<link rel="stylesheet" type="text/css" href="vendor/NeXt/css/next.min.css">
13+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
14+
<link rel="stylesheet" type="text/css" href="vendor/font-awesome/css/font-awesome.min.css">
15+
<!-- / Vendor CSS -->
16+
17+
<!-- Vendor JS -->
18+
<script type="text/javascript" src="vendor/angular/angular.min.js"></script>
19+
<script type="text/javascript" src="vendor/angular-animate/angular-animate.min.js"></script>
20+
<script type="text/javascript" src="vendor/angular-messages/angular-messages.min.js"></script>
21+
<script type="text/javascript" src="vendor/angular-aria/angular-aria.min.js"></script>
22+
<script type="text/javascript" src="vendor/angular-material/angular-material.min.js"></script>
23+
<script type="text/javascript" src="vendor/angular-material-data-table/dist/md-data-table.min.js"></script>
24+
<script type="text/javascript" src="vendor/NeXt/js/next.js"></script>
25+
<script type="text/javascript" src="vendor/jquery/dist/jquery.min.js"></script>
26+
<script type="text/javascript" src="vendor/lodash/dist/lodash.min.js"></script>
27+
<script type="text/javascript" src="vendor/restangular/dist/restangular.min.js"></script>
28+
<!-- / Vendor JS-->
29+
30+
<!-- styles -->
31+
<link rel="stylesheet" type="text/css" href="css/style.css">
32+
33+
</head>
34+
<body ng-controller="PathmanAppCtrl">
35+
36+
37+
<div layout="row" class="h100 app-wrapper" flex>
38+
39+
<section layout="column" class="h100" flex>
40+
<md-toolbar class="toolbar-main">
41+
<div class="md-toolbar-tools toolbar-main">
42+
<span class="product-label">
43+
Pathman SR
44+
</span>
45+
<md-button ng-click="openPanel('path-setup')" ng-class="{'selected-item': shared.sidePanelName === 'path-setup'}">
46+
<i class="fa fa-wrench" aria-hidden="true"></i>
47+
Path setup
48+
</md-button>
49+
<md-button ng-click="openPanel('path-list')" ng-class="{'selected-item': shared.sidePanelName === 'path-list' || shared.sidePanelName === 'path-details'}">
50+
<i class="fa fa-exchange" aria-hidden="true"></i>
51+
Path List
52+
</md-button>
53+
<md-button ng-click="openPanel('node-list')" ng-class="{'selected-item': shared.sidePanelName === 'node-list' || shared.sidePanelName === 'node-details'}">
54+
<i class="fa fa-share-alt" aria-hidden="true"></i>
55+
Node List
56+
</md-button>
57+
<md-button ng-click="openPanel('link-list')" ng-class="{'selected-item': shared.sidePanelName === 'link-list' || shared.sidePanelName === 'link-details'}">
58+
<i class="fa fa-link" aria-hidden="true"></i>
59+
Link List
60+
</md-button>
61+
<md-button>
62+
<i class="fa fa-info-circle" aria-hidden="true"></i>
63+
Help
64+
</md-button>
65+
<span flex></span>
66+
67+
</div>
68+
</md-toolbar>
69+
70+
<div class="content-wrapper">
71+
<md-progress-linear ng-if="!shared.topologyInitd" md-mode="indeterminate"></md-progress-linear>
72+
<div class="w100 h100" ng-controller="NextTopologyCtrl">
73+
<div id="topology-container" class="h100"></div>
74+
</div>
75+
</div>
76+
</section>
77+
78+
<section layout="column"
79+
class="h100"
80+
ng-show="shared.sidePanel"
81+
ng-controller="SidePanelCtrl">
82+
<div class="h100" ng-show="shared.sidePanelName == 'path-list'" ng-include=" 'templates/path-list-panel.tpl.html' "></div>
83+
<div class="h100" ng-show="shared.sidePanelName == 'path-setup'" ng-include=" 'templates/path-setup-panel.tpl.html' "></div>
84+
<div class="h100" ng-show="shared.sidePanelName == 'path-details'" ng-include=" 'templates/path-details-panel.tpl.html' "></div>
85+
<div class="h100" ng-show="shared.sidePanelName == 'node-list'" ng-include=" 'templates/node-list-panel.tpl.html' "></div>
86+
<div class="h100" ng-show="shared.sidePanelName == 'node-details'" ng-include=" 'templates/node-details-panel.tpl.html' "></div>
87+
<div class="h100" ng-show="shared.sidePanelName == 'link-list'" ng-include=" 'templates/link-list-panel.tpl.html' "></div>
88+
<div class="h100" ng-show="shared.sidePanelName == 'link-details'" ng-include=" 'templates/link-details-panel.tpl.html' "></div>
89+
</section>
90+
</div>
91+
<script type="text/javascript" src="js/app.js"></script>
92+
</body>
93+
</html>

client/pathman_sr/js/app.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.12 KB
Binary file not shown.

0 commit comments

Comments
 (0)