suites/4g: Introduce sample handover test
This test currently only works with AmarisoftENB and srsUE, because: * srsENB has no handover support yet * AmarisoftUE doesn't provide any known way to verify handovers. As a result, it usually runs with following filters and modifiers: amarisoftenb-rftype@uhd+srsue-rftype@uhd+mod-enb-ncells@2+mod-enb-meas-enable The get_counter() API may change in the future based on information available from other implementations. Change-Id: I0dff4af7e3a89804a03842ad4a4d697bca3a9773
This commit is contained in:
parent
0dd4c0be10
commit
eaefe6b533
|
@ -97,3 +97,6 @@ class MS(log.Origin, metaclass=ABCMeta):
|
|||
|
||||
def msisdn(self):
|
||||
return self.msisdn
|
||||
|
||||
def get_counter(self, counter_name):
|
||||
raise log.Error('get_counter() not implemented!')
|
||||
|
|
|
@ -327,6 +327,20 @@ class srsUE(MS):
|
|||
proc.launch_sync()
|
||||
return proc
|
||||
|
||||
def _get_counter_handover_success(self):
|
||||
# Match against sample line: "HO success"
|
||||
n = 0
|
||||
stdout_lines = (self.process.get_stdout() or '').splitlines()
|
||||
for l in stdout_lines:
|
||||
if l == 'HO successful':
|
||||
n += 1
|
||||
return n
|
||||
|
||||
def get_counter(self, counter_name):
|
||||
if counter_name == 'handover_success':
|
||||
return self._get_counter_handover_success()
|
||||
raise log.Error('counter %s not implemented!' % counter_name)
|
||||
|
||||
def verify_metric(self, value, operation='avg', metric='dl_brate', criterion='gt'):
|
||||
# file is not properly flushed until the process has stopped.
|
||||
if self.running():
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
modifiers:
|
||||
enb:
|
||||
- enable_measurements: true
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env python3
|
||||
from osmo_gsm_tester.testenv import *
|
||||
|
||||
epc = suite.epc()
|
||||
enb = suite.enb()
|
||||
ue = suite.modem()
|
||||
iperf3srv = suite.iperf3srv({'addr': epc.tun_addr()})
|
||||
iperf3srv.set_run_node(epc.run_node())
|
||||
iperf3cli = iperf3srv.create_client()
|
||||
iperf3cli.set_run_node(ue.run_node())
|
||||
|
||||
epc.subscriber_add(ue)
|
||||
epc.start()
|
||||
enb.ue_add(ue)
|
||||
enb.start(epc)
|
||||
|
||||
print('waiting for ENB to connect to EPC...')
|
||||
wait(epc.enb_is_connected, enb)
|
||||
print('ENB is connected to EPC')
|
||||
|
||||
ue.connect(enb)
|
||||
|
||||
iperf3srv.start()
|
||||
proc = iperf3cli.prepare_test_proc(False, ue.netns(), 30)
|
||||
|
||||
print('waiting for UE to attach...')
|
||||
wait(ue.is_connected, None)
|
||||
print('UE is attached')
|
||||
|
||||
rfemu_cell1 = enb.get_rfemu(0)
|
||||
rfemu_cell2 = enb.get_rfemu(1)
|
||||
|
||||
# attenuation from 0 to 10, then back to 0
|
||||
cell1_att_li = list(range(0, 11, 1)) + list(range(9, -1, -1))
|
||||
# attenuation from 10 to 0, then back to 10
|
||||
cell2_att_li = list(range(10, 0, -1)) + list(range(0, 11, 1))
|
||||
|
||||
try:
|
||||
proc.launch()
|
||||
step = 0
|
||||
while step < len(cell1_att_li):
|
||||
rfemu_cell1.set_attenuation(cell1_att_li[step])
|
||||
rfemu_cell2.set_attenuation(cell2_att_li[step])
|
||||
step += 1
|
||||
sleep(1)
|
||||
num_handovers = ue.get_counter('handover_success')
|
||||
if num_handovers != 2:
|
||||
raise Exception('Wrong number of handovers %d vs expected 2' % num_handovers)
|
||||
except Exception as e:
|
||||
try:
|
||||
proc.terminate() # make sure we always terminate the process
|
||||
except Exception:
|
||||
print("Exception while terminating process %r" % repr(process))
|
||||
raise e
|
||||
|
||||
rest_str = 'Got %d successful handovers' % num_handovers
|
||||
print(res_str)
|
||||
test.set_report_stdout(res_str)
|
||||
proc.terminate()
|
||||
proc.wait()
|
||||
print("Done")
|
Loading…
Reference in New Issue