Commit 9915e153 authored by Renato Caminha Juaçaba Neto's avatar Renato Caminha Juaçaba Neto 🙂
Browse files

Merge branch 'ndnSIM-ns-3.29' of...

Merge branch 'ndnSIM-ns-3.29' of https://icube-forge.unistra.fr/rcaminha/nanoas-proof-of-work into ndnSIM-ns-3.29
parents 9c585f92 6b413cbf
......@@ -9,6 +9,9 @@ cluster_experiments
*.patch
*.rej
.idea/
**/.DS_Store/
*.o
*.pyc
*.pyo
......
......@@ -13,7 +13,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1662945468773356678" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1662813790159214678" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
......@@ -37,7 +37,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1662945468773356678" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1662813790159214678" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
......
......@@ -35,7 +35,7 @@
#include "ns3/ndnSIM/apps/ndn-app.hpp"
#include "ns3/ndnSIM/apps/ndn-consumer.hpp"
#include "ns3/ndnSIM/apps/ndn-producer.hpp"
#include "ns3/ndnSIM/apps/inter-system-intermediator.hpp"
#include "ns3/ndnSIM/apps/inter-domain-intermediator.hpp"
#include "ns3/ndnSIM/apps/ndn-subscription-consumer.hpp"
#include "ns3/ndnSIM/apps/iot-attributed-content-producer.hpp"
#include "ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.hpp"
......
......@@ -37,7 +37,7 @@
#include "ns3/ndnSIM/apps/ndn-app.hpp"
#include "ns3/ndnSIM/apps/ndn-consumer.hpp"
#include "ns3/ndnSIM/apps/ndn-producer.hpp"
#include "ns3/ndnSIM/apps/inter-system-intermediator.hpp"
#include "ns3/ndnSIM/apps/inter-domain-intermediator.hpp"
#include "ns3/ndnSIM/apps/ndn-data-pusher.hpp"
//#include "ns3/ndnSIM/apps/nas-mediator-proactive.hpp"
#include "ns3/ndnSIM/apps/ndn-subscription-consumer.hpp"
......@@ -401,13 +401,13 @@ main(int argc, char *argv[])
};
privacyPolicy.addProducerTransformationPolicy(transformationPolicy);
ndn::AppHelper consumerMediatorHelper("ns3::ndn::InterSystemIntermediator");
ndn::AppHelper consumerMediatorHelper("ns3::ndn::InterDomainIntermediator");
ApplicationContainer consumerMediatorApplications;
for (uint c=0; c<nConsumerAs; c++)
{
consumerMediatorHelper.SetAttribute("NanoAsPrefix", StringValue("/consumer"+to_string(c)+"/"));
Ptr<Application> new_app = consumerMediatorHelper.Install(consumerMediators.Get(c)).Get(0);
Ptr<ndn::InterSystemIntermediator> consumer_mediator_app = DynamicCast<ndn::InterSystemIntermediator> (new_app);
Ptr<ndn::InterDomainIntermediator> consumer_mediator_app = DynamicCast<ndn::InterDomainIntermediator> (new_app);
consumer_mediator_app->setSubEquivalenceChecking("none");
for (uint p=0; p<nProducers; p++)
consumer_mediator_app->addPushedDataSource("/pushedDataPool/", "/producer-data/p"+to_string(p));
......@@ -509,7 +509,7 @@ main(int argc, char *argv[])
for (uint i=0; i<consumerMediatorApplications.GetN(); i++)
{
std::string name = Names::FindName(consumerMediatorApplications.Get(i)->GetNode());
Ptr<ndn::InterSystemIntermediator> mediator = DynamicCast<ndn::InterSystemIntermediator>
Ptr<ndn::InterDomainIntermediator> mediator = DynamicCast<ndn::InterDomainIntermediator>
(consumerMediatorApplications.Get(i));
outputFile << name << "\tOutStream\t" << mediator->getProducerStreamReused() << std::endl;
outputFile << name << "\tInStream\t" << mediator->getConsumerStreamReused() << std::endl;
......
......@@ -35,7 +35,7 @@
#include "ns3/ndnSIM/apps/ndn-app.hpp"
#include "ns3/ndnSIM/apps/ndn-consumer.hpp"
#include "ns3/ndnSIM/apps/ndn-producer.hpp"
#include "ns3/ndnSIM/apps/inter-system-intermediator.hpp"
#include "ns3/ndnSIM/apps/inter-domain-intermediator.hpp"
#include "ns3/ndnSIM/apps/ndn-subscription-consumer.hpp"
#include "ns3/ndnSIM/apps/iot-attributed-content-producer.hpp"
#include "ns3/ndnSIM/utils/tracers/ndn-l3-rate-tracer.hpp"
......@@ -455,7 +455,7 @@ main(int argc, char *argv[])
////// Mediator Applications /////////////////////////////////////////
ndn::AppHelper mediatorHelper("ns3::ndn::InterSystemIntermediator");
ndn::AppHelper mediatorHelper("ns3::ndn::InterDomainIntermediator");
mediatorHelper.SetAttribute("SubEquivalenceCheck", StringValue(subEquivalence));
ApplicationContainer consumerMediatorApplications;
for (uint m=0; m<nConsumerAs && nConsumersPerAs!=1; m++)
......@@ -508,7 +508,7 @@ main(int argc, char *argv[])
for (uint bm=0; bm<nBrokerAs; bm++)
{
brokerNasParameters.setConsumerNasPrefix("/dataBroker"+to_string(bm)+"/");
Ptr<ndn::InterSystemIntermediator> broker_app = DynamicCast<ndn::InterSystemIntermediator>
Ptr<ndn::InterDomainIntermediator> broker_app = DynamicCast<ndn::InterDomainIntermediator>
(brokerMediatorApplications.Get(bm));
for (uint pid=bm*nProducerAsPerBroker; pid < bm*nProducerAsPerBroker+nProducerAsPerBroker; pid++)
broker_app->addDataSource("allPowerUsageData", "/producer"+to_string(pid)+"/allUsageData/");//, brokerNasParameters);
......@@ -518,7 +518,7 @@ main(int argc, char *argv[])
{
nas::NasInterestTransformationAndParameters providerNasParameters;
uint producerAsId = i/nProducersPerAs;
DynamicCast<ndn::InterSystemIntermediator>(producerMediatorApplications.Get(producerAsId))
DynamicCast<ndn::InterDomainIntermediator>(producerMediatorApplications.Get(producerAsId))
->addDataSource ("allUsageData", "/producer"+to_string(producerAsId)+"/p"+to_string(i));
}
......@@ -544,7 +544,7 @@ main(int argc, char *argv[])
};
brokerPolicy.addProducerTransformationPolicy(brokerProducerTransformation);
for (uint bm=0; bm<nBrokerAs; bm++)
DynamicCast<ndn::InterSystemIntermediator>(brokerMediatorApplications.Get(bm))
DynamicCast<ndn::InterDomainIntermediator>(brokerMediatorApplications.Get(bm))
->setPoolPolicy("allPowerUsageData", brokerPolicy);
......@@ -661,7 +661,7 @@ main(int argc, char *argv[])
for (uint i=0; i<allMediatorApplications.GetN(); i++)
{
std::string name = Names::FindName(allMediatorApplications.Get(i)->GetNode());
Ptr<ndn::InterSystemIntermediator> mediator = DynamicCast<ndn::InterSystemIntermediator>(allMediatorApplications.Get(i));
Ptr<ndn::InterDomainIntermediator> mediator = DynamicCast<ndn::InterDomainIntermediator>(allMediatorApplications.Get(i));
outputFile << name << "\tOutStream\t" << mediator->getProducerStreamReused() << std::endl;
outputFile << name << "\tInStream\t" << mediator->getConsumerStreamReused() << std::endl;
outputFile << name << "\tBoth\t" << mediator->getProducerStreamReused() + mediator->getConsumerStreamReused() << std::endl;
......
......@@ -86,9 +86,9 @@ main(int argc, char *argv[])
ofstream outputFile;
outputFile.open("parameters.txt", ios::trunc);
BOOST_ASSERT_MSG(outputFile.is_open(), "Failed to open output file!!!");
if (appScenario == "RandomTrees")outputFile << "NasScenario\tRandom Trees" << std::endl;
else outputFile << "NasScenario\tDirect Subscriptions" << std::endl;
outputFile << "NasScenario\t" << appScenario << std::endl;
outputFile << "NasScenario\tRandomDomains" << std::endl;
if (appScenario == "RandomTrees")outputFile << "AppScenario\tRandom Trees" << std::endl;
else outputFile << "AppScenario\tDirect Subscriptions" << std::endl;
outputFile << "nSystems\t" << nSystems << std::endl;
outputFile << "nExtraEdges\t" << nExtraEdges << std::endl;
outputFile << "nConsumers\t" << nConsumers << std::endl;
......@@ -171,6 +171,7 @@ main(int argc, char *argv[])
Simulator::Stop(tSimulationTime);
Simulator::Run();
Simulator::Destroy();
return 0;
}
......
......@@ -7,7 +7,7 @@
#include "stream-arranger.h"
#include "ns3/ndnSIM/apps/inter-system-intermediator.hpp"
#include "ns3/ndnSIM/apps/inter-domain-intermediator.hpp"
#include "ns3/ndnSIM/nas/NasInterestTransformationAndParameters.hpp"
#include "ns3/names.h"
......@@ -19,7 +19,7 @@ namespace ndn
StreamArranger::StreamArranger(std::string subEquivalence, Time producerStopTime,
shared_ptr<GlobalRoutingHelper> routingHelper):
producerHelper("ns3::ndn::IotAttributedContentProducer"),
intermediaryHelper("ns3::ndn::InterSystemIntermediator")
intermediaryHelper("ns3::ndn::InterDomainIntermediator")
{
this->producerStopTime = producerStopTime;
this->routingHelper = routingHelper;
......@@ -92,7 +92,7 @@ namespace ndn
sourceParams.addTransformation("PT" + childNodeId);
sourceParams.addTransformationParam("PT" + childNodeId, "p", "1");
DynamicCast<ndn::InterSystemIntermediator>(app)->addDataSource("/dataset", dataSourceName, sourceParams);
DynamicCast<ndn::InterDomainIntermediator>(app)->addDataSource("/dataset", dataSourceName, sourceParams);
}
std::string intermediaryDatasetName = "/system"+iid+"/dataset";
......@@ -119,7 +119,7 @@ namespace ndn
sourceParams.addTransformation("PT" + childNodeId);
sourceParams.addTransformationParam("PT" + childNodeId, "p", "1");
DynamicCast<ndn::InterSystemIntermediator>(app)->addDataSource("/dataset", dataSourceName, sourceParams);
DynamicCast<ndn::InterDomainIntermediator>(app)->addDataSource("/dataset", dataSourceName, sourceParams);
}
std::string intermediaryDatasetName = "/system"+iid+"/dataset";
......
......@@ -33,7 +33,7 @@ namespace ndn
if (intermediateNode->GetNApplications() > 0)
{
std::string name = Names::FindName(intermediateNode);
Ptr<InterSystemIntermediator> mediatorApp = DynamicCast<InterSystemIntermediator>(intermediateNode->GetApplication(0));
Ptr<InterDomainIntermediator> mediatorApp = DynamicCast<InterDomainIntermediator>(intermediateNode->GetApplication(0));
outputFile << name << "\tOutStream\t" << mediatorApp->getProducerStreamReused() << std::endl;
outputFile << name << "\tInStream\t" << mediatorApp->getConsumerStreamReused() << std::endl;
outputFile << name << "\tBoth\t" << mediatorApp->getProducerStreamReused() + mediatorApp->getConsumerStreamReused() << std::endl;
......
......@@ -12,7 +12,7 @@
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"
#include "ns3/ndnSIM/apps/inter-system-intermediator.hpp"
#include "ns3/ndnSIM/apps/inter-domain-intermediator.hpp"
#include "ns3/ndnSIM/apps/ndn-single-subscription-consumer.hpp"
#include "ns3/ndnSIM/apps/ndn-subscription-consumer.hpp"
......
......@@ -23,10 +23,11 @@ namespace ndn
// randomTransformationCount(0), randomTransformationParamCount(0)
// {}
ConsumerArranger::ConsumerArranger (Time consumerStopTime, uint subscriptionIntervalCount,
ConsumerArranger::ConsumerArranger (string secondSubInterval, Time consumerStopTime, uint subscriptionIntervalCount,
uint randomTransformationCount, uint randomTransformationParamCount):
consumerStopTime(consumerStopTime), subscriptionIntervalCount(subscriptionIntervalCount),
randomTransformationCount(randomTransformationCount), randomTransformationParamCount(randomTransformationParamCount)
randomTransformationCount(randomTransformationCount), randomTransformationParamCount(randomTransformationParamCount),
secondSubInterval(secondSubInterval)
{}
void
......@@ -47,30 +48,55 @@ namespace ndn
ConsumerArranger::setupPrivateDomains(const shared_ptr<PhysicalTopology> &topology)
{
auto rng = CreateObject<UniformRandomVariable>();
Ptr<Application> app;
AppHelper consumerHelper("ns3::ndn::SingleSubscriptionConsumer");
consumerHelper.SetAttribute("LifeTime", TimeValue(consumerStopTime-MilliSeconds(500)));
consumerHelper.SetAttribute("Prefix", StringValue("/domain0/dataset"));
int subIntervals[] = {2, 2, 1, 4};
setupRandomTransformationsAndParameters();
// Setting up applications
for (uint c=0; c<topology->consumers.GetN(); c++)
{
consumerHelper.SetAttribute("SubscriptionInterval", TimeValue(Minutes(subIntervals[c])));
Ptr<Application> app = consumerHelper.Install(topology->consumers.Get(c)).Get(0);
Time starttime = MilliSeconds(300 + c*20);
consumerHelper.SetAttribute("SubscriptionInterval", TimeValue(Minutes(2)));
app = consumerHelper.Install(topology->consumers.Get(0)).Get(0);
Time starttime = MilliSeconds(310);
app->SetStartTime(starttime);
app->SetStopTime(consumerStopTime);
DynamicCast<SingleSubscriptionConsumer>(app)->setSubscriptionCount(1);
// Consumer NAS parameters
nas::NasInterestTransformationAndParameters parameters;
parameters.setPurpose("Research");
parameters.setConsumerNasPrefix("/consumer1");
DynamicCast<ndn::Consumer>(app)->SetParameters(parameters);
if (secondSubInterval != "None")
{
uint chosenSubInterval;
if (secondSubInterval == "Same")
chosenSubInterval = 2;
else if (secondSubInterval == "Compatible")
chosenSubInterval = 4;
else if (secondSubInterval == "Incompatible")
chosenSubInterval = 1;
else
BOOST_THROW_EXCEPTION(invalid_argument("Invalid secondSubInterval type"));
consumerHelper.SetAttribute("SubscriptionInterval", TimeValue(Minutes(chosenSubInterval)));
app = consumerHelper.Install(topology->consumers.Get(1)).Get(0);
starttime = MilliSeconds(340);
app->SetStartTime(starttime);
app->SetStopTime(consumerStopTime);
DynamicCast<SingleSubscriptionConsumer>(app)->setSubscriptionCount(1);
// Consumer NAS parameters
nas::NasInterestTransformationAndParameters parameters;
parameters.setPurpose("Research");
parameters.setConsumerNasPrefix("/consumer"+to_string(c));
parameters.setConsumerNasPrefix("/consumer2");
DynamicCast<ndn::Consumer>(app)->SetParameters(parameters);
}
}
......@@ -80,11 +106,11 @@ namespace ndn
{
AppHelper consumerHelper("ns3::ndn::SubscriptionConsumer");
consumerHelper.SetAttribute("LifeTime", TimeValue(consumerStopTime-MilliSeconds(500)));
int subIntervals[] = {2, 2, 1, 4};
auto rng = CreateObject<UniformRandomVariable>();
Ptr<Application> app;
// setupRandomTransformationsAndParameters();
// setupRandomTransformationsAndParameters();
SubscriptionConsumer::InterestPrefixes prefixes;
prefixes.resize(topology->producers.GetN());
......@@ -92,22 +118,48 @@ namespace ndn
prefixes[i] = "/producer"+to_string(i);
SubscriptionConsumer::setRandomInterestPrefixes(prefixes);
consumerHelper.SetAttribute("SubscriptionInterval", TimeValue(Minutes(2)));
app = consumerHelper.Install(topology->consumers.Get(0)).Get(0);
uint subCount = topology->producers.GetN();
DynamicCast<SubscriptionConsumer>(app)->setSubscriptionCount(subCount);
Time starttime = MilliSeconds(310);
app->SetStartTime(starttime);
app->SetStopTime(consumerStopTime);
// Consumer NAS parameters
nas::NasInterestTransformationAndParameters parameters;
parameters.setPurpose("Research");
parameters.setConsumerNasPrefix("/consumer1");
DynamicCast<ndn::Consumer>(app)->SetParameters(parameters);
for (uint c=0; c<topology->consumers.GetN(); c++)
if (secondSubInterval != "None")
{
consumerHelper.SetAttribute("SubscriptionInterval", TimeValue(Minutes(subIntervals[c])));
Ptr<Application> app = consumerHelper.Install(topology->consumers.Get(c)).Get(0);
Time starttime = MilliSeconds(300 + c*20);
uint chosenSubInterval;
if (secondSubInterval == "Same")
chosenSubInterval = 2;
else if (secondSubInterval == "Compatible")
chosenSubInterval = 4;
else if (secondSubInterval == "Incompatible")
chosenSubInterval = 1;
else
BOOST_THROW_EXCEPTION(invalid_argument("Invalid secondSubInterval type"));
consumerHelper.SetAttribute("SubscriptionInterval", TimeValue(Minutes(chosenSubInterval)));
app = consumerHelper.Install(topology->consumers.Get(1)).Get(0);
starttime = MilliSeconds(340);
app->SetStartTime(starttime);
app->SetStopTime(consumerStopTime);
uint subCount = topology->producers.GetN();
subCount = topology->producers.GetN();
DynamicCast<SubscriptionConsumer>(app)->setSubscriptionCount(subCount);
// Consumer NAS parameters
nas::NasInterestTransformationAndParameters parameters;
parameters.setPurpose("Research");
parameters.setConsumerNasPrefix("/consumer"+to_string(c));
parameters.setConsumerNasPrefix("/consumer2");
DynamicCast<ndn::Consumer>(app)->SetParameters(parameters);
}
}
......
......@@ -23,7 +23,7 @@ namespace ns3
{
public:
// ConsumerArranger();
ConsumerArranger (Time consumerStopTime, uint subscriptionIntervalCount,
ConsumerArranger (string secondSubInterval, Time consumerStopTime, uint subscriptionIntervalCount,
uint randomTransformationCount, uint randomTransformationParamCount);
virtual
......@@ -85,7 +85,7 @@ namespace ns3
uint subscriptionIntervalCount,
randomTransformationCount,
randomTransformationParamCount;
string secondSubInterval;
private:
void setupRandomTransformationsAndParameters();
};
......
......@@ -21,7 +21,7 @@
#include "ns3/network-module.h"
#include "ns3/rng-seed-manager.h"
#include "ns3/ndnSIM-module.h"
#include "ns3/ndnSIM/NFD/core/scope-prefix.hpp"
#include "../simple-domain-streams/consumer-arranger.h"
#include "../simple-domain-streams/logical-topology-creator.h"
......@@ -52,7 +52,8 @@ main(int argc, char *argv[])
// randomTransformationParamCount = 3,
// subscriptionIntervalCount = 4;
// double percSystemActivation = 0.9;
std::string appScenario = "PrivateDomains";
std::string appScenario = "PrivateDomains",
secondSubInterval = "Same";
// subEquivalence = "multiplier";
CommandLine cmd;
......@@ -68,10 +69,10 @@ main(int argc, char *argv[])
// cmd.AddValue("randomTransformationParamCount", "Number of values for the transformations considered", randomTransformationParamCount);
// cmd.AddValue("subscriptionIntervalCount", "Number of possible values used by consumers for subscription intervals, generated as 1s, 2s, 4s,...", subscriptionIntervalCount);
cmd.AddValue("appScenario", "Scenario of applications to be used (PrivateDomains or DirectSubscriptions)", appScenario);
cmd.AddValue("secondSubInterval", "What type sub interval for the second interest (Same or Compatible or Incompatible or None)", secondSubInterval);
// cmd.AddValue("subEquivalenceType", "Type of equivalence checking done by the mediators (none/equal/multiplier)", subEquivalence);
cmd.Parse(argc, argv);
////// Constants /////////////////////////////////////////
const Time tSimulationTime = Minutes(120);
const Time producerStopTime = tSimulationTime - Seconds(2);
......@@ -80,6 +81,8 @@ main(int argc, char *argv[])
// BOOST_ASSERT((subEquivalence == "none" || subEquivalence == "equal" || subEquivalence == "multiplier"));
BOOST_ASSERT((appScenario == "PrivateDomains" || appScenario == "DirectSubscriptions"));
BOOST_ASSERT((secondSubInterval == "Same" || secondSubInterval == "Compatible" ||
secondSubInterval == "Incompatible" || secondSubInterval == "None"));
////// Record Parameters /////////////////////////////////////////
ofstream outputFile;
......@@ -88,6 +91,7 @@ main(int argc, char *argv[])
outputFile << "NasScenario\tSimple Domains" << std::endl;
if (appScenario.compare("PrivateDomains") == 0) outputFile << "appScenario\tPrivate Domains" << std::endl;
else outputFile << "appScenario\tDirect Subscriptions" << std::endl;
outputFile << "SecondSubInterval\t" << secondSubInterval << std::endl;
// outputFile << "nSystems\t" << nSystems << std::endl;
// outputFile << "nExtraEdges\t" << nExtraEdges << std::endl;
// outputFile << "nConsumers\t" << nConsumers << std::endl;
......@@ -103,10 +107,9 @@ main(int argc, char *argv[])
outputFile.close();
// Topology creators and parameters //////////////////////////////////////////////////////////////////////
Ptr<PhysicalTopologyCreator> physicalcreator = CreateObject<PhysicalTopologyCreator>();
shared_ptr<PhysicalTopology> physicalTopology = physicalcreator->create_physical_topology();
shared_ptr<PhysicalTopology> physicalTopology = physicalcreator->create_physical_topology(secondSubInterval);
......@@ -122,8 +125,7 @@ main(int argc, char *argv[])
ConsumerArranger consumerArranger(consumerStopTime, 1, 1, 1);
ConsumerArranger consumerArranger(secondSubInterval, consumerStopTime, 1, 1, 1);
if (appScenario.compare("PrivateDomains") == 0)
consumerArranger.setupPrivateDomains(physicalTopology);
else
......@@ -150,6 +152,36 @@ main(int argc, char *argv[])
Simulator::Stop(tSimulationTime);
Simulator::Run();
// NS_LOG_UNCOND("### PRINTING NODES CONTENT STORE ###############");
// NS_LOG_UNCOND("");
// for (auto node = NodeList::Begin(); node != NodeList::End(); node++)
// {
// string nodeName = Names::FindName(*node);
// NS_LOG_UNCOND("Node: " << nodeName);
//
// Ptr<L3Protocol> l3Protocol = (*node)->GetObject<L3Protocol>();
// if (l3Protocol != nullptr)
// {
// Ptr<ContentStore> contentStore = l3Protocol->GetObject<ContentStore>();
// if (contentStore != nullptr)
// {
// for (auto csEntry = contentStore->Begin(); csEntry != contentStore->End(); csEntry = contentStore->Next(csEntry))
// {
// if (!nfd::scope_prefix::LOCALHOST.isPrefixOf(csEntry->GetName()))
// {
// NS_LOG_UNCOND(" " << csEntry->GetName() << ", Size: " << csEntry->GetData()->wireEncode().size());// << ", At: " <<
//// csEntry->GetName().at(-1).toSteadyClockTimeStamp().time_since_epoch().count() * 1e-9 / 60);
// }
// }
// }
// else NS_LOG_UNCOND(" No installed Content Store");
// }
// else NS_LOG_UNCOND(" No installed L3 Protocol");
// NS_LOG_UNCOND("");
// }
Simulator::Destroy();
return 0;
}
......
......@@ -35,16 +35,16 @@ namespace ndn {
shared_ptr<PhysicalTopology>
PhysicalTopologyCreator::create_physical_topology()
PhysicalTopologyCreator::create_physical_topology(string secondSubInterval)
{
auto rng = CreateObject<UniformRandomVariable>();
shared_ptr<PhysicalTopology> topology = make_shared<PhysicalTopology>();
topology->consumers.Create(4);
topology->routers.Create(4);
topology->consumers.Create(secondSubInterval == "None" ? 1 : 2);
topology->routers.Create(1);
topology->domainRouters.Create(13);
topology->producers.Create(24);
topology->producers.Create(27);
Ptr<Node> firstRouter = topology->routers.Get(0);
for (uint i=0; i<topology->consumers.GetN(); i++)
......@@ -64,36 +64,35 @@ namespace ndn {
Ptr<Node> prevNode = topology->routers.Get(i-1);
p2pHelper.Install(currNode, prevNode);
}
Ptr<Node> lastRouter = topology->routers.Get(3),
Ptr<Node> lastRouter = topology->routers.Get(topology->routers.GetN() - 1),
firstDomainRouter = topology->domainRouters.Get(0);
p2pHelper.Install(lastRouter, firstDomainRouter);
for (uint i=0; i<topology->domainRouters.GetN(); i++)
Names::Add("DR" + to_string(i+1), topology->domainRouters.Get(i));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get(1));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get(2));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get(3));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get(4));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get( 1));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get( 2));
p2pHelper.Install(firstDomainRouter, topology->domainRouters.Get( 3));
p2pHelper.Install(topology->domainRouters.Get(1), topology->domainRouters.Get(5));
p2pHelper.Install(topology->domainRouters.Get(1), topology->domainRouters.Get(6));
p2pHelper.Install(topology->domainRouters.Get(1), topology->domainRouters.Get( 4));
p2pHelper.Install(topology->domainRouters.Get(1), topology->domainRouters.Get( 5));
p2pHelper.Install(topology->domainRouters.Get(1), topology->domainRouters.Get( 6));
p2pHelper.Install(topology->domainRouters.Get(2), topology->domainRouters.Get(7));
p2pHelper.Install(topology->domainRouters.Get(2), topology->domainRouters.Get(8));
p2pHelper.Install(topology->domainRouters.Get(2), topology->domainRouters.Get( 7));
p2pHelper.Install(topology->domainRouters.Get(2), topology->domainRouters.Get( 8));
p2pHelper.Install(topology->domainRouters.Get(2), topology->domainRouters.Get( 9));
p2pHelper.Install(topology->domainRouters.Get(3), topology->domainRouters.Get(9));
p2pHelper.Install(topology->domainRouters.Get(3), topology->domainRouters.Get(10));
p2pHelper.Install(topology->domainRouters.Get(4), topology->domainRouters.Get(11));
p2pHelper.Install(topology->domainRouters.Get(4), topology->domainRouters.Get(12));
p2pHelper.Install(topology->domainRouters.Get(3), topology->domainRouters.Get(11));
p2pHelper.Install(topology->domainRouters.Get(3), topology->domainRouters.Get(12));
for (uint i=0; i<topology->producers.GetN(); i++)
{
Ptr<Node> producer = topology->producers.Get(i);
Names::Add("P" + to_string(i+1), producer);
uint domainRouterIdx = std::floor(i/3) + 5;
uint domainRouterIdx = std::floor(i/3) + 4;;
Ptr<Node> domainRouter = topology->domainRouters.Get(domainRouterIdx);
p2pHelper.Install(producer, domainRouter);
}
......
......@@ -40,7 +40,7 @@ namespace ndn {
~PhysicalTopologyCreator () {};
shared_ptr<PhysicalTopology>
create_physical_topology();
create_physical_topology(string secondSubInterval);
protected:
PointToPointHelper p2pHelper;
};
......
......@@ -7,7 +7,7 @@
#include "../simple-domain-streams/stream-arranger.h"
#include "ns3/ndnSIM/apps/inter-system-intermediator.hpp"
#include "ns3/ndnSIM/apps/inter-domain-intermediator.hpp"
#include "ns3/ndnSIM/nas/NasInterestTransformationAndParameters.hpp"
#include "ns3/names.h"
......@@ -18,7 +18,7 @@ namespace ndn
StreamArranger::StreamArranger(std::string subEquivalence, Time producerStopTime):
producerHelper("ns3::ndn::IotAttributedContentProducer"),
intermediaryHelper("ns3::ndn::InterSystemIntermediator")
intermediaryHelper("ns3::ndn::InterDomainIntermediator")
{
this->producerStopTime = producerStopTime;
this->routingHelper = make_shared<GlobalRoutingHelper>();
......@@ -30,44 +30,44 @@ namespace ndn
{
std::vector<uint> childs;
childs = { 1, 2, 3, 4};
setupIntermediary(phyTopology, 0, childs, intermediaryStopTime, true);
childs = { 1, 2, 3};
setupIntermediary(phyTopology, 0, childs, intermediaryStopTime, false);
childs = { 5, 6};
setupIntermediary(phyTopology, 1, childs, intermediaryStopTime, true);
childs = { 4, 5, 6};
setupIntermediary(phyTopology, 1, childs, intermediaryStopTime, false);