@@ -1627,8 +1627,6 @@ func handleHandoverRequiredMain(ran *context.AmfRan,
16271627 // handover between different AMF
16281628 sourceUe .Log .Warnf ("Handover required : cannot find target Ran Node Id[%+v] in this AMF" , targetRanNodeId )
16291629 sourceUe .Log .Error ("Handover between different AMF has not been implemented yet" )
1630- // return
1631- // return
16321630 // TODO: Send to T-AMF
16331631 // Described in (23.502 4.9.1.3.2) step 3.Namf_Communication_CreateUEContext Request
16341632 var ueContextCreateData models.UeContextCreateData
@@ -1696,154 +1694,6 @@ func handleHandoverRequiredMain(ran *context.AmfRan,
16961694 item .PDUSessionID .Value = int64 (N2SmInfo .PduSessionId )
16971695 }
16981696
1699- ngap_message .SendHandoverCommand (sourceUe , pduSessionResourceHandoverList , pduSessionResourceToReleaseList ,
1700- * targetToSourceTransparentContainer , nil )
1701- /*
1702- // describe in 23.502 4.9.1.3.2 step11
1703- if pDUSessionResourceAdmittedList != nil {
1704- targetUe.Log.Infof("Send HandoverRequestAcknowledgeTransfer to SMF")
1705- for _, item := range pDUSessionResourceAdmittedList.List { /*
1706- pduSessionID := int32(item.PDUSessionID.Value)
1707- transfer := item.HandoverRequestAcknowledgeTransfer
1708- smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
1709- if !ok {
1710- targetUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
1711- // TODO: Check if doing error handling here
1712- continue
1713- }
1714- resp, errResponse, problemDetails, err := consumer.GetConsumer().SendUpdateSmContextN2HandoverPrepared(amfUe,
1715- smContext, models.N2SmInfoType_HANDOVER_REQ_ACK, transfer)
1716- if err != nil {
1717- targetUe.Log.Errorf("Send HandoverRequestAcknowledgeTransfer error: %v", err)
1718- }
1719- if problemDetails != nil {
1720- targetUe.Log.Warnf("ProblemDetails[status: %d, Cause: %s]", problemDetails.Status, problemDetails.Cause)
1721- }
1722- if resp != nil && resp.BinaryDataN2SmInformation != nil {
1723- handoverItem := ngapType.PDUSessionResourceHandoverItem{}
1724- handoverItem.PDUSessionID = item.PDUSessionID
1725- handoverItem.HandoverCommandTransfer = resp.BinaryDataN2SmInformation
1726- pduSessionResourceHandoverList.List = append(pduSessionResourceHandoverList.List, handoverItem)
1727- targetUe.SuccessPduSessionId = append(targetUe.SuccessPduSessionId, pduSessionID)
1728- }
1729- if errResponse != nil && errResponse.BinaryDataN2SmInformation != nil {
1730- releaseItem := ngapType.PDUSessionResourceToReleaseItemHOCmd{}
1731- releaseItem.PDUSessionID = item.PDUSessionID
1732- releaseItem.HandoverPreparationUnsuccessfulTransfer = errResponse.BinaryDataN2SmInformation
1733- pduSessionResourceToReleaseList.List = append(pduSessionResourceToReleaseList.List, releaseItem)
1734- }
1735- }
1736- }
1737-
1738- if pDUSessionResourceFailedToSetupListHOAck != nil {
1739- targetUe.Log.Infof("Send HandoverResourceAllocationUnsuccessfulTransfer to SMF")
1740- for _, item := range pDUSessionResourceFailedToSetupListHOAck.List {
1741- pduSessionID := int32(item.PDUSessionID.Value)
1742- transfer := item.HandoverResourceAllocationUnsuccessfulTransfer
1743- smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
1744- if !ok {
1745- targetUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
1746- // TODO: Check if doing error handling here
1747- continue
1748- }
1749- _, _, problemDetails, err := consumer.GetConsumer().SendUpdateSmContextN2HandoverPrepared(amfUe, smContext,
1750- models.N2SmInfoType_HANDOVER_RES_ALLOC_FAIL, transfer)
1751- if err != nil {
1752- targetUe.Log.Errorf("Send HandoverResourceAllocationUnsuccessfulTransfer error: %v", err)
1753- }
1754- if problemDetails != nil {
1755- targetUe.Log.Warnf("ProblemDetails[status: %d, Cause: %s]", problemDetails.Status, problemDetails.Cause)
1756- }
1757- }
1758- }
1759-
1760- sourceUe := targetUe.SourceUe
1761- if sourceUe == nil {
1762- // TODO: Send Namf_Communication_CreateUEContext Response to S-AMF
1763- ran.Log.Error("handover between different Ue has not been implement yet")
1764- } else {
1765- ran.Log.Tracef("Source: RanUeNgapID[%d] AmfUeNgapID[%d]", sourceUe.RanUeNgapId, sourceUe.AmfUeNgapId)
1766- ran.Log.Tracef("Target: RanUeNgapID[%d] AmfUeNgapID[%d]", targetUe.RanUeNgapId, targetUe.AmfUeNgapId)
1767- if len(pduSessionResourceHandoverList.List) == 0 {
1768- targetUe.Log.Info("Handle Handover Preparation Failure [HoFailure In Target5GC NgranNode Or TargetSystem]")
1769- cause := &ngapType.Cause{
1770- Present: ngapType.CausePresentRadioNetwork,
1771- RadioNetwork: &ngapType.CauseRadioNetwork{
1772- Value: ngapType.CauseRadioNetworkPresentHoFailureInTarget5GCNgranNodeOrTargetSystem,
1773- },
1774- }
1775- ngap_message.SendHandoverPreparationFailure(sourceUe, *cause, nil)
1776- return
1777- }
1778- ngap_message.SendHandoverCommand(sourceUe, pduSessionResourceHandoverList, pduSessionResourceToReleaseList,
1779- *targetToSourceTransparentContainer, nil)
1780- } */
1781- }
1782- var ueContextCreateData models.UeContextCreateData
1783- ueContextCreateData .UeContext .Supi = amfUe .Supi
1784- ueContextCreateData .UeContext .SupiUnauthInd = amfUe .UnauthenticatedSupi
1785- ueContextCreateData .UeContext .UdmGroupId = amfUe .UdmGroupId
1786- ueContextCreateData .UeContext .AusfGroupId = amfUe .AusfGroupId
1787- ueContextCreateData .UeContext .RestrictedPrimaryRatList [0 ] = amfUe .RatType
1788-
1789- ueContextCreateData .TargetId .RanNodeId = & targetRanNodeId
1790- ueContextCreateData .TargetId .Tai = & amfUe .Tai
1791-
1792- ueContextCreateData .PduSessionList = make ([]models.N2SmInformation , 0 )
1793- for _ , pDUSessionResourceHoItem := range pDUSessionResourceListHORqd .List {
1794- pduSessionID := int32 (pDUSessionResourceHoItem .PDUSessionID .Value )
1795- smContext , okSmContextFindByPDUSessionID := amfUe .SmContextFindByPDUSessionID (pduSessionID )
1796- if ! okSmContextFindByPDUSessionID {
1797- sourceUe .Log .Warnf ("SmContext[PDU Session ID:%d] not found" , pduSessionID )
1798- // TODO: Check if doing error handling here
1799- continue
1800- }
1801- snssai := smContext .Snssai ()
1802- ueContextCreateData .PduSessionList = append (ueContextCreateData .PduSessionList , models.N2SmInformation {
1803- PduSessionId : pduSessionID ,
1804- SNssai : & snssai ,
1805- })
1806- }
1807-
1808- ueContextCreateData .SourceToTargetData .NgapIeType = models .AmfCommunicationNgapIeType_HANDOVER_REQUIRED
1809- ueContextCreateData .SourceToTargetData .NgapData .ContentId = "N2SmInfo"
1810-
1811- ueContextCreateData .N2NotifyUri = ""
1812- ueContextCreatedData , targetToSourceTransparentContainer , problemDetails , err := consumer .GetConsumer ().CreateUEContextRequest (amfUe , ueContextCreateData )
1813-
1814- if problemDetails != nil {
1815- // get UeContextCreateError (HANDOVER FAILURE) from target AMF.
1816- // Send Handover Preparation Failure to source RAN (described in TS 38.413 8.4.1.3).
1817- sourceUe .Log .Info ("Handle Handover Preparation Failure [HoFailure In Target5GC NgranNode Or TargetSystem]" )
1818- cause = & ngapType.Cause {
1819- Present : ngapType .CausePresentRadioNetwork ,
1820- RadioNetwork : & ngapType.CauseRadioNetwork {
1821- Value : ngapType .CauseRadioNetworkPresentHoFailureInTarget5GCNgranNodeOrTargetSystem ,
1822- },
1823- }
1824- ngap_message .SendHandoverPreparationFailure (sourceUe , * cause , nil )
1825- return
1826- } else if err != nil {
1827- // error occurred in S-AMF.
1828- sourceUe .Log .Errorf ("CreateUEContextRequest Error in source AMF: %s" , err .Error ())
1829- cause = & ngapType.Cause {
1830- Present : ngapType .CausePresentRadioNetwork ,
1831- RadioNetwork : & ngapType.CauseRadioNetwork {
1832- Value : ngapType .CauseRadioNetworkPresentUnspecified ,
1833- },
1834- }
1835- ngap_message .SendHandoverPreparationFailure (sourceUe , * cause , nil )
1836- } else {
1837- // Get UeContextCreatedData from T-AMF.
1838- // Send HandoverCommand to S-RAN.
1839- var pduSessionResourceHandoverList ngapType.PDUSessionResourceHandoverList
1840- var pduSessionResourceToReleaseList ngapType.PDUSessionResourceToReleaseListHOCmd
1841-
1842- for _ , N2SmInfo := range ueContextCreatedData .PduSessionList {
1843- var item ngapType.PDUSessionResourceHandoverItem
1844- item .PDUSessionID .Value = int64 (N2SmInfo .PduSessionId )
1845- }
1846-
18471697 ngap_message .SendHandoverCommand (sourceUe , pduSessionResourceHandoverList , pduSessionResourceToReleaseList ,
18481698 * targetToSourceTransparentContainer , nil )
18491699 /*
0 commit comments