update scripts to be executable
[rec.git] / workflows / robot_test_ric.sh
diff --git a/workflows/robot_test_ric.sh b/workflows/robot_test_ric.sh
new file mode 100755 (executable)
index 0000000..d793542
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash\r
+#-----------Pre-modification------------------------------\r
+cd RIC\r
+git clone https://gerrit.o-ran-sc.org/r/it/test\r
+cp test/ric_robot_suite/helm/robot_install.sh /home/cloudadmin/RIC/dep/generated/ricplt\r
+\r
+#-----------Changing the repo location to rec.io-----------\r
+sed -i 's,snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001,registry.kube-system.svc.rec.io:5555,g' test/ric_robot_suite/helm/ric-robot/values.yaml\r
+sed -ri '/nodePort: 30209/d' test/ric_robot_suite/helm/ric-robot/values.yaml\r
+sed -ri 's/^(\s*)(type\s*:\s*NodePort\s*$)/\1type: ClusterIP/' test/ric_robot_suite/helm/ric-robot/values.yaml\r
+sed -i 's/  tag: latest/  tag: 0.1.0-SNAPSHOT-20190318152929/' test/ric_robot_suite/helm/ric-robot/values.yaml\r
+cd dep/generated/ricplt\r
+\r
+#-----------Doing the Docker pull--------------------------\r
+#echo "docker" | docker login -u docker --password-stdin snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001\r
+#docker pull snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/test/ric-robot:latest\r
+docker pull rancodev/ric-robot:0.1.0-SNAPSHOT-20190318152929\r
+#docker logout snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001\r
+\r
+\r
+#-----------Retagging---------------------------------------\r
+docker tag  rancodev/ric-robot:0.1.0-SNAPSHOT-20190318152929 registry.kube-system.svc.rec.io:5555/test/ric-robot:0.1.0-SNAPSHOT-20190318152929\r
+docker push  registry.kube-system.svc.rec.io:5555/test/ric-robot:0.1.0-SNAPSHOT-20190318152929\r
+\r
+\r
+#----------- robot_install----------------------------------\r
+#  Note:\r
+#  This file needs to be in the it/dep/generated/ricplt directory with ric_install.sh/ric_uninstall.sh\r
+#  so that it can use the same dist/packages as the ricplt install\r
+#\r
+#  ricplt is in:     it/dep/geneated/ricplt\r
+#  ric-robot is in:  it/test/ric_robot_suite\r
+#\r
+if [ ! -e ric-robot ]; then\r
+    ln  -s ../../../test/ric_robot_suite/helm/ric-robot  ric-robot\r
+fi\r
+\r
+\r
+helm repo add localric http://127.0.0.1:8879/charts\r
+helm package -d dist/packages ric-robot\r
+pkill helm\r
+helm serve --repo-path dist/packages &\r
+sleep 2\r
+helm repo update\r
+\r
+# if you need to override the repo change the image.repository line for deployment\r
+# helm install local/ric-robot --namespace ricplatform --name ric-robot --set image.repository=snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001/test/ric-robot\r
+#\r
+helm install localric/ric-robot --namespace ricplatform --name ric-robot\r
+helm repo update\r
+#cd ../../../\r
+ric_robot_pod=$(kubectl get pods -l app.kubernetes.io/instance=ric-robot -n ricplatform -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')\r
+kubectl exec -n ricplatform -it $ric_robot_pod -- sed -i '17,19 s/^/#/' /var/opt/RIC/robot/testsuites/health-check.robot\r
+\r
+#---------show the test cases------------------------------\r
+cd /home/cloudadmin/RIC/test/ric_robot_suite/helm/ric-robot/\r
+bash ete-k8s.sh ricplatform health\r
+#----------checking the status of the pods------------------\r
+command="$(kubectl get po --no-headers --namespace=ricplatform --field-selector status.phase!=Running 2> /dev/null)"\r
+if [[ $command != "" ]]; then\r
+  exit 1\r
+fi\r