Option to run cord-tester setup in foreground.
Delete relay configuration instead of restarting onos after tests.
Make sure prerequisites can be run on other ubuntu distros

Change-Id: Ic04a5dab41b013088cda651afe32abae8030c8d8
diff --git a/src/test/setup/cord-test.py b/src/test/setup/cord-test.py
index 4efe7e4..1db4c2f 100755
--- a/src/test/setup/cord-test.py
+++ b/src/test/setup/cord-test.py
@@ -714,8 +714,8 @@
 
     #Finally start the test server and daemonize
     try:
-        cord_test_server_start(daemonize = True, cord_test_host = ip, cord_test_port = port,
-                               onos_cord = onos_cord)
+        cord_test_server_start(daemonize = not args.foreground, cord_test_host = ip, cord_test_port = port,
+                               onos_cord = onos_cord, foreground = args.foreground)
     except socket.error, e:
         #the test agent address could be remote or already running. Exit gracefully
         sys.exit(0)
@@ -961,7 +961,8 @@
     parser_setup.add_argument('-i', '--identity-file', default=identity_file_default,
                               type=str, help='ssh identity file to access compute nodes from test container')
     parser_setup.add_argument('-n', '--onos-instances', default=1, type=int,
-                            help='Specify number of test onos instances to spawn')
+                              help='Specify number of test onos instances to spawn')
+    parser_setup.add_argument('-f', '--foreground', action='store_true', help='Run in foreground')
     parser_setup.set_defaults(func=setupCordTester)
 
     parser_xos = subparser.add_parser('xos', help='Building xos into cord tester environment')
diff --git a/src/test/setup/prerequisites.sh b/src/test/setup/prerequisites.sh
index efa374c..1bfb6dd 100755
--- a/src/test/setup/prerequisites.sh
+++ b/src/test/setup/prerequisites.sh
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 apt-get update
 on_cord=0
+release=$(lsb_release -cs)
 if [ "$1" = "--cord" ]; then
     echo "Skipping installation of Docker and ONOS"
     on_cord=1
@@ -9,7 +10,7 @@
     apt-get -y install apt-transport-https ca-certificates
     apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
     if [ ! -f /etc/apt/sources.list.d/docker.list ]; then
-        echo deb https://apt.dockerproject.org/repo ubuntu-trusty main |  tee /etc/apt/sources.list.d/docker.list
+        echo deb https://apt.dockerproject.org/repo ubuntu-$release main |  tee /etc/apt/sources.list.d/docker.list
     fi
     apt-get update
     apt-get purge lxc-docker || true