1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2022 Northeastern University
4 * Copyright (c) 2022 Sapienza, University of Rome
5 * Copyright (c) 2022 University of Padova
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation;
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Author: Andrea Lacava <thecave003@gmail.com>
21 * Tommaso Zugno <tommasozugno@gmail.com>
22 * Michele Polese <michele.polese@gmail.com>
25 #ifndef ORAN_INTERFACE_H
26 #define ORAN_INTERFACE_H
28 #include "ns3/object.h"
29 #include <ns3/kpm-indication.h>
30 #include <ns3/kpm-function-description.h>
31 #include <ns3/ric-control-function-description.h>
32 #include <ns3/ric-control-message.h>
37 class E2Termination : public Object
45 * \param ricAddress RIC IP address
46 * \param ricPort RIC port
47 * \param clientPort the local port to which the client will bind
48 * \param gnbId the GNB ID
49 * \param plmnId the PLMN ID
51 E2Termination(const std::string ricAddress,
52 const uint16_t ricPort,
53 const uint16_t clientPort,
54 const std::string gnbId,
55 const std::string plmnId);
57 virtual ~E2Termination ();
60 * inherited from Object
63 static TypeId GetTypeId();
66 * Start the E2 termination.
67 * Create a separate thread to host the execution of e2sim. The thread will
68 * execute the method DoStart.
73 * Register an E2 Service Model.
74 * Create a RAN Function Description item containing the configurations
75 * for the SM, add it to the list of supported RAN functions, and
76 * register a callback.
77 * Whenever a RIC Subscription Request to this RAN Function is received,
78 * the callback is triggered.
80 * \param ranFunctionId ID used to identify the KPM RAN Function
81 * \param ranFunctionDescription
82 * \param cb callback that will be triggered if the RIC subscribes to
85 void RegisterKpmCallbackToE2Sm (long ranFunctionId,
86 Ptr<FunctionDescription> ranFunctionDescription,
87 SubscriptionCallback sbCb);
90 * Register an E2 Service Model.
91 * Create a RAN Function Description item containing the configurations
92 * for the SM, add it to the list of supported RAN functions, and
93 * register a callback.
94 * Whenever a Sm message to this RAN Function is received,
95 * the callback is triggered.
97 * \param ranFunctionId ID used to identify the KPM RAN Function
98 * \param ranFunctionDescription
99 * \param cb callback that will be triggered if the RIC subscribes to
102 void RegisterSmCallbackToE2Sm (long ranFunctionId,
103 Ptr<FunctionDescription> ranFunctionDescription,
107 * Struct holding the values returned by ProcessRicSubscriptionRequest
109 struct RicSubscriptionRequest_rval_s
111 uint16_t requestorId; //!< RIC Requestor ID
112 uint16_t instanceId; //!< RIC Instance ID
113 uint16_t ranFuncionId; //!< RAN Function ID
114 uint8_t actionId; //!< RIC Action ID
118 * Process RIC Subscription Request.
119 * This function processes the RIC Subscription Request and sends the
120 * RIC Subscription Response.
122 * \param sub_req_pdu request message
123 * \return RIC subscription request parameters
125 RicSubscriptionRequest_rval_s ProcessRicSubscriptionRequest (E2AP_PDU_t* sub_req_pdu);
128 * Sends an E2 message to the RIC
129 * This function encodes and sends an E2 message to the RIC
131 * \param pdu the PDU of the message
133 void SendE2Message (E2AP_PDU* pdu);
137 * Run the e2sim main loop.
138 * Starts the e2sim main loop, it will open a socket towards the RIC and
139 * start the reception routine.
144 * \brief Accessory function to populate to the registration of the ran function description to e2sim
146 * \param ranFunctionId
147 * \param ranFunctionDescription
149 void RegisterFunctionDescToE2Sm (long ranFunctionId,
150 Ptr<FunctionDescription> ranFunctionDescription);
152 E2Sim* m_e2sim; //!< pointer to an instance of the O-RAN E2 simulator
153 std::string m_ricAddress; //!< IP address of the RIC
154 uint16_t m_ricPort; //!< port of the RIC
155 uint16_t m_clientPort; //!< local bind port
156 std::string m_gnbId; //!< GNB id
157 std::string m_plmnId; //!< PLMN Id
161 #endif /* ORAN_INTERFACE_H */