4 ## Copyright (c) 2010-2017 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
19 from proxdpitester import *
22 def __init__(self, test_systems, maxRate, testParam):
23 self._test_systems = [];
25 self._maxRate = maxRate
27 testParamPerSystem = testParam.getPerSystem(len(test_systems));
29 for i in range(len(test_systems)):
31 to_add = ProxDpiTester(ts, testParamPerSystem, i);
32 self.add_test_system(to_add);
35 return len(self._test_systems);
37 def add_test_system(self, test_system):
38 self._test_systems.append(test_system);
41 print "Starting test systems:"
42 for ts in self._test_systems:
43 print "\t" + str(ts.getIP())
47 for ts in self._test_systems:
48 elapsed = ts.startJoin();
50 print "Failed to start on " + str(ts.getIP())
52 print "Started on " + str(ts.getIP())
55 def startForkJoin(self):
59 def update_stats(self):
60 for ts in self._test_systems:
63 def wait_links_up(self):
64 for ts in self._test_systems:
68 def start_cores(self):
69 for ts in self._test_systems:
72 for ts in self._test_systems:
73 ts.start_all_workers();
74 for ts in self._test_systems:
78 for ts in self._test_systems:
79 ts.stop_all_workers();
82 for ts in self._test_systems:
87 for ts in self._test_systems:
91 def get_setup_rate(self):
93 for ts in self._test_systems:
94 total += ts.getCurrentSetupRate();
97 def get_total_connections(self):
99 for ts in self._test_systems:
100 ts_tot_conn = ts.get_total_connections();
105 def get_total_retx(self):
107 for ts in self._test_systems:
108 total += ts.get_total_retx();
111 def getIerrors(self):
113 for ts in self._test_systems:
114 total += ts.getIerrorsCached();
119 for ts in self._test_systems:
120 rates += ts.get_rates_client_ports();
123 def tx_rate_meassurement(self):
125 for ts in self._test_systems:
126 rates += ts.tx_rate_meassurement();
129 def scpStatsDump(self, dst):
131 for i in range(len(self._test_systems)):
132 dstFileName = dst + str(i);
133 ret.append(dstFileName);
134 self._test_systems[i].scpStatsDump(dstFileName)
137 def conditionsGood(self):
138 tot_retx = self.get_total_retx();
139 rates = self.get_rates();
140 ierrors = self.getIerrors();
143 self._reason = "Too many reTX (" + str(tot_retx) + ")"
146 self._reason = "Too many ierrors (" + str(ierrors) + ")"
148 for i in range(0, len(rates)):
149 if (rates[i] > self._maxRate):
150 self._setReason(i, rates)
154 def _setReason(self, port, rates):
156 rateStr = str(rates[port])
157 maxRateStr = str(self._maxRate);
158 allRatesStr = str(rates);
160 fmt = "Rate on port %s = %s > %s, rate on all = %s"
161 self._reason = fmt % (portStr, rateStr, maxRateStr, allRatesStr)
167 for ts in self._test_systems:
171 for ts in self._test_systems:
172 ts.stop_all_workers();
173 for ts in self._test_systems:
175 for ts in self._test_systems: