From 96f667f06f33bc1c0293631cc3908edf505cb2ff Mon Sep 17 00:00:00 2001 From: Hiro <147632749+Hiro6666@users.noreply.github.com> Date: Fri, 3 May 2024 21:32:34 +0800 Subject: [PATCH] Add TNGF (#124) * feat: add tngf ran ue info * fix: tngf change Kn3iwf to Knon3gpp * fix: tngf delete Kn3iwf * fix: change Kno3gpp back to Kn3iwf * fix: fix dependecies conflict * fix: upgrade ngap version * fix: fix linter --------- Co-authored-by: tsc --- go.mod | 2 +- go.sum | 4 ++-- internal/context/amf_ran.go | 3 ++- internal/context/ran_ue.go | 27 +++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index e9507500..386c7b4f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/davecgh/go-spew v1.1.1 github.com/free5gc/aper v1.0.5 github.com/free5gc/nas v1.1.3 - github.com/free5gc/ngap v1.0.8 + github.com/free5gc/ngap v1.0.9-0.20240414165820-453b0aa37228 github.com/free5gc/openapi v1.0.8 github.com/free5gc/sctp v1.0.0 github.com/free5gc/util v1.0.6 diff --git a/go.sum b/go.sum index 40235598..15d1b4a0 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,8 @@ github.com/free5gc/aper v1.0.5 h1:sUYFFmOXDLjyL4rU6zFnq81M4YluqP90Pso5e/J4UhA= github.com/free5gc/aper v1.0.5/go.mod h1:ybHxhYnRqQ9wD4yB9r/3MZdbCYCjtqUyfLpSnJpwWd4= github.com/free5gc/nas v1.1.3 h1:eYkvT8GGieD06MExw3JLeIPA88Yg89DFjptVBnadIyQ= github.com/free5gc/nas v1.1.3/go.mod h1:PMyj7SQ6+JWHie/ESmy6pZJrYMlqNxowAgCnrZNyvoI= -github.com/free5gc/ngap v1.0.8 h1:ffzSJW26qbZolwbL8yIjrCoEn7PUc/VE91f/zjJIFMs= -github.com/free5gc/ngap v1.0.8/go.mod h1:d5u7tYsBwxmLr3zw7wyBruRjc/gbdsHVhmdGFnVmfBU= +github.com/free5gc/ngap v1.0.9-0.20240414165820-453b0aa37228 h1:47Wa0ZdDI1r+IXbU6sVnMxRd9zZ4sQjXZxIQPXpitDg= +github.com/free5gc/ngap v1.0.9-0.20240414165820-453b0aa37228/go.mod h1:d5u7tYsBwxmLr3zw7wyBruRjc/gbdsHVhmdGFnVmfBU= github.com/free5gc/openapi v1.0.8 h1:QjfQdB6VVA1GRnzOJ7nILzrI7gMiY0lH64JHVW7vF34= github.com/free5gc/openapi v1.0.8/go.mod h1:w6y9P/uySczc1d9OJZAEuB2FImR/z60Wg2BekPAVt3M= github.com/free5gc/sctp v1.0.0 h1:V868MT9yyF2I8uotLCEjLULmhTzrLKxPBvsqFk82xGI= diff --git a/internal/context/amf_ran.go b/internal/context/amf_ran.go index 49ee47a5..9fb3905a 100644 --- a/internal/context/amf_ran.go +++ b/internal/context/amf_ran.go @@ -110,7 +110,8 @@ func (ran *AmfRan) SetRanId(ranNodeId *ngapType.GlobalRANNodeID) { ranId := ngapConvert.RanIdToModels(*ranNodeId) ran.RanPresent = ranNodeId.Present ran.RanId = &ranId - if ranNodeId.Present == ngapType.GlobalRANNodeIDPresentGlobalN3IWFID { + if ranNodeId.Present == ngapType.GlobalRANNodeIDPresentGlobalN3IWFID || + ranNodeId.Present == ngapType.GlobalRANNodeIDPresentChoiceExtensions { ran.AnType = models.AccessType_NON_3_GPP_ACCESS } else { ran.AnType = models.AccessType__3_GPP_ACCESS diff --git a/internal/context/ran_ue.go b/internal/context/ran_ue.go index 437c3190..198cbce9 100644 --- a/internal/context/ran_ue.go +++ b/internal/context/ran_ue.go @@ -250,6 +250,33 @@ func (ranUe *RanUe) UpdateLocation(userLocationInformation *ngapType.UserLocatio } ranUe.Tai = deepcopy.Copy(*ranUe.Location.N3gaLocation.N3gppTai).(models.Tai) + if ranUe.AmfUe != nil { + ranUe.AmfUe.Location = deepcopy.Copy(ranUe.Location).(models.UserLocation) + ranUe.AmfUe.Tai = *ranUe.Location.N3gaLocation.N3gppTai + } + case ngapType.UserLocationInformationPresentChoiceExtensions: + userLocationInformationExtIEsValue := userLocationInformation. + ChoiceExtensions.UserLocationInformationExtIEs.Value.UserLocationInformationTNGF + if ranUe.Location.N3gaLocation == nil { + ranUe.Location.N3gaLocation = new(models.N3gaLocation) + } + + ip := userLocationInformationExtIEsValue.IPAddress + // port := userLocationInformationExtIEsValue.PortNumber + + ipv4Addr, ipv6Addr := ngapConvert.IPAddressToString(ip) + + ranUe.Location.N3gaLocation.UeIpv4Addr = ipv4Addr + ranUe.Location.N3gaLocation.UeIpv6Addr = ipv6Addr + // ranUe.Location.N3gaLocation.PortNumber = ngapConvert.PortNumberToInt(port) + // N3GPP TAI is operator-specific + // TODO: define N3GPP TAI + ranUe.Location.N3gaLocation.N3gppTai = &models.Tai{ + PlmnId: amfSelf.SupportTaiLists[0].PlmnId, + Tac: amfSelf.SupportTaiLists[0].Tac, + } + ranUe.Tai = deepcopy.Copy(*ranUe.Location.N3gaLocation.N3gppTai).(models.Tai) + if ranUe.AmfUe != nil { ranUe.AmfUe.Location = deepcopy.Copy(ranUe.Location).(models.UserLocation) ranUe.AmfUe.Tai = *ranUe.Location.N3gaLocation.N3gppTai