Skip to content

Commit

Permalink
Add and expose method to send a raw PFCP teardown request (#48)
Browse files Browse the repository at this point in the history
* Add and expose method to send a raw PFCP teardown request

* Don't reset seq number for teardown request
  • Loading branch information
Tomasz Osiński authored Mar 8, 2022
1 parent 01d2b5f commit 5d95a02
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkg/pfcpsim/pfcpsim.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ func (c *PFCPClient) SendAssociationSetupRequest(ie ...*ieLib.IE) error {
return c.sendMsg(assocReq)
}

// SendAssociationTeardownRequest sends PFCP Teardown Request towards a peer.
// A caller should make sure that the PFCP connection is established before invoking this function.
func (c *PFCPClient) SendAssociationTeardownRequest(ie ...*ieLib.IE) error {
teardownReq := message.NewAssociationReleaseRequest(0,
ieLib.NewNodeID(c.conn.RemoteAddr().String(), "", ""),
)

teardownReq.IEs = append(teardownReq.IEs, ie...)

return c.sendMsg(teardownReq)
}

func (c *PFCPClient) SendHeartbeatRequest() error {
hbReq := message.NewHeartbeatRequest(
c.getNextSequenceNumber(),
Expand Down Expand Up @@ -321,13 +333,7 @@ func (c *PFCPClient) TeardownAssociation() error {
return NewAssociationInactiveError()
}

ie1 := ieLib.NewNodeID(c.conn.RemoteAddr().String(), "", "")

c.resetSequenceNumber()

msg := message.NewAssociationReleaseRequest(0, ie1)

err := c.sendMsg(msg)
err := c.SendAssociationTeardownRequest()
if err != nil {
return err
}
Expand Down

0 comments on commit 5d95a02

Please sign in to comment.