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/mwtnTdm | |
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/mwtnTdm')
10 files changed, 452 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-bundle/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-bundle/pom.xml new file mode 100644 index 00000000..11d9cec3 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-bundle/pom.xml @@ -0,0 +1,89 @@ +<?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>mwtnTdm</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>mwtnTdm-bundle</artifactId> + <name>${prefix} ${project.artifactId}</name> + <packaging>bundle</packaging> + <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <version>${osgi.core.version}</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${osgi.core.version}</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${apache.felix.compendium}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.dlux</groupId> + <artifactId>loader</artifactId> + <version>${dlux.loader.version}</version> + </dependency> + <dependency> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>mwtnTdm-module</artifactId> + <version>0.5.1-SNAPSHOT</version> + </dependency> + </dependencies> + <build> + <resources> + <resource> + <directory>target/generated-resources</directory> + </resource> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.6</version> + <executions> + <!--loader Resources --> + <execution> + <id>unpack-loader-resources</id> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <outputDirectory>${project.build.directory}/generated-resources</outputDirectory> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <includeArtifactIds>mwtnTdm-module</includeArtifactIds> + <excludes>META-INF\/**</excludes> + <excludeTransitive>true</excludeTransitive> + <ignorePermissions>false</ignorePermissions> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>org.osgi.service.http, + org.osgi.framework;version="1.0.0", + org.opendaylight.dlux.loader + </Import-Package> + <Export-Package></Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 00000000..02eb833c --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,19 @@ +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> + <reference id="httpService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService"/> + <reference id="loader" availability="mandatory" activation="eager" interface="org.opendaylight.dlux.loader.DluxModuleLoader"/> + + <bean id="bundle" init-method="initialize" destroy-method="clean" class="org.opendaylight.dlux.loader.DluxModule"> + <property name="httpService" ref="httpService"/> + <property name="loader" ref="loader"/> + <property name="moduleName" value="mwtnTdm"/> + <property name="url" value="/src/app/mwtnTdm"/> + <property name="directory" value="/mwtnTdm"/> + <property name="requireJs" value="app/mwtnTdm/mwtnTdm.module"/> + <property name="angularJs" value="app.mwtnTdm"/> + <property name="cssDependencies"> + <list> + <value>src/app/mwtnTdm/mwtnTdm-custom.css</value> + </list> + </property> + </bean> +</blueprint>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/pom.xml new file mode 100644 index 00000000..9c8c8716 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/pom.xml @@ -0,0 +1,14 @@ +<?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>mwtnTdm</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>mwtnTdm-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/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/images/mwtnTdm.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/images/mwtnTdm.png Binary files differnew file mode 100755 index 00000000..2da5f584 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/images/mwtnTdm.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm-custom.css new file mode 100644 index 00000000..d396932f --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm-custom.css @@ -0,0 +1,11 @@ +/** + * Add your application related css here + */ + +.owl .bbg b { + color: white; +} + +.owl .bbg i { + color: white; +} diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.controller.js new file mode 100644 index 00000000..e4e488bc --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.controller.js @@ -0,0 +1,159 @@ +/* + * @copyright 2017 highstreet technologies GmbH and others. All rights reserved. + * + * @license + * 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/mwtnTdm/mwtnTdm.module', + 'app/mwtnTdm/mwtnTdm.services'], + function (mwtnTdmApp) { + + mwtnTdmApp.register.controller('mwtnTdmCtrl', ['$scope', '$rootScope', '$timeout', '$mwtnLog', '$mwtnTdm', '$translate', 'OnfNetworkElement', 'uiGridConstants', + function ($scope, $rootScope, $timeout, $mwtnLog, $mwtnTdm, $translate, OnfNetworkElement, uiGridConstants) { + + var COMPONENT = 'mwtnTdmCtrl'; + $rootScope.section_logo = 'src/app/mwtnTdm/images/mwtnTdm.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif' + + $scope.highlightFilteredHeader = $mwtnTdm.highlightFilteredHeader; + $scope.gridOptions = JSON.parse(JSON.stringify($mwtnTdm.gridOptions)); + $scope.gridOptions.onRegisterApi = function (gridApi) { + $scope.gridApi = gridApi; + }; + $scope.gridOptions.columnDefs = [ + // { field: 'id', type: 'number', displayName: 'No.', headerCellClass: $scope.highlightFilteredHeader, width : 50, cellClass: 'number', pinnedLeft : true }, + { field: 'nodeId', type: 'string', displayName: 'Node', headerCellClass: $scope.highlightFilteredHeader, width: 200 }, + { field: 'layer', type: 'string', displayName: 'Layer', headerCellClass: $scope.highlightFilteredHeader, width: 100 }, + { field: 'ltpRef', type: 'string', displayName: 'Logical termiantion point', headerCellClass: $scope.highlightFilteredHeader, width: 300 }, + { field: 'reserved', type: 'number', displayName: 'Reserved E1', headerCellClass: $scope.highlightFilteredHeader, width: 150, cellClass: 'number' }, + { field: 'configured', type: 'number', displayName: 'Configured E1', headerCellClass: $scope.highlightFilteredHeader, width: 150, cellClass: 'number' }, + { field: 'utilization', type: 'number', displayName: 'Utilization [%]', headerCellClass: $scope.highlightFilteredHeader, width: 150, cellClass: 'number', sort: { + direction: uiGridConstants.ASC, + priority: 1 + } } + ]; + + $scope.gridOptions.data = []; + + var getUtilization = function(row) { + if (row.reserved === '?' || row.configured === '?' || row.reserved < 1) { + return '?'; + } + return (( row.configured / row.reserved ) * 100).toFixed(2); + }; + + var cleanProgess = function() { + $scope.progress = { + show: false, + max: 0, + value: 0 + }; + }; + cleanProgess(); + + var cleanMessage = function() { + $scope.message = { + error: undefined, + show: true, + startTime: undefined, + endTime: undefined, + duration: undefined + }; + }; + + var finish = function() { + $scope.message.endTime = new Date().toISOString(); + $scope.message.duration = ((new Date($scope.message.endTime) - new Date($scope.message.startTime))/1000).toFixed(1) + 's'; + $scope.gridOptions.columnDefs.filter(function(column){ + return column.field === 'utilization'; + }).map(function(column){ + column.sort.direction = uiGridConstants.ASC; + $scope.gridApi.core.refresh(); + }); + $timeout(cleanProgess, 1000); + }; + $scope.scan = function() { + cleanMessage(); + $scope.progress.show = true; + $scope.message.startTime = new Date().toISOString(); + + $mwtnTdm.getMountPoints().then(function (mountpoints) { + $scope.gridOptions.data = []; + if (mountpoints.length === 0) { + $timeout(cleanProgess, 1000); + } + mountpoints.filter(function (mountpoint) { + return mountpoint['netconf-node-topology:connection-status'] === 'connected'; + }).map(function (mountpoint) { + $mwtnTdm.getActualNetworkElement(mountpoint['node-id'], '2017-03-24').then(function (success) { + var onfNetworkElement = new OnfNetworkElement(success['network-element']); + var tdmLtps = onfNetworkElement.getLTPMwsList().filter(function (ltp) { + return ltp.getConditionalPackages()[0].contains('hybrid'); + }).map(function (ltp) { + $scope.progress.max = $scope.progress.max + 1; + var row = { + ltpId: [ltp.getId(), onfNetworkElement.getId()].join('@'), + nodeId: onfNetworkElement.getName(), + layer: 'MWS', + ltpRef: ltp.getLabel(), + reserved: '?', + configured: '?', + utilization: '?' + }; + + var specConfig = { + nodeId: mountpoint['node-id'], + revision: '2017-03-24', + pacId: 'microwave-model:mw-hybrid-mw-structure-pac', + layerProtocolId: ltp.getLayerProtocols()[0].getId(), + partId: 'hybrid-mw-structure-configuration' + }; + $mwtnTdm.getPacParts(specConfig).then(function(success){ + success = $mwtnTdm.yangifyObject(success); + row.reserved = success['hybrid-mw-structure-configuration']['number-of-tdm-segments-to-be-reserved']; + row.utilization = getUtilization(row); + }, function(error){ + // ignore + }); + + var specStatus = { + nodeId: mountpoint['node-id'], + revision: '2017-03-24', + pacId: 'microwave-model:mw-hybrid-mw-structure-pac', + layerProtocolId: ltp.getLayerProtocols()[0].getId(), + partId: 'hybrid-mw-structure-status' + }; + $mwtnTdm.getPacParts(specStatus).then(function(success){ + success = $mwtnTdm.yangifyObject(success); + row.configured = success['hybrid-mw-structure-status']['segment-status-list'].filter(function(item){ + return item['segment-is-reserved-for-tdm'] === true; + }).length; + row.utilization = getUtilization(row); + $scope.progress.value = $scope.progress.value + 1; + if ($scope.progress.max === $scope.progress.value) { + finish(); + } + }, function(error){ + // ignore + }); + + $scope.gridOptions.data.push(row); + }); + console.warn(JSON.stringify(tdmLtps)); + if (tdmLtps.length === 0 && $scope.progress.max === $scope.progress.value) { + finish(); + } + }); + }, function (error) { + $scope.gridOptions.data = []; + }); + + }); + }; + $scope.scan(); + + }]); + + }); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.module.js new file mode 100644 index 00000000..b136b535 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.module.js @@ -0,0 +1,53 @@ +/* + * 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', + 'app/mwtnCommons/bower_components/angular-clipboard/angular-clipboard'], function(ng) { + var mwtnTdmApp = angular.module('app.mwtnTdm', ['ui.grid', 'ui.bootstrap', 'app.core', 'ui.router.state', 'config', 'angular-clipboard']); + + mwtnTdmApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) { + mwtnTdmApp.register = { + controller : $controllerProvider.register, + directive : $compileProvider.directive, + factory : $provide.factory, + service : $provide.service + }; + + NavHelperProvider.addControllerUrl('app/mwtnTdm/mwtnTdm.controller'); + NavHelperProvider.addToMenu('mwtnTdm', { + "link" : "#/mwtnTdm", + "active" : "main.mwtnTdm", + "title" : "MWTN TDM", + "icon" : "fa fa-cogs", // Add navigation icon css class here + "page" : { + "title" : "MWTN TDM", + "description" : "mwtnTdm" + } + }); + + var access = routingConfig.accessLevels; + + $stateProvider.state('main.mwtnTdm', { + url: 'mwtnTdm', + access: access.admin, + views : { + content : { + templateUrl: 'src/app/mwtnTdm/templates/frame.tpl.html', + controller: 'mwtnTdmCtrl' + } + } + }); + + }); + + return mwtnTdmApp; +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.services.js new file mode 100644 index 00000000..824fd26b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/mwtnTdm.services.js @@ -0,0 +1,31 @@ +/* + * @copyright 2017 highstreet technologies 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/mwtnCommons/mwtnCommons.module', 'app/mwtnTdm/mwtnTdm.module'],function(mwtnTdmApp) { + + mwtnTdmApp.register.factory('$mwtnTdm', function($mwtnCommons, $mwtnDatabase, $mwtnLog) { + + var service = {}; + + service.getPacParts = $mwtnCommons.getPacParts; + service.highlightFilteredHeader = $mwtnCommons.highlightFilteredHeader; + service.getMountPoints = $mwtnCommons.getMountPoints; + service.gridOptions = $mwtnCommons.gridOptions; + service.getActualNetworkElement = $mwtnCommons.getActualNetworkElement; + service.getMountPoints = $mwtnCommons.getMountPoints; + service.getPacParts = $mwtnCommons.getPacParts; + + service.parts = $mwtnCommons.parts; + service.separator = $mwtnCommons.separator; + service.yangify = $mwtnCommons.yangify; + service.yangifyObject = $mwtnCommons.yangifyObject; + + return service; + }); + +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/templates/frame.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/templates/frame.tpl.html new file mode 100644 index 00000000..c253807c --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/mwtnTdm-module/src/main/resources/mwtnTdm/templates/frame.tpl.html @@ -0,0 +1,52 @@ +<ht-header help-link='sdnr/mwtnTdm/0.4.0/README.md'></ht-header> + +<div class="owl container" style="width: 100%;"> + + <div class="row bbg"> + <div class="col-md-2"> + <button type="button" id="scan" class="btn btn-primary" ng-click="scan()"> + <i class="fa fa-spinner fa-pulse" aria-hidden="true" ng-if="progress.show"></i> + <span>{{'MWTN_SCAN_NETWORK' | translate}}</span> + </button> + </div> + <div class="col-md-3" ng-if="message.startTime !== undefined"> + <span>{{'MWTN_START_TIME' | translate}}</span> + <b>{{message.startTime.toHumanReadableTimeFormat()}}</b> + </div> + <div class="col-md-3" ng-if="message.endTime !== undefined"> + <span>{{'MWTN_END_TIME' | translate}}</span> + <b>{{message.endTime.toHumanReadableTimeFormat()}}</b> + </div> + <div class="col-md-2" ng-if="message.duration !== undefined"> + <span>{{'MWTN_DURATION' | translate}}</span> + <b>{{message.duration}}</b> + </div> + </div> + + <div class="row"> + <div class=" col-md-12"> + <hr/> + </div> + </div> + + <div class="row"> + <div class=" col-md-12"> + <div id="mwtnTdmGrid" ui-grid="gridOptions" ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns ui-grid-move-columns + class="mwtnLogGrid"></div> + </div> + </div> + + <div class="row"> + <div class=" col-md-12"> + <uib-progressbar ng-if="progress.show" class="progress-striped col-md-12" type="primary" max="progress.max" value="progress.value"> + <i class="owl-dark">{{progress.value}} / {{progress.max}}</i> + </uib-progressbar> + </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 diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/pom.xml new file mode 100644 index 00000000..8abbeca5 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnTdm/pom.xml @@ -0,0 +1,24 @@ +<?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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mwtn</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <packaging>pom</packaging> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>mwtnTdm</artifactId> + <version>0.5.1-SNAPSHOT</version> + <name>${prefix} ${project.artifactId}</name> + + <prerequisites> + <maven>3.0</maven> + </prerequisites> + + <modules> + <module>mwtnTdm-module</module> + <module>mwtnTdm-bundle</module> + </modules> +</project>
\ No newline at end of file |