From f34115930038e93bc31703a80c8b70d70d66b3c3 Mon Sep 17 00:00:00 2001 From: Cody Burkard <cody@onlab.us> Date: Mon, 13 Oct 2014 10:52:37 -0700 Subject: [PATCH] support wireshark versions greater than 1.11 --- mininet/test/test_walkthrough.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mininet/test/test_walkthrough.py b/mininet/test/test_walkthrough.py index 802e14ac..b7e7d7f4 100755 --- a/mininet/test/test_walkthrough.py +++ b/mininet/test/test_walkthrough.py @@ -11,6 +11,12 @@ import os import re from mininet.util import quietRun +from distutils.version import StrictVersion + +def tsharkVersion(): + versionStr = quietRun( 'tshark -v' ) + versionMatch = re.findall( 'TShark \d+.\d+.\d+', versionStr )[0] + return versionMatch.split()[ 1 ] class testWalkthrough( unittest.TestCase ): @@ -25,11 +31,14 @@ def testHelp( self ): def testWireshark( self ): "Use tshark to test the of dissector" - tshark = pexpect.spawn( 'tshark -i lo -R of' ) + if StrictVersion( tsharkVersion() ) < StrictVersion( '1.12.0' ): + tshark = pexpect.spawn( 'tshark -i lo -R of' ) + else: + tshark = pexpect.spawn( 'tshark -i lo -Y openflow_v1' ) tshark.expect( [ 'Capturing on lo', "Capturing on 'Loopback'" ] ) mn = pexpect.spawn( 'mn --test pingall' ) mn.expect( '0% dropped' ) - tshark.expect( [ '74 Hello', '74 of_hello' ] ) + tshark.expect( [ '74 Hello', '74 of_hello', '74 Type: OFPT_HELLO' ] ) tshark.sendintr() def testBasic( self ): -- GitLab