Skip to content

Commit

Permalink
Add support for app-filter string
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Gallone committed Mar 11, 2022
1 parent f9a56c3 commit 34d259a
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 189 deletions.
168 changes: 67 additions & 101 deletions api/pfcpsim.pb.go

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

8 changes: 1 addition & 7 deletions api/pfcpsim.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ message CreateSessionRequest {
int32 baseID = 2;
string nodeBAddress = 3;
string ueAddressPool = 4;
// string sdfFilter = 5;
string appFilter = 5;
int32 qfi = 6; // Should be uint8
// **** SDF filter-related fields **** //
bool gateClosed = 7; // If set, the application QERs will have the Gate status to closed.
string protocol = 8;
string destinationIPCIDR = 9; // must be in CIDR notation e.g. 192.168.0.1/24
int32 lowerPortRange = 10;
int32 upperPortRange = 11;
// **** End of SDF filter-related fields **** //
}

message ModifySessionRequest {
Expand Down
6 changes: 3 additions & 3 deletions internal/pfcpctl/commands/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
log "github.com/sirupsen/logrus"
)

type associate struct {}
type disassociate struct {}
type associate struct{}
type disassociate struct{}
type configureRemoteAddresses struct {
RemotePeerAddress string `short:"r" long:"remote-peer-addr" default:"" description:"The remote PFCP agent address."`
RemotePeerAddress string `short:"r" long:"remote-peer-addr" default:"" description:"The remote PFCP agent address."`
N3InterfaceAddress string `short:"n" long:"n3-addr" default:"" description:"The IPv4 address of the UPF's N3 interface"`
}

Expand Down
37 changes: 13 additions & 24 deletions internal/pfcpctl/commands/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,39 @@ package commands

import (
"context"
"strings"

"github.com/jessevdk/go-flags"
pb "github.com/omec-project/pfcpsim/api"
log "github.com/sirupsen/logrus"
)

type commonArgs struct {
Count int `short:"c" long:"count" default:"1" description:"The number of sessions to create"`
BaseID int `short:"i" long:"baseID" default:"1" description:"The base ID to use"`
UePool string `short:"u" long:"ue-pool" default:"17.0.0.0/24" description:"The UE pool address"`
GnBAddress string `short:"g" long:"gnb-addr" description:"The UE pool address"`
Count int `short:"c" long:"count" default:"1" description:"The number of sessions to create"`
BaseID int `short:"i" long:"baseID" default:"1" description:"The base ID to use"`
UePool string `short:"u" long:"ue-pool" default:"17.0.0.0/24" description:"The UE pool address"`
GnBAddress string `short:"g" long:"gnb-addr" description:"The UE pool address"`
AppFilterString string `short:"a" long:"app-filter" description:"Specify an application filter. Format: '<Protocol>:<IP>/<SubnetMask>:<Port>-<Port>:<action>' . e.g. 'udp:10.0.0.0/8:80-88:allow'"`
QFI uint8 `short:"q" long:"qfi" description:"The QFI value for QERs. Max value 64."`
GateClosed bool `short:"t" long:"gate-status" description:"If set, the QER gate status will be CLOSED"`
QFI uint8 `short:"q" long:"qfi" description:"The QFI value for QERs. Max value 64."`
GateClosed bool `short:"t" long:"gate-closed" description:"If set, the QER gate status will be CLOSED"`
}

type sessionCreate struct {
Args struct{
Args struct {
commonArgs
}
}

type sessionModify struct {
Args struct {
commonArgs
BufferFlag bool `short:"b" long:"buffer" description:"If set, downlink FARs will have the buffer flag set to true"`
BufferFlag bool `short:"b" long:"buffer" description:"If set, downlink FARs will have the buffer flag set to true"`
NotifyCPFlag bool `short:"n" long:"notifycp" description:"If set, downlink FARs will have the notify CP flag set to true"`
}
}

type sessionDelete struct {
Args struct{
Count int `short:"c" long:"count" default:"1" description:"The number of sessions to create"`
Args struct {
Count int `short:"c" long:"count" default:"1" description:"The number of sessions to create"`
BaseID int `short:"i" long:"baseID" default:"1" description:"The base ID to use"`
}
}
Expand All @@ -61,24 +60,14 @@ func (s *sessionCreate) Execute(args []string) error {
client := connect()
defer disconnect()

if s.Args.AppFilterString != "" {
splittedString := strings.Split(s.Args.AppFilterString, ":")
if len (splittedString) != 4 {
log.Fatalf("Provided an incorrect/incomplete app filter string: %v", s.Args.AppFilterString)
}

proto, ipNetAddr, portRange, action := splittedString[0], splittedString[1], splittedString[2], splittedString[3]
//FIXME incomplete
}

res, err := client.CreateSession(context.Background(), &pb.CreateSessionRequest{
Count: int32(s.Args.Count),
BaseID: int32(s.Args.BaseID),
NodeBAddress: s.Args.GnBAddress,
UeAddressPool: s.Args.UePool,
SdfFilter: s.Args.SDFfilter,
Qfi: int32(s.Args.QFI),
GateClosed: s.Args.GateClosed,
AppFilter: s.Args.AppFilterString,
Qfi: int32(s.Args.QFI),
GateClosed: s.Args.GateClosed,
})

if err != nil {
Expand Down
Loading

0 comments on commit 34d259a

Please sign in to comment.