Skip to content

Commit

Permalink
feat: add WebAuthSubData and remove r15 openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 authored and Alonza0314 committed Nov 14, 2024
1 parent a311085 commit 7fb287d
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 246 deletions.
201 changes: 201 additions & 0 deletions backend/WebUI/api_sample.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
package WebUI

import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
"github.com/free5gc/webconsole/backend/logger"
)

func GetSampleJSON(c *gin.Context) {
setCorsHeader(c)

logger.ProcLog.Infoln("Get a JSON Example")

var subsData SubsData

webAuthSubsData := WebAuthenticationSubscription{
AuthenticationManagementField: "8000",
AuthenticationMethod: "5G_AKA", // "5G_AKA", "EAP_AKA_PRIME"
Milenage: &Milenage{
Op: &Op{
EncryptionAlgorithm: 0,
EncryptionKey: 0,
OpValue: "c9e8763286b5b9ffbdf56e1297d0887b", // Required
},
},
Opc: &Opc{
EncryptionAlgorithm: 0,
EncryptionKey: 0,
OpcValue: "981d464c7c52eb6e5036234984ad0bcf", // Required
},
PermanentKey: &PermanentKey{
EncryptionAlgorithm: 0,
EncryptionKey: 0,
PermanentKeyValue: "5122250214c33e723a5dd523fc145fc0", // Required
},
SequenceNumber: "16f3b3f70fc2",
}

amDataData := models.AccessAndMobilitySubscriptionData{
Gpsis: []string{
"msisdn-0900000000",
},
Nssai: &models.Nssai{
DefaultSingleNssais: []models.Snssai{
{
Sd: "010203",
Sst: 1,
},
{
Sd: "112233",
Sst: 1,
},
},
SingleNssais: []models.Snssai{
{
Sd: "010203",
Sst: 1,
},
{
Sd: "112233",
Sst: 1,
},
},
},
SubscribedUeAmbr: &models.AmbrRm{
Downlink: "1000 Kbps",
Uplink: "1000 Kbps",
},
}

smDataData := []models.SessionManagementSubscriptionData{
{
SingleNssai: &models.Snssai{
Sst: 1,
Sd: "010203",
},
DnnConfigurations: map[string]models.DnnConfiguration{
"internet": {
PduSessionTypes: &models.PduSessionTypes{
DefaultSessionType: models.PduSessionType_IPV4,
AllowedSessionTypes: []models.PduSessionType{models.PduSessionType_IPV4},
},
SscModes: &models.SscModes{
DefaultSscMode: models.SscMode__1,
AllowedSscModes: []models.SscMode{models.SscMode__1},
},
SessionAmbr: &models.Ambr{
Downlink: "1000 Kbps",
Uplink: "1000 Kbps",
},
Var5gQosProfile: &models.SubscribedDefaultQos{
Var5qi: 9,
Arp: &models.Arp{
PriorityLevel: 8,
},
PriorityLevel: 8,
},
},
},
},
{
SingleNssai: &models.Snssai{
Sst: 1,
Sd: "112233",
},
DnnConfigurations: map[string]models.DnnConfiguration{
"internet": {
PduSessionTypes: &models.PduSessionTypes{
DefaultSessionType: models.PduSessionType_IPV4,
AllowedSessionTypes: []models.PduSessionType{models.PduSessionType_IPV4},
},
SscModes: &models.SscModes{
DefaultSscMode: models.SscMode__1,
AllowedSscModes: []models.SscMode{models.SscMode__1},
},
SessionAmbr: &models.Ambr{
Downlink: "1000 Kbps",
Uplink: "1000 Kbps",
},
Var5gQosProfile: &models.SubscribedDefaultQos{
Var5qi: 9,
Arp: &models.Arp{
PriorityLevel: 8,
},
PriorityLevel: 8,
},
},
},
},
}

smfSelData := models.SmfSelectionSubscriptionData{
SubscribedSnssaiInfos: map[string]models.SnssaiInfo{
"01010203": {
DnnInfos: []models.DnnInfo{
{
Dnn: "internet",
},
},
},
"01112233": {
DnnInfos: []models.DnnInfo{
{
Dnn: "internet",
},
},
},
},
}

amPolicyData := models.AmPolicyData{
SubscCats: []string{
"free5gc",
},
}

smPolicyData := models.SmPolicyData{
SmPolicySnssaiData: map[string]models.SmPolicySnssaiData{
"01010203": {
Snssai: &models.Snssai{
Sd: "010203",
Sst: 1,
},
SmPolicyDnnData: map[string]models.SmPolicyDnnData{
"internet": {
Dnn: "internet",
},
},
},
"01112233": {
Snssai: &models.Snssai{
Sd: "112233",
Sst: 1,
},
SmPolicyDnnData: map[string]models.SmPolicyDnnData{
"internet": {
Dnn: "internet",
},
},
},
},
}

servingPlmnId := "20893"
ueId := "imsi-2089300007487"

subsData = SubsData{
PlmnID: servingPlmnId,
UeId: ueId,
WebAuthenticationSubscription: webAuthSubsData,
AccessAndMobilitySubscriptionData: amDataData,
SessionManagementSubscriptionData: smDataData,
SmfSelectionSubscriptionData: smfSelData,
AmPolicyData: amPolicyData,
SmPolicyData: smPolicyData,
}
c.JSON(http.StatusOK, subsData)
}
Loading

0 comments on commit 7fb287d

Please sign in to comment.