-
Notifications
You must be signed in to change notification settings - Fork 29
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
SDCORE-472 SMF Scale issue, SMF not responding with PDU Sess Modify Rsp #75
Conversation
fsm/txnFsm.go
Outdated
httpResponse := &http_wrapper.Response{ | ||
Header: nil, | ||
Status: http.StatusNotFound, | ||
Body: models.UpdateSmContextErrorResponse{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shall fix this, it should be DeleteSmContextErrorResponse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4xx/5xx Error not defined in spec 29502 for Release SM ctxt error, so shall be initiating 404 Not Found(with Problem detail as per note-1, Spec-29502,
table - 6.1.3.3.4.3.2-2) for context not found case.
fsm/handler.go
Outdated
|
||
if err := producer.SendPduSessN1N2Transfer(smCtxt, false); err != nil { | ||
smCtxt.SubFsmLog.Error("N1N2 transfer failure error, %v ", err.Error()) | ||
return smf_context.SmStateN1N2TransferPending, fmt.Errorf("N1N2 Transfer failure error, %v ", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N1N2 transfer is failed then should move the smcontext state to the pending state?
type SmEvent uint | ||
|
||
const ( | ||
SmEventInvalid SmEvent = iota |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, i would like to free5gc fsm to define states, transitions etc. this we can take care in our next commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vijaya can you pls elaborate your comment ?
smContext := txn.Ctxt.(*smf_context.SMContext) | ||
|
||
//If already Active Txn running then post it to SMF Txn Bus | ||
if smContext.ActiveTxn != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add error/warning log if active txn is not exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not bug that there is no active txn, it simply checks that if there is already active txn running then queue current txn and for that log is already there at line 80
//Initiate N1N2 Transfer | ||
|
||
//nextTxn.StartTxnLifeCycle(SmfTxnFsmHandle) | ||
<-nextTxn.Status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this goroutine block until it receives txn status. can we add timer to come out after n sec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, txn timeout code need to be added.
} | ||
|
||
// Query UDM | ||
if problemDetails, err := consumer.SendNFDiscoveryUDM(); err != nil { | ||
smContext.SubPduSessLog.Errorf("PDUSessionSMContextCreate, send NF Discovery Serving UDM Error[%v]", err) | ||
var httpResponse = smContext.GeneratePDUSessionEstablishmentReject("UDMDiscoveryFailure") | ||
return httpResponse, "UdmError", smContext | ||
txn.Rsp = smContext.GeneratePDUSessionEstablishmentReject("UDMDiscoveryFailure") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have enum for this reject cause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are keyword(string) for picking up pre-configured error response from map. However, I agree that it should be enum rather than plain string.
59d708d
to
c5c621a
Compare
test container |
3 similar comments
test container |
test container |
test container |
SmStateActivePending | ||
SmStateActive | ||
SmStateInActivePending | ||
SmStateModify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify is not stable state right ? Should be ModifyPending ?
SmStatePfcpRelease | ||
SmStateRelease | ||
SmStateN1N2TransferPending | ||
SmStateMax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carefully name the states.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
States need to be revisited. With initial framework, I just defined for completeness and consistency in naming. I shall be renaming/removing as required for procedures
SubFsmLog *logrus.Entry | ||
|
||
//TxnBus per subscriber | ||
TxnBus transaction.TxnBus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is TxnBus same as PendingTransactions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, pending txn queue of that SM context
SmStateInit SMContextState = iota | ||
SmStateActivePending | ||
SmStateActive | ||
SmStateInActivePending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this PDU release pending or something else ?
SmStatePfcpCreatePending | ||
SmStatePfcpModify | ||
SmStatePfcpRelease | ||
SmStateRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this stable ngap release state ? Where paging should be triggered in case downlink data is received
Txn interface{} | ||
} | ||
|
||
//Define FSM Func Point Struct here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good, if we tell what's expected out of this function.. Looks like it gives next state and error ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definition of function pointer matrix of FSM. Later in init(), I have initialised it with default handlers and overridden with actual handlers wherever applicable.
SmfFsmHandler[smf_context.SmStatePfcpCreatePending][SmEventPduSessN1N2Transfer] = HandleStatePfcpCreatePendingEventN1N2Transfer | ||
SmfFsmHandler[smf_context.SmStateN1N2TransferPending][SmEventPduSessN1N2Transfer] = HandleStateN1N2TransferPendingEventN1N2Transfer | ||
SmfFsmHandler[smf_context.SmStateActive][SmEventPduSessModify] = HandleStateActiveEventPduSessModify | ||
SmfFsmHandler[smf_context.SmStateActive][SmEventPduSessRelease] = HandleStateActiveEventPduSessRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you define Abort, timeout events somewhere else ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Abort shall be defined as part of this matrix itself. Yet to do
func InitFsm() { | ||
|
||
SmfFsmHandler[smf_context.SmStateInit][SmEventPduSessCreate] = HandleStateInitEventPduSessCreate | ||
SmfFsmHandler[smf_context.SmStatePfcpCreatePending][SmEventPfcpSessCreate] = HandleStatePfcpCreatePendingEventPfcpSessCreate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should context replacement state/event handling be part of this array or its handled as a part of function handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wanted to keep state/event based handling, however, it required additional changes so kept it as part of new call handling function(as existing) But I shall do it as state/event based as that looks very clean approach
SmfFsmHandler[smf_context.SmStateActive][SmEventPduSessRelease] = HandleStateActiveEventPduSessRelease | ||
} | ||
|
||
func HandleEvent(smContext *smf_context.SMContext, event SmEvent, eventData SmEventData) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment in this function will help. 1/2 liner.
txn := eventData.Txn.(*transaction.Transaction) | ||
smCtxt := txn.Ctxt.(*smf_context.SMContext) | ||
smCtxt.SubFsmLog.Errorf("unhandled event[%s] ", event.String()) | ||
return smCtxt.SMContextState, fmt.Errorf("fsm error, unhandled event[%s] and event data[%s] ", event.String(), eventData.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if we hit events here. Just logging or something more ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Error is returned for unhandled event, Txn FSM shall take it to Txn-Failure handling and there we should add sending error rsp as part of txn failure for each type of event.
txn := eventData.Txn.(*transaction.Transaction) | ||
smCtxt := txn.Ctxt.(*smf_context.SMContext) | ||
|
||
producer.SendPFCPRules(smCtxt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this always success ? What if peer is down ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shall send PFCP msg and then block on response channel. If peer is down then timeout/failure response shall come from PFCP layer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shall send PFCP msg and then block on response channel. If peer is down then timeout/failure response shall come from PFCP layer
case smf_context.SessionEstablishFailed: | ||
fallthrough | ||
default: | ||
smCtxt.SubFsmLog.Error("pfcp session establish response failure") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when we come in default case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout and Abort cases I had in mind so kept default case
fsm/handler.go
Outdated
txn := eventData.Txn.(*transaction.Transaction) | ||
smCtxt := txn.Ctxt.(*smf_context.SMContext) | ||
|
||
if err := producer.SendPduSessN1N2Transfer(smCtxt, false); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little bit confusion here. SendPduSessN1N2Transfer is the API smf consuming. Why it's part of producer package ?
|
||
func HandleStateActiveEventPduSessCreate(event SmEvent, eventData *SmEventData) (smf_context.SMContextState, error) { | ||
|
||
//Context Replacement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log would help here.
fsm/txnFsm.go
Outdated
|
||
func (SmfTxnFsm) TxnCtxtRun(txn *transaction.Transaction) (transaction.TxnEvent, error) { | ||
|
||
txn.TxnFsmLog.Debugf("handle event[%v] ", transaction.TxnEventRun.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this log be in common place instead of every handler adding this log at the start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All txn state level logs I shall remove as generic caller already as log as requested by you.
retest this please |
bb3ff9e
to
38aaf44
Compare
retest container |
No description provided.