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

---
 proto/copy_to_dad.sh                          | 12 ---------
 ...unch_l3_attack_detection_and_mitigation.sh |  9 -------
 ...ttack_detection_and_mitigation_complete.sh | 11 --------
 ...am.sh => show_logs_l3-attack-mitigator.sh} |  2 +-
 ...ow_logs_l3-centralized-attack-detector.sh} |  2 +-
 {scripts => src/tests}/scenario3/l3/README.md |  0
 src/tests/scenario3/l3/copy_protos_to_dad.sh  | 25 ++++++++++++++++++
 ...unch_l3_attack_detection_and_mitigation.sh | 24 +++++++++++++++++
 ...ttack_detection_and_mitigation_complete.sh | 26 +++++++++++++++++++
 9 files changed, 77 insertions(+), 34 deletions(-)
 delete mode 100755 proto/copy_to_dad.sh
 delete mode 100644 scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh
 delete mode 100644 scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh
 rename scripts/{show_logs_am.sh => show_logs_l3-attack-mitigator.sh} (94%)
 rename scripts/{show_logs_cad.sh => show_logs_l3-centralized-attack-detector.sh} (94%)
 rename {scripts => src/tests}/scenario3/l3/README.md (100%)
 create mode 100755 src/tests/scenario3/l3/copy_protos_to_dad.sh
 create mode 100644 src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh
 create mode 100644 src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh

diff --git a/proto/copy_to_dad.sh b/proto/copy_to_dad.sh
deleted file mode 100755
index a866488bc..000000000
--- a/proto/copy_to_dad.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-# Set the variables for the remote host and destination directory
-REMOTE_HOST="192.168.165.73"
-DEST_DIR="/home/ubuntu/TeraflowDockerDistributed/l3_distributedattackdetector/proto"
-
-# Copy the files to the remote host
-sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_centralizedattackdetector_pb2.py "$REMOTE_HOST:$DEST_DIR"
-sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_centralizedattackdetector_pb2_grpc.py "$REMOTE_HOST:$DEST_DIR"
-
-sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_attackmitigator_pb2.py "$REMOTE_HOST:$DEST_DIR"
-sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_attackmitigator_pb2_grpc.py "$REMOTE_HOST:$DEST_DIR"
\ No newline at end of file
diff --git a/scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh b/scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh
deleted file mode 100644
index 8243f042a..000000000
--- a/scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-cd /home/ubuntu/tfs-ctrl
-source my_deploy.sh
-./deploy.sh
-./show_deploy.sh
-
-source tfs_runtime_env_vars.sh
-
-ofc22/run_test_01_bootstrap.sh
-ofc22/run_test_02_create_service.sh
diff --git a/scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh b/scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh
deleted file mode 100644
index 8f9d24590..000000000
--- a/scripts/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-cd /home/ubuntu/tfs-ctrl
-source my_deploy.sh
-./deploy.sh
-./show_deploy.sh
-
-source tfs_runtime_env_vars.sh
-
-ofc22/run_test_01_bootstrap.sh
-ofc22/run_test_02_create_service.sh
-
-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 &'"
diff --git a/scripts/show_logs_am.sh b/scripts/show_logs_l3-attack-mitigator.sh
similarity index 94%
rename from scripts/show_logs_am.sh
rename to scripts/show_logs_l3-attack-mitigator.sh
index 1cbd1994d..fc54a2a36 100755
--- a/scripts/show_logs_am.sh
+++ b/scripts/show_logs_l3-attack-mitigator.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
+# 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.
diff --git a/scripts/show_logs_cad.sh b/scripts/show_logs_l3-centralized-attack-detector.sh
similarity index 94%
rename from scripts/show_logs_cad.sh
rename to scripts/show_logs_l3-centralized-attack-detector.sh
index acfdad79e..002755f3a 100755
--- a/scripts/show_logs_cad.sh
+++ b/scripts/show_logs_l3-centralized-attack-detector.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
+# 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.
diff --git a/scripts/scenario3/l3/README.md b/src/tests/scenario3/l3/README.md
similarity index 100%
rename from scripts/scenario3/l3/README.md
rename to src/tests/scenario3/l3/README.md
diff --git a/src/tests/scenario3/l3/copy_protos_to_dad.sh b/src/tests/scenario3/l3/copy_protos_to_dad.sh
new file mode 100755
index 000000000..6735d9cf9
--- /dev/null
+++ b/src/tests/scenario3/l3/copy_protos_to_dad.sh
@@ -0,0 +1,25 @@
+#!/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.
+
+# Set the variables for the remote host and destination directory
+REMOTE_HOST="192.168.165.73"
+DEST_DIR="/home/ubuntu/TeraflowDockerDistributed/l3_distributedattackdetector/proto"
+
+# Copy the files to the remote host
+sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_centralizedattackdetector_pb2.py "$REMOTE_HOST:$DEST_DIR"
+sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_centralizedattackdetector_pb2_grpc.py "$REMOTE_HOST:$DEST_DIR"
+
+sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_attackmitigator_pb2.py "$REMOTE_HOST:$DEST_DIR"
+sshpass -p "ubuntu" scp /home/ubuntu/tfs-ctrl-new/proto/src/python/l3_attackmitigator_pb2_grpc.py "$REMOTE_HOST:$DEST_DIR"
diff --git a/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh b/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh
new file mode 100644
index 000000000..a22d98bad
--- /dev/null
+++ b/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation.sh
@@ -0,0 +1,24 @@
+#!/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.
+
+cd /home/ubuntu/tfs-ctrl
+source my_deploy.sh
+./deploy.sh
+./show_deploy.sh
+
+source tfs_runtime_env_vars.sh
+
+ofc22/run_test_01_bootstrap.sh
+ofc22/run_test_02_create_service.sh
diff --git a/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh b/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh
new file mode 100644
index 000000000..05b20077e
--- /dev/null
+++ b/src/tests/scenario3/l3/launch_l3_attack_detection_and_mitigation_complete.sh
@@ -0,0 +1,26 @@
+#!/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.
+
+cd /home/ubuntu/tfs-ctrl
+source my_deploy.sh
+./deploy.sh
+./show_deploy.sh
+
+source tfs_runtime_env_vars.sh
+
+ofc22/run_test_01_bootstrap.sh
+ofc22/run_test_02_create_service.sh
+
+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 &'"
-- 
GitLab