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

Sd mismatch issue, make Sd value to lower case in dbOperation() #46

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

brianchennn
Copy link
Contributor

This PR is to fix github issue #435

@@ -1358,6 +1358,42 @@ func dbOperation(ueId string, servingPlmnId string, method string, subsData *Sub
filterUeIdOnly := bson.M{"ueId": ueId}
filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId}

// Set Sd value to lower case
if subsData != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if subsData == nil {
    return
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It couldn't be returned because the function DeleteSubscriberByID() should call dbOperation() with argument subsData = nil .

// Set Sd value to lower case
if subsData != nil {
if subsData.AccessAndMobilitySubscriptionData.Nssai != nil {
if subsData.AccessAndMobilitySubscriptionData.Nssai.DefaultSingleNssais != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this if, range will skip it if it is nil

subsData.AccessAndMobilitySubscriptionData.Nssai.DefaultSingleNssais[i].Sd = strings.ToLower(defaultSingleNssai.Sd)
}
}
if subsData.AccessAndMobilitySubscriptionData.Nssai.SingleNssais != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this if, range will skip it if it is nil

}
}
}
if subsData.SessionManagementSubscriptionData != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this if, range will skip it if it is nil

subsData.SessionManagementSubscriptionData[i].SingleNssai.Sd = strings.ToLower(subscriptionData.SingleNssai.Sd)
}
}
if subsData.SmfSelectionSubscriptionData.SubscribedSnssaiInfos != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this if, range will skip it if it is nil

}
}
}
if subsData.SmPolicyData.SmPolicySnssaiData != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this if, range will skip it if it is nil

if subsData != nil {
if subsData.AccessAndMobilitySubscriptionData.Nssai != nil {
if subsData.AccessAndMobilitySubscriptionData.Nssai.DefaultSingleNssais != nil {
for i, defaultSingleNssai := range subsData.AccessAndMobilitySubscriptionData.Nssai.DefaultSingleNssais {
Copy link
Collaborator

@tim-ywliu tim-ywliu Jul 18, 2023

Choose a reason for hiding this comment

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

use local var to short whole codes:

defaultSingleNssais := subsData.AccessAndMobilitySubscriptionData.Nssai.DefaultSingleNssais
for i, defaultSingleNssai := range defaultSingleNssais {
	defaultSingleNssais[i].Sd = strings.ToLower(defaultSingleNssai.Sd)
}

also modify codes below.

}

smPolicySnssaiDatas := subsData.SmPolicyData.SmPolicySnssaiData
for i, snssaiData := range smPolicySnssaiDatas {
Copy link
Collaborator

Choose a reason for hiding this comment

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

for i := range smPolicySnssaiDatas {
	smPolicySnssaiDatas[i].Snssai.Sd = strings.ToLower(smPolicySnssaiDatas[i].Snssai.Sd)
}

@tim-ywliu tim-ywliu merged commit 85cc414 into free5gc:main Jul 20, 2023
4 checks passed
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.

[Bugs] SD case mismatch
2 participants