behave_tests: tweak nfvbench results JSON filename 88/72888/1
authorGwenael Lambrouin <gwenael.lambrouin@orange.com>
Tue, 31 Aug 2021 13:49:40 +0000 (15:49 +0200)
committerGwenael Lambrouin <gwenael.lambrouin@orange.com>
Tue, 31 Aug 2021 13:56:27 +0000 (15:56 +0200)
In case nfvbench packet rate is expressed as a percentage of the max throughput
rather than a value in pps or bps, use that percentage to build nfvbench
results JSON filename.

This is sometimes needed for results post-processing because the percentage
information cannot be found in nfvbench results itself.

Change-Id: I7d16dba16a733a8ee58a6f80ce4df40cb40e9843
Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
behave_tests/features/environment.py
behave_tests/features/steps/steps.py

index 61096f6..7621075 100644 (file)
@@ -73,6 +73,7 @@ def before_scenario(context, scenario):
     if loopvm_flavor:
         context.json['flavor_type'] = loopvm_flavor
     context.synthesis = {}
+    context.percentage_rate = None
 
     context.logger.info('before_scenario: ' + scenario.name)
 
index e7d9b2c..cfb5848 100644 (file)
@@ -269,11 +269,19 @@ def run_nfvbench_traffic(context, repeat=1):
                         f"rate={context.json['rate']} repeat={repeat}")
 
     if 'json' not in context.json:
+        # Build filename for nfvbench results in JSON format
         context.json['json'] = '/var/lib/xtesting/results/' + context.CASE_NAME + \
-                               '/nfvbench-' + context.tag + '-fs_' + \
-                               context.json['frame_sizes'][0] + '-fc_' + \
-                               context.json['flow_count'] + '-rate_' + \
-                               context.json['rate'] + '.json'
+                               '/nfvbench-' + context.tag + \
+                               '-fs_' + context.json['frame_sizes'][0] + \
+                               '-fc_' + context.json['flow_count']
+        if context.percentage_rate is not None:
+            # Add rate as a percentage, eg '-rate_70%'
+            context.json['json'] += '-rate_' + context.percentage_rate
+        else:
+            # Add rate in bits or packets per second, eg '-rate_15Gbps' or '-rate_10kpps'
+            context.json['json'] += '-rate_' + context.json['rate']
+        context.json['json'] += '.json'
+
     json_base_name = context.json['json']
 
     max_total_tx_rate = None