aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-07-16 09:35:34 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-07-19 08:07:16 +0000
commit43865731ecf49c534c6a54e856e9133fd9288927 (patch)
tree56b470fc80f5d568f21ed8eb68ac2543d06fdc86 /yardstick/benchmark
parent3eb7c80aa614456b05e08651a55f7450e6864c79 (diff)
NodePort information returned in context should be a dictionary
In Kubernetes context, NodePort information returned in context should be a dictionary. In [1], the node information is dumped in a yaml file. The NodePort object doesn't have a serialize implementation; instead of returning the object, an equivalent dictionary should be returned. [1]https://github.com/opnfv/yardstick/blob/f6fa0d7422f0669d049dbf07a51eb39b1dc25830/yardstick/benchmark/scenarios/networking/vnf_generic.py#L293 JIRA: YARDSTICK-1323 Change-Id: If4844c9b074920a7a7d8c1a424b681f9f8a4b0c5 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/benchmark')
-rw-r--r--yardstick/benchmark/contexts/kubernetes.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/yardstick/benchmark/contexts/kubernetes.py b/yardstick/benchmark/contexts/kubernetes.py
index 704c4a022..7534c4ea5 100644
--- a/yardstick/benchmark/contexts/kubernetes.py
+++ b/yardstick/benchmark/contexts/kubernetes.py
@@ -166,8 +166,8 @@ class KubernetesContext(ctx_base.Context):
def _get_server(self, name):
node_ports = self._get_service_ports(name)
for sn_port in (sn_port for sn_port in node_ports
- if sn_port.port == constants.SSH_PORT):
- node_port = sn_port.node_port
+ if sn_port['port'] == constants.SSH_PORT):
+ node_port = sn_port['node_port']
break
else:
raise exceptions.KubernetesSSHPortNotDefined()
@@ -224,4 +224,11 @@ class KubernetesContext(ctx_base.Context):
service = k8s_utils.get_service_by_name(service_name)
if not service:
raise exceptions.KubernetesServiceObjectNotDefined()
- return service.ports
+ ports = []
+ for port in service.ports:
+ ports.append({'name': port.name,
+ 'node_port': port.node_port,
+ 'port': port.port,
+ 'protocol': port.protocol,
+ 'target_port': port.target_port})
+ return ports