[DevOps] - Added local run to docker_run

script and fixed webseal-simulator pom.xml

Change-Id: I8715bf5d7713a0f1b9192c6b8fd7303f01747546
Issue-Id: SDC-152
Signed-off-by: Idan Amit <ia096e@intl.att.com>
diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh
index 23c443e..2ef4f6a 100755
--- a/sdc-os-chef/scripts/docker_run.sh
+++ b/sdc-os-chef/scripts/docker_run.sh
@@ -2,13 +2,13 @@
 
 
 function usage {
-    echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ]  [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -h|--help ]"
+    echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ]  [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -h|--help ]"
 }
 
 
 function cleanup {
 	echo "performing old dockers cleanup"
-	docker_ids=`docker ps -a | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit" | awk '{print $1}'`
+	docker_ids=`docker ps -a | egrep -v "openecomp/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit" | awk '{print $1}'`
 	for X in ${docker_ids}
 	do
 	   docker rm -f ${X}
@@ -24,6 +24,7 @@
 
 
 RELEASE=latest
+LOCAL=false
 [ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__
 [ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)    || NEXUS_USERNAME=release
 [ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)      || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
@@ -43,6 +44,10 @@
             shift
             PORT=${1}
 			;;
+		-l | --local )
+		shift
+		LOCAL=true
+		;;
         -h | --help )
 			usage
             exit
@@ -61,6 +66,11 @@
 
 
 export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
+export PREFIX=${NEXUS_DOCKER_REPO}'/openecomp'
+
+if [ ${LOCAL} = true ]; then
+	PREFIX='openecomp'
+fi
 
 echo ""
 
@@ -74,6 +84,20 @@
 echo "docker run sdc-cassandra..."
 docker pull ${NEXUS_DOCKER_REPO}/openecomp/sdc-cassandra:${RELEASE}
 docker run --detach --name sdc-cs --env RELEASE="${RELEASE}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/CS:/var/lib/cassandra --volume /data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${NEXUS_DOCKER_REPO}/openecomp/sdc-cassandra:${RELEASE}
+echo "docker run sdc-elasticsearch..."
+if [ ${LOCAL} = false ]; then
+	echo "pulling code"
+	docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE}
+fi
+docker run --detach --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 1g --memory-swap=1g --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro -e ES_HEAP_SIZE=1024M --volume /data/ES:/usr/share/elasticsearch/data --volume /data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE}
+
+
+# cassandra
+echo "docker run sdc-cassandra..."
+if [ ${LOCAL} = false ]; then
+	docker pull ${PREFIX}/sdc-cassandra:${RELEASE}
+fi
+docker run --detach --name sdc-cs --env RELEASE="${RELEASE}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/CS:/var/lib/cassandra --volume /data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 openecomp/sdc-cassandra:${RELEASE}
 
 
 echo "please wait while CS is starting..."
@@ -87,18 +111,21 @@
 done
 echo -e ""
 
-
 # kibana
 echo "docker run sdc-kibana..."
-docker pull ${NEXUS_DOCKER_REPO}/openecomp/sdc-kibana:${RELEASE}
-docker run --detach --name sdc-kbn --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --memory-swap=2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/environments:/root/chef-solo/environments --publish 5601:5601 ${NEXUS_DOCKER_REPO}/openecomp/sdc-kibana:${RELEASE}
+if [ ${LOCAL} = false ]; then
+	docker pull ${PREFIX}/sdc-kibana:${RELEASE}
+fi
+docker run --detach --name sdc-kbn --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --memory-swap=2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/environments:/root/chef-solo/environments --publish 5601:5601 ${PREFIX}/sdc-kibana:${RELEASE}
 
 dir_perms
 
 # Back-End
 echo "docker run sdc-backend..."
-docker pull ${NEXUS_DOCKER_REPO}/openecomp/sdc-backend:${RELEASE}
-docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 4g --memory-swap=4g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/BE/:/var/lib/jetty/logs  --volume /data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${NEXUS_DOCKER_REPO}/openecomp/sdc-backend:${RELEASE}
+if [ ${LOCAL} = false ]; then
+	docker pull ${PREFIX}/sdc-backend:${RELEASE}
+fi
+docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 4g --memory-swap=4g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/BE/:/var/lib/jetty/logs  --volume /data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${PREFIX}/sdc-backend:${RELEASE}
 
 echo "please wait while BE is starting..."
 echo ""
@@ -114,8 +141,10 @@
 
 # Front-End
 echo "docker run sdc-frontend..."
-docker pull ${NEXUS_DOCKER_REPO}/openecomp/sdc-frontend:${RELEASE}
-docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --memory-swap=2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro  --volume /data/logs/FE/:/var/lib/jetty/logs --volume /data/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ${NEXUS_DOCKER_REPO}/openecomp/sdc-frontend:${RELEASE}
+if [ ${LOCAL} = false ]; then
+	docker pull ${PREFIX}/sdc-frontend:${RELEASE}
+fi
+docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 2g --memory-swap=2g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro  --volume /data/logs/FE/:/var/lib/jetty/logs --volume /data/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ${PREFIX}/sdc-frontend:${RELEASE}
 
 
 
diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml
index 7bee699..ea620f6 100644
--- a/utils/webseal-simulator/pom.xml
+++ b/utils/webseal-simulator/pom.xml
@@ -13,6 +13,7 @@
 		<docker.latest.tag>${project.version}-latest</docker.latest.tag>
 		<!--maven-->
 		<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
+		<nexus.proxy>https://nexus.onap.org</nexus.proxy>
 	</properties>
 
 	<dependencies>
@@ -51,7 +52,7 @@
 		<dependency>
 			<groupId>commons-codec</groupId>
 			<artifactId>commons-codec</artifactId>
-			<version>2.0-SNAPSHOT</version>
+			<version>1.9</version>
 			<scope>compile</scope>
 		</dependency>
 
@@ -112,6 +113,31 @@
 		</plugins>
 	</build>
 	
+	<repositories>
+		<!-- LF repositories -->
+		<repository>
+			<id>ecomp-releases</id>
+			<name>Release Repository</name>
+			<url>${nexus.proxy}/content/repositories/releases/</url>
+		</repository>
+		<repository>
+			<id>ecomp-staging</id>
+			<name>Staging Repository</name>
+			<url>${nexus.proxy}/content/repositories/staging/</url>
+		</repository>
+		<repository>
+			<id>ecomp-snapshots</id>
+			<name>Snapshots Repository</name>
+			<url>${nexus.proxy}/content/repositories/snapshots/</url>
+		</repository>
+		<repository>
+			<id>ecomp-public</id>
+			<name>Public Repository</name>
+			<url>${nexus.proxy}/content/repositories/public/</url>
+		</repository>
+		<!-- LF repositories END-->
+	</repositories>
+	
 	<profiles>
 		<profile>
 			<id>docker-staging</id>