Skip to content
Merged
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
6 changes: 3 additions & 3 deletions backend/webui_context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ func WEBUI_Self() *WEBUIContext {
return &webuiContext
}

func decode(source interface{}, format string) ([]models.NFProfile, error) {
func decode(source any, format string) ([]models.NFProfile, error) {
var target []models.NFProfile

// config mapstruct
stringToDateTimeHook := func(
f reflect.Type,
t reflect.Type,
data interface{},
) (interface{}, error) {
data any,
) (any, error) {
if t == reflect.TypeOf(time.Time{}) && f == reflect.TypeOf("") {
return time.Parse(format, data.(string))
}
Expand Down
2 changes: 1 addition & 1 deletion configapi/common_mock_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
testSubscriberImsi = "imsi-208930100007487"
)

func (m *MockSession) WithTransaction(ctx context.Context, fn func(ctx context.Context) (interface{}, error), opts ...options.Lister[options.TransactionOptions]) (interface{}, error) {
func (m *MockSession) WithTransaction(ctx context.Context, fn func(ctx context.Context) (any, error), opts ...options.Lister[options.TransactionOptions]) (any, error) {
return fn(ctx)
}

Expand Down
20 changes: 10 additions & 10 deletions configapi/slice_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ func updateSmProvisionedData(snssai *models.Snssai, dnnMap map[string][]configmo
return nil
}

func buildSmProvisionedDataDocument(snssai *models.Snssai, dnnMap map[string][]configmodels.DeviceGroupsIpDomainExpandedUeDnnQos, mcc, mnc, imsi string) (map[string]interface{}, error) {
dnnConfigurations := make(map[string]interface{}, len(dnnMap))
func buildSmProvisionedDataDocument(snssai *models.Snssai, dnnMap map[string][]configmodels.DeviceGroupsIpDomainExpandedUeDnnQos, mcc, mnc, imsi string) (map[string]any, error) {
dnnConfigurations := make(map[string]any, len(dnnMap))

for dnn, ueDnnQosList := range dnnMap {
aggregatedQoS := aggregateQoS(ueDnnQosList)
Expand All @@ -774,22 +774,22 @@ func buildSmProvisionedDataDocument(snssai *models.Snssai, dnnMap map[string][]c
return nil, fmt.Errorf("traffic class missing for DNN %s", dnn)
}

dnnConfigurations[dnn] = map[string]interface{}{
"pduSessionTypes": map[string]interface{}{
dnnConfigurations[dnn] = map[string]any{
"pduSessionTypes": map[string]any{
"defaultSessionType": models.PDUSESSIONTYPE_IPV4,
"allowedSessionTypes": []models.PduSessionType{models.PDUSESSIONTYPE_IPV4},
},
"sscModes": map[string]interface{}{
"sscModes": map[string]any{
"defaultSscMode": models.SSCMODE_SSC_MODE_1,
"allowedSscModes": []models.SscMode{models.SSCMODE_SSC_MODE_2, models.SSCMODE_SSC_MODE_3},
},
"sessionAmbr": map[string]interface{}{
"sessionAmbr": map[string]any{
downlinkKey: ConvertToString(uint64(aggregatedQoS.DnnMbrDownlink)),
uplinkKey: ConvertToString(uint64(aggregatedQoS.DnnMbrUplink)),
},
"5gQosProfile": map[string]interface{}{
"5gQosProfile": map[string]any{
"5qi": aggregatedQoS.TrafficClass.Qci,
"arp": map[string]interface{}{
"arp": map[string]any{
priorityLevelKey: int32(8),
"preemptCap": models.PREEMPTIONCAPABILITY_NOT_PREEMPT,
"preemptVuln": models.PREEMPTIONVULNERABILITY_NOT_PREEMPTABLE,
Expand All @@ -799,14 +799,14 @@ func buildSmProvisionedDataDocument(snssai *models.Snssai, dnnMap map[string][]c
}
}

singleNssai := map[string]interface{}{
singleNssai := map[string]any{
"sst": snssai.Sst,
}
if snssai.Sd != nil {
singleNssai["sd"] = *snssai.Sd
}

return map[string]interface{}{
return map[string]any{
ueIdKey: "imsi-" + imsi,
servingPlmnIdKey: mcc + mnc,
"singlenssai": singleNssai,
Expand Down
10 changes: 5 additions & 5 deletions configapi/slice_operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,28 +924,28 @@ func TestBuildSmProvisionedDataDocument(t *testing.T) {
t.Fatalf("unexpected ueId: %v", got)
}

singleNssai, ok := doc["singlenssai"].(map[string]interface{})
singleNssai, ok := doc["singlenssai"].(map[string]any)
if !ok {
t.Fatalf("singlenssai has unexpected type: %T", doc["singlenssai"])
}
if singleNssai["sd"] != "010203" {
t.Fatalf("unexpected sd: %v", singleNssai["sd"])
}

dnnConfigurations, ok := doc["dnnconfigurations"].(map[string]interface{})
dnnConfigurations, ok := doc["dnnconfigurations"].(map[string]any)
if !ok {
t.Fatalf("dnnconfigurations has unexpected type: %T", doc["dnnconfigurations"])
}
internet, ok := dnnConfigurations[dnnInternet].(map[string]interface{})
internet, ok := dnnConfigurations[dnnInternet].(map[string]any)
if !ok {
t.Fatalf("internet dnn config has unexpected type: %T", dnnConfigurations[dnnInternet])
}

qos, ok := internet["5gQosProfile"].(map[string]interface{})
qos, ok := internet["5gQosProfile"].(map[string]any)
if !ok {
t.Fatalf("5gQosProfile has unexpected type: %T", internet["5gQosProfile"])
}
arp, ok := qos["arp"].(map[string]interface{})
arp, ok := qos["arp"].(map[string]any)
if !ok {
t.Fatalf("arp has unexpected type: %T", qos["arp"])
}
Expand Down
2 changes: 1 addition & 1 deletion configmodels/model_slice_site_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ type SliceSiteInfo struct {
GNodeBs []SliceSiteInfoGNodeBs `json:"gNodeBs"`

// UPF which belong to this slice
Upf map[string]interface{} `json:"upf,omitempty"`
Upf map[string]any `json:"upf,omitempty"`
}
72 changes: 36 additions & 36 deletions dbadapter/db_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,32 @@ func (s *MongoDBSession) WithSession(ctx context.Context, fn func(context.Contex
}

type DBInterface interface {
RestfulAPIGetOne(collName string, filter bson.M) (map[string]interface{}, error)
RestfulAPIGetMany(collName string, filter bson.M) ([]map[string]interface{}, error)
RestfulAPIPutOneTimeout(collName string, filter bson.M, putData map[string]interface{}, timeout int32, timeField string) bool
RestfulAPIPutOne(collName string, filter bson.M, putData map[string]interface{}) (bool, error)
RestfulAPIPutOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]interface{}) (bool, error)
RestfulAPIPutOneNotUpdate(collName string, filter bson.M, putData map[string]interface{}) (bool, error)
RestfulAPIPutMany(collName string, filterArray []bson.M, putDataArray []map[string]interface{}) error
RestfulAPIGetOne(collName string, filter bson.M) (map[string]any, error)
RestfulAPIGetMany(collName string, filter bson.M) ([]map[string]any, error)
RestfulAPIPutOneTimeout(collName string, filter bson.M, putData map[string]any, timeout int32, timeField string) bool
RestfulAPIPutOne(collName string, filter bson.M, putData map[string]any) (bool, error)
RestfulAPIPutOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]any) (bool, error)
RestfulAPIPutOneNotUpdate(collName string, filter bson.M, putData map[string]any) (bool, error)
RestfulAPIPutMany(collName string, filterArray []bson.M, putDataArray []map[string]any) error
RestfulAPIDeleteOne(collName string, filter bson.M) error
RestfulAPIDeleteOneWithContext(context context.Context, collName string, filter bson.M) error
RestfulAPIDeleteMany(collName string, filter bson.M) error
RestfulAPIMergePatch(collName string, filter bson.M, patchData map[string]interface{}) error
RestfulAPIMergePatch(collName string, filter bson.M, patchData map[string]any) error
RestfulAPIJSONPatch(collName string, filter bson.M, patchJSON []byte) error
RestfulAPIJSONPatchWithContext(context context.Context, collName string, filter bson.M, patchJSON []byte) error
RestfulAPIJSONPatchExtend(collName string, filter bson.M, patchJSON []byte, dataName string) error
RestfulAPIPost(collName string, filter bson.M, postData map[string]interface{}) (bool, error)
RestfulAPIPostWithContext(context context.Context, collName string, filter bson.M, postData map[string]interface{}) (bool, error)
RestfulAPIPostMany(collName string, filter bson.M, postDataArray []interface{}) error
RestfulAPIPostManyWithContext(context context.Context, collName string, filter bson.M, postDataArray []interface{}) error
RestfulAPIPost(collName string, filter bson.M, postData map[string]any) (bool, error)
RestfulAPIPostWithContext(context context.Context, collName string, filter bson.M, postData map[string]any) (bool, error)
RestfulAPIPostMany(collName string, filter bson.M, postDataArray []any) error
RestfulAPIPostManyWithContext(context context.Context, collName string, filter bson.M, postDataArray []any) error
RestfulAPICount(collName string, filter bson.M) (int64, error)
RestfulAPIPullOne(collName string, filter bson.M, putData map[string]interface{}) error
RestfulAPIPullOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]interface{}) error
RestfulAPIPullOne(collName string, filter bson.M, putData map[string]any) error
RestfulAPIPullOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]any) error
CreateIndex(collName string, keyField string) (bool, error)
StartSession() (DBSession, error)
SupportsTransactions() (bool, error)
RestfulAPIPostOnDB(ctx context.Context, dbName string, collName string, filter bson.M, postData map[string]interface{}) (bool, error)
RestfulAPIPutOneOnDB(ctx context.Context, dbName string, collName string, filter bson.M, putData map[string]interface{}) (bool, error)
RestfulAPIPostOnDB(ctx context.Context, dbName string, collName string, filter bson.M, postData map[string]any) (bool, error)
RestfulAPIPutOneOnDB(ctx context.Context, dbName string, collName string, filter bson.M, putData map[string]any) (bool, error)
RestfulAPIDeleteOneOnDB(ctx context.Context, dbName string, collName string, filter bson.M) error
}

Expand Down Expand Up @@ -129,7 +129,7 @@ func GetSessionRunner(client DBInterface) SessionRunner {
}
defer session.EndSession(ctx)
return session.WithSession(ctx, func(sc context.Context) error {
_, err = session.WithTransaction(sc, func(sc context.Context) (interface{}, error) {
_, err = session.WithTransaction(sc, func(sc context.Context) (any, error) {
return nil, fn(sc)
})
return err
Expand All @@ -138,9 +138,9 @@ func GetSessionRunner(client DBInterface) SessionRunner {
}

type PatchOperation struct {
Value interface{} `json:"value,omitempty"`
Op string `json:"op"`
Path string `json:"path"`
Value any `json:"value,omitempty"`
Op string `json:"op"`
Path string `json:"path"`
}

func setDBClient(url, dbname string) (DBInterface, error) {
Expand Down Expand Up @@ -395,31 +395,31 @@ func isRetryableMongoMessage(message string) bool {
return false
}

func (db *MongoDBClient) RestfulAPIGetOne(collName string, filter bson.M) (map[string]interface{}, error) {
func (db *MongoDBClient) RestfulAPIGetOne(collName string, filter bson.M) (map[string]any, error) {
return db.MongoClient.RestfulAPIGetOne(collName, filter)
}

func (db *MongoDBClient) RestfulAPIGetMany(collName string, filter bson.M) ([]map[string]interface{}, error) {
func (db *MongoDBClient) RestfulAPIGetMany(collName string, filter bson.M) ([]map[string]any, error) {
return db.MongoClient.RestfulAPIGetMany(collName, filter)
}

func (db *MongoDBClient) RestfulAPIPutOneTimeout(collName string, filter bson.M, putData map[string]interface{}, timeout int32, timeField string) bool {
func (db *MongoDBClient) RestfulAPIPutOneTimeout(collName string, filter bson.M, putData map[string]any, timeout int32, timeField string) bool {
return db.MongoClient.RestfulAPIPutOneTimeout(collName, filter, putData, timeout, timeField)
}

func (db *MongoDBClient) RestfulAPIPutOne(collName string, filter bson.M, putData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPutOne(collName string, filter bson.M, putData map[string]any) (bool, error) {
return db.MongoClient.RestfulAPIPutOne(collName, filter, putData)
}

func (db *MongoDBClient) RestfulAPIPutOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPutOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]any) (bool, error) {
return db.MongoClient.RestfulAPIPutOneWithContext(context, collName, filter, putData)
}

func (db *MongoDBClient) RestfulAPIPutOneNotUpdate(collName string, filter bson.M, putData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPutOneNotUpdate(collName string, filter bson.M, putData map[string]any) (bool, error) {
return db.MongoClient.RestfulAPIPutOneNotUpdate(collName, filter, putData)
}

func (db *MongoDBClient) RestfulAPIPutMany(collName string, filterArray []bson.M, putDataArray []map[string]interface{}) error {
func (db *MongoDBClient) RestfulAPIPutMany(collName string, filterArray []bson.M, putDataArray []map[string]any) error {
return db.MongoClient.RestfulAPIPutMany(collName, filterArray, putDataArray)
}

Expand All @@ -435,7 +435,7 @@ func (db *MongoDBClient) RestfulAPIDeleteMany(collName string, filter bson.M) er
return db.MongoClient.RestfulAPIDeleteMany(collName, filter)
}

func (db *MongoDBClient) RestfulAPIMergePatch(collName string, filter bson.M, patchData map[string]interface{}) error {
func (db *MongoDBClient) RestfulAPIMergePatch(collName string, filter bson.M, patchData map[string]any) error {
return db.MongoClient.RestfulAPIMergePatch(collName, filter, patchData)
}

Expand All @@ -451,31 +451,31 @@ func (db *MongoDBClient) RestfulAPIJSONPatchExtend(collName string, filter bson.
return db.MongoClient.RestfulAPIJSONPatchExtend(collName, filter, patchJSON, dataName)
}

func (db *MongoDBClient) RestfulAPIPost(collName string, filter bson.M, postData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPost(collName string, filter bson.M, postData map[string]any) (bool, error) {
return db.MongoClient.RestfulAPIPost(collName, filter, postData)
}

func (db *MongoDBClient) RestfulAPIPostWithContext(context context.Context, collName string, filter bson.M, postData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPostWithContext(context context.Context, collName string, filter bson.M, postData map[string]any) (bool, error) {
return db.MongoClient.RestfulAPIPostWithContext(context, collName, filter, postData)
}

func (db *MongoDBClient) RestfulAPIPostMany(collName string, filter bson.M, postDataArray []interface{}) error {
func (db *MongoDBClient) RestfulAPIPostMany(collName string, filter bson.M, postDataArray []any) error {
return db.MongoClient.RestfulAPIPostMany(collName, filter, postDataArray)
}

func (db *MongoDBClient) RestfulAPIPostManyWithContext(context context.Context, collName string, filter bson.M, postDataArray []interface{}) error {
func (db *MongoDBClient) RestfulAPIPostManyWithContext(context context.Context, collName string, filter bson.M, postDataArray []any) error {
return db.MongoClient.RestfulAPIPostManyWithContext(context, collName, filter, postDataArray)
}

func (db *MongoDBClient) RestfulAPICount(collName string, filter bson.M) (int64, error) {
return db.MongoClient.RestfulAPICount(collName, filter)
}

func (db *MongoDBClient) RestfulAPIPullOne(collName string, filter bson.M, putData map[string]interface{}) error {
func (db *MongoDBClient) RestfulAPIPullOne(collName string, filter bson.M, putData map[string]any) error {
return db.MongoClient.RestfulAPIPullOne(collName, filter, putData)
}

func (db *MongoDBClient) RestfulAPIPullOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]interface{}) error {
func (db *MongoDBClient) RestfulAPIPullOneWithContext(context context.Context, collName string, filter bson.M, putData map[string]any) error {
return db.MongoClient.RestfulAPIPullOneWithContext(context, collName, filter, putData)
}

Expand All @@ -495,7 +495,7 @@ func (db *MongoDBClient) SupportsTransactions() (bool, error) {
return db.MongoClient.SupportsTransactions()
}

func (db *MongoDBClient) RestfulAPIPostOnDB(ctx context.Context, dbName string, collName string, filter bson.M, postData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPostOnDB(ctx context.Context, dbName string, collName string, filter bson.M, postData map[string]any) (bool, error) {
collection := db.Client.Database(dbName).Collection(collName)
var existing bson.M
err := collection.FindOne(ctx, filter).Decode(&existing)
Expand All @@ -514,7 +514,7 @@ func (db *MongoDBClient) RestfulAPIPostOnDB(ctx context.Context, dbName string,
return false, nil
}

func (db *MongoDBClient) RestfulAPIPutOneOnDB(ctx context.Context, dbName string, collName string, filter bson.M, putData map[string]interface{}) (bool, error) {
func (db *MongoDBClient) RestfulAPIPutOneOnDB(ctx context.Context, dbName string, collName string, filter bson.M, putData map[string]any) (bool, error) {
collection := db.Client.Database(dbName).Collection(collName)
var existing bson.M
err := collection.FindOne(ctx, filter).Decode(&existing)
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ require (
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/uuid v1.6.0
github.com/omec-project/openapi/v2 v2.2.5
github.com/omec-project/util v1.8.13
github.com/omec-project/util v1.9.0
github.com/prometheus/client_golang v1.24.1
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.1
github.com/swaggo/swag v1.16.6
github.com/urfave/cli/v3 v3.13.0
go.mongodb.org/mongo-driver/v2 v2.9.1
github.com/urfave/cli/v3 v3.14.0
go.mongodb.org/mongo-driver/v2 v2.9.2
go.uber.org/zap v1.28.0
go.yaml.in/yaml/v4 v4.0.0-rc.6
golang.org/x/crypto v0.57.0
Expand Down Expand Up @@ -75,6 +75,6 @@ require (
golang.org/x/sync v0.23.0 // indirect
golang.org/x/sys v0.48.0 // indirect
golang.org/x/text v0.42.0 // indirect
golang.org/x/tools v0.50.0 // indirect
golang.org/x/tools v0.51.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
)
Loading
Loading