From fe89c48bb46dead2117d6cb5738a4b23ddc509b1 Mon Sep 17 00:00:00 2001
From: sgambelluri <andrea.sgambelluri@cnit.it>
Date: Mon, 25 Mar 2024 07:44:20 +0000
Subject: [PATCH] Bugs Fixed in Running Agents

---
 src/tests/ofc24/2.device1.json                |  2 +-
 src/tests/ofc24/3.device2.json                |  2 +-
 src/tests/ofc24/4.device3_R1.json             |  2 +-
 src/tests/ofc24/5.device4_R2.json             |  2 +-
 src/tests/ofc24/startExtraNetConfigAgent.sh   | 46 +++++++++-------
 src/tests/ofc24/start_topo.sh                 | 53 +++++++++++--------
 .../ofc24/{ => tempOC/files}/platform_r1.xml  |  0
 .../ofc24/{ => tempOC/files}/platform_r2.xml  |  0
 .../ofc24/{ => tempOC/files}/platform_t1.xml  |  0
 .../ofc24/{ => tempOC/files}/platform_t2.xml  |  0
 .../{ => tempOC/files}/startNetconfAgent.sh   |  0
 11 files changed, 62 insertions(+), 45 deletions(-)
 rename src/tests/ofc24/{ => tempOC/files}/platform_r1.xml (100%)
 mode change 100755 => 100644
 rename src/tests/ofc24/{ => tempOC/files}/platform_r2.xml (100%)
 mode change 100755 => 100644
 rename src/tests/ofc24/{ => tempOC/files}/platform_t1.xml (100%)
 mode change 100755 => 100644
 rename src/tests/ofc24/{ => tempOC/files}/platform_t2.xml (100%)
 mode change 100755 => 100644
 rename src/tests/ofc24/{ => tempOC/files}/startNetconfAgent.sh (100%)
 mode change 100755 => 100644

diff --git a/src/tests/ofc24/2.device1.json b/src/tests/ofc24/2.device1.json
index 3e31f31eb..c5a189e31 100755
--- a/src/tests/ofc24/2.device1.json
+++ b/src/tests/ofc24/2.device1.json
@@ -41,7 +41,7 @@
                         "action": 1,
                         "custom": {
                             "resource_key": "_connect/address",
-                            "resource_value": "10.0.2.15"
+                            "resource_value": "10.0.2.4"
                         }
                     },
                     {
diff --git a/src/tests/ofc24/3.device2.json b/src/tests/ofc24/3.device2.json
index 812affa7b..a38fc2905 100755
--- a/src/tests/ofc24/3.device2.json
+++ b/src/tests/ofc24/3.device2.json
@@ -41,7 +41,7 @@
                         "action": 1,
                         "custom": {
                             "resource_key": "_connect/address",
-                            "resource_value": "10.0.2.15"
+                            "resource_value": "10.0.2.4"
                         }
                     },
                     {
diff --git a/src/tests/ofc24/4.device3_R1.json b/src/tests/ofc24/4.device3_R1.json
index 3a57ba79c..1c110f20e 100755
--- a/src/tests/ofc24/4.device3_R1.json
+++ b/src/tests/ofc24/4.device3_R1.json
@@ -107,7 +107,7 @@
                         "action": 1,
                         "custom": {
                             "resource_key": "_connect/address",
-                            "resource_value": "10.0.2.15"
+                            "resource_value": "10.0.2.4"
                         }
                     },
                     {
diff --git a/src/tests/ofc24/5.device4_R2.json b/src/tests/ofc24/5.device4_R2.json
index 9b1968d09..43ebda5c6 100755
--- a/src/tests/ofc24/5.device4_R2.json
+++ b/src/tests/ofc24/5.device4_R2.json
@@ -108,7 +108,7 @@
                         "action": 1,
                         "custom": {
                             "resource_key": "_connect/address",
-                            "resource_value": "10.0.2.15"
+                            "resource_value": "10.0.2.4"
                         }
                     },
                     {
diff --git a/src/tests/ofc24/startExtraNetConfigAgent.sh b/src/tests/ofc24/startExtraNetConfigAgent.sh
index d9428585e..f8638a51f 100755
--- a/src/tests/ofc24/startExtraNetConfigAgent.sh
+++ b/src/tests/ofc24/startExtraNetConfigAgent.sh
@@ -13,22 +13,32 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-DOCKER_CONTAINER=$1
-DOCKER_PORT=$2
-
-if [ -n "$DOCKER_CONTAINER" ] && [ -n "$DOCKER_PORT" ];then
-      sudo docker stop "$DOCKER_CONTAINER" -t 1
-      sudo docker rm "$DOCKER_CONTAINER"
-
-      echo "Creating TPs"
-      screen -dmS t1 -T xterm sh -c "docker run -p 10.0.2.15:"$DOCKER_PORT":2022 -v ~/tfs-ctrl/tempOC/files:/files --name $DOCKER_CONTAINER -it asgamb1/oc23bgp.img:latest"
-      sleep  2 
-      if [ "$( docker container  inspect -f '{{.State.Running}}' "$DOCKER_CONTAINER")" = "true" ]; then 
-            docker exec  "$DOCKER_CONTAINER"  cp /files/demoECOC21_4.xml demoECOC21.xml
-            docker exec "$DOCKER_CONTAINER" /confd/examples.confd/OC23/startNetconfAgent.sh 
-      else 
-            echo "your container is not running yet"
-      fi
+         
+
+
+
+screen -dmS t1 -T xterm sh -c "docker run -p 10.0.2.4:2023:2022 -v ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na1 -it asgamb1/oc23bgp.img:latest bash"
+screen -dmS t2 -T xterm sh -c "docker run -p 10.0.2.4:2024:2022 -v ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na2 -it asgamb1/oc23bgp.img:latest bash"
+
+
+
+sleep 4
+echo "starting transponder1 "
+
+if [ "$( docker container  inspect -f '{{.State.Running}}' na1)" = "true" ]; then 
+        docker exec  na1 sh -c  " cp /files/platform_t1.xml demoECOC21.xml ; 
+                                 /confd/examples.confd/OC23/startNetconfAgent.sh;"
+       
+else 
+        echo "na1 container is not running yet"
+fi
+
+echo "starting transponder2 "
+
+if [ "$( docker container  inspect -f '{{.State.Running}}' na2)" = "true" ]; then 
+        docker exec  na2 sh -c " cp /files/platform_t2.xml demoECOC21.xml;
+                                  /confd/examples.confd/OC23/startNetconfAgent.sh  "
+
 else 
-   echo "Please define the docker container name and port"
-fi         
+        echo "na2 container is not running yet"
+fi
\ No newline at end of file
diff --git a/src/tests/ofc24/start_topo.sh b/src/tests/ofc24/start_topo.sh
index c92406476..ed93641c9 100755
--- a/src/tests/ofc24/start_topo.sh
+++ b/src/tests/ofc24/start_topo.sh
@@ -29,35 +29,42 @@ sudo docker rm na4
 
 echo "Creating Transponder Agents"
 
-# if ! docker image inspect "$IMAGE_NAME" >/dev/null 2>&1 ; then
-#    echo "asgamb1/oc23bgp.img:latest not existed ! "
-#    screen -dmS t3 -T xterm sh -c "docker run -p 10.0.2.15:2025:2022 -v ~/tempOC/files:/files --name na -it  $IMAGE_NAME bash"
-#    echo 'start downloading  asgamb1/oc23bgp.img:latest , it may take few minutes ! .... ' 
-#    while [ "$(docker image inspect asgamb1/oc23bgp.img:latest 2>/dev/null)" == "[]" ]; do
-#         sleep 1
-# done
+ ./startExtraNetConfigAgent.sh
 
-#fi
 
+echo "Creating Roadms Agents"
 
 
-screen -dmS t1 -T xterm sh -c "docker run  -p 127.0.0.1:2023:2022 -v ~/tempOC/files:/files --name $DOCKER_CONTAINER -it asgamb1/oc23bgp.img:latest bash"
-sleep  2 
-if [ "$( docker container  inspect -f '{{.State.Running}}' "$DOCKER_CONTAINER")" = "true" ]; then 
-        docker exec  "$DOCKER_CONTAINER"  cp /files/demoECOC21_4.xml demoECOC21.xml
-        docker exec "$DOCKER_CONTAINER" /confd/examples.confd/OC23/startNetconfAgent.sh 
+screen -dmS t3 -T xterm sh -c 'docker run -p 10.0.2.4:2025:2022 -v  ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na3 -it asgamb1/flexscale-node.img:latest bash '
+screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.4:2026:2022 -v  ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest bash '
+sleep 4
+
+echo "starting Roadm1 "
+
+if [ "$( docker container  inspect -f '{{.State.Running}}' na4)" = "true" ]; then 
+        docker exec  na4   sh -c " cp /files/platform_r2.xml init_openconfig-platform.xml; 
+                                  cp /files/startNetconfAgent.sh startNetconfAgent.sh;
+                                  /confd/examples.confd/OC23/startNetconfAgent.sh ;"&
+      
 else 
-        echo "your container is not running yet"
+        echo "na4  is not running yet"
 fi
 
-echo " It may take a while , Hang on ..."
-source "./startExtraNetConfigAgent.sh"  "na1" "2023"
-sleep 3
 
-source "./startExtraNetConfigAgent.sh"  "na2" "2024"
-sleep 3
+echo "starting Roadm2 "
+
+
+
+if [ "$( docker container  inspect -f '{{.State.Running}}' na3)" = "true" ]; then 
+        docker exec  na3 sh -c " cp /files/platform_r1.xml init_openconfig-platform.xml;
+                                 cp /files/startNetconfAgent.sh startNetconfAgent.sh;
+                                 /confd/examples.confd/OC23/startNetconfAgent.sh; " 
+
+else 
+        echo "na3  is not running yet"
+fi
+
 
-bash -c "cp /tempOC/files/plat_r1.xml /confd/examples.confd/OC23/init_openconfig-platform.xml; ./startNetconfAgent.sh"
-bash -c "cp /tempOC/files/plat_r2.xml /confd/examples.confd/OC23/init_openconfig-platform.xml; ./startNetconfAgent.sh"
-screen -dmS t3 -T xterm sh -c 'docker run -p 10.0.2.15:2025:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na3 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh'
-screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.15:2026:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh'
+# screen -S t3 -X stuff "cp ~/files/platform_r1.xml /confd/examples.confd/OC23/init_openconfig-platform.xml && ./startNetconfAgent.sh"
+# bash -c "docker  cp  ~/tfs-ctrl/src/tests/ofc24/tempOC/files/platform_r2.xml na4:/confd/examples.confd/OC23/init_openconfig-platform.xml;
+#  docker  cp   ~/tfs-ctrl/src/tests/ofc24/tempOC/files/startNetconfAgent.sh na4:/confd/examples.confd/OC23/startNetconfAgent.sh;"
diff --git a/src/tests/ofc24/platform_r1.xml b/src/tests/ofc24/tempOC/files/platform_r1.xml
old mode 100755
new mode 100644
similarity index 100%
rename from src/tests/ofc24/platform_r1.xml
rename to src/tests/ofc24/tempOC/files/platform_r1.xml
diff --git a/src/tests/ofc24/platform_r2.xml b/src/tests/ofc24/tempOC/files/platform_r2.xml
old mode 100755
new mode 100644
similarity index 100%
rename from src/tests/ofc24/platform_r2.xml
rename to src/tests/ofc24/tempOC/files/platform_r2.xml
diff --git a/src/tests/ofc24/platform_t1.xml b/src/tests/ofc24/tempOC/files/platform_t1.xml
old mode 100755
new mode 100644
similarity index 100%
rename from src/tests/ofc24/platform_t1.xml
rename to src/tests/ofc24/tempOC/files/platform_t1.xml
diff --git a/src/tests/ofc24/platform_t2.xml b/src/tests/ofc24/tempOC/files/platform_t2.xml
old mode 100755
new mode 100644
similarity index 100%
rename from src/tests/ofc24/platform_t2.xml
rename to src/tests/ofc24/tempOC/files/platform_t2.xml
diff --git a/src/tests/ofc24/startNetconfAgent.sh b/src/tests/ofc24/tempOC/files/startNetconfAgent.sh
old mode 100755
new mode 100644
similarity index 100%
rename from src/tests/ofc24/startNetconfAgent.sh
rename to src/tests/ofc24/tempOC/files/startNetconfAgent.sh
-- 
GitLab