2 * Copyright (c) 2016 highstreet technologies GmbH and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 define(['app/mwtnSpectrum/mwtnSpectrum.module'],function(mwtnSpectrumApp) {
12 mwtnSpectrumApp.register.factory('$mwtnSpectrum', function($q, $mwtnCommons, $mwtnLog) {
15 service.gridOptions = $mwtnCommons.gridOptions;
16 service.highlightFilteredHeader = $mwtnCommons.highlightFilteredHeader;
17 service.getActualNetworkElement = $mwtnCommons.getActualNetworkElement;
18 service.getPacParts = $mwtnCommons.getPacParts;
21 service.execute = function() {
24 url: 'operations/scheduler:next'
26 var deferred = $q.defer();
27 $mwtnCommons.genericRequest(request).then(function(success) {
28 deferred.resolve(success);
30 deferred.reject(error);
32 return deferred.promise;
35 service.refresh = function() {
36 var deferred = $q.defer();
37 $mwtnCommons.getRequiredNetworkElements(true).then(function(pNes){
38 var neIds = pNes.map(function(pNe){
39 pNe._source.connectionStatus = 'disconnected';
42 $mwtnCommons.getMountPoints(). then(function(mountpoints){
43 var actualNodes = mountpoints.map(function(mountpoint){
44 var pIndex = neIds.indexOf(mountpoint['node-id']);
46 pNes[pIndex]._source.connectionStatus = mountpoint['netconf-node-topology:connection-status'];
49 id: mountpoint['node-id'],
50 connectionStatus: mountpoint['netconf-node-topology:connection-status']
53 var airInterfaces = [];
54 pNes.map(function(hit){
55 hit._source.MW_AirInterface_Pac.filter(function(airinterface){
56 return airinterface.airInterfaceConfiguration;
57 }).map(function(airinterface){
59 id: $mwtnCommons.getNodeIntIdFromNodeId(hit._source.nodeId),
60 name: hit._source.nodeId,
61 connectionStatus: hit._source.connectionStatus,
62 airInterfaceName: airinterface.airInterfaceConfiguration.airInterfaceName,
63 radioSignalID: airinterface.airInterfaceConfiguration.radioSignalID,
64 plannedTxFrequency: airinterface.airInterfaceConfiguration.txFrequency,
65 actualTxFrequency: '?',
66 plannedRxFrequency: airinterface.airInterfaceConfiguration.rxFrequency,
67 actualRxFrequency: '?'
72 airInterfaces.sort(function(a, b){
73 if(a.radioSignalID < b.radioSignalID) return -1;
74 if(a.radioSignalID > b.radioSignalID) return 1;
77 deferred.resolve({airInterfaces: airInterfaces, actualNodes: actualNodes});
85 return deferred.promise;