summaryrefslogtreecommitdiffstats
path: root/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src
diff options
context:
space:
mode:
authordemx8as6 <martin.skorupski@highstreet-technologies.com>2018-07-10 18:07:44 +0200
committerTimoney, Dan (dt5972) <dt5972@att.com>2018-07-11 16:30:28 -0400
commit27fb2d06608fbb070ae2c15a5580a4f5b2423d15 (patch)
treeccd717991b4e556b67f1fd2cacb345b4d174b41f /sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src
parent60315525ab5e7c12a9f47c409092e8dba6ad656d (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/mwtnClosedLoop/mwtnClosedLoop-module/src')
-rwxr-xr-xsdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/images/mwtnClosedLoop.pngbin0 -> 3524 bytes
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop-custom.css26
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.controller.js160
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.module.js51
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.services.js74
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.tpl.html64
6 files changed, 375 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/images/mwtnClosedLoop.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/images/mwtnClosedLoop.png
new file mode 100755
index 00000000..b4ed3d5c
--- /dev/null
+++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/images/mwtnClosedLoop.png
Binary files differ
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop-custom.css
new file mode 100644
index 00000000..6e9a480c
--- /dev/null
+++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop-custom.css
@@ -0,0 +1,26 @@
+/**
+ * Add your application related css here
+ */
+
+.mwtnClosedLoopGrid {
+ height: 600px;
+ background-color: white;
+}
+
+.mwtnClosedLoopGrid span {
+ color: #393939;
+}
+
+.mwtnClosedLoopGrid span.mismatch {
+ font-weight: bold;
+ color: #428bca;
+}
+
+.mwtnClosedLoopGrid .green {
+ color: darkgreen;
+}
+.mwtnClosedLoopGrid .green span {
+ color: darkgreen;
+}
+
+ \ No newline at end of file
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.controller.js
new file mode 100644
index 00000000..99ad48b7
--- /dev/null
+++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.controller.js
@@ -0,0 +1,160 @@
+/*
+ * 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/mwtnClosedLoop/mwtnClosedLoop.module','app/mwtnClosedLoop/mwtnClosedLoop.services','app/mwtnCommons/mwtnCommons.services'], function(mwtnClosedLoopApp) {
+
+ mwtnClosedLoopApp.register.controller('mwtnClosedLoopCtrl', ['$scope', '$rootScope', 'uiGridConstants', '$mwtnClosedLoop', '$mwtnCommons', '$mwtnLog', 'OnfNetworkElement', 'MicrowavePhysicalSection',
+ function($scope, $rootScope, uiGridConstants, $mwtnClosedLoop, $mwtnCommons, $mwtnLog, OnfNetworkElement, MicrowavePhysicalSection) {
+
+ var COMPONENT = 'mwtnClosedLoopCtrl';
+ $mwtnLog.info({component: COMPONENT, message: 'Started!'});
+
+ $rootScope.section_logo = 'src/app/mwtnClosedLoop/images/mwtnClosedLoop.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif'
+
+ $scope.timerOptionList = [
+ {id : '5seconds', name : "5 seconds"},
+ {id : '30seconds', name : "30 seconds"},
+ {id : '1minute', name : "One minute"},
+ {id : '2minutes', name : "Two minutes"},
+ {id : '30minutes', name : "30 minutes"},
+ {id : '1hour', name : "One hour"}];
+
+ var clearMessages = function() {
+ $scope.info = undefined;
+ $scope.error = undefined;
+ };
+
+ $scope.executeNow = function() {
+ clearMessages();
+ $mwtnCommons.executeClosedLoopAutomation().then(function(message){
+ $mwtnLog.info({component: 'mwtnClosedLoopCtrl', message: 'Closed loop automation was started'});
+ $scope.info = 'Closed loop automation was executed: ' + new Date().toISOString().toHumanReadableTimeFormat();
+ $scope.refresh();
+ }, function(error){
+ $mwtnLog.error({component: 'mwtnClosedLoopCtrl', message: 'Cannot execute Closed Loop Automation'});
+ $scope.error = 'Cannot execute Closed Loop Automation';
+ $scope.refresh();
+ });
+ };
+
+ $scope.save = function() {
+ clearMessages();
+ $mwtnCommons.saveClosedLoopAutomation($scope.timerEnabled, $scope.timerOption).then(function(message){
+ $mwtnLog.info({component: 'mwtnClosedLoopCtrl', message: 'Timer was changed'});
+ $scope.info = 'Timer was changed';
+ $scope.refresh();
+ }, function(error){
+ $mwtnLog.error({component: 'mwtnClosedLoopCtrl', message: 'Cannot save timer'});
+ $scope.error = 'Cannot save timer';
+ $scope.refresh();
+ });
+ };
+
+ $scope.read = function() {
+ clearMessages();
+ $mwtnCommons.readClosedLoopAutomation().then(function(message){
+ $scope.timerEnabled = message.data.output.enabled;
+ $scope.timerOption = message.data.output.option;
+ $scope.refresh();
+ }, function(error){
+ $mwtnLog.error({component: 'mwtnClosedLoopCtrl', message: 'Cannot read configuration data from the server'});
+ $scope.error = 'Cannot read configuration data from the server';
+ $scope.refresh();
+ });
+ };
+
+ $scope.read();
+
+ 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.actualAirInterfaceName = data.airInterfaceConfiguration.airInterfaceName;
+ }
+ });
+ } else {
+ $scope.gridOptions.data.map(function(row){
+ if (row.nodeId === spec.nodeId) {
+ row.actualAirInterfaceName = '?';
+ }
+ });
+ }
+ };
+
+ $scope.processing = false;
+ $scope.refresh = function() {
+ $scope.processing = true;
+ $mwtnClosedLoop.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';
+ $mwtnClosedLoop.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'
+ };
+ $mwtnClosedLoop.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 = $mwtnClosedLoop.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('');
+
+ // ng-class="{\'mismatch\': {{row.entity.plannedAirInterfaceName}} !== grid.getCellValue(row, col) }"
+ var actualAirinterfaceNameTemplate = [
+ '<div class="ui-grid-cell-contents">',
+ ' <span>{{grid.getCellValue(row, col)}}</span>',
+ '</div>'].join('');
+
+ $scope.gridOptions = JSON.parse(JSON.stringify($mwtnClosedLoop.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: 'radioSignalID', type: 'string', displayName: 'Radio signal id', headerCellClass: $scope.highlightFilteredHeader, width : 130 },
+ { field: 'plannedAirInterfaceName', type: 'string', displayName: 'Planned airinterface name', headerCellClass: $scope.highlightFilteredHeader, width : 200 },
+ { field: 'actualAirInterfaceName', type: 'string', displayName: 'Actual airinterface name', headerCellClass: $scope.highlightFilteredHeader, width : 250, cellTemplate: actualAirinterfaceNameTemplate},
+ ];
+
+ $scope.refresh();
+
+ }]);
+
+
+});
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.module.js
new file mode 100644
index 00000000..cec6f69b
--- /dev/null
+++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.module.js
@@ -0,0 +1,51 @@
+/*
+ * 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 mwtnClosedLoopApp = angular.module('app.mwtnClosedLoop', ['ui.grid', 'ui.bootstrap', 'app.core', 'ui.router.state','config']);
+
+ mwtnClosedLoopApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) {
+ mwtnClosedLoopApp.register = {
+ controller : $controllerProvider.register,
+ directive : $compileProvider.directive,
+ factory : $provide.factory,
+ service : $provide.service
+
+ };
+
+
+ NavHelperProvider.addControllerUrl('app/mwtnClosedLoop/mwtnClosedLoop.controller');
+ NavHelperProvider.addToMenu('mwtnClosedLoop', {
+ "link" : "#/mwtnClosedLoop",
+ "active" : "main.mwtnClosedLoop",
+ "title" : "MWTN Closed Loop Automation",
+ "icon" : "fa fa-circle-o", // Add navigation icon css class here
+ "page" : {
+ "title" : "MWTN Closed Loop Automation",
+ "description" : "mwtnClosedLoop"
+ }
+ });
+
+ var access = routingConfig.accessLevels;
+
+ $stateProvider.state('main.mwtnClosedLoop', {
+ url: 'mwtnClosedLoop',
+ access: access.admin,
+ views : {
+ 'content' : {
+ templateUrl: 'src/app/mwtnClosedLoop/mwtnClosedLoop.tpl.html',
+ controller: 'mwtnClosedLoopCtrl'
+ }
+ }
+ });
+
+ });
+
+ return mwtnClosedLoopApp;
+});
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.services.js
new file mode 100644
index 00000000..96c8c3e7
--- /dev/null
+++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.services.js
@@ -0,0 +1,74 @@
+/*
+ * 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/mwtnClosedLoop/mwtnClosedLoop.module'],function(mwtnClosedLoopApp) {
+
+
+ mwtnClosedLoopApp.register.factory('$mwtnClosedLoop', function($q, $mwtnCommons, $mwtnLog) {
+ var service = {};
+
+ service.gridOptions = $mwtnCommons.gridOptions;
+ service.highlightFilteredHeader = $mwtnCommons.highlightFilteredHeader;
+ service.getActualNetworkElement = $mwtnCommons.getActualNetworkElement;
+ service.getPacParts = $mwtnCommons.getPacParts;
+
+
+ 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.map(function(airinterface){
+ return airinterface.airInterfaceConfiguration;
+ }).map(function(airinterface){
+ airInterfaces.push({
+ id: $mwtnCommons.getNodeIntIdFromNodeId(hit._source.nodeId),
+ name: hit._source.nodeId,
+ connectionStatus: hit._source.connectionStatus,
+ radioSignalID: airinterface.airInterfaceConfiguration.radioSignalID,
+ plannedAirInterfaceName: airinterface.airInterfaceConfiguration.airInterfaceName,
+ actualAirInterfaceName: '?'
+ });
+ });
+ });
+
+ 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/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.tpl.html
new file mode 100644
index 00000000..62a2aca0
--- /dev/null
+++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.tpl.html
@@ -0,0 +1,64 @@
+<ht-header help-link='sdnr/mwtn/mwtnClosedLoop/0.4.0/README.md'></ht-header>
+<div class="owl container">
+ <div class="row">
+ <div class="col-md-2 text-right">
+ <span class="white">{{'Timer ON/OFF' | translate}}</span>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <input type="checkbox" ng-model="timerEnabled">
+ </div>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="col-md-2 text-right">
+ <span class="white">{{'Timer Option' | translate}}</span>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <select class="form-control" ng-model="timerOption" ng-disabled="!timerEnabled">
+ <option ng-repeat="timerOption in timerOptionList" value="{{timerOption.id}}">{{timerOption.name}}</option>
+ </select>
+ </div>
+ </div>
+
+ <div class="col-md-6 text-right">
+ <div class="form-group">
+ <button type="button" class="btn btn-primary" ng-click="save()">{{'Save' | translate}}</button>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <hr />
+ <div class="col-md-2">
+ <div class="form-group">
+ <button type="button" class="btn btn-primary" ng-click="executeNow()">{{'Execute now' | translate}}</button>
+ </div>
+ </div>
+ <div class="col-md-8">
+ <div class="form-group">
+ <span class="white" ng-show="info">{{ info }}</span>
+ <span ng-show="error" class="mwtnError">{{ error }}</span>
+ </div>
+ </div>
+ <div clase="col-md-2 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 id="mwtnClosedLoopGrid" ui-grid="gridOptions" ui-grid-exporter
+ ui-grid-selection ui-grid-pinning ui-grid-resize-columns
+ ui-grid-move-columns class="mwtnClosedLoopGrid"></div>
+ </div>
+ </div>
+
+</div>
+<hr />
+<div class="owl">
+ <span class="white">ONAP SDN-R | ONF Wireless for @distversion@ - Build: @buildtime@</span>
+</div>