Syntax update

This commit is contained in:
doganyazar 2010-11-30 13:22:26 +00:00
parent 5a4fa388da
commit 37b47e4cf2

View file

@ -14,24 +14,25 @@ To run REST examples in COOJA under Linux
--------------------------------------------
Accessing the server from outside:
Start COOJA and load the simulation "rest-server-example.csc" by the following command.
> make TARGET=cooja rest-server-example.csc
After loading the cooja file, open another another terminal pointing to the same directory and connect to the COOJA simulation using tunslip6:
>make connect-router-cooja
1. Start COOJA and load the simulation "rest-server-example.csc" by the following command.
make TARGET=cooja rest-server-example.csc
Now, you need to use a COAP or HTTP client to interact with the COOJA nodes running REST code.
2. After loading the COOJA file, open another another terminal pointing to the same directory and connect to the COOJA simulation using tunslip6:
make connect-router-cooja
3. You need to use a COAP or HTTP client to interact with the COOJA nodes running REST code.
In this setting, two servers are available:
IP addresses are aaaa::0212:7402:0002:0202 and aaaa::0212:7403:0003:0303. COAP uses 61616, whereas HTTP uses 8080 port in default configuration.
First, ping the COOJA nodes to test the connectivity.
>ping6 aaaa::0212:7402:0002:0202
>ping6 aaaa::0212:7403:0003:0303
ping6 aaaa::0212:7402:0002:0202
ping6 aaaa::0212:7403:0003:0303
HTTP Examples
You can use curl as an http client to interact with the COOJA motes running REST code.
>curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #get helloworld plain text
>curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/led?color=green -d mode=off -i #turn off the green led
>curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/.well-known/core -i
>curl -X POST -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #method not allowed
curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #get helloworld plain text
curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/led?color=green -d mode=off -i #turn off the green led
curl -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/.well-known/core -i
curl -X POST -H "User-Agent: curl" aaaa::0212:7402:0002:0202:8080/helloworld #method not allowed
COAP Examples
You should run a COAP client on your computer. You can use the URLs and methods provided above in HTTP examples to test the COAP Server.
@ -39,7 +40,8 @@ You should run a COAP client on your computer. You can use the URLs and methods
Accessing the server inside the sensor network:
(Note: Provided only for COAP implementation)
Start COOJA and load the simulation "coap-client-server-example.csc" by the following command.
> make TARGET=cooja coap-client-server-example.csc
make TARGET=cooja coap-client-server-example.csc
coap-client-server-example.csc : Runs rest-server-example.c as the server (over COAP) (IP:aaaa::0212:7401:0001:0101)
in one node and coap-client-example.c as the client (IP: aaaa::0212:7402:0002:0202) in another node.
Client periodically accesses resources of server and prints the payload.
@ -53,24 +55,24 @@ To run REST server on real nodes under Linux
--------------------------------------------
1. Program the nodes with the rest-server-example
> make TARGET=sky rest-server-example.upload
make TARGET=sky rest-server-example.upload
2. Disconnect the nodes and program one node with the RPL border router
> (cd ../ipv6/rpl-border-router && make TARGET=sky border-router.upload)
(cd ../ipv6/rpl-border-router && make TARGET=sky border-router.upload)
3. Connect to the border router using tunslip6:
> make connect-router
make connect-router
4. Reconnect the motes, reboot them and note their IP addresses.
5. Test the connectivity by pinging them.
>ping6 <IPv6 Address of the MOTE>
ping6 <IPv6 Address of the MOTE>
5. Remaining parts are the same with the COOJA example. (i.e. if it is a COAP Server, it is available at <NODE_IP_ADDR>:61616)
ToDo
*Better option handling needed - ex: critical options are not differentiated for now. Need to add support for some such as Tokens.
To Do
*Better option handling needed - ex: critical options are not differentiated for now. Need to add support for some such as Tokens. Also, C/E difference should be added.
*Reilable message sending is missing. i.e. client example should resend request in case ACK does not arrive. Same for server pushing (in case of subscriptions)
*Add Block transfer example
*Add Subscription example