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

Add QER gating parameters #55

Merged
merged 10 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 8 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
14 changes: 12 additions & 2 deletions api/pfcpsim.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/pfcpsim.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ message CreateSessionRequest {
string ueAddressPool = 4;
string sdfFilter = 5;
int32 qfi = 6; // Should be uint8
bool gateStatus = 7;
}

message ModifySessionRequest {
Expand Down
2 changes: 2 additions & 0 deletions internal/pfcpctl/commands/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type commonArgs struct {
GnBAddress string `short:"g" long:"gnb-addr" description:"The (g/e)nodeB address"`
SDFfilter string `short:"s" long:"sdf-filter" description:"The SDF Filter to use"`
QFI uint8 `short:"q" long:"qfi" description:"The QFI value for QERs. Max value 64."`
GateStatus bool `short:"t" long:"gate-status" description:"If set, the QER gate status will be CLOSED"`
EmanueleGallone marked this conversation as resolved.
Show resolved Hide resolved
}

type sessionCreate struct {
Expand Down Expand Up @@ -66,6 +67,7 @@ func (s *sessionCreate) Execute(args []string) error {
UeAddressPool: s.Args.UePool,
SdfFilter: s.Args.SDFfilter,
Qfi: int32(s.Args.QFI),
GateStatus: s.Args.GateStatus,
})

if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion internal/pfcpsim/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func (P pfcpSimService) CreateSession(ctx context.Context, request *pb.CreateSes
}

var SDFFilter = ""
var qfi uint8 = 0
var qfi, gateStatus uint8 = 0, ieLib.GateStatusOpen

if request.GateStatus {
gateStatus = ieLib.GateStatusClosed
}

if request.Qfi != 0 {
qfi = uint8(request.Qfi)
Expand Down Expand Up @@ -218,6 +222,7 @@ func (P pfcpSimService) CreateSession(ctx context.Context, request *pb.CreateSes
WithQFI(qfi).
WithUplinkMBR(50000).
WithDownlinkMBR(30000).
WithGateStatus(gateStatus).
Build(),

// Downlink application QER
Expand All @@ -227,6 +232,7 @@ func (P pfcpSimService) CreateSession(ctx context.Context, request *pb.CreateSes
WithQFI(qfi).
WithUplinkMBR(50000).
WithDownlinkMBR(30000).
WithGateStatus(gateStatus).
Build(),
}

Expand Down
33 changes: 22 additions & 11 deletions pkg/pfcpsim/session/qer_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ package session
import "github.com/wmnsk/go-pfcp/ie"

type qerBuilder struct {
method IEMethod
qerID uint32
qfi uint8
isMbrSet bool
ulMbr uint64
dlMbr uint64
isGbrSet bool
ulGbr uint64
dlGbr uint64
method IEMethod
qerID uint32
qfi uint8
isMbrSet bool
ulMbr uint64
dlMbr uint64
isGbrSet bool
ulGbr uint64
dlGbr uint64
gateStatus uint8

isIDSet bool
}
Expand Down Expand Up @@ -64,6 +65,12 @@ func (b *qerBuilder) WithDownlinkGBR(dlGbr uint64) *qerBuilder {
return b
}

func (b *qerBuilder) WithGateStatus(status uint8) *qerBuilder {
b.gateStatus = status

return b
}

func (b *qerBuilder) validate() {
if !b.isIDSet {
panic("Tried to build a QER without setting the QER ID")
Expand All @@ -83,11 +90,15 @@ func (b *qerBuilder) Build() *ie.IE {
createFunc = ie.NewUpdateQER
}

gate := ie.NewGateStatus(0, 0) //Open
if b.gateStatus == ie.GateStatusClosed {
gate = ie.NewGateStatus(1, 1)
}

qer := createFunc(
ie.NewQERID(b.qerID),
ie.NewQFI(b.qfi),
// FIXME: we don't support gating, always OPEN
ie.NewGateStatus(0, 0),
gate,
)

if b.isMbrSet {
Expand Down
15 changes: 14 additions & 1 deletion pkg/pfcpsim/session/qer_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ func TestQERBuilder(t *testing.T) {
ie.NewQFI(2),
ie.NewGateStatus(0, 0),
),
description: "Valid Create QER",
description: "Valid Create QER with gate open",
},
{
input: NewQERBuilder().
WithID(1).
WithMethod(Create).
WithQFI(2).
WithGateStatus(ie.GateStatusClosed),
expected: ie.NewCreateQER(
ie.NewQERID(1),
ie.NewQFI(2),
ie.NewGateStatus(1, 1),
),
description: "Valid Create QER with Gate closed",
},
{
input: NewQERBuilder().
Expand Down