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

SDCORE-472 SMF Scale issue, SMF not responding with PDU Sess Modify Rsp #75

Merged
merged 3 commits into from
Nov 12, 2021

Conversation

UpadhyayaAnkur
Copy link
Contributor

No description provided.

fsm/txnFsm.go Outdated
httpResponse := &http_wrapper.Response{
Header: nil,
Status: http.StatusNotFound,
Body: models.UpdateSmContextErrorResponse{
Copy link
Contributor Author

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.

Copy link
Contributor Author

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())
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

producer/pdu_session.go Show resolved Hide resolved
producer/pdu_session.go Show resolved Hide resolved
producer/pdu_session.go Show resolved Hide resolved
}

// 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")
Copy link
Contributor

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

Copy link
Contributor Author

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.

@UpadhyayaAnkur
Copy link
Contributor Author

test container

3 similar comments
@UpadhyayaAnkur
Copy link
Contributor Author

test container

@yoooou
Copy link
Contributor

yoooou commented Oct 4, 2021

test container

@yoooou
Copy link
Contributor

yoooou commented Oct 4, 2021

test container

SmStateActivePending
SmStateActive
SmStateInActivePending
SmStateModify
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Carefully name the states.

Copy link
Contributor Author

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
Copy link
Contributor

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 ?

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 ?

Copy link
Contributor Author

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
Copy link
Contributor

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 ?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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())
Copy link
Contributor

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 ?

Copy link
Contributor Author

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)
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

Copy link
Contributor Author

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")
Copy link
Contributor

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 ?

Copy link
Contributor Author

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 {
Copy link
Contributor

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
Copy link
Contributor

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())
Copy link
Contributor

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

Copy link
Contributor Author

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.

@UpadhyayaAnkur
Copy link
Contributor Author

retest this please

@UpadhyayaAnkur
Copy link
Contributor Author

retest container

@UpadhyayaAnkur UpadhyayaAnkur merged commit 1872bb2 into onf-release3.0.5 Nov 12, 2021
@UpadhyayaAnkur UpadhyayaAnkur deleted the dev-sdcore-472 branch November 15, 2021 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants