blob: fde8e87583f63801e6fcd45fcf7b01fb6c2bd96b [file] [log] [blame]
carlosmscabralf40ecd12013-02-01 18:15:58 -02001#!/usr/bin/env python
2
3"""Package: mininet
4 Test creation and all-pairs ping for each included mininet topo type."""
5
6import unittest
7
8from mininet.net import Mininet
9from mininet.node import Host, Controller
10from mininet.node import UserSwitch, OVSKernelSwitch
11from mininet.topo import SingleSwitchTopo, LinearTopo
12from mininet.log import setLogLevel
13
14SWITCHES = { 'user': UserSwitch,
15 'ovsk': OVSKernelSwitch,
16}
17
18
19class testSingleSwitch( unittest.TestCase ):
20 "For each datapath type, test ping with single switch topologies."
21
22 def testMinimal( self ):
23 "Ping test with both datapaths on minimal topology"
24 for switch in SWITCHES.values():
25 mn = Mininet( SingleSwitchTopo(), switch, Host, Controller )
26 dropped = mn.run( mn.ping )
27 self.assertEqual( dropped, 0 )
28
29 def testSingle5( self ):
30 "Ping test with both datapaths on 5-host single-switch topology"
31 for switch in SWITCHES.values():
32 mn = Mininet( SingleSwitchTopo( k=5 ), switch, Host, Controller )
33 dropped = mn.run( mn.ping )
34 self.assertEqual( dropped, 0 )
35
36
37class testLinear( unittest.TestCase ):
38 "For each datapath type, test all-pairs ping with LinearNet."
39
40 def testLinear5( self ):
41 "Ping test with both datapaths on a 5-switch topology"
42 for switch in SWITCHES.values():
43 mn = Mininet( LinearTopo( k=5 ), switch, Host, Controller )
44 dropped = mn.run( mn.ping )
45 self.assertEqual( dropped, 0 )
46
47
48if __name__ == '__main__':
49 setLogLevel( 'warning' )
50 unittest.main()