Renaming AAF services

This change fixes the names used by docker-compose for AAF services.

Change-Id: Ib99c4fcfd5721c3636b6dd25f82ac8853d80a8e3
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: INT-480
diff --git a/test/csit/plans/aaf/aafapi/setup.sh b/test/csit/plans/aaf/aafapi/setup.sh
index 4a31270..add9ae1 100644
--- a/test/csit/plans/aaf/aafapi/setup.sh
+++ b/test/csit/plans/aaf/aafapi/setup.sh
@@ -37,12 +37,15 @@
 
 # start aaf containers with docker compose and configuration from docker-compose.yml
 docker-compose up -d
+export aaf_service=$(get_docker_compose_service aaf_container)
+export cassandra_service=$(get_docker_compose_service cassandra_container)
 
-# Wait for initialization of Docker contaienr for AAF & Cassandra
+# Wait for initialization of Docker container for AAF & Cassandra
 for i in {1..12}; do
-	if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_aaf_container_1) ] && \
-		[ $(docker inspect --format '{{ .State.Running }}' dockercompose_cassandra_container_1) ] && \
-		[ $(docker inspect --format '{{ .State.Running }}' dockercompose_aaf_container_1) ]
+
+	if [ $(docker inspect --format '{{ .State.Running }}' $aaf_service) ] && \
+		[ $(docker inspect --format '{{ .State.Running }}' $cassandra_service) ] && \
+		[ $(docker inspect --format '{{ .State.Running }}' $aaf_service) ]
 	then
 		echo "AAF Service Running"
 		break
@@ -53,9 +56,11 @@
 done
 
 
-AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_aaf_container_1)
-CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_cassandra_container_1)
+AAF_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $aaf_service)
+CASSANDRA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $cassandra_service)
 
+bypass_ip_adress $AAF_IP
+bypass_ip_adress $CASSANDRA_IP
 
 echo AAF_IP=${AAF_IP}
 echo CASSANDRA_IP=${CASSANDRA_IP}
diff --git a/test/csit/plans/aaf/aafapi/teardown.sh b/test/csit/plans/aaf/aafapi/teardown.sh
index 1f7b285..41e0b00 100644
--- a/test/csit/plans/aaf/aafapi/teardown.sh
+++ b/test/csit/plans/aaf/aafapi/teardown.sh
@@ -17,6 +17,8 @@
 # Modifications copyright (c) 2017 AT&T Intellectual Property
 #
 
-kill-instance.sh dockercompose_aaf_container_1 
-kill-instance.sh dockercompose_cassandra_container_1 
+kill-instance.sh $aaf_service
+kill-instance.sh $cassandra_service
 
+unset aaf_service
+unset cassandra_service
diff --git a/test/csit/scripts/common_functions.sh b/test/csit/scripts/common_functions.sh
index 69856da..4293a52 100755
--- a/test/csit/scripts/common_functions.sh
+++ b/test/csit/scripts/common_functions.sh
@@ -233,3 +233,20 @@
     ROBOT_VARIABLES=${ROBOT_VARIABLES}" -v SIMULATOR_IP:${SIMULATOR_IP}  -v SCRIPTS:${SCRIPTS}"
     echo ${ROBOT_VARIABLES}
 }
+
+function get_docker_compose_service ()
+{
+    local service=$1
+    local compose_file=${2:-docker-compose.yml}
+
+    echo $(docker-compose --file ./${compose_file} ps | grep $service |  cut -d " " -f1 )
+}
+
+function bypass_ip_adress ()
+{
+    local ip_address=$1
+
+    if [[ $no_proxy && $no_proxy != *$ip_address* ]]; then
+        export no_proxy=$no_proxy,$ip_address
+    fi
+}