Changes between Initial Version and Version 1 of JoeSandbox/PingPongExample/Execute


Ignore:
Timestamp:
08/13/14 18:17:45 (10 years ago)
Author:
zwang@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JoeSandbox/PingPongExample/Execute

    v1 v1  
     1= [wiki:JoeSandbox/PingPongExample Ping-Pong Example] =
     2{{{
     3#!html
     4<table border="0">
     5   
     6      <tr>
     7         <td>
     8         <a href="http://groups.geni.net/geni/wiki/JoeSandbox/PingPongExample/DesignSetup"> <img border="0" src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/design.2.png?format=raw" alt="Hello GENI index"  height="90" title="Hello GENI Web server" />  </a>
     9       </td>
     10       <td>
     11         <a href="http://groups.geni.net/geni/wiki/JoeSandbox/PingPongExample/Execute"> <img border="0" src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/execute_on.2.png?format=raw" alt="Hello GENI index"  height="90" title="Hello GENI Web server" />  </a>
     12       </td>
     13       <td>
     14         <a href="http://groups.geni.net/geni/wiki/JoeSandbox/PingPongExample/Finish"> <img border="0" src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/finish.2.png?format=raw" alt="Hello GENI index"  height="90" title="Hello GENI Web server" />  </a>
     15       </td>
     16     </tr>
     17 </table>
     18}}}
     19
     20= STEPS FOR EXECUTING EXAMPLE =
     21
     22In this section, we will see how communication is carried out through LGI middleware and how regulation is imposed on it. LGI governs the communication by an explicitly specified policy, called the "interaction law", or simply the '''law'''. For the law that allows arbitrary messages, please see [http://www.moses.rutgers.edu/examples/simple/simple.java1 here], and for the law that specifies the communication protocol, please see [http://www.moses.rutgers.edu/examples/pingpong/Pingpong.java1 here]. You can compare them to have a better understanding while doing the experiment.
     23
     24There are two '''actors''' need to talk to each other. In order to enforce the communication protocol, we associate each of them with a LGI '''controller'''. The actors cannot send message to each other unless the message is sent through their controllers. According to the law, the controllers will decide whether a message can be sent or received based on the actor's interaction history.
     25
     26== 1 Basic communication ==
     27=== 1.1 Start Controllers ===
     28a. Log into C1 (the hostname for Controller 1) and C2 in separate windows.
     29
     30b. On C1, start the controller using this command:
     31{{{
     32C1:~$ java moses.Controller
     33}}}
     34
     35You should see output like this:
     36{{{
     37Controller starts (use -help option for help)
     38C1:9000 is sandboxed
     39Location of the configuration files is:
     40/tmp/moses/controllerConf
     41}}}
     42
     43c. On C2, start the controller using the same command.
     44
     45=== 1.2 Start Actors ===
     46a. Log into A1 (the hostname for Actor 1) and A2 in separate windows.
     47
     48b. On A1, start the actor using the following commands:
     49{{{
     50A1:~$ cd /tmp/
     51A1:/tmp$ java SomeAgent C1 9000 simple.java1 a1
     52}}}
     53
     54This indicates you are using actor program '''!SomeAgent''' to communicate with a controller, whose hostname is '''C1''' and port number is '''9000'''. The communication is under the protocol written in LGI law file '''simple.java1''' and the actor is using name '''a1'''.
     55
     56You should see output like this:
     57{{{
     58> java SomeAgent contrname contrport lawfile agname
     59> java SomeAgent contrname contrport lawfile agname CApub
     60> java SomeAgent contrname contrport lawfile agname CApub Mycert Myprivkey
     61-1
     62Type exit to quit
     63}}}
     64
     65c. Similarly on A2, start the actor using following commands:
     66{{{
     67A2:~$ cd /tmp/
     68A2:/tmp$ java SomeAgent C2 9000 simple.java1 a2
     69}}}
     70
     71=== 1.3 Communication ===
     72You can now send a message using command:
     73{{{
     74send(msg,dest)
     75}}}
     76
     77where ''msg'' is the content of the message you want to send and ''dest'' is the LGI address of the destination. For example, in our case, A2's address is a2@C2, where a2 is the name you chose when connecting to the controller and C2 is the hostname of its controller.
     78
     79a. On A1, send a message to A2. For example:
     80{{{
     81send(hello,a2@C2)
     82}}}
     83
     84b. On A2, you should see:
     85{{{
     86Received: hello
     87}}}
     88
     89You can continue sending messages with each other. Any message should be sent and delivered.
     90
     91== 2 Regulated Communication ==
     92
     93Now we want to impose the following protocol over the community:
     94
     95We allow the exchange of two types of messages: '''ping''' messages, which might represent such things as a question, or a request; and '''pong''' messages, used as a reply to a previously received ping messages. The ping-pong policy regulates the flow of messages between any two actors a1, a2 as follows: a1 cannot send any pong message to a2 unless a2 has previously sent a ping message to a1; and a1 cannot send a second ping message to a2 unless a2 answers with a pong message to a1 following the initial ping.
     96
     97We call a ping message sent by a1(a2) to a2(a1) '''unresolved''', if a1(a2) did not receive a corresponding pong to it.
     98
     99=== 2.1 Start Actors ===
     100a. CTRL-C in A1 and A2 windows to stop the agents. Use command below to adopt the new law '''Pingpong.java1'''.
     101{{{
     102A1:/tmp$ java SomeAgent C1 9000 Pingpong.java1 a1
     103}}}
     104
     105b. Similarly, start Actor 2:
     106{{{
     107A2:/tmp$ java SomeAgent C2 9000 Pingpong.java1 a2
     108}}}
     109
     110=== 2.2 Communication ===
     111a. On A1, send a message that does not start with '''"ping("''' or '''"pong("''' to A2. For example:
     112{{{
     113send(hello,a2@C2)
     114}}}
     115b. On A2, nothing should be received and displayed, because we only allow the two types of messages. Any other messages will be discarded.
     116
     117c. On A1, send a message that starts with '''"ping("''' to A2. For example:
     118{{{
     119send(ping(hi),a2@C2)
     120}}}
     121d. On A2, you should see:
     122{{{
     123Received: ping(hi)
     124}}}
     125because it is a legitimate message and A1 does not have an '''unresolved ping''' message sent to A2.
     126
     127e. On A1, send another message that starts with '''"ping("''' to A2. For example:
     128{{{
     129send(ping(hey),a2@C2)
     130}}}
     131
     132f. On A2, this message should not be received and displayed, because A1 now has an '''unresolved ping''' message sent, therefore this message is discarded.
     133
     134g. On A2, send a message that starts with '''"pong("''' to A1. For example:
     135{{{
     136send(pong(howdy),a1@C1)
     137}}}
     138h. On A1, you should see:
     139{{{
     140Received: pong(howdy)
     141}}}
     142because there is an '''unresolved ping''' message sent by A1 to A2, therefore this '''pong''' message is legitimate and allowed to be sent.
     143
     144i. After A1 receives this '''pong(howdy)''' message, its previous '''ping(hi)''' message is resolved. Therefore A1 can send '''ping''' message to A2 now. But let's not to do that for a moment.
     145
     146j. On A2, send another message that starts with '''"pong("''' to A1. For example:
     147{{{
     148send(pong(yo),a1@C1)
     149}}}
     150k. On A1, nothing should be received and displayed, as there is no '''unresolved ping''' message sent by A1 to A2, therefore this '''pong''' message is discarded.
     151
     152You can continue sending messages to test the behavior and compare the law files.
     153
     154If you want to explore how this protocol is enforced over the whole community and what other policies can be imposed on communication, please see [http://www.moses.rutgers.edu/ here] and [http://www.cs.rutgers.edu/~minsky/pubs.html here].
     155
     156= [wiki:JoeSandbox/PingPongExample/Finish Next: Teardown Experiment] =