diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-22 11:41:34 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-02-10 23:42:01 -0800 |
commit | aa3cedc03a1595a3941de408d1f2c5ed6b0830ac (patch) | |
tree | 95c8803a0667adebca0a3cdd14897e4bd275a1b0 /test/lib | |
parent | 023a498e4a90982095c870c5491770bf4952fc2b (diff) |
test: add graceful restart test
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/base.py | 6 | ||||
-rw-r--r-- | test/lib/gobgp.py | 13 | ||||
-rw-r--r-- | test/lib/quagga.py | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 5ab94d8b..37cc26f4 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -247,7 +247,8 @@ class BGPContainer(Container): def add_peer(self, peer, passwd=None, evpn=False, is_rs_client=False, policies=None, passive=False, is_rr_client=False, cluster_id=None, - flowspec=False, bridge='', reload_config=True, as2=False): + flowspec=False, bridge='', reload_config=True, as2=False, + graceful_restart=None): neigh_addr = '' local_addr = '' for me, you in itertools.product(self.ip_addrs, peer.ip_addrs): @@ -274,7 +275,8 @@ class BGPContainer(Container): 'policies': policies, 'passive': passive, 'local_addr': local_addr, - 'as2': as2} + 'as2': as2, + 'graceful_restart': graceful_restart} if self.is_running and reload_config: self.create_config() self.reload_config() diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 18e7ddc8..1f956587 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -42,12 +42,11 @@ class GoBGPContainer(BGPContainer): self.default_policy = None self.zebra = zebra - def _start_gobgp(self): - zebra_op = '' + def _start_gobgp(self, graceful_restart=False): c = CmdBuffer() c << '#!/bin/bash' c << '/go/bin/gobgpd -f {0}/gobgpd.conf -l {1} -p {2} > ' \ - '{0}/gobgpd.log 2>&1'.format(self.SHARED_VOLUME, self.log_level, zebra_op) + '{0}/gobgpd.log 2>&1'.format(self.SHARED_VOLUME, self.log_level, '-r' if graceful_restart else '') cmd = 'echo "{0:s}" > {1}/start.sh'.format(c, self.config_dir) local(cmd, capture=True) @@ -55,6 +54,9 @@ class GoBGPContainer(BGPContainer): local(cmd, capture=True) self.local("{0}/start.sh".format(self.SHARED_VOLUME), flag='-d') + def graceful_restart(self): + self.local("pkill -INT gobgpd") + def _start_zebra(self): cmd = 'cp {0}/zebra.conf {1}/'.format(self.SHARED_VOLUME, self.QUAGGA_VOLUME) self.local(cmd) @@ -213,6 +215,11 @@ class GoBGPContainer(BGPContainer): if info['is_rs_client']: n['route-server'] = {'config': {'route-server-client': True}} + if info['graceful_restart'] is not None: + n['graceful-restart'] = {'config': {'enabled': True, 'restart-time': 20}} + for afi_safi in afi_safi_list: + afi_safi['mp-graceful-restart'] = {'config': {'enabled': True}} + if info['is_rr_client']: clusterId = self.router_id if 'cluster_id' in info and info['cluster_id'] is not None: diff --git a/test/lib/quagga.py b/test/lib/quagga.py index 30f036f0..81c8f666 100644 --- a/test/lib/quagga.py +++ b/test/lib/quagga.py @@ -178,6 +178,8 @@ class QuaggaBGPContainer(BGPContainer): c << 'password zebra' c << 'router bgp {0}'.format(self.asn) c << 'bgp router-id {0}'.format(self.router_id) + if any(info['graceful_restart'] for info in self.peers.itervalues()): + c << 'bgp graceful-restart' version = 4 for peer, info in self.peers.iteritems(): |