[PATCH] osmocom-bb[fixeria/trx]: fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Tue Feb 27 08:42:03 UTC 2018


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/6846

to look at the new patch set (#2).

fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

At the moment, the BurstForwarder performs simple randomization
of both RSSI and ToA values for each forwarded message. Let's
add two additional CTRL commands, which may be used to manually
update the mentioned message fields. This is useful for testing
the measurement processing code in OsmoBTS.

Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
---
M src/target/fake_trx/burst_fwd.py
M src/target/fake_trx/ctrl_if_bb.py
2 files changed, 33 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/46/6846/2

diff --git a/src/target/fake_trx/burst_fwd.py b/src/target/fake_trx/burst_fwd.py
index 663f499..d55ee68 100644
--- a/src/target/fake_trx/burst_fwd.py
+++ b/src/target/fake_trx/burst_fwd.py
@@ -34,6 +34,10 @@
 	bts_freq = None
 	bb_freq = None
 
+	# Static message fields
+	force_rssi = None
+	force_toa = None
+
 	# Constants
 	# TODO: add options to change this
 	RSSI_RAND_TRESHOLD = 10
@@ -76,11 +80,19 @@
 		# Compose a new message for L1
 		msg_trx2l1 = msg_l12trx.gen_trx2l1()
 
-		# Randomize both RSSI and ToA values
-		msg_trx2l1.rssi = msg_trx2l1.rand_rssi(
-			min = self.rssi_min, max = self.rssi_max)
-		msg_trx2l1.toa = msg_trx2l1.rand_toa(
-			min = self.toa_min, max = self.toa_max)
+		# Emulate RSSI value
+		if self.force_rssi is not None:
+			msg_trx2l1.rssi = self.force_rssi
+		else:
+			msg_trx2l1.rssi = msg_trx2l1.rand_rssi(
+				min = self.rssi_min, max = self.rssi_max)
+
+		# Emulate ToA value
+		if self.force_toa is not None:
+			msg_trx2l1.toa = self.force_toa
+		else:
+			msg_trx2l1.toa = msg_trx2l1.rand_toa(
+				min = self.toa_min, max = self.toa_max)
 
 		return msg_trx2l1
 
diff --git a/src/target/fake_trx/ctrl_if_bb.py b/src/target/fake_trx/ctrl_if_bb.py
index 47c7048..f4634cd 100644
--- a/src/target/fake_trx/ctrl_if_bb.py
+++ b/src/target/fake_trx/ctrl_if_bb.py
@@ -115,6 +115,22 @@
 
 			return 0
 
+		elif self.verify_cmd(request, "FAKE_RSSI", 1):
+			print("[i] Recv FAKE_RSSI cmd")
+			self.burst_fwd.force_rssi = int(request[1])
+			# HACK: We don't return a response, as the command is typically sent
+			# by another program (test controller) and we don't want to confuse
+			# trxcon with bogus responses
+			return -1
+
+		elif self.verify_cmd(request, "FAKE_TOA", 1):
+			print("[i] Recv FAKE_TOA cmd")
+			self.burst_fwd.force_toa = float(request[1])
+			# HACK: We don't return a response, as the command is typically sent
+			# by another program (test controller) and we don't want to confuse
+			# trxcon with bogus responses
+			return -1
+
 		# Wrong / unknown command
 		else:
 			# We don't care about other commands,

-- 
To view, visit https://gerrit.osmocom.org/6846
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>


More information about the gerrit-log mailing list