summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-09-12 15:13:21 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-09-12 17:06:54 +0200
commitf111ee775eba76d92ee9dde223a60c2ccd016f04 (patch)
tree5e4f60428c00c410e2ac5e2b7220925b8fd46bb6
parent15aae98cf0ea9d73e7e8d75539ae3e909446a5db (diff)
resource: ipa_unit_id is expected to be a 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 da543f7..f8acb9e 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -51,7 +51,7 @@ RESOURCES_SCHEMA = {
'ip_address[].addr': schema.IPV4,
'bts[].label': schema.STR,
'bts[].type': schema.STR,
- 'bts[].ipa_unit_id': schema.INT,
+ 'bts[].ipa_unit_id': schema.UINT,
'bts[].addr': schema.IPV4,
'bts[].band': schema.BAND,
'bts[].trx_remote_ip': schema.IPV4,
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,