- os.mkdirs(r'/home/opnfv/bottlenecks/testsuites/posca/test_result/')
-
-
-def posca_output_result(time_new, input_1, input_2, input_3,
- input_4, input_5, input_6):
- save_dic = {}
- save_dic['tx_pkt_size'] = input_1
- save_dic['rx_cache_size'] = input_2
- save_dic['tx_cache_size'] = input_3
- save_dic['throughput '] = input_4
- save_dic['latency'] = input_5
- save_dic['cpu_load'] = input_6
- with open("/home/opnfv/bottlenecks/testsuites/posca/test_result/\
- factor_tx_cache_size_%s.json" % (time_new), "a") as f:
- f.write(json.dumps(save_dic, f))
- f.write("\n")
-
-
-def posca_config_read(config_str):
- print("========== posca system bandwidth config read ===========")
-
- con_dic = {}
- config = ConfigParser.ConfigParser()
- with open(config_str, "rd") as cfgfile:
- config.readfp(cfgfile)
- con_dic['test_ip'] = config.get("config", "test_ip")
- con_dic['test_throughput'] = config.get("config", "throughput")
- con_dic['test_tool'] = config.get("config", "tool")
- con_dic['test_time'] = config.get("config", "test_time")
- con_dic['test_protocol'] = config.get("config", "protocol")
- con_dic['test_pkt_s'] = config.get("config", "pkt sizes")
- con_dic['test_tx_cache_s'] = config.get("config", "tx cache sizes")
- con_dic['test_rx_cache_s'] = config.get("config", "rx cache sizes")
- con_dic['test_cpu_load'] = config.get("config", "cpu load")
- con_dic['test_latency'] = config.get("config", "latency")
- con_dic['test_rx_flavor'] = config.get("flavor_config", "rx_flavor")
- con_dic['test_tx_flavor'] = config.get("flavor_config", "tx_flavor")
- return con_dic
+ os.mkdir(r'/home/opnfv/bottlenecks/testsuites/posca/test_result/')
+
+
+def system_cpu_burden(test_id, data, file_config, con_dic):
+ date_id = test_id
+ print("test is is begin from %d" % test_id)
+ data_return = {}
+ data_max = {}
+ data_return["throughput"] = 1
+ for test_x in data["tx_pkt_sizes"]:
+ data_max["throughput"] = 1
+ for test_y in data["rx_pkt_sizes"]:
+ test_config = {
+ "tx_msg_size": float(test_x),
+ "rx_msg_size": float(test_y),
+ }
+ date_id = date_id + 1
+ file_config["test_id"] = date_id
+ data_reply = common_script.posca_send_data(
+ con_dic, test_config, file_config)
+ if (data_max["remote_cpu_util"] > con_dic["cpu_load"]):
+ return 1, data_reply
+ if (data_max["local_cpu_util"] > con_dic["cpu_load"]):
+ return 1, data_reply
+ print("cpu_burden don't find\n")
+ return 0, data_return