Change in osmo-gsm-tester[master]: open5gs: Avoid use of non-standard ports

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/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Apr 12 11:48:32 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/23729 )


Change subject: open5gs: Avoid use of non-standard ports
......................................................................

open5gs: Avoid use of non-standard ports

Despite open5gs allowing to change the GTP ports in the config file, in
reality changing those values to something else than the standard prot
will fail. Hence, we must use the standard port. As a result, we must
use different IP addresses in each process to avoid ip+port collisions.
Let's use some loopback addresses which shouldn't require extra
configuration on the host, and still only requiring 1 run_node as per
existing EPCs, with the limitation that only 1 open5gs EPC instance can
be run at one in a given run_node.

Related: https://github.com/open5gs/open5gs/issues/897
Change-Id: Id3062c6ad9d6de4c6066547e1e46edad5da285c1
---
M src/osmo_gsm_tester/obj/epc_open5gs.py
M src/osmo_gsm_tester/templates/open5gs-mmed.yaml.tmpl
M src/osmo_gsm_tester/templates/open5gs-sgwcd.yaml.tmpl
M src/osmo_gsm_tester/templates/open5gs-sgwud.yaml.tmpl
M src/osmo_gsm_tester/templates/open5gs-smfd.yaml.tmpl
M src/osmo_gsm_tester/templates/open5gs-upfd.yaml.tmpl
6 files changed, 70 insertions(+), 51 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/29/23729/1

diff --git a/src/osmo_gsm_tester/obj/epc_open5gs.py b/src/osmo_gsm_tester/obj/epc_open5gs.py
index 15f4eab..feff901 100644
--- a/src/osmo_gsm_tester/obj/epc_open5gs.py
+++ b/src/osmo_gsm_tester/obj/epc_open5gs.py
@@ -39,7 +39,9 @@
     schema.register_config_schema('epc', config_schema)
 
 class Open5gsEPC(epc.EPC):
-
+##############
+# PROTECTED
+##############
     REMOTE_DIR = '/osmo-gsm-tester-open5gs'
 
     def __init__(self, testenv, run_node):
@@ -54,6 +56,43 @@
         self.sgwu = None
         self.subscriber_list = []
 
+    def configure(self):
+        values = super().configure(['open5gsepc'])
+        db_host = values['epc']['db_host']
+        db_uri = 'mongodb://'+db_host+'/open5gs'
+        config.overlay(values, dict(epc=dict(db_uri=db_uri,
+                                             tun_addr=self.tun_addr(),
+                                             addr_smf=self.priv_addr_smf(),
+                                             addr_upf=self.priv_addr_upf(),
+                                             addr_sgwc=self.priv_addr_sgwc(),
+                                             addr_sgwu=self.priv_addr_sgwu(),
+                                             )))
+        self.fill_subscribers_mongodb(values['epc']['db_host'], 27017)
+        self.pcrf = Open5gsPCRF(self.testenv, self)
+        self.upf = Open5gsUPF(self.testenv, self)
+        self.smf = Open5gsSMF(self.testenv, self)
+        self.hss = Open5gsHSS(self.testenv, self)
+        self.mme = Open5gsMME(self.testenv, self)
+        self.sgwc = Open5gsSGWC(self.testenv, self)
+        self.sgwu = Open5gsSGWU(self.testenv, self)
+        self.pcrf.configure(copy.deepcopy(values))
+        self.upf.configure(copy.deepcopy(values))
+        self.smf.configure(copy.deepcopy(values))
+        self.hss.configure(copy.deepcopy(values))
+        self.mme.configure(copy.deepcopy(values))
+        self.sgwc.configure(copy.deepcopy(values))
+        self.sgwu.configure(copy.deepcopy(values))
+
+    def gen_priv_addr(self, suffix):
+        if ':' in self.addr():
+            raise log.Error('IPv6 not implemented!')
+        public_suffix = self.addr()[self.addr().rindex('.')+1:]
+        return '127.0.' + public_suffix + '.' + str(suffix)
+
+########################
+# PUBLIC - INTERNAL API
+########################
+
     def cleanup(self):
         if self.pcrf:
             self.pcrf.cleanup()
@@ -70,27 +109,21 @@
         if self.sgwu:
             self.sgwu.cleanup()
 
-    def configure(self):
-        values = super().configure(['open5gsepc'])
-        db_host = values['epc']['db_host']
-        db_uri = 'mongodb://'+db_host+'/open5gs'
-        config.overlay(values, dict(epc=dict(db_uri=db_uri)))
-        self.fill_subscribers_mongodb(values['epc']['db_host'], 27017)
-        self.pcrf = Open5gsPCRF(self.testenv, self)
-        self.upf = Open5gsUPF(self.testenv, self)
-        self.smf = Open5gsSMF(self.testenv, self)
-        self.hss = Open5gsHSS(self.testenv, self)
-        self.mme = Open5gsMME(self.testenv, self)
-        self.sgwc = Open5gsSGWC(self.testenv, self)
-        self.sgwu = Open5gsSGWU(self.testenv, self)
-        self.pcrf.configure(copy.deepcopy(values))
-        self.upf.configure(copy.deepcopy(values))
-        self.smf.configure(copy.deepcopy(values))
-        self.hss.configure(copy.deepcopy(values))
-        self.mme.configure(copy.deepcopy(values))
-        self.sgwc.configure(copy.deepcopy(values))
-        self.sgwu.configure(copy.deepcopy(values))
+    def priv_addr_smf(self):
+        return self.gen_priv_addr(1)
 
+    def priv_addr_upf(self):
+        return self.gen_priv_addr(2)
+
+    def priv_addr_sgwc(self):
+        return self.gen_priv_addr(3)
+
+    def priv_addr_sgwu(self):
+        return self.gen_priv_addr(4)
+
+###################
+# PUBLIC (test API included)
+###################
     def start(self):
         self.log('Starting srsepc')
         self.run_dir = util.Dir(self.testenv.test().get_run_dir().new_dir(self.name()))
diff --git a/src/osmo_gsm_tester/templates/open5gs-mmed.yaml.tmpl b/src/osmo_gsm_tester/templates/open5gs-mmed.yaml.tmpl
index 9aec578..5c886e3 100644
--- a/src/osmo_gsm_tester/templates/open5gs-mmed.yaml.tmpl
+++ b/src/osmo_gsm_tester/templates/open5gs-mmed.yaml.tmpl
@@ -104,8 +104,7 @@
 #
 sgwc:
     gtpc:
-      - addr: ${epc.run_addr}
-        port: 2125
+      - addr: ${epc.addr_sgwc}
 
 #
 # smf:
@@ -146,8 +145,7 @@
 #        apn: volte
 smf:
     gtpc:
-      - addr: ${epc.run_addr}
-        port: 2124
+      - addr: ${epc.addr_smf}
 
 #
 # parameter:
diff --git a/src/osmo_gsm_tester/templates/open5gs-sgwcd.yaml.tmpl b/src/osmo_gsm_tester/templates/open5gs-sgwcd.yaml.tmpl
index 8d2bd1a..a1db7ed 100644
--- a/src/osmo_gsm_tester/templates/open5gs-sgwcd.yaml.tmpl
+++ b/src/osmo_gsm_tester/templates/open5gs-sgwcd.yaml.tmpl
@@ -52,11 +52,9 @@
 #
 sgwc:
     gtpc:
-      - addr: ${epc.run_addr}
-        port: 2125
+      - addr: ${epc.addr_sgwc}
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8805
+      - addr: ${epc.addr_sgwc}
 
 #
 # sgwu:
@@ -112,8 +110,7 @@
 #
 sgwu:
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8806
+      - addr: ${epc.addr_sgwu}
 
 #
 # parameter:
diff --git a/src/osmo_gsm_tester/templates/open5gs-sgwud.yaml.tmpl b/src/osmo_gsm_tester/templates/open5gs-sgwud.yaml.tmpl
index 27dd55c..f0e2384 100644
--- a/src/osmo_gsm_tester/templates/open5gs-sgwud.yaml.tmpl
+++ b/src/osmo_gsm_tester/templates/open5gs-sgwud.yaml.tmpl
@@ -49,8 +49,7 @@
 #
 sgwu:
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8806
+      - addr: ${epc.addr_sgwu}
     gtpu:
       - addr: ${epc.run_addr}
         port: 2152
@@ -67,8 +66,7 @@
 #
 sgwc:
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8805
+      - addr: ${epc.addr_sgwc}
 
 #
 # parameter:
diff --git a/src/osmo_gsm_tester/templates/open5gs-smfd.yaml.tmpl b/src/osmo_gsm_tester/templates/open5gs-smfd.yaml.tmpl
index 0e01337..4a030d6 100644
--- a/src/osmo_gsm_tester/templates/open5gs-smfd.yaml.tmpl
+++ b/src/osmo_gsm_tester/templates/open5gs-smfd.yaml.tmpl
@@ -20,6 +20,7 @@
 #
 logger:
     file: ${smf.log_filename}
+    level: debug
 #
 # smf:
 #
@@ -310,22 +311,17 @@
       - addr: ${epc.run_addr}
         port: 7777
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8808
+      - addr: ${epc.addr_smf}
     gtpc:
-      - addr: ${epc.run_addr}
-        port: 2124
+      - addr: ${epc.addr_smf}
     gtpu:
       - addr: ${epc.run_addr}
         port: 2153
     subnet:
-      - addr: 10.45.0.1/16
-      - addr: 2001:230:cafe::1/48
+      - addr: ${epc.tun_addr}/16
     dns:
       - 8.8.8.8
       - 8.8.4.4
-      - 2001:4860:4860::8888
-      - 2001:4860:4860::8844
     mtu: 1400
     freeDiameter: ${smf.diameter_filename}
 
@@ -415,8 +411,7 @@
 #
 upf:
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8807
+      - addr: ${epc.addr_upf}
 
 #
 # parameter:
diff --git a/src/osmo_gsm_tester/templates/open5gs-upfd.yaml.tmpl b/src/osmo_gsm_tester/templates/open5gs-upfd.yaml.tmpl
index 4f7a25d..4fd77f6 100644
--- a/src/osmo_gsm_tester/templates/open5gs-upfd.yaml.tmpl
+++ b/src/osmo_gsm_tester/templates/open5gs-upfd.yaml.tmpl
@@ -20,6 +20,7 @@
 #
 logger:
     file: ${upf.log_filename}
+    level: debug
 
 #
 # upf:
@@ -104,14 +105,12 @@
 #
 upf:
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8807
+      - addr: ${epc.addr_upf}
     gtpu:
       - addr: ${epc.run_addr}
         port: 2154
     subnet:
-      - addr: 10.45.0.1/16
-      - addr: 2001:230:cafe::1/48
+      - addr: ${epc.tun_addr}/16
 
 #
 # smf:
@@ -125,8 +124,7 @@
 #
 smf:
     pfcp:
-      - addr: ${epc.run_addr}
-        port: 8808
+      - addr: ${epc.addr_smf}
 
 #
 # parameter:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/23729
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: Id3062c6ad9d6de4c6066547e1e46edad5da285c1
Gerrit-Change-Number: 23729
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210412/031659ab/attachment.htm>


More information about the gerrit-log mailing list