From 381216075f84bffc021cee2c18ef0cf02031be04 Mon Sep 17 00:00:00 2001 From: IWAMOTO Toshihiro Date: Fri, 1 Dec 2017 17:49:04 +0900 Subject: packet_data_generator3: Support ovs-2.8 From ovs 2.8, ovs-ofctl tries to collect port descriptions, which isn't handled by the fake server in gen.py. Pass the --no-names option to work around this. Signed-off-by: IWAMOTO Toshihiro Signed-off-by: FUJITA Tomonori --- ryu/tests/packet_data_generator3/gen.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ryu/tests/packet_data_generator3/gen.py b/ryu/tests/packet_data_generator3/gen.py index 92676e46..b436ec58 100644 --- a/ryu/tests/packet_data_generator3/gen.py +++ b/ryu/tests/packet_data_generator3/gen.py @@ -4,6 +4,7 @@ from __future__ import print_function import getopt import os +import re import six from six.moves import socketserver import subprocess @@ -283,6 +284,18 @@ if __name__ == '__main__': if not os.access(ofctl_cmd, os.X_OK): raise Exception("%s is not executable" % ofctl_cmd) + ovs_version = subprocess.Popen([ofctl_cmd, '--version'], + stdout=subprocess.PIPE) + has_names = False + try: + ver_tuple = re.search('\s(\d+)\.(\d+)(\.\d*|\s*$)', + ovs_version.stdout.readline().decode()).groups() + if int(ver_tuple[0]) > 2 or \ + int(ver_tuple[0]) == 2 and int(ver_tuple[1]) >= 8: + has_names = True + except AttributeError: + pass + outpath = '../packet_data' socketdir = tempfile.mkdtemp() socketname = os.path.join(socketdir, 'ovs') @@ -297,6 +310,8 @@ if __name__ == '__main__': cmdargs = [ofctl_cmd, '-O', 'OpenFlow%2d' % (v + 9)] if verbose: cmdargs.append('-v') + if has_names: + cmdargs.append('--no-names') cmdargs.append(msg['cmd']) cmdargs.append('unix:%s' % socketname) cmdargs.append('\n'.join(msg['args'])) -- cgit v1.2.3