From f111ee775eba76d92ee9dde223a60c2ccd016f04 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 12 Sep 2017 15:13:21 +0200 Subject: resource: ipa_unit_id is expected to be a positive integer Change-Id: I26d7a4351089b73716d193496d7161bf3d9988bb --- src/osmo_gsm_tester/schema.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/osmo_gsm_tester/schema.py') diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py index 2da80cd..b904960 100644 --- a/src/osmo_gsm_tester/schema.py +++ b/src/osmo_gsm_tester/schema.py @@ -66,8 +66,14 @@ def auth_algo(val): return raise ValueError('Unknown Authentication Algorithm: %r' % val) +def uint(val): + n = int(val) + if n < 0: + raise ValueError('Positive value expected instead of %d' % n) + INT = 'int' STR = 'str' +UINT = 'uint' BOOL_STR = 'bool_str' BAND = 'band' IPV4 = 'ipv4' @@ -79,6 +85,7 @@ AUTH_ALGO = 'auth_algo' SCHEMA_TYPES = { INT: int, STR: str, + UINT: uint, BOOL_STR: str2bool, BAND: band, IPV4: ipv4, -- cgit v1.2.3