301 const char *streamRedundancyConfiguratorModulePath = par(
"streamRedundancyConfiguratorModule");
302 if (strlen(streamRedundancyConfiguratorModulePath) != 0) {
303 auto streamRedundancyConfigurator = check_and_cast<StreamRedundancyConfigurator *>(getModuleByPath(streamRedundancyConfiguratorModulePath));
304 cValueArray *streamsParameterValue =
new cValueArray();
306 cValueMap *streamParameterValue =
new cValueMap();
307 cValueArray *treesParameterValue =
new cValueArray();
308 streamParameterValue->set(
"name", streamConfiguration.name.c_str());
309 streamParameterValue->set(
"pcp", streamConfiguration.pcp);
310 streamParameterValue->set(
"packetFilter", streamConfiguration.packetFilter);
311 streamParameterValue->set(
"source", streamConfiguration.source.c_str());
313 streamParameterValue->set(
"destination", streamConfiguration.destinations[0].c_str());
314 streamParameterValue->set(
"destinationAddress", streamConfiguration.destinationAddress.c_str());
315 for (
auto& tree : streamConfiguration.trees) {
316 cValueArray *treeParameterValue =
new cValueArray();
317 for (
auto& path : tree.paths) {
318 cValueArray *pathParameterValue =
new cValueArray();
319 for (
auto& interface : path.interfaces) {
321 name = interface->node->module->getFullName();
323 name = name +
"." + interface->networkInterface->getInterfaceName();
324 pathParameterValue->add(name.c_str());
326 treeParameterValue->add(pathParameterValue);
328 treesParameterValue->add(treeParameterValue);
330 streamParameterValue->set(
"trees", treesParameterValue);
331 streamsParameterValue->add(streamParameterValue);
333 EV_INFO <<
"Configuring stream configurator" <<
EV_FIELD(streamRedundancyConfigurator) <<
EV_FIELD(streamsParameterValue) <<
EV_ENDL;
334 streamRedundancyConfigurator->par(
"configuration") = streamsParameterValue;
335 const char *gateScheduleConfiguratorModulePath = par(
"gateScheduleConfiguratorModule");
336 if (strlen(gateScheduleConfiguratorModulePath) != 0) {
337 auto gateScheduleConfigurator = getModuleByPath(gateScheduleConfiguratorModulePath);
338 cValueArray *parameterValue =
new cValueArray();
340 cValueMap *streamConfiguration = check_and_cast<cValueMap *>(
configuration->get(i).objectValue());
341 auto source = streamConfiguration->get(
"source").stringValue();
342 auto destination = streamConfiguration->get(
"destination").stringValue();
343 auto pathFragments = streamRedundancyConfigurator->getPathFragments(streamConfiguration->get(
"name").stringValue());
344 cValueMap *streamParameterValue =
new cValueMap();
345 cValueArray *pathFragmentsParameterValue =
new cValueArray();
346 for (
auto& pathFragment : pathFragments) {
347 cValueArray *pathFragmentParameterValue =
new cValueArray();
348 for (
auto nodeName : pathFragment)
349 pathFragmentParameterValue->add(nodeName);
350 pathFragmentsParameterValue->add(pathFragmentParameterValue);
352 streamParameterValue->set(
"pathFragments", pathFragmentsParameterValue);
353 streamParameterValue->set(
"name", streamConfiguration->get(
"name").stringValue());
354 streamParameterValue->set(
"application", streamConfiguration->get(
"application"));
355 streamParameterValue->set(
"source", source);
356 streamParameterValue->set(
"destination", destination);
357 if (streamConfiguration->containsKey(
"pcp"))
358 streamParameterValue->set(
"pcp", streamConfiguration->get(
"pcp").intValue());
359 if (streamConfiguration->containsKey(
"gateIndex"))
360 streamParameterValue->set(
"gateIndex", streamConfiguration->get(
"gateIndex").intValue());
361 streamParameterValue->set(
"packetLength", cValue(streamConfiguration->get(
"packetLength").doubleValueInUnit(
"B"),
"B"));
362 streamParameterValue->set(
"packetInterval", cValue(streamConfiguration->get(
"packetInterval").doubleValueInUnit(
"s"),
"s"));
363 if (streamConfiguration->containsKey(
"maxLatency"))
364 streamParameterValue->set(
"maxLatency", cValue(streamConfiguration->get(
"maxLatency").doubleValueInUnit(
"s"),
"s"));
365 parameterValue->add(streamParameterValue);
367 gateScheduleConfigurator->par(
"configuration") = parameterValue;