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
This commit is contained in:
parent
0696c60812
commit
d776059deb
|
@ -39,7 +39,9 @@ def on_register_schemas():
|
|||
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 @@ class Open5gsEPC(epc.EPC):
|
|||
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 @@ class Open5gsEPC(epc.EPC):
|
|||
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()))
|
||||
|
|
|
@ -104,8 +104,7 @@ mme:
|
|||
#
|
||||
sgwc:
|
||||
gtpc:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 2125
|
||||
- addr: ${epc.addr_sgwc}
|
||||
|
||||
#
|
||||
# smf:
|
||||
|
@ -146,8 +145,7 @@ sgwc:
|
|||
# apn: volte
|
||||
smf:
|
||||
gtpc:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 2124
|
||||
- addr: ${epc.addr_smf}
|
||||
|
||||
#
|
||||
# parameter:
|
||||
|
|
|
@ -52,11 +52,9 @@ logger:
|
|||
#
|
||||
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 @@ sgwc:
|
|||
#
|
||||
sgwu:
|
||||
pfcp:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 8806
|
||||
- addr: ${epc.addr_sgwu}
|
||||
|
||||
#
|
||||
# parameter:
|
||||
|
|
|
@ -49,8 +49,7 @@ logger:
|
|||
#
|
||||
sgwu:
|
||||
pfcp:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 8806
|
||||
- addr: ${epc.addr_sgwu}
|
||||
gtpu:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 2152
|
||||
|
@ -67,8 +66,7 @@ sgwu:
|
|||
#
|
||||
sgwc:
|
||||
pfcp:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 8805
|
||||
- addr: ${epc.addr_sgwc}
|
||||
|
||||
#
|
||||
# parameter:
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#
|
||||
logger:
|
||||
file: ${smf.log_filename}
|
||||
level: debug
|
||||
#
|
||||
# smf:
|
||||
#
|
||||
|
@ -310,22 +311,17 @@ smf:
|
|||
- 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 @@ nrf:
|
|||
#
|
||||
upf:
|
||||
pfcp:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 8807
|
||||
- addr: ${epc.addr_upf}
|
||||
|
||||
#
|
||||
# parameter:
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#
|
||||
logger:
|
||||
file: ${upf.log_filename}
|
||||
level: debug
|
||||
|
||||
#
|
||||
# upf:
|
||||
|
@ -104,14 +105,12 @@ logger:
|
|||
#
|
||||
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 @@ upf:
|
|||
#
|
||||
smf:
|
||||
pfcp:
|
||||
- addr: ${epc.run_addr}
|
||||
port: 8808
|
||||
- addr: ${epc.addr_smf}
|
||||
|
||||
#
|
||||
# parameter:
|
||||
|
|
Loading…
Reference in New Issue