1 | | = [wiki:GENIExperimenter/Tutorials/jFed/GettingStarted_PartII_ccn/Procedure Understanding the AM API using Named Data Networking] = |
| 1 | = [../Setup Understanding the AM API using Named Data Networking] = |
| 2 | |
| 3 | {{{ |
| 4 | #!html |
| 5 | |
| 6 | <div style="text-align:center; width:495px; margin-left:auto; margin-right:auto;"> |
| 7 | <img id="Image-Maps_5201305222028436" src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/Execute.jpg?format=raw" usemap="#Image-Maps_5201305222028436" border="0" width="495" height="138" alt="" /> |
| 8 | <map id="_Image-Maps_5201305222028436" name="Image-Maps_5201305222028436"> |
| 9 | <area shape="rect" coords="18,18,135,110" href="./Setup" alt="" title="" /> |
| 10 | <area shape="rect" coords="180,18,297,111" href="./Execute" alt="" title="" /> |
| 11 | <area shape="rect" coords="344,17,460,110" href="./Finish" alt="" title="" /> |
| 12 | <area shape="rect" coords="493,136,495,138" href="http://www.image-maps.com/index.php?aff=mapped_users_5201305222028436" alt="Image Map" title="Image Map" /> |
| 13 | </map> |
| 14 | <!-- Image map text links - End - --> |
| 15 | |
| 16 | </div> |
| 17 | }}} |
| 18 | |
| 19 | == 4 Wait for resources to be ready == |
| 20 | |
| 21 | You can tell whether your nodes are ''ready'' by using a script built on `omni` called `readyToLogin`. |
| 22 | |
| 23 | {{{ |
| 24 | #!html |
| 25 | <ol type='a'> |
| 26 | <li> |
| 27 | Please use the command: |
| 28 | <pre> |
| 29 | readyToLogin -a AM_NICKNAME SLICE_NAME |
| 30 | <pre> |
| 31 | where (as before) <tt>AM_NICKNAME</tt> and <tt> SLICE_NAME </tt> are your aggregate |
| 32 | manager nickname and your slice name. |
| 33 | </li> |
| 34 | <li>If it reports that the sliver is not yet ready (for example, it might say that the status is "changing"), then wait a minute |
| 35 | or two and try again. Once everything is complete, <tt>readyToLogin</tt> |
| 36 | will give output that should look something like this: |
| 37 | <pre> |
| 38 | ... |
| 39 | rschr's geni_status is: ready (am_status:ready) |
| 40 | User example logs in to rschr using: |
| 41 | ssh -p 32768 -i /Users/example/.ssh/geni_key_portal example@pc1.utah.geniracks.net |
| 42 | User example logs in to collar using: |
| 43 | ssh -p 32769 -i /Users/example/.ssh/geni_key_portal example@pc1.utah.geniracks.net |
| 44 | ... |
| 45 | </pre> |
| 46 | |
| 47 | </li> |
| 48 | </ol> |
| 49 | }}} |
| 50 | |
| 51 | == 5 Trying out the NDN application == |
| 52 | |
| 53 | In this experiment, you will be able to see the NDN in-network caching in action. Our experiment consists of the following nodes: |
| 54 | * A data source node, called {{{Custodian}}} that holds data in the namespace /nytimes |
| 55 | * A node, called {{{Internet Router}}} that forwards {{{Interest}}} and {{{Data}}} packets to and from the {{{Custodian}}}. |
| 56 | * A node, called {{{Campus Router}}} that forwards {{{Interest}}} and {{{Data}}} packets to and from the university nodes. |
| 57 | * A principal investigator node, called {{{PI}}} and a experimenter node, called {{{Experimenter}}} that will send {{{Interest}}} requests to the {{{Custodian}}} via UDP tunnels. |
3 | | {{{ |
4 | | #!html |
| 59 | Download the scripts and Python codes to your host machine and extract it. |
| 60 | * [http://192.1.242.151/files/ndn-tutorial.gz ndn-tutorial.gz] |
| 61 | |
| 62 | Or alternatively, |
| 63 | {{{ |
| 64 | $ wget http://192.1.242.151/files/ndn-tutorial.gz |
| 65 | $ tar -xvf ndn-tutorial.gz |
| 66 | }}} |
| 67 | |
| 68 | In the '''ndn-tutorial-config.sh''' configuration file, edit the fields according to your GENI username, SSH key, GENI Aggregate name, pc and port numbers. [[br]] |
| 69 | Keep the quotes format unchanged, otherwise the script may not run. |
| 70 | |
| 71 | Once the topology is up, run {{{copy-scripts.sh}}}, this will automatically transfer the necessary files to the nodes in our topology. |
| 72 | {{{ |
| 73 | $ ./copy-scripts.sh |
| 74 | }}} |
6 | | <div style="text-align:center; width:495px; margin-left:auto; margin-right:auto;"> |
7 | | <img id="Image-Maps_5201305222028436" src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/Execute.jpg?format=raw" usemap="#Image-Maps_5201305222028436" border="0" width="495" height="138" alt="" /> |
8 | | <map id="_Image-Maps_5201305222028436" name="Image-Maps_5201305222028436"> |
9 | | <area shape="rect" coords="18,18,135,110" href="./Setup" alt="" title="" /> |
10 | | <area shape="rect" coords="180,18,297,111" href="./Execute" alt="" title="" /> |
11 | | <area shape="rect" coords="344,17,460,110" href="./Finish" alt="" title="" /> |
12 | | <area shape="rect" coords="493,136,495,138" href="http://www.image-maps.com/index.php?aff=mapped_users_5201305222028436" alt="Image Map" title="Image Map" /> |
13 | | </map> |
14 | | <!-- Image map text links - End - --> |
| 76 | Login into the node {{{Custodian}}} and re-start the NDN Forwarding Daemon (NFD). This will make sure the content store is refreshed and the routes are cleared. |
| 77 | {{{ |
| 78 | $ nfd-stop |
| 79 | $ nfd-start |
| 80 | }}} |
23 | | {{{ |
24 | | #!html |
25 | | <ol type='a'> |
26 | | <li> |
27 | | Please use the command: |
28 | | <pre> |
29 | | readyToLogin -a AM_NICKNAME SLICENAME |
30 | | <pre> |
31 | | where (as before) <tt>AM_NICKNAME</tt> and <tt>SLICENAME</tt> are your aggregate |
32 | | manager nickname and your slice name (both found on your worksheet). |
33 | | </li> |
34 | | <li>If it reports that the sliver is not yet ready (for example, it might say that the status is "changing"), then wait a minute |
35 | | or two and try again. Once everything is complete, <tt>readyToLogin</tt> |
36 | | will give output that should look something like this: |
37 | | <pre> |
38 | | ... |
39 | | rschr's geni_status is: ready (am_status:ready) |
40 | | User example logs in to rschr using: |
41 | | ssh -p 32768 -i /Users/example/.ssh/geni_key_portal example@pc1.utah.geniracks.net |
42 | | User example logs in to collar using: |
43 | | ssh -p 32769 -i /Users/example/.ssh/geni_key_portal example@pc1.utah.geniracks.net |
44 | | ... |
45 | | </pre> |
| 107 | === 5.2 Run the NDN application on the entire topology === |
| 108 | In this section, we are going to start the NFD and register the forwarding faces on the remaining nodes. We have automated these tasks for the {{{Campus-Router}}}, {{{Internet-Router}}}, and {{{PI}}} nodes using a script. On your host machine, do the following: |
| 109 | {{{ |
| 110 | $ ./setup-app.sh |
| 111 | }}} |
51 | | == 5 Trying out the CCN protocol == |
| 119 | SSH to the {{{Experimenter}}} node, register the namespace, and start the consumer application |
| 120 | {{{ |
| 121 | $ nfdc register / udp4://10.0.0.1 |
| 122 | $ python consumer.py -u /nytimes/science |
| 123 | }}} |
| 124 | This time the {{{Interest}}} request travels the entire topology, leaving breadcrumbs. The {{{Data}}} packet follows the breadcrumbs back to the {{{consumer}}}, leaving cached versions of the content. This is call in-network caching and it is one of the most important features in {{{Information Centric Networking (ICN)}}} |
| 125 | You can check this phenomenon by running the same consumer application in the {{{PI}}} node. |
| 126 | SSH to the {{{PI}}} node and start the consumer application |
| 127 | {{{ |
| 128 | $ python consumer.py -u /nytimes/science |
| 129 | }}} |
| 130 | This time your {{{PI}}} node gets the content back, but nothing happens on the {{{Custodian}}} because the requested content is cached in the {{{Campus Router}}} node. |
| 131 | You can repeat the experiment with different namespaces |
| 132 | {{{ |
| 133 | $ python consumer.py -u /nytimes/math |
| 134 | }}} |
| 135 | This time you see that the {{{Interest}}} request is served by the {{{Custodian}}}. |
53 | | The `install` and `execute` services requested in our RSpec have |
54 | | already started, and nodes in our experiment should be running the CCN (Content Centric Networking) protocol. Our experiment consists of: |
55 | | * A data source (node {{{dsrc1}}} that holds precipitation data from the US National Oceanic and Atmospheric Administration (NOAA). |
56 | | * A researcher node {{{rsrchr}}} that gets data from the data source |
57 | | * A collaborator node {{{collab}}} that gets data from the researcher |
58 | | |
59 | | Key features of the CCN protocol include: |
60 | | * Data is accessed by name. In our case we use a program called client to get precipitation data by date range (e.g. precipitation between 1901/01/01 and 1901/01/02). |
61 | | * All nodes cache data for a certain period of time. When a node receives a request for data, it checks its local cache. If the data is in it's cache, it returns that data. Otherwise, it forwards it on to its neighbor. |
62 | | |
63 | | We verify this caching behavior by: |
64 | | * Logging into the researcher node and using the client program to get precipitation data for a certain date range. The client displays how long it took to get the data. |
65 | | * Retrieving the same data again and noting how we get it much faster since it comes out of a cache. |
66 | | * Requesting data for different date range and see how long it took to retrieve the data. |
67 | | * Requesting the data again and noting it is retrieved much faster. |
68 | | |
69 | | If you have time, you can repeat the above steps on the collaborator node. |
70 | | |
71 | | Note: There is an [wiki:GENIExperimenter/Tutorials/GettingStarted_PartII_ccn/Procedure/Execute/GEMINI optional part] to this exercise that uses the GENI Desktop to visualize traffic on the links in our network. There you can visualize which data requests went all the way to the data source (node {{{dsrc1}}}) and which data requests were fulfilled from a node's cache. |
72 | | |
73 | | === 5.1 Run the CCN application === |
74 | | 1. Log into the node {{{rsrchr}}} using the {{{ssh}}} command returned by {{{readyToLogin}}}. |
75 | | 2. Once you are logged in, ask for precipitation data from 1 Jan 1902 to 2 Jan 1902: |
76 | | {{{ |
77 | | $ /opt/ccnx-atmos/client.py |
78 | | Start Date in YYYY/MM/DD? 1902/01/01 |
79 | | End Date in YYYY/MM/DD? 1902/01/02 |
80 | | }}} |
81 | | 3. You should see output that looks like: |
82 | | {{{ |
83 | | Asking for /ndn/colostate.edu/netsec/pr_1902/01/01/00, Saving to pr_1902_01_01.tmp.nc |
84 | | Time for pr_1902_01_01.tmp.nc 1.09802699089= |
85 | | Asking for /ndn/colostate.edu/netsec/pr_1902/01/02/00, Saving to pr_1902_01_02.tmp.nc |
86 | | Time for pr_1902_01_02.tmp.nc 4.65998315811= |
87 | | Joining files.. |
88 | | Concat + write time 0.0735998153687 |
89 | | Wrote to pr_1902_1_1_1902_1_2.nc |
90 | | }}} |
91 | | Note that it took about 1.1 and 4.7 seconds respectively to retrieve data for Jan 1 and Jan 2 |
92 | | 4. Run the client again and request the same data. This time your output should look like: |
93 | | {{{ |
94 | | Asking for /ndn/colostate.edu/netsec/pr_1902/01/01/00, Saving to pr_1902_01_01.tmp.nc |
95 | | Time for pr_1902_01_01.tmp.nc 0.0423700809479= |
96 | | Asking for /ndn/colostate.edu/netsec/pr_1902/01/02/00, Saving to pr_1902_01_02.tmp.nc |
97 | | Time for pr_1902_01_02.tmp.nc 0.0388598442078= |
98 | | Joining files.. |
99 | | Concat + write time 0.0237510204315 |
100 | | Wrote to pr_1902_1_1_1902_1_2.nc |
101 | | }}} |
102 | | Notice how much faster the data was retrieved this time. |
103 | | 5. If time permits, log into the collaborator node {{{collab}}} and run queries from there. (Pick dates in 1901 or 1902.) Notice different data retrieval times depending on whether the data came from the datasource, the cache at {{{rsrchr}}}, or the local cache. |
| 137 | === 5.3 (Optional) Visualize experiment data flows === |
| 138 | To use the GENI Desktop to visualize the data flows in your network, continue with the instructions [wiki:GENIExperimenter/Tutorials/jacks/GettingStarted_PartII_ndn/Procedure/Execute/GEMINI here]. |