From ab534a6d2ffefdeccdd4db2460970bf79bb49f09 Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Thu, 11 May 2023 15:25:24 +0000
Subject: [PATCH] Pre-merge code cleanup

---
 complete_deploy.sh                            |  8 -------
 get_ml_model_info.sh                          |  2 --
 launch_webui.sh                               |  1 -
 src/tests/scenario3/l3/complete_deploy.sh     | 23 +++++++++++++++++++
 .../tests/scenario3/l3/deploy_l3_component.sh | 17 +++++++++++++-
 src/tests/scenario3/l3/get_ml_model_info.sh   | 22 ++++++++++++++++++
 src/tests/scenario3/l3/launch_webui.sh        | 16 +++++++++++++
 7 files changed, 77 insertions(+), 12 deletions(-)
 delete mode 100755 complete_deploy.sh
 delete mode 100755 get_ml_model_info.sh
 delete mode 100755 launch_webui.sh
 create mode 100755 src/tests/scenario3/l3/complete_deploy.sh
 rename deploy_l3_component.sh => src/tests/scenario3/l3/deploy_l3_component.sh (71%)
 create mode 100755 src/tests/scenario3/l3/get_ml_model_info.sh
 create mode 100755 src/tests/scenario3/l3/launch_webui.sh

diff --git a/complete_deploy.sh b/complete_deploy.sh
deleted file mode 100755
index 552038165..000000000
--- a/complete_deploy.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-./src/tests/ofc22/run_test_03_delete_service.sh
-./src/tests/ofc22/run_test_04_cleanup.sh
-source src/tests/ofc22/deploy_specs.sh
-source my_deploy.sh
-./deploy/all.sh
-source tfs_runtime_env_vars.sh
-ofc22/run_test_01_bootstrap.sh
-ofc22/run_test_02_create_service.sh
\ No newline at end of file
diff --git a/get_ml_model_info.sh b/get_ml_model_info.sh
deleted file mode 100755
index 9292f26bc..000000000
--- a/get_ml_model_info.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-pod=$(kubectl get pods -n "tfs" -l app=l3-centralizedattackdetectorservice | sed -n '2p' | cut -d " " -f1)
-while true; do kubectl -n "tfs" cp $pod:prediction_accuracy.txt ./prediction_accuracy.txt; clear; cat prediction_accuracy.txt | tail -n 10; sleep 1; done
\ No newline at end of file
diff --git a/launch_webui.sh b/launch_webui.sh
deleted file mode 100755
index 81f4611ae..000000000
--- a/launch_webui.sh
+++ /dev/null
@@ -1 +0,0 @@
-ssh -L 12345:localhost:80 ubuntu@192.168.165.78
diff --git a/src/tests/scenario3/l3/complete_deploy.sh b/src/tests/scenario3/l3/complete_deploy.sh
new file mode 100755
index 000000000..5e8a2772c
--- /dev/null
+++ b/src/tests/scenario3/l3/complete_deploy.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+./src/tests/ofc22/run_test_03_delete_service.sh
+./src/tests/ofc22/run_test_04_cleanup.sh
+source src/tests/ofc22/deploy_specs.sh
+source my_deploy.sh
+./deploy/all.sh
+source tfs_runtime_env_vars.sh
+ofc22/run_test_01_bootstrap.sh
+ofc22/run_test_02_create_service.sh
diff --git a/deploy_l3_component.sh b/src/tests/scenario3/l3/deploy_l3_component.sh
similarity index 71%
rename from deploy_l3_component.sh
rename to src/tests/scenario3/l3/deploy_l3_component.sh
index a590bacbc..8e468c906 100755
--- a/deploy_l3_component.sh
+++ b/src/tests/scenario3/l3/deploy_l3_component.sh
@@ -1,3 +1,18 @@
+#!/bin/bash
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 component=$1
 
 source "my_deploy.sh"
@@ -42,4 +57,4 @@ echo "Component $component deployed"
 
 echo "Restarting DAD..."
 sshpass -p "ubuntu" ssh -o StrictHostKeyChecking=no -n -f ubuntu@192.168.165.73 "sh -c 'nohup /home/ubuntu/TeraflowDockerDistributed/restart.sh > /dev/null 2>&1 &'"
-echo "DAD restarted"
\ No newline at end of file
+echo "DAD restarted"
diff --git a/src/tests/scenario3/l3/get_ml_model_info.sh b/src/tests/scenario3/l3/get_ml_model_info.sh
new file mode 100755
index 000000000..19fb1177a
--- /dev/null
+++ b/src/tests/scenario3/l3/get_ml_model_info.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+pod=$(kubectl get pods -n "tfs" -l app=l3-centralizedattackdetectorservice | sed -n '2p' | cut -d " " -f1)
+while true; do
+    kubectl -n "tfs" cp $pod:prediction_accuracy.txt ./prediction_accuracy.txt
+    clear
+    cat prediction_accuracy.txt | tail -n 10
+    sleep 1
+done
diff --git a/src/tests/scenario3/l3/launch_webui.sh b/src/tests/scenario3/l3/launch_webui.sh
new file mode 100755
index 000000000..bf1867eb1
--- /dev/null
+++ b/src/tests/scenario3/l3/launch_webui.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+ssh -L 12345:localhost:80 ubuntu@192.168.165.78
-- 
GitLab