summaryrefslogtreecommitdiffstats
path: root/tools/pkt_gen
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-04-19 11:09:45 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-04-19 11:09:45 +0000
commit22faa4f0a15caf61065ff1fa5033e3da72a79680 (patch)
treed12daf1bd1fcd15d6f0f1b14817971252bc156ae /tools/pkt_gen
parent26ec31cb51f6c7fb9ef89cc437b69167be98b4bf (diff)
parente95a10ac8330c300ab0c7e1ff218a6711180cb89 (diff)
Merge "xena_verify: Add final verification option to Xena"
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,