Skip to content

Commit

Permalink
Merge pull request #15 from openbaton/develop
Browse files Browse the repository at this point in the history
imp: merge develop to master
  • Loading branch information
ogozman committed Aug 12, 2016
2 parents d769770 + d9c51cd commit 6e9e22c
Show file tree
Hide file tree
Showing 18 changed files with 792 additions and 78 deletions.
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<img src="https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/openBaton.png" width="250"/>

Copyright © 2015-2016 [Open Baton](http://openbaton.org).
Licensed under [Apache v2 License](http://www.apache.org/licenses/LICENSE-2.0).

# Dashboard
Dashboard is a component of the Openbaton NFVO, which adds the Web GUI to it. It works as web pages provided by the inbuilt server of the NFVO.

# Technical Requirements
1. NFVO
2. Webbrowser capable of interpeting HTML, Javascript and CSS

# How to install Dashboard

The project iself does not require any installation. However, if you want to change the component inside your NFVO, you will need to copy the contents into the dashboard subfolder inside the NFVO folder or edit the one that you have already. After this, recompile NFVO in order for it to be built with the updated version.

# How to use Dashboard

In order to learn about GUI, please, refer to the [documentation][openbaton-doc-GUI]


# How to extend Dashboard

You can add the pages to the GUI by simply adding them to the static resources folder of the component.

# Issue tracker

Issues and bug reports should be posted to the GitHub Issue Tracker of this project

# What is Open Baton?

OpenBaton is an open source project providing a comprehensive implementation of the ETSI Management and Orchestration (MANO) specification.

Open Baton is a ETSI NFV MANO compliant framework. Open Baton was part of the OpenSDNCore (www.opensdncore.org) project started almost three years ago by Fraunhofer FOKUS with the objective of providing a compliant implementation of the ETSI NFV specification.

Open Baton is easily extensible. It integrates with OpenStack, and provides a plugin mechanism for supporting additional VIM types. It supports Network Service management either using a generic VNFM or interoperating with VNF-specific VNFM. It uses different mechanisms (REST or PUB/SUB) for interoperating with the VNFMs. It integrates with additional components for the runtime management of a Network Service. For instance, it provides autoscaling and fault management based on monitoring information coming from the the monitoring system available at the NFVI level.

# Source Code and documentation

The Source Code of the other Open Baton projects can be found [here][openbaton-github] and the documentation can be found [here][openbaton-doc] .

# News and Website

Check the [Open Baton Website][openbaton]
Follow us on Twitter @[openbaton][openbaton-twitter].

# Licensing and distribution
Copyright [2015-2016] Open Baton project

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

# Support
The Open Baton project provides community support through the Open Baton Public Mailing List and through StackOverflow using the tags openbaton.

# Supported by
<img src="https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/fokus.png" width="250"/><img src="https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/tu.png" width="150"/>

[fokus-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/fokus.png
[openbaton]: http://openbaton.org
[openbaton-doc]: http://openbaton.org/documentation
[openbaton-doc-GUI]: http://openbaton.github.io/documentation/nfvo-how-to-use-gui/
[openbaton-github]: http://github.org/openbaton
[openbaton-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/openBaton.png
[openbaton-mail]: mailto:users@openbaton.org
[openbaton-twitter]: https://twitter.com/openbaton
[tub-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/tu.png
6 changes: 1 addition & 5 deletions src/main/java/org/openbaton/nfvo/gui/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@

import org.springframework.stereotype.Controller;


@Controller
class WebConfig {


}
class WebConfig {}
2 changes: 1 addition & 1 deletion src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@

</body>

</html>
</html>
6 changes: 5 additions & 1 deletion src/main/resources/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies', 'an
templateUrl: 'pages/copyright.html',
controller: ''
}).
when('/keypairs', {
templateUrl: 'pages/keypairs/keypairs.html',
controller: 'keyPairsCtrl'
}).
otherwise({
// redirectTo: '/'
});
Expand Down Expand Up @@ -180,4 +184,4 @@ angular.module('app').controller('MenuCtrl', function ($scope, http) {



});
});
32 changes: 28 additions & 4 deletions src/main/resources/static/js/controllers/indexController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var app = angular.module('app');
app.controller('LoginController', function ($scope, AuthService, Session, $rootScope, $location, $cookieStore, $http, $window) {
$scope.currentUser = null;
//$scope.URL = 'http://lore:8080';
//$scope.URL = 'http://192.168.161.6:8080';

$scope.URL = '';
$scope.credential = {
"username": '',
Expand Down Expand Up @@ -102,12 +102,23 @@ app.controller('LoginController', function ($scope, AuthService, Session, $rootS

app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI, $interval, $cookieStore, $location, AuthService, http, $rootScope, $window) {
$('#side-menu').metisMenu();

$scope.adminRole = "ADMIN";
$scope.superProject = "*";
var url = $cookieStore.get('URL') + "/api/v1";

$scope.config = {};


$scope.userLogged = {};
function loadCurrentUser() {
http.get(url +'/users/current')
.success(function (response) {
console.log(response);
$scope.userLogged = response
})
.error(function (response, status) {
showError(status, response);
});
};
loadCurrentUser();
function getConfig() {

http.get(url + '/configurations/')
Expand Down Expand Up @@ -161,6 +172,7 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI
});
$scope.numberUnits = units;
});

}


Expand All @@ -173,6 +185,7 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI
$cookieStore.put('project', newValue);
loadNumbers();
getConfig();
loadCurrentUser();
}
});

Expand Down Expand Up @@ -273,5 +286,16 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI

};

$scope.admin = function() {
//console.log($scope.userLogged);

if($scope.userLogged.roles[0].project === $scope.superProject && $scope.userLogged.roles[0].role === $scope.adminRole) {
return true;
} else {
return false;
}
};



});
105 changes: 105 additions & 0 deletions src/main/resources/static/js/controllers/keyPairsController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
var app = angular.module('app');
app.controller('keyPairsCtrl', function ($scope, serviceAPI, $routeParams, http, $cookieStore, AuthService, $window) {

var url = $cookieStore.get('URL') + "/api/v1/keys/";
var urlprojects = $cookieStore.get('URL') + "/api/v1/projects/";
$scope.keyName = "";
$scope.pubKey = "";
$scope.keypairs = "";
$scope.newKey = {name:"", publicKey:""};
$scope.alerts = [];
loadTable();
function loadTable() {

//console.log($routeParams.userId);
http.get(url)
.success(function (response) {
$scope.keypairs = response;
//console.log($scope.users.length);

console.log($scope.keypairs);
})
.error(function (data, status) {
showError(data, status);
});


}
$scope.closeAlert = function (index) {
$scope.alerts.splice(index, 1);
};

$scope.save = function () {
//console.log($scope.projectObj);

$scope.newKey.name = $scope.keyName;
$scope.newKey.publicKey = $scope.pubKey;
console.log($scope.newKey);
http.post(url, $scope.newKey)
.success(function (response) {
showOk('Key pair: ' + $scope.keyName + ' saved.');
setTimeout(loadTable(),250);
$scope.keyName = "";
$scope.pubKey = "";
//location.reload();
})
.error(function (response, status) {
showError(response, status);
});
};
$scope.delete = function (data) {
http.delete(url + data.id)
.success(function (response) {
showOk('Key with name: ' + data.name + ' deleted.');
setTimeout(loadTable(), 250);

})
.error(function (response, status) {
showError(response, status);
});
};
$scope.createKeyName = "";
$scope.createKey = function () {
//console.log($scope.projectObj);



http.postPlain(url + 'generate', $scope.createKeyName)
.success(function (response) {
showOk('Key: ' + $scope.createKeyName + ' generated.');
setTimeout(loadTable(),250);
//console.log(response);
var key = document.createElement("a");
key.download = $scope.createKeyName + '.pem';
key.href = 'data:application/x-pem-file,' + encodeURIComponent(response);
document.body.appendChild(key);
key.click()
document.body.removeChild(key);
delete key;
//document.location = 'title: key.pem, data:application/x-pem-file,' +
// encodeURIComponent(response);
//location.reload();
})
.error(function (response, status) {
showError(response, status);
});
};

function showError(data, status) {
$scope.alerts.push({
type: 'danger',
msg: 'ERROR: <strong>HTTP status</strong>: ' + status + ' response <strong>data</strong> : ' + JSON.stringify(data)
});
$('.modal').modal('hide');
if (status === 401) {
//console.log(status + ' Status unauthorized')
AuthService.logout();
}
}

function showOk(msg) {
$scope.alerts.push({type: 'success', msg: msg});
loadTable();
$('.modal').modal('hide');
}
});
51 changes: 48 additions & 3 deletions src/main/resources/static/js/controllers/nsdController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
var urlVNFD = baseURL + '/vnf-descriptors/';

loadTable();
loadKeys();

$.fn.bootstrapSwitch.defaults.size = 'mini';

Expand All @@ -29,6 +30,32 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
$scope.file = '';
$scope.alerts = [];
$scope.vimInstances = [];
$scope.keys = {};
$scope.launchKeys = [];
$scope.launchObj = {"keys":[]};
function loadKeys() {

//console.log($routeParams.userId);
http.get(baseURL + '/keys')
.success(function (response) {
$scope.keys = response;
//console.log($scope.users.length);

console.log($scope.keys);
})
.error(function (data, status) {
showError(data, status);
});


}

$scope.addLaunchKey = function() {
var key = "";
$scope.launchKeys.push(key);
}


http.get(urlVim)
.success(function (response, status) {
$scope.vimInstances = response;
Expand Down Expand Up @@ -342,18 +369,37 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
$scope.launchOption = function (data) {
$scope.nsdToSend = data;
//$('#madalLaunch').modal('show');
$scope.launch();

};

$scope.launch = function () {
//console.log($scope.nsdToSend);
http.post(urlRecord + $scope.nsdToSend.id)
$scope.launchObj.keys = $scope.launchKeys;
console.log($scope.launchObj);
http.post(urlRecord + $scope.nsdToSend.id, $scope.launchObj)
.success(function (response) {
showOk("Created Network Service Record from Descriptor with id: \<a href=\'\#nsrecords\'>" + $scope.nsdToSend.id + "<\/a>");
})
.error(function (data, status) {
showError(status, data);
});
$scope.launchKeys = [];
$scope.launchObj = {"keys":[]};
};

$scope.launchWithoutkey = function () {
console.log("Launching without key");


http.post(urlRecord + $scope.nsdToSend.id, empty = {})
.success(function (response) {
showOk("Created Network Service Record from Descriptor with id: \<a href=\'\#nsrecords\'>" + $scope.nsdToSend.id + "<\/a>");
})
.error(function (data, status) {
showError(status, data);
});
$scope.launchKeys = [];
$scope.launchObj = {"keys":[]};
};

$scope.Jsplumb = function () {
Expand Down Expand Up @@ -489,4 +535,3 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
}

});

5 changes: 2 additions & 3 deletions src/main/resources/static/js/controllers/nsrController.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $
http.delete(url + data.id)
.success(function (response) {
showOk('Network Service Record deleted!');
loadTable();
window.setTimeout(loadTable, 250);
})
.error(function (data, status) {
showError(status, data);
Expand Down Expand Up @@ -406,7 +406,7 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $
http.get(url)
.success(function (response, status) {
$scope.nsrecords = response;
//console.log(response);
console.log(response);
})
.error(function (data, status) {
showError(status, data);
Expand All @@ -431,4 +431,3 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $


});

0 comments on commit 6e9e22c

Please sign in to comment.