diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-03-24 11:27:01 +0000 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2017-03-24 11:27:01 +0000 |
commit | 99d8c66180e24849bb4f0f7edd1be4fe852f44db (patch) | |
tree | f927d3af830fef67010c704ba452e24d3d9ff46f | |
parent | b770d57b11de901ee3665611e97194a82f2ec55e (diff) | |
parent | 21e1397605f9474ba638cc66425378fbd89cbcae (diff) | |
download | rumba-99d8c66180e24849bb4f0f7edd1be4fe852f44db.tar.gz rumba-99d8c66180e24849bb4f0f7edd1be4fe852f44db.zip |
Merge branch 'vincenzo' into 'master'
model: add per-IPCP self-enrolled information
See merge request !13
-rw-r--r-- | rumba/model.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/rumba/model.py b/rumba/model.py index 4f3e72a..098930a 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -303,10 +303,15 @@ class IPCP: self.dif = dif self.registrations = [] + # Is this node the first in the DIF, so that it does not need + # to enroll to anyone ? + self.dif_bootstrapper = False + def __repr__(self): - return "{IPCP=%s,DIF=%s,N-1-DIFs=(%s)}" % \ + return "{IPCP=%s,DIF=%s,N-1-DIFs=(%s)%s}" % \ (self.name, self.dif.name, - ' '.join([dif.name for dif in self.registrations]) + ' '.join([dif.name for dif in self.registrations]), + ',bootstrapper' if self.dif_bootstrapper else '' ) def __hash__(self): @@ -537,6 +542,19 @@ class Experiment: for lower in node.dif_registrations[dif]: ipcp.registrations.append(lower) + ipcp.dif_bootstrapper = True + for el in self.enrollments: + for e in el: + if e['dif'] != dif: + # Skip this DIF + break + if e['enrollee'] == node: + ipcp.dif_bootstrapper = False + # Exit the loops + break + if not ipcp.dif_bootstrapper: + break + node.ipcps.append(ipcp) print("IPCP for node %s: %s" % (node.name, node.ipcps)) |