[PATCH] osmo-gsm-tester[master]: Add features attribute to modems

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Sep 1 16:04:31 UTC 2017


Review at  https://gerrit.osmocom.org/3763

Add features attribute to modems

The idea behind this attribute is similar to the Features one in ofono:
To provide an easy-to-use list of features that a modem supports.

In osmo-gsm-tester this feature list can be used to create scenarios to
act as a filter for modems. For instance, if an sms related feature must
be tested, then a modem supporting sms features is required. This way
only modems supporting that feature are going to be selected for that
test when that scenario is used.

We provide our own list instead of dynamically using it for two reasons:
- Accessing the list from ofono means powering on + online the modem,
which requires using the modem before resource resolution is done.
- ofono may state that it has support for feature X, but it still
doesn't have all features required by osmo-gsm-tester or there is a bug
in some part of the feature which prevents it from being used for a
specific test.

Change-Id: I1634049f01859ae0310174892a96e204bb670bc1
---
M example/resources.conf
A example/scenarios/mfeature-gprs.conf
M src/osmo_gsm_tester/resource.py
M src/osmo_gsm_tester/schema.py
4 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/63/3763/1

diff --git a/example/resources.conf b/example/resources.conf
index e7e64ee..4798b0a 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -60,6 +60,7 @@
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'xor'
   ciphers: ['a5 0', 'a5 1']
+  features: ['sms']
 
 - label: sierra_2
   path: '/sierra_2'
@@ -67,6 +68,7 @@
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'xor'
   ciphers: ['a5 0', 'a5 1']
+  features: ['sms']
 
 - label: gobi_0
   path: '/gobi_0'
@@ -74,6 +76,7 @@
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'xor'
   ciphers: ['a5 0', 'a5 1']
+  features: []
 
 - label: gobi_3
   path: '/gobi_3'
@@ -81,3 +84,4 @@
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'xor'
   ciphers: ['a5 0', 'a5 1']
+  features: ['gprs']
diff --git a/example/scenarios/mfeature-gprs.conf b/example/scenarios/mfeature-gprs.conf
new file mode 100644
index 0000000..69a05d8
--- /dev/null
+++ b/example/scenarios/mfeature-gprs.conf
@@ -0,0 +1,4 @@
+resources:
+  modem:
+  - features:
+    - 'gprs'
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 4f43bfc..f960322 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -67,6 +67,7 @@
         'modem[].ki': schema.KI,
         'modem[].auth_algo': schema.AUTH_ALGO,
         'modem[].ciphers[]': schema.CIPHER,
+        'modem[].features[]': schema.MODEM_FEATURE,
     }
 
 WANT_SCHEMA = util.dict_add(
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index 91ad883..f7be899 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -71,6 +71,11 @@
         return
     raise ValueError('Unknown Cipher value: %r' % val)
 
+def modem_feature(val):
+    if val in ('sms', 'gprs', 'voicecall', 'ussd'):
+        return
+    raise ValueError('Unknown Modem Feature: %r' % val)
+
 INT = 'int'
 STR = 'str'
 BOOL_STR = 'bool_str'
@@ -82,6 +87,8 @@
 MSISDN = 'msisdn'
 AUTH_ALGO = 'auth_algo'
 CIPHER = 'cipher'
+MODEM_FEATURE = 'modem_feature'
+
 SCHEMA_TYPES = {
         INT: int,
         STR: str,
@@ -94,6 +101,7 @@
         MSISDN: msisdn,
         AUTH_ALGO: auth_algo,
         CIPHER: cipher,
+        MODEM_FEATURE: modem_feature,
     }
 
 def validate(config, schema):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1634049f01859ae0310174892a96e204bb670bc1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list