diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-18 23:03:36 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-18 23:28:00 +0900 |
commit | c2e7632397c2e49fdfb0f2b8e42d0321bf00c38d (patch) | |
tree | 61f9ab1f6fb2c6ea01d09089d958fe020cf57fdc /test/lib | |
parent | c8cb20e75bb830f1a9fe1037356a4007faaba04d (diff) |
Revert "test/lib/gobgp: Use local GoBGP executables in contaier"
This reverts commit 47ab84e34caeb7c89b26271bf84959011bc8ed19.
using the same binaries on a host and inside a container isn't always
feasible (by default, not statically linked binary).
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/base.py | 23 | ||||
-rw-r--r-- | test/lib/gobgp.py | 8 |
2 files changed, 24 insertions, 7 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 2618d720..4b4ff4ef 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -97,6 +97,29 @@ class CmdBuffer(list): return self.delim.join(self) +def make_gobgp_ctn(tag='gobgp', local_gobgp_path='', from_image='osrg/quagga'): + if local_gobgp_path == '': + local_gobgp_path = os.getcwd() + + c = CmdBuffer() + c << 'FROM {0}'.format(from_image) + c << 'ADD gobgp /go/src/github.com/osrg/gobgp/' + c << 'RUN go get github.com/osrg/gobgp/gobgpd' + c << 'RUN go install github.com/osrg/gobgp/gobgpd' + c << 'RUN go get github.com/osrg/gobgp/gobgp' + c << 'RUN go install github.com/osrg/gobgp/gobgp' + + rindex = local_gobgp_path.rindex('gobgp') + if rindex < 0: + raise Exception('{0} seems not gobgp dir'.format(local_gobgp_path)) + + workdir = local_gobgp_path[:rindex] + with lcd(workdir): + local('echo \'{0}\' > Dockerfile'.format(str(c))) + local('docker build -t {0} .'.format(tag)) + local('rm Dockerfile') + + class Bridge(object): def __init__(self, name, subnet='', with_ip=True, self_ip=False): self.name = name diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 0251a807..14fbfe1f 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -47,8 +47,7 @@ def extract_path_attribute(path, typ): class GoBGPContainer(BGPContainer): - LOCAL_GOPATH = os.environ['GOPATH'] - CONTAINER_GOPATH = '/go' + SHARED_VOLUME = '/root/shared_volume' QUAGGA_VOLUME = '/etc/quagga' @@ -57,11 +56,6 @@ class GoBGPContainer(BGPContainer): zapi_version=2, ospfd_config=None): super(GoBGPContainer, self).__init__(name, asn, router_id, ctn_image_name) - # Add volume to export local GoBGP executables into container. - self.shared_volumes.append( - (self.LOCAL_GOPATH + '/bin/', self.CONTAINER_GOPATH + '/bin/')) - - # Add volume to export config files into container. self.shared_volumes.append((self.config_dir, self.SHARED_VOLUME)) self.log_level = log_level |