Skip to main content

TRACE FILES AND DESCRIPTION

The file written by an application (or by the Coverage Server) to store coverage information or overall network information and In NS2 , it is called as Trace File.


In order to generate a trace file. we have to create a trace file in Otcl script.


SYNTAX FOR CREATING A TRACE FILE


# Open the trace file

set nf [open out.tr w]

$ns trace-all $nf


which means we are opening a newtrace file named as "out" and also telling that data must be stored in .tr [trace] format.

"nf" is the file handler that we are used here to handle the trace file.

"w" means write i.e the file out.tr is opened for writing.

>> "r" means reading and "a" means appending

The second line tells the simulator to trace each packet on every link in the topology and for that we give file handler nf for the simulator ns.


# Define finish procedure

proc finish {} {

global ns nf

$ns flush-trace

close nf

exit 0

}

In here the trace data is flushed into the file by using command $ns flush-trace and then file is closed.

While running the ns2 program via terminal, trace file is generated in the selected directory (folder or directory where the program stored).



SNAP SHOT OF A GENERATED TRACE FILE FOR WIRED NETWORK



The format of a trace string is shown below:




In here,there is 12 feilds and we can explain it as;

1. EVENT OR TYPE IDENTIFIER

+ :a packet enque event
-  :a packet deque event
r  :a packet reception event
d :a packet drop (e.g., sent to dropHead_) event
c :a packet collision at the MAC level

2. TIME : at which the packet tracing string is created.

3-4. SOURCE AND DESTINATION NODE : source and destination ID's of tracing objects.

5. PACKET NAME : Name of the packet type.

6. PACKET SIZE : Size of packet in bytes.

7. FLAGS : 7 digit flag string.


“-”: disable
1st = “E”: ECN (Explicit Congestion Notification) echo is enabled.
2nd = “P”: the priority in the IP header is enabled.
3rd : Not in use
4th = “A”: Congestion action
5th = “E”: Congestion has occurred.
6th = “F”: The TCP fast start is used.
7th = “N”: Explicit Congestion Notification (ECN) is on. 

8. FLOW ID

9-10. SOURCE AND DESTINATION ADDRESS : The format of these two fields is “a.b”, where “a" is the address and "b" is the port.

11. SEQUENCE NUMBER

12. PACKET UNIQUE ID

Each trace line starts with an event (+, -, d, r) descriptor followed by the simulation time (in seconds) of that event, and from and to node, which identify the link on which the event occurred. Look at Figure 4 in the Network Components to see where in a link each type of event is traced. The next information in the line before flags (appeared as "------" since no flag is set) is packet type and size (in Bytes). Currently, NS implements only the Explicit Congestion Notification (ECN) bit, and the remaining bits are not used. The next field is flow id (fid) of IPv6 that a user can set for each flow at the input OTcl script. Even though fid field may not used in a simulation, users can use this field for analysis purposes. The fid field is also used when specifying stream color for the NAM display. The next two fields are source and destination address in forms of "node.port". The next field shows the network layer protocol's packet sequence number. Note that even though UDP implementations do not use sequence number, NS keeps track of UDP packet sequence number for analysis purposes. The last field shows the unique id of the packet.


SNAP SHOT OF A GENERATED TRACE FILE FOR WIRELESS NETWORK [NEW TRACE FILE FORMAT]


New Trace File Format
























TRACE FILE DESCRIPTION

Following list shows the trace file variables and its explanations;

s - send packet
r - received packet
d - packet dropped 
f - packet forwarded
c - collision of packet at MAC level
t - time at which packet tracing started
Hs - ID of the hop
Hd - ID of the next hop towards destination 
Ni - Node ID
Nx,Ny,Nz - Co ordinates that the nodes situated
Ne - Node energy level
Nl - Trace level
Nw - Reason of the event
AGT - Agent
RTR -Routing
END - DROP End of Simulation
COL - DROP MAC COLLISION
DUP - DROP MAC DUPLICATE
DERR - DROP MAC PACKET ERROR
RET - DROP MAC RETRY COUNT EXCEED
STA - DROP MAC INVALID STATE
BSY - DROP MAC BUSY
NRTE - DROP RTR - NO ROUTE
LOOP - DROP RTR ROUTE LOOP
TTL - DROP RTR TTL has reached Zero
TOUT - DROP-RTR-QTIME OUT Expired
Is - Source address of source port
Id - Destination address of destination port
Il - Packet Size
If - Flow ID
Ii - Unique ID
Iv - TTL value next hop into

MAC LAYER INFORMATION

Ma - MAC Layer duration
Md - Destn. Ethernet Address
Ms - Source Ethernet Address
Mt - Ethernet Type

PACKET INFORMATION

-P arp - address resolution protocol-Po - ARP Request / Reply
Pm - Source MAC Address
Ps - Source Address
Pa - Destination MAC Address
Pd - Destination Address
Pn - Nodes Transversed
Pq - Flag
Pi - Route Request Sequence Number/ Sequence Number
Pp - Flag
Pl - Reply Length
Pe - src of source routing
Pw - Error Report Flag
Pc - Report to whom 
Pb - Link error from link a to link b
-P cbr - CBR data
Pf - How many level packet leave
Po - Optimal Number of Forward
-P TCP - TCP flow
-Ps - seq. number
Pu - acknowledgement
Pf - Packet Failure



OLD TRACE FORMAT

Old trace format consists of two parts;

Basic trace string: This is similar to the Normal Packet Trace Format(Seen in wired trace file format). It is labeled with numbered 1-12. These fields appear in every trace strings. 
Additional trace string: This string is specific to what NS2 is tracing. For example, the trace strings for IP Trace and AODV-RREQ Trace format are shown above. When NS2 does not trace these two information. These lines will not appear as a part of the trace string, but the Basic trace string would still appear on the string. 

Trace Field Definition
Trace level: The level NS2 is tracing. The common arguments are AGT for agent, MAC for MAC, and RTR for Routing. See the list of possible values in the file  ̃ns /trace/cmu-trace.cc.

Reason: The reason for this trace (e.g., “NRTE” for No RouTe Entry)
Time to Send Data: Expected duration required to transmitted this packet over the wireless channel as indicated by the underlying MAC protocol. 
Ethernet Packet Type: Currently, there are only two Ethernet packet types: RREQ Type: Type as indicated in the field “rq_type” of thehdr_aodv_request struct data type. By default, the value is “AODVTYPE_RREQ” defined as “0×02”.
A general IP packet: The value is “ETHERTYPE_IP” defined as “0×0800”.
An ARP packet: The value is “ETHERTYPE_ARP” defined as “0×0860”.

SNAPSHOT OF AODV TRACE FILE

Basic trace information:
  • The node “_0_” sends (i.e., “s”) at time “21.500275” second.
  • The trace level is at the “MAC” layer.
  • The packet has the unique ID of “0”, contains an “AODV” payload type, and is “106” bytes in size.
  • The MAC protocol assumes that the delay over the underlying wireless channel is zero “0”.
  • The source and destination MAC addresses are “0” and “ffffffff”, respectively.
  • This is an IP packet running over an Ethernet network (i.e., “800”).
IP trace information:
  • The IP source and destination addresses of “0” and “1”, respectively.
  • The ports for both source and destination are “255”.
  • The time to live and the address of the next hop node are “30” hops and “0”, respectively.
AODV trace information:
  1. This is an RREQ packet tagged with the ID “0×2”.
  2. The number of hop counts is “1” and the broadcast ID is “4”.
  3. The destination IP address and sequence number are 1 and 0, respectively.
  4. The source IP address and sequence number are 0 and 10, respectively.
  5. The string “(REQUEST)” confirms that this is the RREQ packet.


DSR TRACE FILE FORMAT




s: means send
606.210364161: time stamp
_39_:  node id
RTR: means router message
1306:  id of this packet
DSR: DSR agent
44: size in the common header hdr_cmn()
[13a a 27 800] MAC detail:  13a: means the expected transmission time ( note that packet size is large, 44 bytes, 314second?)
                                               a: means the receiving node: 10
                                               27: means the sending node is 39
                                               800:  IP header: 0x0800, (ETHERTYPE_ARP is 0x0806)
[39:255 8:255 255 8] IP detail: src address: IP 39 means 0.0.0.39
                                                  port 255
                                                  dst address: IP 8 means 0.0.0.8
                                                  port 255
                                                  TTL: 255
                                                  Next-hop: 8
2 [0 0] [0 0 0 0->0] [1 1 8 39->10] DSR detail:
                                                   2:  num_addrs()
                                                   [0 0] route-request option, this is not a route request, the second 0 is labeled for sequence number
                                                   [0 0 0 0->0]    route-reply option: [ " route-reply?" "Rreq seqno" "reply length" "dst of src  route", "src of the src route"]
                                                   [1 1 8 39->10], 1: shows this is a route error
                                                                            1: number of route errors
                                                                            8: tp notify node 8.
                                                                            39->10: link 39-10 is broken  

Comments

Popular posts from this blog

Link State Routing Protocol

Link state routing is a method in which each router shares its neighborhood’s knowledge with every other router on the internetwork. In this algorithm, each router in the network understands the network topology and then makes a routing table depending on this topology. Each router will share data about its connection to its neighbor, who will, consecutively, reproduce the data to its neighbors, etc. This appears just before all routers have constructed a topology of the network. In LSP, each node transmits its IP address and the MAC to its neighbor with its signature. Neighbors determine the signature and maintain a record of the combining IP address and the MAC. The Neighbor Lookup Protocol (NLP) of LSP derives and maintains the MAC and IP address of every network frame accepted by a node. The extracted data can support the mapping of MACs and IP addresses. The link-state flooding algorithm prevents the general issues of broadcast in the existence of loops by having every node mainta...

Matter: A next generation home standard

The smart home is evolving. To date, if you've wanted to get into developing a smart home, you've had to deal with the multitude of smart home ecosystems, and making sure that each device you buy is compatible. That, however, may soon change — thanks to new smart home standard called Matter. Matter isn't available just yet, but when it is finally released, it could completely change how you buy smart home products, for the better. All of the best smart home devices could soon support the standard, helping them all work together nicely, and ensuring that no matter what products you buy, you'll be able to use them. Matter is basically the name of a new smart home connectivity standard . But this standard is a little unlike others. That's because of the fact that it's being developed by the Connectivity Standards Alliance, which counts hundreds of companies as members. That includes the likes of Google, Alexa, and Apple. So, whether you prefer to use Google Assista...

New interactive stickers for Stories

Instagram has introduced several new features to Stories, offering interactive ways to share music, photos, and videos. One of the most interesting additions is a feature called Reveal , which blurs the content of a story post and requires viewers to DM the person who shared it in order to see it. Instagram's head, Adam Mosseri, has emphasized the importance of direct messages on the platform, with stories and DMs driving most of Instagram's growth. Requiring a DM to view content represents the next step in boosting engagement, and creators are likely to use it as a tactic to increase their stories' engagement. Another new feature, Frames, adds a Polaroid overlay to images that initially appear gray. Users can shake their phone to reveal the photo, resembling the process many people associate with Polaroid pictures, despite the fact that shaking Polaroids is not recommended by the company during development. Instagram has also introduced a music-based template feature calle...