| 1 | Go back --> [wiki:Tutorial Tutorials] |
| 2 | [[TOC(heading=Tutorial TOC, Tutorial, depth=2)]] |
| 3 | |
| 4 | = How to use execute an Application via a Prototype = |
| 5 | |
| 6 | === Prerequisite === |
| 7 | |
| 8 | This feature is only available in NodeHandler v4 and above. |
| 9 | |
| 10 | Before going through this tutorial, you should know the basics of writing and running an experiment script (see [wiki:Tutorial/HelloWorld here] and [wiki:Tutorial/HowtoWriteScripts here]). |
| 11 | |
| 12 | You should also have installed a disk image with Node Agent v4 on the nodes of the testbed you are using (e.g. "baseline.ndz"). See [wiki:Tutorial/HowToImage "How to install a disk image"]. |
| 13 | |
| 14 | === Goal === |
| 15 | |
| 16 | In this tutorial, you will learn a method to execute an application using a prototype. This method is complementary to the two previous methods presented [wiki:Tutorial/HowToCommand here] and [wiki:Tutorial/HowToApplication here]. It is the recommended method if you have an application, which you would like to use in the long term with different (possibly dynamic) parameters. |
| 17 | |
| 18 | For example, this would be the case of a traffic generator that can generate multiple type of traffic depending on the parameters given by the experiment script. Using a prototype to execute this generator within your experiment allows you to: |
| 19 | * run the application with different initial parameters without having to re-write any modified "wrapper" code, |
| 20 | * change any eventual dynamic parameters during the application execution (e.g. change the rate of the generated traffic after 60sec) |
| 21 | |
| 22 | This method involves three steps: |
| 23 | * the definition of a "wrapper" around your original application. This step would correspond to the creation of a generic Node Handler-compatible version of your application. |
| 24 | * the definition of a so-called prototype. This step would correspond to the creation of a specific type or instance of your application. |
| 25 | * the definition of an experiment script, which would use your application via its prototype. |
| 26 | |
| 27 | In the context of the above traffic generator example: |
| 28 | * first step: you create an Node Handler-compatible application definition, which is a "wrapper" around your original application. This application definition will provide an interface to all the available parameters of your original application. |
| 29 | * second step: you specialize the previous application definition in a prototype definition. For example you decide to define an instance of your application (i.e. a prototype) which will only generate a given traffic model (e.g. pareto) but which still accepts different parameter (e.g. packet size, rate, etc...). You may also decide to define a second prototype, which will generate another type of traffic. |
| 30 | * third step: you define an experiment which will use this specialized application. |
| 31 | |
| 32 | The remainder of this tutorial describes these three steps and the execution of the related experiment script |
| 33 | |
| 34 | === Step 1: Application Definition === |
| 35 | |
| 36 | === Step 2: Prototype Definition === |
| 37 | |
| 38 | === Step 3: The Experiment Script === |
| 39 | |
| 40 | This experiment is given in the attached script [attachment:a a]. |
| 41 | |
| 42 | This file contains extensive comments that should help you understand the different steps involved in running an application on the nodes of a testbed. |
| 43 | |
| 44 | To run this example script, use the following command: |
| 45 | |
| 46 | {{{ |
| 47 | orbit exec tut_app_1 |
| 48 | }}} |
| 49 | |
| 50 | === The Results === |
| 51 | |
| 52 | The experiment screen output should then look like [attachment:a this]. And the experiment log file should look like [attachment:a this]. |
| 53 | |
| 54 | === More... === |