Session Handling
For updates of the PGW or other critical components, the impact should be reduced by having as little sessions as possible on the PGW. To achieve this, requests for new sessions can be rejected. When devices detach, the number of sessions will decrease. In addition, sessions can be actively terminated.
Both actions are triggered through API. To access the API, use a port-forward, for example:
Reject New Contexts/Sessions
Check the internal state to accept new sessions through the API:
Change the internal state to accept new sessions:
Drain Sessions
Caution
Draining sessions increases the memory usage that mainly depends on the current number of sessions and not on the number of sessions to delete (around 2.6GB for 250k current sessions). Remove a large number of sessions (for example, 2000) at once instead of repeatedly removing a small number of sessions.
Drain existing sessions:
Drain existing sessions in a loop:
Using the ergw Erlang API without a specific type refers to contexts of all types. The following commands delete both GTP-initiated and TDF (PFCP-initiated) contexts:
Get TDF Sessions
FEATURE STATE: alpha
Obtain contexts per type from an Erlang shell:
Using the ergw Erlang API without a specific type refers to contexts of all types. The following commands delete both GTP-initiated and TDF (PFCP-initiated) contexts:
Drain TDF Sessions
FEATURE STATE: alpha
Drain sessions per type from an Erlang shell:
Caution
The following script can be used at an Erlang shell to manually remove TDF contexts in previous releases. Incorrect usage may result in session termination without AAA termination and may cause a node reboot.
Split is provided due to the limitations of lists:split/2.
List and close PFCP associations
All existing PFCP associations can be found through the Sx node registry using ergw_sx_node_reg:all():
A single PFCP association can be removed through ergw_sx_node:down(Key), where Key is either the PID of the Sx process or any other key the association is registered with. In the example above, the key can be either the linked PID (for example <0.3179.0>), the IP of the PFCP peer in tuple form (for example {127,0,200,1}) or the FQDN of the PFCP peer in binary format (for example <<"topon.sx.prox01.epc.mnc001.mcc001.3gppnetwork.org">>).
Note
Invoking down will behave as if a node down (no PFCP Echo response) were detected. All sessions that existed in that UPF will receive a down notification and be closed. The retry counter for PFCP Association Requests will also be reset to 0, triggering an immediate reconnection attempt.