Create a generic netconf-pnp-simulator verify script 98/104998/1
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Thu, 2 Apr 2020 14:40:59 +0000 (07:40 -0700)
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>
Thu, 2 Apr 2020 14:40:59 +0000 (07:40 -0700)
Change-Id: I2e4859daa6f8ccc8ed01a8c4b9fabaa3590eba0f
Issue-ID: INT-1508
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
jjb/integration/integration-docker-compose.yaml
jjb/integration/integration-templates-docker.yaml
jjb/integration/netconf-pnp-simulator-verify.sh [moved from jjb/integration/emssimulator-swm-netconf_post.sh with 79% similarity]

index ae840f6..ef4bf0c 100644 (file)
@@ -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
index 0ef7a52..ac383fb 100644 (file)
     node: 'ubuntu1804-docker-8c-8g'
     docker_root: '$WORKSPACE'
     post_script: ''
+    netconf_sim_service_name: ''
 
     parameters:
       - lf-infra-parameters:
       - inject:
           properties-content: |
             DOCKER_ROOT={docker_root}
+            NETCONF_SIM_SERVICE_NAME={netconf_sim_service_name}
       - shell: '{script}'
       - shell: '{post_script}'
 
 # 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