[MERGED] osmo-gsm-tester[master]: Use own format to specify encryption algorithm

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 18 22:29:59 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: Use own format to specify encryption algorithm
......................................................................


Use own format to specify encryption algorithm

... instead of using the one from from osmo vty directly.

This way we avoid having multiple word attribute value and we can skip
using quotes in the conf files.

Change-Id: I5265cc9990dd5e99dba1f6262b3a8c597a3e958d
---
M example/defaults.conf
M selftest/template_test/osmo-nitb.cfg.tmpl
M src/osmo_gsm_tester/osmo_bsc.py
M src/osmo_gsm_tester/osmo_msc.py
M src/osmo_gsm_tester/osmo_nitb.py
M src/osmo_gsm_tester/util.py
M suites/aoip_encryption/register_a5_0_authopt.py
M suites/aoip_encryption/register_a5_0_authreq.py
M suites/aoip_encryption/register_a5_1_authreq.py
9 files changed, 26 insertions(+), 13 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/example/defaults.conf b/example/defaults.conf
index f6ecedd..e2921a4 100644
--- a/example/defaults.conf
+++ b/example/defaults.conf
@@ -5,7 +5,7 @@
     short_name: osmo-gsm-tester-nitb
     long_name: osmo-gsm-tester-nitb
     auth_policy: closed
-    encryption: a5 0
+    encryption: a5_0
 
 bsc:
   net:
@@ -14,7 +14,7 @@
     short_name: osmo-gsm-tester-msc
     long_name: osmo-gsm-tester-msc
     auth_policy: closed
-    encryption: a5 0
+    encryption: a5_0
     authentication: optional
 
 msc:
@@ -24,7 +24,7 @@
     short_name: osmo-gsm-tester-msc
     long_name: osmo-gsm-tester-msc
     auth_policy: closed
-    encryption: a5 0
+    encryption: a5_0
     authentication: optional
 
 bsc_bts:
diff --git a/selftest/template_test/osmo-nitb.cfg.tmpl b/selftest/template_test/osmo-nitb.cfg.tmpl
index 200dfdc..2559b14 100644
--- a/selftest/template_test/osmo-nitb.cfg.tmpl
+++ b/selftest/template_test/osmo-nitb.cfg.tmpl
@@ -24,7 +24,7 @@
  long name ${net_name_long}
  auth policy ${net_auth_policy}
  location updating reject cause 13
- encryption a5 ${encryption}
+ encryption ${encryption}
  neci 1
  rrlp mode none
  mm info 1
diff --git a/src/osmo_gsm_tester/osmo_bsc.py b/src/osmo_gsm_tester/osmo_bsc.py
index f9eb858..5fbeea6 100644
--- a/src/osmo_gsm_tester/osmo_bsc.py
+++ b/src/osmo_gsm_tester/osmo_bsc.py
@@ -81,7 +81,10 @@
 
         # runtime parameters:
         if self.encryption is not None:
-            config.overlay(values, dict(bsc=dict(net=dict(encryption=self.encryption))))
+            encryption_vty = util.encryption2osmovty(self.encryption)
+        else:
+            encryption_vty = util.encryption2osmovty(values['bsc']['net']['encryption'])
+        config.overlay(values, dict(bsc=dict(net=dict(encryption=encryption_vty))))
 
         self.dbg('BSC CONFIG:\n' + pprint.pformat(values))
 
diff --git a/src/osmo_gsm_tester/osmo_msc.py b/src/osmo_gsm_tester/osmo_msc.py
index f023b29..67234e3 100644
--- a/src/osmo_gsm_tester/osmo_msc.py
+++ b/src/osmo_gsm_tester/osmo_msc.py
@@ -81,7 +81,10 @@
 
         # runtime parameters:
         if self.encryption is not None:
-            config.overlay(values, dict(msc=dict(net=dict(encryption=self.encryption))))
+            encryption_vty = util.encryption2osmovty(self.encryption)
+        else:
+            encryption_vty = util.encryption2osmovty(values['msc']['net']['encryption'])
+        config.overlay(values, dict(msc=dict(net=dict(encryption=encryption_vty))))
         if self.authentication is not None:
             config.overlay(values, dict(msc=dict(net=dict(authentication=self.authentication))))
 
diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index 8f91bbd..b0a706d 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -82,7 +82,10 @@
 
         # runtime parameters:
         if self.encryption is not None:
-            config.overlay(values, dict(nitb=dict(net=dict(encryption=self.encryption))))
+            encryption_vty = util.encryption2osmovty(self.encryption)
+        else:
+            encryption_vty = util.encryption2osmovty(values['nitb']['net']['encryption'])
+        config.overlay(values, dict(nitb=dict(net=dict(encryption=encryption_vty))))
 
         self.config = values
 
diff --git a/src/osmo_gsm_tester/util.py b/src/osmo_gsm_tester/util.py
index bb4c524..c07bcf2 100644
--- a/src/osmo_gsm_tester/util.py
+++ b/src/osmo_gsm_tester/util.py
@@ -337,4 +337,8 @@
         return ()
     raise ValueError('type %r not supported!' % t)
 
+def encryption2osmovty(val):
+    assert val[:3] == 'a5_'
+    return 'a5 ' + val[3:]
+
 # vim: expandtab tabstop=4 shiftwidth=4
diff --git a/suites/aoip_encryption/register_a5_0_authopt.py b/suites/aoip_encryption/register_a5_0_authopt.py
index ff93cb8..0224ee0 100755
--- a/suites/aoip_encryption/register_a5_0_authopt.py
+++ b/suites/aoip_encryption/register_a5_0_authopt.py
@@ -11,8 +11,8 @@
 
 print('start network...')
 msc.set_authentication(False)
-msc.set_encryption('a5 0')
-bsc.set_encryption('a5 0')
+msc.set_encryption('a5_0')
+bsc.set_encryption('a5_0')
 hlr.start()
 stp.start()
 msc.start()
diff --git a/suites/aoip_encryption/register_a5_0_authreq.py b/suites/aoip_encryption/register_a5_0_authreq.py
index 051f5e2..114c628 100755
--- a/suites/aoip_encryption/register_a5_0_authreq.py
+++ b/suites/aoip_encryption/register_a5_0_authreq.py
@@ -11,8 +11,8 @@
 
 print('start network...')
 msc.set_authentication(True)
-msc.set_encryption('a5 0')
-bsc.set_encryption('a5 0')
+msc.set_encryption('a5_0')
+bsc.set_encryption('a5_0')
 hlr.start()
 stp.start()
 msc.start()
diff --git a/suites/aoip_encryption/register_a5_1_authreq.py b/suites/aoip_encryption/register_a5_1_authreq.py
index 11ee006..a84fa3a 100755
--- a/suites/aoip_encryption/register_a5_1_authreq.py
+++ b/suites/aoip_encryption/register_a5_1_authreq.py
@@ -11,8 +11,8 @@
 
 print('start network...')
 msc.set_authentication(True)
-msc.set_encryption('a5 1')
-bsc.set_encryption('a5 1')
+msc.set_encryption('a5_1')
+bsc.set_encryption('a5_1')
 hlr.start()
 stp.start()
 msc.start()

-- 
To view, visit https://gerrit.osmocom.org/3815
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5265cc9990dd5e99dba1f6262b3a8c597a3e958d
Gerrit-PatchSet: 9
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list