6#include "xr-traffic-mixer-helper.h"
10#include "ns3/simulator.h"
11#include "ns3/uinteger.h"
16NS_LOG_COMPONENT_DEFINE(
"XrTrafficMixerHelper");
17NS_OBJECT_ENSURE_REGISTERED(XrTrafficMixerHelper);
19const std::map<NrXrConfig, std::list<TypeId>> XrPreconfig = {
40GetXrTrafficType(
const std::string& item)
46 else if (item ==
"AR_M3_V2")
50 else if (item ==
"VR_DL1")
54 else if (item ==
"VR_DL2")
58 else if (item ==
"VR_UL")
62 else if (item ==
"CG_DL1")
66 else if (item ==
"CG_DL2")
70 else if (item ==
"CG_UL")
74 else if (item ==
"NGMN_VOICE")
80 NS_ABORT_MSG(
"Unknown traffic type");
85GetXrTrafficName(
const NrXrConfig& item)
108 NS_ABORT_MSG(
"Unknown traffic type");
116 TypeId(
"ns3::XrTrafficMixerHelper").SetParent<Object>().SetGroupName(
"Applications");
120XrTrafficMixerHelper::XrTrafficMixerHelper()
122 NS_LOG_FUNCTION(
this);
126XrTrafficMixerHelper::AddStream(TypeId trafficGenerator)
128 NS_LOG_FUNCTION(
this);
129 m_trafficStreams.push_back(trafficGenerator);
132XrTrafficMixerHelper::~XrTrafficMixerHelper()
134 NS_LOG_FUNCTION(
this);
135 m_trafficStreams.clear();
139XrTrafficMixerHelper::ConfigureXr(NrXrConfig xrTrafficType)
141 NS_LOG_FUNCTION(
this);
142 auto it = XrPreconfig.find(xrTrafficType);
143 NS_ASSERT_MSG(it != XrPreconfig.end(),
"Unknown NrXrConfig configuration.");
144 NS_ASSERT_MSG(m_trafficStreams.empty(),
145 "Some traffic streams were already set. Default XR configuration failed.");
146 for (
const auto& streamType : it->second)
148 m_trafficStreams.push_back(streamType);
153XrTrafficMixerHelper::Install(std::string transportProtocol,
154 std::vector<Address>& remoteAddresses,
155 Ptr<Node> trafficGeneratorNode)
157 NS_LOG_FUNCTION(
this);
158 NS_ASSERT(!m_trafficStreams.empty() && m_trafficStreams.size() <= 3);
159 NS_ASSERT(!remoteAddresses.empty() && remoteAddresses.size() <= 3);
160 NS_ASSERT(remoteAddresses.size() >= m_trafficStreams.size());
163 ApplicationContainer trafficGeneratorApps;
164 for (
const auto& trafficTypeId : m_trafficStreams)
166 TrafficGeneratorHelper trafficHelper(transportProtocol,
167 remoteAddresses[index],
169 trafficGeneratorApps.Add(trafficHelper.Install(trafficGeneratorNode));
172 return trafficGeneratorApps;
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.