diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-02-22 22:24:19 +0100 |
---|---|---|
committer | Vadim Yanitskiy <axilirator@gmail.com> | 2018-03-01 00:17:24 +0700 |
commit | 5ab622d2b72ac6df9d71d42736a6a65ac76cfab5 (patch) | |
tree | 3e01d0574533db0beefb1213d2c79d4ad59bdc79 /src/target | |
parent | 7de70009f63f5c923aaebd35aa9549931357c2c2 (diff) |
fake_trx/ctrl_if_(bb|bts).py: add FAKE_TOA command
FAKE_TOA is an auxilary CTRL command, which may be used to update
the ToA (Timing of Arrival) value of forwarded bursts at runtime.
This is useful for testing the measurement processing
code in OsmoBTS.
The command is implemented for both BTS and BB CTRL interfaces
in two absolute and relative forms:
CMD FAKE_TOA <BASE> <THRESH>
CMD FAKE_TOA <+-BASE_DELTA>
The first form overwrites both ToA value and its treshold.
The second one is relative, and applies a delta
to the current ToA value.
The command affects Downlink bursts if sent on BTS CTRL
interface, and Uplink bursts if sent on the BB CTRL.
Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/fake_trx/ctrl_if_bb.py | 23 | ||||
-rw-r--r-- | src/target/fake_trx/ctrl_if_bts.py | 23 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/target/fake_trx/ctrl_if_bb.py b/src/target/fake_trx/ctrl_if_bb.py index 74fb242e..c4d879c0 100644 --- a/src/target/fake_trx/ctrl_if_bb.py +++ b/src/target/fake_trx/ctrl_if_bb.py @@ -129,6 +129,29 @@ class CTRLInterfaceBB(CTRLInterface): self.burst_fwd.ta = ta return 0 + # Timing of Arrival simulation for Uplink + # Absolute form: CMD FAKE_TOA <BASE> <THRESH> + elif self.verify_cmd(request, "FAKE_TOA", 2): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply both base and threshold + self.burst_fwd.toa256_ul_base = int(request[1]) + self.burst_fwd.toa256_ul_threshold = int(request[2]) + + # TODO: avoid sending response + return -1 + + # Timing of Arrival simulation for Uplink + # Relative form: CMD FAKE_TOA <+-BASE_DELTA> + elif self.verify_cmd(request, "FAKE_TOA", 1): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply delta + self.burst_fwd.toa256_ul_base += int(request[1]) + + # TODO: avoid sending response + return -1 + # Wrong / unknown command else: # We don't care about other commands, diff --git a/src/target/fake_trx/ctrl_if_bts.py b/src/target/fake_trx/ctrl_if_bts.py index 92a4abb2..f27b87d2 100644 --- a/src/target/fake_trx/ctrl_if_bts.py +++ b/src/target/fake_trx/ctrl_if_bts.py @@ -97,6 +97,29 @@ class CTRLInterfaceBTS(CTRLInterface): self.burst_fwd.bts_freq = self.tx_freq return 0 + # Timing of Arrival simulation for Downlink + # Absolute form: CMD FAKE_TOA <BASE> <THRESH> + elif self.verify_cmd(request, "FAKE_TOA", 2): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply both base and threshold + self.burst_fwd.toa256_dl_base = int(request[1]) + self.burst_fwd.toa256_dl_threshold = int(request[2]) + + # TODO: avoid sending response + return -1 + + # Timing of Arrival simulation for Downlink + # Relative form: CMD FAKE_TOA <+-BASE_DELTA> + elif self.verify_cmd(request, "FAKE_TOA", 1): + print("[i] Recv FAKE_TOA cmd") + + # Parse and apply delta + self.burst_fwd.toa256_dl_base += int(request[1]) + + # TODO: avoid sending response + return -1 + # Wrong / unknown command else: # We don't care about other commands, |