diff options
author | 2018-07-10 18:07:44 +0200 | |
---|---|---|
committer | 2018-07-11 16:30:28 -0400 | |
commit | 27fb2d06608fbb070ae2c15a5580a4f5b2423d15 (patch) | |
tree | ccd717991b4e556b67f1fd2cacb345b4d174b41f /sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module | |
parent | 60315525ab5e7c12a9f47c409092e8dba6ad656d (diff) |
Add seed code for sdnr app based on ONF Centennial
At this point in time all the Carbon code from ONF Centennial is added to ONAP.
Later it needs to be refactored and modified for ODL Oxygen.
Change-Id: Iff85dd940c05c3827f1c4e6f9542ecd060c58a46
Issue-ID: SDNC-374
Signed-off-by: demx8as6 <martin.skorupski@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module')
8 files changed, 403 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/pom.xml new file mode 100644 index 00000000..ca8ef939 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/pom.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mwtnSpectrum</artifactId> + <groupId>cn.com.zte.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <artifactId>mwtnSpectrum-module</artifactId> + <name>${prefix} ${project.artifactId}</name> + <packaging>jar</packaging> +</project>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/images/bluelight.gif b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/images/bluelight.gif Binary files differnew file mode 100644 index 00000000..33de2178 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/images/bluelight.gif diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/images/mwtnSpectrum.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/images/mwtnSpectrum.png Binary files differnew file mode 100755 index 00000000..23956335 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/images/mwtnSpectrum.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum-custom.css new file mode 100644 index 00000000..df461795 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum-custom.css @@ -0,0 +1,45 @@ +/** + * Add your application related css here + */ + +.alarm div { + height: 160px; + vertical-align: middle; +} + +.cleared { + color: lightgreen; +} +.cleared span { + color: lightgreen; +} + +.raised { + color: red; +} +.raised span { + color: red; +} + +.mwtnSpectrumGrid { + height: 600px; + background-color: white; +} + +.mwtnSpectrumGrid span { + color: #393939; +} + +.mwtnSpectrumGrid span.mismatch { + font-weight: bold; + color: #428bca; +} + +.mwtnSpectrumGrid .green { + color: darkgreen; +} +.mwtnSpectrumGrid .green span { + color: darkgreen; +} + +
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.controller.js new file mode 100644 index 00000000..f2433853 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.controller.js @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2016 highstreet technologies GmbH and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['app/mwtnSpectrum/mwtnSpectrum.module', + 'app/mwtnSpectrum/mwtnSpectrum.services', + 'app/mwtnCommons/mwtnCommons.services'], function(mwtnSpectrumApp) { + + mwtnSpectrumApp.register.controller('mwtnSpectrumCtrl', ['$scope', '$rootScope', 'uiGridConstants','$mwtnSpectrum', '$mwtnLog', 'OnfNetworkElement', 'MicrowavePhysicalSection', + function($scope, $rootScope, uiGridConstants, $mwtnSpectrum, $mwtnLog, OnfNetworkElement, MicrowavePhysicalSection) { + + var COMPONENT = 'mwtnSpectrumCtrl'; + $mwtnLog.info({component: COMPONENT, message: 'mwtnSpectrumCtrl started!'}); + + $rootScope.section_logo = 'src/app/mwtnSpectrum/images/mwtnSpectrum.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif' + + $scope.interference = { + alarmStatus: 'cleared' + }; + + $scope.execute = function() { + $scope.interference.alarmStatus = 'raised'; + $mwtnSpectrum.execute().then(function(success) { + $scope.interference.alarmStatus = 'cleared'; + }, function(error) { + $scope.interference.alarmStatus = 'cleared'; + }); + }; + $scope.clear = function() { + console.log("Cleared"); + $scope.interference.alarmStatus = 'cleared'; + }; + + var updateAirInterface = function(spec, data) { + if (data) { + var radioSignalID = data.airInterfaceConfiguration.radioSignalID; + $scope.gridOptions.data.map(function(row){ + if (row.name === spec.nodeId && row.radioSignalID === radioSignalID) { + row.actualTxFrequency = data.airInterfaceConfiguration.txFrequency; + row.actualRxFrequency = data.airInterfaceConfiguration.rxFrequency; + } + }); + } else { + $scope.gridOptions.data.map(function(row){ + if (row.nodeId === spec.nodeId) { + row.actualTxFrequency = '?'; + row.actualRxFrequency = '?'; + } + }); + } + }; + + $scope.processing = false; + $scope.refresh = function() { + $scope.processing = true; + $scope.interference.alarmStatus = 'cleared'; + $mwtnSpectrum.refresh().then(function(success){ + $scope.processing = false; + $scope.gridOptions.data = success.airInterfaces; + success.actualNodes.map(function(actualNode){ + if (actualNode.connectionStatus !== 'connected') { + return; + } + var revision = '2016-09-01'; + $mwtnSpectrum.getActualNetworkElement(actualNode.id, revision).then(function(onfNe){ + var aOnfNe = new OnfNetworkElement(onfNe.NetworkElement); + aOnfNe.getLTPMwpsList().map(function(ltp){ + var spec = { + nodeId: actualNode.id, + revision: revision, + pacId: 'airinterface', + layerProtocolId: ltp._lpList[0].uuid, + partId: 'Configuration' + }; + $mwtnSpectrum.getPacParts(spec).then(function(success){ + updateAirInterface(spec, success); + }, function(error){ + updateAirInterface(spec, error); + }); + }); + }, function(error){ + // do nothing + }); + }); + }, function(error){ + $scope.processing = false; + $scope.gridOptions.data = []; + }); + }; + + $scope.highlightFilteredHeader = $mwtnSpectrum.highlightFilteredHeader; + + var requiredNesConnectionStatusCellTemplate = [ + '<div class="ui-grid-cell-contents" ng-class="{ \'green\': grid.getCellValue(row, col) === \'connected\'}"}>', + ' <i ng-show="grid.getCellValue(row, col) === \'connected\'" class="fa fa-link" aria-hidden="true"></i>', + ' <span>{{grid.getCellValue(row, col)}}</span>', + '</div>'].join(''); + + var actualTxFrequencyCellTemplate = [ + '<div class="ui-grid-cell-contents" ng-class="{ \'green\': grid.getCellValue(row, col) === \'connected\'}"}>', + ' <span ng-class="{\'mismatch\': {{row.entity.plannedTxFrequency}} !== grid.getCellValue(row, col) }">{{grid.getCellValue(row, col)}}</span>', + '</div>'].join(''); + + var actualRxFrequencyCellTemplate = [ + '<div class="ui-grid-cell-contents" ng-class="{ \'green\': grid.getCellValue(row, col) === \'connected\'}"}>', + ' <span ng-class="{\'mismatch\': {{row.entity.plannedRxFrequency}} !== grid.getCellValue(row, col) }">{{grid.getCellValue(row, col)}}</span>', + '</div>'].join(''); + + $scope.gridOptions = JSON.parse(JSON.stringify($mwtnSpectrum.gridOptions)); + $scope.gridOptions.columnDefs = [ + { field: 'id', type: 'number', displayName: 'Id', headerCellClass: $scope.highlightFilteredHeader, width : 50, cellClass: 'number', pinnedLeft : true , sort: { + direction: uiGridConstants.ASC, + ignoreSort: false, + priority: 0 + }}, + { field: 'name', type: 'string', displayName: 'Name', headerCellClass: $scope.highlightFilteredHeader, width : 140 }, + { field: 'connectionStatus', type: 'string', displayName: 'Connection status', headerCellClass: $scope.highlightFilteredHeader, width : 150, cellTemplate: requiredNesConnectionStatusCellTemplate }, + { field: 'airInterfaceName', type: 'string', displayName: 'Airinterface name', headerCellClass: $scope.highlightFilteredHeader, width : 140 }, + { field: 'radioSignalID', type: 'string', displayName: 'Radio signal id', headerCellClass: $scope.highlightFilteredHeader, width : 130 }, + { field: 'plannedTxFrequency', type: 'number', displayName: 'TX (plan)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number' }, + { field: 'actualTxFrequency', type: 'number', displayName: 'TX (actual)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number', cellTemplate: actualTxFrequencyCellTemplate}, + { field: 'plannedRxFrequency', type: 'number', displayName: 'RX (plan)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number' }, + { field: 'actualRxFrequency', type: 'number', displayName: 'RX (actual)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number', cellTemplate: actualRxFrequencyCellTemplate} + ]; + + $scope.refresh(); + + }]); + + +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.module.js new file mode 100644 index 00000000..238f3ad3 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.module.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 highstreet technologies GmbH and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['angularAMD', + 'app/routingConfig', + 'app/core/core.services', + 'common/config/env.module', + 'app/mwtnCommons/mwtnCommons.module'], function(ng) { + var mwtnSpectrumApp = angular.module('app.mwtnSpectrum', ['ui.grid', 'ui.bootstrap', 'app.core', 'ui.router.state','config']); + + mwtnSpectrumApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) { + mwtnSpectrumApp.register = { + controller : $controllerProvider.register, + directive : $compileProvider.directive, + factory : $provide.factory, + service : $provide.service + + }; + + + NavHelperProvider.addControllerUrl('app/mwtnSpectrum/mwtnSpectrum.controller'); + NavHelperProvider.addToMenu('mwtnSpectrum', { + "link" : "#/mwtnSpectrum", + "active" : "main.mwtnSpectrum", + "title" : "MWTN Spectrum", + "icon" : "fa fa-bar-chart", // Add navigation icon css class here + "page" : { + "title" : "MWTN Spectrum", + "description" : "mwtnSpectrum" + } + }); + + var access = routingConfig.accessLevels; + + $stateProvider.state('main.mwtnSpectrum', { + url: 'mwtnSpectrum', + access: access.admin, + views : { + 'content' : { + templateUrl: 'src/app/mwtnSpectrum/mwtnSpectrum.tpl.html', + controller: 'mwtnSpectrumCtrl' + } + } + }); + + }); + + return mwtnSpectrumApp; +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.services.js new file mode 100644 index 00000000..df822a9b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.services.js @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016 highstreet technologies GmbH and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['app/mwtnSpectrum/mwtnSpectrum.module'],function(mwtnSpectrumApp) { + + + mwtnSpectrumApp.register.factory('$mwtnSpectrum', function($q, $mwtnCommons, $mwtnLog) { + var service = {}; + + service.gridOptions = $mwtnCommons.gridOptions; + service.highlightFilteredHeader = $mwtnCommons.highlightFilteredHeader; + service.getActualNetworkElement = $mwtnCommons.getActualNetworkElement; + service.getPacParts = $mwtnCommons.getPacParts; + + + service.execute = function() { + var request = { + method: 'POST', + url: 'operations/scheduler:next' + }; + var deferred = $q.defer(); + $mwtnCommons.genericRequest(request).then(function(success) { + deferred.resolve(success); + }, function(error) { + deferred.reject(error); + }); + return deferred.promise; + }; + + service.refresh = function() { + var deferred = $q.defer(); + $mwtnCommons.getRequiredNetworkElements(true).then(function(pNes){ + var neIds = pNes.map(function(pNe){ + pNe._source.connectionStatus = 'disconnected'; + return pNe._id; + }); + $mwtnCommons.getMountPoints(). then(function(mountpoints){ + var actualNodes = mountpoints.map(function(mountpoint){ + var pIndex = neIds.indexOf(mountpoint['node-id']); + if (pIndex > -1) { + pNes[pIndex]._source.connectionStatus = mountpoint['netconf-node-topology:connection-status']; + } + return { + id: mountpoint['node-id'], + connectionStatus: mountpoint['netconf-node-topology:connection-status'] + }; + }); + var airInterfaces = []; + pNes.map(function(hit){ + hit._source.MW_AirInterface_Pac.filter(function(airinterface){ + return airinterface.airInterfaceConfiguration; + }).map(function(airinterface){ + airInterfaces.push({ + id: $mwtnCommons.getNodeIntIdFromNodeId(hit._source.nodeId), + name: hit._source.nodeId, + connectionStatus: hit._source.connectionStatus, + airInterfaceName: airinterface.airInterfaceConfiguration.airInterfaceName, + radioSignalID: airinterface.airInterfaceConfiguration.radioSignalID, + plannedTxFrequency: airinterface.airInterfaceConfiguration.txFrequency, + actualTxFrequency: '?', + plannedRxFrequency: airinterface.airInterfaceConfiguration.rxFrequency, + actualRxFrequency: '?' + }); + }); + }); + + airInterfaces.sort(function(a, b){ + if(a.radioSignalID < b.radioSignalID) return -1; + if(a.radioSignalID > b.radioSignalID) return 1; + return 0; + }); + deferred.resolve({airInterfaces: airInterfaces, actualNodes: actualNodes}); + }, function(error){ + deferred.reject([]); + }); + + }, function(error){ + deferred.reject([]); + }); + return deferred.promise; + }; + + return service; + }); +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.tpl.html new file mode 100644 index 00000000..ae9543dd --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnSpectrum/mwtnSpectrum-module/src/main/resources/mwtnSpectrum/mwtnSpectrum.tpl.html @@ -0,0 +1,64 @@ +<ht-header help-link='sdnr/mwtnSpectrum/0.4.0/README.md'></ht-header> +<div class="owl container"> + <div class="row"> + <div clase="col-md-12 text-left radio" + ng-class="{'raised':interference.alarmStatus !== 'cleared', 'cleared':interference.alarmStatus === 'cleared' }"> + <span>{{'MWTN_INTERFERENCE_ALARM_STATUS' | translate}}: </span> + <i class="fa fa-bell" aria-hidden="true" ng-show="interference.alarmStatus !== 'cleared'"></i> + <span>{{interference.alarmStatus}}</span> + </div> + </div> + <div class="row"> + <div clase="col-md-12"> + <hr/> + <button class="btn btn-lg btn-block" ng-click="execute()" ng-class="{'btn-danger':interference.alarmStatus !== 'cleared', 'btn-success':interference.alarmStatus === 'cleared' }"> + <div class="container" > + <div class="row alarm"> + <div class="col-md-2 text-left"> + <img ng-show="interference.alarmStatus !== 'cleared'" src="src/app/mwtnSpectrum/images/bluelight.gif" ></img> + </div> + <div class="col-md-8"> + </br></br> + <i class="fa" ng-class="{'fa-exclamation-triangle':interference.alarmStatus !== 'cleared', 'fa-question-circle-o':interference.alarmStatus === 'cleared' }" aria-hidden="true"></i> + <span ng-show="interference.alarmStatus !== 'cleared'">{{'MWTN_INTERFERENCE_ALARM!' | translate}}</span> + <span ng-show="interference.alarmStatus === 'cleared'">{{'MWTN_INTERFERENCE_ALARM?' | translate}}</span> + </div> + <div class="col-md-2"> + <img ng-show="interference.alarmStatus !== 'cleared'" src="src/app/mwtnSpectrum/images/bluelight.gif" ></img> + </div> + </div> + </div> + </button> + <hr/> + </div> + </div> +<!-- <div class="row"> + <div clase="col-md-12"> + <button class="btn btn-success" ng-click="clear()"> + <i class="fa fa-magic" aria-hidden="true"></i> + <span>{{'MWTN_CLEAR' | translate}}</span> + </button> + </div> + </div> --> + <div class="row"> + <div clase="col-md-12 text-right"> + <button class="btn btn-primary pull-right" ng-click="refresh()"> + <i class="fa fa-refresh" ng-class="{'fa-spin':processing == true}" aria-hidden="true"></i> + <span>{{'MWTN_REFRESH' | translate}}</span> + </button> + </div> + </div> + <div class="row"> + <div clase="col-md-12"> + <div><span class="white">All frequencies in kHz</span></div> + <div id="mwtnSpectrumGrid" ui-grid="gridOptions" ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns ui-grid-move-columns + class="mwtnSpectrumGrid"> + </div> + </div> + </div> + +</div> +<hr /> +<div class="owl"> + <span class="white">ONAP SDN-R | ONF Wireless for @distversion@ - Build: @buildtime@</span> +</div>
\ No newline at end of file |