53 if(!platformNEMMap_.insert(std::make_pair(pNEM->getNEMId(),std::move(pNEM))).second)
55 throw makeException<PlatformException>(
"NEMManagerImpl: Multiple NEMs with id" 68 "IPv4 or IPv6 Event Service channel multicast endpoint.");
70 configRegistrar.registerNonNumeric<std::string>(
"eventservicedevice",
73 "Device to associate with the Event Service channel multicast endpoint.");
75 configRegistrar.registerNumeric<std::uint8_t>(
"eventservicettl",
78 "Device to associate with the Event Service channel multicast endpoint.");
80 configRegistrar.registerNonNumeric<
INETAddr>(
"otamanagergroup",
83 "IPv4 or IPv6 Event Service OTA channel endpoint.");
85 configRegistrar.registerNonNumeric<std::string>(
"otamanagerdevice",
88 "Device to associate with the OTA channel multicast endpoint.");
90 configRegistrar.registerNumeric<std::uint32_t>(
"otamanagermtu",
95 configRegistrar.registerNumeric<std::uint16_t>(
"otamanagerpartcheckthreshold",
98 "Defines the rate in seconds a check is performed to see if any OTA packet" 99 " part reassembly efforts should be abandoned.");
101 configRegistrar.registerNumeric<std::uint16_t>(
"otamanagerparttimeoutthreshold",
104 "Defines the threshold in seconds to wait for another OTA packet part" 105 " for an existing reassembly effort before abandoning the effort.");
107 configRegistrar.registerNumeric<std::uint8_t>(
"otamanagerttl",
110 "OTA channel multicast message TTL.");
112 configRegistrar.registerNumeric<
bool>(
"otamanagerloopback",
115 "Enable multicast loopback on the OTA channel multicast channel.");
117 configRegistrar.registerNumeric<
bool>(
"otamanagerchannelenable",
120 "Enable OTA channel multicast communication.");
123 configRegistrar.registerNonNumeric<
INETAddr>(
"controlportendpoint",
126 "IPv4 or IPv6 control port endpoint.");
128 configRegistrar.registerNonNumeric<std::string>(
"antennaprofilemanifesturi",
131 "URI of the antenna profile manifest to load." 132 " The antenna profile manifest contains a list of" 133 " antenna profile entries. Each entry contains a unique" 134 " profile identifier, an antenna pattern URI and an" 135 " antenna blockage URI. This parameter is required when" 136 " antennaprofileenable is on or if any other NEM" 137 " participating in the emulation has antennaprofileenable" 138 " set on, even in the case where antennaprofileenable is" 141 configRegistrar.registerNumeric<std::uint32_t>(
"stats.ota.maxpacketcountrows",
144 "OTA channel max packet count table rows.");
146 configRegistrar.registerNumeric<std::uint32_t>(
"stats.ota.maxeventcountrows",
149 "OTA channel max event count table rows.");
151 configRegistrar.registerNumeric<std::uint32_t>(
"stats.event.maxeventcountrows",
154 "Event channel max event count table rows.");
160 for(
const auto & item : update)
162 if(item.first ==
"otamanagergroup")
164 OTAManagerGroupAddr_ = item.second[0].asINETAddr();
168 "NEMManagerImpl::configure %s: %s",
170 OTAManagerGroupAddr_.
str().c_str());
173 else if(item.first ==
"otamanagerdevice")
175 sOTAManagerGroupDevice_ = item.second[0].asString();
179 "NEMManagerImpl::configure %s: %s",
181 sOTAManagerGroupDevice_.c_str());
184 else if(item.first ==
"otamanagerttl")
186 u8OTAManagerTTL_ = item.second[0].asUINT8();
190 "NEMManagerImpl::configure %s: %hhu",
194 else if(item.first ==
"otamanagermtu")
196 u32OTAManagerMTU_ = item.second[0].asUINT32();
200 "NEMManagerImpl::configure %s: %u",
204 else if(item.first ==
"otamanagerpartcheckthreshold")
206 OTAManagerPartCheckThreshold_=
EMANE::Seconds{item.second[0].asUINT16()};
210 "NEMManagerImpl::configure %s = %lu",
212 OTAManagerPartCheckThreshold_.count());
214 else if(item.first ==
"otamanagerparttimeoutthreshold")
216 OTAManagerPartTimeoutThreshold_ =
EMANE::Seconds{item.second[0].asUINT16()};
220 "NEMManagerImpl::configure %s = %lu",
222 OTAManagerPartTimeoutThreshold_.count());
224 else if(item.first ==
"otamanagerloopback")
226 bOTAManagerChannelLoopback_ = item.second[0].asBool();
230 "NEMManagerImpl::configure %s: %s",
232 bOTAManagerChannelLoopback_ ?
"on" :
"off");
234 else if(item.first ==
"otamanagerchannelenable")
236 bOTAManagerChannelEnable_ = item.second[0].asBool();
240 "NEMManagerImpl::configure %s: %s",
242 bOTAManagerChannelEnable_ ?
"on" :
"off");
244 else if(item.first ==
"eventservicegroup")
246 eventServiceGroupAddr_ = item.second[0].asINETAddr();
250 "NEMManagerImpl::configure %s: %s",
252 eventServiceGroupAddr_.
str().c_str());
255 else if(item.first ==
"eventservicedevice")
257 sEventServiceDevice_ = item.second[0].asString();
261 "NEMManagerImpl::configure %s: %s",
263 sEventServiceDevice_.c_str());
266 else if(item.first ==
"eventservicettl")
268 u8EventServiceTTL_ = item.second[0].asUINT8();
272 "NEMManagerImpl::configure %s: %hhu",
276 else if(item.first ==
"controlportendpoint")
278 controlPortAddr_ = item.second[0].asINETAddr();
282 "NEMManagerImpl::configure %s: %s",
284 controlPortAddr_.
str().c_str());
287 else if(item.first ==
"antennaprofilemanifesturi")
289 sAntennaProfileManifestURI_ = item.second[0].asString();
293 "NEMManagerImpl::configure %s: %s",
295 sAntennaProfileManifestURI_.c_str());
298 else if(item.first ==
"stats.ota.maxpacketcountrows")
300 std::uint32_t u32OTAMaxPacketCountRows = item.second[0].asUINT32();
304 "NEMManagerImpl::configure %s: %u",
306 u32OTAMaxPacketCountRows);
309 setStatPacketCountRowLimit(u32OTAMaxPacketCountRows);
311 else if(item.first ==
"stats.ota.maxeventcountrows")
313 std::uint32_t u32OTAMaxEventCountRows = item.second[0].asUINT32();
317 "NEMManagerImpl::configure %s: %u",
319 u32OTAMaxEventCountRows);
322 setStatEventCountRowLimit(u32OTAMaxEventCountRows);
324 else if(item.first ==
"stats.event.maxeventcountrows")
326 std::uint32_t u32EventMaxEventCountRows = item.second[0].asUINT32();
330 "NEMManagerImpl::configure %s: %u",
332 u32EventMaxEventCountRows);
335 setStatEventCountRowLimit(u32EventMaxEventCountRows);
339 throw makeException<ConfigureException>(
"NEMManagerImpl: " 340 "Unexpected configuration item %s",
346 if(!sAntennaProfileManifestURI_.empty())
355 if(bOTAManagerChannelEnable_)
360 sOTAManagerGroupDevice_,
361 bOTAManagerChannelLoopback_,
365 OTAManagerPartCheckThreshold_,
366 OTAManagerPartTimeoutThreshold_);
377 sEventServiceDevice_,
387 controlPortService_.
open(controlPortAddr_);
389 std::for_each(platformNEMMap_.begin(),
390 platformNEMMap_.end(),
392 std::bind(&PlatformNEMMap::value_type::second,
393 std::placeholders::_1)));
398 std::for_each(platformNEMMap_.begin(),
399 platformNEMMap_.end(),
401 std::bind(&PlatformNEMMap::value_type::second,
402 std::placeholders::_1)));
407 controlPortService_.
close();
409 std::for_each(platformNEMMap_.begin(),
410 platformNEMMap_.end(),
412 std::bind(&PlatformNEMMap::value_type::second,
413 std::placeholders::_1)));
419 std::for_each(platformNEMMap_.begin(),
420 platformNEMMap_.end(),
422 std::bind(&PlatformNEMMap::value_type::second,
423 std::placeholders::_1)));
void load(const std::string &sAntennaProfileURI)
The Registrar interface provides access to all of the emulator registrars.
virtual ConfigurationRegistrar & configurationRegistrar()=0
void open(const INETAddr &endpoint)
void registerNonNumeric(const std::string &sName, const ConfigurationProperties &properties=ConfigurationProperties::NONE, const std::initializer_list< T > &values={}, const std::string &sUsage="", std::size_t minOccurs=1, std::size_t maxOccurs=1, const std::string &sRegexPattern={})
Exception thrown when registering or unregistering OTAUsers.
std::chrono::seconds Seconds
const char * what() const
Contains and manages NEM instances.
void open(const INETAddr &eventChannelAddress, const std::string &sDevice, int iTTL, bool loopbackEnable, const uuid_t &uuid)
std::string str(bool bWithPort=true) const
void add(std::unique_ptr< NEM > &pNEM) override
void configure(const ConfigurationUpdate &update) override
void postStart() override
Component start exception is used to indicate an exception during transition to the start state...
NEMManagerImpl(const uuid_t &uuid)
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
void initialize(Registrar ®istrar) override
#define LOGGER_STANDARD_LOGGING(logger, level, fmt, args...)
static LogService * instance()
Exception thrown during open/establishment of the event service communication channel.
void open(const INETAddr &otaGroupAddress, const std::string &sDevice, bool bLoopback, int iTTL, const uuid_t &uuid, size_t otaMTU, Seconds partCheckThreshold, Seconds partTimeoutThreshold)