Add cipher cfg param for modem and bts

This parameter is contains a list of supported encryption ciphers by the
modem or bts setting it. It is so far not directly/automatically used
inside osmo-gsm-tester code, but can be useful to create scenarios for
tests that require specific ciphering modes.
For instance, aoip_encryption suite contains tests that require a BTS and
a modem that supports a5 0 and a5 1, otherwise tests will fail.

Change-Id: Ic0e368843a6e58bd3eeef36d2c0a7501296f0f3e
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 150e28b..dab3453 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -56,6 +56,7 @@
         'bts[].band': schema.BAND,
         'bts[].trx_remote_ip': schema.IPV4,
         'bts[].launch_trx': schema.BOOL_STR,
+        'bts[].ciphers[]': schema.CIPHER,
         'bts[].trx_list[].hw_addr': schema.HWADDR,
         'bts[].trx_list[].net_device': schema.STR,
         'bts[].trx_list[].nominal_power': schema.UINT,
@@ -67,6 +68,7 @@
         'modem[].imsi': schema.IMSI,
         'modem[].ki': schema.KI,
         'modem[].auth_algo': schema.AUTH_ALGO,
+        'modem[].ciphers[]': schema.CIPHER,
     }
 
 WANT_SCHEMA = util.dict_add(
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index dcdfdb1..9a0906c 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -76,6 +76,11 @@
     if n < 1:
         raise ValueError('Positive value >0 expected instead of %d' % n)
 
+def cipher(val):
+    if val in ('a5_0', 'a5_1', 'a5_2', 'a5_3', 'a5_4', 'a5_5', 'a5_6', 'a5_7'):
+        return
+    raise ValueError('Unknown Cipher value: %r' % val)
+
 INT = 'int'
 STR = 'str'
 UINT = 'uint'
@@ -88,6 +93,7 @@
 MSISDN = 'msisdn'
 AUTH_ALGO = 'auth_algo'
 TIMES='times'
+CIPHER = 'cipher'
 SCHEMA_TYPES = {
         INT: int,
         STR: str,
@@ -101,6 +107,7 @@
         MSISDN: msisdn,
         AUTH_ALGO: auth_algo,
         TIMES: times,
+        CIPHER: cipher,
     }
 
 def validate(config, schema):