Adding waf script for building
diff --git a/src/nlsr_test.cpp b/src/nlsr_test.cpp
new file mode 100644
index 0000000..ef19e63
--- /dev/null
+++ b/src/nlsr_test.cpp
@@ -0,0 +1,104 @@
+#include <ndn-cpp-dev/face.hpp>
+#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cpp-dev/util/scheduler.hpp>
+
+#include "nlsr.hpp"
+#include "nlsr_test.hpp"
+
+using namespace std;
+using namespace ndn;
+
+void
+nlsrTest::schedlueAddingLsas(nlsr& pnlsr)
+{
+ // scheduling adding two name lsas, two Cor Lsas and three Adj LSAs
+
+ //Scheduling Adding LSAs for router altair
+ string router("/ndn/memphis.edu/cs/altair");
+ string name1("/ndn/memphis.edu/cs/altair/name1");
+ string name2("/ndn/memphis.edu/cs/altair/name2");
+ string name3("/ndn/memphis.edu/cs/broadcast");
+ Adjacent adj1("/ndn/memphis.edu/cs/pollux",7,17,1,0);
+ Adjacent adj2("/ndn/memphis.edu/cs/maia",15,27,1,0);
+
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(30),
+ ndn::bind(&nlsrTest::secheduledAddNameLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,router,name1,name2,name3));
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(37),
+ ndn::bind(&nlsrTest::secheduledAddCorLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,router,123.098,1.875));
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(47),
+ ndn::bind(&nlsrTest::scheduledAddAdjacentLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,router,adj1,adj2));
+
+ //Scheduling Adding LSAs for router Maia
+ string routerMaia("/ndn/memphis.edu/cs/maia");
+ string maiaName1("/ndn/memphis.edu/maia/name1");
+ string maiaName2("/ndn/memphis.edu/maia/name2");
+ string maiaName3("/ndn/memphis.edu/cs/broadcast");
+ Adjacent maiaAdj1("/ndn/memphis.edu/cs/pollux",8,25,1,0);
+ Adjacent maiaAdj2("/ndn/memphis.edu/cs/altair",11,15,1,0);
+
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(55),
+ ndn::bind(&nlsrTest::secheduledAddNameLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,routerMaia,maiaName1,maiaName2,maiaName3));
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(65),
+ ndn::bind(&nlsrTest::secheduledAddCorLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,routerMaia,12.098,0.875));
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(75),
+ ndn::bind(&nlsrTest::scheduledAddAdjacentLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,routerMaia,maiaAdj1,maiaAdj2));
+
+ //sheduling Adding LSAs for Router itself
+ string routerPollux("/ndn/memphis.edu/cs/pollux");
+ Adjacent polluxAdj1("/ndn/memphis.edu/cs/maia",9,13,1,0);
+ Adjacent polluxAdj2("/ndn/memphis.edu/cs/altair",12,23,1,0);
+
+ pnlsr.getScheduler().scheduleEvent(ndn::time::seconds(90),
+ ndn::bind(&nlsrTest::scheduledAddAdjacentLsa,pnlsr.getNlsrTesting(),
+ boost::ref(pnlsr)
+ ,routerPollux,polluxAdj1,polluxAdj2));
+
+
+}
+
+
+
+void
+nlsrTest::secheduledAddNameLsa(nlsr& pnlsr, string router,
+ string name1, string name2, string name3)
+{
+ Npl npl;
+ npl.insertIntoNpl(name1);
+ npl.insertIntoNpl(name2);
+ npl.insertIntoNpl(name3);
+ NameLsa nameLsa(router,1,1,3600,npl);
+ pnlsr.getLsdb().installNameLsa(pnlsr, nameLsa);
+
+}
+
+void
+nlsrTest::secheduledAddCorLsa(nlsr& pnlsr,string router, double r, double angle)
+{
+ CorLsa corLsa(router,3,1,3600,r,angle);
+ pnlsr.getLsdb().installCorLsa(pnlsr, corLsa);
+}
+
+void
+nlsrTest::scheduledAddAdjacentLsa(nlsr& pnlsr, string router,
+ Adjacent adj1, Adjacent adj2)
+{
+ Adl adl;
+ adl.insert(adj1);
+ adl.insert(adj2);
+ AdjLsa adjLsa(router,2,1,3600,2,adl);
+ pnlsr.getLsdb().installAdjLsa(pnlsr, adjLsa);
+
+}
+