Menu

(Solved) : Assignment Work Real Life Research Problem Network Lab Hosts Auckland Satellite Simulator Q30914319 . . .

In this assignment, you will work on a real life researchproblem. Our network lab hosts the Auckland Satellite Simulator(http://sde.blogs.auckland.ac.nz/). We use it to simulate Internettraffic to small Pacific islands that are connected to the rest ofthe world via a satellite link.

To do this, the simulator has a number of machines (“sourcehosts”) on the “world side” of the simulated satellite link thattransmit data in the form of small chunks of up to 1500 bytescalled packets. These packets travel via a simulatedsatellite link to the “island side”. Once on the island side, eachpacket ends up at a machine there. These machines are called“destination hosts”.

The simulated satellite link delays packets and occasionallythrows some away when there are more packets arriving that it candeal with at the moment. When the link throws packets away, thesource hosts respond by sending less data for a while beforeattempting to send more again.

On the island side of the satellite link, our simulatoreavesdrops on the incoming packets. It stores summary informationabout each packet in a trace file. The trace file is plaintext and each line contains the record for exactly one packet (moreon the file format in the next section).

What we would like to be able to do is get a graphical displayof how much data comes from a particular source host over time, orhow much data goes to a particular destination host over the courseof an experiment. Experiments typically take between 90 seconds andabout 11 minutes.

This where your assignment comes in: You are to build anapplication that displays this data. Now is the time to watch thewalk-through video of the application on Canvas, so you get an ideaof what is expected. If you find my voice in the video difficult tolisten to, there is a (rough) transcript of the video on theassignment page as well.

In the next section, we’ll look at the structure of our tracefiles, before we take you through the steps for building theapplication.

Trace files

The total size of a trace file can vary substantially dependingon the number of hosts involved in an experiment and the length ofthe experiment. On Canvas, there are two trace files for you toexperiment with: a small one with 148315 lines, and a large onewith 651274 lines. You can open them in text editors such asNotepad++. And yes you can edit them, too!

To get a good idea of your “typical” line, scroll down a goodbit – the lines/packets at the start and at the end are a bitunusual. The following shows a bunch of typical lines from thelarge trace file:

108860 128.879102000

108861 128.879885000

108862 128.880603000

108863 128.881481000

108864 128.881481000

108865 128.881481000

108866 128.881495000

108867 128.882148000

108868 128.882905000

108869 128.883800000

192.168.0.24 192.168.0.24 192.168.0.24 192.168.0.15 192.168.0.9192.168.0.24 192.168.0.15 192.168.0.3 192.168.0.3 192.168.0.3

47928 10.0.0.5
47928 10.0.0.5
47928 10.0.0.5
8000 10.0.1.2559590 8000 10.0.1.1542081 47928 10.0.0.5 5201 800010.0.1.2559590

1514 1500 1514 1500 1514 1500 66 52 66 52 1514 1500 66 52 15141500 1514 1500 1514 1500

1448 … 1448 … 1448 … 0 … 0 … 1448 … 0 … 1448 …1448 … 1448 …

8000 10.0.1.4 8000 10.0.1.4 8000 10.0.1.4

554425544255442

The lines here have been truncated to be able to accommodatethem on the page, but they show all the data you will need. Eachline consists of a number of

520152015201

fields separated by a single tab character. Note that fields maybe empty, in which case you get two successive tab characters.

The first field on the left is a just a sequential number foreach packet that is added by the eavesdropping program. The secondfield is a time stamp that is also added by the eavesdroppingprogram. Each trace file starts with a time stamp of 0.000000000for the first packet in the file. You will need to use the timestamp column in order to find out what maximum value to scale thex-axis in your application to.

The third field in each line is the IP address of the sourcehost. IP addresses identify machines on the network and helprouters forward packets between source and destination. Each IPaddress consists of four decimal numbers between 0 and 255separated by dots (full stops).

The trace files here only show packets heading towardsdestination hosts on the island side, so all source host IPaddresses start with “192.168.0.”, indicating that they are “worldside” addresses.

The fifth field is the IP address of the destination host fromthe island network. All of the island addresses start with “10.0.”.You will need the third or the fifth field to populate the combobox depending on the status of the radio buttons.

The fourth and the sixth field are the TCP ports on the hoststhat the respective packets travel between. They identify theapplications that have sent or would have received the packets, butare not relevant for your assignment.

Fields 7, 8 and 9 are packet sizes in bytes. The size we’reinterested in here is that in field 8, it’s the IP packet size. Thesize in field 7 is that of the whole Ethernet frame that containsthe IP packet, and field 9 is the TCP payload size (the size of thecontent of the IP packet).

There are also a number of additional fields: various flags,packet sequence and acknowledgment numbers, which are allirrelevant for your task. You only need to look at four fields:time stamp, source and destination IP addresses, and IP packetsize. Note that some packets are not IP packets, meaning that theIP packet size field can be empty.

Step 1: Getting started

You are expected to do your own class design for thisassignment, but there are some fairly obvious parts to the design:Firstly, it’s a GUI application with one window, so you’ll need aJFrame. In all our GUI applications in the lectures, we haveextended that JFrame by a dedicated subclass for the application.So you’ll probably want to do the same here.

The Swing components are all associated with the JFrame, soyou’ll need to import the associated packages, configure thecomponents and add them to the JFrame either directly or via theirrespective parent. The ListOWords and Album applications from thelectures are good examples for how to do this. Don’t forget toconfigure the ButtonGroup to link your radio buttons!

One exception is the JPanel that shows the coordinate systemwith the graph. As you’ll want to use this with the AWT graphics,it’s best to extend JPanel, so a more specialised subclass can takecare of the drawing.

Start by placing all components visibly within the JFrame – youmay wish to set the JPanel background colours to something a bitdifferent so you can see where in the JFrame they end up beingpositioned. Remember that a larger vertical position value puts thecomponent further down in the frame. Suggested values thatwork for me (but aren’t compulsory):

 The JFrame has size 1000 by 500.

 I’ve put the JPanel with the radio buttons at position 0,0(upper left corner

of the JFrame’s content pane) and made it 200 wide and 100tall.

 The JPanel subclass with the graph is at 0,100 and is 1000wide by 325

tall.

 The coordinate system is 900 wide and 250 tall, and the ticks(the short

lines perpendicular to the axis that mark the position of thelabels) are of length 5. Labels are positioned based on their lowerleft corner. The labels on the x-axis in my sample application havea horizontal position 10 less than the tick and a vertical position20 larger than the axis. On the y-axis, the labels sit 40 to theleft of the axis and 5 below the ticks.

You can earn a total of 40 marks in thisstep:

 JFrame subclass correctly started via a class implementingRunnable & using invokeLater(): 2 marks

 Menu bar present, showing a File menu with the two requireditems: 4 marks.

 Menu item “Quit” quits the application and Menu item “Opentrace file” opens a JFileChooser: 4 marks

 The two radio buttons are visible: 4 marks

 The radio buttons are mutually exclusive and one is selectedby default:

4 marks

 The JPanel (subclass) for the graph is visible and shows adefault

coordinate system: 8 marks

 The coordinate system has between 8 and 24 ticks on thex-axis: 8 marks

 The ticks are labelled in intervals of 1, 2, 5, 10, 20, 50, or100: 4 marks

 The axes are labelled with “Volume [bytes]” and ”Time [s]”respectively:

2 marks

In order to get the marks for positioning, no components orlabels must touch each other or overlap with other components orparts the coordinate system (i.e., the JFrame and its contents mustlook neat and tidy).

Step 2: Design your classes

Beyond the JFrame subclass and the JPanel subclass, this isreally up to you. You could use classes for the trace file, thehosts (even source or destination hosts), lines, packets, graphelements – you decide where you want to have your data and whereyou want to accommodate your functionality. You need to

design and use at least two extra classes, but you will probablywant more than that.

There are no marks in this step, but it is a precursor to Step5, which you should complete at the end once your design is finaland you have implemented as much of it as you could.

Step 3: Extract the source and destination hosts from the tracefile

First ensure that the combo box is invisible before you open thefirst trace file.

Using the trace file selected by the JFileChooser, parse thefile to extract the source and destination hosts. Check which radiobutton is active and show the respective set of hosts selected inthe combo box.

Hint: There are a few a little catcheshere:

1) Splitting lines can be done with the split() method of theString class, which takes a regular expression as itsparameter.

2) The lists must not contain duplicates, so you can’t simplyadd each line’s host entry to an ArrayList and then load thatArrayList into the JComboBox. Instead, Java has a data structurequite similar to an ArrayList that doesn’t allow duplicates: theHashSet class. It implements the Set interface, and for Strings,you can use it as follows:

import java.util.Set; import java.util.HashSet; … Set<String> myUniqueStrings = new HashSet<String>(); … myUniqueStrings.add(aStringWeMayOrMayNotHaveSeenBefore);

If aStringWeMayOrMayNotHaveSeenBefore is not yet in the hashsetmyUniqueStrings, it will be added. If the string is already inthe set, the add() method does nothing.

3) The lists must only contain IP addresses of IP version 4(IPv4). Some packets in the trace file are not IPpackets and the entries for source and destination in therespective lines will be empty. You must skip these packets. Thinkregular expressions, perhaps.

4) The lists in the combo box must be sorted. To do this, youneed to figure out how to sort IP addresses in Java. This can bedone in a number of ways. I use Collections.sort() andstore the IP addresses in a class that has an appropriatecompareTo() method. Google is your friend!

Once you have accomplished this, ensure that the combo boxupdates every time you click the other radio button and every timeyou open a new trace file. For this, you need to:

 Implement and add the necessary event handlers for the radiobutton.

 Implement the code required to (where applicable) fetch thelist of hosts

(should you generate these lists once when you load the file, oreach time the radio buttons change?).

 Implement the code required to wipe and re-populate the combobox. Look to the Album example from the lectures for a guidehere.

Ensure that you get the correct list of hosts in the combo boxeach time. You can earn a total of 34 marks inthis step:

 The combo box is invisible before the trace file is selectedand opened: 2 marks

 The application shows some evidence of a trace file beingopened and its contents being processed after one selects a filewith the JFileChooser (e.g., plot appearing, combo box gettingpopulated with sensible data): 8 marks

 The combo box becomes visible at this point in time: 2marks

 The combo box contains a list of IP addresses: 5 marks

 The list contains the selected type of host addresses(192.168.0.x if

source hosts are selected, 10.0.x.x for destination hosts): 4marks

 The list does not contain duplicates: 5 marks

 The list is sorted correctly: 4 marks

 The list updates correctly when the selected radio button ischosen:

2 marks

 The list updates correctly when we open a new trace file: 2marks

Step 4: Compute and plot the data

Implement the necessary code to:

 Compute the total number of bytes that the selectedsource/destination host sent/received for each 2 second interval(or 1 second interval if you wish). For 2 second intervals, youshould be getting the same plots as in the video.

 Compute the maximum number of bytes across all of theseintervals.

 Re-draw the coordinate system with appropriate ticks andlabels for the

whole duration of the experiment. “Appropriate” means that thehorizontal axis must be scaled to cover the time period of theexperiment within at least one tick, that the vertical axis must bescaled so its maximum must be at most one tick above the maximumnumber of bytes, and that the number and format of the ticks oneach axis must conform to the requirements of Step 1. The verticalaxis should have between about 4 and 10 ticks – again theappropriate maximum number here depends on the requirement that thelabels should not touch or overlap.

 Plot the bytes data from the first bullet point in a differentcolour, either as a bar plot (as in the video), as a curve withlines, or as a series of markers.

 Ensure that the plot updates each time you select a new host,change between source and destination hosts, and open a new tracefile.

You can earn a total of 36 marks in thisstep:

 The application shows a data plot of sorts: 8 marks

 The data plot is actually correct (shape-wise) and correspondsto the host

selected: 8 marks

 The x-axis scales correctly: 3 marks

 The x-axis has an acceptable number of ticks (8 – 24): 4marks

 The x-axis is labelled correctly: 4 marks

 The y-axis scales correctly: 3 marks

 The y-axis has an acceptable number of ticks (4 – 10): 2marks

 The y-axis is labelled correctly: 4 marks

Step 5: Document your classes

Document your design. The documentation must consist of twoparts:

1) A UML-style class diagram, which must contain all of theclasses you designed (except the class implementing Runnable),including your JFrame and JPanel subclasses. The diagram must showany subclass- superclass relationships (“is-a”) as arrows, and any“has a” (with multiplicity such as “1” or “0..*” or “1..*”) aslines. Each class must show its public non-inherited methods andfields.

2) “Javadoc” style comments for each public non-inherited methodin your code (except for event handlers in anonymous classes). See“Writing Doc Comments”underhttp://www.oracle.com/technetwork/java/javase/tech/index-137868.htmlYourcomments only need a description of what the method does and the@param and @return block tags.

You can earn a total of 10 marks in thisstep:

 UML class diagram: 5 marks minus one mark for eachun-/incorrectly documented class or relationship.

 Javadoc comments: 5 marks minus one mark for eachun-/incorrectly documented method

Debugging

I strongly recommend that you use Eclipse for this project. Oneparticular challenge is the parsing of the trace file in Step 3 and(depending on your design) Step 4, as well as the scaling andplotting operations in Step 4. Much of the intermediate operationshere happen behind the scenes – there is no visible output till thevery end of a lot of these operations and many things that canpotentially go wrong. One nice feature in Eclipse is that you canstill useSystem.out.println() etc. to write to the console, so youcan add such statements to check that your code behaves asexpected. You’ll also get to see any stack traces when exceptionsare thrown. And of course, you can add breakpoints and debug usingEclipse’s debugging features!

Expert Answer


Answer to Assignment Work Real Life Research Problem Network Lab Hosts Auckland Satellite Simulator Q30914319 . . .

OR