diff options
-rwxr-xr-x | libarcfire.py | 23 | ||||
-rwxr-xr-x | main.py | 1 |
2 files changed, 21 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 # @@ -12,6 +12,7 @@ exp.dif_add(ShimEthDIF("400", 0, ["b", "c"])) n1 = NormalDIF("n1", ["a", "b", "c"]) n1.policy_add(Policy("rmt.pff", "lfa")) n1.policy_add(Policy("security-manager", "passwd", passwd="xyz")) +n1.appmap_add("rina-echo-time.server") exp.dif_add(n1) print(exp) |