GSOC2020PatchRequirement: Difference between revisions

From Nsnam
Jump to navigation Jump to search
(Created page with "As part of their Google Summer of Code 2020 applications to ns-3, we require that students produce at least a small amount of code for ns-3. This will allow us to gauge your a...")
 
(patch requirement)
Line 1: Line 1:
{{TOC}}
As part of their Google Summer of Code 2020 applications to ns-3, we require that students produce at least a small amount of code for ns-3. This will allow us to gauge your ability to dive into source code, understand it, make a modification, and proceed to build and verify if your modification works.
As part of their Google Summer of Code 2020 applications to ns-3, we require that students produce at least a small amount of code for ns-3. This will allow us to gauge your ability to dive into source code, understand it, make a modification, and proceed to build and verify if your modification works.


Line 28: Line 30:
=== Objective ===
=== Objective ===


In ns-3, a preferred way to split module dependencies is to use a callback. For instance, a hypothetical L3 protocol can directly call methods on a NetDevice (e.g., Send()) to perform operations. But when a NetDevice has to call the above layer, the callback mechanism comes into play: since it is not possible for a NetDevice to know what future network layer will be placed on top of it, it must rely, in general, on callbacks. This kind of connection is prevalent inside a Node: if you take a look at node.cc, you will see that forwarding packets from NetDevice to a L3 layer is done through callbacks. Any L3 protocol has to register its own handler that will be called if the protocol number matches the number on the packet.
Recently, an ns-3 maintainer asked about [https://mailman.isi.edu/pipermail/ns-developers/2020-February/014992.html how to create an attribute value for a const Object pointer]. In order to work with the [https://www.nsnam.org/docs/manual/html/attributes.html#id1 ns-3 attribute system], ns-3 provides so-called 'value' classes that wrap an underlying C++ type. Sometimes, an author will want to expose a smart pointer to [https://www.nsnam.org/docs/manual/html/object-model.html an ns-3 Object] through the attribute system. The ns-3 [https://www.nsnam.org/docs/doxygen/classns3_1_1_pointer_value.html PointerValue] class does this.


The objective of this patch is to add a new, simple, basic, L3 protocol, with the protocol number 99. The new protocol implementation should be registered on the node, and it should be able to send a ping packet, and receive a response.  That is, it does not need to do routing or introduce any new addressing scheme; it merely needs to be able to send a 'ping-like' packet to the NetDevice, and receive a packet (destined to protocol 99) from a NetDevice.  A simple print on the screen at the send and receive moment is enough to show a working implementation.
For an example of how this can be used, study the code found in the attribute test suite; specifically:


=== What to submit ===
* https://gitlab.com/nsnam/ns-3-dev/-/blob/master/src/core/test/attribute-test-suite.cc#L206
and
* https://gitlab.com/nsnam/ns-3-dev/-/blob/master/src/core/test/attribute-test-suite.cc#L1257
 
For a practical example (there are several in the ns-3 codebase):
 
* https://gitlab.com/nsnam/ns-3-dev/-/blob/master/src/lte/model/lte-enb-phy.cc#L232
 
The implementation of PointerValue is found here:


* A patch to ns-3-dev that accomplishes the objectives. In your GSoC application, point us to a publicly available URL where you've hosted the patch (such as a "gist" on github.com, or a snippet on gitlab.com, for instance).  See also some guidelines [http://www.nsnam.org/developers/contributing-code/submit/ here] about formatting patches for review.  If you need help with this step, contact the ns-3 Org Admin (Tom Henderson) for advice.
* https://gitlab.com/nsnam/ns-3-dev/-/blob/master/src/core/model/pointer.h
* https://gitlab.com/nsnam/ns-3-dev/-/blob/master/src/core/model/pointer.cc


'''Note:''' Keep your solution private by pasting the link in your application to Google, not posting it on the mailing list.
What Natale is asking for is a new class that will allow pointing to a const object.  We can call this 'PointerToConstValue'.  In the LTE case, it would look like this:


== Minimum requirement patch (for ns-3 AppStore applicants)==
```
    .AddAttribute ("DlSpectrumPhy",
                  "The downlink LteSpectrumPhy associated to this LtePhy",
                  TypeId::ATTR_GET,
                  PointerToConstValue (),
                  MakePointerToConstAccessor (&LteEnbPhy::GetDlSpectrumPhy),
                  MakePointerToConstChecker <const LteSpectrumPhy> ())
```


=== Setting up the repository ===
We would like a patch that does the following:
* Download and setup the AppStore [https://github.com/abhijithanilkumar/ns-3-AppStore repository] locally.
* Follow the guidelines in the GitHub wiki for setting up the repo.


=== Objective ===
# implement pointer-to-const.h and pointer-to-const.cc in the src/core directory, following very closely the pointer.h and pointer.cc approach
The project aims at improving the functionality of the AppStore and linking Bake with it. The App Store is built on Django and stores the details of ns-3 modules in the database. The configuration details of a module are stored in an XML file called bakefile.xml, which will be used by Bake to build the module.  
# extend src/core/test/attribute-test-suite.cc to provide test code that tries out the PointerToConstValue class.


The objective of this patch is to create a new application in the AppStore DB, by parsing details from the bakefile. To do this, a new bakefile should be created for the module (https://bitbucket.org/tomhend/sift-ns3/), then create a python script that can be used to parse the bakefile and add an object to the DB. The script should take the bakefile as input and should automatically create a new App in the DB when run from the Django shell.
The patch should contain the modification to src/core/wscript to include the two new files, the two new files themselves, and a patch to src/core/test-attribute-test-suite.cc.


=== What to submit ===
=== What to submit ===


* A patch to ns-3-AppStore that accomplishes the objectives. In your GSoC application, point us to a publicly available URL where you've hosted the patch (such as a "gist" on github.com for instance). If you need any help with this, please contact the mentors responsible for this project.
A patch to ns-3-dev that accomplishes the objectives. In your GSoC application, point us to a publicly available URL where you've hosted the patch (such as a "gist" on github.com, or a snippet on gitlab.com, for instance). See also some guidelines [http://www.nsnam.org/developers/contributing-code/submit/ here] about formatting patches for review.  If you need help with this step, contact the ns-3 Org Admin (Tom Henderson) for advice.
 
'''Note:''' Keep your solution private by pasting the link in your application to Google, not posting it on the mailing list.
 
'''Note:''' You can share your patch with a GSoC mentor prior to the deadline, for initial feedback, if you have any doubt about it.

Revision as of 17:01, 6 March 2020

Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects

HOWTOs - Installation - Troubleshooting - User FAQ - Samples - Models - Education - Contributed Code - Papers

As part of their Google Summer of Code 2020 applications to ns-3, we require that students produce at least a small amount of code for ns-3. This will allow us to gauge your ability to dive into source code, understand it, make a modification, and proceed to build and verify if your modification works.

Applicants who have already contributed a patch to ns-3 should check with the org admins whether the patch requirement can be satisfied by this prior code. If you have code posted somewhere else (GitHub, for example, or a class project page) that you feel is a good indicator of your ability to write ns-3 code, please point us to the URL.

For everyone else, there are two choices:

  1. Fix one of our open technical issues by submitting a merge request in the usual way. Note: if there is already a fix pending for a given issue, one cannot duplicate the effort and submit a second request.
  2. Complete the minimum patch requirement project below, and submit the patch not as a merge request (where others can see it) but privately as a diff or patchfile, or GitLab.com snippet).

Minimum requirement patch

Setting up the environment

Perform the following steps (you may want to review our Installation page):

  • Download the ns-3-dev repository, or fork it or clone it from Git:
 $: git clone https://gitlab.com/nsnam/ns-3-dev.git
 $: cd ns-3-dev
 $: git checkout -b patch-requirement origin/master
  • Verify if you can build ns-3 and run the test suite:
 $: ./waf configure --disable-python --enable-examples --enable-tests
 $: ./waf build
 $: ./test.py

Objective

Recently, an ns-3 maintainer asked about how to create an attribute value for a const Object pointer. In order to work with the ns-3 attribute system, ns-3 provides so-called 'value' classes that wrap an underlying C++ type. Sometimes, an author will want to expose a smart pointer to an ns-3 Object through the attribute system. The ns-3 PointerValue class does this.

For an example of how this can be used, study the code found in the attribute test suite; specifically:

and

For a practical example (there are several in the ns-3 codebase):

The implementation of PointerValue is found here:

What Natale is asking for is a new class that will allow pointing to a const object. We can call this 'PointerToConstValue'. In the LTE case, it would look like this:

```

   .AddAttribute ("DlSpectrumPhy",
                  "The downlink LteSpectrumPhy associated to this LtePhy",
                  TypeId::ATTR_GET,
                  PointerToConstValue (),
                  MakePointerToConstAccessor (&LteEnbPhy::GetDlSpectrumPhy),
                  MakePointerToConstChecker <const LteSpectrumPhy> ())

```

We would like a patch that does the following:

  1. implement pointer-to-const.h and pointer-to-const.cc in the src/core directory, following very closely the pointer.h and pointer.cc approach
  2. extend src/core/test/attribute-test-suite.cc to provide test code that tries out the PointerToConstValue class.

The patch should contain the modification to src/core/wscript to include the two new files, the two new files themselves, and a patch to src/core/test-attribute-test-suite.cc.

What to submit

A patch to ns-3-dev that accomplishes the objectives. In your GSoC application, point us to a publicly available URL where you've hosted the patch (such as a "gist" on github.com, or a snippet on gitlab.com, for instance). See also some guidelines here about formatting patches for review. If you need help with this step, contact the ns-3 Org Admin (Tom Henderson) for advice.

Note: Keep your solution private by pasting the link in your application to Google, not posting it on the mailing list.

Note: You can share your patch with a GSoC mentor prior to the deadline, for initial feedback, if you have any doubt about it.