Skip to content

Commit

Permalink
Merge pull request #137 from YouShengLiu/twif
Browse files Browse the repository at this point in the history
fix: choice extensions for TWIF
  • Loading branch information
ianchen0119 authored Aug 22, 2024
2 parents b46ca98 + 799103d commit 4e7a912
Showing 1 changed file with 58 additions and 21 deletions.
79 changes: 58 additions & 21 deletions internal/context/ran_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,32 +256,69 @@ func (ranUe *RanUe) UpdateLocation(userLocationInformation *ngapType.UserLocatio
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)
}
switch userLocationInformation.ChoiceExtensions.UserLocationInformationExtIEs.Id.Value {
case ngapType.ProtocolIEIDUserLocationInformationTNGF:
// TNGF
userLocationInformationExtIEsValue := userLocationInformation.
ChoiceExtensions.UserLocationInformationExtIEs.Value.UserLocationInformationTNGF
if ranUe.Location.N3gaLocation == nil {
ranUe.Location.N3gaLocation = new(models.N3gaLocation)
}

ip := userLocationInformationExtIEsValue.IPAddress
// port := userLocationInformationExtIEsValue.PortNumber
ip := userLocationInformationExtIEsValue.IPAddress
// port := userLocationInformationExtIEsValue.PortNumber

ipv4Addr, ipv6Addr := ngapConvert.IPAddressToString(ip)
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)
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
if ranUe.AmfUe != nil {
ranUe.AmfUe.Location = deepcopy.Copy(ranUe.Location).(models.UserLocation)
ranUe.AmfUe.Tai = *ranUe.Location.N3gaLocation.N3gppTai
}
case ngapType.ProtocolIEIDUserLocationInformationTWIF:
// TWIF
userLocationInformationExtIEsValue := userLocationInformation.
ChoiceExtensions.UserLocationInformationExtIEs.Value.UserLocationInformationTWIF

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
}

case ngapType.ProtocolIEIDUserLocationInformationWAGF:
// W-AGF
}

case ngapType.UserLocationInformationPresentNothing:
}
}

0 comments on commit 4e7a912

Please sign in to comment.