From 27fb2d06608fbb070ae2c15a5580a4f5b2423d15 Mon Sep 17 00:00:00 2001 From: demx8as6 Date: Tue, 10 Jul 2018 18:07:44 +0200 Subject: 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 --- .../mwtnClosedLoop/mwtnClosedLoop-module/pom.xml | 15 ++ .../mwtnClosedLoop/images/mwtnClosedLoop.png | Bin 0 -> 3524 bytes .../mwtnClosedLoop/mwtnClosedLoop-custom.css | 26 ++++ .../mwtnClosedLoop/mwtnClosedLoop.controller.js | 160 +++++++++++++++++++++ .../mwtnClosedLoop/mwtnClosedLoop.module.js | 51 +++++++ .../mwtnClosedLoop/mwtnClosedLoop.services.js | 74 ++++++++++ .../mwtnClosedLoop/mwtnClosedLoop.tpl.html | 64 +++++++++ 7 files changed, 390 insertions(+) create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/pom.xml create mode 100755 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/images/mwtnClosedLoop.png create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop-custom.css create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.controller.js create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.module.js create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.services.js create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/mwtnClosedLoop.tpl.html (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module') diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/pom.xml new file mode 100644 index 00000000..aadd37ce --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + mwtnClosedLoop + com.highstreet.technologies.odl.dlux + 0.5.1-SNAPSHOT + .. + + mwtnClosedLoop-module + ${prefix} ${project.artifactId} + jar + \ No newline at end of file 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 Binary files /dev/null and b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnClosedLoop/mwtnClosedLoop-module/src/main/resources/mwtnClosedLoop/images/mwtnClosedLoop.png 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 = [ + '
', + ' ', + ' {{grid.getCellValue(row, col)}}', + '
'].join(''); + + // ng-class="{\'mismatch\': {{row.entity.plannedAirInterfaceName}} !== grid.getCellValue(row, col) }" + var actualAirinterfaceNameTemplate = [ + '
', + ' {{grid.getCellValue(row, col)}}', + '
'].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 @@ + +
+
+
+ {{'Timer ON/OFF' | translate}} +
+
+
+ +
+
+
+ +
+
+ {{'Timer Option' | translate}} +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+ {{ info }} + {{ error }} +
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+ ONAP SDN-R | ONF Wireless for @distversion@ - Build: @buildtime@ +
-- cgit 1.2.3-korg