behave_tests: fix infinite recursion
[nfvbench.git] / behave_tests / features / steps / steps.py
index e7d9b2c..512a4e5 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
@@ -615,5 +623,5 @@ def get_last_result(context, reference=None, page=None):
                 return tagged_result
     if last_results["pagination"]["current_page"] < last_results["pagination"]["total_pages"]:
         page = last_results["pagination"]["current_page"] + 1
-        return get_last_result(context, page)
+        return get_last_result(context, reference, page)
     return None