From fb6e00045726d606d24385a6f5c23c7f2048b0a0 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Tue, 26 Apr 2016 09:45:14 +0000 Subject: test: enable pass multiple commands to vtysh() Signed-off-by: ISHIDA Wataru --- test/lib/quagga.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/lib/quagga.py') diff --git a/test/lib/quagga.py b/test/lib/quagga.py index ce53a29b..4dd42d76 100644 --- a/test/lib/quagga.py +++ b/test/lib/quagga.py @@ -228,10 +228,13 @@ class QuaggaBGPContainer(BGPContainer): f.writelines(str(c)) def vtysh(self, cmd, config=True): + if type(cmd) is not list: + cmd = [cmd] + cmd = ' '.join("-c '{0}'".format(c) for c in cmd) if config: - return self.local("vtysh -d bgpd -c 'en' -c 'conf t' -c 'router bgp {0}' -c '{1}'".format(self.asn, cmd), capture=True) + return self.local("vtysh -d bgpd -c 'en' -c 'conf t' -c 'router bgp {0}' {1}".format(self.asn, cmd), capture=True) else: - return self.local("vtysh -d bgpd -c '{0}'".format(cmd), capture=True) + return self.local("vtysh -d bgpd {0}".format(cmd), capture=True) def reload_config(self): daemon = [] -- cgit v1.2.3