diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-03-30 15:18:43 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-17 23:05:59 +0900 |
commit | 47ab84e34caeb7c89b26271bf84959011bc8ed19 (patch) | |
tree | 593380c833af9adbb14e2abf0a27337faf7b77f4 /test/lib | |
parent | 616ae9f2cd960e9e7b49bbceee4a0424806b8ef2 (diff) |
test/lib/gobgp: Use local GoBGP executables in contaier
Currently, to reflect the modification of the local source code or to
switch the base image for GoBGP container, it is required to re-build
the GoBGP container image, and this take a long time to test or debug
with the scenario tests.
This patch fixes to use the local GoBGP executables (gobgp and gobgpd)
in container, and enables to reflect the changes without rebuidling
container image.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/base.py | 23 | ||||
-rw-r--r-- | test/lib/gobgp.py | 8 |
2 files changed, 7 insertions, 24 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 4b4ff4ef..2618d720 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -97,29 +97,6 @@ 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 14fbfe1f..0251a807 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -47,7 +47,8 @@ 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' @@ -56,6 +57,11 @@ 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 |