Change in osmocom-bb[master]: trx_toolkit/data_msg.py: use uppercase for KNOWN_VERSIONS

fixeria gerrit-no-reply at lists.osmocom.org
Mon Mar 1 15:02:39 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/23134 )

Change subject: trx_toolkit/data_msg.py: use uppercase for KNOWN_VERSIONS
......................................................................

trx_toolkit/data_msg.py: use uppercase for KNOWN_VERSIONS

Change-Id: Ie4dcc8e91115c514ace243a95a9b44a17cd976b4
Related: OS#4006, SYS#4895
---
M src/target/trx_toolkit/burst_gen.py
M src/target/trx_toolkit/data_if.py
M src/target/trx_toolkit/data_msg.py
M src/target/trx_toolkit/test_data_msg.py
4 files changed, 8 insertions(+), 8 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/target/trx_toolkit/burst_gen.py b/src/target/trx_toolkit/burst_gen.py
index 7028c24..7f154b3 100755
--- a/src/target/trx_toolkit/burst_gen.py
+++ b/src/target/trx_toolkit/burst_gen.py
@@ -176,7 +176,7 @@
 			help = "How many bursts to send (default %(default)s)")
 		bg_group.add_argument("-v", "--hdr-version", metavar = "VER",
 			dest = "hdr_ver", type = int,
-			default = 0, choices = DATAMSG.known_versions,
+			default = 0, choices = DATAMSG.KNOWN_VERSIONS,
 			help = "TRXD header version (default %(default)s)")
 		bg_group.add_argument("-f", "--frame-number", metavar = "FN",
 			dest = "tdma_fn", type = int,
diff --git a/src/target/trx_toolkit/data_if.py b/src/target/trx_toolkit/data_if.py
index cab25aa..07f3d32 100644
--- a/src/target/trx_toolkit/data_if.py
+++ b/src/target/trx_toolkit/data_if.py
@@ -35,7 +35,7 @@
 		log.debug("Init TRXD interface (%s)" % self.desc_link())
 
 	def set_hdr_ver(self, ver):
-		if not ver in DATAMSG.known_versions:
+		if not ver in DATAMSG.KNOWN_VERSIONS:
 			return False
 
 		self._hdr_ver = ver
@@ -43,7 +43,7 @@
 
 	def pick_hdr_ver(self, ver_req):
 		# Pick a version that is lower or equal to ver_req
-		for ver in DATAMSG.known_versions[::-1]:
+		for ver in DATAMSG.KNOWN_VERSIONS[::-1]:
 			if ver <= ver_req:
 				return ver
 
diff --git a/src/target/trx_toolkit/data_msg.py b/src/target/trx_toolkit/data_msg.py
index 8857ba8..742dce4 100644
--- a/src/target/trx_toolkit/data_msg.py
+++ b/src/target/trx_toolkit/data_msg.py
@@ -121,7 +121,7 @@
 
 	# NOTE: up to 16 versions can be encoded
 	CHDR_VERSION_MAX = 0b1111
-	known_versions = (0, 1)
+	KNOWN_VERSIONS = (0, 1)
 
 	def __init__(self, fn = None, tn = None, burst = None, ver = 0):
 		self.burst = burst
@@ -209,7 +209,7 @@
 	def validate(self):
 		''' Validate the message fields (throws ValueError). '''
 
-		if not self.ver in self.known_versions:
+		if not self.ver in self.KNOWN_VERSIONS:
 			raise ValueError("Unknown TRXD header version %d" % self.ver)
 
 		if self.fn is None:
@@ -263,7 +263,7 @@
 
 		# Parse the header version first
 		self.ver = (msg[0] >> 4)
-		if not self.ver in self.known_versions:
+		if not self.ver in self.KNOWN_VERSIONS:
 			raise ValueError("Unknown TRXD header version %d" % self.ver)
 
 		# Parse TDMA TN and FN
diff --git a/src/target/trx_toolkit/test_data_msg.py b/src/target/trx_toolkit/test_data_msg.py
index 8735b0c..991dd25 100644
--- a/src/target/trx_toolkit/test_data_msg.py
+++ b/src/target/trx_toolkit/test_data_msg.py
@@ -120,7 +120,7 @@
 
 	# Validate encoding and decoding
 	def test_enc_dec(self):
-		for ver in DATAMSG.known_versions:
+		for ver in DATAMSG.KNOWN_VERSIONS:
 			with self.subTest("L1 -> TRX message", ver = ver):
 				msg = DATAMSG_L12TRX(ver = ver)
 				self._test_enc_dec(msg)
@@ -180,7 +180,7 @@
 
 	# Validate message transformation
 	def test_transform(self):
-		for ver in DATAMSG.known_versions:
+		for ver in DATAMSG.KNOWN_VERSIONS:
 			with self.subTest("L1 -> TRX message", ver = ver):
 				msg = DATAMSG_L12TRX(ver = ver)
 				self._test_transform(msg)

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/23134
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie4dcc8e91115c514ace243a95a9b44a17cd976b4
Gerrit-Change-Number: 23134
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210301/b77dfa5f/attachment.htm>


More information about the gerrit-log mailing list