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

Update pfcpsim dep #4

Merged
merged 4 commits into from
Apr 9, 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
4 changes: 2 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
branches:
- master
push:
branches:
- master
# branches:
# - master

jobs:
build:
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ require (
github.com/google/gopacket v1.1.19
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/libp2p/go-reuseport v0.1.0
github.com/omec-project/pfcpsim v0.1.0
github.com/omec-project/pfcpsim v1.0.0
github.com/p4lang/p4runtime v1.3.0
github.com/prometheus/client_golang v1.11.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
github.com/wmnsk/go-pfcp v0.0.14
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.9.0
github.com/wmnsk/go-pfcp v0.0.19
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1
google.golang.org/grpc v1.56.3
google.golang.org/protobuf v1.33.0
Expand Down Expand Up @@ -47,6 +47,6 @@ require (
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.1.0 // indirect
)
20 changes: 11 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/omec-project/pfcpsim v0.1.0 h1:bVns5jF9bZvleejQNNHBvzvA/PtQTBxUE0YnLS4XyXE=
github.com/omec-project/pfcpsim v0.1.0/go.mod h1:ELaB0bjuNv7TEWN0Nx+HX4yQx0uevmdw/3GM+Kny7Ko=
github.com/omec-project/pfcpsim v1.0.0 h1:6vv0vdKS0vIWVi/HxHguIwMk4Av4x9BsAAMvGPHEsxE=
github.com/omec-project/pfcpsim v1.0.0/go.mod h1:KpZns0wcb+ZZRgaK1dPZG4MigtNMvxvTC6FA579cVyE=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM=
Expand Down Expand Up @@ -156,19 +156,20 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/wmnsk/go-pfcp v0.0.14 h1:PMX7zKZYHaRM8qgjle45a/yis4q9hOAwRTfBMt+o7U4=
github.com/wmnsk/go-pfcp v0.0.14/go.mod h1:QKYWo1Wac4hc1Ut1YeaPKxcYUf8oHBZyqODJC6VAPBI=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/wmnsk/go-pfcp v0.0.19 h1:jLZpmunrG2eJ+4Lr/HDq8j+/2Z1JEq5TwQoF/hklxAg=
github.com/wmnsk/go-pfcp v0.0.19/go.mod h1:GdZzvBajb3sNUP8ohAhXcVgzuckLPe/fVBJlzJSIqXs=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
Expand Down Expand Up @@ -226,6 +227,7 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -286,8 +288,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk=
gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ=
Expand Down
1 change: 1 addition & 0 deletions pfcpiface/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type Conf struct {
RespTimeout string `json:"resp_timeout"`
EnableHBTimer bool `json:"enable_hbTimer"`
HeartBeatInterval string `json:"heart_beat_interval"`
N4Addr string `json:"n4_addr"`
}

// QciQosConfig : Qos configured attributes.
Expand Down
3 changes: 2 additions & 1 deletion pfcpiface/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ type PFCPNode struct {

// NewPFCPNode create a new PFCPNode listening on local address.
func NewPFCPNode(upf *upf) *PFCPNode {
conn, err := reuse.ListenPacket("udp", ":"+PFCPPort)
conn, err := reuse.ListenPacket("udp",
upf.n4addr+":"+PFCPPort)
Copy link
Author

Choose a reason for hiding this comment

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

If n4addr is not set, upf will listening on 0.0.0.0:8805, it causes the pfcpsim can not listening on any ip with port 8805 on the same host.

if err != nil {
log.Fatalln("ListenUDP failed", err)
}
Expand Down
3 changes: 2 additions & 1 deletion pfcpiface/parse_far.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ func (f *far) parseFAR(farIE *ie.IE, fseid uint64, upf *upf, op operation) error

f.farID = farID

action, err := farIE.ApplyAction()
actionByte, err := farIE.ApplyAction()
if err != nil {
return err
}

var action uint8 = actionByte[0]
if action == 0 {
return ErrInvalidArgument("FAR Action", action)
}
Expand Down
2 changes: 2 additions & 0 deletions pfcpiface/upf.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type upf struct {
enableUeIPAlloc bool
enableEndMarker bool
enableFlowMeasure bool
n4addr string
accessIface string
coreIface string
ippoolCidr string
Expand Down Expand Up @@ -128,6 +129,7 @@ func NewUPF(conf *Conf, fp datapath) *upf {
maxReqRetries: conf.MaxReqRetries,
enableHBTimer: conf.EnableHBTimer,
readTimeout: time.Second * time.Duration(conf.ReadTimeout),
n4addr: conf.N4Addr,
}

if len(conf.CPIface.Peers) > 0 {
Expand Down
13 changes: 8 additions & 5 deletions test/integration/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestUPFBasedUeIPAllocation(t *testing.T) {
WithDownlinkIP(testcase.input.nbAddress).BuildFAR(),
}

err := pfcpClient.SendSessionEstablishmentRequest(pdrs, fars, nil)
err := pfcpClient.SendSessionEstablishmentRequest(pdrs, fars, nil, nil)
require.NoError(t, err)

resp, err := pfcpClient.PeekNextResponse()
Expand Down Expand Up @@ -161,6 +161,9 @@ func TestDetectUP4Restart(t *testing.T) {
WithDownlinkMBR(500000).
WithUplinkGBR(0).
WithDownlinkGBR(0).Build(),
}, []*ie.IE{
session.NewURRBuilder().WithMethod(session.Create).WithID(1).
WithMeasurementMethod(1, 1, 1).WithReportingTrigger(session.ReportingTrigger{Flags: 1}).Build(),
})
}

Expand Down Expand Up @@ -614,7 +617,7 @@ func testUEAttach(t *testing.T, testcase *testCase) {
))
}

sess, err := pfcpClient.EstablishSession(pdrs, fars, qers)
sess, err := pfcpClient.EstablishSession(pdrs, fars, qers, nil)
testcase.expected.pdrs = pdrs
testcase.expected.fars = fars
testcase.expected.qers = qers
Expand All @@ -628,7 +631,7 @@ func testUEAttach(t *testing.T, testcase *testCase) {
WithMethod(session.Update).WithID(2).
WithAction(ActionForward).WithDstInterface(ie.DstInterfaceAccess).
WithTEID(testcase.input.dlTEID).WithDownlinkIP(testcase.input.nbAddress).BuildFAR(),
}, nil)
}, nil, nil)

verifyEntries(t, testcase.input, testcase.expected, UEStateAttached)
}
Expand All @@ -643,7 +646,7 @@ func testUEBuffer(t *testing.T, testcase *testCase) {
WithDownlinkIP(testcase.input.nbAddress).BuildFAR(),
}

err := pfcpClient.ModifySession(testcase.session, nil, fars, nil)
err := pfcpClient.ModifySession(testcase.session, nil, fars, nil, nil)
require.NoError(t, err)

verifyEntries(t, testcase.input, testcase.expected, UEStateBuffering)
Expand All @@ -657,7 +660,7 @@ func testUEBuffer(t *testing.T, testcase *testCase) {
WithDownlinkIP(testcase.input.nbAddress).BuildFAR(),
}

err = pfcpClient.ModifySession(testcase.session, nil, fars, nil)
err = pfcpClient.ModifySession(testcase.session, nil, fars, nil, nil)
require.NoError(t, err)

verifyEntries(t, testcase.input, testcase.expected, UEStateAttached)
Expand Down
8 changes: 5 additions & 3 deletions test/integration/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,16 @@
require.NoError(t, err)
MustStartPFCPAgent()
case ModeNative:
pfcpAgent = pfcpiface.NewPFCPIface(GetConfig(os.Getenv(EnvDatapath), configType))
upfConf := GetConfig(os.Getenv(EnvDatapath), configType)
upfConf.N4Addr = "127.0.0.8"
pfcpAgent = pfcpiface.NewPFCPIface(upfConf)
go pfcpAgent.Run()
default:
t.Fatal("Unexpected test mode")
}

pfcpClient = pfcpsim.NewPFCPClient("127.0.0.1")
err := pfcpClient.ConnectN4("127.0.0.1")
pfcpClient = pfcpsim.NewPFCPClient("127.0.0.7")
err := pfcpClient.ConnectN4("127.0.0.8")

Check failure on line 347 in test/integration/framework.go

View workflow job for this annotation

GitHub Actions / integration-tests-bess

not enough arguments in call to pfcpClient.ConnectN4

Check failure on line 347 in test/integration/framework.go

View workflow job for this annotation

GitHub Actions / integration-tests-up4

not enough arguments in call to pfcpClient.ConnectN4

Check failure on line 347 in test/integration/framework.go

View workflow job for this annotation

GitHub Actions / lint

not enough arguments in call to pfcpClient.ConnectN4
require.NoErrorf(t, err, "failed to connect to UPF")

// wait for PFCP Agent to initialize, blocking
Expand Down
Loading