diff options
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module')
8 files changed, 497 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/pom.xml new file mode 100644 index 00000000..f5d04d8f --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-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>onapSo</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>onapSo-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/onapSo/onapSo-module/src/main/resources/onapSo/images/onap-end-to-end-slicing.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/images/onap-end-to-end-slicing.png Binary files differnew file mode 100755 index 00000000..c798dc1a --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/images/onap-end-to-end-slicing.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/images/onapSo.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/images/onapSo.png Binary files differnew file mode 100755 index 00000000..f2a595f3 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/images/onapSo.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo-custom.css new file mode 100644 index 00000000..f2aaeb7b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo-custom.css @@ -0,0 +1,78 @@ +/** + * Add your application related css here + */ + + .app-onapSo * { + box-sizing: border-box; +} + +.app-onapSo .col { +height: 70px; +width: 12.5%; +float: left; +padding: 15px; +} + +.app-onapSo .row::after { + content: ""; + clear: both; + display: table; +} + + + +.onapSoGrid { + height: 600px; + background-color: white; +} + +.onapSoGrid span { + color: #393939; +} +.ht-pagination span { + color: #393939; +} +.ht-pagination span.dark { + color: #393939; +} +.dark { + color: #393939; +} + + + +.onapSoGrid div.debug { + color: #393939; + background-color: white; +} +.onapSoGrid div.error { + color: #ff0000; + background-color: #ffeeee; + font-weight: bold; +} + +.onapSoGrid div.info { + color: #3276b1; + background-color: #eeeeff; +} + +.onapSoGrid 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/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.controller.js new file mode 100644 index 00000000..cb07fc78 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.controller.js @@ -0,0 +1,84 @@ +/* + * 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/onapSo/onapSo.module', + 'app/onapSo/onapSo.services'], + function (onapSoApp) { + + onapSoApp.register.controller('onapSoCtrl', ['uiGridConstants', '$uibModal', '$scope', '$rootScope', '$window', '$timeout', '$onapSo', '$mwtnLog', + function (uiGridConstants, $uibModal, $scope, $rootScope, $window, $timeout, $onapSo, $mwtnLog) { + + var COMPONENT = 'onapSoCtrl'; + $mwtnLog.info({ component: COMPONENT, message: 'onapSoCtrl started!' }); + + $rootScope.section_logo = 'src/app/onapSo/images/onapSo.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif' + + $scope.highlightFilteredHeader = $onapSo.highlightFilteredHeader; + + $scope.pnf = { + pnfName: { id: 'pnfName', labelId: 'PNF_NAME', value: 'New-PNF' }, + pnfId: { id: 'pnfId', labelId: 'PNF_IDENTIFIER', value: 'New-PNF network unique identifier' }, + equipType: { id: 'equipType', labelId: 'PNF_EQUIPMENT_TYPE', value: 'Fancy equipment type' }, + equipModel: { id: 'equipModel', labelId: 'PNF_EQUIPMENT_MODEL', value: 'Best in class' }, + equipVendor: { id: 'equipVendor', labelId: 'PNF_EQUIPMENT_VENDOR', value: 'ONAP SDN-R Community' }, + ipaddressV4Oam: { id: 'ipaddressV4Oam', labelId: 'PNF_IPv4ADDRESS', value: '10.10.10.10' }, + inMaintenance: { id: 'inMaintenance', labelId: 'PNF_MAINTENANCE_MODE', value: false }, + resourceVersion: { id: 'resourceVersion', labelId: 'PNF_RESOURCE_VERSION', value: '' } + } + + $scope.createPnfInAai = function () { + + var data = { + "pnf-name": $scope.pnf.pnfName.value, + "pnf-id": $scope.pnf.pnfId.value, + "equip-type": $scope.pnf.equipType.value, + "equip-model": $scope.pnf.equipModel.value, + "equip-vendor": $scope.pnf.equipVendor.value, + "ipaddress-v4-oam": $scope.pnf.ipaddressV4Oam.value, + "in-maint": $scope.pnf.inMaintenance.value + } + + $onapSo.createPnf(data).then(function (response) { + console.info('successfully created: ', data['pnf-name']); + $onapSo.getPnf(data).then(function (success) { + // console.info('success', JSON.stringify(success.data)); + $scope.pnf.resourceVersion.value = success.data['resource-version']; + }, function (error) { + console.log('error1', JSON.stringify(error.data)); + $scope.error = error; + }); + }, function (error) { + console.log('error2', JSON.stringify(error.data)); + $scope.error = error; + }); + } + + $scope.deletePnfInAai = function () { + var data = { + "pnf-name": $scope.pnf.pnfName.value, + } + $onapSo.getPnf(data).then(function (success) { + console.info('success', JSON.stringify(success.data)); + $scope.pnf.resourceVersion.value = success.data['resource-version']; + data['resource-version'] = success.data['resource-version']; + $onapSo.deletePnf(data).then(function (success) { + console.info('success', JSON.stringify(success)); + $scope.pnf.resourceVersion.value = success.data['resource-version']; + }, function (error) { + console.log('error', JSON.stringify(error.data)); + $scope.error = error; + }); + }, function (error) { + console.log('error', JSON.stringify(error.data)); + $scope.error = error; + }); + } + + }]); + + }); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.module.js new file mode 100644 index 00000000..b2bfec44 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.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 onapSoApp = angular.module('app.onapSo', ['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' ]); + + onapSoApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) { + onapSoApp.register = { + controller : $controllerProvider.register, + directive : $compileProvider.directive, + factory : $provide.factory, + service : $provide.service + }; + + + NavHelperProvider.addControllerUrl('app/onapSo/onapSo.controller'); + NavHelperProvider.addToMenu('onapSo', { + "link" : "#/onapSo/", + "active" : "main.onapSo", + "title" : "ONAP SO", + "icon" : "fa fa-music", // Add navigation icon css class here + "page" : { + "title" : "ONAP SO", + "description" : "Open Network Automation Platform (ONAP) - Master Service Orchestrator (MSO)" + } + }); + + var access = routingConfig.accessLevels; + + $stateProvider.state('main.onapSo', { + url: 'onapSo/:nodeId', + access: access.admin, + views : { + 'content' : { + templateUrl: 'src/app/onapSo/onapSo.tpl.html', + controller: 'onapSoCtrl' + } + } + }); + + }); + + return onapSoApp; +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.services.js new file mode 100644 index 00000000..3e14e7c2 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.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/onapSo/onapSo.module', 'app/mwtnCommons/mwtnCommons.services'], function (onapSoApp) { + + onapSoApp.register.factory('$onapSo', 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 (pnf) { + var base = window.location.origin; + var request = { + method: 'PUT', + url: base + '/aai/network/pnfs/pnf/' + pnf['pnf-name'], + // withCredentials: true, + headers: getHeaders(), + data: pnf + }; + 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 (pnf) { + // 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/' + pnf['pnf-name'] + '/?resource-version=' + pnf['resource-version'], + // 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.getPnf = function (pnf) { + + console.log('get', JSON.stringify(pnf)); + var base = window.location.origin; + var request = { + method: 'GET', + url: base + '/aai/network/pnfs/pnf/' + pnf['pnf-name'], + // 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 + onapSoApp.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/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.tpl.html new file mode 100644 index 00000000..777e2713 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/onapSo/onapSo-module/src/main/resources/onapSo/onapSo.tpl.html @@ -0,0 +1,103 @@ +<ht-header help-link='sdnr/onapSo/0.4.0/README.md'></ht-header> + +<!-- +"pnf-name": "@pnfId@", +"pnf-id": "@pnfId@", +"equip-type": "@type@", +"equip-model": "@model@", +"equip-vendor": "@vendor@", +"ipaddress-v4-oam": "@oamIp@", +"in-maint": true, +--> + +<div class="app-onapSo container owl"> + + <div class="row"> + + <div class="col-md-12"> + <h3>Design Phase</h3> + <h4>Create PNF via SO in A&AI</h4> + </div> + + </div> + <div class="row"> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.pnfName.id }}">{{ pnf.pnfName.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.pnfName.id }}" ng-model="pnf.pnfName.value"> + </div> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.pnfId.id }}">{{ pnf.pnfId.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.pnfId.id }}" ng-model="pnf.pnfId.value"> + </div> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.equipType.id }}">{{ pnf.equipType.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.equipType.id }}" ng-model="pnf.equipType.value"> + </div> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.equipModel.id }}">{{ pnf.equipModel.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.equipModel.id }}" ng-model="pnf.equipModel.value"> + </div> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.equipVendor.id }}">{{ pnf.equipVendor.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.equipVendor.id }}" ng-model="pnf.equipVendor.value"> + </div> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.ipaddressV4Oam.id }}">{{ pnf.ipaddressV4Oam.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.ipaddressV4Oam.id }}" ng-model="pnf.ipaddressV4Oam.value"> + </div> + + <div class="col-md-3 form-check"> + <input type="checkbox" class="form-check-input" id="{{ pnf.inMaintenance.id }}" ng-model="pnf.inMaintenance.value"> + <label class="form-check-label" for="{{ pnf.inMaintenance.id }}"> + <span>{{ pnf.inMaintenance.labelId | translate }}</span> + </label> + </div> + + <div class="col-md-3 form-group"> + <label for="{{ pnf.resourceVersion.id }}">{{ pnf.resourceVersion.labelId | translate }}</label> + <br/> + <input type="text" class="form-control" id="{{ pnf.resourceVersion.id }}" ng-model="pnf.resourceVersion.value"> + </div> + + </div> + + <div class="row"> + + <div class="col-md-12"> + <button type="button" class="btn btn-primary" ng-click="createPnfInAai()"> + <i class="fa fa-plus" aria-hidden="true"></i> + <span>{{'PNF_CREATE_IN_AAI' | translate}}</span> + </button> + </div> + + </div> + <!-- api gateway must be enhanced to support query + <div class="row"> + + <div class="col-md-12"> + <button type="button" class="btn btn-danger" ng-click="deletePnfInAai()"> + <i class="fa fa-minus" aria-hidden="true"></i> + <span>{{'PNF_DELETE_IN_AAI' | translate}}</span> + </button> + </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 |