diff options
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/tg_ixload.py')
-rw-r--r-- | yardstick/network_services/vnf_generic/vnf/tg_ixload.py | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py index c15f7b954..612799ff5 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py @@ -22,11 +22,10 @@ import shutil from collections import OrderedDict from subprocess import call -import six - from yardstick.common.utils import makedirs from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper +from yardstick.benchmark.scenarios.networking.vnf_generic import find_relative_file LOG = logging.getLogger(__name__) @@ -46,7 +45,7 @@ IXLOAD_CONFIG_TEMPLATE = '''\ }, "remote_server": "%s", "result_dir": "%s", - "ixload_cfg": '"C:/Results/%s" + "ixload_cfg": "C:/Results/%s" }''' IXLOAD_CMD = "{ixloadpy} {http_ixload} {args}" @@ -78,6 +77,7 @@ class IxLoadResourceHelper(ClientResourceHelper): super(IxLoadResourceHelper, self).__init__(setup_helper) self.result = OrderedDict((key, ResourceDataHelper()) for key in self.KPI_LIST) self.resource_file_name = '' + self.data = None def parse_csv_read(self, reader): for row in reader: @@ -92,7 +92,9 @@ class IxLoadResourceHelper(ClientResourceHelper): def setup(self): # TODO: fixupt scenario_helper to hanlde ixia - self.resource_file_name = str(self.scenario_helper.scenario_cfg['ixia_profile']) + self.resource_file_name = \ + find_relative_file(self.scenario_helper.scenario_cfg['ixia_profile'], + self.scenario_helper.scenario_cfg["task_path"]) makedirs(self.RESULTS_MOUNT) cmd = MOUNT_CMD.format(self.vnfd_helper.mgmt_interface, self) LOG.debug(cmd) @@ -108,6 +110,12 @@ class IxLoadResourceHelper(ClientResourceHelper): return {key_right: self.result[key_left].get_aggregates() for key_left, key_right in self.KPI_LIST.items()} + def collect_kpi(self): + if self.data: + self._result.update(self.data) + LOG.info("Collect {0} KPIs {1}".format(self.RESOURCE_WORD, self._result)) + return self._result + def log(self): for key in self.KPI_LIST: LOG.debug(self.result[key]) @@ -122,8 +130,6 @@ class IxLoadTrafficGen(SampleVNFTrafficGen): super(IxLoadTrafficGen, self).__init__(name, vnfd, setup_env_helper_type, resource_helper_type) self._result = {} - self.done = False - self.data = None def run_traffic(self, traffic_profile): ports = [] @@ -131,7 +137,7 @@ class IxLoadTrafficGen(SampleVNFTrafficGen): for interface in self.vnfd_helper.interfaces: vpci_list = interface['virtual-interface']["vpci"].split(":") card = vpci_list[0] - ports.append(vpci_list[1]) + ports.append(str(vpci_list[1])) for csv_file in glob.iglob(self.ssh_helper.join_bin_path('*.csv')): os.unlink(csv_file) @@ -143,6 +149,7 @@ class IxLoadTrafficGen(SampleVNFTrafficGen): os.path.basename(self.resource_helper.resource_file_name)) http_ixload_path = os.path.join(VNF_PATH, "../../traffic_profile") + cmd = IXLOAD_CMD.format( ixloadpy=os.path.join(ixia_config["py_bin_path"], "ixloadpython"), http_ixload=os.path.join(http_ixload_path, "http_ixload.py"), @@ -153,23 +160,25 @@ class IxLoadTrafficGen(SampleVNFTrafficGen): with open(self.ssh_helper.join_bin_path("ixLoad_HTTP_Client.csv")) as csv_file: lines = csv_file.readlines()[10:] - with open(self.ssh_helper.join_bin_path("http_result.csv"), 'wb+') as result_file: - result_file.writelines(six.text_type(lines[:-1])) + result_file.writelines(lines[:-1]) result_file.flush() result_file.seek(0) reader = csv.DictReader(result_file) self.resource_helper.parse_csv_read(reader) self.resource_helper.log() - self.data = self.resource_helper.make_aggregates() + self.resource_helper.data = self.resource_helper.make_aggregates() def listen_traffic(self, traffic_profile): pass def instantiate(self, scenario_cfg, context_cfg): super(IxLoadTrafficGen, self).instantiate(scenario_cfg, context_cfg) - self.done = False + + def wait_for_instantiate(self): + # not needed for Ixload + pass def terminate(self): call(["pkill", "-9", "http_ixload.py"]) |