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

Make QFI configurable when creating sessions #42

Merged
merged 4 commits into from
Mar 2, 2022
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
117 changes: 63 additions & 54 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 @@ -14,6 +14,7 @@ message CreateSessionRequest {
string nodeBAddress = 3;
string ueAddressPool = 4;
string sdfFilter = 5;
int32 qfi = 6; // Should be uint8
}

message ModifySessionRequest {
Expand Down
6 changes: 6 additions & 0 deletions cmd/pfcpctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func main() {
bufferFlag := getopt.BoolLong("buffer", 'b', "If set, downlink FARs will have the buffer flag set to true")
notifyCPFlag := getopt.BoolLong("notifycp", 'm', "If set, downlink FARs will have the notify CP flag set to true")
sdfFilter := getopt.StringLong("sdf-filter", 'f', "" ,"Allows to set a custom SDF filter")
qfi := getopt.Int32Long("qfi", 'q', 0, "Allows to set a custom QFI value for QERs. Max value 64")

optHelp := getopt.BoolLong("help", 0, "Help")

Expand All @@ -57,6 +58,10 @@ func main() {
os.Exit(0)
}

if *qfi > 64 {
log.Fatalf("QFI value cannot exceed 64.")
}

simClient, conn := connect(*srvAddr)
defer conn.Close()

Expand Down Expand Up @@ -98,6 +103,7 @@ func main() {
NodeBAddress: *nodeBAddr,
UeAddressPool: *ueAddrPool,
SdfFilter: *sdfFilter,
Qfi: *qfi,
})
if err != nil {
log.Errorf("Error while associating: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ go 1.16
require (
github.com/c-robinson/iplib v1.0.3
github.com/golang/protobuf v1.5.2
github.com/jessevdk/go-flags v1.5.0
github.com/pborman/getopt/v2 v2.1.0
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
github.com/wmnsk/go-pfcp v0.0.14
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.27.1
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/getopt/v2 v2.1.0 h1:eNfR+r+dWLdWmV8g5OlpyrTYHkhVNxHBdN2cCrJmOEA=
Expand Down
9 changes: 7 additions & 2 deletions internal/pfcpsim/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ func (P pfcpSimService) CreateSession(ctx context.Context, request *pb.CreateSes
}

var SDFFilter = ""
var qfi uint8 = 0

if request.Qfi != 0 {
qfi = uint8(request.Qfi)
}

if request.SdfFilter != "" {
SDFFilter = request.SdfFilter
Expand Down Expand Up @@ -212,7 +217,7 @@ func (P pfcpSimService) CreateSession(ctx context.Context, request *pb.CreateSes
session.NewQERBuilder().
WithID(uplinkAppQerID).
WithMethod(session.Create).
WithQFI(0x08).
WithQFI(qfi).
WithUplinkMBR(50000).
WithDownlinkMBR(30000).
Build(),
Expand All @@ -221,7 +226,7 @@ func (P pfcpSimService) CreateSession(ctx context.Context, request *pb.CreateSes
session.NewQERBuilder().
WithID(downlinkAppQerID).
WithMethod(session.Create).
WithQFI(0x08).
WithQFI(qfi).
WithUplinkMBR(50000).
WithDownlinkMBR(30000).
Build(),
Expand Down