Omnetpp model asimmetric channel - performance

I have to model a bittorrent network, so there are a number of node connected each other. Each node has a download speed, say 600KBps, and an upload speed, say 130KBps.
The problem is: how can I model this in omnetpp? in the NED file i created the network this way. If A and B are nodes:
A.mygate$o++ --> {something} -->B.mygate$i++
B.mygate$o++ --> {something} -->A.mygate$i++
where mygate is a inout gate, $i and $o are the input and output half channel. But something must be a speed, but:
if I set a speed to the first line of code, this is the upload speed of A BUT is also the download speed of B. Ths is normal, because if I download from a slow server i have a slow download. How can I model the download speed of a peer in Omnetpp? I cannot understand this. Should i have to say: "allow k simultaneus download untill I reach the download speed?" or it is a bad approach? Can someone suggest me the right approach, and if a modul builtin in omnetpp already exists? I have read the manual but is a bit confusing. Thanks for every reply.

I suggest to take a look at OverSim which is a peer to peer network simulator on top of INET framework which is the framework to simulate internet related protocols in OMNeT++.
Generally each host should have a queue at link layer and the interfaces that are connected should manage that they do not put out further network packets until the transimmision line is not idle (which is determined by the datarate on the line and the length of the packet). Once the line gets idle, the next packet can be sent out on the line. This is how the datarate is limited by the actual channel.
If you don't want to implement this from scratch (no reason to do that) take a look at the INET framework. You should drop your hosts and connect their PPP interfaces with the asymmetric connection you have proposed in your question. The PPP interface in the StandardHost will do the queueing for you, so you only have to add some applications that generate your traffic, and you are set.
Still I would take a look at OverSim as it gives an even higher level abstraction on top of INET (I have no experience with it though)

Related

Need to c++ functions like handlemessage function for single or multi-radio wireless node interface

In interface element level of wireless nodes:
I know handleMessage() is called by the simulation kernel when the module receives a message.
Is there a similar function when a physical wireless link is established between two single or multi-radio nodes to communicate them is called? If there is no such function, how can I generate it?
Thanks
There is no such thing as physical wireless link. Radios transmit packets that may or may not be received on the other end. That physical wireless link is just an abstraction layered on top of the low level communication.
I.e. when do you consider a physical wireless link present? When data was exchanged between the two peer? Only one way or data should travel in both ways? How will node1 know that node2 received the sent data? Should it wait for acknowledgement? For how long? What is if the acknowledgement is lost during the transmission. And so on...
Providing reliable communication channel between two nodes is the responsibility of the Link Layer (or Mac layer if you want to call it that way like in Ieee80211Mac). So you should add your logic somewhere there, however you must define your own logic. Take a look at the handleLowerPacket() as a good place to insert your code.

Broadcasting from application layer (or a lower layer) [INET 4.1.0]

So here is what I want to do:
Broadcast some information to my neighbours via UDP (wireless scenario) without having to specify an IP address (a generic one is fine). The port will be the same on all nodes. The incoming packet should be accepted by the neighbouring nodes and handed up to the application layer.
I've read this question but I was not able to find the mentioned parameter. I also couldn't find out how to bind a socket to a specific interface by looking at the developers guide of inet.
So my question is: Is it even possible to broadcast from Application Layer?
If it is: Which parameters do I have to set?
If it is not possible: Do I have to go to a lower layer? I have seen the the pure ethernet examples in inet (inet/applications/ethernet/) but how can I apply this to a wireless scenario?
So I found it out myself. I'm posting an answer here to help other people encountering the same problem.
I solved the problem by setting several udp socket options. I set the following (some of them are not necessary but I found them to be useful):
socket.setMulticastOutputInterface(101);
socket.setMulticastLoop(false);
socket.bind(port);
L3Address address;
L3AddressResolver().tryResolve("224.0.0.1", address);
socket.joinMulticastGroup(address);
setMulticastOutputInterface(101): This sets the interface (by id) which should be used to broadcast (multicast) my messages.
setMulticastLoop(false): I found this to be useful to prevent ipv4 layer to sent
the multicast to my loopback device as well. This is not necessary though.
bind(port): This is to only receive udp packets with the given destination port. Not necessary too.
joinMulticastGroup(address): This is necessary to accept the packets with the given multicast address.
I imagined the solution to be somewhat different but this is fine for my use case. I tried to stay as far away from lower layer broadcasting as possible to avoid being dependent on a specific lower layer protocol. Check out the source code comments for more info. Hope this helps someone.

What exactly does handleParkingUpdate() do?

I am trying to implement a VANET model for smart parking simulations. Trying to fully understand the TraCIDemo11pp.cc and files relevant to it and its proving quite difficult to get my head around the general structure of each module and the communications between them despite understanding the TicToc tutorial.
I understand how SUMO and OMNETPP are run in parallel, TraCIScenarioManager from OMNETPP communicates with the TraCI server in order to exchange information to SUMO etc. But I'm finding it hard to get my head around how the TraCIDemoApp is utilised.
The question is quite specific, but hoping an answer to it would let me figure out the rest. Any help would be appreciated!
Thanks,
Wesley
Veins comes with a very small demo example in the city of Erlangen:
Vehicles start at the parking lot of the university and drive to a location off-sight. After some time the first vehicle (node[0]) emulates an accident and stops driving. Therefore, it broadcasts this information which gets re-distributed via the RSU to all other vehicles in range. They, in turn, try to use an alternative route to their destination while re-broadcasting the information about the accident. Thus, newly spawned vehicles also get informed and immediately try to choose a different route to the destination.
All of this (i.e. accident, broadcasting, switching route) is implemented in the TraCIDemo* files which represent a VANET application running in a car or RSU utilizing the NIC (i.e. PHY & MAC) to do communication. See what policy is based vehicle rerouting in case of accident? for more information.
handleParkingUpdate() is used to react to a vehicle having switched it's state from driving to parking or vice versa. Depending on the current state and whether parked cars should be allowed to communicate in the simulation this method registers the vehicle's NIC module at the BaseConnectionManager which is involved in handling the actual wireless communication. For more details see this module or follow a packet from one application layer to another (i.e. twice through the networking stack and the wireless transmission).

Problems getting Altera's Triple Speed Ethernet IP core to work

I am using a Cyclone V on a SoCKit board (link here) (provided by Terasic), connecting an HSMC-NET daughter card (link here) to it in order to create a system that can communicate using Ethernet while communication that is both transmitted and received goes through the FPGA - The problem is, I am having a really, really hard time getting this system to work using Altera's Triple Speed Ethernet core.
I am using Qsys to construct the system that contains the Triple Speed Ethernet core, instantiating it inside a VHDL wrapper that also contains an instantiation of a packet generator module, connected directly to the transmit Avalon-ST sink port of the TSE core and controlled through an Avalon-MM slave interface connected to a JTAG to Avalon Master bridge core which has it's master port exported to the VHDL wrapper as well.
Then, using System Console, I am configuring the Triple Speed Ethernet core as described in the core's user guide (link here) at section 5-26 (Register Initialization) and instruct the packet generator module (also using System Console) to start and generate Ethernet packets into the TSE core's transmit Avalon-ST sink interface ports.
Although having everything configured exactly as described in the core's user guide (linked above) I cannot get it to output anything on the MII/GMII output interfaces, neither get any of the statistics counters to increase or even change - clearly, I am doing something wrong, or missing something, but I just can't find out what exactly it is.
Can any one please, please help me with this?
Thanks ahead,
Itamar
Starting the basic checks,
Have you simulated it? It's not clear to me if you are just simulating or synthesizing.
If you haven't simulated, you really should. If it's not working in SIM, why would it ever work in real life.
Make sure you are using the QIP file to synthesize the design. It will automatically include your auto generated SDC constraints. You will still need to add your own PIN constraints, more on that later.
The TSE is fairly old and reliable, so the obvious first things to check are Clock, Reset, Power and Pins.
a.) Power is usually less of problem on devkits if you have already run the demo that came with the kit.
b.) Pins can cause a whole slew of issues if they are not mapped right on this core. I'll assume you are leveraging something from Terasic. It should define a pin for reset, input clock and signal standards. Alot of times, this goes in the .qsf file, and you also reference the QIP file (mentioned above) in here too.
c.) Clock & Reset is a more likely culprit in my mind. No activity on the interface is kind of clue. One way to check, is to route your clocks to spare pins and o-scope them and insure they are what you think they are. Similarly, if you may want to bring out your reset to a pin and check it. MAKE SURE YOU KNOW THE POLARITY and you haven't been using ~reset in some places and non-inverted reset in others.
Reconfig block. Some Altera chips and certain versions of Quartus require you to use a reconfig block to configure the XCVR. This doesn't seem like your issue to me because you say the GMII is flat lined.

Kernel module to get network jitter and bandwidth?

I need to get a list of interfaces on my local machine, along with their IP addresses, MACs and a set of QoS measurements ( Delay, Jitter, Error rate, Loss Rate, Bandwidth)...
I'm writing a kernel module to read these information from local network devices,So far I've extracted every thing mentioned above except for both Jitter and Bandwidth...
I'm using linux kernel 2.6.35
It depends what you mean by bandwidth. In most cases you only get from the PHY something that is better called bitrate. I guess you rather need some kind of information on the available bandwidth at a higher layer, which you can't get without active or passive measurements done, e.g. sending ICMP echo-like probe packets, and investigating replies. You should also make clear what the two points in the network are (both the actual endpoints and the communication layer) between which you would like to measure available bandwidth.
As for jitter you also need to do some kind of measurements, basically the same way as above.
I know this is an old post, but you could accomplish at least getting jitter by inspecting the RTCP packets if they're available. They come in on the +1 of the RTP port and come along with any RTP stream as far as I've seen. A lot of information can be gotten from RTCP, but for your purposes just the basic source description would do it:
EDIT: (didn't look at the preview)
Just check out this link for the details of the protocol, but you can get the jitter pretty easily from an RTCP packet.
Depending on what you're using the RTP stream for too there are a lot of other resources, like the VoIP Metrics Report Block in the Extended Report (https://www.rfc-editor.org/rfc/rfc3611#page-25).
EDIT:
As per Artem's request here is a basic flow of how you might do it:
An RTP stream is started on say port 16400 (the needed drivers/mechanism for this to happen are most likely already in place).
Tell the kernel to start listening on port 16401 (1 above your RTP stream's port) as well; this is where the RTCP pkts will start coming in.
As the RTCP pkts come in send them wherever you want to handle them (ie, if you're wanting to parse it in userspace or something).
Parse the pkts for the desired data. I'm not aware of a particular lib to do this, but it's pretty easy to just point some struct at it (in C) and dereference, watching out for Endianess.

Resources