Commit 64e3d4f6 authored by knopp's avatar knopp
Browse files

Merge branch 'enhancement-10-harmony' of...

Merge branch 'enhancement-10-harmony' of https://gitlab.eurecom.fr/oai/openairinterface5g into enhancement-10-harmony

Conflicts:
	openair1/SCHED/phy_procedures_lte_eNb.c
parents f7b6d16c 456572c9
...@@ -32,3 +32,8 @@ job1: ...@@ -32,3 +32,8 @@ job1:
- sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $NFS_TEST_RESULTS_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$NFS_TEST_RESULTS_DIR - sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $NFS_TEST_RESULTS_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$NFS_TEST_RESULTS_DIR
- sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $EXTERNAL_SHARE_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$EXTERNAL_SHARE_DIR - sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $EXTERNAL_SHARE_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$EXTERNAL_SHARE_DIR
- cat $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml - cat $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml
- exce_log=`egrep -i 'warning|error|critical|exception' $NFS_TEST_RESULTS_DIR/log/python_autotest.log `
- if [ -n "$exce_log" ]; then echo -e "\e[31mThere are errors in $NFS_TEST_RESULTS_DIR/log/python_autotest.log. Please check the logs\e[0m" ; fi
- exce_log=`egrep -i 'warning|error|critical|exception' $NFS_TEST_RESULTS_DIR/log/python_autotest_cleanup.log `
- if [ -n "$exce_log" ]; then echo -e "\e[31mThere are errors in $NFS_TEST_RESULTS_DIR/log/python_autotest_cleanup.log. Please check the logs\e[0m" ; fi
OpenAirInterface is under GNU GPLv3 license. The full GNU General Public License is included in this distribution in the file called "COPYING". OpenAirInterface is under OpenAirInterface Software Alliance license.
├── http://www.openairinterface.org/?page_id=101
The OpenAirInterface (OAI) software is composed of six different parts: ├── http://www.openairinterface.org/?page_id=698
openair1: 3GPP LTE Rel-8 PHY layer + PHY RF simulation The OpenAirInterface (OAI) software is composed of the following parts:
openair2: 3GPP LTE Rel-9 RLC/MAC/PDCP/RRC implementations, eNB application, X2AP. Note that for RLC, the following versions are userL UM_v9.3.0, TM_v9.3.0, and AM_v9.3.0. For PDCP, PDCP_v10.1.0 is used. For RRC, only LITE is used. openairinterface5g
├── cmake_targets: build utilities to compile (simulation, emulation and real-time platforms), and generated build files
openair3: 3GPP LTE Rel9 and 10 MME/NAS, S+P-GW, HSS, S1AP (ENB and MME). ├── common : some common OAI utilities, other tools can be found at openair2/UTILS
├── COPYING
common: some common OAI utilities, other tools can be found at openair2/UTILS ├── maketags : script to generate emacs tags
├── openair1 : 3GPP LTE Rel-10 PHY layer + PHY RF simulation and a subset of Rel 12 Features.
targets: scripts to compile and lauch different system targets (simulation, emulation and real-time platforms, user-space tools for these platforms (tbd)) ├── openair2 :3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation.
├── LAYER2/RLC/ with the following subdirectories: UM_v9.3.0, TM_v9.3.0, and AM_v9.3.0.
see README files in these subdirectories for more information ├── LAYER2/PDCP/PDCP_v10.1.0.
├── RRC/LITE
see also https://twiki.eurecom.fr/twiki/bin/view/OpenAirInterface/WebHome ├── PHY_INTERFACE
├── X2AP
├── ENB_APP
├── openair3: 3GPP LTE Rel10 for S1AP, NAS GTPV1-U for both ENB and UE.
├── GTPV1-U
├── NAS
├── S1AP
├── SCTP
├── SECU
├── UDP
└── targets: top level wrapper for unitary simulation for PHY channels, system-level emulation (eNB-UE with and without S1), and realtime eNB and UE and RRH GW.
This diff is collapsed.
...@@ -29,10 +29,7 @@ ...@@ -29,10 +29,7 @@
# *******************************************************************************/ # *******************************************************************************/
# \file test01.py # \author Rohit Gupta
# \brief test 01 for OAI
# \author Navid Nikaein
# \date 2013 - 2015
# \version 0.1 # \version 0.1
# @ingroup _test # @ingroup _test
...@@ -316,12 +313,12 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logd ...@@ -316,12 +313,12 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logd
# \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box # \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box
# \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml) # \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml)
def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop): def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop):
cmd = 'killall -q -r ' + programList cmd = 'killall -9 -q -r ' + programList
result = oai.send(cmd, True) result = oai.send(cmd, True)
print "Killing old programs..." + result print "Killing old programs..." + result
programArray = programList.split() programArray = programList.split()
programListJoin = '|'.join(programArray) programListJoin = '|'.join(programArray)
cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail )>& $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
result=oai.send_recv(cmd) result=oai.send_recv(cmd)
cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\'' cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\''
#result = oai.send_recv(cmd) #result = oai.send_recv(cmd)
...@@ -330,7 +327,7 @@ def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop): ...@@ -330,7 +327,7 @@ def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop):
print "Looking for old programs..." + result print "Looking for old programs..." + result
res=oai.send_recv(CleanUpAluLteBox, True) res=oai.send_recv(CleanUpAluLteBox, True)
cmd = "( " + ExmimoRfStop + " ) >> $HOME/.oai_test_setup_cleanup.log.`hostname` ; sync " cmd = "( " + ExmimoRfStop + " ) >> $HOME/.oai_test_setup_cleanup.log.`hostname` ; sync "
res=oai.send_recv(cmd, False) res=oai.send_recv(cmd, False, timeout=600)
#res = oai.send_recv(ExmimoRfStop, False) #res = oai.send_recv(ExmimoRfStop, False)
cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync"
res=oai.send_recv(cmd) res=oai.send_recv(cmd)
...@@ -1529,9 +1526,8 @@ for testcase in testcaseList: ...@@ -1529,9 +1526,8 @@ for testcase in testcaseList:
print "Now copying files to NFS Share" print "Now copying files to NFS Share"
oai_localhost = openair('localdomain','localhost') oai_localhost = openair('localdomain','localhost')
oai_localhost.connect(user,pw) oai_localhost.connect(user,pw)
cmd = ' rm -fr ' + NFSTestsResultsDir + ' ; mkdir -p ' + NFSTestsResultsDir cmd = ' mkdir -p ' + NFSTestsResultsDir
res = oai_localhost.send_recv(cmd) res = oai_localhost.send_recv(cmd)
print "Deleting NFSTestResults Dir..." + res
print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir
SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all")
...@@ -1568,12 +1564,15 @@ res=os.system(cmd) ...@@ -1568,12 +1564,15 @@ res=os.system(cmd)
print "Now copying files to NFS Share" print "Now copying files to NFS Share"
oai_localhost = openair('localdomain','localhost') oai_localhost = openair('localdomain','localhost')
oai_localhost.connect(user,pw) oai_localhost.connect(user,pw)
cmd = ' rm -fr ' + NFSTestsResultsDir + ' ; mkdir -p ' + NFSTestsResultsDir cmd = 'mkdir -p ' + NFSTestsResultsDir
res = oai_localhost.send_recv(cmd) res = oai_localhost.send_recv(cmd)
print "Deleting NFSTestResults Dir..." + res
print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir
SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all")
cmd = "cat " + NFSTestsResultsDir + "/log/*/*.xml > " + NFSTestsResultsDir + "/log/results_autotests.xml"
res = oai_localhost.send_recv(cmd)
oai_localhost.disconnect() oai_localhost.disconnect()
sys.exit() sys.exit()
This diff is collapsed.
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
import time import time
import serial import serial
import os import os
from socket import AF_INET
from pyroute2 import IPRoute from pyroute2 import IPRoute
import sys import sys
import re import re
...@@ -62,7 +63,7 @@ def find_open_port(): ...@@ -62,7 +63,7 @@ def find_open_port():
while True: while True:
if os.path.exists(serial_port) == True: if os.path.exists(serial_port) == True:
return serial_port return serial_port
for port in range(2,100): for port in range(0,100):
serial_port_tmp = '/dev/ttyUSB'+str(port) serial_port_tmp = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port_tmp) == True: if os.path.exists(serial_port_tmp) == True:
print 'New Serial Port : ' + serial_port_tmp print 'New Serial Port : ' + serial_port_tmp
...@@ -97,11 +98,12 @@ signal.signal(signal.SIGINT, signal_handler) ...@@ -97,11 +98,12 @@ signal.signal(signal.SIGINT, signal_handler)
#ser.isOpen() #ser.isOpen()
class pppThread (threading.Thread): class pppThread (threading.Thread):
def __init__(self, threadID, name, counter): def __init__(self, threadID, name, counter,port):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.threadID = threadID self.threadID = threadID
self.name = name self.name = name
self.counter = counter self.counter = counter
self.port=port
def run(self): def run(self):
print "Starting " + self.name print "Starting " + self.name
#Here we keep running pppd thread in indefinite loop as this script terminates sometimes #Here we keep running pppd thread in indefinite loop as this script terminates sometimes
...@@ -111,6 +113,10 @@ class pppThread (threading.Thread): ...@@ -111,6 +113,10 @@ class pppThread (threading.Thread):
print "Starting wvdial now..." print "Starting wvdial now..."
print 'exit_flag = ' + str(exit_flag) print 'exit_flag = ' + str(exit_flag)
send_command('AT+CGATT=1','OK', 300) send_command('AT+CGATT=1','OK', 300)
#Now we do search and replace on wvdial config file
cmd="sed -i \"s%Modem = .*%Modem = " + self.port + "%g\" " + bandrich_ppd_config
os.system(cmd)
os.system('wvdial -C ' + bandrich_ppd_config + '' ) os.system('wvdial -C ' + bandrich_ppd_config + '' )
if exit_flag == 1: if exit_flag == 1:
print "Exit flag set to true. Exiting pppThread now" print "Exit flag set to true. Exiting pppThread now"
...@@ -141,10 +147,12 @@ def send_command (cmd, response, timeout): ...@@ -141,10 +147,12 @@ def send_command (cmd, response, timeout):
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc() error = error + traceback.format_exc()
print error print error
time.sleep(1)
def start_ue () : def start_ue () :
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.' #print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
global serial_port
timeout=60 #timeout in seconds timeout=60 #timeout in seconds
send_command('AT', 'OK' , timeout) send_command('AT', 'OK' , timeout)
send_command('AT+CFUN=1' , 'OK' , timeout) send_command('AT+CFUN=1' , 'OK' , timeout)
...@@ -152,23 +160,33 @@ def start_ue () : ...@@ -152,23 +160,33 @@ def start_ue () :
send_command('AT+CGATT=1','OK', 300) send_command('AT+CGATT=1','OK', 300)
#os.system('wvdial -C ' + bandrich_ppd_config + ' &' ) #os.system('wvdial -C ' + bandrich_ppd_config + ' &' )
thread_ppp = pppThread(1, "ppp_thread", 1) thread_ppp = pppThread(1, "ppp_thread", 1,port=serial_port)
thread_ppp.start() thread_ppp.start()
iface='ppp0' #iface='ppp0'
while 1: while 1:
time.sleep ( 2) time.sleep ( 2)
iface=''
#Now we check if ppp0 interface is up and running #Now we check if ppp0 interface is up and running
try: try:
if exit_flag == 1: if exit_flag == 1:
break break
cmd="ifconfig -a | sed 's/[ \t].*//;/^$/d' | grep ppp"
status, out = commands.getstatusoutput(cmd)
iface=out
ip = IPRoute() ip = IPRoute()
idx = ip.link_lookup(ifname=iface)[0] idx = ip.link_lookup(ifname=iface)[0]
os.system ('route add ' + gw + ' ppp0') print "iface = " + iface
print " Setting route now..."
#os.system("status=1; while [ \"$status\" -ne \"0\" ]; do route add -host " + gw + ' ' + iface + " ; status=$? ;sleep 1; echo \"status = $status\" ; sleep 2; done ")
os.system ('route add -host ' + gw + ' ' + iface + ' 2> /dev/null')
#ip.route('add', dst=gw, oif=iface)
os.system('sleep 5') os.system('sleep 5')
os.system ('ping ' + gw) #print "Starting ping now..."
break os.system ('ping -c 1 ' + gw)
#break
except Exception, e: except Exception, e:
error = ' Interface ' + iface + 'does not exist...' 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 + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
...@@ -200,24 +218,31 @@ def reset_ue(): ...@@ -200,24 +218,31 @@ def reset_ue():
ProductId=res[0][3] ProductId=res[0][3]
usb_dir= find_usb_path(VendorId, ProductId) usb_dir= find_usb_path(VendorId, ProductId)
print "Bandrich 4G LTE Adapter found in..." + usb_dir print "Bandrich 4G LTE Adapter found in..." + usb_dir
print "Sleeping now for 45 seconds...please wait..."
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\"" cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 15" ) os.system(cmd + " ; sleep 15" )
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\"" cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 30" ) os.system(cmd + " ; sleep 30" )
find_open_port()
stop_ue()
i=1 i=1
gw='192.172.0.1' gw='192.172.0.1'
while i < len(sys.argv): while i < len(sys.argv):
arg=sys.argv[i] arg=sys.argv[i]
if arg == '--start-ue' : if arg == '--start-ue' :
print "Turning on UE..."
find_open_port() find_open_port()
print 'Using Serial port : ' + serial_port print 'Using Serial port : ' + serial_port
start_ue() start_ue()
elif arg == '--stop-ue' : elif arg == '--stop-ue' :
print "Turning off UE..."
find_open_port() find_open_port()
print 'Using Serial port : ' + serial_port print 'Using Serial port : ' + serial_port
stop_ue() stop_ue()
elif arg == '--reset-ue' : elif arg == '--reset-ue' :
print "Resetting UE..."
find_open_port()
reset_ue() reset_ue()
elif arg == '-gw' : elif arg == '-gw' :
gw = sys.argv[i+1] gw = sys.argv[i+1]
......
...@@ -143,6 +143,7 @@ def send_command (cmd, response, timeout): ...@@ -143,6 +143,7 @@ def send_command (cmd, response, timeout):
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc() error = error + traceback.format_exc()
print error print error
time.sleep(1)
def start_ue () : def start_ue () :
...@@ -211,6 +212,7 @@ def reset_ue(): ...@@ -211,6 +212,7 @@ def reset_ue():
os.system(cmd + " ; sleep 15" ) os.system(cmd + " ; sleep 15" )
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\"" cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd + " ; sleep 30" ) os.system(cmd + " ; sleep 30" )
stop_ue()
i=1 i=1
gw='192.172.0.1' gw='192.172.0.1'
...@@ -225,6 +227,7 @@ while i < len(sys.argv): ...@@ -225,6 +227,7 @@ while i < len(sys.argv):
print 'Using Serial port : ' + serial_port print 'Using Serial port : ' + serial_port
stop_ue() stop_ue()
elif arg == '--reset-ue' : elif arg == '--reset-ue' :
find_open_port()
reset_ue() reset_ue()
elif arg == '-gw' : elif arg == '-gw' :
gw = sys.argv[i+1] gw = sys.argv[i+1]
......
...@@ -43,7 +43,8 @@ def kill_processes(name): ...@@ -43,7 +43,8 @@ def kill_processes(name):
cmd = 'sudo adb -s ' + device_id +' shell "ps |grep ' + name + '"' cmd = 'sudo adb -s ' + device_id +' shell "ps |grep ' + name + '"'
status, out = commands.getstatusoutput(cmd) status, out = commands.getstatusoutput(cmd)
if status != 0: if status != 0:
print "Error execting command to kill process " + name print "Error executing command to kill process " + name
print "Error =" + out
sys.exit(1) sys.exit(1)
print "Out = " + out print "Out = " + out
if out=='': if out=='':
...@@ -51,7 +52,7 @@ def kill_processes(name): ...@@ -51,7 +52,7 @@ def kill_processes(name):
out_arr = out.split() out_arr = out.split()
pid_to_kill = out_arr[1] pid_to_kill = out_arr[1]
print "Now killing process ID " + pid_to_kill + " on Phone" print "Now killing process ID " + pid_to_kill + " on Phone"
cmd = 'sudo adb -s ' + device_id +' shell "kill ' + pid_to_kill + '"' cmd = 'sudo adb -s ' + device_id +' shell "kill -9 ' + pid_to_kill + '"'
status, out = commands.getstatusoutput(cmd) status, out = commands.getstatusoutput(cmd)
if status != 0: if status != 0:
print "Error execting command to kill process " + name print "Error execting command to kill process " + name
...@@ -62,6 +63,7 @@ def start_ue () : ...@@ -62,6 +63,7 @@ def start_ue () :
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.' #print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
print 'Killing old iperf/ping sessions' print 'Killing old iperf/ping sessions'
kill_processes('iperf') kill_processes('iperf')
kill_processes('iperf3')
kill_processes('ping') kill_processes('ping')
print "Turning off airplane mode" print "Turning off airplane mode"
os.system('sudo -E adb devices') os.system('sudo -E adb devices')
...@@ -93,6 +95,7 @@ def stop_ue(): ...@@ -93,6 +95,7 @@ def stop_ue():
os.system('sudo adb -s ' + device_id + ' shell \"settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true\" ') os.system('sudo adb -s ' + device_id + ' shell \"settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true\" ')
print "Killing iperf/ping sessions" print "Killing iperf/ping sessions"
kill_processes('iperf') kill_processes('iperf')
kill_processes('iperf3')
kill_processes('ping') kill_processes('ping')
i=1 i=1
......
#!/usr/bin/python
#******************************************************************************
# OpenAirInterface
# Copyright(c) 1999 - 2014 Eurecom
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# *******************************************************************************/
# \author Navid Nikaein, Rohit Gupta
import time
import serial
import os
from pyroute2 import IPRoute
import sys
import re
import threading
import signal
import traceback
import os
import commands
# configure the serial connections (the parameters differs on the device you are connecting to)
#First we find an open port to work with
serial_port=''
openair_dir = os.environ.get('OPENAIR_DIR')
if openair_dir == None:
print "Error getting OPENAIR_DIR environment variable"
sys.exit(1)
sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/'))
from lib_autotest import *
#Stop the USB BUS of USRPB210
def stop_usrpb210():
stringIdBandrich='National Instruments Corp.'
status, out = commands.getstatusoutput('lsusb | grep -i \'' + stringIdBandrich + '\'')
if (out == '') :
print "USRP B210 not found. Exiting now..."
sys.exit()
p=re.compile('Bus\s*(\w+)\s*Device\s*(\w+):\s*ID\s*(\w+):(\w+)')
res=p.findall(out)
BusId=res[0][0]
DeviceId=res[0][1]
VendorId=res[0][2]
ProductId=res[0][3]
usb_dir= find_usb_path(VendorId, ProductId)
print "USRP B210 found in..." + usb_dir
cmd = "sudo sh -c \"echo 0 > " + usb_dir + "/authorized\""
os.system(cmd)
#Start the USB bus of USRP B210
def start_usrpb210():
stringIdBandrich='National Instruments Corp.'
status, out = commands.getstatusoutput('lsusb | grep -i \'' + stringIdBandrich + '\'')
if (out == '') :
print "USRP B210 not found. Exiting now..."
sys.exit()
p=re.compile('Bus\s*(\w+)\s*Device\s*(\w+):\s*ID\s*(\w+):(\w+)')
res=p.findall(out)
BusId=res[0][0]
DeviceId=res[0][1]
VendorId=res[0][2]
ProductId=res[0][3]
usb_dir= find_usb_path(VendorId, ProductId)
print "USRP B210 found in..." + usb_dir
cmd = "sudo sh -c \"echo 1 > " + usb_dir + "/authorized\""
os.system(cmd)
i=1
while i < len(sys.argv):
arg=sys.argv[i]
if arg == '--start-usrpb210' :
start_usrpb210()
elif arg == '--stop-usrpb210' :
stop_usrpb210()
elif arg == '-h' :
print "--stop-usrpb210: Stop the USRP B210. It cannot be found in uhd_find_devices"
print "--start-usrpb210: Start the USRP B210. It can now be found in uhd_find_devices"
else :
print " Script called with wrong arguments, arg = " + arg
sys.exit()
i = i +1
#!/bin/bash
#******************************************************************************
# OpenAirInterface
# Copyright(c) 1999 - 2014 Eurecom
# OpenAirInterface is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# OpenAirInterface is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OpenAirInterface.The full GNU General Public License is
# included in this distribution in the file called "COPYING". If not,
# see <http://www.gnu.org/licenses/>.
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# *******************************************************************************/
# \author Navid Nikaein, Rohit Gupta
#arg1 timeout to wait before running the script
#arg2 interface
#arg3 iperf arguments
args=($*)
timeout=${args[0]}
iface=${args[1]}
iperf3_args=(${args[@]:2})
#array=${1:-1}
echo "args = ${args[@]}"
echo "timeout = $timeout"
echo "iface = $iface"