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/mwtnClosedLoop/mwtnClosedLoop.module'],function(mwtnClosedLoopApp) {
12 mwtnClosedLoopApp.register.factory('$mwtnClosedLoop', 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.refresh = function() {
22 var deferred = $q.defer();
23 $mwtnCommons.getRequiredNetworkElements(true).then(function(pNes){
24 var neIds = pNes.map(function(pNe){
25 pNe._source.connectionStatus = 'disconnected';
28 $mwtnCommons.getMountPoints(). then(function(mountpoints){
29 var actualNodes = mountpoints.map(function(mountpoint){
30 var pIndex = neIds.indexOf(mountpoint['node-id']);
32 pNes[pIndex]._source.connectionStatus = mountpoint['netconf-node-topology:connection-status'];
35 id: mountpoint['node-id'],
36 connectionStatus: mountpoint['netconf-node-topology:connection-status']
39 var airInterfaces = [];
40 pNes.map(function(hit){
41 hit._source.MW_AirInterface_Pac.map(function(airinterface){
42 return airinterface.airInterfaceConfiguration;
43 }).map(function(airinterface){
45 id: $mwtnCommons.getNodeIntIdFromNodeId(hit._source.nodeId),
46 name: hit._source.nodeId,
47 connectionStatus: hit._source.connectionStatus,
48 radioSignalID: airinterface.airInterfaceConfiguration.radioSignalID,
49 plannedAirInterfaceName: airinterface.airInterfaceConfiguration.airInterfaceName,
50 actualAirInterfaceName: '?'
55 airInterfaces.sort(function(a, b){
56 if(a.radioSignalID < b.radioSignalID) return -1;
57 if(a.radioSignalID > b.radioSignalID) return 1;
60 deferred.resolve({airInterfaces: airInterfaces, actualNodes: actualNodes});
68 return deferred.promise;