creating new p2p links after simulation starts

66 views
Skip to first unread message

nahid

unread,
Oct 10, 2017, 3:20:44 AM10/10/17
to ns-3-users
Hi all,
I have some nodes that is trying to connect to a list of servers during a specific time period( all of them will not connect to a single server because  the server will change to another machine at specific time periods).
so I need to create p2p links between my nodes and my servers when they try to connect( we don't know  which node will connect which server at the first,it depends on nodes arrival rate and server machine changing rates)
I have tried to schedule functions to create nodes and related net devices but links are not created and no traffic is sending between servers and nodes. how can I create links after simulation starts?
I am new to ns3 and I will be really thankful to your helps.
can someone help me with that?

pdbarnes

unread,
Oct 12, 2017, 1:28:01 AM10/12/17
to ns-3-users
Perhaps create all nodes and P2P links at the beginning, then set all links down. As needed you can bring links up to connect to the server of the moment.

Peter

nahid

unread,
Oct 14, 2017, 2:03:34 AM10/14/17
to ns-3-users

thanks for your reply. I'm sorry for my little knowledge of ns3 but I have another question. As I understand if I create all links I need to get nodes interface to set up link as one of examples(dynamic-global-routing.cc) says like this:

  Ptr<Node> n1 = c.Get (1);
  Ptr<Ipv4> ipv41 = n1->GetObject<Ipv4> ();
  // The first ifIndex is 0 for loopback, then the first p2p is numbered 1,
  // then the next p2p is numbered 2
  uint32_t ipv4ifIndex1 = 2;
  Simulator::Schedule (Seconds (2),&Ipv4::SetDown,ipv41, ipv4ifIndex1);

my problem is that how can I know which interface is the one connected to server of the moment? I have do some searches but I could not find a good solution. can you help me with that?

pdbarnes

unread,
Oct 15, 2017, 2:57:02 PM10/15/17
to ns-3-users
> my problem is that how can I know which interface is the one connected to server of the moment?

I understood from your original question you had a reason to decide which nodes should be able to reach the server at any given time. That's up to you to define and implement it.

In some settings that could just be based on distance (range). Other problems might schedule this, or based on messages received. It all depends on what you are modeling.

Peter

Reply all
Reply to author
Forward
0 new messages