diff options
Diffstat (limited to 'test/scenario_test/lib/base.py')
-rw-r--r-- | test/scenario_test/lib/base.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/scenario_test/lib/base.py b/test/scenario_test/lib/base.py index 11b77ca5..6fc40e36 100644 --- a/test/scenario_test/lib/base.py +++ b/test/scenario_test/lib/base.py @@ -115,9 +115,8 @@ class Bridge(object): return "{0}/{1}".format(self._ip_generator.next(), self.subnet.prefixlen) - def addif(self, ctn, name=''): - if name == '': - name = self.name + def addif(self, ctn): + name = ctn.next_if_name() self.ctns.append(ctn) if self.with_ip: ctn.pipework(self, self.next_ip_address(), name) @@ -136,6 +135,7 @@ class Container(object): self.shared_volumes = [] self.ip_addrs = [] self.is_running = False + self.eths = [] if self.docker_name() in get_containers(): self.stop() @@ -145,6 +145,11 @@ class Container(object): return self.name return '{0}_{1}'.format(TEST_PREFIX, self.name) + def next_if_name(self): + name = 'eth{0}'.format(len(self.eths)+1) + self.eths.append(name) + return name + def run(self): c = CmdBuffer(' ') c << "docker run --privileged=true" |