[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
Wed Feb 28 09:07:13 UTC 2018


Hello Harald Welte, Jenkins Builder,

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

    https://gerrit.osmocom.org/6846

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

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/3

diff --git a/src/target/fake_trx/burst_fwd.py b/src/target/fake_trx/burst_fwd.py
index cf6f2a8..e2c27ca 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_toa256 = None
+	force_rssi = 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.toa256 = msg_trx2l1.rand_toa(
-			min = self.toa256_min, max = self.toa256_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_toa256 is not None:
+			msg_trx2l1.toa256 = self.force_toa256
+		else:
+			msg_trx2l1.toa256 = msg_trx2l1.rand_toa256(
+				min = self.toa256_min, max = self.toa256_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..31810c1 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_toa256 = 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
+
 		# 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: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: 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