|
|---|
| How to write DML network models, continued |
|
Simple network with two routers: IP and packet queues | ||
|
At this point you should be familiar with the first tutorial on host protocol configuration and DML object-oriented support for attribute substitution and inheritance. This tutorial shows how to specify the default routes in very simple networks without using the routing protocols (which are the subject of the following tutorial), and how to globally specify a traffic pattern in a network with several client and server hosts. The operation of the SSFNet's IP protocol and packet queueing is summarized at the end. After reading this tutorial, you should examine the directory ssfnet/src/SSF/OS/TCP/test/tcpdumpTest in the SSFNet distribution to see how to collect the packets in the tcpdump format from a network interface, and how to use the utility class SSF.OS.DumpPro to extract ascii data from the tcpdump file. | ||
| ||
|
analysis of udpXnet.dml The id numbers of hosts, routers and interfaces in this network are shown in the ascii art:# udpXnet.dml # 2 X 2 network with UDP clients and servers, interfaces in NHI addressing # # client 11(0)------1(1) 2(1)------12(0) client # \ / # [R1] 1(0)------------2(0)[R2] # / \ # server 21(0)------1(2) 2(2)------22(0) server The first new kind of DML code fragment specifies arrays of objects: | ||
# ROUTERS AND POINT-TO-POINT LINKS -----------------------------------
router [
idrange [from 1 to 2]
graph [ProtocolSession [name ip use SSF.OS.IP]]
interface [ id 0 buffer 8000 _extends .dictionary.100BaseT]
interface [ idrange [from 1 to 3] buffer 16000 _extends .dictionary.10BaseT]
route [dest default interface 0]
]
| ||
|
Above we specified two identical routers as elements of an array with id indices
1 and 2 using the attribute idrange.
We used the same construct to specify that each router has 3 10BaseT interfaces with id = 1,2,3. Note that we specified 3 10BaseT interfaces but only the first two are actually attached to point-to-point links. This is just to show that it is legal to have unconnected ("down") interfaces in SSFNet models - it will prove to be a very convenient trick for preconfiguring a library of networks that are later connected together. The next new thing is the attribute interface.buffer, here specifying buffer 8000. This is the size of interface output queue buffer in bytes. Finally, using the attribute route we specified that if an IP packet's address is not in the IP routing table, the router should forward it via interface with id=0. If you look at the the file udpXnet.dml, you'll see that the link connecting the two routers is attached to interface 0 of router 1 and to interface 0 of router 2: Thus, for each router dest default simply says "if a packet's destination IP address is not on any link directly connected to a router, send it to the other router". The other new DML construct in this tutorial section is the array notation for multiple server NHI addresses: | ||
# CLIENTS-SERVER TRAFFIC PATTERN --------------------------------------
# "left side" client can request data from any server
# "right side" client can request data only from "left side" server
traffic [
pattern [
client 11
servers [nhi_range [from 21(0) to 22(0)] port 1600]
]
pattern [
client 12
servers [nhi 21(0) port 1600]
]
]
| ||
|
The expression servers [nhi_range [from 21(0) to 22(0)] port 1600]is the array notation equivalent to two separate single-server addresses: servers [nhi 21(0) port 1600] servers [nhi 22(0) port 1600]Note that in the above array notation the host id is the running index, while the interface id remains the same for all array elements. The client's session udpStreamClient chooses one server uniformly at random from the list specified by the servers attributes. SSF.OS.IP, SSF.Net.NIC and packet queues In SSFNet 1.1 the IP ProtocolSession (implemented in class SSF.OS.IP) provides the following services:
SSF.OS.IP does not maintain outgoing packet queues. It immediately pushes an outgoing packet to the "network interface card" implemented in class SSF.Net.NIC. SSFNet models the Internet at the logical IP level of detail, and SSF.OS.IP does not implement packet fragmentation and reassembly. The NIC is a bottom-level pseudo-protocol that maintains a pair of SSF in/outChannels to the world outside the protocol graph. It represents the border between the internal operation of the protocol graph (characterized by the push() of ProtocolMessages between ProtocolSessions in zero elapsed simulation time) and the IP packet transmission to external network nodes (characterized by sending of PacketEvents in positive elapsed simulation time). IP packets that arrive on the NIC's IN channel are immediately pushed up to the IP protocol session. IP packets that are pushed down from IP to NIC are handed to an instance of class packetQueue, which schedules event transmission on behalf of the NIC. By default, this queue manager is of type dropTailQueue, but the modeler may write another class to be used and load it from DML configuration using the method NIC.config(). SSF.Net.dropTailQueue and packet transmission timing Logical model: The dropTailQueue capacity is specified by the interface.buffer attribute (infinite capacity if omitted). The timing resolution is at the bit level: bits go out one by one at the NIC's bitrate. If NIC attempts to enqueue a message whose size is larger than the currently available free buffer space, the message is dropped. Transmit a message: Each interface tracks its "queueing delay," which accumulates as packets are written out onto the link. Each packet contributes its transmission time (size in bits / bitrate) to the queueing delay of future packets. This guarantees that the interface will never exceed its configured bitrate.
Warning: if Net.frequency (ticks per second) is smaller than NIC's bitrate (bits/sec) the delay calculations are not accurate enough to obtain correct value of number of bits in the buffer. Fairness among competing outgoing flows is an entirely separate issue; and is not dealt with. The packets are enqueued in the order they are pushed to the NIC by IP.
| ||
|
|