Short Term fix for javax.servlet-api
[sdnc/oam.git] / csit / plans / sdnc / setup.sh
index 037bc2e..5b8e4fa 100644 (file)
@@ -18,7 +18,8 @@
 # Modifications copyright (c) 2021 AT&T Intellectual Property
 #
 
-# 
+# Remove all dangling images
+docker image prune -f
 
 ###################### Netconf Simulator Setup ######################
 
@@ -30,7 +31,7 @@ fi
 mkdir ${WORKSPACE}/archives/pnf-simulator
 git clone "https://gerrit.onap.org/r/integration/simulators/pnf-simulator" ${WORKSPACE}/archives/pnf-simulator
 
-# Fix docker-compose to add nexus repo for onap dockers 
+# Fix docker-compose to add nexus repo for onap dockers
 mv ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig
 cat ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig | sed -e "s/image: onap/image: nexus3.onap.org:10001\/onap/" > ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml
 
@@ -74,10 +75,13 @@ export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
 
 unset http_proxy https_proxy
 
+# Append test data to standard data init file to create db init script
+cat ${WORKSPACE}/../installation/sdnc/src/main/resources/sdnctl.dump ${WORKSPACE}/scripts/csit-data.sql > ${WORKSPACE}/archives/csit-dbinit.sql
 
 # start SDNC containers with docker compose and configuration from docker-compose.yml
 docker-compose -f ${SCRIPTS}/docker-compose.yml up -d
 
+
 # WAIT 5 minutes maximum and check karaf.log for readiness every 10 seconds
 
 TIME_OUT=300
@@ -105,10 +109,8 @@ fi
 num_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | tail -1 | cut -d' ' -f1)
 
   if [ "$num_bundles" -ge 333 ]; then
-    num_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | tail -1 | cut -d' ' -f1)
-
-    num_failed_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | grep Failure | wc -l)
-    failed_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | grep Failure)
+    num_failed_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | grep -w Failure | wc -l)
+    failed_bundles=$(docker exec -i ${SDNC_CONTAINER_NAME} sh -c "echo '' | /opt/opendaylight/current/bin/client bundle:list" | grep -w Failure)
     echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles.
   fi
 
@@ -145,6 +147,20 @@ cp ${REQUEST_DATA_PATH}/mount.xml.tmpl ${REQUEST_DATA_PATH}/mount.xml
 sed -i "s/pnfaddr/${LOCAL_IP}/g" "${REQUEST_DATA_PATH}"/mount.xml
 
 
+# Load test dgs
+docker exec ${SDNC_CONTAINER_NAME} mkdir -p /tmp/gra.patch
+
+for file in ${WORKSPACE}/plans/sdnc/testdata/*xml
+do
+    docker cp $file ${SDNC_CONTAINER_NAME}:/tmp/gra.patch
+    mname=$(basename $file | cut -d. -f1| cut -d_ -f1)
+    bname=$(basename $file | cut -d. -f1| cut -d_ -f2-)
+    echo ${mname} ${bname} aai-disabled sync >> ${WORKSPACE}/archives/graph.versions
+done
+docker cp ${WORKSPACE}/archives/graph.versions ${SDNC_CONTAINER_NAME}:/tmp/gra.patch
+docker exec ${SDNC_CONTAINER_NAME} /opt/onap/sdnc/svclogic/bin/svclogic.sh install /tmp/gra.patch /opt/onap/sdnc/svclogic/config/svclogic.properties
+
+
 #########################################################################
 
 # Export SDNC, AAF-Certservice-Cient, Netconf-Pnp-Simulator Continer Names