aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/networking')
-rw-r--r--yardstick/benchmark/scenarios/networking/iperf3.py14
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf.py12
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf_node.py13
-rw-r--r--yardstick/benchmark/scenarios/networking/netutilization.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/networkcapacity.py9
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py5
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6.py1
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen.py12
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen_dpdk.py1
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc.py11
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc_openstack.py25
-rw-r--r--yardstick/benchmark/scenarios/networking/vsperf.py3
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_throughput.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py7
16 files changed, 92 insertions, 49 deletions
diff --git a/yardstick/benchmark/scenarios/networking/iperf3.py b/yardstick/benchmark/scenarios/networking/iperf3.py
index 13fa0155b..b8ec9acdf 100644
--- a/yardstick/benchmark/scenarios/networking/iperf3.py
+++ b/yardstick/benchmark/scenarios/networking/iperf3.py
@@ -10,9 +10,13 @@
# iperf3 scenario
# iperf3 homepage at: http://software.es.net/iperf/
+from __future__ import absolute_import
+from __future__ import print_function
+
import logging
-import json
+
import pkg_resources
+from oslo_serialization import jsonutils
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
@@ -89,7 +93,7 @@ For more info see http://software.es.net/iperf
self.host.close()
status, stdout, stderr = self.target.execute("pkill iperf3")
if status:
- LOG.warn(stderr)
+ LOG.warning(stderr)
self.target.close()
def run(self, result):
@@ -138,7 +142,8 @@ For more info see http://software.es.net/iperf
# Note: convert all ints to floats in order to avoid
# schema conflicts in influxdb. We probably should add
# a format func in the future.
- result.update(json.loads(stdout, parse_int=float))
+ result.update(
+ jsonutils.loads(stdout, parse_int=float))
if "sla" in self.scenario_cfg:
sla_iperf = self.scenario_cfg["sla"]
@@ -188,7 +193,8 @@ def _test():
p = Iperf(args, ctx)
p.run(result)
- print result
+ print(result)
+
if __name__ == '__main__':
_test()
diff --git a/yardstick/benchmark/scenarios/networking/netperf.py b/yardstick/benchmark/scenarios/networking/netperf.py
index 28f5bea56..80dbed334 100755
--- a/yardstick/benchmark/scenarios/networking/netperf.py
+++ b/yardstick/benchmark/scenarios/networking/netperf.py
@@ -7,9 +7,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# bulk data test and req/rsp test are supported
-import pkg_resources
+from __future__ import absolute_import
+from __future__ import print_function
+
import logging
-import json
+
+import pkg_resources
+from oslo_serialization import jsonutils
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
@@ -129,7 +133,7 @@ class Netperf(base.Scenario):
if status:
raise RuntimeError(stderr)
- result.update(json.loads(stdout))
+ result.update(jsonutils.loads(stdout))
if result['mean_latency'] == '':
raise RuntimeError(stdout)
@@ -175,7 +179,7 @@ def _test():
netperf = Netperf(args, ctx)
netperf.run(result)
- print result
+ print(result)
if __name__ == '__main__':
diff --git a/yardstick/benchmark/scenarios/networking/netperf_node.py b/yardstick/benchmark/scenarios/networking/netperf_node.py
index a76982b6f..0cf52b8dd 100755
--- a/yardstick/benchmark/scenarios/networking/netperf_node.py
+++ b/yardstick/benchmark/scenarios/networking/netperf_node.py
@@ -7,9 +7,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# bulk data test and req/rsp test are supported
-import pkg_resources
+from __future__ import absolute_import
+from __future__ import print_function
+
import logging
-import json
+
+import pkg_resources
+from oslo_serialization import jsonutils
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
@@ -152,7 +156,7 @@ class NetperfNode(base.Scenario):
if status:
raise RuntimeError(stderr)
- result.update(json.loads(stdout))
+ result.update(jsonutils.loads(stdout))
if result['mean_latency'] == '':
raise RuntimeError(stdout)
@@ -200,7 +204,8 @@ def _test(): # pragma: no cover
netperf = NetperfNode(args, ctx)
netperf.run(result)
- print result
+ print(result)
+
if __name__ == '__main__':
_test()
diff --git a/yardstick/benchmark/scenarios/networking/netutilization.py b/yardstick/benchmark/scenarios/networking/netutilization.py
index 1ea92cca3..1ba6f1ec3 100644
--- a/yardstick/benchmark/scenarios/networking/netutilization.py
+++ b/yardstick/benchmark/scenarios/networking/netutilization.py
@@ -6,11 +6,13 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import logging
import re
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
+from six.moves import zip
LOG = logging.getLogger(__name__)
@@ -121,7 +123,7 @@ class NetUtilization(base.Scenario):
values = line[1:]
if values and len(values) == len(fields):
- temp_dict = dict(zip(fields, values))
+ temp_dict = dict(list(zip(fields, values)))
if net_interface not in maximum:
maximum[net_interface] = temp_dict
else:
@@ -158,7 +160,8 @@ class NetUtilization(base.Scenario):
net_interface = line[0]
values = line[1:]
if values and len(values) == len(fields):
- average[net_interface] = dict(zip(fields, values))
+ average[net_interface] = dict(
+ list(zip(fields, values)))
else:
raise RuntimeError("network_utilization average: \
parse error", fields, line)
diff --git a/yardstick/benchmark/scenarios/networking/networkcapacity.py b/yardstick/benchmark/scenarios/networking/networkcapacity.py
index 250f7eaf0..e7ce83570 100644
--- a/yardstick/benchmark/scenarios/networking/networkcapacity.py
+++ b/yardstick/benchmark/scenarios/networking/networkcapacity.py
@@ -6,9 +6,12 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import pkg_resources
+from __future__ import absolute_import
+
import logging
-import json
+
+import pkg_resources
+from oslo_serialization import jsonutils
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
@@ -67,4 +70,4 @@ class NetworkCapacity(base.Scenario):
if status:
raise RuntimeError(stderr)
- result.update(json.loads(stdout))
+ result.update(jsonutils.loads(stdout))
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 6e49a1437..eb173f1df 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -9,6 +9,8 @@
# ping scenario
+from __future__ import print_function
+from __future__ import absolute_import
import pkg_resources
import logging
@@ -122,7 +124,8 @@ def _test(): # pragma: no cover
p = Ping(args, ctx)
p.run(result)
- print result
+ print(result)
+
if __name__ == '__main__': # pragma: no cover
_test()
diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py
index f4d23ce7b..dd4272236 100644
--- a/yardstick/benchmark/scenarios/networking/ping6.py
+++ b/yardstick/benchmark/scenarios/networking/ping6.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import pkg_resources
import logging
diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py
index e2df706a2..69663ec5f 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen.py
@@ -6,9 +6,13 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import pkg_resources
+from __future__ import absolute_import
+from __future__ import print_function
+
import logging
-import json
+
+import pkg_resources
+from oslo_serialization import jsonutils
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
@@ -130,7 +134,7 @@ class Pktgen(base.Scenario):
if status:
raise RuntimeError(stderr)
- result.update(json.loads(stdout))
+ result.update(jsonutils.loads(stdout))
result['packets_received'] = self._iptables_get_result()
@@ -170,7 +174,7 @@ def _test():
p = Pktgen(args, ctx)
p.run(result)
- print result
+ print(result)
if __name__ == '__main__':
diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
index 503ea97e1..2bdb91abb 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
@@ -6,6 +6,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import pkg_resources
import logging
import time
diff --git a/yardstick/benchmark/scenarios/networking/sfc.py b/yardstick/benchmark/scenarios/networking/sfc.py
index 1bd99b957..87fea4f95 100644
--- a/yardstick/benchmark/scenarios/networking/sfc.py
+++ b/yardstick/benchmark/scenarios/networking/sfc.py
@@ -1,9 +1,14 @@
-import pkg_resources
+from __future__ import absolute_import
+
import logging
import subprocess
-import sfc_openstack
+
+import pkg_resources
+from six.moves import range
+
import yardstick.ssh as ssh
from yardstick.benchmark.scenarios import base
+from yardstick.benchmark.scenarios.networking import sfc_openstack
LOG = logging.getLogger(__name__)
@@ -199,7 +204,7 @@ class Sfc(base.Scenario): # pragma: no cover
sfc = Sfc(scenario_cfg, context_cfg)
sfc.setup()
sfc.run(result)
- print result
+ print(result)
sfc.teardown()
if __name__ == '__main__': # pragma: no cover
diff --git a/yardstick/benchmark/scenarios/networking/sfc_openstack.py b/yardstick/benchmark/scenarios/networking/sfc_openstack.py
index d1d45d8e4..caaf10060 100644
--- a/yardstick/benchmark/scenarios/networking/sfc_openstack.py
+++ b/yardstick/benchmark/scenarios/networking/sfc_openstack.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+from __future__ import absolute_import
import os
from novaclient import client as novaclient
from neutronclient.v2_0 import client as neutronclient
@@ -40,8 +42,8 @@ def get_credentials(service): # pragma: no cover
"ca_file": cacert})
creds.update({"insecure": "True", "https_insecure": "True"})
if not os.path.isfile(cacert):
- print ("WARNING: The 'OS_CACERT' environment variable is " +
- "set to %s but the file does not exist." % cacert)
+ print(("WARNING: The 'OS_CACERT' environment variable is " +
+ "set to %s but the file does not exist." % cacert))
return creds
@@ -49,8 +51,8 @@ def get_instances(nova_client): # pragma: no cover
try:
instances = nova_client.servers.list(search_opts={'all_tenants': 1})
return instances
- except Exception, e:
- print "Error [get_instances(nova_client)]:", e
+ except Exception as e:
+ print("Error [get_instances(nova_client)]:", e)
return None
@@ -62,8 +64,8 @@ def get_SFs(nova_client): # pragma: no cover
if "sfc_test" not in instance.name:
SFs.append(instance)
return SFs
- except Exception, e:
- print "Error [get_SFs(nova_client)]:", e
+ except Exception as e:
+ print("Error [get_SFs(nova_client)]:", e)
return None
@@ -83,8 +85,8 @@ def create_floating_ips(neutron_client): # pragma: no cover
ip_json = neutron_client.create_floatingip({'floatingip': props})
fip_addr = ip_json['floatingip']['floating_ip_address']
ips.append(fip_addr)
- except Exception, e:
- print "Error [create_floating_ip(neutron_client)]:", e
+ except Exception as e:
+ print("Error [create_floating_ip(neutron_client)]:", e)
return None
return ips
@@ -96,9 +98,9 @@ def floatIPtoSFs(SFs, floatips): # pragma: no cover
SF.add_floating_ip(floatips[i])
i = i + 1
return True
- except Exception, e:
- print ("Error [add_floating_ip(nova_client, '%s', '%s')]:" %
- (SF, floatips[i]), e)
+ except Exception as e:
+ print(("Error [add_floating_ip(nova_client, '%s', '%s')]:" %
+ (SF, floatips[i]), e))
return False
@@ -113,5 +115,6 @@ def get_an_IP(): # pragma: no cover
floatIPtoSFs(SFs, floatips)
return floatips
+
if __name__ == '__main__': # pragma: no cover
get_an_IP()
diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py
index 4f4ef21eb..9d6db7c1d 100644
--- a/yardstick/benchmark/scenarios/networking/vsperf.py
+++ b/yardstick/benchmark/scenarios/networking/vsperf.py
@@ -13,6 +13,7 @@
# limitations under the License.
""" Vsperf specific scenario definition """
+from __future__ import absolute_import
import logging
import os
import subprocess
@@ -211,7 +212,7 @@ class Vsperf(base.Scenario):
# convert result.csv to JSON format
reader = csv.DictReader(stdout.split('\r\n'))
- result.update(reader.next())
+ result.update(next(reader))
# sla check; go through all defined SLAs and check if values measured
# by VSPERF are higher then those defined by SLAs
diff --git a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py b/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py
index bec23fc52..bf42d9a9a 100644
--- a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py
+++ b/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import logging
import os
@@ -81,7 +82,7 @@ class VtcInstantiationValidation(base.Scenario):
heat_template_parameters,
deployment_configuration,
openstack_credentials)
- except Exception as e:
- LOG.info('Exception: {}'.format(e.message))
- LOG.info('Got output: {}'.format(res))
+ except Exception:
+ LOG.exception('Exception')
+ LOG.info('Got output: %s', res)
result.update(res)
diff --git a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py b/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
index 8d9bf0962..fb6e762d1 100644
--- a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
+++ b/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import logging
import os
@@ -92,7 +93,7 @@ class VtcInstantiationValidationNoisy(base.Scenario):
heat_template_parameters,
deployment_configuration,
openstack_credentials)
- except Exception as e:
- LOG.info('Exception: {}'.format(e.message))
- LOG.info('Got output: {}'.format(res))
+ except Exception:
+ LOG.exception('Exception')
+ LOG.info('Got output: %s', res)
result.update(res)
diff --git a/yardstick/benchmark/scenarios/networking/vtc_throughput.py b/yardstick/benchmark/scenarios/networking/vtc_throughput.py
index ff20279ff..0754d3782 100644
--- a/yardstick/benchmark/scenarios/networking/vtc_throughput.py
+++ b/yardstick/benchmark/scenarios/networking/vtc_throughput.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import logging
import os
@@ -81,7 +82,7 @@ class VtcThroughput(base.Scenario):
heat_template_parameters,
deployment_configuration,
openstack_credentials)
- except Exception as e:
- LOG.info('Exception: {}'.format(e.message))
- LOG.info('Got output: {}'.format(res))
+ except Exception:
+ LOG.exception("Exception")
+ LOG.info('Got output: %s', res)
result.update(res)
diff --git a/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py b/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py
index f03226732..552ef8090 100644
--- a/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py
+++ b/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import logging
import os
@@ -91,7 +92,7 @@ class VtcThroughputNoisy(base.Scenario):
heat_template_parameters,
deployment_configuration,
openstack_credentials)
- except Exception as e:
- LOG.info('Exception: {}'.format(e.message))
- LOG.info('Got output: {}'.format(res))
+ except Exception:
+ LOG.exception('Exception')
+ LOG.info('Got output: %s', res)
result.update(res)