summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/lib/quagga.py
diff options
context:
space:
mode:
authorNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-09-02 17:43:39 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-09-04 22:15:12 +0900
commit03789fa0cee9a11bf272d202c74bf03f2ad0ec51 (patch)
treef6c5a5cc80b7f5df60586ea36f338c3020e170ce /test/scenario_test/lib/quagga.py
parent52c96558a2fd993cd0ce380785740198ffa00c62 (diff)
scenario_test: add zebra test
Diffstat (limited to 'test/scenario_test/lib/quagga.py')
-rw-r--r--test/scenario_test/lib/quagga.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/test/scenario_test/lib/quagga.py b/test/scenario_test/lib/quagga.py
index 8d3e0612..b881f6ed 100644
--- a/test/scenario_test/lib/quagga.py
+++ b/test/scenario_test/lib/quagga.py
@@ -44,10 +44,11 @@ class QuaggaBGPContainer(BGPContainer):
WAIT_FOR_BOOT = 1
SHARED_VOLUME = '/etc/quagga'
- def __init__(self, name, asn, router_id, ctn_image_name='osrg/quagga'):
+ def __init__(self, name, asn, router_id, ctn_image_name='osrg/quagga', zebra=False):
super(QuaggaBGPContainer, self).__init__(name, asn, router_id,
ctn_image_name)
self.shared_volumes.append((self.config_dir, self.SHARED_VOLUME))
+ self.zebra = zebra
def run(self):
super(QuaggaBGPContainer, self).run()
@@ -152,6 +153,11 @@ class QuaggaBGPContainer(BGPContainer):
raise Exception('not found peer {0}'.format(peer.router_id))
def create_config(self):
+ self._create_config_bgp()
+ if self.zebra:
+ self._create_config_zebra()
+
+ def _create_config_bgp(self):
c = CmdBuffer()
c << 'hostname bgpd'
c << 'password zebra'
@@ -205,6 +211,23 @@ class QuaggaBGPContainer(BGPContainer):
print colors.yellow(indent(str(c)))
f.writelines(str(c))
+ def _create_config_zebra(self):
+ c = CmdBuffer()
+ c << 'hostname zebra'
+ c << 'password zebra'
+ c << 'log file {0}/zebra.log'.format(self.SHARED_VOLUME)
+
+ with open('{0}/zebra.conf'.format(self.config_dir), 'w') as f:
+ print colors.yellow('[{0}\'s new config]'.format(self.name))
+ print colors.yellow(indent(str(c)))
+ f.writelines(str(c))
+
def reload_config(self):
- cmd = '/usr/bin/pkill bgpd -SIGHUP'
- self.local(cmd)
+ daemon = []
+ daemon.append('bgpd')
+ if self.zebra:
+ daemon.append('zebra')
+ for d in daemon:
+ cmd = '/usr/bin/pkill {0} -SIGHUP'.format(d)
+ self.local(cmd)
+