Skip IVS and UserSwitch tests if they are not installed

This commit is contained in:
Bob Lantz
2013-09-11 12:00:12 -07:00
committed by Brian O'Connor
parent d2762938b7
commit 94324e3f46
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -11,6 +11,7 @@ from mininet.node import CPULimitedHost
from mininet.link import TCLink from mininet.link import TCLink
from mininet.topo import Topo from mininet.topo import Topo
from mininet.log import setLogLevel from mininet.log import setLogLevel
from mininet.util import quietRun
# Number of hosts for each test # Number of hosts for each test
N = 2 N = 2
@@ -125,10 +126,13 @@ class testOptionsTopoOVSKernel( testOptionsTopoCommon, unittest.TestCase ):
"Verify ability to create networks with host and link options (OVS kernel switch)." "Verify ability to create networks with host and link options (OVS kernel switch)."
switchClass = OVSKernelSwitch switchClass = OVSKernelSwitch
@unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS is not installed' )
class testOptionsTopoIVS( testOptionsTopoCommon, unittest.TestCase ): class testOptionsTopoIVS( testOptionsTopoCommon, unittest.TestCase ):
"Verify ability to create networks with host and link options (IVS switch)." "Verify ability to create networks with host and link options (IVS switch)."
switchClass = IVSSwitch switchClass = IVSSwitch
@unittest.skipUnless( quietRun( 'which ofprotocol' ),
'Reference user switch is not installed' )
class testOptionsTopoUserspace( testOptionsTopoCommon, unittest.TestCase ): class testOptionsTopoUserspace( testOptionsTopoCommon, unittest.TestCase ):
"Verify ability to create networks with host and link options (Userspace switch)." "Verify ability to create networks with host and link options (Userspace switch)."
switchClass = UserSwitch switchClass = UserSwitch
+5
View File
@@ -10,6 +10,7 @@ from mininet.node import Host, Controller
from mininet.node import UserSwitch, OVSKernelSwitch, IVSSwitch from mininet.node import UserSwitch, OVSKernelSwitch, IVSSwitch
from mininet.topo import SingleSwitchTopo, LinearTopo from mininet.topo import SingleSwitchTopo, LinearTopo
from mininet.log import setLogLevel from mininet.log import setLogLevel
from mininet.util import quietRun
class testSingleSwitchCommon( object ): class testSingleSwitchCommon( object ):
@@ -53,14 +54,18 @@ class testLinearCommon( object ):
dropped = mn.run( mn.ping ) dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 ) self.assertEqual( dropped, 0 )
class testLinearOVSKernel( testLinearCommon, unittest.TestCase ): class testLinearOVSKernel( testLinearCommon, unittest.TestCase ):
"Test all-pairs ping with LinearNet (OVS kernel switch)." "Test all-pairs ping with LinearNet (OVS kernel switch)."
switchClass = OVSKernelSwitch switchClass = OVSKernelSwitch
@unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS is not installed' )
class testLinearIVS( testLinearCommon, unittest.TestCase ): class testLinearIVS( testLinearCommon, unittest.TestCase ):
"Test all-pairs ping with LinearNet (IVS switch)." "Test all-pairs ping with LinearNet (IVS switch)."
switchClass = IVSSwitch switchClass = IVSSwitch
@unittest.skipUnless( quietRun( 'which ofprotocol' ),
'Reference user switch is not installed' )
class testLinearUserspace( testLinearCommon, unittest.TestCase ): class testLinearUserspace( testLinearCommon, unittest.TestCase ):
"Test all-pairs ping with LinearNet (Userspace switch)." "Test all-pairs ping with LinearNet (Userspace switch)."
switchClass = UserSwitch switchClass = UserSwitch