[ndnSIM] how to disable a link

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Jul 10 10:22:00 PDT 2013


Hi Xiaoke,

The approaches are not wrong, you just need to add a little bit of C++ syntax craziness to it :)

Simulator::Schedule(Seconds(hd), &ns3::ndn::Face::SetUp, face1, false);
Simulator::Schedule(Seconds(hd), &ns3::ndn::Face::SetUp, face2, false);

Or, if you define the FailLink function (as a global function or static in some class), you can do a little bit simpler things
void
FailLinks (Ptr<Node> node1, Ptr<Node> node2)

Simulator::Schedule (Seconds (10.0), FailLinks, Names::Find<Node> ("node1"), Names::Find<Node> ("node2"));


I haven't checked, but I hope this code should compile. Let me know if it doesn't, so I'll double check.

---
Alex


On Jul 9, 2013, at 11:44 PM, Xiaoke Jiang <shock.jiang at gmail.com> wrote:

> thank you, Alex. But I have to fail the link at a specified time:
> 
> 	          Simulator::Schedule(Seconds(hd), &&ns3::ndn::Face::SetUp, face1, false);
> 	          Simulator::Schedule(Seconds(hd), &face2->SetUp, false);
> The above two approaches are wrong. What is your suggestion?
> 
> 
> thanks
> 
> My Regards,
> Xiaoke (Shock) Jiang (蒋小可)
> 
> Ph.D. Candidate,
> Department of Computer Science and Technology,
> Tsinghua University, Beijing, P.R.China. 100084
> On Wednesday, July 10, 2013 at 2:09 PM, Alex Afanasyev wrote:
> 
>> With point to point links you cannot remove any of them, but you can "fail" them.  You can try to make something base on this example: http://ndnsim.net/faq.html#code-questions
>> 
>> To get Ptr<Node> from string (defined in the topology file), just use something like this: Names::Find<Node> ("node1")---
>> Alex
>> 
>> On Jul 9, 2013, at 10:40 PM, Xiaoke Jiang <shock.jiang at gmail.com> wrote:
>> 
>>> Dear all,
>>> 	I read a topology with AnnotatedTopologyReader, now I am trying to disable a link, say link between node1 and node2, anyone can give me any hint?
>>> 
>>> thanks
>>> 
>>> My Regards,
>>> Xiaoke (Shock) Jiang (蒋小可)
>>> 
>>> Ph.D. Candidate,
>>> Department of Computer Science and Technology,
>>> Tsinghua University, Beijing, P.R.China. 100084
>>> _______________________________________________
>>> ndnSIM mailing list
>>> ndnSIM at lists.cs.ucla.edu
>>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130710/5fe356b0/attachment.html>


More information about the ndnSIM mailing list