summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWAMOTO Toshihiro <iwamoto@valinux.co.jp>2017-12-01 17:49:04 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-12-11 22:35:09 +0900
commit381216075f84bffc021cee2c18ef0cf02031be04 (patch)
tree23a07135188859f55d72155ee954f03621814ba7
parent9fa0b58199ce64c0819ebd7a7963d377bd1519bd (diff)
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 <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/packet_data_generator3/gen.py15
1 files changed, 15 insertions, 0 deletions
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']))