Pass code check

This commit is contained in:
Bob Lantz
2013-09-11 12:00:15 -07:00
committed by Brian O'Connor
parent f796f01f38
commit 9d14c841d7
2 changed files with 25 additions and 7 deletions
+16 -7
View File
@@ -31,9 +31,12 @@ class SingleSwitchOptionsTopo(Topo):
host = self.addHost('h%s' % (h + 1))
self.addLink(host, switch)
# Tell pylint not to complain about calls to other class
# pylint: disable=E1101
class testOptionsTopoCommon( object ):
"Verify ability to create networks with host and link options (common code)."
"""Verify ability to create networks with host and link options
(common code)."""
switchClass = None # overridden in subclasses
@@ -41,7 +44,8 @@ class testOptionsTopoCommon( object ):
"Generic topology-with-options test runner."
mn = Mininet( topo=SingleSwitchOptionsTopo( n=n, hopts=hopts,
lopts=lopts ),
host=CPULimitedHost, link=TCLink, switch=self.switchClass )
host=CPULimitedHost, link=TCLink,
switch=self.switchClass )
dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 )
@@ -107,7 +111,8 @@ class testOptionsTopoCommon( object ):
REPS = 1
lopts = { 'loss': LOSS_PERCENT, 'use_htb': True }
mn = Mininet( topo=SingleSwitchOptionsTopo( n=N, lopts=lopts ),
host=CPULimitedHost, link=TCLink, switch=self.switchClass )
host=CPULimitedHost, link=TCLink,
switch=self.switchClass )
# Drops are probabilistic, but the chance of no dropped packets is
# 1 in 100 million with 4 hops for a link w/99% loss.
dropped_total = 0
@@ -123,24 +128,28 @@ class testOptionsTopoCommon( object ):
hopts = { 'cpu': 0.5 / N }
self.runOptionsTopoTest( N, hopts=hopts, lopts=lopts )
# pylint: enable=E1101
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 = 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)."
"""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 ):
"Verify ability to create networks with host and link options (IVS switch)."
"Verify ability to create networks with host and link options (IVS)."
switchClass = IVSSwitch
@unittest.skipUnless( quietRun( 'which ofprotocol' ),
'Reference user switch is not installed' )
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 (UserSwitch)."
switchClass = UserSwitch
if __name__ == '__main__':
+9
View File
@@ -13,6 +13,8 @@ from mininet.topo import SingleSwitchTopo, LinearTopo
from mininet.log import setLogLevel
from mininet.util import quietRun
# Tell pylint not to complain about calls to other class
# pylint: disable=E1101
class testSingleSwitchCommon( object ):
"Test ping with single switch topology (common code)."
@@ -31,6 +33,8 @@ class testSingleSwitchCommon( object ):
dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 )
# pylint: enable=E1101
class testSingleSwitchOVSKernel( testSingleSwitchCommon, unittest.TestCase ):
"Test ping with single switch topology (OVS kernel switch)."
switchClass = OVSSwitch
@@ -51,6 +55,9 @@ class testSingleSwitchUserspace( testSingleSwitchCommon, unittest.TestCase ):
switchClass = UserSwitch
# Tell pylint not to complain about calls to other class
# pylint: disable=E1101
class testLinearCommon( object ):
"Test all-pairs ping with LinearNet (common code)."
@@ -62,6 +69,8 @@ class testLinearCommon( object ):
dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 )
# pylint: enable=E1101
class testLinearOVSKernel( testLinearCommon, unittest.TestCase ):
"Test all-pairs ping with LinearNet (OVS kernel switch)."