summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-09-12 15:19:18 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-09-12 17:06:55 +0200
commitd761efc80fe36443fd747d50bbb546ea212639a4 (patch)
tree68ffe490dc57e2b46dee70c8c05ae4c036476262
parentf111ee775eba76d92ee9dde223a60c2ccd016f04 (diff)
resource: times is expected to be a non-zero positive integer
-rw-r--r--src/osmo_gsm_tester/resource.py2
-rw-r--r--src/osmo_gsm_tester/schema.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index f8acb9e..d8efe2f 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -68,7 +68,7 @@ RESOURCES_SCHEMA = {
}
WANT_SCHEMA = util.dict_add(
- dict([('%s[].times' % r, schema.INT) for r in R_ALL]),
+ dict([('%s[].times' % r, schema.TIMES) for r in R_ALL]),
RESOURCES_SCHEMA)
KNOWN_BTS_TYPES = {
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index b904960..dcdfdb1 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -71,6 +71,11 @@ def uint(val):
if n < 0:
raise ValueError('Positive value expected instead of %d' % n)
+def times(val):
+ n = int(val)
+ if n < 1:
+ raise ValueError('Positive value >0 expected instead of %d' % n)
+
INT = 'int'
STR = 'str'
UINT = 'uint'
@@ -82,6 +87,7 @@ IMSI = 'imsi'
KI = 'ki'
MSISDN = 'msisdn'
AUTH_ALGO = 'auth_algo'
+TIMES='times'
SCHEMA_TYPES = {
INT: int,
STR: str,
@@ -94,6 +100,7 @@ SCHEMA_TYPES = {
KI: ki,
MSISDN: msisdn,
AUTH_ALGO: auth_algo,
+ TIMES: times,
}
def validate(config, schema):