Merge "CORD-3071 updating mcord-deployment pipeline script"
diff --git a/jjb/pipeline/mcord-deployment.groovy b/jjb/pipeline/mcord-deployment.groovy
index d1922b6..163b2df 100644
--- a/jjb/pipeline/mcord-deployment.groovy
+++ b/jjb/pipeline/mcord-deployment.groovy
@@ -28,6 +28,27 @@
             '''
             }
         }
+    stage ('Configure K8 Compute Node DNS') {
+      steps {
+        sh '''
+            pushd $WORKSPACE
+            HOSTNAME=\$(cat /etc/hostname)
+            IPADDRESS=\$(ip route get 8.8.8.8 | head -1 | cut -d' ' -f8)
+            cat <<EOF > /tmp/\$HOSTNAME-dns.yaml
+            kind: Service
+            apiVersion: v1
+            metadata:
+              name: \$HOSTNAME
+              namespace: default
+            spec:
+              type: ExternalName
+              externalName: \$IPADDRESS
+EOF
+            popd
+            kubectl create -f /tmp/\$HOSTNAME-dns.yaml
+            '''
+            }
+        }
 
     stage ('Test MCORD') {
       steps {
@@ -35,7 +56,7 @@
             pushd $WORKSPACE
             git clone https://gerrit.opencord.org/mcord
             cd mcord/test
-            ansible-playbook -i localhost, mcord-cavium-test-playbook.yml
+            ansible-playbook -i localhost, -c local mcord-cavium-test-playbook.yml
             popd
             '''
             }
@@ -52,11 +73,34 @@
                     helm delete --purge xos-core
                     helm delete --purge mcord
                     helm delete --purge base-openstack
-                    helm reset --force
+                    helm delete --purge onos-cord
+
+                    for NS in openstack ceph nfs libvirt; do
+                       helm ls --namespace $NS --short | xargs -r -L1 -P2 helm delete --purge
+                    done
+
+                    # delete any helm chart left
+                    helm ls --short | xargs -r -L1 -P2 helm delete --purge || true
+
+                    #delete all kubectl pods
+                    kubectl delete pods --all
+
+                    sudo docker ps -aq | xargs -r -L1 -P16 sudo docker rm -f
+
+                    sudo rm -rf /var/lib/openstack-helm/*
+
+                    # NOTE(portdirect): These directories are used by nova and libvirt
+                    sudo rm -rf /var/lib/nova/*
+                    sudo rm -rf /var/lib/libvirt/*
+                    sudo rm -rf /etc/libvirt/qemu/*
+
+                    #remove all docker images
+                    sudo docker rmi $(sudo docker images -q) || true
+
                 fi
-                if [ -x "/usr/bin/kubelet" ]; then
-                    sudo rm /usr/bin/kubelet
-                fi
+                kubectl get pods || true
+                helm ls || true
+                sudo rm -rf $WORKSPACE/*
                 popd
                 '''
             step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])