diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-11-08 01:04:04 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-11-11 00:28:42 +0900 |
commit | 15812686282c61120e07c7880be6d347c1a53059 (patch) | |
tree | 01e87d3438f11ab205768793131366bfc0112ef2 /test/scenario_test/lib/bagpipe.py | |
parent | 6dacfb38bf6e5c32abe39cfdfe825d3702316855 (diff) |
move lib to parent directory
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test/lib/bagpipe.py')
-rw-r--r-- | test/scenario_test/lib/bagpipe.py | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/test/scenario_test/lib/bagpipe.py b/test/scenario_test/lib/bagpipe.py deleted file mode 100644 index c73b6472..00000000 --- a/test/scenario_test/lib/bagpipe.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (C) 2015 Nippon Telegraph and Telephone Corporation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from base import * - - -class BagpipeContainer(BGPContainer): - - SHARED_VOLUME = '/root/shared_volume' - - def __init__(self, name, asn, router_id, - ctn_image_name='yoshima/bagpipe-bgp'): - super(BagpipeContainer, self).__init__(name, asn, router_id, - ctn_image_name) - self.shared_volumes.append((self.config_dir, self.SHARED_VOLUME)) - - def run(self): - super(BagpipeContainer, self).run() - cmd = CmdBuffer(' ') - cmd << 'docker exec' - cmd << '{0} cp {1}/bgp.conf'.format(self.name, self.SHARED_VOLUME) - cmd << '/etc/bagpipe-bgp/' - local(str(cmd), capture=True) - cmd = 'docker exec {0} service bagpipe-bgp start'.format(self.name) - local(cmd, capture=True) - - def create_config(self): - c = CmdBuffer() - c << '[BGP]' - if len(self.ip_addrs) > 0: - c << 'local_address={0}'.format(self.ip_addrs[0][1].split('/')[0]) - for peer, info in self.peers.iteritems(): - c << 'peers={0}'.format(info['neigh_addr'].split('/')[0]) - c << 'my_as={0}'.format(self.asn) - c << 'enable_rtc=True' - c << '[API]' - c << 'api_host=localhost' - c << 'api_port=8082' - c << '[DATAPLANE_DRIVER_IPVPN]' - c << 'dataplane_driver = DummyDataplaneDriver' - c << '[DATAPLANE_DRIVER_EVPN]' - c << 'dataplane_driver = DummyDataplaneDriver' - - with open('{0}/bgp.conf'.format(self.config_dir), 'w') as f: - print colors.yellow(str(c)) - f.writelines(str(c)) - - def reload_config(self): - cmd = CmdBuffer(' ') - cmd << 'docker exec' - cmd << '{0} cp {1}/bgp.conf'.format(self.name, self.SHARED_VOLUME) - cmd << '/etc/bagpipe-bgp/' - local(str(cmd), capture=True) - cmd = 'docker exec {0} service bagpipe-bgp restart'.format(self.name) - local(cmd, capture=True) - - def pipework(self, bridge, ip_addr, intf_name=""): - super(BagpipeContainer, self).pipework(bridge, ip_addr, intf_name) - self.create_config() - if self.is_running: - self.reload_config() |