Skip to content

Commit ead427e

Browse files
committed
Fixed bgp config
1 parent fd805f5 commit ead427e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/lab-generator/controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ app.controller("nc", function ($location, $anchorScroll, $scope) {
2727
$scope.counter++;
2828
var p = JSON.clone(backbone);
2929
p.row = $scope.counter;
30-
p._uid = Math.floor((Math.random() * (1000**5)) + 1);
30+
p._uid = Math.floor((Math.random() * (1000 ** 5)) + 1);
3131
$scope.netkit.push(p);
3232

3333
changed = true;
@@ -187,11 +187,11 @@ app.controller("nc", function ($location, $anchorScroll, $scope) {
187187
}
188188
};
189189

190-
$scope.toggleOVSwitchSelection = function (netkitData, thisType){
190+
$scope.toggleOVSwitchSelection = function (netkitData, thisType) {
191191
return netkitData.some(machine => machine.type == "controller") && thisType != "controller";
192192
};
193193

194-
$scope.toggleControllerSelection = function (netkitData, thisType){
194+
$scope.toggleControllerSelection = function (netkitData, thisType) {
195195
return !netkitData.some(machine => machine.type == "controller") || thisType == "controller";
196196
};
197197

src/lab-generator/make.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function makeLabConfFile(netkit, lab) {
5454
// TODO: Metti a fattor comune:
5555
/*
5656
for (let machine of netkit) {
57-
if (machine.name && machine.name != "" && .....
57+
if (machine.name && machine.name != "" && .....
5858
*/
5959

6060
function makeTerminal(netkit, lab) {
@@ -433,8 +433,7 @@ function makeBgpConf(router, lab) {
433433

434434
lab.file[router.name + "/etc/zebra/bgpd.conf"] += "\n";
435435

436-
//Inserisco tutti i Neibourgh
437-
for (let remote in router.routing.bgp.remote) {
436+
router.routing.bgp.remote.forEach(function (remote) {
438437
if (remote && remote.neighbor != "" && remote.as != "") {
439438
//Aggiungo il remote-as
440439
lab.file[router.name + "/etc/zebra/bgpd.conf"] += "neighbor " + remote.neighbor + " remote-as " + remote.as + "\n";
@@ -444,7 +443,8 @@ function makeBgpConf(router, lab) {
444443
lab.file[router.name + "/etc/zebra/bgpd.conf"] += "neighbor " + remote.neighbor + " description " + remote.description + "\n";
445444
}
446445
}
447-
}
446+
});
447+
448448
//Free conf
449449
if (router.routing.bgp.free && router.routing.bgp.free != "")
450450
lab.file[router.name + "/etc/zebra/bgpd.conf"] += "\n" + router.routing.bgp.free + "\n";
@@ -457,10 +457,10 @@ function makeFilesStructure(netkit, labInfo) {
457457
let isAllValidNames = netkit
458458
.map(machine => machine.name && /[A-z0-9]+/i.test(machine.name))
459459
.reduce((prev, curr, ind) => ind == 0 ? curr : (prev && curr)) // Tutti i nomi devono aver soddisfatto la regex
460-
if(!isAllValidNames)
460+
if (!isAllValidNames)
461461
return { folders: [], file: [] }
462462

463-
var lab = []; // TODO: E' un oggetto... Cosa c'entra un array?! sistemare (se ho tempo di ricontrollare bene tutto)
463+
var lab = {};
464464
lab.folders = [];
465465
lab.file = [];
466466
lab.warning = 0;

0 commit comments

Comments
 (0)