2 * @copyright 2017 highstreet technologies GmbH and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 define(['app/mwtnPerformanceHistory/mwtnPerformanceHistory.module',
11 'app/mwtnPerformanceHistory/mwtnPerformanceHistory.services'],
12 function (mwtnPerformanceHistoryoryApp) {
14 mwtnPerformanceHistoryoryApp.register.controller('mwtnPerformanceHistoryCtrl', ['$scope', '$rootScope', '$window', '$translate', '$mwtnLog', '$mwtnPerformanceHistory', 'uiGridConstants', 'OnfNetworkElement',
15 function ($scope, $rootScope, $window, $translate, $mwtnLog, $mwtnPerformanceHistory, uiGridConstants, OnfNetworkElement) {
17 var COMPONENT = 'mwtnPerformanceHistory';
18 $mwtnLog.info({ component: COMPONENT, message: 'mwtn historical Performance started!' });
20 $rootScope.section_logo = 'src/app/mwtnPerformanceHistory/images/mwtnPerformance.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif'
24 $scope.selecteditem = {};
27 $scope.selecteditem.timePeriod = "15 minutes";
28 $scope.timePeriods = ["15 minutes", "24 hours"];
31 $scope.selecteditem.selectedLtpId = undefined;
32 $scope.availableLtpIds = [];
36 $scope.state.filter = false;
37 $scope.state.sort = false;
38 $scope.state.lastfilter = null;
39 $scope.state.lastSort = null;
40 $scope.state.grid = null;
42 //perf log configuration
43 $scope.gridOptionsPerformance826 = {
44 paginationPageSizes: [25, 100, 1000, 10000],
45 paginationPageSize: 25,
46 useExternalPagination: true,
47 useExternalSorting: true,
48 enablePaginationControls: true,
49 enableFiltering: true,
50 useExternalFiltering: true,
53 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
54 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
55 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
56 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
58 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
59 direction: uiGridConstants.ASC,
63 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
65 { field: 'es', type: 'string', displayName: 'ES', width: 70 },
66 { field: 'ses', type: 'string', displayName: 'SES', width: 70 },
67 { field: 'uas', type: 'string', displayName: 'UAS', width: 70 }
70 data: 'performance826',
71 onRegisterApi: function (gridApi) {
72 $scope.performancegridApi = gridApi;
73 $scope.performancegridApi.core.on.filterChanged($scope, $scope.filter);
74 $scope.performancegridApi.core.on.sortChanged($scope, $scope.sortChanged);
75 $scope.sortChanged($scope.performancegridApi.grid, [$scope.gridOptionsPerformance826.columnDefs[1]]);
77 $scope.performancegridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
78 getPage($scope.gridOptionsPerformance826);
83 //receive lvl configuration
84 $scope.gridOptionsReceiveLevel = {
85 paginationPageSizes: [25, 100, 1000, 10000],
86 paginationPageSize: 25,
87 useExternalPagination: true,
88 useExternalSorting: true,
89 enablePaginationControls: true,
90 enableFiltering: true,
91 useExternalFiltering: true,
94 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
95 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
96 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
97 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
99 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
100 direction: uiGridConstants.ASC,
104 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
105 { field: 'rxmin', type: 'string', displayName: 'Rx min', width: 90 },
106 { field: 'rxavg', type: 'string', displayName: 'Rx avg', width: 90 },
107 { field: 'rxmax', type: 'string', displayName: 'Rx max', width: 90 }
109 data: 'receiveLevel',
110 onRegisterApi: function (gridApi) {
111 $scope.recvGridApi = gridApi;
112 $scope.recvGridApi.core.on.filterChanged($scope, $scope.filter);
113 $scope.recvGridApi.core.on.sortChanged($scope, $scope.sortChanged);
114 $scope.sortChanged($scope.recvGridApi.grid, [$scope.gridOptionsReceiveLevel.columnDefs[1]]);
116 $scope.recvGridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
117 getPage($scope.gridOptionsReceiveLevel);
122 //transmission lvl configuration
123 $scope.gridOptionsTransmissionLevel = {
124 paginationPageSizes: [25, 100, 1000, 10000],
125 paginationPageSize: 25,
126 useExternalPagination: true,
127 useExternalSorting: true,
128 enablePaginationControls: true,
129 enableFiltering: true,
130 useExternalFiltering: true,
131 enableGridMenu: true,
133 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
134 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
135 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
136 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
138 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
139 direction: uiGridConstants.ASC,
143 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
144 { field: 'txmin', type: 'string', displayName: 'Tx min', width: 90 },
145 { field: 'txavg', type: 'string', displayName: 'Tx avg', width: 90 },
146 { field: 'txmax', type: 'string', displayName: 'Tx max', width: 90 }
148 data: 'transmissionLevel',
149 onRegisterApi: function (gridApi) {
150 $scope.transmissionGridApi = gridApi;
151 $scope.transmissionGridApi.core.on.filterChanged($scope, $scope.filter);
152 $scope.transmissionGridApi.core.on.sortChanged($scope, $scope.sortChanged);
153 $scope.sortChanged($scope.transmissionGridApi.grid, [$scope.gridOptionsTransmissionLevel.columnDefs[1]]);
155 $scope.transmissionGridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
156 getPage($scope.gridOptionsTransmissionLevel);
161 //modulation configuration
162 $scope.gridOptionsModulation = {
163 paginationPageSizes: [25, 100, 1000, 10000],
164 paginationPageSize: 25,
165 useExternalPagination: true,
166 useExternalSorting: true,
167 enablePaginationControls: true,
168 enableFiltering: true,
169 useExternalFiltering: true,
170 enableGridMenu: true,
172 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
173 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
174 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
175 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
177 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
178 direction: uiGridConstants.ASC,
182 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
183 { field: 'time2S', type: 'string', displayName: 'QAM2S', width: 90 },
184 { field: 'time2', type: 'string', displayName: 'QAM2', width: 90 },
185 { field: 'time2L', type: 'string', displayName: 'QAM2L', width: 90 },
186 { field: 'time4S', type: 'string', displayName: 'QAM4S', width: 90 },
187 { field: 'time4', type: 'string', displayName: 'QAM4', width: 90 },
188 { field: 'time4L', type: 'string', displayName: 'QAM4L', width: 90 },
189 { field: 'time16S', type: 'string', displayName: 'QAM16S', width: 90 },
190 { field: 'time16', type: 'string', displayName: 'QAM16', width: 90 },
191 { field: 'time16L', type: 'string', displayName: 'QAM16L', width: 90 },
192 { field: 'time32S', type: 'string', displayName: 'QAM32S', width: 90 },
193 { field: 'time32', type: 'string', displayName: 'QAM32', width: 90 },
194 { field: 'time32L', type: 'string', displayName: 'QAM32L', width: 90 },
195 { field: 'time64S', type: 'string', displayName: 'QAM64S', width: 90 },
196 { field: 'time64', type: 'string', displayName: 'QAM64', width: 90 },
197 { field: 'time64L', type: 'string', displayName: 'QAM64L', width: 90 },
198 { field: 'time128S', type: 'string', displayName: 'QAM128S', width: 90 },
199 { field: 'time128', type: 'string', displayName: 'QAM128', width: 90 },
200 { field: 'time128L', type: 'string', displayName: 'QAM128L', width: 90 },
201 { field: 'time256S', type: 'string', displayName: 'QAM256S', width: 90 },
202 { field: 'time256', type: 'string', displayName: 'QAM256', width: 90 },
203 { field: 'time256L', type: 'string', displayName: 'QAM256L', width: 90 },
204 { field: 'time512S', type: 'string', displayName: 'QAM512S', width: 90 },
205 { field: 'time512', type: 'string', displayName: 'QAM512', width: 90 },
206 { field: 'time512L', type: 'string', displayName: 'QAM512L', width: 90 },
207 { field: 'time1024S', type: 'string', displayName: 'QAM1024S', width: 90 },
208 { field: 'time1024', type: 'string', displayName: 'QAM1024', width: 90 },
209 { field: 'time1024L', type: 'string', displayName: 'QAM1024L', width: 90 },
210 { field: 'time2048S', type: 'string', displayName: 'QAM2048S', width: 90 },
211 { field: 'time2048', type: 'string', displayName: 'QAM2048', width: 90 },
212 { field: 'time2048L', type: 'string', displayName: 'QAM2048L', width: 90 },
213 { field: 'time4096S', type: 'string', displayName: 'QAM4096S', width: 90 },
214 { field: 'time4096', type: 'string', displayName: 'QAM4096', width: 90 },
215 { field: 'time4096L', type: 'string', displayName: 'QAM4096L', width: 90 },
216 { field: 'time8192S', type: 'string', displayName: 'QAM8192S', width: 90 },
217 { field: 'time8192', type: 'string', displayName: 'QAM8192', width: 90 },
218 { field: 'time8192L', type: 'string', displayName: 'QAM8192L', width: 90 }
223 onRegisterApi: function (gridApi) {
224 $scope.gridApi = gridApi;
225 $scope.gridApi.core.on.filterChanged($scope, $scope.filter);
226 $scope.gridApi.core.on.sortChanged($scope, $scope.sortChanged);
227 $scope.sortChanged($scope.gridApi.grid, [$scope.gridOptionsModulation.columnDefs[1]]);
229 $scope.gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
230 getPage($scope.gridOptionsModulation);
235 //temperature configuration
236 $scope.gridOptionsTemperature = {
237 paginationPageSizes: [25, 100, 1000, 10000],
238 paginationPageSize: 25,
239 useExternalPagination: true,
240 useExternalSorting: true,
241 enablePaginationControls: true,
242 enableFiltering: true,
243 useExternalFiltering: true,
244 enableGridMenu: true,
246 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
247 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
248 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
249 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
251 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
252 direction: uiGridConstants.ASC,
256 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
257 { field: 'rfTempMin', type: 'string', displayName: 'Rf Temp Min [°C]', width: 90 },
258 { field: 'rfTempAvg', type: 'string', displayName: 'Rf Temp Avg [°C]', width: 90 },
259 { field: 'rfTempMax', type: 'string', displayName: 'Rf Temp Max [°C]', width: 90 }
263 onRegisterApi: function (gridApi) {
264 $scope.gridTemperatureApi = gridApi;
265 $scope.gridTemperatureApi.core.on.filterChanged($scope, $scope.filter);
266 $scope.gridTemperatureApi.core.on.sortChanged($scope, $scope.sortChanged);
267 $scope.sortChanged($scope.gridTemperatureApi.grid, [$scope.gridOptionsTemperature.columnDefs[1]]);
269 $scope.gridTemperatureApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
270 getPage($scope.gridOptionsTemperature);
276 $scope.gridOptionsSnir = {
277 paginationPageSizes: [25, 100, 1000, 10000],
278 paginationPageSize: 25,
279 useExternalPagination: true,
280 useExternalSorting: true,
281 enablePaginationControls: true,
282 enableFiltering: true,
283 useExternalFiltering: true,
284 enableGridMenu: true,
286 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
287 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
288 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
289 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
291 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
292 direction: uiGridConstants.ASC,
296 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
297 { field: 'snirMin', type: 'string', displayName: [$translate.instant('MWTN_SNIR_MIN'),'[dB]'].join(' '), width: 90 },
298 { field: 'snirAvg', type: 'string', displayName: [$translate.instant('MWTN_SNIR_AVG'),'[dB]'].join(' '), width: 90 },
299 { field: 'snirMax', type: 'string', displayName: [$translate.instant('MWTN_SNIR_MAX'),'[dB]'].join(' '), width: 90 }
302 onRegisterApi: function (gridApi) {
303 $scope.gridSNIRApi = gridApi;
304 $scope.gridSNIRApi.core.on.filterChanged($scope, $scope.filter);
305 $scope.gridSNIRApi.core.on.sortChanged($scope, $scope.sortChanged);
306 $scope.sortChanged($scope.gridSNIRApi.grid, [$scope.gridOptionsSnir.columnDefs[1]]);
308 $scope.gridSNIRApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
309 getPage($scope.gridOptionsSnir);
315 $scope.gridOptionsCrossPolarDiscrimination = {
316 paginationPageSizes: [25, 100, 1000, 10000],
317 paginationPageSize: 25,
318 useExternalPagination: true,
319 useExternalSorting: true,
320 enablePaginationControls: true,
321 enableFiltering: true,
322 useExternalFiltering: true,
323 enableGridMenu: true,
325 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
326 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
327 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
328 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
330 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
331 direction: uiGridConstants.ASC,
335 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
336 { field: 'xpdMin', type: 'string', displayName: 'CPD min [dB]', width: 90 },
337 { field: 'xpdAvg', type: 'string', displayName: 'CPD avg [dB]', width: 90 },
338 { field: 'xpdMax', type: 'string', displayName: 'CPD max [dB]', width: 90 }
341 data: 'crossPolarDiscrimination',
342 onRegisterApi: function (gridApi) {
343 $scope.gridXpdApi = gridApi;
344 $scope.gridXpdApi.core.on.filterChanged($scope, $scope.filter);
345 $scope.gridXpdApi.core.on.sortChanged($scope, $scope.sortChanged);
346 $scope.sortChanged($scope.gridOptionsCrossPolarDiscrimination, [$scope.gridOptionsCrossPolarDiscrimination.columnDefs[1]]);
348 $scope.gridXpdApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
349 getPage($scope.gridOptionsCrossPolarDiscrimination);
354 //ethernet perf configuration
355 $scope.gridOptionsPerformanceEthernetContainer = {
356 paginationPageSizes: [25, 100, 1000, 10000],
357 paginationPageSize: 25,
358 useExternalPagination: true,
359 useExternalSorting: true,
360 enablePaginationControls: true,
361 enableFiltering: true,
362 useExternalFiltering: true,
363 enableGridMenu: true,
365 { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false },
366 { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false },
367 { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90, visible: false },
368 { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
370 field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: {
371 direction: uiGridConstants.ASC,
375 { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
376 { field: 'txEthernetBytesMaxS', type: 'number', displayName: 'Tx BytesMaxS', width: 90 },
377 { field: 'txEthernetBytesMaxM', type: 'number', displayName: 'Tx BytesMaxM', width: 90 },
378 { field: 'txEthernetBytesSum', type: 'number', displayName: 'Tx BytesSum', width: 90 }
381 data: 'performanceEthernetContainer',
382 onRegisterApi: function (gridApi) {
383 $scope.gridPerfEthernetApi = gridApi;
384 $scope.gridPerfEthernetApi.core.on.filterChanged($scope, $scope.filter);
385 $scope.gridPerfEthernetApi.core.on.sortChanged($scope, $scope.sortChanged);
386 $scope.sortChanged($scope.gridPerfEthernetApi.grid, [$scope.gridOptionsPerformanceEthernetContainer.columnDefs[1]]);
388 $scope.gridPerfEthernetApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
389 getPage($scope.gridOptionsPerformanceEthernetContainer);
395 $scope.filter = function () {
396 var grid = this.grid;
399 //get all columns where data was typed in
400 angular.forEach(grid.columns, function (value, key) {
401 if (value.filters[0].term) {
402 var col = findColumn(value.field);
403 if (col === "time-stamp") {
404 //convert timestamp to db format
405 var timestamp = $mwtnPerformanceHistory.TimeStampToONFFormat(value.filters[0].term);
406 columns.push({ column: col, value: timestamp });
409 columns.push({ column: col, value: value.filters[0].term }); //create column object
413 if (columns.length == 0) { //all filter data cleared away
414 $scope.state.filter = false;
415 $scope.state.lastfilter = null;
417 //get unfiltered data
418 getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, null).then(function (response) {
419 if (response.data.hits.hits) {
420 processRequestInGrid(response, grid.options);
427 var filter = { "query": { "bool": { "must": [] } } };
429 //create filter objects
431 prefixs.push({ prefix: globalFilter });
433 columns.map(function (obj) {
435 prefixObj[obj.column] = obj.value;//add like: {column: "fault.counter", value: "1"} => {"fault.counter":1}
436 prefixs.push({ prefix: prefixObj }); // => {"prefix":{...}}
439 //add objects to must property
440 filter.query.bool.must = prefixs;
443 $scope.state.lastfilter = filter;
444 $scope.state.filter = true;
446 getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, filter, null).then(function (response) {
447 if (response.data.hits.total > 0) { //only, when hits exist
448 processRequestInGrid(response, grid.options);
449 //$scope.gridOptionsAlarmLog.totalItems = response.data.hits.total;
451 //clear data from list
452 $scope[grid.options.data] = [];
453 grid.options.totalItems = 0;
460 $scope.sortChanged = function (grid, sortColumns) { // sortColumns is an array containing just the column sorted in the grid
463 if (sortColumns && sortColumns.length > 0) {
464 if (sortColumns[0].sort) {
465 var name = sortColumns[0].field; // the field (name) of the column sorted
466 var direction = sortColumns[0].sort.direction // the direction of the column sorted: "desc" or "asc"
467 sort(direction, findColumn(name), grid);
469 } else if (sortColumns) {
470 $scope.state.sort = false;
471 $scope.state.lastSort = null;
474 getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, null).then(function (response) {
475 if (response.data.hits.hits) {
476 processRequestInGrid(response, grid.options);
482 var sort = function (direction, columnName, grid) {
484 case uiGridConstants.ASC:
488 sortObj[columnName] = { order: 'asc' };
489 var sort = [sortObj];
491 $scope.state.lastSort = sort;
493 getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, sort).then(function (response) {
494 if (response.data.hits.hits) {
495 processRequestInGrid(response, grid.options);
496 $scope.state.sort = true;
503 case uiGridConstants.DESC:
506 sortObj[columnName] = { order: 'desc' };
507 var sort = [sortObj];
508 $scope.state.lastSort = sort;
510 getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, sort).then(function (response) {
511 if (response.data.hits.hits) {
512 processRequestInGrid(response, grid.options);
513 $scope.state.sort = true;
520 $scope.state.sort = false;
521 $scope.state.lastSort = null;
523 getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, null)
524 .then(function (response) {
525 if (response.data.hits.hits) {
526 processRequestInGrid(response, grid.options);
534 function findColumn(name) {
536 if (name === "timestamp") { return "time-stamp"; }
537 else if (name === "layerprotocol") { return "layer-protocol-name"; }
538 else if (name === "id") { return "uuid-interface"; }
539 else if (name === "suspectInterval") { return "suspect-interval-flag"; }
540 else if (name === "scannerId") { return "scanner-id"; }
541 else if (name === "radiosignal") { return "radio-signal-id"; }
542 else if (name === "es") { return "performance-data.es"; }
543 else if (name === "ses") { return "performance-data.ses"; }
544 else if (name === "uas") { return "performance-data.unavailability"; }
545 else if (name === "rxmin") { return "performance-data.rx-level-min"; }
546 else if (name === "rxmax") { return "performance-data.rx-level-max"; }
547 else if (name === "rxavg") { return "performance-data.rx-level-avg"; }
548 else if (name === "txmin") { return "performance-data.tx-level-min"; }
549 else if (name === "txmax") { return "performance-data.tx-level-max"; }
550 else if (name === "txavg") { return "performance-data.tx-level-avg"; }
551 else if (name === "Tx BytesMaxS") { return "performance-data.tx-ethernet-bytes-max-s"; }
552 else if (name === "Tx BytesMaxM") { return "performance-data.tx-ethernet-bytes-max-m"; }
553 else if (name === "Tx BytesSum") { return "performance-data.tx-ethernet-bytes-sum"; }
554 else if (name === "xpdMin") { return "performance-data.xpd-min"; }
555 else if (name === "xpdAvg") { return "performance-data.xpd-avg"; }
556 else if (name === "xpdMax") { return "performance-data.xpd-max"; }
557 else if (name === "snirMin") { return "performance-data.snir-min"; }
558 else if (name === "snirAvg") { return "performance-data.snir-avg"; }
559 else if (name === "snirMax") { return "performance-data.snir-max"; }
560 else if (name === "rfTempMin") { return "performance-data.rf-temp-min"; }
561 else if (name === "rfTempAvg") { return "performance-data.rf-temp-avg"; }
562 else if (name === "rfTempMax") { return "performance-data.rf-temp-max"; }
563 else if (name === "time2S") { return "performance-data.time2-states-s"; }
564 else if (name === "time2") { return "performance-data.time2-states"; }
565 else if (name === "time2L") { return "performance-data.time2-states-l"; }
566 else if (name === "time4S") { return "performance-data.time4-states-s"; }
567 else if (name === "time4") { return "performance-data.time4-states"; }
568 else if (name === "time4L") { return "performance-data.time4-states-l"; }
569 else if (name === "time16S") { return "performance-data.time16-states-s"; }
570 else if (name === "time16") { return "performance-data.time16-states"; }
571 else if (name === "time16L") { return "performance-data.time16-states-l"; }
572 else if (name === "time32S") { return "performance-data.time32-states-s"; }
573 else if (name === "time32") { return "performance-data.time32-states"; }
574 else if (name === "time32L") { return "performance-data.time32-states-l"; }
575 else if (name === "time64S") { return "performance-data.time64-states-s"; }
576 else if (name === "time64") { return "performance-data.time64-states"; }
577 else if (name === "time64L") { return "performance-data.time64-states-l"; }
578 else if (name === "time128S") { return "performance-data.time128-states-s"; }
579 else if (name === "time128") { return "performance-data.time128-states"; }
580 else if (name === "time128L") { return "performance-data.time128-states-l"; }
581 else if (name === "time256S") { return "performance-data.time256-states-s"; }
582 else if (name === "time256") { return "performance-data.time256-states"; }
583 else if (name === "time256L") { return "performance-data.time256-states-l"; }
584 else if (name === "time512S") { return "performance-data.time512-states-s"; }
585 else if (name === "time512") { return "performance-data.time512-states"; }
586 else if (name === "time512L") { return "performance-data.time512-states-l"; }
587 else if (name === "time1024S") { return "performance-data.time1024-states-s"; }
588 else if (name === "time1024") { return "performance-data.time1024-states"; }
589 else if (name === "time1024L") { return "performance-data.time1024-states-l"; }
590 else if (name === "time2048S") { return "performance-data.time2048-states-s"; }
591 else if (name === "time2048") { return "performance-data.time2048-states"; }
592 else if (name === "time2048L") { return "performance-data.time2048-states-l"; }
593 else if (name === "time4096S") { return "performance-data.time4096-states-s"; }
594 else if (name === "time4096") { return "performance-data.time4096-states"; }
595 else if (name === "time4096L") { return "performance-data.time4096-states-l"; }
596 else if (name === "time8192S") { return "performance-data.time8192-states-s"; }
597 else if (name === "time8192") { return "performance-data.time8192-states"; }
598 else if (name === "time8192L") { return "performance-data.time8192-states-l"; }
603 var checkData = function (value) {
604 if (value === -1 || value === undefined) return undefined;
608 var getPage = function (grid) {
610 //from, how many, sort, filter
611 getData($scope.state.lastSort, $scope.state.lastfilter, grid, null, null)
612 .then(function (data) {
614 processRequestInGrid(data, grid);
618 var processRequestInGrid = function (response, grid) {
619 // console.log(grid.data);
621 case "performance826":
624 response.data.hits.hits.map(function (entry) {
626 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
627 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
628 layerProtocol: entry._source['layer-protocol-name'],
629 suspectInterval: entry._source['suspect-interval-flag'],
630 scannerId: entry._source['scanner-id'],
631 es: checkData(entry._source['performance-data'].es),
632 ses: checkData(entry._source['performance-data'].ses),
633 uas: checkData(entry._source['performance-data'].unavailability),
634 radiosignal: entry._source['radio-signal-id']
640 $scope.performance826 = list;
641 $scope.gridOptionsPerformance826.totalItems = response.data.hits.total;
643 case "transmissionLevel":
646 response.data.hits.hits.map(function (entry) {
648 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
649 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
650 layerProtocol: entry._source['layer-protocol-name'],
651 suspectInterval: entry._source['suspect-interval-flag'],
652 scannerId: entry._source['scanner-id'],
653 txmin: checkData(entry._source['performance-data']['tx-level-min']),
654 txavg: checkData(entry._source['performance-data']['tx-level-avg']),
655 txmax: checkData(entry._source['performance-data']['tx-level-max']),
656 radiosignal: entry._source['radio-signal-id']
662 $scope.transmissionLevel = list;
663 $scope.gridOptionsTransmissionLevel.totalItems = response.data.hits.total;
670 response.data.hits.hits.map(function (entry) {
672 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
673 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
674 layerProtocol: entry._source['layer-protocol-name'],
675 suspectInterval: entry._source['suspect-interval-flag'],
676 scannerId: entry._source['scanner-id'],
677 rxmin: checkData(entry._source['performance-data']['rx-level-min']),
678 rxavg: checkData(entry._source['performance-data']['rx-level-avg']),
679 rxmax: checkData(entry._source['performance-data']['rx-level-max']),
680 radiosignal: entry._source['radio-signal-id']
686 $scope.receiveLevel = list;
687 $scope.gridOptionsReceiveLevel.totalItems = response.data.hits.total;
694 response.data.hits.hits.map(function (entry) {
696 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
697 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
698 layerProtocol: entry._source['layer-protocol-name'],
699 suspectInterval: entry._source['suspect-interval-flag'],
700 scannerId: entry._source['scanner-id'],
701 time2S: checkData(entry._source['performance-data']['time2-states-s']),
702 time2: checkData(entry._source['performance-data']['time2-states']),
703 time2L: checkData(entry._source['performance-data']['time2-states-l']),
704 time4S: checkData(entry._source['performance-data']['time4-states-s']),
705 time4: checkData(entry._source['performance-data']['time4-states']),
706 time4L: checkData(entry._source['performance-data']['time4-states-l']),
707 time16S: checkData(entry._source['performance-data']['time16-states-s']),
708 time16: checkData(entry._source['performance-data']['time16-states']),
709 time16L: checkData(entry._source['performance-data']['time16-states-l']),
710 time32S: checkData(entry._source['performance-data']['time32-states-s']),
711 time32: checkData(entry._source['performance-data']['time32-states']),
712 time32L: checkData(entry._source['performance-data']['time32-states-l']),
713 time64S: checkData(entry._source['performance-data']['time64-states-s']),
714 time64: checkData(entry._source['performance-data']['time64-states']),
715 time64L: checkData(entry._source['performance-data']['time64-states-l']),
716 time128S: checkData(entry._source['performance-data']['time128-states-s']),
717 time128: checkData(entry._source['performance-data']['time128-states']),
718 time128L: checkData(entry._source['performance-data']['time128-states-l']),
719 time256S: checkData(entry._source['performance-data']['time256-states-s']),
720 time256: checkData(entry._source['performance-data']['time256-states']),
721 time256L: checkData(entry._source['performance-data']['time256-states-l']),
722 time512S: checkData(entry._source['performance-data']['time512-states-s']),
723 time512: checkData(entry._source['performance-data']['time512-states']),
724 time512L: checkData(entry._source['performance-data']['time512-states-l']),
725 time1024S: checkData(entry._source['performance-data']['time1024-states-s']),
726 time1024: checkData(entry._source['performance-data']['time1024-states']),
727 time1024L: checkData(entry._source['performance-data']['time1024-states-l']),
728 time2048S: checkData(entry._source['performance-data']['time2048-states-s']),
729 time2048: checkData(entry._source['performance-data']['time2048-states']),
730 time2048L: checkData(entry._source['performance-data']['time2048-states-l']),
731 time4096S: checkData(entry._source['performance-data']['time4096-states-s']),
732 time4096: checkData(entry._source['performance-data']['time4096-states']),
733 time4096L: checkData(entry._source['performance-data']['time4096-states-l']),
734 time8192S: checkData(entry._source['performance-data']['time8192-states-s']),
735 time8192: checkData(entry._source['performance-data']['time8192-states']),
736 time8192L: checkData(entry._source['performance-data']['time8192-states-l']),
737 radiosignal: entry._source['radio-signal-id']
743 $scope.modulation = list;
744 $scope.gridOptionsModulation.totalItems = response.data.hits.total;
751 response.data.hits.hits.map(function (entry) {
753 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
754 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
755 layerProtocol: entry._source['layer-protocol-name'],
756 suspectInterval: entry._source['suspect-interval-flag'],
757 scannerId: entry._source['scanner-id'],
758 rfTempMin: entry._source['performance-data']['rf-temp-min'],
759 rfTempAvg: entry._source['performance-data']['rf-temp-avg'],
760 rfTempMax: entry._source['performance-data']['rf-temp-max'],
761 radiosignal: entry._source['radio-signal-id']
767 $scope.temperature = list;
768 $scope.gridOptionsTemperature.totalItems = response.data.hits.total;
775 response.data.hits.hits.map(function (entry) {
777 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
778 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
779 layerProtocol: entry._source['layer-protocol-name'],
780 suspectInterval: entry._source['suspect-interval-flag'],
781 scannerId: entry._source['scanner-id'],
782 snirMin: entry._source['performance-data']['snir-min'],
783 snirAvg: entry._source['performance-data']['snir-avg'],
784 snirMax: entry._source['performance-data']['snir-max'],
785 radiosignal: entry._source['radio-signal-id']
792 $scope.gridOptionsSnir.totalItems = response.data.hits.total;
796 case "crossPolarDiscrimination":
799 response.data.hits.hits.map(function (entry) {
801 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
802 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
803 layerProtocol: entry._source['layer-protocol-name'],
804 suspectInterval: entry._source['suspect-interval-flag'],
805 scannerId: entry._source['scanner-id'],
806 xpdMin: entry._source['performance-data']['xpd-min'],
807 xpdAvg: entry._source['performance-data']['xpd-avg'],
808 xpdMax: entry._source['performance-data']['xpd-max'],
809 radiosignal: entry._source['radio-signal-id']
816 $scope.crossPolarDiscrimination = list;
817 $scope.gridOptionsCrossPolarDiscrimination.totalItems = response.data.hits.total;
822 case "performanceEthernetContainer":
826 response.data.hits.hits.map(function (entry) {
828 timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']),
829 id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'],
830 layerProtocol: entry._source['layer-protocol-name'],
831 suspectInterval: entry._source['suspect-interval-flag'],
832 scannerId: entry._source['scanner-id'],
833 period: entry._source['granularity-period'],
834 txEthernetBytesMaxS: checkData(entry._source['performance-data']['tx-ethernet-bytes-max-s']),
835 txEthernetBytesMaxM: checkData(entry._source['performance-data']['tx-ethernet-bytes-max-m']),
836 txEthernetBytesSum: checkData(entry._source['performance-data']['tx-ethernet-bytes-sum'])
843 $scope.performanceEthernetContainer = list;
844 $scope.gridOptionsPerformanceEthernetContainer.totalItems = response.data.hits.total;
850 var getData = function (sort, query, grid, currFilter, currSort) {
852 // console.log(grid);
856 switch (grid.data) { //get pagesize / nr according to current grid (else everything gets messy => wana get next page in grid a, get next page for grid b too)
857 case 'performance826':
858 pagesize = $scope.gridOptionsPerformance826.paginationPageSize;
859 pagenr = $scope.gridOptionsPerformance826.paginationCurrentPage;
863 pagesize = $scope.gridOptionsReceiveLevel.paginationPageSize;
864 pagenr = $scope.gridOptionsReceiveLevel.paginationCurrentPage;
867 case 'transmissionLevel':
868 pagesize = $scope.gridOptionsTransmissionLevel.paginationPageSize;
869 pagenr = $scope.gridOptionsTransmissionLevel.paginationCurrentPage;
873 pagesize = $scope.gridOptionsModulation.paginationPageSize;
874 pagenr = $scope.gridOptionsModulation.paginationCurrentPage;
878 pagesize = $scope.gridOptionsTemperature.paginationPageSize;
879 pagenr = $scope.gridOptionsTemperature.paginationCurrentPage;
883 pagesize = $scope.gridOptionsSnir.paginationPageSize;
884 pagenr = $scope.gridOptionsSnir.paginationCurrentPage;
887 case 'crossPolarDiscrimination':
888 pagesize = $scope.gridOptionsCrossPolarDiscrimination.paginationPageSize;
889 pagenr = $scope.gridOptionsCrossPolarDiscrimination.paginationCurrentPage;
892 case 'performanceEthernetContainer':
893 pagesize = $scope.gridOptionsPerformanceEthernetContainer.paginationPageSize;
894 pagenr = $scope.gridOptionsPerformanceEthernetContainer.paginationCurrentPage;
898 $mwtnLog.warning({component: COMPONENT, message: ['Unexpected grid.data', grid.data, '!'].join(' ')});
901 if (grid !== undefined) {
903 if ($scope.state.grid === null || $scope.state.grid === undefined) {
904 $scope.state.grid = grid.data;
907 //check, if sort/filter params are for current grid
908 if ($scope.state.grid !== grid.data) {
909 $scope.state.sort = false;
910 $scope.state.lastSort = null;
911 $scope.state.filter = false;
912 $scope.state.lastfilter = null;
913 if (currSort !== null) {
919 if (currFilter !== null) {
925 //update current grid
926 $scope.state.grid = grid.data;
930 if (!sort) { //default sort value
931 sort = [{ 'time-stamp': { order: 'desc' } }];
934 if (!query) { //default filter value
935 query = { query: { bool: { must: [{ prefix: globalFilter }] } } };
938 //add layer protocol selector to filter query
939 var localQuery = angular.copy(query); //copy the object for adding layerprotocol locally
940 var lpn = $scope.layerProtocol;
941 if (lpn === 'ETC' && $scope.revision.contains('2016')) lpn = 'ETH-CTP';
942 localQuery.query.bool.must.push({ prefix: { "layer-protocol-name": lpn } });
944 //add interface selector to filter query
945 if ($scope.selecteditem.selectedLtpId) {
946 localQuery.query.bool.must.push({ prefix: { "uuid-interface": $scope.selecteditem.selectedLtpId } });
949 var selected15minPeriod = true;
950 if ($scope.selecteditem.timePeriod !== $scope.timePeriods[0]) selected15minPeriod = false;
951 console.warn('selected15minPeriod', selected15minPeriod);
952 return $mwtnPerformanceHistory.getFilteredSortedData((pagenr - 1) * pagesize, pagesize, sort, localQuery, selected15minPeriod);
956 * function to calculate the current open tab
957 * @param status - Object of current tab opening information
958 * @param previousStatus - optional Object of previous tab opening information
959 * @return latest opened tab key or undefined, in case none is currently open
961 var getKey = function(status, previousStatus) {
962 var result = Object.keys(status).filter(function(key){
963 return status[key] === true && !(previousStatus && previousStatus[key])
965 if (result.length > 0) {
971 $scope.status = { performance826: true, performanceEthernetContainer: false };
974 $scope.$watch(function() {
975 return $scope.selecteditem;
976 }, function (newValue, oldValue) {
977 console.warn('selecteditem###', newValue, oldValue, $scope.networkElementId );
979 if (newValue.selectedLtpId && newValue.selectedLtpId !== oldValue.selectedLtpId && $scope.onfNetworkElement) {
980 $scope.layerProtocol = $scope.onfNetworkElement.getLpById(newValue.selectedLtpId).getLayer();
982 $scope.performance826 = [];
983 $scope.receiveLevel = [];
984 $scope.transmissionLevel = [];
985 $scope.modulation = [];
986 $scope.temperature = [];
987 $scope.performanceEthernetContainer = [];
989 $scope.crossPolarDiscrimination = [];
990 $scope.jsonvalue = [];
992 // if all tabs are closed - open first.
993 var isOneTabOpen = Object.keys($scope.status).filter(function(key){
994 return $scope.status[key] === true;
997 $scope.status = { performance826: $scope.layerProtocol === 'MWPS', performanceEthernetContainer: $scope.layerProtocol === 'ETC' };
1001 chooseGrid(getKey($scope.status));
1006 $scope.$watch('status', function (status, oldValue) {
1007 console.warn('status', status, oldValue,$scope.networkElementId );
1008 if ($scope.networkElementId && status && status !== oldValue) {
1009 chooseGrid(getKey(status, oldValue));
1014 // $scope.$watch(function(){
1015 // $scope.selecteditem.timePeriod;
1016 // }, function (newValue, oldValue) {
1017 // console.warn('timePeriod', status, oldValue,$scope.networkElementId );
1018 // if (newValue && oldValue !== "" && newValue !== oldValue) {
1019 // chooseGrid(getKey($scope.status));
1023 $scope.collapseAll = function () {
1025 Object.keys($scope.status).map(function (group) {
1026 $scope.status[group] = false;
1028 Object.keys($scope.spinner).map(function (group) {
1029 $scope.spinner[group] = false;
1033 var order = $mwtnPerformanceHistory.layerProtocolNameOrder;
1036 * @function updateNe
1037 * A function, which updates onfNetworkElement by new data.
1038 * @param {*} data New data recieved from OpenDaylight via RestConf
1040 var updateNe = function(data) {
1042 // update onfNetworkElement
1043 switch ($scope.revision) {
1050 // console.log(JSON.stringify(data));
1051 $scope.onfNetworkElement = new OnfNetworkElement(data['network-element']);
1052 $scope.onfLtps = $scope.onfNetworkElement.getLogicalTerminationPoints().filter(function(ltp){
1053 return ltp.getLayer() === 'MWPS' || ltp.getLayer() === 'ETC';
1054 }).sort(function(a, b){
1055 if(order[a.getLayer()] < order[b.getLayer()]) return 1;
1056 if(order[a.getLayer()] > order[b.getLayer()]) return -1;
1057 if(a.getId() < b.getId()) return -1;
1058 if(a.getId() > b.getId()) return 1;
1061 $scope.availableLtpIds = $scope.onfLtps.map(function(ltp){
1062 return {key: ltp.getLayerProtocols()[0].getId(), label:ltp.getLabel()};
1064 if ($scope.availableLtpIds.length > 0) {
1065 $scope.selecteditem.selectedLtpId = $scope.availableLtpIds[0].key;
1069 $mwtnLog.info({component: COMPONENT, message: ['The ONF Microwave Model revision', $scope.revision, ' is not supported (yet)!'].join(' ')});
1070 $scope.onfNetworkElement = {};
1071 $scope.onfLtps = {};
1075 var updatePart = function(spec, data) {
1076 switch (spec.pacId) {
1083 //get data on ne selection
1084 $scope.$watch('networkElement', function (neId, oldValue) {
1085 console.warn('networkElement', neId, oldValue,$scope.networkElementId );
1087 if (neId && neId !== '' && neId !== oldValue) {
1088 $scope.selecteditem.selectedLtpId = undefined;
1090 $scope.networkElements.map(function (ne) {
1091 if (ne.id === neId) revision = ne.revision;
1093 $scope.networkElementId = neId;
1094 $scope.revision = revision;
1097 var filter = { "query": { "bool": { "must": [{ "prefix": { "node-name": $scope.networkElementId } }] } } };
1098 // var filter={"query":{"bool":{"must":[{"prefix":{"node-name": "new"}}]}}}; //first part of my local simulator name
1099 globalFilter = filter.query.bool.must[0].prefix;
1100 $scope.state.filter = true;
1101 $scope.state.lastfilter = filter;
1102 $scope.state.sort = false;
1103 $scope.state.lastSort = null;
1105 // get onf network element data
1107 nodeId: $scope.networkElementId,
1108 revision: $scope.revision,
1111 console.warn('PM HIstory getPacPMHistory', JSON.stringify(spec));
1112 $mwtnPerformanceHistory.getPacParts(spec).then(function(success){
1113 $scope.collapseAll();
1114 // console.warn('PM HIstory getPacPMHistory', JSON.stringify(success));
1115 updatePart(spec, $mwtnPerformanceHistory.yangifyObject(success));
1117 console.error(JSON.stringify(error));
1118 $scope.collapseAll();
1119 updatePart(spec, error);
1124 var chooseGrid = function (key) {
1125 if (!$scope.networkElementId || !key) return;
1129 case 'performance826':
1130 getData(null, null, $scope.gridOptionsPerformance826).then(function (response) {
1131 if (response.data.hits.hits) {
1132 processRequestInGrid(response, $scope.gridOptionsPerformance826);
1137 case 'receiveLevel':
1138 getData(null, null, $scope.gridOptionsReceiveLevel).then(function (response) {
1139 if (response.data.hits.hits) {
1140 processRequestInGrid(response, $scope.gridOptionsReceiveLevel);
1145 case 'transmissionLevel':
1146 getData(null, null, $scope.gridOptionsTransmissionLevel).then(function (response) {
1147 if (response.data.hits.hits) {
1148 processRequestInGrid(response, $scope.gridOptionsTransmissionLevel);
1154 getData(null, null, $scope.gridOptionsModulation).then(function (response) {
1155 if (response.data.hits.hits) {
1156 processRequestInGrid(response, $scope.gridOptionsModulation);
1162 getData(null, null, $scope.gridOptionsTemperature).then(function (response) {
1163 if (response.data.hits.hits) {
1164 processRequestInGrid(response, $scope.gridOptionsTemperature);
1170 getData(null, null, $scope.gridOptionsSnir).then(function (response) {
1171 if (response.data.hits.hits) {
1172 processRequestInGrid(response, $scope.gridOptionsSnir);
1177 case 'crossPolarDiscrimination':
1178 getData(null, null, $scope.gridOptionsCrossPolarDiscrimination).then(function (response) {
1179 if (response.data.hits.hits) {
1180 processRequestInGrid(response, $scope.gridOptionsCrossPolarDiscrimination);
1185 case 'performanceEthernetContainer':
1186 getData(null, null, $scope.gridOptionsPerformanceEthernetContainer).then(function (response) {
1187 if (response.data.hits.hits) {
1188 processRequestInGrid(response, $scope.gridOptionsPerformanceEthernetContainer);
1193 $window.dispatchEvent(new Event("resize"));