10 from vstf.controller.spirent.common.result_analysis import analysis_instance as analysis_instance
11 LOG = logging.getLogger(__name__)
14 class spirentSTC(object):
16 super(spirentSTC, self).__init__()
19 def init(self, conner="", measurand="", model="", **kwargs):
21 :param str conner: the spirent tester, the agent id of spirent vm
22 :param list measurand: the tested host's agent id
23 :param str model: the model used of the tested host
26 mgr = stevedore.driver.DriverManager(namespace="spirent.model.plugins",
29 self.TempMod = mgr.driver(kwargs)
31 self.measurand = measurand
35 LOG.info(vars(self.runmodel))
41 if not os.path.exists(config['configfile']):
42 LOG.error('The config file %s does exist.', config.get("configfile"))
45 runmodel = None # Tnv_Model(config = config)
47 # check parameter valid
48 flag = runmodel.check_parameter_invalid()
50 LOG.error("[ERROR]Check parameter invalid.")
53 # check logical parameter in the
54 flag = runmodel.check_logic_invalid
56 LOG.error("[ERROR]Check logic parameter with host invalid.")
59 init_flows_tables = runmodel.read_flow_init
60 LOG.info(init_flows_tables)
62 # print init_flows_tables
63 update_flows = runmodel.flow_build
65 LOG.info(update_flows)
67 flag = runmodel.affinity_bind(aff_strategy=1)
69 LOG.error("runmodel affinity bind failed.")
74 for suite in ["frameloss", "throughput"]:
75 ret, test_result = runmodel.Test_Run(suite)
77 LOG.error("[ERROR]Run rfc2544 %s test failed.", suite)
80 ret, result_dict = restrucData(test_result)
82 LOG.error("[ERROR]Restructure the test data failed.")
83 perfdata = getResult(result_dict)
84 columndata = getResultColumn(result_dict)
85 column_array, data_array = analysis_instance.analyseResult(suite, columndata, perfdata)
86 temp = {'columns': column_array, 'data': data_array}
91 if __name__ == "__main__":