Skip to content

Commit 6e9e22c

Browse files
author
ogozman
authored
Merge pull request #15 from openbaton/develop
imp: merge develop to master
2 parents d769770 + d9c51cd commit 6e9e22c

File tree

18 files changed

+792
-78
lines changed

18 files changed

+792
-78
lines changed

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<img src="https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/openBaton.png" width="250"/>
2+
3+
Copyright © 2015-2016 [Open Baton](http://openbaton.org).
4+
Licensed under [Apache v2 License](http://www.apache.org/licenses/LICENSE-2.0).
5+
6+
# Dashboard
7+
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.
8+
9+
# Technical Requirements
10+
1. NFVO
11+
2. Webbrowser capable of interpeting HTML, Javascript and CSS
12+
13+
# How to install Dashboard
14+
15+
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.
16+
17+
# How to use Dashboard
18+
19+
In order to learn about GUI, please, refer to the [documentation][openbaton-doc-GUI]
20+
21+
22+
# How to extend Dashboard
23+
24+
You can add the pages to the GUI by simply adding them to the static resources folder of the component.
25+
26+
# Issue tracker
27+
28+
Issues and bug reports should be posted to the GitHub Issue Tracker of this project
29+
30+
# What is Open Baton?
31+
32+
OpenBaton is an open source project providing a comprehensive implementation of the ETSI Management and Orchestration (MANO) specification.
33+
34+
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.
35+
36+
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.
37+
38+
# Source Code and documentation
39+
40+
The Source Code of the other Open Baton projects can be found [here][openbaton-github] and the documentation can be found [here][openbaton-doc] .
41+
42+
# News and Website
43+
44+
Check the [Open Baton Website][openbaton]
45+
Follow us on Twitter @[openbaton][openbaton-twitter].
46+
47+
# Licensing and distribution
48+
Copyright [2015-2016] Open Baton project
49+
50+
Licensed under the Apache License, Version 2.0 (the "License");
51+
52+
you may not use this file except in compliance with the License.
53+
You may obtain a copy of the License at
54+
55+
http://www.apache.org/licenses/LICENSE-2.0
56+
57+
Unless required by applicable law or agreed to in writing, software
58+
distributed under the License is distributed on an "AS IS" BASIS,
59+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60+
See the License for the specific language governing permissions and
61+
limitations under the License.
62+
63+
# Support
64+
The Open Baton project provides community support through the Open Baton Public Mailing List and through StackOverflow using the tags openbaton.
65+
66+
# Supported by
67+
<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"/>
68+
69+
[fokus-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/fokus.png
70+
[openbaton]: http://openbaton.org
71+
[openbaton-doc]: http://openbaton.org/documentation
72+
[openbaton-doc-GUI]: http://openbaton.github.io/documentation/nfvo-how-to-use-gui/
73+
[openbaton-github]: http://github.org/openbaton
74+
[openbaton-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/openBaton.png
75+
[openbaton-mail]: mailto:users@openbaton.org
76+
[openbaton-twitter]: https://twitter.com/openbaton
77+
[tub-logo]: https://raw.githubusercontent.com/openbaton/openbaton.github.io/master/images/tu.png

src/main/java/org/openbaton/nfvo/gui/WebConfig.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,5 @@
22

33
import org.springframework.stereotype.Controller;
44

5-
65
@Controller
7-
class WebConfig {
8-
9-
10-
}
6+
class WebConfig {}

src/main/resources/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@
5454

5555
</body>
5656

57-
</html>
57+
</html>

src/main/resources/static/js/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ angular.module('app', ['ngRoute', 'ngSanitize', 'ui.bootstrap', 'ngCookies', 'an
138138
templateUrl: 'pages/copyright.html',
139139
controller: ''
140140
}).
141+
when('/keypairs', {
142+
templateUrl: 'pages/keypairs/keypairs.html',
143+
controller: 'keyPairsCtrl'
144+
}).
141145
otherwise({
142146
// redirectTo: '/'
143147
});
@@ -180,4 +184,4 @@ angular.module('app').controller('MenuCtrl', function ($scope, http) {
180184

181185

182186

183-
});
187+
});

src/main/resources/static/js/controllers/indexController.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var app = angular.module('app');
99
app.controller('LoginController', function ($scope, AuthService, Session, $rootScope, $location, $cookieStore, $http, $window) {
1010
$scope.currentUser = null;
1111
//$scope.URL = 'http://lore:8080';
12-
//$scope.URL = 'http://192.168.161.6:8080';
12+
1313
$scope.URL = '';
1414
$scope.credential = {
1515
"username": '',
@@ -102,12 +102,23 @@ app.controller('LoginController', function ($scope, AuthService, Session, $rootS
102102

103103
app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI, $interval, $cookieStore, $location, AuthService, http, $rootScope, $window) {
104104
$('#side-menu').metisMenu();
105-
105+
$scope.adminRole = "ADMIN";
106+
$scope.superProject = "*";
106107
var url = $cookieStore.get('URL') + "/api/v1";
107108

108109
$scope.config = {};
109-
110-
110+
$scope.userLogged = {};
111+
function loadCurrentUser() {
112+
http.get(url +'/users/current')
113+
.success(function (response) {
114+
console.log(response);
115+
$scope.userLogged = response
116+
})
117+
.error(function (response, status) {
118+
showError(status, response);
119+
});
120+
};
121+
loadCurrentUser();
111122
function getConfig() {
112123

113124
http.get(url + '/configurations/')
@@ -161,6 +172,7 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI
161172
});
162173
$scope.numberUnits = units;
163174
});
175+
164176
}
165177

166178

@@ -173,6 +185,7 @@ app.controller('IndexCtrl', function ($scope, $compile, $routeParams, serviceAPI
173185
$cookieStore.put('project', newValue);
174186
loadNumbers();
175187
getConfig();
188+
loadCurrentUser();
176189
}
177190
});
178191

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

274287
};
275288

289+
$scope.admin = function() {
290+
//console.log($scope.userLogged);
291+
292+
if($scope.userLogged.roles[0].project === $scope.superProject && $scope.userLogged.roles[0].role === $scope.adminRole) {
293+
return true;
294+
} else {
295+
return false;
296+
}
297+
};
298+
299+
276300

277301
});
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
var app = angular.module('app');
2+
app.controller('keyPairsCtrl', function ($scope, serviceAPI, $routeParams, http, $cookieStore, AuthService, $window) {
3+
4+
var url = $cookieStore.get('URL') + "/api/v1/keys/";
5+
var urlprojects = $cookieStore.get('URL') + "/api/v1/projects/";
6+
$scope.keyName = "";
7+
$scope.pubKey = "";
8+
$scope.keypairs = "";
9+
$scope.newKey = {name:"", publicKey:""};
10+
$scope.alerts = [];
11+
loadTable();
12+
function loadTable() {
13+
14+
//console.log($routeParams.userId);
15+
http.get(url)
16+
.success(function (response) {
17+
$scope.keypairs = response;
18+
//console.log($scope.users.length);
19+
20+
console.log($scope.keypairs);
21+
})
22+
.error(function (data, status) {
23+
showError(data, status);
24+
});
25+
26+
27+
}
28+
$scope.closeAlert = function (index) {
29+
$scope.alerts.splice(index, 1);
30+
};
31+
32+
$scope.save = function () {
33+
//console.log($scope.projectObj);
34+
35+
$scope.newKey.name = $scope.keyName;
36+
$scope.newKey.publicKey = $scope.pubKey;
37+
console.log($scope.newKey);
38+
http.post(url, $scope.newKey)
39+
.success(function (response) {
40+
showOk('Key pair: ' + $scope.keyName + ' saved.');
41+
setTimeout(loadTable(),250);
42+
$scope.keyName = "";
43+
$scope.pubKey = "";
44+
//location.reload();
45+
})
46+
.error(function (response, status) {
47+
showError(response, status);
48+
});
49+
};
50+
$scope.delete = function (data) {
51+
http.delete(url + data.id)
52+
.success(function (response) {
53+
showOk('Key with name: ' + data.name + ' deleted.');
54+
setTimeout(loadTable(), 250);
55+
56+
})
57+
.error(function (response, status) {
58+
showError(response, status);
59+
});
60+
};
61+
$scope.createKeyName = "";
62+
$scope.createKey = function () {
63+
//console.log($scope.projectObj);
64+
65+
66+
67+
http.postPlain(url + 'generate', $scope.createKeyName)
68+
.success(function (response) {
69+
showOk('Key: ' + $scope.createKeyName + ' generated.');
70+
setTimeout(loadTable(),250);
71+
//console.log(response);
72+
var key = document.createElement("a");
73+
key.download = $scope.createKeyName + '.pem';
74+
key.href = 'data:application/x-pem-file,' + encodeURIComponent(response);
75+
document.body.appendChild(key);
76+
key.click()
77+
document.body.removeChild(key);
78+
delete key;
79+
//document.location = 'title: key.pem, data:application/x-pem-file,' +
80+
// encodeURIComponent(response);
81+
//location.reload();
82+
})
83+
.error(function (response, status) {
84+
showError(response, status);
85+
});
86+
};
87+
88+
function showError(data, status) {
89+
$scope.alerts.push({
90+
type: 'danger',
91+
msg: 'ERROR: <strong>HTTP status</strong>: ' + status + ' response <strong>data</strong> : ' + JSON.stringify(data)
92+
});
93+
$('.modal').modal('hide');
94+
if (status === 401) {
95+
//console.log(status + ' Status unauthorized')
96+
AuthService.logout();
97+
}
98+
}
99+
100+
function showOk(msg) {
101+
$scope.alerts.push({type: 'success', msg: msg});
102+
loadTable();
103+
$('.modal').modal('hide');
104+
}
105+
});

src/main/resources/static/js/controllers/nsdController.js

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
88
var urlVNFD = baseURL + '/vnf-descriptors/';
99

1010
loadTable();
11+
loadKeys();
1112

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

@@ -29,6 +30,32 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
2930
$scope.file = '';
3031
$scope.alerts = [];
3132
$scope.vimInstances = [];
33+
$scope.keys = {};
34+
$scope.launchKeys = [];
35+
$scope.launchObj = {"keys":[]};
36+
function loadKeys() {
37+
38+
//console.log($routeParams.userId);
39+
http.get(baseURL + '/keys')
40+
.success(function (response) {
41+
$scope.keys = response;
42+
//console.log($scope.users.length);
43+
44+
console.log($scope.keys);
45+
})
46+
.error(function (data, status) {
47+
showError(data, status);
48+
});
49+
50+
51+
}
52+
53+
$scope.addLaunchKey = function() {
54+
var key = "";
55+
$scope.launchKeys.push(key);
56+
}
57+
58+
3259
http.get(urlVim)
3360
.success(function (response, status) {
3461
$scope.vimInstances = response;
@@ -342,18 +369,37 @@ var app = angular.module('app').controller('NsdCtrl', function ($scope, $compile
342369
$scope.launchOption = function (data) {
343370
$scope.nsdToSend = data;
344371
//$('#madalLaunch').modal('show');
345-
$scope.launch();
372+
346373
};
347374

348375
$scope.launch = function () {
349376
//console.log($scope.nsdToSend);
350-
http.post(urlRecord + $scope.nsdToSend.id)
377+
$scope.launchObj.keys = $scope.launchKeys;
378+
console.log($scope.launchObj);
379+
http.post(urlRecord + $scope.nsdToSend.id, $scope.launchObj)
351380
.success(function (response) {
352381
showOk("Created Network Service Record from Descriptor with id: \<a href=\'\#nsrecords\'>" + $scope.nsdToSend.id + "<\/a>");
353382
})
354383
.error(function (data, status) {
355384
showError(status, data);
356385
});
386+
$scope.launchKeys = [];
387+
$scope.launchObj = {"keys":[]};
388+
};
389+
390+
$scope.launchWithoutkey = function () {
391+
console.log("Launching without key");
392+
393+
394+
http.post(urlRecord + $scope.nsdToSend.id, empty = {})
395+
.success(function (response) {
396+
showOk("Created Network Service Record from Descriptor with id: \<a href=\'\#nsrecords\'>" + $scope.nsdToSend.id + "<\/a>");
397+
})
398+
.error(function (data, status) {
399+
showError(status, data);
400+
});
401+
$scope.launchKeys = [];
402+
$scope.launchObj = {"keys":[]};
357403
};
358404

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

491537
});
492-

src/main/resources/static/js/controllers/nsrController.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $
307307
http.delete(url + data.id)
308308
.success(function (response) {
309309
showOk('Network Service Record deleted!');
310-
loadTable();
310+
window.setTimeout(loadTable, 250);
311311
})
312312
.error(function (data, status) {
313313
showError(status, data);
@@ -406,7 +406,7 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $
406406
http.get(url)
407407
.success(function (response, status) {
408408
$scope.nsrecords = response;
409-
//console.log(response);
409+
console.log(response);
410410
})
411411
.error(function (data, status) {
412412
showError(status, data);
@@ -431,4 +431,3 @@ var app = angular.module('app').controller('NsrCtrl', function ($scope, $http, $
431431

432432

433433
});
434-

0 commit comments

Comments
 (0)