[AETHER-1265] Integrate Java profiler in TOST env

- Adds a dockerfile to build ONOS image with profiler agent enabled
- Prevents the overriding of the JAVA_OPTS when using the profiler
- Deploy profiler also in the atomix nodes when using stc

Change-Id: I00d5091428083f44360989c701350b7fead66038
diff --git a/tools/test/bin/atomix-install b/tools/test/bin/atomix-install
index b059e12..92ec60f 100755
--- a/tools/test/bin/atomix-install
+++ b/tools/test/bin/atomix-install
@@ -48,6 +48,15 @@
 
     sudo mkdir -p $ATOMIX_INSTALL_DIR && sudo chown ${ONOS_USER}:${ONOS_GROUP} $ATOMIX_INSTALL_DIR
     tar -xvf /tmp/atomix.tar.gz -C $ATOMIX_INSTALL_DIR
+
+    if [ ! -z "$ONOS_YOURKIT" ]; then
+        sudo apt-get install unzip
+        cd /tmp
+        wget -N https://www.yourkit.com/download/YourKit-JavaProfiler-${ONOS_YOURKIT}.zip
+        unzip -o YourKit-JavaProfiler-${ONOS_YOURKIT}.zip
+        rm YourKit-JavaProfiler-${ONOS_YOURKIT}.zip
+        mv /tmp/YourKit-JavaProfiler-$(echo $ONOS_YOURKIT | sed 's/\(.*\)-.*/\1/')/bin/linux-x86-64/libyjpagent.so $ATOMIX_INSTALL_DIR/libyjpagent.so
+    fi
 "
 
 # Configure the ONOS installation