• How to extend ns-3 for your research

    Having been busy with coursework lately, I hadn't gone through our users' list in a while. Wading through a week's worth of posts today, it seems to me like a good deal of questions are from users who are trying to get started with extending ns-3. This is indeed quite expected; as a research tool, ns-3 is most useful only when built upon. These extensions usually take one of the following forms:

    1. a tweak to an existing protocol to make it simulate some specific scenario (try searching for "attacks" on our users list),
    2. adding some functionality X to an existing module, (for instance, RRC messages support for LTE)
    3. or writing an entirely new module from scratch.

    Before you do *anything* with ns-3, go through the tutorials first.

    Now, for cases 1 and 2 mentioned above, the *only* way to proceed is:

    1. Go through the literature about what you're trying to implement -- "What do I want to achieve?"
    2. Understand the scope and limitations of the ns-3 module you're trying to deal with (go through the model documentation at least) -- "Does ns-3 have the necessary base for me to build on top of?"
    3. If the answer to the above is "yes", then start reading through the respective module's code to figure out where you'll need to insert your modifications. -- "Where does my extension/tweak fit within the existing source code?"
    4. Implement.
    5. Profit.

    Case 3, on the other hand, requires a lot more work:

    1. Go through the literature about what you're trying to implement -- "What do I want to achieve?"
    2. Understand how your module would fit within ns-3. This is usually the tricky part. To this end, it's very important to understand how packets flow through a node within ns-3. This figure from our manual is usually the only thing you'll need to know to get started.
    3. At this point, I'll make things easier for myself and assume that you're going to implement something that fits into the above mentioned architecture (rather than trying to modify the architecture itself). The first step is as simple as deriving from the right class. This gives you the virtual methods you need to implement in order to maintain a particular component's semantics. So if you're trying to write a new application, derive from ns3::Application. If it's a new routing protocol, derive from ns3::Ipv4RoutingProtocol or ns3::Ipv6RoutingProtocol. If it's a new NetDevice, derive from ns3::NetDevice. The easiest thing to do is to find another example of the component type you're trying to develop and reflect its basic structure.
    4. Now to get started writing your new module, have a look at Gustavo Carnerio's create-module.py script (inside src/)  which generates a skeleton for your new module. This includes the necessary sub-folders for the module, and also the all important wscript file. For most use cases, it would suffice to peek into some other module's wscript file to get an idea of what to do. If you're going to need some fancy external libraries, you'll need to go through the waf documentation a bit. Look into src/click/wscript to get an idea of how to do external linking.
    5. Now once you start developing your new simulation model, you'll need to attach this object to a node to get it to do something. This mode of attachment varies from component to component. Some objects are 'aggregated' to the node, some are added to a list of similar components (like applications being added to a node's 'ApplicationList') and so forth. The best places to look in order to understand this are the helpers for each module. So for instance, if you want to figure out how to add your routing protocol to a node, look at src/olsr/helper/ to get an idea.
    6. Lastly, you'll need to write simulation scripts to see your module in action. Copying off and editing existing example scripts from the examples/ folder or the src/*/examples/ folders should suffice for most cases.
    7. If you're going to propose this new module for merge, look at our contributing code page. Keep in mind that we won't merge code which doesn't have any documentation, or tests (validation or unit tests, as is applicable).
    8. Merge. :)
  • Comic: Seals

    3. YANC - Seals

  • Comic: Utility

     

    2. YANC - Utility

  • Comic: A bad networking researcher...

    I always wanted to do comics, so here's a hello world:

    1. YANC - A bad networking researcher...

  • Students aren't cattle, they're humans

    Recently, a teacher at my alma mater turned barber and forcibly cropped the hair of over 90 students who didn't follow the school's code of conduct for haircuts (we didn't even know there was one during our days). Obviously, the students, parents and locals weren't amused by this barb-er-ic act. Neither were those of us who are proud of being former students of that school.

    Indian educational institutions have always been rather conservative in their organisation. There is all too often a strict hierarchy visible in the way things work. Teachers have a commanding authority over students, and it's common for students to stand up and say "good morning/afternoon/whatever" in unison when the former enters a classroom. Failure to do so is often seen as an act of disrespect. In many schools, even at a high school level, you find that students are expected to form and walk only in a line when moving from one classroom to another. I've seen institutions with really silly dress codes, like "boys should only wear shirts/t-shirts that *have a collar*". There are many colleges where cell phones are banned on campus (and many that go too far to implement their policy). And there are also colleges where guys aren't allowed to talk to girls.

    There is an overflow of rules, and unnecessary requirements on conformance. I've had a lecturer yell at me for 15 minutes (out of a 40 minute lecture), ask me to never enter class again, and walk out of class herself in anger simply because I didn't "write down" the last few steps of a solution to a problem she handed out in class, which I managed to solve in my head to arrive at the answer.

    All the above is absolutely disgusting and is an antithesis to what is supposed to be education. We put a bunch of students into a classroom, expect all of them to conform to a strict set of rules, and punish the ones who don't with expulsion. Ultimately, all these students end up having to take charge of society in some way or the other, and we basically leave our country in the hands of those who abide by silly dogmas, are well trained in the art of superficial respect, can't think laterally, are used to hierarchies, and with regard to some of the specific cases I mentioned above, are incapable of working with the opposite sex.

    I wonder what the net gain is from putting so much effort into running a system like this?

    Our future leaders should be capable of making decisions that affect others positively. We need students to be well trained in networking with others, exchanging ideas, and communicating effectively. We need them to be open minded, embrace differences, and adapt to the pace at which the world around us is evolving. How on earth is all that supposed to happen if *this* is their education?

    Furthermore, where do teachers get the time and energy to enforce such rules when they have so many important things to attend to?

    Teachers have the responsibility of being a role model and not that of a dictator. All those teachers who'd inspired me over my life _strictly_ fall into the former category (from junior school, through high school, and upto where I am now). They were the ones who invested enough effort into figuring out how best to convey their ideas to their students, learned how to tap into our creative potential, and at the same time, stayed up to date with whatever it is that they were supposed to teach. They also served as moral and social instructors not through an iron fist, but through inspiration. They gave us enough room to develop, spared us the fury when we made mistakes and instead, taught us how to learn from them. They made us go "There is so much I can learn from that person!" as opposed to "That person will screw me over if I don't do this".

    Sure, perfect pedagogy isn't easy, but chaining students to a gratuitous set of rules is definitely not the answer. They are humans after all.