Skip to content

Commit

Permalink
fix: get network slice by name and delete operation were broken (#248)
Browse files Browse the repository at this point in the history
Signed-off-by: Patricia Reinoso <[email protected]>
  • Loading branch information
patriciareinoso authored Nov 7, 2024
1 parent 1ef5845 commit 43ab52d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.1-dev
1.7.2
2 changes: 1 addition & 1 deletion configapi/api_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func GetNetworkSliceByName(c *gin.Context) {
logger.WebUILog.Infoln("Get Network Slice by name")

var networkSlice configmodels.Slice
filter := bson.M{"SliceName": c.Param("slice-name")}
filter := bson.M{"slice-name": c.Param("slice-name")}
rawNetworkSlice, errGetOne := dbadapter.CommonDBClient.RestfulAPIGetOne(sliceDataColl, filter)
if errGetOne != nil {
logger.DbLog.Warnln(errGetOne)
Expand Down
6 changes: 3 additions & 3 deletions proto/server/configEvtHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func configHandler(configMsgChan chan *configmodels.ConfigMessage, configReceive
if configMsg.Slice == nil {
logger.ConfigLog.Infof("received delete Slice [%v] from config channel", configMsg.SliceName)
config5gMsg.PrevSlice = getSliceByName(configMsg.SliceName)
filter := bson.M{"SliceName": configMsg.SliceName}
filter := bson.M{"slice-name": configMsg.SliceName}
errDelOne := dbadapter.CommonDBClient.RestfulAPIDeleteOne(sliceDataColl, filter)
if errDelOne != nil {
logger.DbLog.Warnln(errDelOne)
Expand Down Expand Up @@ -204,7 +204,7 @@ func handleNetworkSlicePost(configMsg *configmodels.ConfigMessage, subsUpdateCha
config5gMsg.PrevSlice = getSliceByName(configMsg.SliceName)
subsUpdateChan <- &config5gMsg
}
filter := bson.M{"SliceName": configMsg.SliceName}
filter := bson.M{"slice-name": configMsg.SliceName}
sliceDataBsonA := configmodels.ToBsonM(configMsg.Slice)
_, errPost := dbadapter.CommonDBClient.RestfulAPIPost(sliceDataColl, filter, sliceDataBsonA)
if errPost != nil {
Expand Down Expand Up @@ -308,7 +308,7 @@ func getSlices() []*configmodels.Slice {
}

func getSliceByName(name string) *configmodels.Slice {
filter := bson.M{"SliceName": name}
filter := bson.M{"slice-name": name}
sliceDataInterface, errGetOne := dbadapter.CommonDBClient.RestfulAPIGetOne(sliceDataColl, filter)
if errGetOne != nil {
logger.DbLog.Warnln(errGetOne)
Expand Down
4 changes: 2 additions & 2 deletions proto/server/configEvtHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func Test_handleNetworkSlicePost(t *testing.T) {
if postData[0]["coll"] != expected_collection {
t.Errorf("Expected collection %v, got %v", expected_collection, postData[0]["coll"])
}
expected_filter := bson.M{"SliceName": testSlice.SliceName}
expected_filter := bson.M{"slice-name": testSlice.SliceName}
if !reflect.DeepEqual(postData[0]["filter"], expected_filter) {
t.Errorf("Expected filter %v, got %v", expected_filter, postData[0]["filter"])
}
Expand Down Expand Up @@ -313,7 +313,7 @@ func Test_handleNetworkSlicePost_alreadyExists(t *testing.T) {
if postData[0]["coll"] != expected_collection {
t.Errorf("Expected collection %v, got %v", expected_collection, postData[0]["coll"])
}
expected_filter := bson.M{"SliceName": testSlice.SliceName}
expected_filter := bson.M{"slice-name": testSlice.SliceName}
if !reflect.DeepEqual(postData[0]["filter"], expected_filter) {
t.Errorf("Expected filter %v, got %v", expected_filter, postData[0]["filter"])
}
Expand Down

0 comments on commit 43ab52d

Please sign in to comment.