assigning unique strings/names to network interfaces in a simulation.

34 views
Skip to first unread message

hardik soni

unread,
Mar 3, 2015, 10:23:30 AM3/3/15
to ns-3-...@googlegroups.com, Hardik Soni
Hi All,

I want to assign unique names/strings to the network interfaces in a simulator process.
ns-3 assigns name/string to interface unique within a node.
For example,
if a simulation script has 2 nodes have 2 network interfaces each.
Both nodes would have interfaces named sim1 and sim2.
I want sim1, sim2 to interfaces of one node and sim3,sim4 to interfaces of another node. 

I want to assign unique string across the simulation not across the interfaces in one particular node.
It will help me in debugging my scenario in ns-3.

Thanks,
Hardik Soni

Tommaso Pecorella

unread,
Mar 3, 2015, 11:45:41 AM3/3/15
to ns-3-...@googlegroups.com, hardi...@inria.fr
Hi,

it's a problem of name assignments I guess. I'd suggest to use a string composition in the main loop, and to assign names from there.
I can't help more if I don't see how you actually build the various nodes and their interfaces, but it's definitely possible.

Cheers,

T.

hardik soni

unread,
Mar 3, 2015, 12:44:32 PM3/3/15
to ns-3-...@googlegroups.com, hardi...@inria.fr
Thanks.
I was searching for an API to set the name of NetDevice object directly.
But, "ns3::NetDevice::SetIfIndex" may help me to achieve the same. need to check.

Tommaso Pecorella

unread,
Mar 3, 2015, 12:47:23 PM3/3/15
to Hardik Soni, ns-3-...@googlegroups.com
Yo,

check this: "examples/naming/object-names.cc"
It does what you want (more or less).

Cheers,

T.


On 03 Mar 2015, at 18:28, Hardik Soni <hardi...@inria.fr> wrote:

Hi,

I am not doing anything special to build nodes and interfaces, yet.
below is the code snippet.
------------------------------------------
CsmaHelper csma;
devices = csma.Install (NodeContainer (nodes.Get (0), nodes.Get (1), nodes.Get (4)));

NetDeviceContainer dev14 = csma.Install (NodeContainer (nodes.Get (1), nodes.Get (4)));
NetDeviceContainer dev12 = csma.Install (NodeContainer (nodes.Get (1), nodes.Get (2)));
NetDeviceContainer dev43 = csma.Install (NodeContainer (nodes.Get (4), nodes.Get (3)));
------------------------------------------

I am looking for some API to set name of the NetDevice object. In my case it is CSMANetDevice object.
Ultimately everything comes from the "Object" class, so somewhere it should have facility to associate name of the object with its instance.

Thanks,
Hardik Soni



--------------------------------------------------------------

*** My POTS number is changed. Please update your records. ***
--------------------------------------------------------------

Thinking evolution:
 "To be is to do" - Socrates
 "To do is to be" - Sartre "Do Be Do Be Do" - Sinatra "Scooby Dooby Do" - Scooby Do "Yaba Daba Doo!" - Fred Flintstone 

--------------------------------------------------------------

Tommaso Pecorella - Ph.D.

Assistant professor
Dpt. Ingegneria dell'Informazione
Università di Firenze

CNIT - Università di Firenze Unit

via di S. Marta 3
50139, Firenze
ITALY

email: tommaso....@unifi.it       tommaso....@cnit.it

phone : +39-055-2758540
fax   : +39-055-2758570





Tommaso Pecorella

unread,
Mar 3, 2015, 12:47:59 PM3/3/15
to ns-3-...@googlegroups.com, hardi...@inria.fr
The answer is in examples/naming/object-names.cc

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages