aboutsummaryrefslogtreecommitdiff
path: root/rumba/model.py
diff options
context:
space:
mode:
authorVincenzo Maffione <v.maffione@gmail.com>2017-04-28 11:23:00 +0200
committerVincenzo Maffione <v.maffione@gmail.com>2017-04-28 11:23:00 +0200
commitcab2290e34c77e00914da1ef8115cf4c86956709 (patch)
tree8e320058291c6135d436b95edb925a313683ad78 /rumba/model.py
parent200e920ec04164ed3d96f034082efd9464287f7a (diff)
downloadrumba-cab2290e34c77e00914da1ef8115cf4c86956709.tar.gz
rumba-cab2290e34c77e00914da1ef8115cf4c86956709.zip
model: fix bug in bootstrapper computation
The bootstrapper computation must happen in a separate phase, after both IPCPs computation and enrollment computation.
Diffstat (limited to 'rumba/model.py')
-rw-r--r--rumba/model.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 9187fcb..0b9fc7a 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -285,7 +285,7 @@ class IPCP:
self.dif = dif
self.registrations = []
- # Is this node the first in the DIF, so that it does not need
+ # Is this IPCP the first in its DIF, so that it does not need
# to enroll to anyone ?
self.dif_bootstrapper = False
@@ -511,6 +511,7 @@ class Experiment:
if dif not in node.difs:
continue
+ # Create an instance of the required IPCP class
ipcp = dif.get_ipcp_class()(
name='%s.%s' % (dif.name, node.name),
node=node, dif=dif)
@@ -519,30 +520,34 @@ class Experiment:
for lower in node.dif_registrations[dif]:
ipcp.registrations.append(lower)
+ node.ipcps.append(ipcp)
+ dif.ipcps.append(ipcp)
+
+ def compute_bootstrappers(self):
+ for node in self.nodes:
+ for ipcp in node.ipcps:
ipcp.dif_bootstrapper = True
for el in self.enrollments:
for e in el:
- if e['dif'] != dif:
+ if e['dif'] != ipcp.dif:
# Skip this DIF
break
- if e['enrollee'] == node:
+ if e['enrollee'] == ipcp:
ipcp.dif_bootstrapper = False
# Exit the loops
break
if not ipcp.dif_bootstrapper:
break
- node.ipcps.append(ipcp)
- dif.ipcps.append(ipcp)
-
- logger.info("IPCP for node %s: %s", node.name, node.ipcps)
-
# Examine the nodes and DIFs, compute the registration and enrollment
# order, the list of IPCPs to create, registrations, ...
def generate(self):
self.compute_dif_ordering()
self.compute_ipcps()
self.compute_enrollments()
+ self.compute_bootstrappers()
+ for node in self.nodes:
+ logger.info("IPCPs for node %s: %s", node.name, node.ipcps)
@abc.abstractmethod
def install_prototype(self):