[SDC-154] - sdc-simulator docker task

Change-Id: Ife75655d7ad0a6566a93ebabed217566f17ee246
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_locate_keystore.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb
similarity index 100%
rename from sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_locate_keystore.rb
rename to sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb
diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_create_jetty_modules.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb
similarity index 100%
rename from sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_create_jetty_modules.rb
rename to sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb
diff --git a/sdc-os-chef/sdc-frontend/chef-solo/roles/catalog-fe.json b/sdc-os-chef/sdc-frontend/chef-solo/roles/catalog-fe.json
index 547c006..fdc99d0 100644
--- a/sdc-os-chef/sdc-frontend/chef-solo/roles/catalog-fe.json
+++ b/sdc-os-chef/sdc-frontend/chef-solo/roles/catalog-fe.json
@@ -15,8 +15,8 @@
     "recipe[sdc-catalog-fe::FE_3_errors_config]",
     "recipe[sdc-catalog-fe::FE_4_logback]",
     "recipe[sdc-catalog-fe::FE_5_rest_configuration]",
-    "recipe[sdc-catalog-fe::FE_7_locate_keystore]",
-    "recipe[sdc-catalog-fe::FE_6_create_jetty_modules]"
+    "recipe[sdc-catalog-fe::FE_6_locate_keystore]",
+    "recipe[sdc-catalog-fe::FE_7_create_jetty_modules]"
   ],
   "env_run_lists": {
   }
diff --git a/utils/webseal-simulator/sdc-simulator/Dockerfile b/utils/webseal-simulator/sdc-simulator/Dockerfile
index bd682be..95d452f 100644
--- a/utils/webseal-simulator/sdc-simulator/Dockerfile
+++ b/utils/webseal-simulator/sdc-simulator/Dockerfile
@@ -1,4 +1,4 @@
-FROM jetty:9.3.15-jre8
+FROM jetty:9.3-jre8
 
 ARG HTTP_PROXY
 ARG HTTPS_PROXY
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/webseal.conf b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/webseal.conf
index a7026e3..25952fd 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/webseal.conf
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/webseal.conf
@@ -1,6 +1,6 @@
 {
 	webseal {
-		fe="http://localhost:8181"
+		fe="http://10.0.2.15:8181"
 		users = [
 			{
 				userId="cs0008"
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb
index 05c787f..ca7d237 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb
@@ -6,13 +6,4 @@
    owner "jetty"
    group "jetty"
    mode "0755"
-end
-
-
-cookbook_file "logback.xml" do
-   path "#{jetty_base}/config/sdc-simulator/logback.xml"
-   source "logback.xml"
-   owner "jetty"
-   group "jetty"
-   mode "0755"
 end
\ No newline at end of file
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_logback.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_logback.rb
index ba3097c..0d9282b 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_logback.rb
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_logback.rb
@@ -1,7 +1,10 @@
-#cookbook_file "/var/lib/jetty/config/catalog-fe/logback.xml" do
-#  source "FE-logback.xml"
-#  mode 0755
-#  owner "jetty"
-#  group "jetty"
-#end
- 
+jetty_base="/var/lib/jetty"
+
+
+cookbook_file "logback.xml" do
+   path "#{jetty_base}/config/sdc-simulator/logback.xml"
+   source "logback.xml"
+   owner "jetty"
+   group "jetty"
+   mode "0755"
+end
\ No newline at end of file
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_6_create_jetty_modules.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_6_create_jetty_modules.rb
deleted file mode 100644
index 2800fd1..0000000
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_6_create_jetty_modules.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-jetty_base="/var/lib/jetty"
-jetty_home="/usr/local/jetty"
-
-###### create Jetty modules
-bash "create-jetty-modules" do
-cwd "#{jetty_base}"
-code <<-EOH
-   cd "#{jetty_base}"
-   java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy
-   java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid
-EOH
-not_if "ls /#{jetty_base}/start.d/https.ini"
-end
-
-
-###### configure Jetty modules
-template "FE-http-ini" do
-   path "/#{jetty_base}/start.d/http.ini"
-   source "FE-http-ini.erb"
-   owner "jetty"
-   group "jetty"
-   mode "0755"
-   variables :FE_http_port => "#{node['FE'][:http_port]}"
-end
-
-
-template "FE-https-ini" do
-   path "/#{jetty_base}/start.d/https.ini"
-   source "FE-https-ini.erb"
-   owner "jetty"
-   group "jetty"
-   mode "0755"
-   variables :FE_https_port => "#{node['FE'][:https_port]}"
-end
-
-
-template "FE-ssl-ini" do
-   path "/#{jetty_base}/start.d/ssl.ini"
-   source "FE-ssl-ini.erb"
-   owner "jetty"
-   group "jetty"
-   mode "0755"
-   variables :FE_https_port => "#{node['FE'][:https_port]}"
-end
-
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_7_locate_keystore.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_6_locate_keystore.rb
similarity index 100%
rename from utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_7_locate_keystore.rb
rename to utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_6_locate_keystore.rb
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_7_create_jetty_modules.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_7_create_jetty_modules.rb
new file mode 100644
index 0000000..b4de469
--- /dev/null
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_7_create_jetty_modules.rb
@@ -0,0 +1,45 @@
+jetty_base="/var/lib/jetty"
+jetty_home="/usr/local/jetty"
+
+###### create Jetty modules
+bash "create-jetty-modules" do
+cwd "#{jetty_base}"
+code <<-EOH
+   cd "#{jetty_base}"
+   java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy
+   java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid
+EOH
+not_if "ls /#{jetty_base}/start.d/https.ini"
+end
+
+
+####### configure Jetty modules
+#template "SDC-Simulator-http-ini" do
+#   path "/#{jetty_base}/start.d/http.ini"
+#   source "SDC-Simulator-http-ini.erb"
+#   owner "jetty"
+#   group "jetty"
+#   mode "0755"
+#   variables :Simulator_http_port => "#{node['simulator'][:http_port]}"
+#end
+
+
+#template "FE-https-ini" do
+#   path "/#{jetty_base}/start.d/https.ini"
+#   source "FE-https-ini.erb"
+#   owner "jetty"
+#   group "jetty"
+#   mode "0755"
+#   variables :FE_https_port => "#{node['FE'][:https_port]}"
+#end
+#
+#
+#template "FE-ssl-ini" do
+#   path "/#{jetty_base}/start.d/ssl.ini"
+#   source "FE-ssl-ini.erb"
+#   owner "jetty"
+#   group "jetty"
+#   mode "0755"
+#   variables :FE_https_port => "#{node['FE'][:https_port]}"
+#end
+
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-configuration.yaml.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-configuration.yaml.erb
similarity index 100%
rename from utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-configuration.yaml.erb
rename to utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-configuration.yaml.erb
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-http-ini.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-http-ini.erb
similarity index 94%
rename from utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-http-ini.erb
rename to utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-http-ini.erb
index 34a73fd..51b9add 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-http-ini.erb
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-http-ini.erb
@@ -8,7 +8,7 @@
 # jetty.http.host=0.0.0.0
 
 ## Connector port to listen on
-jetty.http.port=<%= @FE_http_port %>
+jetty.http.port=<%= @Simulator_http_port %>
 
 ## Connector idle timeout in milliseconds
 jetty.http.idleTimeout=30000
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-https-ini.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-https-ini.erb
similarity index 100%
rename from utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-https-ini.erb
rename to utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-https-ini.erb
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-onboarding-configuration.yaml.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-onboarding-configuration.yaml.erb
similarity index 100%
rename from utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-onboarding-configuration.yaml.erb
rename to utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-onboarding-configuration.yaml.erb
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-ssl-ini.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-ssl-ini.erb
similarity index 100%
rename from utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/FE-ssl-ini.erb
rename to utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-ssl-ini.erb
diff --git a/utils/webseal-simulator/sdc-simulator/chef-solo/roles/sdc-simulator.json b/utils/webseal-simulator/sdc-simulator/chef-solo/roles/sdc-simulator.json
index 8f84675..36a1637 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-solo/roles/sdc-simulator.json
+++ b/utils/webseal-simulator/sdc-simulator/chef-solo/roles/sdc-simulator.json
@@ -12,7 +12,9 @@
   "run_list": [
     "recipe[sdc-simulator::SDC_Simulator_1_cleanup_jettydir]",
     "recipe[sdc-simulator::SDC_Simulator_2_setup_configuration]",
-    "recipe[sdc-simulator::SDC_Simulator_7_locate_keystore]"
+    "recipe[sdc-simulator::SDC_Simulator_4_logback]",
+    "recipe[sdc-simulator::SDC_Simulator_6_locate_keystore]",
+    "recipe[sdc-simulator::SDC_Simulator_7_create_jetty_modules]"
   ],
   "env_run_lists": {
   }
diff --git a/utils/webseal-simulator/sdc-simulator/startup.sh b/utils/webseal-simulator/sdc-simulator/startup.sh
index 46a3173..d5abda9 100644
--- a/utils/webseal-simulator/sdc-simulator/startup.sh
+++ b/utils/webseal-simulator/sdc-simulator/startup.sh
@@ -6,7 +6,9 @@
 chef-solo -c solo.rb
 #chef-solo -c solo.rb -E ${CHEFNAME}
 
-sed -i '/^set -e/aJAVA_OPTIONS=\"-Xdebug -Xmx128m -Xms128m -Xss1m -Dconfig.home=${JETTY_BASE}/config -Dlog.home=${JETTY_BASE}/logs -Dlogback.configurationFile=${JETTY_BASE}/config/sdc-simulator/logback.xml -Djetty.logging.dir=${JETTY_BASE}/logs\"' /docker-entrypoint.sh 
+sed -i '/^set -e/aJAVA_OPTIONS=\"-Xdebug -Xmx128m -Xms128m -Xss1m -Dconfig.home=${JETTY_BASE}/config/sdc-simulator -Dlog.home=${JETTY_BASE}/logs -Dlogback.configurationFile=${JETTY_BASE}/config/sdc-simulator/logback.xml -Djetty.logging.dir=${JETTY_BASE}/logs -Djetty.base=${JETTY_BASE} \"' /docker-entrypoint.sh
+#Moty Default WS startup args
+#/usr/bin/java -Dconfig.home=/apps/jetty/base/ws/config -Dlog.home=/apps/jetty/base/ws/logs -Dlogback.configurationFile=/apps/jetty/base/ws/logback.xml -Djetty.logging.dir=/apps/jetty/base/ws/logs -Djetty.home=/apps/jetty/jetty-distribution-9.3.6.v20151106 -Djetty.base=/apps/jetty/base/ws -Djava.io.tmpdir=/tmp -jar /apps/jetty/jetty-distribution-9.3.6.v20151106/start.jar jetty.state=/apps/jetty/base/ws/webseal-simulator.state jetty-logging.xml jetty-started.xml 
 sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh
 
 cd /var/lib/jetty
diff --git a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
index db4853a..2798f68 100644
--- a/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
+++ b/utils/webseal-simulator/src/main/java/org/openecomp/sdc/webseal/simulator/Login.java
@@ -112,8 +112,8 @@
 		System.out.println("Login -> doPOst userId=" + userId);
 		User user = getUser(userId, password);
 		if (user == null) {
-			request.setAttribute("message", "ERROR: userId or password incorect");
-			doGet(request, response);
+			response.sendError(500, "ERROR: userId or password incorect");
+//			doGet(request, response);
 		} else {
 			System.out.println("Login -> doPOst redirext to /sdc1 (to proxy)");
 			Cookie cookieUser = new Cookie("HTTP_IV_USER", user.getUserId());