From c2005144ed1532cb411e110860fe1da56c83d71d Mon Sep 17 00:00:00 2001
From: Ferreira <ferreira@eurecom.fr>
Date: Wed, 15 Oct 2014 12:49:46 +0000
Subject: [PATCH] Added SPECTRA modifications for demo polishing and bug fixing
 (v1.13)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5891 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../PROJECTS/SPECTRA/DEMO_SPECTRA/README.txt  |  23 +++++-
 .../clientSensing/client/server               | Bin 17896 -> 12356 bytes
 .../clientSensing/client/spectra_deamon.c     |  17 ++--
 .../mih_user/lte_test_user/enb_lte_user.cpp   |  24 +++++-
 .../enb1/oai_conf/start_enb.bash              |   4 +-
 .../mih_user/lte_test_user/enb2_lte_user.cpp  |  78 ++++++++++++------
 targets/PROJECTS/SPECTRA/start_enb.bash       |   4 +-
 7 files changed, 109 insertions(+), 41 deletions(-)

diff --git a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/README.txt b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/README.txt
index 87e991c1fe..69dc0fc9c4 100644
--- a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/README.txt
+++ b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/README.txt
@@ -7,7 +7,7 @@
 #
 # Rui Costa <ferreira@eurecom.fr>
 #
-# v1.12 (13 Oct 2014)
+# v1.13 (15 Oct 2014)
 #
 ########################################
 
@@ -83,6 +83,14 @@
    2.3. CRM
    This component of the demo MUST be compiled and installed separately.
    Check <spectra_root_folder>/CRM/ for more details.
+   There is a google app that must be running in the google cloud,
+   and it's url configured in the source code. The local client is based
+   on the C++ REST framework codenamed "Casablanca".
+   Furthermore you need to compile the local client components 
+   (CRMClient and CRMMain).
+   In the CRM client you will find a folder <tosend> which includes some
+   basic scripts that populate the google app database, and show how to 
+   interact with it.
 
    2.4. TVWS Sensing Measurements
    There is a server and client for simulating the TVWS measurements and
@@ -180,7 +188,7 @@
 
 
 
-########################################
+################################################################################
 CHANGELOG
 
 v0.99 (03/09/2014)
@@ -248,4 +256,15 @@ v1.12 (13/10/2014)
       - Added final version to openair svn
       - Reworked README file.
 
+v1.13 (15/10/2014)
+      - Polishing of the demo
+      - Added bug fixes on launch scripts for enb1
+      - Added feature to put measurements on CRM from enb1
+      - Changed readable output of received measurement reports on enb2
+      - Added more informative output on the sensingClient (TVWS)
+      - Demonstration now stops at end of MIH_Link_Actions.confirm 
+        message on MIH_User of enb2
+      - Added info on sensing client and CRM
+      - Reworked README file.
 
+################################################################################ EOF
diff --git a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/clientSensing/client/server b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/clientSensing/client/server
index 4b6559bfa6a4e92c0dd826805cb19df6c6566bdd..8bea168ace9d6796637245efbac75182bacb3f92 100644
GIT binary patch
delta 1880
zcma)7eN0nV6u<BFl~sJDEv?;Dq_5_oNWg(qR>g^R?V`(A`0y){DTO|<8*8yVj2IVO
z5Vh;fz+;R<vc$|7T};$8Gft<&F~5>6x|#i>%k0dSJe4h|sEiTs&aH}KBH2y)etqZs
z&bhyH?z{JDG4A{7cFC$aNpiS|M8=S8l1V0Z6qcuS*$L^gcYGX5b=e4U?GOyE9l&!t
zZRBqLFXQNe-UIi)dT?aJZ8>7P@kjh1x0T~^<1=*<&uxh>(XZl+m)Zrx>S}zHFIk-n
z7g8Q_`SJ5FUDk06plfUycMSd-`x@5=S>jZCe}`bucK<_Z>&f%~Qc7AZ=LGpa)QDkT
z+zyw;6*=m5WE>r!bWitT!4MT>Z5F=Vn8y)fI@)#|gIW`Po4QSH(_y(WGZn+TS;YGT
zaLQ<hZN`_!6TrB)WieVMo1<P?h%S;1QJ1Xkg_Fiit`L4TPR=wBQu?)*5v!1>K0_2`
z%?BB2Ud|5wG>3@!yO5?Wdq62{Ok1#UBdUqE{lIjbWKY_}I2Re`r~8x+Yc$Q#sn%HA
zH%MVcG@<Xt`XNf&W4>fnDp*Y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e+@e|iRZ|%AXN4=q
zoNyqY?6ClLM^KmSksTZV6}$hQ&e%VigK}|<f>eFQ@ZbzQ#A9h?k1XIE%Z}cA==cFX
z;(dx0kv+(cehV$Tto~p<V}GUr>)@=#<d%QM@IV9J!?RYPSs#>BUe(#5$6>dL8;w)T
zYffLw*it-3S7HoWdM0G~_~qh<MLv4CmKk?U{j8oEMLHY9I}8r$7Ev4X5Rrep5Vc7V
z#!l}yo|yKaSuWD!u(1-8vCcO6?RiXPW0S`Oa5jd|`&S$`R(6F%<NmM6Q${CF11kH2
zv8DPx<-`HwgX&U#%5YDQ70|yu)S*Irv!9MK{e!W0dH|oWjSr@`^OuaKn&aGM{H3N0
w|NBgyQO4_yMKhLgVSEGUqT!P>6rSI3H4Evncpx0wR@*qI;hNzyGn2Oe0|F4qX8-^I

diff --git a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/clientSensing/client/spectra_deamon.c b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/clientSensing/client/spectra_deamon.c
index c4e75d456b..869f581e98 100644
--- a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/clientSensing/client/spectra_deamon.c
+++ b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/clientSensing/client/spectra_deamon.c
@@ -109,10 +109,10 @@ void *connection_handler(int fd) {
 
 	/* now loop, receiving data and printing what we received */
 	for (;;) {
-		printf("---\n Waiting on port %d\n", PORT);
+		printf("\n[SPECTRA Sensing Module]  Started!\n[SPECTRA Sensing Module] ---\n[SPECTRA Sensing Module]  Waiting on port %d\n", PORT);
 		recvlen = recvfrom(fd, rawPacket, MAX_PACKET_SIZE, 0,
 				(struct sockaddr *) &remaddr, &addrlen);
-		printf("Received %d bytes  > ", recvlen);
+		printf("\n[SPECTRA Sensing Module]  Received Data (%d bytes)  > ", recvlen);
 
 		for (i=0; i<recvlen;i++){
 		   printf("%x ", (rawPacket[i] & 0xff));
@@ -126,7 +126,7 @@ void *connection_handler(int fd) {
 		} else {
 
 			request = assembleMessage(&rawPacket);
-			printf(" > Received spectra packet %i of type %i for function %i with %i parameters\n",
+			printf("\n[SPECTRA Sensing Module]   > Received spectra packet %i of type %i for function %i with %i parameters\n",
 					request.messageID,
 					(uint32_t) request.type, (uint32_t) request.function,
 					(uint32_t) request.numberOfparameters);
@@ -135,7 +135,7 @@ void *connection_handler(int fd) {
 			if (request.type == EndProcessing) {
 
 				returnMessage = createReturnPacket(&request, 0, EndProcessing);
-				printf("End processing!!!\n");
+				printf("\n[SPECTRA Sensing Module]  Received: End of cognitive algorithm processing!\n");
 				fflush(stdout);
 			} else {
 				if (request.function == EnergyDetection) {
@@ -143,11 +143,11 @@ void *connection_handler(int fd) {
 					// circular loop over the score list
 					scoreIndex = (scoreIndex < (sizeof(scoresList)/ sizeof(scoresList[0]))) ?
 									scoreIndex : 0;
-
-					printf("Score value: %16llx (%lld)\n",
+					printf("\n[SPECTRA Sensing Module]  Received: Energy Detection Request!\n");
+					printf("\n[SPECTRA Sensing Module]  Processing Score value: %16llx (%lld)\n",
 							(long long int)scoresList[scoreIndex],
 							(long long int)scoresList[scoreIndex]);
-					printf("Score host to network value: 0x%016llx (%lld)\n",
+					printf("\n[SPECTRA Sensing Module]  Processing Score host to network value: 0x%016llx (%lld)\n",
 							(long long int)htonll(scoresList[scoreIndex]),
 							(long long int)htonll(scoresList[scoreIndex]));
 
@@ -157,6 +157,7 @@ void *connection_handler(int fd) {
 			}
 
 			// Sends the answer
+			printf("\n[SPECTRA Sensing Module]  Sending: Reply Message!\n");
 			int retError = returnSpectraPacket(returnMessage, fd, remaddr);
 			if (retError == -1) {
 				perror("Send failed!!!\n");
@@ -203,7 +204,7 @@ int socketBind() {
 		perror("bind failed");
 		return 0;
 	}
-	puts("bind done");
+	puts("\n[SPECTRA Sensing Module]  Initialization done");
 	return fd;
 }
 
diff --git a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/mih_user/lte_test_user/enb_lte_user.cpp b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/mih_user/lte_test_user/enb_lte_user.cpp
index 80fbfe7522..8b6d45652e 100644
--- a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/mih_user/lte_test_user/enb_lte_user.cpp
+++ b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/mih_user/lte_test_user/enb_lte_user.cpp
@@ -1395,18 +1395,36 @@ void mih_user::receive_MIH_Link_Parameters_Report(odtone::mih::message& msg, con
     log_(0, "[MSC_MSG]["+getTimeStamp4Log()+"]["+ msg.source().to_string() +"][--- MIH_Link_Parameters_Report.indication --->]["+msg.destination().to_string()+"]\n");
     log_(0, "  - LINK_TUPLE_ID - Link identifier:  ", link_id2string(link).c_str());
     std::cout<<"LINK_TUPLE_ID - Link identifier: "<<link<<std::endl;
-    
+
     for (odtone::mih::link_param_rpt_list::iterator i=lprl.begin(); i!=lprl.end(); i++)
     {
             log_(0, "Meausrement Type: --- 0 => RSRP  ----- 1=>RSRQ  ---- 2=>CQI  ", i->param.type);
             if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
             {
                 log_(0, "Meausrement Value: ", (short) *value );
+   // ferreira: Upload of measurements to gae-spectra.com
+   // FIXME This will not work for: more than 3 types of measurements OR out of sequence types of measurements 
+		std::string crmc_cmd_str;
+                std::stringstream crmc_ss;
+	        std::string result;
+                if (count % 10 == 0) // All measures at CRM are outdated! do server cleanup!
+		   result = exec ("./CRMClient DEL 2"); 
+                if (count % 3 == 0) // Add 1st measurement (RSRP)
+                   crmc_ss << "./CRMClient PUT 2 meas_no." << count << " " << msg.source().to_string() << "_" << link_id2string(link).c_str() << " RSRP dB " << (short) *value << " 3" ;
+                if (count % 3 == 1) // Add 2nd measurement (RSRQ)
+                   crmc_ss << "./CRMClient PUT 2 meas_no." << count << " " << msg.source().to_string() << "_" << link_id2string(link).c_str() << " RSRQ dB " << (short) *value << " 3" ;
+                if (count % 3 == 2) // Add 3rd measurement (CQI)
+                   crmc_ss << "./CRMClient PUT 2 meas_no." << count << " " << msg.source().to_string() << "_" << link_id2string(link).c_str() << " CQI - " << (short) *value << " 3" ;
+		crmc_cmd_str = crmc_ss.str();
+                const char* crmc_cmd_cstr = crmc_cmd_str.c_str();
+                char* crmc_cmd_char = new char [strlen(crmc_cmd_cstr)+1];
+                strcpy(crmc_cmd_char, crmc_cmd_cstr);
+                result = exec (crmc_cmd_char);   
+                delete [] crmc_cmd_char;
             }
     }
     log_(0, "MIH_Link_Parameters_Report.indication - End");
-    
-    
+
     //eNB1: Forward the message to UE 2
         forward_Parameters_Report_indication(msg);
 
diff --git a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/oai_conf/start_enb.bash b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/oai_conf/start_enb.bash
index 4204ab9b7c..23d02bd58b 100644
--- a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/oai_conf/start_enb.bash
+++ b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb1/oai_conf/start_enb.bash
@@ -68,8 +68,8 @@ source $THIS_SCRIPT_PATH/env_802dot21.bash
 ###########################################################
 bash_exec "ifconfig $EMULATION_DEV_INTERFACE up $EMULATION_DEV_ADDRESS netmask 255.255.255.0"
 bash_exec "ifconfig eth2 up 192.168.14.3 netmask 255.255.255.0"
-#bash_exec "ip r d default dev eth0"
-#bash_exec "ip r a default via 192.168.14.4 dev eth2"
+bash_exec "ip r d default via 192.168.14.4 dev eth2"
+bash_exec "ip r a default via 192.168.12.100 dev eth0"
 ###########################################################
 IPTABLES=/sbin/iptables
 THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
diff --git a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb2/mih_user/lte_test_user/enb2_lte_user.cpp b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb2/mih_user/lte_test_user/enb2_lte_user.cpp
index 87179f2a7f..319d68e2e3 100644
--- a/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb2/mih_user/lte_test_user/enb2_lte_user.cpp
+++ b/targets/PROJECTS/SPECTRA/DEMO_SPECTRA/spectra_demo_src/enb2/mih_user/lte_test_user/enb2_lte_user.cpp
@@ -1372,13 +1372,15 @@ void mih_user::receive_MIH_Link_Actions_confirm(odtone::mih::message& msg)
 // #endif // SCENARIO_2
 
 	log_(0, "MIH_Link_Actions.confirm - End\n");
+    // ferreira: Added sleep time + exit + output to make visible the end of SPECTRA demo
         if( second_link_activated == 1 )
 	{
 		unsigned int pause_time = 30; // in seconds to show the result of the demo then proceed
 		log_(0, "\n\n\n\n\t----- Confirmed Configuration of LTE Link for TVWS -----\n");
 		log_(0, "\n\t----- END OF SPECTRA DEMO ! -----\n");
-		log_(0, "\n\n MIH User regular function will resume in (secs) : ", pause_time );
-		usleep(pause_time * 1000000);
+//		log_(0, "\n\n MIH User regular function will resume in (secs) : ", pause_time );
+//		usleep(pause_time * 1000000);
+		exit(1);
 	}
 }
 
@@ -1422,20 +1424,34 @@ void mih_user::receive_MIH_MN_HO_Candidate_Query_request(odtone::mih::message& m
            & odtone::mih::tlv_link_identifier(link)
            & odtone::mih::tlv_link_param_rpt_list(lprl);
 
-    log_(0, "MIH_MN_HO_Candidate_Query.request - RECEIVED - Begin");
-    log_(0, "\t- LINK CFG STATUS LIST - Length: ", lprl.size());
-    log_(0, "[MSC_MSG]["+getTimeStamp4Log()+"]["+ msg.source().to_string() +"][--- MIH_Link_Parameters_Report.indication --->]["+msg.destination().to_string()+"]\n");
-    log_(0, "  - LINK_TUPLE_ID - Link identifier:  ", link_id2string(link).c_str());
+//    log_(0, "MIH_MN_HO_Candidate_Query.request - RECEIVED - Begin");
+//    log_(0, "\t- LINK CFG STATUS LIST - Length: ", lprl.size());
+//    log_(0, "[MSC_MSG]["+getTimeStamp4Log()+"]["+ msg.source().to_string() +"][--- MIH_Link_Parameters_Report.indication --->]["+msg.destination().to_string()+"]\n");
+//    log_(0, "  - LINK_TUPLE_ID - Link identifier:  ", link_id2string(link).c_str());
+//    
+//     for (odtone::mih::link_param_rpt_list::iterator i=lprl.begin(); i!=lprl.end(); i++)
+//    {
+//            log_(0, "Meausrement Type: --- 0 => RSRP  ----- 1=>RSRQ  ---- 2=>CQI  ", i->param.type);
+//            if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
+//            {
+//                log_(0, "Meausrement Value: ", (short) *value );
+//            }
+//    }
+
+
+    // ferreira: changed output of message for better readability!    
+    log_(0, "\n["+getTimeStamp4Log()+"] [RX] [FROM: "+ msg.source().to_string() +"] [Link ID: "+ link_id2string(link).c_str() +"]");
+    log_(0, "\t[MIH_MN_HO_Candidate_Query [MIH_Link_Parameters_Report]]"); 
     
-     for (odtone::mih::link_param_rpt_list::iterator i=lprl.begin(); i!=lprl.end(); i++)
+    for (odtone::mih::link_param_rpt_list::iterator i=lprl.begin(); i!=lprl.end(); i++)
     {
-            log_(0, "Meausrement Type: --- 0 => RSRP  ----- 1=>RSRQ  ---- 2=>CQI  ", i->param.type);
-            if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
-            {
-                log_(0, "Meausrement Value: ", (short) *value );
-            }
+      if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
+      {
+         log_(0, "\t[Measurement Types: RSRP 0|RSRQ 1|CQI 2] [type: ", i->param.type, "| value: ",  (short) *value, "]" );
+      }
     }
     
+    
 //eNB2 : Action Power Up the TVWS Link after running the cognitive algorithm
     
     //First Phase: Collect the data as input fot the cognitive algorithm
@@ -1461,12 +1477,13 @@ void mih_user::receive_MIH_MN_HO_Candidate_Query_request(odtone::mih::message& m
 //                 link1.type = type;
 //                 send_MIH_Link_Actions_request(link, odtone::mih::link_ac_type_power_up);
 
+// ferreira: commented out the count printouts and changed the comparison value (originally count >= 30 )
                 //Send ONLY ONCE RRC_Connection_Reconfiguration request to the UE on LTE link 0
 //               		 log_(0, "COUNT: ", count );
                 if (second_link_activated==0)
                 {
 //               		 log_(0, "COUNT: ", count );
-                    if (count  >= 750)
+                    if (count  >= 1500)
                     {
 //               		 log_(0, "COUNT: ", count );
                     send_MIH_Link_Action_Power_Up_request(_link_id_list[0]);//Link LTE
@@ -1497,21 +1514,34 @@ void mih_user::receive_MIH_Link_Parameters_Report(odtone::mih::message& msg, con
            & odtone::mih::tlv_link_identifier(link)
            & odtone::mih::tlv_link_param_rpt_list(lprl);
 
-    log_(0, "MIH_Link_Parameters_Report.indication - RECEIVED - Begin");
-    log_(0, "\t- LINK CFG STATUS LIST - Length: ", lprl.size());
-    log_(0, "[MSC_MSG]["+getTimeStamp4Log()+"]["+ msg.source().to_string() +"][--- MIH_Link_Parameters_Report.indication --->]["+msg.destination().to_string()+"]\n");
-    log_(0, "  - LINK_TUPLE_ID - Link identifier:  ", link_id2string(link).c_str());
-    std::cout<<"LINK_TUPLE_ID - Link identifier: "<<link<<std::endl;
+//    log_(0, "MIH_Link_Parameters_Report.indication - RECEIVED - Begin");
+//    log_(0, "\t- LINK CFG STATUS LIST - Length: ", lprl.size());
+//    log_(0, "[MSC_MSG]["+getTimeStamp4Log()+"]["+ msg.source().to_string() +"][--- MIH_Link_Parameters_Report.indication --->]["+msg.destination().to_string()+"]\n");
+//    log_(0, "  - LINK_TUPLE_ID - Link identifier:  ", link_id2string(link).c_str());
+//    std::cout<<"LINK_TUPLE_ID - Link identifier: "<<link<<std::endl;
+//    
+//    for (odtone::mih::link_param_rpt_list::iterator i=lprl.begin(); i!=lprl.end(); i++)
+//    {
+//            log_(0, "Meausrement Type: --- 0 => RSRP  ----- 1=>RSRQ  ---- 2=>CQI  ", i->param.type);
+//            if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
+//            {
+//                log_(0, "Meausrement Value: ", (short) *value );
+//            }
+//    }
+//    log_(0, "MIH_Link_Parameters_Report.indication - End");
+    
+    // ferreira: changed output of message for better readability!    
+    log_(0, "\n["+getTimeStamp4Log()+"] [RX] [FROM: "+ msg.source().to_string() +"] [Link ID: "+ link_id2string(link).c_str() +"]");
+    log_(0, "\t[MIH_Link_Parameters_Report]"); 
     
     for (odtone::mih::link_param_rpt_list::iterator i=lprl.begin(); i!=lprl.end(); i++)
     {
-            log_(0, "Meausrement Type: --- 0 => RSRP  ----- 1=>RSRQ  ---- 2=>CQI  ", i->param.type);
-            if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
-            {
-                log_(0, "Meausrement Value: ", (short) *value );
-            }
+      if(odtone::mih::link_param_val *value = boost::get<odtone::mih::link_param_val>(&i->param.value))
+      {
+         log_(0, "\t[Measurement Types: RSRP 0|RSRQ 1|CQI 2] [type: ", i->param.type, "| value: ",  (short) *value, "]" );
+      }
     }
-    log_(0, "MIH_Link_Parameters_Report.indication - End");
+//    log_(0, "MIH_Link_Parameters_Report.indication - End");
     
     
     //eNB1: Forward the message to UE 2
diff --git a/targets/PROJECTS/SPECTRA/start_enb.bash b/targets/PROJECTS/SPECTRA/start_enb.bash
index 4204ab9b7c..23d02bd58b 100755
--- a/targets/PROJECTS/SPECTRA/start_enb.bash
+++ b/targets/PROJECTS/SPECTRA/start_enb.bash
@@ -68,8 +68,8 @@ source $THIS_SCRIPT_PATH/env_802dot21.bash
 ###########################################################
 bash_exec "ifconfig $EMULATION_DEV_INTERFACE up $EMULATION_DEV_ADDRESS netmask 255.255.255.0"
 bash_exec "ifconfig eth2 up 192.168.14.3 netmask 255.255.255.0"
-#bash_exec "ip r d default dev eth0"
-#bash_exec "ip r a default via 192.168.14.4 dev eth2"
+bash_exec "ip r d default via 192.168.14.4 dev eth2"
+bash_exec "ip r a default via 192.168.12.100 dev eth0"
 ###########################################################
 IPTABLES=/sbin/iptables
 THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
-- 
GitLab