From b6c13439ae75bd02b94f8d344fc9f253910fc5ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joanne=20Hug=C3=A9?= <joanne.huge@nexedi.com>
Date: Fri, 3 Feb 2023 15:31:34 +0100
Subject: [PATCH] software/ors-amarisoft: add gnb_id_bits parameter

---
 software/ors-amarisoft/buildout.hash.cfg                    | 2 +-
 software/ors-amarisoft/config/gnb.jinja2.cfg                | 2 +-
 .../ors-amarisoft/instance-gnb-input-schema.json.jinja2     | 6 ++++++
 .../instance-tdd1900-gnb-epc-input-schema.json              | 6 ++++++
 .../ors-amarisoft/instance-tdd1900-gnb-input-schema.json    | 6 ++++++
 .../instance-tdd2600-gnb-epc-input-schema.json              | 6 ++++++
 .../ors-amarisoft/instance-tdd2600-gnb-input-schema.json    | 6 ++++++
 .../instance-tdd3500-gnb-epc-input-schema.json              | 6 ++++++
 .../ors-amarisoft/instance-tdd3500-gnb-input-schema.json    | 6 ++++++
 .../instance-tdd3700-gnb-epc-input-schema.json              | 6 ++++++
 .../ors-amarisoft/instance-tdd3700-gnb-input-schema.json    | 6 ++++++
 software/ors-amarisoft/test/test.jinja2.py                  | 2 ++
 software/ors-amarisoft/test/testTDD1900.py                  | 2 ++
 software/ors-amarisoft/test/testTDD2600.py                  | 2 ++
 software/ors-amarisoft/test/testTDD3500.py                  | 2 ++
 software/ors-amarisoft/test/testTDD3700.py                  | 2 ++
 16 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/software/ors-amarisoft/buildout.hash.cfg b/software/ors-amarisoft/buildout.hash.cfg
index cb84bd24d..db6942ed0 100644
--- a/software/ors-amarisoft/buildout.hash.cfg
+++ b/software/ors-amarisoft/buildout.hash.cfg
@@ -76,7 +76,7 @@ md5sum = b377dac7f1fcf94fb9ce9ebed617f36a
 
 [gnb.jinja2.cfg]
 filename = config/gnb.jinja2.cfg
-md5sum = 2e051b91c39542152bc679ec78cb5926
+md5sum = cbbbdeda9ddaaf5957d91ef31afe6051
 
 [ltelogs.jinja2.sh]
 filename = ltelogs.jinja2.sh
diff --git a/software/ors-amarisoft/config/gnb.jinja2.cfg b/software/ors-amarisoft/config/gnb.jinja2.cfg
index 453f0caf4..85c53c9fb 100644
--- a/software/ors-amarisoft/config/gnb.jinja2.cfg
+++ b/software/ors-amarisoft/config/gnb.jinja2.cfg
@@ -68,7 +68,7 @@
   gtp_addr: "127.0.1.1",
 {% endif %}
 
-  gnb_id_bits: 28,
+  gnb_id_bits: {{ slapparameter_dict.get('gnb_id_bits', 28) }},
   gnb_id: {{ slapparameter_dict.get('gnb_id', '0x12345') }},
 
   nr_support: true,
diff --git a/software/ors-amarisoft/instance-gnb-input-schema.json.jinja2 b/software/ors-amarisoft/instance-gnb-input-schema.json.jinja2
index c5a6a3b76..8b948fd13 100644
--- a/software/ors-amarisoft/instance-gnb-input-schema.json.jinja2
+++ b/software/ors-amarisoft/instance-gnb-input-schema.json.jinja2
@@ -87,6 +87,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd1900-gnb-epc-input-schema.json b/software/ors-amarisoft/instance-tdd1900-gnb-epc-input-schema.json
index 0c0288b7a..baec8f78f 100644
--- a/software/ors-amarisoft/instance-tdd1900-gnb-epc-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd1900-gnb-epc-input-schema.json
@@ -85,6 +85,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd1900-gnb-input-schema.json b/software/ors-amarisoft/instance-tdd1900-gnb-input-schema.json
index d99a507fa..ac7053001 100644
--- a/software/ors-amarisoft/instance-tdd1900-gnb-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd1900-gnb-input-schema.json
@@ -67,6 +67,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd2600-gnb-epc-input-schema.json b/software/ors-amarisoft/instance-tdd2600-gnb-epc-input-schema.json
index 38bff4745..382af4dd2 100644
--- a/software/ors-amarisoft/instance-tdd2600-gnb-epc-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd2600-gnb-epc-input-schema.json
@@ -85,6 +85,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd2600-gnb-input-schema.json b/software/ors-amarisoft/instance-tdd2600-gnb-input-schema.json
index f5f2a0bda..47b2f1630 100644
--- a/software/ors-amarisoft/instance-tdd2600-gnb-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd2600-gnb-input-schema.json
@@ -67,6 +67,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd3500-gnb-epc-input-schema.json b/software/ors-amarisoft/instance-tdd3500-gnb-epc-input-schema.json
index 182c30221..e397ab17e 100644
--- a/software/ors-amarisoft/instance-tdd3500-gnb-epc-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd3500-gnb-epc-input-schema.json
@@ -85,6 +85,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd3500-gnb-input-schema.json b/software/ors-amarisoft/instance-tdd3500-gnb-input-schema.json
index 76b47e222..8218a7a45 100644
--- a/software/ors-amarisoft/instance-tdd3500-gnb-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd3500-gnb-input-schema.json
@@ -67,6 +67,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd3700-gnb-epc-input-schema.json b/software/ors-amarisoft/instance-tdd3700-gnb-epc-input-schema.json
index 830c0ba15..a98621381 100644
--- a/software/ors-amarisoft/instance-tdd3700-gnb-epc-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd3700-gnb-epc-input-schema.json
@@ -85,6 +85,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/instance-tdd3700-gnb-input-schema.json b/software/ors-amarisoft/instance-tdd3700-gnb-input-schema.json
index 873779c6d..a1e976442 100644
--- a/software/ors-amarisoft/instance-tdd3700-gnb-input-schema.json
+++ b/software/ors-amarisoft/instance-tdd3700-gnb-input-schema.json
@@ -67,6 +67,12 @@
       "type": "string",
       "default": "0x12345"
     },
+    "gnb_id_bits": {
+      "title": "gNB ID bits",
+      "description": "Number of bits for the gNodeB global identifier. (range 22 to 32)",
+      "type": "number",
+      "default": 28
+    },
     "pci": {
       "title": "Physical Cell ID",
       "description": "Physical Cell ID",
diff --git a/software/ors-amarisoft/test/test.jinja2.py b/software/ors-amarisoft/test/test.jinja2.py
index 1d3d8ce22..464e22173 100644
--- a/software/ors-amarisoft/test/test.jinja2.py
+++ b/software/ors-amarisoft/test/test.jinja2.py
@@ -66,6 +66,7 @@ param_dict = {
     'n_antenna_ul': 2,
     'inactivity_timer': 17,
     'gnb_id': "0x17",
+    'gnb_id_bits': 30,
     'ssb_pos_bitmap': "10",
     'amf_list': {
         '10.0.0.1': {'amf_addr': '10.0.0.1'},
@@ -133,6 +134,7 @@ def test_gnb_conf1(self):
         self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
         self.assertEqual(conf['nr_cell_default']['n_id_cell'], gnb_param_dict1['pci'])
         self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
+        self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
         for p in conf['nr_cell_default']['plmn_list']:
           for n in "plmn ranac reserved tac".split():
               self.assertEqual(p[n], gnb_param_dict1['plmn_list'][p['plmn']][n])
diff --git a/software/ors-amarisoft/test/testTDD1900.py b/software/ors-amarisoft/test/testTDD1900.py
index 407444a4e..06ff29015 100644
--- a/software/ors-amarisoft/test/testTDD1900.py
+++ b/software/ors-amarisoft/test/testTDD1900.py
@@ -66,6 +66,7 @@ param_dict = {
     'n_antenna_ul': 2,
     'inactivity_timer': 17,
     'gnb_id': "0x17",
+    'gnb_id_bits': 30,
     'ssb_pos_bitmap': "10",
     'amf_list': {
         '10.0.0.1': {'amf_addr': '10.0.0.1'},
@@ -133,6 +134,7 @@ def test_gnb_conf1(self):
         self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
         self.assertEqual(conf['nr_cell_default']['n_id_cell'], gnb_param_dict1['pci'])
         self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
+        self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
         for p in conf['nr_cell_default']['plmn_list']:
           for n in "plmn ranac reserved tac".split():
               self.assertEqual(p[n], gnb_param_dict1['plmn_list'][p['plmn']][n])
diff --git a/software/ors-amarisoft/test/testTDD2600.py b/software/ors-amarisoft/test/testTDD2600.py
index a0d1d6ca3..a831a197b 100644
--- a/software/ors-amarisoft/test/testTDD2600.py
+++ b/software/ors-amarisoft/test/testTDD2600.py
@@ -66,6 +66,7 @@ param_dict = {
     'n_antenna_ul': 2,
     'inactivity_timer': 17,
     'gnb_id': "0x17",
+    'gnb_id_bits': 30,
     'ssb_pos_bitmap': "10",
     'amf_list': {
         '10.0.0.1': {'amf_addr': '10.0.0.1'},
@@ -133,6 +134,7 @@ def test_gnb_conf1(self):
         self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
         self.assertEqual(conf['nr_cell_default']['n_id_cell'], gnb_param_dict1['pci'])
         self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
+        self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
         for p in conf['nr_cell_default']['plmn_list']:
           for n in "plmn ranac reserved tac".split():
               self.assertEqual(p[n], gnb_param_dict1['plmn_list'][p['plmn']][n])
diff --git a/software/ors-amarisoft/test/testTDD3500.py b/software/ors-amarisoft/test/testTDD3500.py
index 04266908a..4a35264ac 100644
--- a/software/ors-amarisoft/test/testTDD3500.py
+++ b/software/ors-amarisoft/test/testTDD3500.py
@@ -66,6 +66,7 @@ param_dict = {
     'n_antenna_ul': 2,
     'inactivity_timer': 17,
     'gnb_id': "0x17",
+    'gnb_id_bits': 30,
     'ssb_pos_bitmap': "10",
     'amf_list': {
         '10.0.0.1': {'amf_addr': '10.0.0.1'},
@@ -133,6 +134,7 @@ def test_gnb_conf1(self):
         self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
         self.assertEqual(conf['nr_cell_default']['n_id_cell'], gnb_param_dict1['pci'])
         self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
+        self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
         for p in conf['nr_cell_default']['plmn_list']:
           for n in "plmn ranac reserved tac".split():
               self.assertEqual(p[n], gnb_param_dict1['plmn_list'][p['plmn']][n])
diff --git a/software/ors-amarisoft/test/testTDD3700.py b/software/ors-amarisoft/test/testTDD3700.py
index 3b8586dbd..0741f51ff 100644
--- a/software/ors-amarisoft/test/testTDD3700.py
+++ b/software/ors-amarisoft/test/testTDD3700.py
@@ -66,6 +66,7 @@ param_dict = {
     'n_antenna_ul': 2,
     'inactivity_timer': 17,
     'gnb_id': "0x17",
+    'gnb_id_bits': 30,
     'ssb_pos_bitmap': "10",
     'amf_list': {
         '10.0.0.1': {'amf_addr': '10.0.0.1'},
@@ -133,6 +134,7 @@ def test_gnb_conf1(self):
         self.assertEqual(conf['nr_cell_list'][0]['ssb_pos_bitmap'], gnb_param_dict1['ssb_pos_bitmap'])
         self.assertEqual(conf['nr_cell_default']['n_id_cell'], gnb_param_dict1['pci'])
         self.assertEqual(conf['gnb_id'], int(gnb_param_dict1['gnb_id'], 16))
+        self.assertEqual(conf['gnb_id_bits'], gnb_param_dict1['gnb_id_bits'])
         for p in conf['nr_cell_default']['plmn_list']:
           for n in "plmn ranac reserved tac".split():
               self.assertEqual(p[n], gnb_param_dict1['plmn_list'][p['plmn']][n])
-- 
2.30.9