代码拉取完成,页面将自动刷新
package consumer
import (
"context"
amf_context "gitee.com/liu-zhao234568/amf/context"
"github.com/free5gc/openapi"
"github.com/free5gc/openapi/Nudm_UEContextManagement"
"github.com/free5gc/openapi/models"
)
func UeCmRegistration(ue *amf_context.AmfUe, accessType models.AccessType, initialRegistrationInd bool) (
*models.ProblemDetails, error) {
configuration := Nudm_UEContextManagement.NewConfiguration()
configuration.SetBasePath(ue.NudmUECMUri)
client := Nudm_UEContextManagement.NewAPIClient(configuration)
amfSelf := amf_context.AMF_Self()
switch accessType {
case models.AccessType__3_GPP_ACCESS:
registrationData := models.Amf3GppAccessRegistration{
AmfInstanceId: amfSelf.NfId,
InitialRegistrationInd: initialRegistrationInd,
Guami: &amfSelf.ServedGuamiList[0],
RatType: ue.RatType,
// TODO: not support Homogenous Support of IMS Voice over PS Sessions this stage
ImsVoPs: models.ImsVoPs_HOMOGENEOUS_NON_SUPPORT,
}
_, httpResp, localErr := client.AMFRegistrationFor3GPPAccessApi.Registration(context.Background(),
ue.Supi, registrationData)
if localErr == nil {
return nil, nil
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
return nil, localErr
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
return &problem, nil
} else {
return nil, openapi.ReportError("server no response")
}
case models.AccessType_NON_3_GPP_ACCESS:
registrationData := models.AmfNon3GppAccessRegistration{
AmfInstanceId: amfSelf.NfId,
Guami: &amfSelf.ServedGuamiList[0],
RatType: ue.RatType,
}
_, httpResp, localErr :=
client.AMFRegistrationForNon3GPPAccessApi.Register(context.Background(), ue.Supi, registrationData)
if localErr == nil {
return nil, nil
} else if httpResp != nil {
if httpResp.Status != localErr.Error() {
return nil, localErr
}
problem := localErr.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails)
return &problem, nil
} else {
return nil, openapi.ReportError("server no response")
}
}
return nil, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。