From 549321257806d8e07520f673d5e35d2e522303e8 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Mon, 26 Aug 2013 15:44:49 -0700
Subject: [PATCH] Add tests for OVS user switch (skipping hifi test for now)

test_hifi.py currently fails for OVS when datapath=user -
we should look at this and fix it.
---
 mininet/test/test_hifi.py | 10 ++++++++--
 mininet/test/test_nets.py | 14 +++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py
index 542e0099..f6ebb71f 100755
--- a/mininet/test/test_hifi.py
+++ b/mininet/test/test_hifi.py
@@ -4,9 +4,10 @@
    Test creation and pings for topologies with link and/or CPU options."""
 
 import unittest
+from functools import partial
 
 from mininet.net import Mininet
-from mininet.node import OVSKernelSwitch, UserSwitch, IVSSwitch
+from mininet.node import OVSSwitch, UserSwitch, IVSSwitch
 from mininet.node import CPULimitedHost
 from mininet.link import TCLink
 from mininet.topo import Topo
@@ -124,7 +125,12 @@ def testMostOptions( self ):
 
 class testOptionsTopoOVSKernel( testOptionsTopoCommon, unittest.TestCase ):
     "Verify ability to create networks with host and link options (OVS kernel switch)."
-    switchClass = OVSKernelSwitch
+    switchClass = OVSSwitch
+
+@unittest.skip( 'Skipping OVS user switch test for now' )
+class testOptionsTopoOVSUser( testOptionsTopoCommon, unittest.TestCase ):
+    "Verify ability to create networks with host and link options (OVS user switch)."
+    switchClass = partial( OVSSwitch, datapath='user' )
 
 @unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS is not installed' )
 class testOptionsTopoIVS( testOptionsTopoCommon, unittest.TestCase ):
diff --git a/mininet/test/test_nets.py b/mininet/test/test_nets.py
index f378ce89..a56061b8 100755
--- a/mininet/test/test_nets.py
+++ b/mininet/test/test_nets.py
@@ -4,10 +4,11 @@
    Test creation and all-pairs ping for each included mininet topo type."""
 
 import unittest
+from functools import partial
 
 from mininet.net import Mininet
 from mininet.node import Host, Controller
-from mininet.node import UserSwitch, OVSKernelSwitch, IVSSwitch
+from mininet.node import UserSwitch, OVSSwitch, IVSSwitch
 from mininet.topo import SingleSwitchTopo, LinearTopo
 from mininet.log import setLogLevel
 from mininet.util import quietRun
@@ -32,8 +33,11 @@ def testSingle5( self ):
 
 class testSingleSwitchOVSKernel( testSingleSwitchCommon, unittest.TestCase ):
     "Test ping with single switch topology (OVS kernel switch)."
-    switchClass = OVSKernelSwitch
+    switchClass = OVSSwitch
 
+class testSingleSwitchOVSUser( testSingleSwitchCommon, unittest.TestCase ):
+    "Test ping with single switch topology (OVS user switch)."
+    switchClass = partial( OVSSwitch, datapath='user' )
 
 @unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS is not installed' )
 class testSingleSwitchIVS( testSingleSwitchCommon, unittest.TestCase ):
@@ -61,7 +65,11 @@ def testLinear5( self ):
 
 class testLinearOVSKernel( testLinearCommon, unittest.TestCase ):
     "Test all-pairs ping with LinearNet (OVS kernel switch)."
-    switchClass = OVSKernelSwitch
+    switchClass = OVSSwitch
+
+class testLinearOVSUser( testLinearCommon, unittest.TestCase ):
+    "Test all-pairs ping with LinearNet (OVS user switch)."
+    switchClass = partial( OVSSwitch, datapath='user' )
 
 @unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS is not installed' )
 class testLinearIVS( testLinearCommon, unittest.TestCase ):
-- 
GitLab