-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add WebAuthSubData and remove r15 openapi
- Loading branch information
1 parent
a311085
commit 7fb287d
Showing
8 changed files
with
347 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
Oops, something went wrong.