1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
14 from vstf.controller.spirent.common.result_analysis import analysis_instance as analysis_instance
15 LOG = logging.getLogger(__name__)
18 class spirentSTC(object):
20 super(spirentSTC, self).__init__()
23 def init(self, conner="", measurand="", model="", **kwargs):
25 :param str conner: the spirent tester, the agent id of spirent vm
26 :param list measurand: the tested host's agent id
27 :param str model: the model used of the tested host
30 mgr = stevedore.driver.DriverManager(namespace="spirent.model.plugins",
33 self.TempMod = mgr.driver(kwargs)
35 self.measurand = measurand
39 LOG.info(vars(self.runmodel))
45 if not os.path.exists(config['configfile']):
46 LOG.error('The config file %s does exist.', config.get("configfile"))
49 runmodel = None # Tnv_Model(config = config)
51 # check parameter valid
52 flag = runmodel.check_parameter_invalid()
54 LOG.error("[ERROR]Check parameter invalid.")
57 # check logical parameter in the
58 flag = runmodel.check_logic_invalid
60 LOG.error("[ERROR]Check logic parameter with host invalid.")
63 init_flows_tables = runmodel.read_flow_init
64 LOG.info(init_flows_tables)
66 # print init_flows_tables
67 update_flows = runmodel.flow_build
69 LOG.info(update_flows)
71 flag = runmodel.affinity_bind(aff_strategy=1)
73 LOG.error("runmodel affinity bind failed.")
78 for suite in ["frameloss", "throughput"]:
79 ret, test_result = runmodel.Test_Run(suite)
81 LOG.error("[ERROR]Run rfc2544 %s test failed.", suite)
84 ret, result_dict = restrucData(test_result)
86 LOG.error("[ERROR]Restructure the test data failed.")
87 perfdata = getResult(result_dict)
88 columndata = getResultColumn(result_dict)
89 column_array, data_array = analysis_instance.analyseResult(suite, columndata, perfdata)
90 temp = {'columns': column_array, 'data': data_array}
95 if __name__ == "__main__":