aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSridhar K. N. Rao <sridhar.rao@spirent.com>2021-11-10 21:26:14 +0530
committerSridhar K. N. Rao <sridhar.rao@spirent.com>2021-11-10 21:27:45 +0530
commit4fa105c5b4113a9ff4311569709ca99a8fbf5028 (patch)
tree481ffea4b406da29e3dbf0dd29c4bb67a378be81
parentab6ee21423c20c101a5885924f08a46a86ce5b00 (diff)
Minor Fixes.
This patch add multiple minor changes. Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com> Change-Id: Ieda8af0b8145c1ffde6bfdb7a7394776b42df988
-rw-r--r--pods/papi/k8scmdrun.py13
-rw-r--r--pods/papi/papi.py19
-rw-r--r--tools/docker/test-containers/dpdk-forwarding-pods/Dockerfile (renamed from tools/k8s/test-containers/dpdk-forwarding-pods/Dockerfile)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/pktgen/Dockerfile (renamed from tools/k8s/test-containers/trafficgen-pods/pktgen/Dockerfile)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/prox/Dockerfile (renamed from tools/k8s/test-containers/trafficgen-pods/prox/Dockerfile)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/prox/deploycentostools.sh (renamed from tools/k8s/test-containers/trafficgen-pods/prox/deploycentostools.sh)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/prox/port_info/Makefile (renamed from tools/k8s/test-containers/trafficgen-pods/prox/port_info/Makefile)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/prox/port_info/port_info.c (renamed from tools/k8s/test-containers/trafficgen-pods/prox/port_info/port_info.c)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/prox/rapid_rsa_key (renamed from tools/k8s/test-containers/trafficgen-pods/prox/rapid_rsa_key)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/prox/rapid_rsa_key.pub (renamed from tools/k8s/test-containers/trafficgen-pods/prox/rapid_rsa_key.pub)0
-rwxr-xr-xtools/docker/test-containers/trafficgen-pods/prox/start.sh (renamed from tools/k8s/test-containers/trafficgen-pods/prox/start.sh)0
-rwxr-xr-xtools/docker/test-containers/trafficgen-pods/prox/vhost_substitute.sh (renamed from tools/k8s/test-containers/trafficgen-pods/prox/vhost_substitute.sh)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/Dockerfile (renamed from tools/k8s/test-containers/trafficgen-pods/trex/Dockerfile)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/deploycentostools.sh (renamed from tools/k8s/test-containers/trafficgen-pods/trex/deploycentostools.sh)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/rapid_rsa_key (renamed from tools/k8s/test-containers/trafficgen-pods/trex/rapid_rsa_key)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/rapid_rsa_key.pub (renamed from tools/k8s/test-containers/trafficgen-pods/trex/rapid_rsa_key.pub)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/trex_cfg.yaml (renamed from tools/k8s/test-containers/trafficgen-pods/trex/trex_cfg.yaml)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/trex_cfg.yaml.j2 (renamed from tools/k8s/test-containers/trafficgen-pods/trex/trex_cfg.yaml.j2)0
-rw-r--r--tools/docker/test-containers/trafficgen-pods/trex/vppconf.py (renamed from tools/k8s/test-containers/trafficgen-pods/trex/vppconf.py)0
19 files changed, 16 insertions, 16 deletions
diff --git a/pods/papi/k8scmdrun.py b/pods/papi/k8scmdrun.py
index 2fb1a62e..d9c95028 100644
--- a/pods/papi/k8scmdrun.py
+++ b/pods/papi/k8scmdrun.py
@@ -16,8 +16,7 @@ Run commands inside the pod for post-deployment configuration
"""
import re
-import os
-from kubernetes import client, config
+import sys
from kubernetes.client.rest import ApiException
from kubernetes.stream import stream
@@ -31,10 +30,10 @@ def execute_command(api_instance, pod_info, exec_command):
try:
resp = api_instance.read_namespaced_pod(name=name,
namespace='default')
- except ApiException as e:
- if e.status != 404:
- print("Unknown error: %s" % e)
- exit(1)
+ except ApiException as excep:
+ if excep.status != 404:
+ print("Unknown error: %s" % excep)
+ sys.exit(0)
if not resp:
print("Pod %s does not exist. Creating it..." % name)
return -1
@@ -100,6 +99,7 @@ def get_sriov_interfaces(api_instance, podname, namespace):
elif 'name' in rout:
names.append(rout[5:])
res = {names[i]: ifs[i] for i in range(len(names))}
+ return res
def start_fowarding_app(api_instance, podname, namespace, appname):
"""
@@ -110,3 +110,4 @@ def start_fowarding_app(api_instance, podname, namespace, appname):
'namespace': namespace}
cmd = [appname, '&']
response = execute_command(api_instance, pinfo, cmd)
+ return response
diff --git a/pods/papi/papi.py b/pods/papi/papi.py
index 67cc3bc5..bd935897 100644
--- a/pods/papi/papi.py
+++ b/pods/papi/papi.py
@@ -27,6 +27,7 @@ from kubernetes.client.rest import ApiException
from conf import settings as S
from pods.pod.pod import IPod
+from pods.papi import k8scmdrun as util
class Papi(IPod):
"""
@@ -73,7 +74,7 @@ class Papi(IPod):
group = 'k8s.cni.cncf.io'
version = 'v1'
kind_plural = 'network-attachment-definitions'
- api = client.CustomObjectsApi()
+ api = client.CustomObjectsApi()
assert pod_count <= len(pod_manifests)
for nad_filepath in S.getValue('NETWORK_ATTACHMENT_FILEPATH'):
@@ -113,13 +114,10 @@ class Papi(IPod):
status = response.status.phase
except ApiException as err:
raise Exception from err
- if (status == "Running"
- or status == "Failed"
- or status == "Unknown"):
+ if status in ("Running", "Failed", "Unknown"):
break
- else:
- time.sleep(5)
- count = count + 1
+ time.sleep(5)
+ count = count + 1
# Now Get the Pod-IP
try:
response = api.read_namespaced_pod_status(dep_pod_info['name'],
@@ -128,10 +126,11 @@ class Papi(IPod):
except ApiException as err:
raise Exception from err
dep_pod_info['namespace'] = namespace
- dep_pod_list.append(dep_pod_info)
cmd = ['cat', '/etc/podnetinfo/annotations']
- execute_command(api, dep_pod_info, cmd)
-
+ output = util.execute_command(api, dep_pod_info, cmd)
+ dep_pod_info['annotations'] = output
+ dep_pod_list.append(dep_pod_info)
+
S.setValue('POD_LIST',dep_pod_list)
return dep_pod_list
diff --git a/tools/k8s/test-containers/dpdk-forwarding-pods/Dockerfile b/tools/docker/test-containers/dpdk-forwarding-pods/Dockerfile
index 58f558fb..58f558fb 100644
--- a/tools/k8s/test-containers/dpdk-forwarding-pods/Dockerfile
+++ b/tools/docker/test-containers/dpdk-forwarding-pods/Dockerfile
diff --git a/tools/k8s/test-containers/trafficgen-pods/pktgen/Dockerfile b/tools/docker/test-containers/trafficgen-pods/pktgen/Dockerfile
index 8288cf63..8288cf63 100644
--- a/tools/k8s/test-containers/trafficgen-pods/pktgen/Dockerfile
+++ b/tools/docker/test-containers/trafficgen-pods/pktgen/Dockerfile
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/Dockerfile b/tools/docker/test-containers/trafficgen-pods/prox/Dockerfile
index 3235e725..3235e725 100644
--- a/tools/k8s/test-containers/trafficgen-pods/prox/Dockerfile
+++ b/tools/docker/test-containers/trafficgen-pods/prox/Dockerfile
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/deploycentostools.sh b/tools/docker/test-containers/trafficgen-pods/prox/deploycentostools.sh
index 80af81fd..80af81fd 100644
--- a/tools/k8s/test-containers/trafficgen-pods/prox/deploycentostools.sh
+++ b/tools/docker/test-containers/trafficgen-pods/prox/deploycentostools.sh
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/port_info/Makefile b/tools/docker/test-containers/trafficgen-pods/prox/port_info/Makefile
index f91cf156..f91cf156 100644
--- a/tools/k8s/test-containers/trafficgen-pods/prox/port_info/Makefile
+++ b/tools/docker/test-containers/trafficgen-pods/prox/port_info/Makefile
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/port_info/port_info.c b/tools/docker/test-containers/trafficgen-pods/prox/port_info/port_info.c
index 79bd0c0b..79bd0c0b 100644
--- a/tools/k8s/test-containers/trafficgen-pods/prox/port_info/port_info.c
+++ b/tools/docker/test-containers/trafficgen-pods/prox/port_info/port_info.c
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/rapid_rsa_key b/tools/docker/test-containers/trafficgen-pods/prox/rapid_rsa_key
index 6ecdb277..6ecdb277 100644
--- a/tools/k8s/test-containers/trafficgen-pods/prox/rapid_rsa_key
+++ b/tools/docker/test-containers/trafficgen-pods/prox/rapid_rsa_key
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/rapid_rsa_key.pub b/tools/docker/test-containers/trafficgen-pods/prox/rapid_rsa_key.pub
index c735d178..c735d178 100644
--- a/tools/k8s/test-containers/trafficgen-pods/prox/rapid_rsa_key.pub
+++ b/tools/docker/test-containers/trafficgen-pods/prox/rapid_rsa_key.pub
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/start.sh b/tools/docker/test-containers/trafficgen-pods/prox/start.sh
index 7fbeedf8..7fbeedf8 100755
--- a/tools/k8s/test-containers/trafficgen-pods/prox/start.sh
+++ b/tools/docker/test-containers/trafficgen-pods/prox/start.sh
diff --git a/tools/k8s/test-containers/trafficgen-pods/prox/vhost_substitute.sh b/tools/docker/test-containers/trafficgen-pods/prox/vhost_substitute.sh
index b33f3521..b33f3521 100755
--- a/tools/k8s/test-containers/trafficgen-pods/prox/vhost_substitute.sh
+++ b/tools/docker/test-containers/trafficgen-pods/prox/vhost_substitute.sh
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/Dockerfile b/tools/docker/test-containers/trafficgen-pods/trex/Dockerfile
index 7258533a..7258533a 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/Dockerfile
+++ b/tools/docker/test-containers/trafficgen-pods/trex/Dockerfile
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/deploycentostools.sh b/tools/docker/test-containers/trafficgen-pods/trex/deploycentostools.sh
index 69889b9d..69889b9d 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/deploycentostools.sh
+++ b/tools/docker/test-containers/trafficgen-pods/trex/deploycentostools.sh
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/rapid_rsa_key b/tools/docker/test-containers/trafficgen-pods/trex/rapid_rsa_key
index 6ecdb277..6ecdb277 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/rapid_rsa_key
+++ b/tools/docker/test-containers/trafficgen-pods/trex/rapid_rsa_key
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/rapid_rsa_key.pub b/tools/docker/test-containers/trafficgen-pods/trex/rapid_rsa_key.pub
index c735d178..c735d178 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/rapid_rsa_key.pub
+++ b/tools/docker/test-containers/trafficgen-pods/trex/rapid_rsa_key.pub
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/trex_cfg.yaml b/tools/docker/test-containers/trafficgen-pods/trex/trex_cfg.yaml
index 384817a4..384817a4 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/trex_cfg.yaml
+++ b/tools/docker/test-containers/trafficgen-pods/trex/trex_cfg.yaml
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/trex_cfg.yaml.j2 b/tools/docker/test-containers/trafficgen-pods/trex/trex_cfg.yaml.j2
index 9a42bd97..9a42bd97 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/trex_cfg.yaml.j2
+++ b/tools/docker/test-containers/trafficgen-pods/trex/trex_cfg.yaml.j2
diff --git a/tools/k8s/test-containers/trafficgen-pods/trex/vppconf.py b/tools/docker/test-containers/trafficgen-pods/trex/vppconf.py
index ad7d63d8..ad7d63d8 100644
--- a/tools/k8s/test-containers/trafficgen-pods/trex/vppconf.py
+++ b/tools/docker/test-containers/trafficgen-pods/trex/vppconf.py