import logging.config
-from subprocess import check_output,run
+from subprocess import check_output, run
from onapsdk.configuration import settings
logging.config.dictConfig(settings.LOG_CONFIG)
def is_onap_up(cls) -> bool:
"""Verify if ONAP platform is up or not."""
cmd = "kubectl get pods --field-selector 'status.phase=Failed' -n onap -o name | xargs kubectl delete -n onap"
- run(cmd, shell=True)
+ run(cmd, shell=True, check=False)
cmd = "kubectl get pods --field-selector status.phase!=Running -n onap | wc -l"
result = check_output(cmd, shell=True).decode('utf-8')
- logger.info("Number of Onap pods not in Running state (expected <= 8): %s", result)
- if int(result) <= 8:
+ logger.info("Number of Onap pods not in Running state (expected <= %s): %s", settings.ONAP_PODS_WHEN_READY, result)
+ if int(result) <= settings.ONAP_PODS_WHEN_READY:
logger.info("ONAP is Up")
return True
logger.info("ONAP is Down")