Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update backend openapi to r17 #109

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions backend/WebUI/api_charging.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ func GetChargingRecord(c *gin.Context) {

// Get supi of UEs
var uesJsonData interface{}
if amfUris := webuiSelf.GetOamUris(models.NfType_AMF); amfUris != nil {
if amfUris := webuiSelf.GetOamUris(models.NrfNfManagementNfType_AMF); amfUris != nil {
requestUri := fmt.Sprintf("%s/namf-oam/v1/registered-ue-context", amfUris[0])

ctx, pd, tokerErr := webui_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_OAM, models.NfType_AMF)
ctx, pd, tokerErr := webui_context.GetSelf().GetTokenCtx(
models.ServiceName_NAMF_OAM, models.NrfNfManagementNfType_AMF)
if tokerErr != nil {
logger.ProcLog.Errorf("GetTokenCtx error: %+v", tokerErr)
c.JSON(http.StatusInternalServerError, pd)
Expand Down
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)
}
4 changes: 2 additions & 2 deletions backend/WebUI/api_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func GetSmfUserPlaneInfo() (interface{}, error) {
var jsonData interface{}

// TODO: support fetching data from multiple SMF
if smfUris := webuiSelf.GetOamUris(models.NfType_SMF); smfUris != nil {
if smfUris := webuiSelf.GetOamUris(models.NrfNfManagementNfType_SMF); smfUris != nil {
requestUri := fmt.Sprintf("%s/nsmf-oam/v1/user-plane-info/", smfUris[0])

ctx, pd, err := webuiSelf.GetTokenCtx(models.ServiceName_NSMF_OAM, models.NfType_SMF)
ctx, pd, err := webuiSelf.GetTokenCtx(models.ServiceName_NSMF_OAM, models.NrfNfManagementNfType_SMF)
if err != nil {
logger.ConsumerLog.Infof("GetTokenCtx: service %v, err: %+v", models.ServiceName_NSMF_OAM, err)
return pd, err
Expand Down
Loading
Loading