diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-07-26 17:59:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-07-27 11:26:10 +0900 |
commit | 11c3fadfabfeda933126ebc70d22d8d65e4f4037 (patch) | |
tree | 628ff4601b722f2ff49ba53dbeca5b86b50a0276 /test/scenario_test | |
parent | b3f503494d5eec45c668bdaafddc1018068f24d7 (diff) |
test: change pipeworked interface name
aimed to shorten pipeworked interface name.
since we introduced test_prefix, pipeworked interface name tends to get
longer. This may violate IFNAMSIZ(=16).
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test')
-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" |