UserPlaneNodeControl.h Source File

Simu5G: UserPlaneNodeControl.h Source File
Simu5G
UserPlaneNodeControl.h
1//
2// Simu5G
3//
4// Authors: Andras Varga (OpenSim Ltd)
5//
6// This file is part of a software released under the license included in file
7// "license.pdf". Please read LICENSE and README files before using it.
8// The above files and the present reference are part of the software itself,
9// and cannot be removed from it.
10//
11
12#ifndef _USERPLANENODECONTROL_H_
13#define _USERPLANENODECONTROL_H_
14
15#include <string>
16
17#include <inet/common/ModuleRefByPar.h>
18#include <inet/networklayer/common/L3Address.h>
19
20#include "simu5g/common/LteCommon.h"
21#include "simu5g/common/QfiRuleSet.h"
22#include "simu5g/common/binder/Binder.h"
23#include "simu5g/corenetwork/gtp/GtpTunnel.h"
24
25namespace simu5g {
26
28class GtpUser;
30
37class UserPlaneNodeControl : public omnetpp::cSimpleModule
38{
39 protected:
40 CoreNodeType nodeType_ = UPF;
41 std::string gateway_;
42
43 inet::ModuleRefByPar<Binder> binder_;
44 inet::ModuleRefByPar<GtpUser> gtpUser_;
45 inet::ModuleRefByPar<TrafficFlowFilter> trafficFlowFilter_;
46 inet::ModuleRefByPar<EthernetSessionMux> ethernetBridge_; // the node's Ethernet session bridge, or nullptr
47
48 // The node's TEID space: the TEID allocated last (see allocateTeid())
49 Teid lastTeid_ = TEID_NONE;
50
51 // The transport address of the node's tunnel endpoint, resolved on first use: the
52 // node's addresses are assigned after INITSTAGE_LOCAL (see getAddress())
53 inet::L3Address address_;
54
55 // The N6 end of the Unstructured sessions this node anchors, as configured (the
56 // unstructured* parameters), checked and resolved at the first such session (see
57 // getN6Configuration()): the prefix the sessions' N6 addresses are allocated
58 // from, the server's address, and the ports
59 bool n6Configured_ = false;
60 inet::L3Address unstructuredPrefix_;
61 int unstructuredPrefixLength_ = -1;
62 inet::L3Address unstructuredServer_;
63 int unstructuredServerPort_ = -1;
64 int unstructuredPort_ = -1;
65
66 protected:
67 int numInitStages() const override { return inet::NUM_INIT_STAGES; }
68 void initialize(int stage) override;
69 void handleMessage(omnetpp::cMessage *msg) override { throw omnetpp::cRuntimeError("This module does not process messages"); }
70
71 // Hand out the next TEID of the node's TEID space. TEIDs are allocated in
72 // increasing order and never reused within a run, so a G-PDU still in flight on a
73 // released tunnel cannot be taken for a later session's.
74 virtual Teid allocateTeid();
75
76 // The transport address of the node's tunnel endpoint: that of the network node
77 virtual const inet::L3Address& getAddress();
78
79 // Check and resolve the unstructured* parameters; throws if they do not describe
80 // the N6 end of Unstructured sessions
81 virtual void configureN6();
82
83 public:
84 CoreNodeType getNodeType() const { return nodeType_; }
85 const std::string& getGateway() const { return gateway_; }
86
87 // The node's downlink QFI classification rules, installed into the traffic flow
88 // filter (5GC: the PDRs/QERs PFCP would carry)
89 virtual void setDownlinkClassifierRules(QfiRuleSet&& rules);
90
91 // The prefix the N6 addresses of the Unstructured sessions this node anchors are
92 // allocated from (the unstructuredPrefix parameter), as (address, length); throws
93 // if the node is not configured for Unstructured sessions
94 virtual std::pair<inet::L3Address, int> getUnstructuredPrefix();
95
96 // PFCP Session Establishment / GTP-C Create Session: the uplink tunnel of the
97 // session, which is of the given type, at this node, under a TEID allocated here;
98 // returns the tunnel's F-TEID, for the base stations to send the session's uplink
99 // on. An Unstructured session also gets its N6 tunnel here, under the given N6
100 // address (the anchor's only; unspecified for the other sessions and nodes); an
101 // Ethernet session gets its port in the node's Ethernet session bridge.
102 virtual FTeid establishUserPlaneSession(const SessionRef& session, SessionType type, const inet::L3Address& n6Address);
103
104 // PFCP Session Modification / GTP-C Modify Bearer: the session's downlink now goes
105 // into tunnel dl (unset: nowhere, the UE is attached nowhere). If oldDl is set, the
106 // downlink on that path is ended with an End Marker first (TS 23.502 4.9.1.2.2).
107 virtual void updateDownlinkTunnel(const SessionRef& session, const FTeid& dl, const FTeid& oldDl);
108
109 // PFCP Session Deletion / GTP-C Delete Session: the session's tunnels at this node
110 // are forgotten
111 virtual void releaseUserPlaneSession(const SessionRef& session);
112};
113
114} //namespace
115
116#endif
Definition EthernetSessionMux.h:57
Definition GtpUser.h:43
An ordered set of QFI-assignment rules, shared by every module that classifies packets to QoS flows.
Definition QfiRuleSet.h:57
Definition TrafficFlowFilter.h:44
Definition UserPlaneNodeControl.h:38
Definition AlertReceiver.h:24
constexpr Teid TEID_NONE
GTP-U Tunnel Endpoint Identifier (TS 29.281), chosen by the receiving end of the tunnel.
Definition LteTypes.h:87
Definition GtpTunnel.h:33
Definition GtpTunnel.h:51