[Edu-sig] Network Simulations using Python

David MacQuigg macquigg at ece.arizona.edu
Sat Sep 13 12:00:45 CEST 2008


At 11:14 AM 9/10/2008 -0500, Andrew Harrington wrote:

>Doing this in Python sounds good.  keep us posted on the updates.

I'll keep my updates at http://ece.arizona.edu/~edatools/ece578/Ethernet/

>I am most interested in a module to use with Cs0 or CS1 types to 
>illustrate network issues, not something a *user* would need more
>than a few weeks of Python for.

I can do some fairly sophisticated models with simple Python programs.  Class definitions are essential, however, so it may take a little more Python than is covered in the first few weeks of CS1.  Maybe there is some synergy here.  The network models can help students learn Python by motivating the need to define your own classes.

At 11:05 AM 9/10/2008 -0500, Michael Goldwasser wrote:

> Thats a great start and I agree that it might be easier to develop
> your own Python simulation versus using the existing simulators.  I
> don't teach our upper level networks course but have tried to do some
> very simple networks materials as part of a "cs 0" breadth course and
> again I run into the same problem in that I want a very basic network
> simulation that demonstrates the basic idea of packet switching
> without overwhelming beginning students.

We're using Computer Networks by Peterson and Davie, and packet switching is Chapter 3, starting a week from now.  Suggestions for simulation problems are welcome.  I appreciate the earlier suggestion to do some network programming (using a network rather than simulating it), and I know Python is very good at this.  There is not much in this text on programming.

For CS0 you might want animations, rather than simulations.  See http://net-seal.net  They have one on packet switching.

I've gone the next step with my Ethernet simulation (sim1.py), and encapsulated all the functionality into a few classes.  This adds some complexity (sim2.py), but now you can easily change the variable to be swept, even re-use the objects in a different network configuration.

One difficulty that I am running into is that many of our students haven't even heard of Python.  They have had plenty of Java, however, so I've written an annotated version of sim1.py to explain the differences from Java (sim1PythonNotes.py).  Michael's Appendix B is excellent on comparing Java and Python.

I thought about just doing the whole thing in Java, but then we lose the most important advantage of Python as a network simulation toolkit - interactive development of the models.

-- Dave


>On Wed, Sep 10, 2008 at 10:43 AM, David MacQuigg <<mailto:macquigg at ece.arizona.edu>macquigg at ece.arizona.edu> wrote:
>>I'm putting together some problems for students in ECE 578, Computer Networks.  The simulator being used in the class is truly awful, one of these expensive commercial programs, dumbed down for academic use, but still loaded with the non-essential complexity typical of programs written for full-time professionals.
>>
>>It occurs to me that Python would be a much better tool for what we are doing.  The objects in a network are easily modeled as Python objects, and students gain a much better understanding when they see what is inside the objects, rather than just picking them off a menu, and using them as black boxes.
>>
>>Take a look at <http://ece.arizona.edu/%7Eedatools/ece578/Ethernet/>http://ece.arizona.edu/~edatools/ece578/Ethernet/   The Python program is still in its early stages.  Next step is to "refactor" it, making the main program a Network object, so we can run it in a loop.
>>
>>Comments and suggestions are welcome, especially for more clarity in the Python code.  Python is still not used in any class at U of A, and this could be one of our shining examples to get it started.




More information about the Edu-sig mailing list