HewlettPackard / PacketRusher

High performance 5G UE/gNB Simulator and CP/UP load tester.
Apache License 2.0
100 stars 21 forks source link

[TEST] Add state machine #63

Closed Raguideau closed 5 months ago

Raguideau commented 6 months ago

Types of changes

linouxis9 commented 6 months ago

Thanks for the new commit! It's not exactly what we should do. The state machine should be intrinsic to the aio5gc, it should not be set by the tests. The whole point of having a state machine in aio5gc is that you don't have to do things like this:

    if !ue.GetInitialContextSetup() {
        return errors.New("[5GC][NGAP] This UE has no security context set up")
    }
    if ue != ranUe {
        return errors.New("[5GC][NGAP] RanUeNgapId does not match the one registred for this UE")
    }

Basically, the point is that you have one handler per state (eg. the callback). You don't need to do these kinds of checks: In the Registered state handler, you can handle a Session Establishment PDU, and a Deregister. However, it won't be possible in the fresh state handler. And then we can have hooks in each of these handlers (using a map msg.MsgType -> hook and call it generically from each callbacks.)

Note that you can have several PDU Sessions, so you'll need a global state machine + one per PDU Session (this is what's normally done in the AMF for the 5GMM state machine the SMF for the 5GSM state machine per PDU Session).

This is something we would also need to implement on PacketRusher's side instead of our current big global handler.

See for reference: 24.501 Figure 5.1.3.2.1.1.1: 5GMM main states in the UE: https://www.tech-invite.com/3m24/toc/tinv-3gpp-24-501_l.html

And 24.501 Figure 6.1.3.2.1.1: The 5GSM sublayer states for PDU session handling in the UE: https://www.tech-invite.com/3m24/toc/tinv-3gpp-24-501_zg.html

linouxis9 commented 6 months ago

Thanks a lot for your work! Make sure to sign DCO for the previous commits as well See the commands at: https://github.com/HewlettPackard/PacketRusher/pull/63/checks?check_run_id=20501740969