Repository navigation
Expand file tree
/
Copy pathtest_nets.py
More file actions
executable file
·61 lines (48 loc) · 2.03 KB
/
Copy pathtest_nets.py
File metadata and controls
executable file
·61 lines (48 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
"""Package: mininet
Test creation and all-pairs ping for each included mininet topo type."""
import unittest
from mininet.net import init, Mininet
from mininet.node import Host, Controller, ControllerParams
# from mininet.node import KernelSwitch
from mininet.node import UserSwitch, OVSKernelSwitch
from mininet.topo import SingleSwitchTopo, LinearTopo
from mininet.log import setLogLevel
SWITCHES = { 'user': UserSwitch,
'ovsk': OVSKernelSwitch,
# 'kernel': KernelSwitch
}
class testSingleSwitch( unittest.TestCase ):
"For each datapath type, test ping with single switch topologies."
def testMinimal( self ):
"Ping test with both datapaths on minimal topology"
init()
for switch in SWITCHES.values():
controllerParams = ControllerParams( '10.0.0.0', 8 )
mn = Mininet( SingleSwitchTopo(), switch, Host, Controller,
controllerParams )
dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 )
def testSingle5( self ):
"Ping test with both datapaths on 5-host single-switch topology"
init()
for switch in SWITCHES.values():
controllerParams = ControllerParams( '10.0.0.0', 8 )
mn = Mininet( SingleSwitchTopo( k=5 ), switch, Host, Controller,
controllerParams )
dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 )
class testLinear( unittest.TestCase ):
"For each datapath type, test all-pairs ping with LinearNet."
def testLinear5( self ):
"Ping test with both datapaths on a 5-switch topology"
init()
for switch in SWITCHES.values():
controllerParams = ControllerParams( '10.0.0.0', 8 )
mn = Mininet( LinearTopo( k=5 ), switch, Host, Controller,
controllerParams )
dropped = mn.run( mn.ping )
self.assertEqual( dropped, 0 )
if __name__ == '__main__':
setLogLevel('warning')
unittest.main()