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):
21 super(spirentSTC, self).__init__()
24 def init(self, conner="", measurand="", model="", **kwargs):
26 :param str conner: the spirent tester, the agent id of spirent vm
27 :param list measurand: the tested host's agent id
28 :param str model: the model used of the tested host
31 mgr = stevedore.driver.DriverManager(namespace="spirent.model.plugins",
34 self.TempMod = mgr.driver(kwargs)
36 self.measurand = measurand
40 LOG.info(vars(self.runmodel))
46 if not os.path.exists(config['configfile']):
47 LOG.error('The config file %s does exist.', config.get("configfile"))
50 runmodel = None # Tnv_Model(config = config)
52 # check parameter valid
53 flag = runmodel.check_parameter_invalid()
55 LOG.error("[ERROR]Check parameter invalid.")
58 # check logical parameter in the
59 flag = runmodel.check_logic_invalid
61 LOG.error("[ERROR]Check logic parameter with host invalid.")
64 init_flows_tables = runmodel.read_flow_init
65 LOG.info(init_flows_tables)
67 # print init_flows_tables
68 update_flows = runmodel.flow_build
70 LOG.info(update_flows)
72 flag = runmodel.affinity_bind(aff_strategy=1)
74 LOG.error("runmodel affinity bind failed.")
79 for suite in ["frameloss", "throughput"]:
80 ret, test_result = runmodel.Test_Run(suite)
82 LOG.error("[ERROR]Run rfc2544 %s test failed.", suite)
85 ret, result_dict = restrucData(test_result)
87 LOG.error("[ERROR]Restructure the test data failed.")
88 perfdata = getResult(result_dict)
89 columndata = getResultColumn(result_dict)
90 column_array, data_array = analysis_instance.analyseResult(
91 suite, columndata, perfdata)
92 temp = {'columns': column_array, 'data': data_array}
97 if __name__ == "__main__":