Skip to content

Commit

Permalink
add tngf ran ue info
Browse files Browse the repository at this point in the history
  • Loading branch information
tsc11539 committed Feb 7, 2024
1 parent 5cd14b2 commit 13ce776
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/context/amf_ran.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ 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
Expand Down
9 changes: 6 additions & 3 deletions internal/context/amf_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ type AmfUe struct {
KnasInt [16]uint8 // 16 byte
KnasEnc [16]uint8 // 16 byte
Kgnb []uint8 // 32 byte
Kn3iwf []uint8 // 32 byte
// Kn3iwf []uint8 // 32 byte
Knon3gpp []uint8 // 32 byte
NH []uint8 // 32 byte
NCC uint8 // 0..7
ULCount security.Count
Expand Down Expand Up @@ -535,7 +536,8 @@ func (ue *AmfUe) DerivateAnKey(anType models.AccessType) {
case security.AccessType3GPP:
ue.Kgnb = key
case security.AccessTypeNon3GPP:
ue.Kn3iwf = key
// ue.Kn3iwf = key
ue.Knon3gpp = key
}
}

Expand All @@ -562,7 +564,8 @@ func (ue *AmfUe) UpdateSecurityContext(anType models.AccessType) {
case models.AccessType__3_GPP_ACCESS:
ue.DerivateNH(ue.Kgnb)
case models.AccessType_NON_3_GPP_ACCESS:
ue.DerivateNH(ue.Kn3iwf)
// ue.DerivateNH(ue.Kn3iwf)
ue.DerivateNH(ue.Knon3gpp)
}
ue.NCC = 1
}
Expand Down
26 changes: 26 additions & 0 deletions internal/context/ran_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,32 @@ 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
Expand Down

0 comments on commit 13ce776

Please sign in to comment.