Change in python/osmo-python-tests[master]: ctrl: introduce constant for TRAP id

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Nov 26 11:19:36 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/11928


Change subject: ctrl: introduce constant for TRAP id
......................................................................

ctrl: introduce constant for TRAP id

Use it for TRAP message parsing and generation.

Change-Id: I0381eb60d10e7278b966464add79772a9f7c8118
---
M osmopy/osmo_ipa.py
1 file changed, 3 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/28/11928/1

diff --git a/osmopy/osmo_ipa.py b/osmopy/osmo_ipa.py
index 246101d..41865c1 100755
--- a/osmopy/osmo_ipa.py
+++ b/osmopy/osmo_ipa.py
@@ -43,6 +43,7 @@
     CTRL_REP = 'REPLY'
     CTRL_ERR = 'ERR'
     CTRL_TRAP = 'TRAP'
+    CTRL_TRAP_ID = 0
 
     def _l(self, d, p):
         """
@@ -250,7 +251,7 @@
         if s == self.CTRL_GET + '_' + self.CTRL_REP:
             return i, v, None
         (s, i, var, val) = data.split(' ', 3)
-        if s == self.CTRL_TRAP and i != '0':
+        if s == self.CTRL_TRAP and int(i) != self.CTRL_TRAP_ID:
             return i, None, None
         return i, var, val
 
@@ -267,7 +268,7 @@
         """
         Make TRAP message with given (vak, val) pair
         """
-        return self.add_header("%s 0 %s %s" % (self.CTRL_TRAP, var, val))
+        return self.add_header("%s %d %s %s" % (self.CTRL_TRAP, self.CTRL_TRAP_ID, var, val))
 
     def cmd(self, var, val=None):
         """

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

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0381eb60d10e7278b966464add79772a9f7c8118
Gerrit-Change-Number: 11928
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181126/a155151a/attachment.htm>


More information about the gerrit-log mailing list