diff options
author | Sander Vrijders <[email protected]> | 2018-01-12 14:28:44 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2018-01-12 13:48:41 +0000 |
commit | 30747f9ea71610a0b2e41db407c0a9090e37144c (patch) | |
tree | 3d842e3de4e8e4babc7490f753e55764994b09e0 | |
parent | 658a41da85783d0ea06b91e5c72f755144b2e449 (diff) | |
download | rumba-30747f9ea71610a0b2e41db407c0a9090e37144c.tar.gz rumba-30747f9ea71610a0b2e41db407c0a9090e37144c.zip |
model: Add check for number of members in ShimEthDIF
This adds a check to see that the number of members in the ShimEthDIF
class is not exceeded by two, since it is currently not supported by
Rumba.
-rw-r--r-- | rumba/model.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/rumba/model.py b/rumba/model.py index 30bc70f..14b856a 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -64,7 +64,7 @@ except OSError: # @proj_name [string] project name # @exp_name [string] experiment name # -class Testbed: +class Testbed(object): def __init__(self, exp_name, username, @@ -91,7 +91,7 @@ class Testbed: # # @name [string] DIF name # -class DIF: +class DIF(object): def __init__(self, name, members=None): self.name = name if members is None: @@ -146,6 +146,11 @@ class ShimEthDIF(DIF): def get_ipcp_class(self): return ShimEthIPCP + def add_member(self, node): + super(ShimEthDIF, self).add_member(node) + if len(self.members) > 2: + raise Exception("More than 2 members in %s!" % self.name) + # Normal DIF # @@ -178,7 +183,7 @@ class NormalDIF(DIF): # SSH Configuration # -class SSHConfig: +class SSHConfig(object): def __init__(self, hostname, port=22, proxy_server=None): self.username = None self.password = None @@ -206,7 +211,7 @@ class SSHConfig: # @policies: dict of dif -> policy to apply for that dif in this node # # -class Node: +class Node(object): def __init__(self, name, difs=None, dif_registrations=None, policies=None, machine_type=None): self.name = name @@ -394,7 +399,7 @@ class Node: # @node: Node where the IPCP gets created # @dif: the DIF the IPCP belongs to # -class IPCP: +class IPCP(object): def __init__(self, name, node, dif): self.name = name self.node = node @@ -518,7 +523,7 @@ class Policy(object): # @name [string] Name of the experiment # @nodes: Nodes in the experiment # -class Experiment: +class Experiment(object): __metaclass__ = abc.ABCMeta def __init__(self, testbed, nodes=None): |