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: add back static IP setting UI #85

Merged
merged 14 commits into from
Apr 23, 2024

Conversation

andy89923
Copy link
Contributor

@andy89923 andy89923 commented Mar 29, 2024

Description

  • Add back Static IP UI
  • Get SMF Config Data via OAM service
  • Verify Static IP button

Note

@andy89923
Copy link
Contributor Author

@yccodr Please review this PR~ Thanks! 😀

@andy89923 andy89923 marked this pull request as draft March 29, 2024 03:17
@ianchen0119
Copy link
Contributor

Hi @andy89923

Did you test the functionality with 5GC?

@andy89923
Copy link
Contributor Author

Hi @andy89923

Did you test the functionality with 5GC?

Yes, it could assign the IP setting in the webconsole.

However, I am working on a better coding style in frontend. So mark it as draft for now.

@andy89923 andy89923 marked this pull request as ready for review April 2, 2024 03:15
"ueId": bson.D{{Key: "$ne", Value: checkData.Supi}}, // not this UE
}
smDataDataInterface, mongo_err := mongoapi.RestfulAPIGetMany(smDataColl, filter)
if mongo_err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if mongo_err != nil && mongo_err != mongo.ErrNoDocuments {

@ianchen0119
Copy link
Contributor

@andy89923

The IP verifier responds the status 500 once the verification failed (mongo nil document).
I think we should use status 204 instead of status 500. When frontend receives the status 204, it should allow user to set the static ip (cause this ip hasn't been used so far).

@andy89923
Copy link
Contributor Author

@andy89923

The IP verifier responds the status 500 once the verification failed (mongo nil document). I think we should use status 204 instead of status 500. When frontend receives the status 204, it should allow user to set the static ip (cause this ip hasn't been used so far).

I think the mongoapi would handle the job.
If there is no document related, the mongoapi will return an empty slice and nil.

Here is part of code in mongoapi:

func RestfulAPIGetMany(
  collName string, filter bson.M, argOpt ...interface{},
) ([]map[string]interface{}, error) {
        collection := Client.Database(dbName).Collection(collName) 

        var cur *mongo.Cursor
	var err error
	collation := getCollation(argOpt...)
	if collation != nil {
		opts := new(options.FindOptions)
		opts.SetCollation(collation)
		cur, err = collection.Find(ctx, filter, opts)
	} else {
		cur, err = collection.Find(ctx, filter)
	}

        ...
}

backend/WebUI/api_verify.go Show resolved Hide resolved
@ianchen0119 ianchen0119 merged commit b1f67d2 into free5gc:main Apr 23, 2024
3 checks passed
@andy89923 andy89923 deleted the fix/static-ip branch April 23, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants