archiving pod logs and displaying kafka events

Change-Id: Ibf6cb8e464ea5495f399e1fd83625ccbe6e434ed
diff --git a/Jenkinsfile-attworkflow-test b/Jenkinsfile-attworkflow-test
index 9ef073a..2fdcc6e 100644
--- a/Jenkinsfile-attworkflow-test
+++ b/Jenkinsfile-attworkflow-test
@@ -52,13 +52,33 @@
                     """
                 }
             }
+            stage ('Display Kafka Events') {
+                timeout(5) {
+                    sh """
+                    CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    """
+                }
+            }
             stage('Publish test results') {
                 sh returnStdout: true, script: """
                 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
                 mkdir RobotLogs/TestDoc || true
                 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true
+                for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+                do
+                  kubectl logs \$pod > $WORKSPACE/\$pod.log;
+                done
+                for pod in \$(kubectl get pods -n voltha --no-headers | awk '{print \$1}');
+                do
+                  kubectl logs \$pod > $WORKSPACE/\$pod.log;
+                done
                 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
+                sudo chown cord:cord $WORKSPACE/*log
                 """
+                archiveArtifacts artifacts: '*log'
                 step([$class: 'RobotPublisher',
                     disableArchiveOutput: false,
                     logFileName: 'RobotLogs/log*.html',
diff --git a/Jenkinsfile-rcordlite-topdown-test b/Jenkinsfile-rcordlite-topdown-test
index c6623b2..04322b5 100644
--- a/Jenkinsfile-rcordlite-topdown-test
+++ b/Jenkinsfile-rcordlite-topdown-test
@@ -51,13 +51,34 @@
                     """
                 }
             }
+            stage ('Display Kafka Events') {
+                timeout(5) {
+                    sh """
+                    CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    """
+                }
+            }
             stage('Publish test results') {
                 sh returnStdout: true, script: """
                 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
                 mkdir RobotLogs/TestDoc || true
                 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true
                 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
+                for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+                do
+                  kubectl logs \$pod > $WORKSPACE/\$pod.log;
+                done
+                for pod in \$(kubectl get pods -n voltha --no-headers | awk '{print \$1}');
+                do
+                  kubectl logs \$pod > $WORKSPACE/\$pod.log;
+                done
+                cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
+                sudo chown cord:cord $WORKSPACE/*log
                 """
+                archiveArtifacts artifacts: '*log'
                 step([$class: 'RobotPublisher',
                     disableArchiveOutput: false,
                     logFileName: 'RobotLogs/log*.html',
diff --git a/Jenkinsfile-rcordlite-zerotouch-test b/Jenkinsfile-rcordlite-zerotouch-test
index aa5063a..5e9b639 100644
--- a/Jenkinsfile-rcordlite-zerotouch-test
+++ b/Jenkinsfile-rcordlite-zerotouch-test
@@ -51,13 +51,34 @@
                     """
                 }
             }
+            stage ('Display Kafka Events') {
+                timeout(5) {
+                    sh """
+                    CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
+                    """
+                }
+            }
             stage('Publish test results') {
                 sh returnStdout: true, script: """
                 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
                 mkdir RobotLogs/TestDoc || true
                 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true
                 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
+                for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+                do
+                  kubectl logs \$pod > $WORKSPACE/\$pod.log;
+                done
+                for pod in \$(kubectl get pods -n voltha --no-headers | awk '{print \$1}');
+                do
+                  kubectl logs \$pod > $WORKSPACE/\$pod.log;
+                done
+                cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
+                sudo chown cord:cord $WORKSPACE/*log
                 """
+                archiveArtifacts artifacts: '*log'
                 step([$class: 'RobotPublisher',
                     disableArchiveOutput: false,
                     logFileName: 'RobotLogs/log*.html',