-
Notifications
You must be signed in to change notification settings - Fork 0
/
mt.go
56 lines (46 loc) · 1.76 KB
/
mt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package producer
import (
"github.com/nycu-ucr/gonet/http"
"github.com/nycu-ucr/amf/context"
"github.com/nycu-ucr/amf/logger"
"github.com/nycu-ucr/http_wrapper"
"github.com/nycu-ucr/openapi/models"
)
func HandleProvideDomainSelectionInfoRequest(request *http_wrapper.Request) *http_wrapper.Response {
logger.MtLog.Info("Handle Provide Domain Selection Info Request")
ueContextID := request.Params["ueContextId"]
infoClassQuery := request.Query.Get("info-class")
supportedFeaturesQuery := request.Query.Get("supported-features")
ueContextInfo, problemDetails := ProvideDomainSelectionInfoProcedure(ueContextID,
infoClassQuery, supportedFeaturesQuery)
if problemDetails != nil {
return http_wrapper.NewResponse(int(problemDetails.Status), nil, problemDetails)
} else {
return http_wrapper.NewResponse(http.StatusOK, nil, ueContextInfo)
}
}
func ProvideDomainSelectionInfoProcedure(ueContextID string, infoClassQuery string, supportedFeaturesQuery string) (
*models.UeContextInfo, *models.ProblemDetails) {
amfSelf := context.AMF_Self()
ue, ok := amfSelf.AmfUeFindByUeContextID(ueContextID)
if !ok {
problemDetails := &models.ProblemDetails{
Status: http.StatusNotFound,
Cause: "CONTEXT_NOT_FOUND",
}
return nil, problemDetails
}
ueContextInfo := new(models.UeContextInfo)
// TODO: Error Status 307, 403 in TS29.518 Table 6.3.3.3.3.1-3
anType := ue.GetAnType()
if anType != "" && infoClassQuery != "" {
ranUe := ue.RanUe[anType]
ueContextInfo.AccessType = anType
ueContextInfo.LastActTime = ranUe.LastActTime
ueContextInfo.RatType = ue.RatType
ueContextInfo.SupportedFeatures = ranUe.SupportedFeatures
ueContextInfo.SupportVoPS = ranUe.SupportVoPS
ueContextInfo.SupportVoPSn3gpp = ranUe.SupportVoPSn3gpp
}
return ueContextInfo, nil
}