diff options
Diffstat (limited to 'libarcfire.py')
-rwxr-xr-x | libarcfire.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libarcfire.py b/libarcfire.py index 0993d66..e04b667 100755 --- a/libarcfire.py +++ b/libarcfire.py @@ -6,6 +6,7 @@ # # @name [string] DIF name # @members [iterable] Nodes belonging to the DIF +# @appmap [iterable] Application names mapped to this DIF # class DIF: def __init__(self, name, members): @@ -14,16 +15,32 @@ class DIF: if members != None: for m in members: self.members[m] = m + self.appmap = set() def __repr__(self): - return "%s: %s" % (self.name, str(sorted(self.members))) + s = "DIF %s: members=%s" % (self.name, str(sorted(self.members))) + if len(self.appmap) > 0: + s += " appmap=%s" % self.appmap + return s - def node_add(node_name): + def node_add(self, node_name): self.members[node_name] = node_name - def node_del(node_name): + def node_del(self, node_name): del self.members[node_name] + def appmap_add(self, apname, apinst = None): + s = apname + if apinst: + s += apinst + self.appmap.add(s) + + def appmap_del(self, apname, apinst = None): + s = apname + if apinst: + s += apinst + self.appmap.discard(s) + # Shim over Ethernet # |