Modify Python ONAP SDK tests to not require kubeconfig
[testsuite/pythonsdk-tests.git] / src / onaptests / steps / simulator / pnf_simulator_cnf / pnf_register.py
index 0e6e001..3a846e3 100644 (file)
@@ -46,7 +46,10 @@ class PnfSimulatorCnfRegisterStep(BaseStep):
             bool: True if PNF simulator pod is running, False otherwise
 
         """
-        config.load_kube_config(settings.K8S_CONFIG)
+        if settings.IN_CLUSTER:
+            config.load_incluster_config()
+        else:
+            config.load_kube_config(config_file=settings.K8S_CONFIG)
         k8s_client: "CoreV1API" = client.CoreV1Api()
         k8s_watch: "Watch" =  watch.Watch()
         status = False
@@ -75,7 +78,10 @@ class PnfSimulatorCnfRegisterStep(BaseStep):
             Tuple[str, str, str]: VES protocol, IP and port
 
         """
-        config.load_kube_config(settings.K8S_CONFIG)
+        if settings.IN_CLUSTER:
+            config.load_incluster_config()
+        else:
+            config.load_kube_config(config_file=settings.K8S_CONFIG)
         k8s_client: "CoreV1API" = client.CoreV1Api()
         try:
             for service in k8s_client.list_namespaced_service(namespace=settings.K8S_ONAP_NAMESPACE).items: