# Copyright (c) 2019 AT&T Intellectual Property.
+# Copyright (c) 2020 HCL Technologies Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+*** Settings ***
+Documentation Run basic health checks for all known components which have one
+
+Resource /robot/resources/global_properties.robot
+
+Resource /robot/resources/ric/ric_utils.robot
+
+Library KubernetesEntity ${GLOBAL_RICPLT_NAMESPACE}
+Library Collections
+Library String
+Library Process
+Library OperatingSystem
+
+
+*** Test Cases ***
+Basic Component Health Checks
+ [Documentation] For any defined RIC component with a health check keyword,
+ ... Run that keyword. "Health check" keywords have names of the
+ ... form "Run ${component} Health Check".
+ # This could have been entirely implemented in Helm; however, I wanted to
+ # allow for the possibility that it would be used (with some modification)
+ # by the ric-robot, which does not perform template expansion on testsuites.
+ [Tags] health
+ Set Test Variable ${finalStatus} PASS
+ FOR ${component} IN @{GLOBAL_RICPLT_COMPONENTS}
+ Log To Console component is ${component}
+ Run Keyword And Ignore Error
+ ... Import Resource /robot/resources/${component}_interface.robot
+ ${healthCheck} = Set Variable Run ${component} Health Check
+ ${status} = Run Keyword If Present ${healthCheck}
+ Log To Console ${healthcheck}
+ Log To Console ${status}
+ ${finalStatus} = Set Variable If '${status}' == 'FAIL' FAIL ${finalStatus}
+ Run Keyword If '${status}' == 'FAIL'
+ ... Log To Console ${component} is unhealthy
+ ... ELSE
+ ... Log To Console ${component} is healthy
+ Log To Console -----------------------------------------------------------------
+ END
+ Run Keyword If '${finalStatus}' == 'FAIL'
+ ... Fail One or more Health Checks failed
-*** Settings ***
-Documentation Run basic health checks for all known components which have one
-
-Resource /robot/resources/global_properties.robot
-
-Resource /robot/resources/ric/ric_utils.robot
-
-*** Test Cases ***
-Basic Component Health Checks
- [Documentation] For any defined RIC component with a health check keyword,
- ... Run that keyword. "Health check" keywords have names of the
- ... form "Run ${component} Health Check".
- # This could have been entirely implemented in Helm; however, I wanted to
- # allow for the possibility that it would be used (with some modification)
- # by the ric-robot, which does not perform template expansion on testsuites.
- [Tags] health
- Set Test Variable ${finalStatus} PASS
- :FOR ${component} IN @{GLOBAL_RICPLT_COMPONENTS}
- \ Run Keyword And Ignore Error
- ... Import Resource /robot/resources/${component}/${component}_interface.robot
- \ ${healthCheck} = Set Variable Run ${component} Health Check
- \ ${status} = Run Keyword If Present ${healthCheck}
- \ ${finalStatus} = Set Variable If '${status}' == 'FAIL' FAIL ${finalStatus}
- \ Run Keyword If '${status}' == 'FAIL'
- ... Log ${component} is unhealthy
- Run Keyword If '${finalStatus}' == 'FAIL'
- ... Fail One or more Health Checks failed