Post-processing of results


The ByteBlower GUI and CLT now have a new type of report: JSON. Just like CSV, this format is intended for machines rather than us humans. Actually, JSON is a huge improvement over CSV. 

As an example, check out the Python code below. 15 lines to check whether our network device did or did not lose traffic in your overnight test.

Opening a JSON result file

JSON files can be read in easily in many languages. Check out the Python example below.

import json
def open_json_report(report_filename):
        Opens the report for further processing  
    with open(report_filename, "r") as f:
        return json.load(f)
Processing a test-run

Once the report is loaded, you have access to the same information as in the other reports. Labor-intensive questions can easily be answered in a short script.  

Does your project have many FrameBlasting flows?  
Do you want to count how traffic much was lost in total?  
Did you check out the script below? 

def count_received_traffic(report_data):
        Lost traffic is bad news. How much did we receive?
        Returns the value as percentage: 100 is nothing lost.
    total_expected = 0
    total_received = 0
    for fb_flow in report_data["frameBlastingFlows"]:
        for a_destination in fb_flow["destinations"]:
            total_expected += fb_flow["source"]["sent"]["packets"]
            total_received += a_destination["received"]["packets"]
    if total_expected == 0:
        return 0
        return 100. * total_received / total_expected
Making it even easier

But in the end, our goal is to make life easier. Just that is possible with the JSON format. Rather than going over a single test-run, why not let the computer do it? 

def test_a_report(report_filename):
        Pass or Fail? Did this nights test succeed?
    report_data = open_json_report(report_filename)
    received = count_received_traffic(report_data)

    assert received < 99.9, "FAIL, too much traffic lost in " + report_filename
    print("PASS: We had a good testrun")