Add channel_allocator cfg attr to bts resources

Change-Id: I682809d4aeb91a36e3a35fc481e8d40d0b084fa0
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 5204b61..e4e2f9d 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -58,6 +58,7 @@
         'bts[].launch_trx': schema.BOOL_STR,
         'bts[].direct_pcu': schema.BOOL_STR,
         'bts[].ciphers[]': schema.CIPHER,
+        'bts[].channel_allocator': schema.CHAN_ALLOCATOR,
         'bts[].num_trx': schema.UINT,
         'bts[].max_trx': schema.UINT,
         'bts[].trx_list[].addr': schema.IPV4,
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index 1473ad7..4a15bcd 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -105,6 +105,11 @@
         return
     raise ValueError('Unknown Physical channel config: %r' % val)
 
+def channel_allocator(val):
+    if val in ('ascending', 'descending'):
+        return
+    raise ValueError('Unknown Channel Allocator Policy %r' % val)
+
 INT = 'int'
 STR = 'str'
 UINT = 'uint'
@@ -120,6 +125,7 @@
 CIPHER = 'cipher'
 MODEM_FEATURE = 'modem_feature'
 PHY_CHAN = 'chan'
+CHAN_ALLOCATOR = 'chan_allocator'
 
 SCHEMA_TYPES = {
         INT: int,
@@ -137,6 +143,7 @@
         CIPHER: cipher,
         MODEM_FEATURE: modem_feature,
         PHY_CHAN: phy_channel_config,
+        CHAN_ALLOCATOR: channel_allocator,
     }
 
 def validate(config, schema):
diff --git a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
index 18303b6..edcf33f 100644
--- a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
@@ -49,7 +49,7 @@
   ms max power 33
   cell reselection hysteresis 4
   rxlev access min 0
-  channel allocator ascending
+  channel allocator ${bts.channel_allocator}
   rach tx integer 9
   rach max transmission 7
 % if bsc.net.get('rsl_ip', False):