8000 fix: PDU Session Modification Request message does not have the IE for QoSRules or QoSFlowDescs by pf-lin · Pull Request #114 · free5gc/smf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: PDU Session Modification Request message does not have the IE for QoSRules or QoSFlowDescs #114

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

Merged
merged 4 commits into from
Jul 31, 2024
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
7 changes: 7 additions & 0 deletions internal/sbi/consumer/pcf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ func (s *npcfService) SendSMPolicyAssociationUpdateByUERequestModification(
}

// UE SHOULD only create ONE QoS Flow in a request (TS 24.501 6.4.2.2)
if len(qosRules) == 0 {
return nil, errors.New("QoS Rule not found")
}
if len(qosFlowDescs) == 0 {
return nil, errors.New("QoS Flow Description not found")
}

rule := qosRules[0]
flowDesc := qosFlowDescs[0]

Expand Down
78 changes: 78 additions & 0 deletions internal/sbi/consumer/pcf_service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package consumer_test

import (
"fmt"
"testing"

"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"

"github.com/free5gc/nas/nasType"
"github.com/free5gc/openapi/models"
smf_context "github.com/free5gc/smf/internal/context"
"github.com/free5gc/smf/internal/sbi/consumer"
"github.com/free5gc/smf/pkg/factory"
"github.com/free5gc/smf/pkg/service"
)

var testConfig = factory.Config{
Info: &factory.Info{
Version: "1.0.0",
Description: "SMF procdeure test configuration",
},
Configuration: &factory.Configuration{
Sbi: &factory.Sbi{
Scheme: "http",
RegisterIPv4: "127.0.0.1",
BindingIPv4: "127.0.0.1",
Port: 8000,
},
},
}

func TestSendSMPolicyAssociationUpdateByUERequestModification(t *testing.T) {
smf_context.InitSmfContext(&testConfig)

testCases := []struct {
name string
smContext *smf_context.SMContext
qosRules nasType.QoSRules
qosFlowDescs nasType.QoSFlowDescs

smPolicyDecision *models.SmPolicyDecision
responseErr error
}{
{
name: "QoSRules is nil",
smContext: smf_context.NewSMContext("imsi-208930000000001", 10),
qosRules: nasType.QoSRules{},
qosFlowDescs: nasType.QoSFlowDescs{nasType.QoSFlowDesc{}},
smPolicyDecision: nil,
responseErr: fmt.Errorf("QoS Rule not found"),
},
{
name: "QoSFlowDescs is nil",
smContext: smf_context.NewSMContext("imsi-208930000000001", 10),
qosRules: nasType.QoSRules{nasType.QoSRule{}},
qosFlowDescs: nasType.QoSFlowDescs{},
smPolicyDecision: nil,
responseErr: fmt.Errorf("QoS Flow Description not found"),
},
}

mockSmf := service.NewMockSmfAppInterface(gomock.NewController(t))
consumer, errNewConsumer := consumer.NewConsumer(mockSmf)
if errNewConsumer != nil {
t.Fatalf("Failed to create consumer: %+v", errNewConsumer)
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
smPolicyDecision, err := consumer.SendSMPolicyAssociationUpdateByUERequestModification(
tc.smContext, tc.qosRules, tc.qosFlowDescs)

require.Equal(t, tc.smPolicyDecision, smPolicyDecision)
require.Equal(t, tc.responseErr.Error(), err.Error())
})
}
}
Loading
0