CNAui-CNAd communication example » Historial » Versió 2
Roger Pueyo Centelles, 02-06-2014 17:46
1 | 1 | Roger Pueyo Centelles | h1. NCui-NCd communication example |
---|---|---|---|
2 | |||
3 | 2 | Roger Pueyo Centelles | This page shows an example of the communication process from the [[NCui|Network Characterization user interface]] (NCui) to the [[NCd|Network Characterization daemon]] (NCd) to retrieve information about the network to plot in on a graph. |
4 | 1 | Roger Pueyo Centelles | |
5 | h2. Description |
||
6 | |||
7 | 2 | Roger Pueyo Centelles | The NCui only takes care of the interaction with the end user (displaying the network, nodes and links information on the browser and processing interaction requests), but does not fetch such data by itself. To retrieve these information, it relies on the NCd, that is able to search for and collect them. |
8 | 1 | Roger Pueyo Centelles | |
9 | h2. Example network |
||
10 | |||
11 | 2 | Roger Pueyo Centelles | To illustrate the NCui-NCd communication example, the following network topology is used: |
12 | 1 | Roger Pueyo Centelles | |
13 | !={width:600px}Example_network.png! |
||
14 | See the full-size image "here":http://dev.qmp.cat/attachments/download/148/Example_network.png |
||
15 | |||
16 | The node on the top left corner (labeled node016) is used as the local node, where the plot is centered in the default view. |
||
17 | |||
18 | h2. Communication example |
||
19 | |||
20 | # *Get local node id* |
||
21 | |
||
22 | 2 | Roger Pueyo Centelles | The NCd needs to know the local node's id (a unique string to identify it) to later ask for more information regarding this node. By using this id, all the requests and responses, either about local or remote nodes, follow the same structure. |
23 | 1 | Roger Pueyo Centelles | |
24 | CNAui request: |
||
25 | <pre>cnad.node.id { "node" : "local" }</pre> |
||
26 | CNAd response: |
||
27 | <pre>{"id" : "node016"}</pre> |
||
28 | |
||
29 | # *Get local node's list of neighbours (1 hop)* |
||
30 | |
||
31 | To start retrieving the network graph, the CNAui needs to know which are the local node's neighbours. |
||
32 | |
||
33 | CNAui request: |
||
34 | <pre>cnad.node.neighbours { "node" : "node016" }</pre> |
||
35 | CNAd response: |
||
36 | <pre>{ "nodes" : [ "node011", "node400" ] }</pre> |
||
37 | At this point, the CNAui can start plotting, though uncomplete, the network graph. |
||
38 | |
||
39 | |
||
40 | # *Get local and neighbours' node names* |
||
41 | |
||
42 | The graph information is progressively completed, now by adding the names of the plotted nodes. |
||
43 | |
||
44 | CNAui request: |
||
45 | <pre>cnad.node.name { "nodes" : [ "node016", "node011", "node400" ] }</pre> |
||
46 | CNAd response: |
||
47 | <pre>{ "names" : [ "FT-NarrowStreet16-NSLM5", "FT-NarrowStreet11-RSM5", "FT-WideStreet400-NSM5" }</pre> |
||
48 | The nodes on the plot now are shown with their names instead of their ids. |
||
49 | |
||
50 | |
||
51 | # *Get the neighbour's list of neighbours (2 hops)* |
||
52 | |
||
53 | The default network graph plot shows the local node and the nodes at a distance of up to two physical hops. To represent them, the list of the neighbours' neighbours is needed. |
||
54 | |
||
55 | CNAui request: |
||
56 | <pre>cnad.node.neighbours { "nodes" : [ "node011", "node400" ] }</pre> |
||
57 | CNAd response: |
||
58 | <pre>{ "node011": [ "node094", "node400" ], "node400": [ "node011", "node094", "node017" ] }</pre> |
||
59 | With this, all the nodes that need to be plotted on the default view are known. Additionally, any links between the local node's neighbours are known, are known too.. |
||
60 | |
||
61 | |
||
62 | # *Get the neighbours' neighbours' (2 hops) node names* |
||
63 | |
||
64 | The remaining node names are added. |
||
65 | |
||
66 | CNAui request: |
||
67 | <pre>cnad.node.name { "nodes" : [ "node017", "node094"] }</pre> |
||
68 | CNAd response: |
||
69 | <pre>{ "names" : [ "FC-RiverStreet17-NSM5", "FT-FarAvenue94-NSLM5" }</pre> |
||
70 | The plot is updated with the nodes' names. |
||
71 | |
||
72 | |
||
73 | # *Get the neighbours' neighbours' neighbours (3 hops)* |
||
74 | |
||
75 | To determine if there are physical links between nodes at two hops distance from the local node, the following request is needed: |
||
76 | |
||
77 | CNAui request: |
||
78 | <pre>cnad.node.neighbours { "nodes" : [ "node017", "node094"] }</pre> |
||
79 | CNAd response: |
||
80 | <pre>{ "node011": [ "node104", "node400" ], "node094": [ "node011", "node400", "node017" ] }</pre> |
||
81 | In this case, there are no physical links between nodes at 2 hops from the local node, so the plot needs no updates. |
||
82 | |
||
83 | |
||
84 | # *Get the links information* |
||
85 | |
||
86 | [ To be added ] |
||
87 | |
||
88 | CNAui request: |
||
89 | <pre>[ To be added ]</pre> |
||
90 | CNAd response: |
||
91 | <pre>[ To be added ]</pre> |
||
92 | [ To be added ] |
||
93 | |
||
94 | |