Skip to content

Commit

Permalink
feat: add simple association update support
Browse files Browse the repository at this point in the history
Merge pull request #6 from edgecomllc/1-move-association-update-support-to-public-repo
  • Loading branch information
pirog-spb authored Dec 16, 2024
1 parent 40f00fe commit a1d1f14
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
11 changes: 11 additions & 0 deletions cmd/core/display_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ func printAssociationSetupRequest(req *message.AssociationSetupRequest) {
log.Info().Msg(sb.String())
}

func printAssociationUpdateRequest(req *message.AssociationUpdateRequest) {
var sb strings.Builder
sb.WriteString("\n")
writeLineTabbed(&sb, "Association Update Request:", 0)
nodeId, err := req.NodeID.NodeID()
if err == nil {
writeLineTabbed(&sb, fmt.Sprintf("Node ID: %s", nodeId), 1)
}
log.Info().Msg(sb.String())
}

func printSessionEstablishmentRequest(req *message.SessionEstablishmentRequest) {
var sb strings.Builder
sb.WriteString("\n")
Expand Down
1 change: 1 addition & 0 deletions cmd/core/pfcp_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var pfcpHandlers = PfcpHandlerMap{
message.MsgTypeHeartbeatResponse: HandlePfcpHeartbeatResponse,
message.MsgTypeAssociationSetupRequest: HandlePfcpAssociationSetupRequest,
message.MsgTypeAssociationSetupResponse: HandlePfcpAssociationSetupResponse,
message.MsgTypeAssociationUpdateRequest: HandlePfcpAssociationUpdateRequest,
message.MsgTypeSessionEstablishmentRequest: HandlePfcpSessionEstablishmentRequest,
message.MsgTypeSessionDeletionRequest: HandlePfcpSessionDeletionRequest,
message.MsgTypeSessionModificationRequest: HandlePfcpSessionModificationRequest,
Expand Down
47 changes: 47 additions & 0 deletions cmd/core/pfcp_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,53 @@ func HandlePfcpAssociationSetupRequest(conn *PfcpConnection, msg message.Message
return asres, nil
}

func HandlePfcpAssociationUpdateRequest(conn *PfcpConnection, msg message.Message, addr string) (message.Message, error) {
asreq := msg.(*message.AssociationUpdateRequest)
log.Info().Msgf("Got Association Update Request from: %s", addr)
if asreq.NodeID == nil {
log.Warn().Msgf("Got Association Update Request without NodeID from: %s", addr)
// Reject with cause

PfcpMessageRxErrors.WithLabelValues(msg.MessageTypeName(), causeToString(ie.CauseMandatoryIEMissing)).Inc()
asres := message.NewAssociationUpdateResponse(asreq.SequenceNumber,
ie.NewCause(ie.CauseMandatoryIEMissing),
)
return asres, nil
}
printAssociationUpdateRequest(asreq)
// Get NodeID
remoteNodeID, err := asreq.NodeID.NodeID()
if err != nil {
log.Warn().Msgf("Got Association Update Request with invalid NodeID from: %s", addr)
PfcpMessageRxErrors.WithLabelValues(msg.MessageTypeName(), causeToString(ie.CauseMandatoryIEIncorrect)).Inc()
asres := message.NewAssociationUpdateResponse(asreq.SequenceNumber,
ie.NewCause(ie.CauseMandatoryIEIncorrect),
)
return asres, nil
}

conn.associationMutex.Lock()
defer conn.associationMutex.Unlock()
if _, ok := conn.NodeAssociations[addr]; !ok {
log.Warn().Msgf("Association with NodeID: %s and address: %s doesn't exist", remoteNodeID, addr)
PfcpMessageRxErrors.WithLabelValues(msg.MessageTypeName(), causeToString(ie.CauseNoEstablishedPFCPAssociation)).Inc()
asres := message.NewAssociationUpdateResponse(asreq.SequenceNumber,
ie.NewCause(ie.CauseNoEstablishedPFCPAssociation),
)
return asres, nil
}

// shall send a PFCP Association Update Response including:
asres := message.NewAssociationUpdateResponse(asreq.SequenceNumber,
newIeNodeID(conn.nodeId), // its Node ID;
ie.NewCause(ie.CauseRequestAccepted), // a successful cause
)

// Send AssociationUpdateResponse
PfcpMessageRxErrors.WithLabelValues(msg.MessageTypeName(), causeToString(ie.CauseRequestAccepted)).Inc()
return asres, nil
}

func newIeNodeID(nodeID string) *ie.IE {
ip := net.ParseIP(nodeID)
if ip != nil {
Expand Down
6 changes: 3 additions & 3 deletions docs/eupf_3gpp_compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ eUPF implements 5G UPF functions according to 3GPP TS 129 244 version 16.4.0 Rel
|Overload Control | `N` | TS 129 244: 6.2.4 Overload Control Procedure |
|PFD Management | `N` | TS 129 244: 6.2.5 PFCP PFD Management Procedure |
|Association Setup | `Y` | TS 129 244: 6.2.6 PFCP Association Setup Procedure |
|Association Update | `N` | TS 129 244: 6.2.7 PFCP Association Update Procedure |
|Association Update | `Y` | TS 129 244: 6.2.7 PFCP Association Update Procedure |
|Association Release | `N` | TS 129 244: 6.2.8 PFCP Association Release Procedure |
|Node Report | `N` | TS 129 244: 6.2.9 PFCP Node Report Procedure |
|Session Establishment | `Y` | TS 129 244: 6.3.2 PFCP Session Establishment Procedure |
Expand All @@ -31,8 +31,8 @@ eUPF implements 5G UPF functions according to 3GPP TS 129 244 version 16.4.0 Rel
| PFD Management Response | `N` | TS 129 244: 7.4.3.2 PFCP PFD Management Response |
| Association Setup Request | `Y` | TS 129 244: 7.4.4.1 PFCP Association Setup Request |
| Association Setup Response | `Y` | TS 129 244: 7.4.4.2 PFCP Association Setup Response|
| Association Update Request | `N` | TS 129 244: 7.4.4.3 PFCP Association Update Request|
| Association Update Response | `N` | TS 129 244: 7.4.4.4 PFCP Association Update Response|
| Association Update Request | `Y` | TS 129 244: 7.4.4.3 PFCP Association Update Request|
| Association Update Response | `Y` | TS 129 244: 7.4.4.4 PFCP Association Update Response|
| Association Release Request | `N` | TS 129 244: 7.4.4.5 PFCP Association Release Request|
| Association Release Response | `N` | TS 129 244: 7.4.4.6 PFCP Association Release Response|
| Version Not Supported Response | `N` | TS 129 244: 7.4.4.7 PFCP Version Not Supported Response|
Expand Down

0 comments on commit a1d1f14

Please sign in to comment.