From 30747f9ea71610a0b2e41db407c0a9090e37144c Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 12 Jan 2018 14:28:44 +0100 Subject: 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. --- rumba/model.py | 17 +++++++++++------ 1 file 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): -- cgit v1.2.3