From 8137692dd94e112943dcc576470f4b361fbd8c5c Mon Sep 17 00:00:00 2001 From: "Sridhar K. N. Rao" Date: Wed, 2 Jun 2021 19:11:18 +0530 Subject: WIP:Infrastructure for supporting more K8S Tests. This patch add multiple changes to ViNePerf to support following tests. 1. External virtual switch - not managed by Vineperf. 2. CNI not based on virtual switch 3. Fixed bugs after successful testing. 4. Pylint issues fixed 4. Fix some license-content and comments Signed-off-by: Sridhar K. N. Rao Change-Id: Ie01735f99c0687cc812eae8e67ee2353347924f2 --- pods/papi/papi.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'pods') diff --git a/pods/papi/papi.py b/pods/papi/papi.py index 5a21f1d6..5a96660d 100644 --- a/pods/papi/papi.py +++ b/pods/papi/papi.py @@ -49,9 +49,12 @@ class Papi(IPod): """ Creation Process """ + print("Entering Create Function") # create vswitchperf namespace api = client.CoreV1Api() namespace = 'default' + pod_manifests = S.getValue('POD_MANIFEST_FILEPATH') + pod_count = int(S.getValue('POD_COUNT')) #namespace = 'vswitchperf' # replace_namespace(api, namespace) @@ -68,6 +71,8 @@ class Papi(IPod): version = 'v1' kind_plural = 'network-attachment-definitions' api = client.CustomObjectsApi() + + assert pod_count <= len(pod_manifests) for nad_filepath in S.getValue('NETWORK_ATTACHMENT_FILEPATH'): nad_manifest = load_manifest(nad_filepath) @@ -81,15 +86,17 @@ class Papi(IPod): raise Exception from err #create pod workloads - pod_manifest = load_manifest(S.getValue('POD_MANIFEST_FILEPATH')) api = client.CoreV1Api() + + for count in range(pod_count): + pod_manifest = load_manifest(pod_manifests[count]) - try: - response = api.create_namespaced_pod(namespace, pod_manifest) - self._logger.info(str(response)) - self._logger.info("Created POD %d ...", self._number) - except ApiException as err: - raise Exception from err + try: + response = api.create_namespaced_pod(namespace, pod_manifest) + self._logger.info(str(response)) + self._logger.info("Created POD %d ...", self._number) + except ApiException as err: + raise Exception from err time.sleep(12) -- cgit