aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/traffic_profile/http_ixload.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/traffic_profile/http_ixload.py')
-rw-r--r--yardstick/network_services/traffic_profile/http_ixload.py81
1 files changed, 74 insertions, 7 deletions
diff --git a/yardstick/network_services/traffic_profile/http_ixload.py b/yardstick/network_services/traffic_profile/http_ixload.py
index 3ccec637d..ec0762500 100644
--- a/yardstick/network_services/traffic_profile/http_ixload.py
+++ b/yardstick/network_services/traffic_profile/http_ixload.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2016-2017 Intel Corporation
+# Copyright (c) 2016-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,14 +24,26 @@ try:
except ImportError:
import json as jsonutils
-from yardstick.common import exceptions
+
+class ErrorClass(object):
+
+ def __init__(self, *args, **kwargs):
+ if 'test' not in kwargs:
+ raise RuntimeError
+
+ def __getattr__(self, item):
+ raise AttributeError
+
+
+class InvalidRxfFile(Exception):
+ message = 'Loaded rxf file has unexpected format'
+
try:
from IxLoad import IxLoad, StatCollectorUtils
except ImportError:
- IxLoad = exceptions.ErrorClass
- StatCollectorUtils = exceptions.ErrorClass
-
+ IxLoad = ErrorClass
+ StatCollectorUtils = ErrorClass
LOG = logging.getLogger(__name__)
CSV_FILEPATH_NAME = 'IxL_statResults.csv'
@@ -197,7 +209,7 @@ class IXLOADHttpTest(object):
ipAddress=address,
gatewayAddress=gateway)
except Exception:
- raise exceptions.InvalidRxfFile
+ raise InvalidRxfFile
def update_network_mac_address(self, net_traffic, mac):
"""Update MACaddress for net_traffic object
@@ -225,7 +237,7 @@ class IXLOADHttpTest(object):
"MacRange")
mac_range.config(mac=mac)
except Exception:
- raise exceptions.InvalidRxfFile
+ raise InvalidRxfFile
def update_network_param(self, net_traffic, param):
"""Update net_traffic by parameters specified in param"""
@@ -256,6 +268,61 @@ class IXLOADHttpTest(object):
continue
self.update_network_param(net_traffic, param["ip"])
+ if "uplink" in name:
+ self.update_http_client_param(net_traffic, param["http_client"])
+
+ def update_http_client_param(self, net_traffic, param):
+ """Update http client object in net_traffic
+
+ Update http client object in net_traffic by parameters
+ specified in param.
+ Do not return anything.
+
+ :param net_traffic: (IxLoadObjectProxy) proxy obj to tcl net_traffic object
+ :param param: (dict) http_client section from traffic profile
+ :return:
+ """
+ page = param.get("page_object")
+ if page:
+ self.update_page_size(net_traffic, page)
+ users = param.get("simulated_users")
+ if users:
+ self.update_user_count(net_traffic, users)
+
+ def update_page_size(self, net_traffic, page_object):
+ """Update page_object field in http client object in net_traffic
+
+ This function update field which configure page_object
+ which will be loaded from server
+ Do not return anything.
+
+ :param net_traffic: (IxLoadObjectProxy) proxy obj to tcl net_traffic object
+ :param page_object: (str) path to object on server e.g. "/4k.html"
+ :return:
+ """
+ try:
+ activity = net_traffic.activityList[0]
+ ix_http_command = activity.agent.actionList[0]
+ ix_http_command.config(pageObject=page_object)
+ except Exception:
+ raise InvalidRxfFile
+
+ def update_user_count(self, net_traffic, user_count):
+ """Update userObjectiveValue field in activity object in net_traffic
+
+ This function update field which configure users count
+ which will be simulated by client.
+ Do not return anything.
+
+ :param net_traffic: (IxLoadObjectProxy) proxy obj to tcl net_traffic object
+ :param user_count: (int) number of simulated users
+ :return:
+ """
+ try:
+ activity = net_traffic.activityList[0]
+ activity.config(userObjectiveValue=user_count)
+ except Exception:
+ raise InvalidRxfFile
def start_http_test(self):
self.ix_load = IxLoad()