From 43865731ecf49c534c6a54e856e9133fd9288927 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Mon, 16 Jul 2018 09:35:34 +0100 Subject: 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 --- yardstick/benchmark/contexts/kubernetes.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'yardstick/benchmark/contexts') 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 -- cgit 1.2.3-korg