Skip to content

Commit

Permalink
fix: remove urr when deactivate tunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Sep 11, 2024
1 parent 440edfd commit 53befc3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
28 changes: 24 additions & 4 deletions internal/context/datapath.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ func (node *DataPathNode) DeactivateUpLinkTunnel(smContext *SMContext) {
if far := pdr.FAR; far != nil {
err = node.UPF.RemoveFAR(far)
if err != nil {
logger.CtxLog.Warnln("Deactivated UpLinkTunnel", err)
logger.CtxLog.Warnln("Deactivated UpLinkTunnel RemoveFAR", err)
}

bar := far.BAR
if bar != nil {
err = node.UPF.RemoveBAR(bar)
if err != nil {
logger.CtxLog.Warnln("Deactivated UpLinkTunnel", err)
logger.CtxLog.Warnln("Deactivated UpLinkTunnel RemoveBAR", err)
}
}
}
Expand All @@ -201,7 +201,17 @@ func (node *DataPathNode) DeactivateUpLinkTunnel(smContext *SMContext) {
if qer != nil {
err = node.UPF.RemoveQER(qer)
if err != nil {
logger.CtxLog.Warnln("Deactivated UpLinkTunnel", err)
logger.CtxLog.Warnln("Deactivated UpLinkTunnel RemoveQER", err)
}
}
}
}

if urrList := pdr.URR; urrList != nil {
for _, urr := range urrList {
if urr != nil {
if err = node.UPF.RemoveURR(urr); err != nil {
logger.CtxLog.Warnln("Deactivated UpLinkTunnel RemoveURR:", err)
}
}
}
Expand Down Expand Up @@ -236,7 +246,17 @@ func (node *DataPathNode) DeactivateDownLinkTunnel(smContext *SMContext) {
if qer != nil {
err = node.UPF.RemoveQER(qer)
if err != nil {
logger.CtxLog.Warnln("Deactivated UpLinkTunnel", err)
logger.CtxLog.Warnln("Deactivated DownLinkTunnel", err)
}
}
}
}

if urrList := pdr.URR; urrList != nil {
for _, urr := range urrList {
if urr != nil {
if err = node.UPF.RemoveURR(urr); err != nil {
logger.CtxLog.Warnln("Deactivated DownLinkTunnel RemoveURR:", err)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/context/upf.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ func (upf *UPF) RemoveQER(qer *QER) (err error) {
return nil
}

// TODO: add unit test
func (upf *UPF) RemoveURR(urr *URR) (err error) {
if upf.UPFStatus != AssociatedSetUpSuccess {
err = fmt.Errorf("UPF[%s] not Associate with SMF", upf.NodeID.ResolveNodeIdToIp().String())
Expand Down

0 comments on commit 53befc3

Please sign in to comment.