1 Star 1 Fork 1

刘昭 / amf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ue_context_management.go 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
刘昭 提交于 2022-01-25 19:22 . 1.0.1
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
}
1
https://gitee.com/liu-zhao234568/amf.git
git@gitee.com:liu-zhao234568/amf.git
liu-zhao234568
amf
amf
v1.3.0

搜索帮助