Make examples runable as tests

This commit is contained in:
Tim Schubert 2020-08-29 21:11:55 +02:00
parent fccc05f6c2
commit 3f4ba0a8c1
5 changed files with 107 additions and 26 deletions

View file

@ -22,7 +22,7 @@ int main(int argc, char *argv[])
CommandLine cmd;
std::string orbitFile;
std::string traceFile;
double duration;
double duration = 60;
cmd.AddValue("orbitFile", "CSV file with orbit parameters", orbitFile);
cmd.AddValue("traceFile", "CSV file to store mobility trace in", traceFile);
cmd.AddValue("precision", "ns3::LeoCircularOrbitMobilityModel::Precision");
@ -30,7 +30,16 @@ int main(int argc, char *argv[])
cmd.Parse (argc, argv);
LeoOrbitNodeHelper orbit;
NodeContainer satellites = orbit.Install (orbitFile);
NodeContainer satellites;
if (orbitFile.empty())
{
satellites = orbit.Install (orbitFile);
}
else
{
satellites = orbit.Install ({ LeoOrbit (1200, 20, 32, 16),
LeoOrbit (1180, 30, 12, 10) });
}
Config::Connect ("/NodeList/*/$ns3::MobilityModel/CourseChange",
MakeCallback (&CourseChange));

View file

@ -74,18 +74,18 @@ int main (int argc, char *argv[])
CommandLine cmd;
std::string orbitFile;
std::string traceFile;
LeoLatLong source;
LeoLatLong destination;
std::string islRate;
std::string constellation;
LeoLatLong source (51.84, 10.28);
LeoLatLong destination (40.76, -73.96);
std::string islRate = "2Gbps";
std::string constellation = "TelesatGateway";
uint32_t latGws = 20;
uint32_t lonGws = 20;
double interval;
double duration;
bool islEnabled = false;
bool traceDrops = false;
bool traceTxRx = false;
bool traceFwd = false;
double interval = 1;
double duration = 100;
bool islEnabled = true;
bool traceDrops = true;
bool traceTxRx = true;
bool traceFwd = true;
std::string routingProto = "aodv";
cmd.AddValue("orbitFile", "CSV file with orbit parameters", orbitFile);
cmd.AddValue("traceFile", "CSV file to store mobility trace in", traceFile);
@ -117,7 +117,16 @@ int main (int argc, char *argv[])
}
LeoOrbitNodeHelper orbit;
NodeContainer satellites = orbit.Install (orbitFile);
NodeContainer satellites;
if (orbitFile.empty())
{
satellites = orbit.Install (orbitFile);
}
else
{
satellites = orbit.Install ({ LeoOrbit (1200, 20, 32, 16),
LeoOrbit (1180, 30, 12, 10) });
}
LeoGndNodeHelper ground;
NodeContainer stations = ground.Install (latGws, lonGws);