summaryrefslogtreecommitdiffstats
path: root/tools/pkt_gen
diff options
context:
space:
mode:
authorChristian Trautman <ctrautma@redhat.com>2017-04-13 19:31:57 -0400
committerChristian Trautman <ctrautma@redhat.com>2017-04-18 07:57:15 -0400
commite95a10ac8330c300ab0c7e1ff218a6711180cb89 (patch)
treeb2a9d40ed66c59743e0c9dd1c28fa1e13be3fee2 /tools/pkt_gen
parent881bf91ed8014ba48c55d3a8fc5b4980913f9b95 (diff)
xena_verify: Add final verification option to Xena
Adds final verification option to Xena traffic generator inside VSPerf. Works by running the Xena2544.exe again after the initial run is complete with modified values inside the json file. If the final verify fails it will revert the settings and continue the in a pattern based on if the smart search is enabled. JIRA: VSPERF-506 Change-Id: Ic272628c489b88989f67549bd020af7354dc9b91 Signed-off-by: Christian Trautman <ctrautma@redhat.com>
Diffstat (limited to 'tools/pkt_gen')
-rwxr-xr-xtools/pkt_gen/xena/xena.py81
1 files changed, 78 insertions, 3 deletions
diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py
index c6b26f88..2601a7c3 100755
--- a/tools/pkt_gen/xena/xena.py
+++ b/tools/pkt_gen/xena/xena.py
@@ -366,7 +366,7 @@ class Xena(ITrafficGenerator):
settings.setValue('XENA_VERSION', 'XENA Socket API - {}'.format(
self.xmanager.get_version()))
- if not len(self.xmanager.ports):
+ if not self.xmanager.ports:
self.xmanager.ports[0] = self.xmanager.add_module_port(
settings.getValue('TRAFFICGEN_XENA_MODULE1'),
settings.getValue('TRAFFICGEN_XENA_PORT1'))
@@ -435,8 +435,8 @@ class Xena(ITrafficGenerator):
port.set_port_ping_reply(is_on=True)
port.set_port_ping_reply(is_on=True, ipv6=True)
- stream.set_rate_fraction(
- 10000 * self._params['traffic']['frame_rate'])
+ stream.set_rate_fraction(int(
+ 10000 * self._params['traffic']['frame_rate']))
stream.set_packet_header(self._build_packet_header(
reverse=flip_addr))
stream.set_header_protocol(
@@ -632,6 +632,81 @@ class Xena(ITrafficGenerator):
self._wait_xena_2544_complete()
root = ET.parse(r'./tools/pkt_gen/xena/xena2544-report.xml').getroot()
+
+ if settings.getValue('TRAFFICGEN_XENA_RFC2544_VERIFY'):
+ # record the previous settings so we can revert to them if needed to
+ # run the binary search again if the verify fails.
+ old_tests = tests
+ old_duration = self._duration
+ old_min = settings.getValue('TRAFFICGEN_XENA_2544_TPUT_MIN_VALUE')
+
+ for attempt in range(
+ 1, settings.getValue(
+ 'TRAFFICGEN_XENA_RFC2544_MAXIMUM_VERIFY_ATTEMPTS')+1):
+ self._logger.info('Running verify attempt %s', attempt)
+ # get the last pass tx rate from the binary search
+ pass_rate = float(root[0][1][0].get('TotalTxRatePcnt'))
+ # run a one pass rfc2544 with the pass rate to see if it passes
+ # the verify duration
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_INIT_VALUE', pass_rate)
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_MIN_VALUE', pass_rate)
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_MAX_VALUE', pass_rate)
+ self.start_rfc2544_throughput(
+ traffic, 1, settings.getValue(
+ 'TRAFFICGEN_XENA_RFC2544_VERIFY_DURATION'), lossrate)
+ self.wait_rfc2544_throughput()
+ root = ET.parse(
+ r'./tools/pkt_gen/xena/xena2544-report.xml').getroot()
+
+ # If it passed, report the number of lost frames and exit the
+ # loop
+ if root[0][1][0].get('TestState') == "PASS":
+ self._logger.info('Verify passed, packets lost = %s',
+ root[0][1][0].get('TotalLossFrames'))
+ break
+ elif attempt < settings.getValue(
+ 'TRAFFICGEN_XENA_RFC2544_MAXIMUM_VERIFY_ATTEMPTS'):
+ self._logger.info(
+ 'Verify failed, resuming binary search, packets lost = %s',
+ root[0][1][0].get('TotalLossFrames'))
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_MAX_VALUE',
+ pass_rate - float(settings.getValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_VALUE_RESOLUTION')))
+ if settings.getValue(
+ 'TRAFFICGEN_XENA_RFC2544_BINARY_RESTART_SMART_SEARCH'):
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_INIT_VALUE',
+ (pass_rate - float(old_min)) / 2)
+ else:
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_INIT_VALUE',
+ pass_rate - float(settings.getValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_VALUE_RESOLUTION')))
+ settings.setValue(
+ 'TRAFFICGEN_XENA_2544_TPUT_MIN_VALUE', old_min)
+ self._logger.debug(
+ 'RFC2544 Initial rate: %s',
+ settings.getValue('TRAFFICGEN_XENA_2544_TPUT_INIT_VALUE'))
+ self._logger.debug(
+ 'RFC2544 Maximum rate: %s',
+ settings.getValue('TRAFFICGEN_XENA_2544_TPUT_MAX_VALUE'))
+ self._logger.debug(
+ 'RFC2544 Minimum rate: %s',
+ settings.getValue('TRAFFICGEN_XENA_2544_TPUT_MIN_VALUE'))
+ self._duration = old_duration
+ self.start_rfc2544_throughput(
+ traffic, old_tests, self._duration, lossrate)
+ self.wait_rfc2544_throughput()
+ root = ET.parse(
+ r'./tools/pkt_gen/xena/xena2544-report.xml').getroot()
+ else:
+ self._logger.error(
+ 'Maximum number of verify attempts reached. Reporting last result')
+
return Xena._create_throughput_result(root)
def start_rfc2544_throughput(self, traffic=None, tests=1, duration=20,