diff options
Diffstat (limited to 'libarcfire.py')
-rwxr-xr-x | libarcfire.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libarcfire.py b/libarcfire.py index e9b7adc..60bce47 100755 --- a/libarcfire.py +++ b/libarcfire.py @@ -37,6 +37,48 @@ class ShimEthDIF(DIF): raise ValueError("link_speed must be a non-negative number") +# A policy +# +# @component: RINA component to which the policy applies to +# @name: Name of the policy +# @parameters: A dictionary of (key, values) pairs representing policy-specific +# parameters +class Policy: + def __init__(self, component, name, **kwargs): + self.component = component + self.name = name + self.parameters = kwargs + + def __repr__(self): + s = "%s:%s" % (self.component, self.name) + if self.parameters: + s += "%s" % self.parameters + return s + + +# Normal DIF +class NormalDIF(DIF): + def __init__(self, name, members = None): + DIF.__init__(self, name, members) + self.policies = dict() + + def policy_add(self, policy): + self.policies[policy.component] = policy + + def policy_del(self, component): + del self.policies[component] + + def __repr__(self): + s = DIF.__repr__(self) + if self.policies: + s += " policies=[" + for p in self.policies: + s += "%s," % self.policies[p] + if self.policies: + s += "]" + return s + + # Base class for ARCFIRE experiments # # @name [string] Name of the experiment |