• And it Click(!)ed

    Another ns-3-click update from my side. The Ipv4ClickRouting class is almost done. I tried writing some sample to code to get a Click router based node to send a packet, and have another similar node receive it via a CSMA link. And it actually works! w00t! :) Meanwhile, it seems like I'm going to have to deviate from my proposal a bit. The project proposal talked about using Click strictly for layer 3 services only. This meant that we were to stay away from using Click's MAC layer functionality for the time being. This naturally means that once a Click graph is processed, we'll need to receive the packet on the ns-3 side as an IP packet, as opposed to an Ethernet encapsulated one. The original plan was to send this IP based packet down to a node's Ipv4Interface, from which point onwards, we'd be following the normal ns-3 path of a packet. But this has complications of its own, the most important of them being the fact that we can't perform a RouteOutput() query when using external routers like Click. RouteOutput(), in a normal scenario, returns the route that the packet is to follow, which is a method provided by the Ipv4RoutingProtocol instance of a node. Thus, given an IP packet returned from Click, we have no way of knowing what the 'next hop' destination of the packet is, which needs to be known in order to forward a packet. I'm presently proposing to directly send this packet down a node's NetDevice, thus bypassing even the ArpL3Protocol. The advantage with this scheme is that a user gets to test the _whole_ of his Click graph as it is! The only disadvantage is that we need to extract the required MAC layer details from the packet and strip off the packet's Ethernet header before forwarding it down the NetDevice, since all the NetDevice subclasses append an ethernet header in their Send() methods. While this is hardly 10 lines of code, purists may argue that a packet going down a stack never needs to have a packet stripped off it. Oh well. I'm presently trying to discuss this on the ns-developers mailing list. Let's see what everyone else thinks. :)
  • The road to an ns-3-click Hello World!

    The GSoC coding period started three days ago, on the 24th of this month. I did begin working on ns-3-click in the beginning of the month itself though. Although I had just included it as a one-liner in my proposal, "linking NS-3 with Click" wasn't exactly the most straightforward of steps for me. Reason? NS-3 uses waf for managing its build process. Since I'm new to waf, it took me a few days to figure out, but yes, I managed to link NS-3 with libnsclick.so. To build NS-3 with Click Integration enabled, just perform the following steps: $: cd <to-click-source> $: ./configure --enable-nsclick --disable-linuxmodule --enable-userlevel $: make && sudo make install $: cd <to-ns-3-click> $: ./waf --with-nsclick=<click-installation-prefix> Once the above was done, I could start implementing the required classes as soon as the coding period began. If you have a look at src/routing/click, you'll find the Ipv4ExternalRouting and Ipv4ClickRouting classes. Ipv4ExternalRouting has been maintained to hold generic external routing code, which is then sub-classed to implement the External Router specific code. The gist of my work involves completing one half of a Simulator API which allows an external simulator to talk with Click. The fun part about the work so far, is executing random methods from the API to see what the Click code is expecting from NS-3. So far, I never once needed to peek into Click's side of the Simulator API (I last saw all that code while making my proposal)! The first thing I tried was running simclick_click_create() with a sample .click file (the one I initially used was ns-2.34/tcl/ex/nsclick-simple-lan.click). Since I had included debug statements in all the Click service methods (look under simclick_sim_command()), a simple run of the code told me whatever I needed to implement first. And the services I needed to code were: 1) SIMCLICK_IPADDR_FROM_NAME 2) SIMCLICK_MACADDR_FROM_NAME 3) SIMCLICK_GET_NODE_NAME 4) SIMCLICK_IFID_FROM_NAME Figuring that out was easy enough. I began by writing dummy code for the above services. I then implemented a function I named Ipv4ClickRouting::TestInit(), which would call simclick_click_create(). This allowed me to begin initialising Click Router Instances within NS-3! So we're now through step number 1. :) The next step involves being able to execute simclick_click_run(). It is ultimately this method from the Simulator API that the NS-3 Simulator should call everytime it needs to execute a Click router for a particular node in the simulation. I included this command inside the Ipv4ClickRouting::TestInit() as well, and gave it another run. As expected, it seemed that the Click code needed the SIMCLICK_SCHEDULE service. This was basically Click asking NS-3 to schedule a specific simulation node to execute at a particular time. Why was this an easy guess? Because once a Click Router is initialised, the Click Driver code would need to schedule itself to run again at a later time. In an integration with NS-3, the Click Driver would want NS-3 to get the Click Instance to run. Why? Because Click needs to synchronise to NS-3's simulation time, not the other way around. :) So the requirement here is that NS-3 should drive the Click code. So step  number 2 was to code out the SIMCLICK_SCHEDULE service. This was fairly easy as well, for which I added some more methods to the Ipv4ClickRouting class. After this step, I noticed another Click script in ns-2.34/tcl/ex named 'nsclick-simple-bridge.click'. This one seemed ideally suited for testing purposes, because it consisted of just two ethernet interfaces, eth0 and eth1. Any packet received on eth0 is sent to eth1 and vice versa. Exactly what the doctor ordered for Click newbies like myself! The last bit of testing code I checked in a few hours ago seems like a working example for the integration. Try doing an hg clone of the ns-3-click code, and running scratch/nsclick-test.cc. As of now, the code simply initialises an Ipv4ClickRouting instance and creates a Click Router instance for the nsclick-simple-bridge.click configuration. In the 20th second of the simulation, a packet is sent down eth0, and received via simclick_sim_send() from eth1. This repeats every second until the simulation is done. This sure feels good! :) UPDATE: The code's been improved since then. The hacks have been removed and replaced with actual code. Check out nsclick-test.cc. Just specify the .click configuration file you need to use in your simulation script. Note that the file must be in your ns-3 top level directory.
  • There Will Be No Curtain Fall

    I know many of you who read this will say, "I know what got him to write this!". And you are correct. What I will be writing below doesn't depend on it though, I hope you do not fall asleep mid way (or even before that!). I have been an army brat all my life. From my "Hello World!" moment in the beautiful city of Tehran, life has been all about change. I went on to experience the fresh fish of Calicut, the rapid development at Doha, the breathtaking rice fields of Palakkad and finally, the wonderful city of Jaipur. Seeing new places and meeting new people is exciting, but the flip side involves something that everyone would no doubt agree, is difficult. It is the part where you have to say goodbye, to friends, family and a lot of wonderful memories. I have always considered myself rather cold when it comes to emotions such as this. I don't remember being heavy hearted during any of the times that I had to leave one city for another. I used to look forward to seeing my new home. I used to make guesses as to the life I was soon going to live, the life that I knew I would need to put behind me a few more years later. But humans are known for the never ending depth to their emotions. A depth that is explored from birth to death, in a journey that is never short of surprises for the bearer of the emotions itself. And the realisation that one is changing, is usually the cause of surprise. It is this realisation in myself that prompted me to write this. I now enter another checkpoint in my life where I have to say goodbye to a lot of people. And I know this time that things are different. I think of the experiences that made me what I am today, the people who influenced me and the memories that have been engraved onto me. I know that when I leave the institute, dragging my luggage behind me, I will turn back and look down the long road. I know 4 years of thoughts will flash by me, from the moment I entered this institute and stared aghast at the desert-like environment that was MNIT, to the point of the final goodbye, which is just a few days away from now. I will now proceed to say goodbye in two parts, each targeted at two different sets of people. Mind you, the two sets might have an intersection, so that's two goodbyes for these people! The first goodbye, is to the ones I call friends. Those of you who were part of the mass bunks in first year. Those of who took my 'ice-breaker' sessions and those who were my comrades during the same. The guys who I'd drink with, and the very next morning, would tell me about all the crap I'd have done the previous night. The people I'd turned to during my lowest of moments, by far one of the most forgettable phases of my life. The awesome people I've gamed with and taken part in tournaments with. The amazing friends who took the trouble to make a lovely video for me. And a lot more. To each and every one of you, all I can say is, I'm speechless with gratitude. I'm proud to have known all of you. Hope nothing but success comes your way. I'm not sure how many of you can guess who my second goodbye is for. But here goes. It is to my juniors. I've had quite a number of you thanking me for helping out and for having guided you at times. But allow me to say something in return. Thank _you_. Ever since my 3rd year, I used to take time off to teach you guys. What started out as just a little something I was doing to help the department ended up being a passion for me. I cherished every second of every seminar I'd taken. I enjoyed evaluating all those answer sheets from the quizzes we'd have after the seminars and reading out the funny answers during the next session (with the promise of anonymity of course!). And those killer doubts that you'd raise! Trust me when I say that there was no better way to learn than that! And how can I forget all the fun times that we've had conducting events and workshops, an enriching experience in itself. All of this together convinced me to proceed towards the career that I now have in mind for myself, which is teaching. I yearn to be a professor, and I will be pursuing an MS now and a PhD after that as steps towards that direction. Thanks to _each_ and every one of you for making me realise what I truly want to become in life, for making me find something that I truly loved doing. Thanks to all those of you who'd turned to me for advice. And the same amount of thanks to all those juniors from the newsletter team who I've had the pleasure of working with as well. I forever remain indebted to all of you for this and will continue to be the geeky Lalith Boss that you've always known. To put it in my own words, "Let me know if you need any help." :) On a concluding note, all I'd like to say is that I hope to not lose touch with any of you, because bonds like this don't deserve a punishment as cruel. And thus I assure you all that this time on, the curtains will not fall. Cheers!
  • Google Summer of Code 2010!

    I've finally been selected for the Google Summer of Code programme! My proposal is named "NS-3 Click Modular Router Integration" and the mentoring organization is Network Simulator 3. I'm being mentored by Ruben Merz. :) I've also prepared a presentation on the same. Stay tuned here to follow posts on ns-3-click development!
  • Euro Trip!

    A few days ago, I lived a part of my life which I like to call Happiness. Yes, I was finally accepted into the European Masters in Distributed Computing programme and that too with a Category A Erasmus Mundus scholarship. This programme is being offered by the consortium of universities formed by Royal Institute of Technology (KTH), Sweden; Instituto Superior Técnico (IST), Portugal and Universitat Politècnica de Catalunya (UPC), Barcelona. My study track involves being in IST, Portugal for the first year; KTH, Sweden during my 3rd semester and finally having my Master's Thesis evaluated from IST, Portugal. Furthermore, my good friend Navaneeth has been offered the same course _and_ the same study track as well, to the relief of our parents. :) So here's how the python list of my life looks like: life.journey = ['Tehran, Iran', 'Calicut, India', 'Doha, Qatar', 'Palakkad, Kerala', 'Jaipur, India'] life.journey.append ('Lisbon, Portugal') life.journey.append ('Stockholm, Sweden') Guess it's time for a Euro trip then eh? :)