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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
"""
Created on 2015-9-28
@author: y00228926
"""
import unittest
from vstf.agent.perf.vstfperf import Vstfperf
from vstf.agent.unittest.perf import model
class Test(model.Model):
def setUp(self):
super(Test, self).setUp()
for ns, dev, ip_setting in zip(self.ns_list, self.device_list, self.ip_setting_list):
net_dev = {
"namespace":ns,
"iface":dev,
'ip_setting':ip_setting
}
self.mgr.config_dev(net_dev)
self.start = {
"operation": "start",
"action": "send",
"tool": "netperf",
"params":{
"namespace": self.ns_list[0],
"protocol": "tcp_lat",
"dst":[
{"ip": self.ip_list[1]}
],
"size": 64,
"threads": 1,
"time": 1,
},
}
self.stop = {
"operation": "stop",
"action": "send",
"tool": "netperf",
"params":{
"namespace": self.ns_list[1],
},
}
def tearDown(self):
super(Test, self).tearDown()
def testNetperf(self):
perf = Vstfperf()
self.start['tool'] = 'netperf'
self.stop['tool'] = 'netperf'
self.start['action'] = 'receive'
self.start['operation'] = 'start'
self.start['params']['namespace'] = self.ns_list[1]
self.start['params']['protocol'] = 'udp_bw'
perf.run(**self.start)
self.start['action'] = 'send'
self.start['operation'] = 'start'
self.start['params']['namespace'] = self.ns_list[0]
perf.run(**self.start)
self.stop['action'] = 'send'
self.stop['operation'] = 'stop'
self.stop['params']['namespace'] = self.ns_list[0]
perf.run(**self.stop)
self.stop['action'] = 'receive'
self.stop['operation'] = 'stop'
self.stop['params']['namespace'] = self.ns_list[1]
perf.run(**self.stop)
def testQperf(self):
perf = Vstfperf()
self.start['tool'] = 'qperf'
self.stop['tool'] = 'qperf'
self.start['action'] = 'receive'
self.start['operation'] = 'start'
self.start['params']['namespace'] = self.ns_list[1]
perf.run(**self.start)
self.start['action'] = 'send'
self.start['operation'] = 'start'
self.start['params']['namespace'] = self.ns_list[0]
perf.run(**self.start)
self.stop['action'] = 'send'
self.stop['operation'] = 'stop'
self.stop['params']['namespace'] = self.ns_list[0]
perf.run(**self.stop)
self.stop['action'] = 'receive'
self.stop['operation'] = 'stop'
self.stop['params']['namespace'] = self.ns_list[1]
perf.run(**self.stop)
if __name__ == "__main__":
import logging
logging.basicConfig(level = logging.DEBUG)
unittest.main()
|