From 4d63be5307e49284daa5fbc872e23951973ad471 Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Thu, 2 Apr 2020 07:40:59 -0700 Subject: [PATCH] Create a generic netconf-pnp-simulator verify script Change-Id: I2e4859daa6f8ccc8ed01a8c4b9fabaa3590eba0f Issue-ID: INT-1508 Signed-off-by: Bartek Grzybowski --- jjb/integration/integration-docker-compose.yaml | 3 ++- jjb/integration/integration-templates-docker.yaml | 2 ++ ...swm-netconf_post.sh => netconf-pnp-simulator-verify.sh} | 14 +++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) rename jjb/integration/{emssimulator-swm-netconf_post.sh => netconf-pnp-simulator-verify.sh} (79%) diff --git a/jjb/integration/integration-docker-compose.yaml b/jjb/integration/integration-docker-compose.yaml index ae840f6c6..ef4bf0cb6 100644 --- a/jjb/integration/integration-docker-compose.yaml +++ b/jjb/integration/integration-docker-compose.yaml @@ -19,4 +19,5 @@ - 'emssimulator-swm-netconf': pattern: 'test/mocks/emssimulator/swm-netconf/**' docker_root: 'test/mocks/emssimulator/swm-netconf' - post_script: !include-raw-escape: emssimulator-swm-netconf_post.sh + netconf_sim_service_name: 'ems-netconf-swm' + post_script: !include-raw-escape: netconf-pnp-simulator-verify.sh diff --git a/jjb/integration/integration-templates-docker.yaml b/jjb/integration/integration-templates-docker.yaml index 0ef7a5212..ac383fb23 100644 --- a/jjb/integration/integration-templates-docker.yaml +++ b/jjb/integration/integration-templates-docker.yaml @@ -131,6 +131,7 @@ node: 'ubuntu1804-docker-8c-8g' docker_root: '$WORKSPACE' post_script: '' + netconf_sim_service_name: '' parameters: - lf-infra-parameters: @@ -163,6 +164,7 @@ - inject: properties-content: | DOCKER_ROOT={docker_root} + NETCONF_SIM_SERVICE_NAME={netconf_sim_service_name} - shell: '{script}' - shell: '{post_script}' diff --git a/jjb/integration/emssimulator-swm-netconf_post.sh b/jjb/integration/netconf-pnp-simulator-verify.sh similarity index 79% rename from jjb/integration/emssimulator-swm-netconf_post.sh rename to jjb/integration/netconf-pnp-simulator-verify.sh index b69d3c0f8..cb265f5ca 100644 --- a/jjb/integration/emssimulator-swm-netconf_post.sh +++ b/jjb/integration/netconf-pnp-simulator-verify.sh @@ -14,15 +14,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -echo "---> emssimulator-swm-netconf_post.sh" +# Script verifies if all services in Netconf simulator's docker +# service container were launched successfully. + +echo "---> netconf-pnp-simulator-verify.sh" set -e # Exit with zero only if all commands succeed -SERVICE_NAME="ems-netconf-swm" DOCKER_COMPOSE_LOG="/tmp/docker-compose.log" DOCKER_COMPOSE_LOG_MSG=( "INFO success:" "entered RUNNING state" ) DOCKER_COMPOSE_SLEEP_INTERVAL=4 +if [ -z ${NETCONF_SIM_SERVICE_NAME} ]; +then + echo "ERROR: netconf-pnp-simulator service name not set." + exit 1 +fi + pushd $DOCKER_ROOT # Dump container logs @@ -30,7 +38,7 @@ sleep ${DOCKER_COMPOSE_SLEEP_INTERVAL} # Hang for a while so the services settle docker-compose logs --no-color > ${DOCKER_COMPOSE_LOG} # Get the supervisord services running within container -supervisord_services=($(docker-compose exec -T ${SERVICE_NAME} /bin/sh -c \ +supervisord_services=($(docker-compose exec -T ${NETCONF_SIM_SERVICE_NAME} /bin/sh -c \ 'cat /etc/supervisord.conf /etc/supervisord.d/*' | grep -ho "program:[-a-zA-Z0-9]*" | cut -d: -f 2)) # Check all services are running and fail if not -- 2.16.6