Assign image keyname and pubkey at vnf level
[ccsdk/apps.git] / sdnr / wireless-transport / code-Carbon-SR1 / ux / mwtnPerformanceCurrent / mwtnPerformanceCurrent-module / src / main / resources / mwtnPerformanceCurrent / mwtnPerformanceCurrent.controller.js
1 /*
2  * @copyright 2017 highstreet technologies GmbH and others.  All rights reserved.
3  *
4  * @license
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
8  */
9
10 define(['app/mwtnPerformanceCurrent/mwtnPerformanceCurrent.module',
11   'app/mwtnPerformanceCurrent/mwtnPerformanceCurrent.services'],
12   function (mwtnPerformanceCurrentApp) {
13
14     mwtnPerformanceCurrentApp.register.controller('mwtnPerformanceCurrentCtrl', ['$scope', '$rootScope', '$window', '$translate', '$mwtnLog', '$mwtnPerformanceCurrent', 'uiGridConstants', 'OnfNetworkElement', 
15                                                  function ($scope, $rootScope, $window, $translate, $mwtnLog, $mwtnPerformanceCurrent, uiGridConstants, OnfNetworkElement) {
16
17       var COMPONENT = 'mwtnPerformanceCurrent';
18       $mwtnLog.info({ component: COMPONENT, message: 'mwtnPerformanceCurrent started!' });
19
20       $rootScope.section_logo = 'src/app/mwtnPerformanceCurrent/images/mwtnPerformance.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif'
21
22       var radioSignalMap = new Map(); //holds uuid/singalid
23
24       var initPac = {
25         layerProtocol: 'unknown'
26       };
27
28       $scope.layerProtocol = 'MWPS';
29       $scope.layerProtocols = ['MWPS', 'ETC'];
30
31       var updateNe = function (data) {
32         if (!data) return;
33
34         // update onfNetworkElement
35         switch (data.revision) {
36           case '2016-03-23':
37             $mwtnLog.info({ component: COMPONENT, message: 'Revision ' + data.revision + 'not supported!' });
38             break;
39           default: //4. PoC
40             $scope.onfNetworkElement = JSON.parse(JSON.stringify(data['network-element']));
41             $scope.onfLtps = data['network-element'].ltp;
42             $scope.onfNetworkElement.ltpRefList = undefined;
43         }
44
45         // update onfLTPs
46         var order = $mwtnPerformanceCurrent.layerProtocolNameOrder;
47         $scope.onfLtps.sort(function (a, b) {
48           if (order[a.lp[0]['layer-protocol-name']] < order[b.lp[0]['layer-protocol-name']]) return -1;
49           if (order[a.lp[0]['layer-protocol-name']] > order[b.lp[0]['layer-protocol-name']]) return 1;
50           if (a.lp[0].uuid < b.lp[0].uuid) return -1;
51           if (a.lp[0].uuid > b.lp[0].uuid) return 1;
52           return 0;
53         });
54
55         // calculate conditional packages
56         $scope.airinterfaces = [];
57         $scope.ethernets = [];
58         $scope.tdms = [];
59         $scope.onfLtps.map(function (ltp) {
60           var lpId = ltp.lp[0].uuid;
61
62
63
64           switch (ltp.lp[0]['layer-protocol-name']) {
65             case "MWPS":
66               var init = JSON.parse(JSON.stringify(initPac));
67               init.layerProtocol = lpId;
68               $scope.airinterfaces.push(init);
69
70               break;
71             case "ETH-CTP":
72             case "ETC":
73               var init = JSON.parse(JSON.stringify(initPac));
74               init.layerProtocol = lpId;
75               $scope.ethernets.push(init);
76               break;
77
78             default:
79               $mwtnLog.info({ component: COMPONENT, message: 'The layerProtocol ' + ltp.lp[0]['layer-protocol-name'] + ' is not supported (yet)!' });
80           }
81         });
82
83         data.revision = undefined;
84       };
85
86       var updateAirInterface = function (data, key) {
87         // console.log(JSON.stringify(data), lpId);
88
89         if (Object.keys(data)[0].startsWith('air-interface-current-performance')) {
90
91           $scope.jsonvalue.push(data);
92           var label = new OnfNetworkElement($scope.onfNetworkElement).getLpById(data['layer-protocol']).getLabel() || data['layer-protocol'];
93           var radioSignal = radioSignalMap.get(data['layer-protocol'])
94           var list = data['air-interface-current-performance']['current-performance-data-list'] || data['air-interface-current-performance']['current-performance-data']; 
95           list.map(function(item) {
96
97
98             var timestamp = $mwtnPerformanceCurrent.formatTimeStamp(item.timestamp);
99
100             switch (key) {
101
102               case 'performance826':
103                 $scope.performance826.push({
104                   timestamp: timestamp,
105                   elapsedTime: checkData(item['elapsed-time']),
106                   suspectInterval: item['suspect-interval-flag'],
107                   scannerId: item['scanner-id'],
108                   id: label,
109                   period: item['granularity-period'],
110                   es: item['performance-data'].es,
111                   ses: item['performance-data'].ses,
112                   uas: item['performance-data'].unavailability,
113                   radioSignal: radioSignal
114                 });
115                 break;
116
117               case 'receiveLevel':
118                 $scope.receiveLevel.push({
119                   timestamp: timestamp,
120                   elapsedTime: checkData(item['elapsed-time']),
121                   suspectInterval: item['suspect-interval-flag'],
122                   scannerId: item['scanner-id'],
123                   id: label,
124                   period: item['granularity-period'],
125                   rxmin: checkData(item['performance-data']['rx-level-min']),
126                   rxmax: checkData(item['performance-data']['rx-level-max']),
127                   rxavg: checkData(item['performance-data']['rx-level-avg']),
128                   radioSignal: radioSignal
129                 });
130                 break;
131
132               case 'transmissionLevel':
133
134                 $scope.transmissionLevel.push({
135                   timestamp: timestamp,
136                   elapsedTime: checkData(item['elapsed-time']),
137                   suspectInterval: item['suspect-interval-flag'],
138                   scannerId: item['scanner-id'],
139                   id: label,
140                   period: item['granularity-period'],
141                   txmin: checkData(item['performance-data']['tx-level-min']),
142                   txmax: checkData(item['performance-data']['tx-level-max']),
143                   txavg: checkData(item['performance-data']['tx-level-avg']),
144                   radioSignal: radioSignal
145                 });
146
147                 break;
148
149               case 'modulation':
150
151                 $scope.modulation.push(
152                   {
153                     timestamp: timestamp,
154                     elapsedTime: checkData(item['elapsed-time']),
155                     suspectInterval: item['suspect-interval-flag'],
156                     scannerId: item['scanner-id'],
157                     id: label,
158                     period: item['granularity-period'],
159                     time2S: checkData(item['performance-data']['time2-states-s']),
160                     time2: checkData(item['performance-data']['time2-states']),
161                     time2L: checkData(item['performance-data']['time2-states-l']),
162                     time4S: checkData(item['performance-data']['time4-states-s']),
163                     time4: checkData(item['performance-data']['time4-states']),
164                     time4L: checkData(item['performance-data']['time4-states-l']),
165                     time16S: checkData(item['performance-data']['time16-states-s']),
166                     time16: checkData(item['performance-data']['time16-states']),
167                     time16L: checkData(item['performance-data']['time16-states-l']),
168                     time32S: checkData(item['performance-data']['time32-states-s']),
169                     time32: checkData(item['performance-data']['time32-states']),
170                     time32L: checkData(item['performance-data']['time32-states-l']),
171                     time64S: checkData(item['performance-data']['time64-states-s']),
172                     time64: checkData(item['performance-data']['time64-states']),
173                     time64L: checkData(item['performance-data']['time64-states-l']),
174                     time128S: checkData(item['performance-data']['time128-states-s']),
175                     time128: checkData(item['performance-data']['time128-states']),
176                     time128L: checkData(item['performance-data']['time128-states-l']),
177                     time256S: checkData(item['performance-data']['time256-states-s']),
178                     time256: checkData(item['performance-data']['time256-states']),
179                     time256L: checkData(item['performance-data']['time256-states-l']),
180                     time512S: checkData(item['performance-data']['time512-states-s']),
181                     time512: checkData(item['performance-data']['time512-states']),
182                     time512L: checkData(item['performance-data']['time512-states-l']),
183                     time1024S: checkData(item['performance-data']['time1024-states-s']),
184                     time1024: checkData(item['performance-data']['time1024-states']),
185                     time1024L: checkData(item['performance-data']['time1024-states-l']),
186                     time2048S: checkData(item['performance-data']['time2048-states-s']),
187                     time2048: checkData(item['performance-data']['time2048-states']),
188                     time2048L: checkData(item['performance-data']['time2048-states-l']),
189                     time4096S: checkData(item['performance-data']['time4096-states-s']),
190                     time4096: checkData(item['performance-data']['time4096-states']),
191                     time4096L: checkData(item['performance-data']['time4096-states-l']),
192                     time8192S: checkData(item['performance-data']['time8192-states-s']),
193                     time8192: checkData(item['performance-data']['time8192-states']),
194                     time8192L: checkData(item['performance-data']['time8192-states-l']),
195                     radioSignal: radioSignal
196                   });
197
198                 break;
199
200               case 'temperature':
201
202                 $scope.temperature.push({
203                   timestamp: timestamp,
204                   elapsedTime: checkData(item['elapsed-time']),
205                   suspectInterval: item['suspect-interval-flag'],
206                   scannerId: item['scanner-id'],
207                   id: label,
208                   period: item['granularity-period'],
209                   rfTempMin: item['performance-data']['rf-temp-min'],
210                   rfTempAvg: item['performance-data']['rf-temp-avg'],
211                   rfTempMax: item['performance-data']['rf-temp-max'],
212                   radioSignal: radioSignal
213                 });
214                 break;
215
216               case 'snir':
217
218                 $scope.snir.push({
219                   timestamp: timestamp,
220                   elapsedTime: checkData(item['elapsed-time']),
221                   suspectInterval: item['suspect-interval-flag'],
222                   scannerId: item['scanner-id'],
223                   id: label,
224                   period: item['granularity-period'],
225                   snirMin: item['performance-data']['snir-min'],
226                   snirAvg: item['performance-data']['snir-avg'],
227                   snirMax: item['performance-data']['snir-max'],
228                   radioSignal: radioSignal
229                 }
230                 );
231
232                 break;
233
234               case 'crossPolarDiscrimination':
235
236                 $scope.cpdData.push({
237
238                   timestamp: timestamp,
239                   elapsedTime: checkData(item['elapsed-time']),
240                   suspectInterval: item['suspect-interval-flag'],
241                   scannerId: item['scanner-id'],
242                   id: label,
243                   period: item['granularity-period'],
244                   xpdMin: item['performance-data']['xpd-min'],
245                   xpdAvg: item['performance-data']['xpd-avg'],
246                   xpdMax: item['performance-data']['xpd-max'],
247                   radioSignal: radioSignal
248                 });
249
250                 break;
251             }
252
253           });
254
255         }
256       };
257
258       var updateContainer = function (lpId, part, data) {
259         // console.log(JSON.stringify(data), lpId);
260         var label = new OnfNetworkElement($scope.onfNetworkElement).getLpById(data['layer-protocol']).getLabel() || data['layer-protocol'];
261
262         if (Object.keys(data)[0].contains('ethernet-container')) {
263           $scope.ethernetJsonValue.push(data);
264
265           var list = data['ethernet-container-current-performance']['current-performance-data-list'] || data['ethernet-container-current-performance']['current-performance-data']
266           list.map(function (item) {
267
268             $scope.performanceEthernetContainer.push({
269               timestamp: $mwtnPerformanceCurrent.formatTimeStamp(item['timestamp']),
270               elapsedTime: checkData(item['elapsed-time']),
271               suspectInterval: item['suspect-interval-flag'],
272               scannerId: item['scanner-id'],
273               period: item['granularity-period'],
274               txEthernetBytesMaxS: checkData(item['performance-data']['tx-ethernet-bytes-max-s']),
275               txEthernetBytesMaxM: checkData(item['performance-data']['tx-ethernet-bytes-max-m']),
276               txEthernetBytesSum: checkData(item['performance-data']['tx-ethernet-bytes-sum']),
277               id: label
278             });
279           });
280         }
281       };
282
283       //replace -1 with undefined in json data
284       var checkData = function (value) {
285         if (value === -1 || value === undefined) return undefined;
286         else return value;
287       };
288
289       //perf log configuration
290       $scope.gridOptionsPerformance826 = {
291         paginationPageSizes: [25, 100, 1000, 10000],
292         paginationPageSize: 25,
293         enablePaginationControls: true,
294         enableFiltering: true,
295         enableGridMenu: true,
296         columnDefs: [
297           
298           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
299           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
300           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
301           {
302             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
303               direction: uiGridConstants.ASC,
304               priority: 1
305             }
306           },
307           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
308           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
309           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
310           { field: 'es', type: 'string', displayName: 'ES', width: 70 },
311           { field: 'ses', type: 'string', displayName: 'SES', width: 70 },
312           { field: 'uas', type: 'string', displayName: 'UAS', width: 70 }
313         ],
314         data: 'performance826'
315       };
316
317       //receive lvl configuration
318       $scope.gridOptionsReceiveLevel = {
319         paginationPageSizes: [25, 100, 1000, 10000],
320         paginationPageSize: 25,
321         enablePaginationControls: true,
322         enableFiltering: true,
323         enableGridMenu: true,
324         columnDefs: [
325           
326           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
327           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
328           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
329           {
330             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
331               direction: uiGridConstants.ASC,
332               priority: 1
333             }
334           },
335           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
336           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
337           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
338           { field: 'rxmin', type: 'string', displayName: 'Rx min   [dBm]', width: 90 },
339           { field: 'rxavg', type: 'string', displayName: 'Rx avg   [dBm]', width: 90 },
340           { field: 'rxmax', type: 'string', displayName: 'Rx max   [dBm]', width: 90 }
341
342         ],
343         data: 'receiveLevel'
344       };
345
346       //transmission lvl configuration
347       $scope.gridOptionsTransmissionLevel = {
348         paginationPageSizes: [25, 100, 1000, 10000],
349         paginationPageSize: 25,
350         enablePaginationControls: true,
351         enableFiltering: true,
352         enableGridMenu: true,
353         columnDefs: [
354           
355           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
356           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
357           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
358           {
359             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
360               direction: uiGridConstants.ASC,
361               priority: 1
362             }
363           },
364           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
365           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
366           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
367           { field: 'txmin', type: 'string', displayName: 'Tx min   [dBm]', width: 90 },
368           { field: 'txavg', type: 'string', displayName: 'Tx avg   [dBm]', width: 90 },
369           { field: 'txmax', type: 'string', displayName: 'Tx max   [dBm]', width: 90 }
370
371         ],
372         data: 'transmissionLevel'
373       };
374
375       //modulation configuration
376       $scope.gridOptionsModulation = {
377         paginationPageSizes: [25, 100, 1000, 10000],
378         paginationPageSize: 25,
379         enablePaginationControls: true,
380         enableFiltering: true,
381         enableGridMenu: true,
382         columnDefs: [
383           
384           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
385           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
386           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
387           {
388             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
389               direction: uiGridConstants.ASC,
390               priority: 1
391             }
392           },
393           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
394           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
395           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
396           { field: 'time2S', type: 'string', displayName: 'QAM2S', width: 90 },
397           { field: 'time2', type: 'string', displayName: 'QAM2', width: 90 },
398           { field: 'time2L', type: 'string', displayName: 'QAM2L', width: 90 },
399           { field: 'time4S', type: 'string', displayName: 'QAM4S', width: 90 },
400           { field: 'time4', type: 'string', displayName: 'QAM4', width: 90 },
401           { field: 'time4L', type: 'string', displayName: 'QAM4L', width: 90 },
402           { field: 'time16S', type: 'string', displayName: 'QAM16S', width: 90 },
403           { field: 'time16', type: 'string', displayName: 'QAM16', width: 90 },
404           { field: 'time16L', type: 'string', displayName: 'QAM16L', width: 90 },
405           { field: 'time32S', type: 'string', displayName: 'QAM32S', width: 90 },
406           { field: 'time32', type: 'string', displayName: 'QAM32', width: 90 },
407           { field: 'time32L', type: 'string', displayName: 'QAM32L', width: 90 },
408           { field: 'time64S', type: 'string', displayName: 'QAM64S', width: 90 },
409           { field: 'time64', type: 'string', displayName: 'QAM64', width: 90 },
410           { field: 'time64L', type: 'string', displayName: 'QAM64L', width: 90 },
411           { field: 'time128S', type: 'string', displayName: 'QAM128S', width: 90 },
412           { field: 'time128', type: 'string', displayName: 'QAM128', width: 90 },
413           { field: 'time128L', type: 'string', displayName: 'QAM128L', width: 90 },
414           { field: 'time256S', type: 'string', displayName: 'QAM256S', width: 90 },
415           { field: 'time256', type: 'string', displayName: 'QAM256', width: 90 },
416           { field: 'time256L', type: 'string', displayName: 'QAM256L', width: 90 },
417           { field: 'time512S', type: 'string', displayName: 'QAM512S', width: 90 },
418           { field: 'time512', type: 'string', displayName: 'QAM512', width: 90 },
419           { field: 'time512L', type: 'string', displayName: 'QAM512L', width: 90 },
420           { field: 'time1024S', type: 'string', displayName: 'QAM1024S', width: 90 },
421           { field: 'time1024', type: 'string', displayName: 'QAM1024', width: 90 },
422           { field: 'time1024L', type: 'string', displayName: 'QAM1024L', width: 90 },
423           { field: 'time2048S', type: 'string', displayName: 'QAM2048S', width: 90 },
424           { field: 'time2048', type: 'string', displayName: 'QAM2048', width: 90 },
425           { field: 'time2048L', type: 'string', displayName: 'QAM2048L', width: 90 },
426           { field: 'time4096S', type: 'string', displayName: 'QAM4096S', width: 90 },
427           { field: 'time4096', type: 'string', displayName: 'QAM4096', width: 90 },
428           { field: 'time4096L', type: 'string', displayName: 'QAM4096L', width: 90 },
429           { field: 'time8192S', type: 'string', displayName: 'QAM8192S', width: 90 },
430           { field: 'time8192', type: 'string', displayName: 'QAM8192', width: 90 },
431           { field: 'time8192L', type: 'string', displayName: 'QAM8192L', width: 90 }
432
433         ],
434         data: 'modulation', onRegisterApi: function (gridApi) {
435           $scope.gridApi = gridApi;
436         }
437       };
438
439       //temperature configuration
440       $scope.gridOptionsTemperature = {
441         paginationPageSizes: [25, 100, 1000, 10000],
442         paginationPageSize: 25,
443         enablePaginationControls: true,
444         enableFiltering: true,
445         enableGridMenu: true,
446         columnDefs: [
447           
448           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
449           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
450           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
451           {
452             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
453               direction: uiGridConstants.ASC,
454               priority: 1
455             }
456           },
457           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
458           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
459           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
460           { field: 'rfTempMin', type: 'string', displayName: 'Rf Temp Min  [&deg;C]', width: 90 },
461           { field: 'rfTempAvg', type: 'string', displayName: 'Rf Temp Avg  [&deg;C]', width: 90 },
462           { field: 'rfTempMax', type: 'string', displayName: 'Rf Temp Max  [&deg;C]', width: 90 }
463
464         ],
465         data: 'temperature'
466       }
467
468       //SNIR configuration
469       $scope.gridOptionsSnir = {
470         paginationPageSizes: [25, 100, 1000, 10000],
471         paginationPageSize: 25,
472         enablePaginationControls: true,
473         enableFiltering: true,
474         enableGridMenu: true,
475         columnDefs: [
476           { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false},
477           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
478           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
479           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
480           {
481             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
482               direction: uiGridConstants.ASC,
483               priority: 1
484             }
485           },
486           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
487           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
488           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
489           { field: 'snirMin', type: 'string', displayName: [$translate.instant('MWTN_SNIR_MIN'),'[dB]'].join(' '), width: 90 },
490           { field: 'snirAvg', type: 'string', displayName: [$translate.instant('MWTN_SNIR_AVG'),'[dB]'].join(' '), width: 90 },
491           { field: 'snirMax', type: 'string', displayName: [$translate.instant('MWTN_SNIR_MAX'),'[dB]'].join(' '), width: 90 }
492         ],
493         data: 'snir'
494       }
495
496       //CPD Configuration
497       $scope.gridOptionsCrossPolarDiscrimination = {
498         paginationPageSizes: [25, 100, 1000, 10000],
499         paginationPageSize: 25,
500         enablePaginationControls: true,
501         enableFiltering: true,
502         enableGridMenu: true,
503         columnDefs: [
504           
505           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
506           { field: 'radioSignal', type: 'string', displayName: 'Radio Signal Id', width: 90 },
507           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
508           {
509             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
510               direction: uiGridConstants.ASC,
511               priority: 1
512             }
513           },
514           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
515           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
516           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
517           { field: 'xpdMin', type: 'string', displayName: 'CPD min  [dB]', width: 90 },
518           { field: 'xpdAvg', type: 'string', displayName: 'CPD avg  [dB]', width: 90 },
519           { field: 'xpdMax', type: 'string', displayName: 'CPD max  [dB]', width: 90 }
520
521         ],
522         data: 'cpdData'
523       }
524
525       //ethernet perf configuration
526       $scope.gridOptionsPerformanceEthernetContainer = {
527         paginationPageSizes: [25, 100, 1000, 10000],
528         paginationPageSize: 25,
529         enablePaginationControls: true,
530         enableFiltering: true,
531         enableGridMenu: true,
532         columnDefs: [
533           
534           { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LP'), width: 300 },
535           { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 },
536           {
537             field: 'timestamp', type: 'string', displayName: 'Request time', width: 200, sort: {
538               direction: uiGridConstants.ASC,
539               priority: 1
540             }
541           },
542           { field: 'elapsedTime', type: 'string', displayName: 'Elapsed Time', width: 100 },
543           { field: 'period', type: 'string', displayName: 'Period', width: 200 },
544           { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 },
545           { field: 'txEthernetBytesMaxS', type: 'number', displayName: 'Tx BytesMaxS', width: 90 },
546           { field: 'txEthernetBytesMaxM', type: 'number', displayName: 'Tx BytesMaxM', width: 90 },
547           { field: 'txEthernetBytesSum', type: 'number', displayName: 'Tx BytesSum', width: 90 }
548
549         ],
550         data: 'performanceEthernetContainer'
551       };
552
553       var updatePart = function (spec, data, key) {
554         switch (spec.pacId) {
555           case 'ne':
556             updateNe(data);
557             break;
558
559           case 'airinterface':
560             console.log(JSON.stringify(spec, JSON.stringify(data)));
561             updateAirInterface(data, key);
562             break;
563
564           case 'container':
565             updateContainer(spec.layerProtocolId, spec.partId, data);
566             break;
567
568         }
569       };
570
571       var refreshAirInterface = function (key) {
572         //get performance data from interfaces
573         for (var interf of $scope.airinterfaces) {
574           var airIterfaceSpec = {
575             nodeId: $scope.networkElementId,
576             revision: $scope.revision,
577             pacId: 'airinterface',
578             partId: 'CurrentPerformance',
579             layerProtocolId: interf.layerProtocol
580           };
581           $mwtnPerformanceCurrent.getPacParts(airIterfaceSpec).then(function (data) {
582             var yangfiedObj = $mwtnPerformanceCurrent.yangifyObject(data);
583             updatePart(airIterfaceSpec, yangfiedObj, key);
584           });
585         }
586       };
587
588       $scope.collapseAll = function () {
589         // close all groups
590         Object.keys($scope.status).map(function (group) {
591           $scope.status[group] = false;
592         });
593         Object.keys($scope.spinner).map(function (group) {
594           $scope.spinner[group] = false;
595         });
596       };
597
598       // events
599       $scope.status = { performanceEthernetContainer: true };
600       $scope.spinner = {};
601       $scope.separator = $mwtnPerformanceCurrent.separator; //'&nbsp;'
602
603       //get data on ne selection
604       $scope.$watch('networkElement', function (neId, oldValue) {
605         if (neId && neId !== '' && neId !== oldValue) {
606           $scope.collapseAll();
607
608           // clear lists visible on screen
609           $scope.performance826 = [];
610           $scope.receiveLevel = [];
611           $scope.transmissionLevel = [];
612           $scope.modulation = [];
613           $scope.temperature = [];
614           $scope.snir = [];
615           $scope.cpdData = [];
616           $scope.jsonvalue = [];
617           $scope.performanceEthernetContainer = [];
618           $scope.ethernetJsonValue = [];
619
620           var revision;
621           $scope.networkElements.map(function (ne) {
622             if (ne.id === neId) revision = ne.revision;
623           });
624           $scope.networkElementId = neId;
625           $scope.revision = revision;
626
627           var spec = {
628             nodeId: neId,
629             revision: revision,
630             pacId: 'ne'
631           };
632
633           //get ne data
634           $mwtnPerformanceCurrent.getPacParts(spec).then(function (success) {
635             var yangfiedObj = $mwtnPerformanceCurrent.yangifyObject(success);
636
637             updatePart(spec, yangfiedObj);
638
639             //get performance data from interfaces
640             $scope.airinterfaces.map(function(airInterface) {
641
642               //get configuration for airinterfaces
643               var airIterfaceSpec = {
644                 nodeId: neId,
645                 revision: revision,
646                 pacId: 'airinterface',
647                 partId: 'Configuration',
648                 layerProtocolId: airInterface.layerProtocol
649               };
650
651               //get radioSignalID and add it to map
652               $mwtnPerformanceCurrent.getPacParts(airIterfaceSpec).then(function (data) {
653                 var yangfiedObj = $mwtnPerformanceCurrent.yangifyObject(data);
654                 radioSignalMap.set(yangfiedObj['layer-protocol'], yangfiedObj['air-interface-configuration']['radio-signal-id']);
655               });
656             });
657
658           }, function (error) {
659             updatePart(spec, error);
660           });
661         }
662       });
663
664       $scope.$watch('layerProtocol', function (newValue, oldValue) {
665
666         if (newValue && oldValue !== "" && newValue !== oldValue) {
667           $scope.collapseAll();
668         }
669
670       }, true);
671
672       //update data within tables on accordion - open
673       $scope.$watch('status', function (status, oldValue) {
674         Object.keys(status).map(function (key) {
675           if ($scope.networkElementId && status[key] && status[key] !== oldValue[key]) {
676             switch (key) {
677
678               case 'performance826':
679                 $scope.performance826 = [];
680                 refreshAirInterface(key);
681                 break;
682
683               case 'receiveLevel':
684                 $scope.receiveLevel = [];
685                 refreshAirInterface(key);
686                 break;
687
688               case 'transmissionLevel':
689                 $scope.transmissionLevel = [];
690                 refreshAirInterface(key);
691                 break;
692
693               case 'modulation':
694                 $scope.modulation = [];
695                 refreshAirInterface(key);
696                 break;
697
698               case 'temperature':
699                 $scope.temperature = [];
700                 refreshAirInterface(key);
701                 break;
702
703               case 'snir':
704                 $scope.snir = [];
705                 refreshAirInterface(key);
706                 break;
707
708               case 'crossPolarDiscrimination':
709                 $scope.cpdData = [];
710                 refreshAirInterface(key);
711                 break;
712
713               case 'performanceEthernetContainer':
714                 $scope.performanceEthernetContainer = [];
715                 $scope.ethernetJsonValue = [];
716
717                 //get performance data for ethernet
718                 $scope.ethernets.map(function (item) {
719                   var ethernetSpec = {
720                     nodeId: $scope.networkElementId,
721                     revision: $scope.revision,
722                     pacId: 'container',
723                     partId: 'CurrentPerformance',
724                     layerProtocolId: item.layerProtocol
725                   };
726
727                   $mwtnPerformanceCurrent.getPacParts(ethernetSpec).then(function (data) {
728                     var yangfiedObj = $mwtnPerformanceCurrent.yangifyObject(data);
729                     updatePart(ethernetSpec, yangfiedObj);
730                   });
731                 });
732                 break;
733
734             }
735             $window.dispatchEvent(new Event("resize"));
736           }
737         });
738       }, true);
739
740     }]);
741   });