Commit dc440717 authored by Rohit Gupta's avatar Rohit Gupta

added fixes for controlling bandrich UE remotely

parent 2704037a
<testCaseList> <testCaseList>
<MachineList>stevens calisson nano</MachineList> <MachineList>stevens calisson amerique</MachineList>
<NFSResultsShare>/mnt/sradio/TEST_RESULTS</NFSResultsShare> <NFSResultsShare>/mnt/sradio/TEST_RESULTS</NFSResultsShare>
<GitOAI5GRepo>https://gitlab.eurecom.fr/oai/openairinterface5g.git</GitOAI5GRepo> <GitOAI5GRepo>https://gitlab.eurecom.fr/oai/openairinterface5g.git</GitOAI5GRepo>
<GitOpenair-cnRepo>https://gitlab.eurecom.fr/oai/openair-cn.git</GitOpenair-cnRepo> <GitOpenair-cnRepo>https://gitlab.eurecom.fr/oai/openair-cn.git</GitOpenair-cnRepo>
<GitOAI5GRepoBranch>feature-34-test_framework</GitOAI5GRepoBranch> <GitOAI5GRepoBranch>feature-34-test_framework</GitOAI5GRepoBranch>
<GitOpenair-cnRepoBranch>develop</GitOpenair-cnRepoBranch> <GitOpenair-cnRepoBranch>feature-17-test_framework</GitOpenair-cnRepoBranch>
<CleanUpOldProgs>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox* </CleanUpOldProgs> <CleanUpOldProgs>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox* </CleanUpOldProgs>
<testCase id="010101" > <testCase id="010101" >
...@@ -750,20 +750,24 @@ ...@@ -750,20 +750,24 @@
<desc></desc> <desc></desc>
<eNB>calisson</eNB> <eNB>calisson</eNB>
<UE>stevens</UE> <UE>stevens</UE>
<EPC>nano</EPC> <EPC>amerique</EPC>
<cleanupScript>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox*</cleanupScript> <cleanupScript>oaisim* oaisim_nos1* lte-softmodem* lte-softmodem-nos1* mme_gw* run_epc* run_hss* iperf* ltebox*</cleanupScript>
<TimeOut_cmd>300</TimeOut_cmd> <TimeOut_cmd>60</TimeOut_cmd>
<eNB_working_dir>/tmp</eNB_working_dir> <eNB_working_dir>/tmp</eNB_working_dir>
<eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code 1 <eNB_config_file>targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf tracking_area_code 1
targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code 2 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_country_code 208
targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code 9</eNB_config_file> targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.local.conf mobile_network_code 92
targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf tracking_area_code 1
targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_country_code 208
targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mobile_network_code 92
targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf mme_ip_address ({ipv4="192.168.12.26";ipv6="192:168:30::17";active="yes";preference="ipv4";})</eNB_config_file>
<eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog> <eNB_compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</eNB_compile_prog>
<eNB_compile_prog_args>--eNB -w USRP</eNB_compile_prog_args> <eNB_compile_prog_args>--eNB -w USRP</eNB_compile_prog_args>
<eNB_pre_exec></eNB_pre_exec> <eNB_pre_exec></eNB_pre_exec>
<eNB_pre_exec_args></eNB_pre_exec_args> <eNB_pre_exec_args></eNB_pre_exec_args>
<eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec> <eNB_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</eNB_main_exec>
<eNB_main_exec_args></eNB_main_exec_args> <eNB_main_exec_args> -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.epc.remote.conf </eNB_main_exec_args>
<eNB_traffic_exec>iperf</eNB_traffic_exec> <eNB_traffic_exec>iperf -s</eNB_traffic_exec>
<eNB_traffic_exec_args></eNB_traffic_exec_args> <eNB_traffic_exec_args></eNB_traffic_exec_args>
<eNB_search_expr_true></eNB_search_expr_true> <eNB_search_expr_true></eNB_search_expr_true>
<eNB_search_expr_false></eNB_search_expr_false> <eNB_search_expr_false></eNB_search_expr_false>
...@@ -776,17 +780,19 @@ ...@@ -776,17 +780,19 @@
<UE_compile_prog_args>--eNB -w USRP</UE_compile_prog_args> <UE_compile_prog_args>--eNB -w USRP</UE_compile_prog_args>
<UE_pre_exec></UE_pre_exec> <UE_pre_exec></UE_pre_exec>
<UE_pre_exec_args></UE_pre_exec_args> <UE_pre_exec_args></UE_pre_exec_args>
<UE_main_exec>$OPENAIR_DIR/cmake_targets/lte_build_oai/build/lte-softmodem</UE_main_exec> <UE_main_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue --stop-ue ; $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue --start-ue </UE_main_exec>
<UE_main_exec_args></UE_main_exec_args> <UE_main_exec_args></UE_main_exec_args>
<UE_traffic_exec>iperf</UE_traffic_exec> <UE_traffic_exec>ping 192.172.0.1</UE_traffic_exec>
<UE_traffic_exec_args></UE_traffic_exec_args> <UE_traffic_exec_args></UE_traffic_exec_args>
<UE_search_expr_true></UE_search_expr_true> <UE_search_expr_true></UE_search_expr_true>
<UE_search_expr_false></UE_search_expr_false> <UE_search_expr_false></UE_search_expr_false>
<EPC_working_dir>/tmp</EPC_working_dir> <EPC_working_dir>/tmp</EPC_working_dir>
<EPC_config_file>BUILD/EPC/epc.local.enb.conf.in MCC 7 <EPC_config_file>BUILD/EPC/epc.local.enb.conf.in MCC 208
BUILD/EPC/epc.local.enb.conf.in MNC 8 BUILD/EPC/epc.local.enb.conf.in MNC 92
BUILD/EPC/epc.local.enb.conf.in TAC 9</EPC_config_file> BUILD/EPC/epc.local.enb.conf.in TAC 1
BUILD/EPC/epc.local.enb.conf.in PGW_INTERFACE_NAME_FOR_SGI eth1
BUILD/EPC/epc.local.enb.conf.in PGW_IPV4_ADDRESS_FOR_SGI 192.168.12.82/24 </EPC_config_file>
<EPC_compile_prog>SCRIPTS/build_epc</EPC_compile_prog> <EPC_compile_prog>SCRIPTS/build_epc</EPC_compile_prog>
<EPC_compile_prog_args>-c -l</EPC_compile_prog_args> <EPC_compile_prog_args>-c -l</EPC_compile_prog_args>
<HSS_compile_prog>SCRIPTS/build_hss</HSS_compile_prog> <HSS_compile_prog>SCRIPTS/build_hss</HSS_compile_prog>
...@@ -794,11 +800,11 @@ ...@@ -794,11 +800,11 @@
<EPC_pre_exec></EPC_pre_exec> <EPC_pre_exec></EPC_pre_exec>
<EPC_pre_exec_args></EPC_pre_exec_args> <EPC_pre_exec_args></EPC_pre_exec_args>
<EPC_main_exec>SCRITPTS/run_epc -l </EPC_main_exec> <EPC_main_exec>/opt/ltebox/tools/stop_ltebox ; /opt/ltebox/tools/start_ltebox </EPC_main_exec>
<EPC_main_exec_args></EPC_main_exec_args> <EPC_main_exec_args></EPC_main_exec_args>
<HSS_main_exec>SCRIPTS/run_hss -l</HSS_main_exec> <HSS_main_exec>/opt/hss_sim0609/starthss </HSS_main_exec>
<HSS_main_exec_args></HSS_main_exec_args> <HSS_main_exec_args></HSS_main_exec_args>
<EPC_traffic_exec>iperf</EPC_traffic_exec> <EPC_traffic_exec>iperf -s</EPC_traffic_exec>
<EPC_traffic_exec_args></EPC_traffic_exec_args> <EPC_traffic_exec_args></EPC_traffic_exec_args>
<EPC_search_expr_true></EPC_search_expr_true> <EPC_search_expr_true></EPC_search_expr_true>
<EPC_search_expr_false></EPC_search_expr_false> <EPC_search_expr_false></EPC_search_expr_false>
......
import time
import serial
import os
from pyroute2 import IPRoute
import sys
import re
import threading
import signal
import traceback
# configure the serial connections (the parameters differs on the device you are connecting to)
serial_port = '/dev/ttyUSB2'
bandrich_ppd_config = '$OPENAIR_DIR/cmake_targets/autotests/tools/wdial.bandrich.conf'
exit_flag=0
def signal_handler(signal, frame):
print('You pressed Ctrl+C!')
print('Resetting the UE to detached state')
timeout=10
exit_flag=1
send_command('AT+CGATT=0' , 'OK' , timeout)
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
ser = serial.Serial(
port=serial_port,
#baudrate=9600,
#parity=serial.PARITY_ODD,
#stopbits=serial.STOPBITS_TWO,
#bytesize=serial.EIGHTBITS
)
#ser.open()
#ser.isOpen()
class pppThread (threading.Thread):
def __init__(self, threadID, name, counter):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
def run(self):
print "Starting " + self.name
#Here we keep running pppd thread in indefinite loop as this script terminates sometimes
#while 1:
while 1:
time.sleep(5) #Hard coded, do not reduce this number!
print "Starting wvdial now..."
print 'exit_flag = ' + str(exit_flag)
send_command('AT+CGATT=1','OK', 300)
os.system('wvdial -C ' + bandrich_ppd_config + '' )
if exit_flag == 1:
print "Exit flag set to true. Exiting pppThread now"
print "Terminating wvdial now..."
def send_command (cmd, response, timeout):
count=0
sleep_duration = 1
while count <= timeout:
ser.write (cmd + '\r\n')
out = ''
time.sleep(sleep_duration)
count = count + sleep_duration
while ser.inWaiting() > 0:
out += ser.read(1)
print 'out = <' + out + '> response = <' + response + '> \n'
if re.search(response, out):
break
def start_ue () :
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
timeout=60 #timeout in seconds
send_command('AT', 'OK' , timeout)
send_command('AT+CGATT=0' , 'OK' , timeout)
send_command('AT+CGATT=1','OK', 300)
#os.system('wvdial -C ' + bandrich_ppd_config + ' &' )
thread_ppp = pppThread(1, "ppp_thread", 1)
thread_ppp.start()
iface='ppp0'
while 1:
time.sleep ( 2)
#Now we check if ppp0 interface is up and running
try:
if exit_flag == 1:
break
ip = IPRoute()
idx = ip.link_lookup(ifname=iface)[0]
os.system ('route add 192.172.0.1 ppp0')
break
except Exception, e:
error = ' Interface ' + iface + 'does not exist...'
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc()
print error
thread_ppp.join()
def stop_ue():
timeout=60
os.system('killall wvdial')
send_command('AT', 'OK' , timeout)
send_command('AT+CGATT=0' , 'OK' , timeout)
for arg in sys.argv[1:]:
if arg == '--start-ue' :
start_ue()
elif arg == '--stop-ue' :
stop_ue()
else :
print " Script called with wrong arguments, arg = " + arg
sys.exit()
#!/usr/bin/python
import sys
import re
#Arg 1 name of file
#Arg 2 keyword
#arg 3 replacement text
#Note that these should be seperated by spaces
if len(sys.argv) != 4:
print "search_repl.py: Wrong number of arguments. This program needs 3 arguments"
sys.exit()
filename = sys.argv[1]
keyword = sys.argv[2]
replacement_text = sys.argv[3]
file = open(filename, 'r')
string = file.read()
file.close()
if keyword == 'mme_ip_address':
#string = (re.sub(r"mme_ip_address\s*=\s*\([^\$]+)\)\s*;\s*", r"<% tex \1 %>", t, re.M)
replacement_text = keyword + ' = ' + replacement_text + ' ; '
string = re.sub(r"mme_ip_address\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
else :
replacement_text = keyword + ' = \" ' + replacement_text + '\" ; '
string = re.sub(r"%s\s*=\s*\"([^\$]+?)\"\s*;" % keyword , replacement_text, string, re.M)
file = open(filename, 'w')
file.write(string)
file.close()
[Dialer Defaults]
Modem = /dev/ttyUSB0
ISDN = off
Modem Type = Analog Modem
Baud = 9600
Init = ATZ
Init2 = AT+CPIN?
Init3 = AT+CGREG?
Init4 = AT+COPS?
Init5 = AT+CSQ
Init6 =
Init7 = AT+CGATT=1
Init8 =
Init9 =
Phone = *99***1#
Phone1 =
Phone2 =
Phone3 =
Phone4 =
Dial Prefix =
Dial Attempts = 1
Dial Command = ATM1L3DT
Ask Password = off
Password = ''
Username = ImaginLab
Auto Reconnect = off
Abort on Busy = off
Carrier Check = on
Check Def Route = on
Abort on No Dialtone = on
Stupid Mode = on
Idle Seconds = 0
Auto DNS = on
;Minimize = off
;Dock = off
;Do NOT edit this file by hand!
...@@ -256,7 +256,9 @@ check_install_oai_software() { ...@@ -256,7 +256,9 @@ check_install_oai_software() {
python \ python \
subversion \ subversion \
xmlstarlet \ xmlstarlet \
python-pip python-pip \
pydb \
wvdial
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
if [ `lsb_release -rs` = '12.04' ] ; then if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source install_nettle_from_source
...@@ -265,6 +267,7 @@ check_install_oai_software() { ...@@ -265,6 +267,7 @@ check_install_oai_software() {
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin $SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
fi fi
$SUDO pip install paramiko $SUDO pip install paramiko
$SUDO pip install pyroute2
install_asn1c_from_source install_asn1c_from_source
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment