diff options
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai')
10 files changed, 509 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-bundle/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-bundle/pom.xml new file mode 100644 index 00000000..3a409fe8 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-bundle/pom.xml @@ -0,0 +1,115 @@ +<?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>onapAai</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>onapAai-bundle</artifactId> + <packaging>bundle</packaging> + <name>${prefix} ${project.artifactId}</name> + <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>onapAai-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>onapAai-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> + <!-- <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.1</version> + <executions> + <execution> + <id>copy-resources</id> + <!- - here the phase you need - -> + <phase>package</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>../../deploy</outputDirectory> + <resources> + <resource> + <directory>target</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> --> + </plugins> + </build> +</project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 00000000..1a2ab2ed --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-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="onapAai"/> + <property name="url" value="/src/app/onapAai"/> + <property name="directory" value="/onapAai"/> + <property name="requireJs" value="app/onapAai/onapAai.module"/> + <property name="angularJs" value="app.onapAai"/> + <property name="cssDependencies"> + <list> + <value>src/app/onapAai/onapAai-custom.css</value> + </list> + </property> + </bean> +</blueprint>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/pom.xml new file mode 100644 index 00000000..6c2eef33 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-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>onapAai</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>onapAai-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/onapAai/onapAai-module/src/main/resources/onapAai/images/onapAai.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/images/onapAai.png Binary files differnew file mode 100755 index 00000000..a3724882 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/images/onapAai.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai-custom.css new file mode 100644 index 00000000..fc314684 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai-custom.css @@ -0,0 +1,58 @@ +/** + * Add your application related css here + */ +.onapAaiGrid { + height: 600px; + background-color: white; +} + +.onapAaiGrid span { + color: #393939; +} +.ht-pagination span { + color: #393939; +} +.ht-pagination span.dark { + color: #393939; +} +.dark { + color: #393939; +} + + + +.onapAaiGrid div.debug { + color: #393939; + background-color: white; +} +.onapAaiGrid div.error { + color: #ff0000; + background-color: #ffeeee; + font-weight: bold; +} + +.onapAaiGrid div.info { + color: #3276b1; + background-color: #eeeeff; +} + +.onapAaiGrid div.warning { + color: #ffa500; + background-color: #ffeedd; +} + +.rotated { + transform: rotate(180deg); + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -o-transform: rotate(180deg); +} + +h3.modal-title { + color: #393939; +} + +.modal-body span { + color: #393939; +}
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.controller.js new file mode 100644 index 00000000..6c5685e9 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.controller.js @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017 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/onapAai/onapAai.module', + 'app/onapAai/onapAai.services'], + function (onapAaiApp) { + + onapAaiApp.register.controller('onapAaiCtrl', ['uiGridConstants', '$uibModal', '$scope', '$rootScope', '$window', '$timeout', '$onapAai', '$mwtnLog', + function (uiGridConstants, $uibModal, $scope, $rootScope, $window, $timeout, $onapAai, $mwtnLog) { + + var COMPONENT = 'onapAaiCtrl'; + $mwtnLog.info({ component: COMPONENT, message: 'onapAaiCtrl started!' }); + + $rootScope.section_logo = 'src/app/onapAai/images/onapAai.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif' + + $scope.highlightFilteredHeader = $onapAai.highlightFilteredHeader; + + // Grid + $scope.gridOptions = JSON.parse(JSON.stringify($onapAai.gridOptions)); + $scope.gridOptions.columnDefs = [ + { field: 'pnf-id', type: 'string', displayName: 'ID', headerCellClass: $scope.highlightFilteredHeader, width: 170 }, + { field: 'pnf-name', type: 'string', displayName: 'Name', headerCellClass: $scope.highlightFilteredHeader, width: 200 }, + { field: 'equip-type', type: 'string', displayName: 'Type', headerCellClass: $scope.highlightFilteredHeader, width: 160 }, + { field: 'equip-vendor', type: 'string', displayName: 'Vendor', headerCellClass: $scope.highlightFilteredHeader, width: 100 }, + { field: 'equip-model', type: 'string', displayName: 'Model', headerCellClass: $scope.highlightFilteredHeader, width: 160 }, + { field: 'ipaddress-v4-oam', type: 'string', displayName: 'If OAM', headerCellClass: $scope.highlightFilteredHeader, width: 140 }, + { field: 'in-maint', type: 'string', displayName: 'Maintenance', headerCellClass: $scope.highlightFilteredHeader, width: 100 }, + { field: 'interfaces', type: 'string', displayName: '#p-interfaces', headerCellClass: $scope.highlightFilteredHeader, width: 100, visible: false }, + { field: 'resourceVersion', type: 'string', displayName: 'Resource version', headerCellClass: $scope.highlightFilteredHeader, width: 100, visible: false } + ]; + + $onapAai.getAaiPnfs().then(function(success){ + $scope.gridOptions.data = success.data.pnf; + $scope.gridOptions.data.map(function(item){ + item.interfaces = 1; + }); + }, function(error) { + console.log('error'); + $scope.error = error; + }); + + }]); + + }); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.module.js new file mode 100644 index 00000000..a3deb333 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.module.js @@ -0,0 +1,56 @@ +/* + * 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 onapAaiApp = angular.module('app.onapAai', ['ui.grid', 'ui.bootstrap', 'app.core', + 'ui.router.state', 'config', 'ui.grid.exporter', + 'ui.grid.moveColumns', 'ui.grid.pinning', 'ui.grid.selection', + 'ui.grid.resizeColumns', 'ui.grid.infiniteScroll','ui.grid.pagination' ]); + + onapAaiApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) { + onapAaiApp.register = { + controller : $controllerProvider.register, + directive : $compileProvider.directive, + factory : $provide.factory, + service : $provide.service + }; + + + NavHelperProvider.addControllerUrl('app/onapAai/onapAai.controller'); + NavHelperProvider.addToMenu('onapAai', { + "link" : "#/onapAai/", + "active" : "main.onapAai", + "title" : "ONAP AAI", + "icon" : "fa fa-th", // Add navigation icon css class here + "page" : { + "title" : "ONAP AAI", + "description" : "Open Network Automation Platform (ONAP) - Active and Available Inventory (AAI)" + } + }); + + var access = routingConfig.accessLevels; + + $stateProvider.state('main.onapAai', { + url: 'onapAai/:nodeId', + access: access.admin, + views : { + 'content' : { + templateUrl: 'src/app/onapAai/onapAai.tpl.html', + controller: 'onapAaiCtrl' + } + } + }); + + }); + + return onapAaiApp; +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.services.js new file mode 100644 index 00000000..dfbbf473 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.services.js @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2017 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/onapAai/onapAai.module', 'app/mwtnCommons/mwtnCommons.services'], function (onapAaiApp) { + + onapAaiApp.register.factory('$onapAai', function ($q, $http, Base64, $mwtnCommons, $mwtnDatabase, $mwtnLog, Device) { + + var service = {}; + + var functionId = "mwtn"; + var docType = "device"; + var from = 0; + var size = 9999; + var sort = undefined; + var deviceLookup = {}; + $mwtnDatabase.getAllData(functionId, docType, from, size, sort).then( + function successCallback(response) { + response.data.hits.hits.map(function(device){ + deviceLookup[device._id] = new Device(device._source); + }); + }, function errorCallback(response) { + deviceLookup = {}; + }); + + service.checkModules = $mwtnCommons.checkModules; + service.getMwtnWebSocketUrl = $mwtnCommons.getMwtnWebSocketUrl; + service.gridOptions = $mwtnCommons.gridOptions; + service.formatData = $mwtnCommons.formatData; + service.formatTimeStamp = $mwtnCommons.formatTimeStamp; + service.deleteDocType = $mwtnDatabase.deleteDocType; + + + var transactionId = 1; + var getHeaders = function () { + return { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'X-TransactionId': transactionId++ + } + }; + + // create or modify a pnf in aai + service.createPnf = function (pnfId, doc) { + var base = window.location.origin; + var getIp = function (extension) { + return extension.filter(function (item) { + return item['value-name'] === 'neIpAddress'; + }).map(function (item) { + return item.value; + })[0]; + } + + var device = deviceLookup[pnfId]; + if (!device) device = new Device({"id":pnfId,"name":pnfId,"mediator-ipv4":"127.0.0.1","netconf-port":"830","oam-ipv4":"127.0.0.1","site":"unknown","controller":"this","controller-site":"unknown","vendor":"unknown","type":"unknown","model":"unknown","version":"0.0"}); + var data = { + "pnf-name": pnfId, + "pnf-id": doc.connect.host + ':' + doc.connect.port, + "equip-type": device.getType(), + "equip-model": device.getModel(), + "equip-vendor": device.getVendor(), + "ipaddress-v4-oam": getIp(doc['core-model:network-element'].extension) | doc.connect.host, + "in-maint": false + }; + console.info('pnf', data); + var request = { + method: 'PUT', + url: base + '/aai/network/pnfs/pnf/' + pnfId, // to es config + // withCredentials: true, + headers: getHeaders(), + data: data + }; + var deferred = $q.defer(); + $http(request).then(function successCallback(response) { + deferred.resolve(response); + }, function errorCallback(response) { + deferred.reject(response); + }); + + return deferred.promise; + }; + + service.deletePnf = function (pnfId) { + // curl -X DELETE http://localhost:8282/aai/network/pnfs/pnf/Ericsson-A1 --insecure -v -u AAI:AAI -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-FromAppId: SDNR' -H 'X-TransactionId: 9999' + var base = window.location.origin; + var request = { + method: 'DELETE', + url: base + '/aai/network/pnfs/pnf/' + pnfId, // to es config + // withCredentials: true, + headers: getHeaders() + }; + var deferred = $q.defer(); + $http(request).then(function successCallback(response) { + deferred.resolve(response); + }, function errorCallback(response) { + deferred.reject(response); + }); + + return deferred.promise; + }; + + service.getAaiPnfs = function () { + // curl https://10.31.1.55:8443/network/pnfs -k -v -u abc:def -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-FromAppId: SDNR' -H 'X-TransactionId: 9999' + + var base = window.location.origin; + var request = { + method: 'GET', + url: base + '/aai/network/pnfs', // to es config + // withCredentials: true, + headers: getHeaders(), + }; + + var deferred = $q.defer(); + $http(request).then(function successCallback(response) { + deferred.resolve(response); + }, function errorCallback(response) { + deferred.reject(response); + }); + + return deferred.promise; + }; + + return service; + }); + + // Class Device + onapAaiApp.register.factory('Device', function () { + var Device = function (data) { + if (!data) { + data = {id:new Date(), type: 'unknown', name:'unknonw', model: 'unkonwn', vendor:'unknonw', version:'unkonwn'}; + } + this.data = data; + this.getData = function () { + return this.data; + }; + this.getId = function () { + return this.getData().id; + }; + this.getType = function () { + return this.getData().type; + }; + this.getName = function () { + return this.getData().name; + }; + this.getModel = function () { + return this.getData().model; + }; + this.getVendor = function () { + return this.getData().vendor; + }; + this.getVersion = function () { + return this.getData().version; + }; + }; + return Device; + }); + +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.tpl.html new file mode 100644 index 00000000..c121b6d5 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/onapAai-module/src/main/resources/onapAai/onapAai.tpl.html @@ -0,0 +1,12 @@ +<ht-header help-link='sdnr/onapAai/0.4.0/README.md'></ht-header> +<pre ng-if="error">{{ error | json }}</pre> + + +<div id="onapAaiGrid" ui-grid="gridOptions" ui-grid-exporter ui-grid-selection ui-grid-pinning + ui-grid-resize-columns ui-grid-move-columns class="onapAaiGrid" ng-if="!error"></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/onapAai/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/pom.xml new file mode 100644 index 00000000..6049029a --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapAai/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> + </parent> + <packaging>pom</packaging> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>onapAai</artifactId> + <version>0.5.1-SNAPSHOT</version> + <name>${prefix} ${project.artifactId}</name> + + <prerequisites> + <maven>3.0</maven> + </prerequisites> + + <modules> + <module>onapAai-module</module> + <module>onapAai-bundle</module> + </modules> +</project> |