-
Notifications
You must be signed in to change notification settings - Fork 6
3. Warp testing against OpenFlow 1.3 LINC Switch
Dmitry-Orekhov edited this page May 13, 2014
·
8 revisions
##REST API ###Starting the Controller ####Controller
$ java -jar build/lib/warp.jar
Starting the internal [HTTP/1.1] server on port 8080####LINC Switch
linc@localhost)1> 20:20:50.301 [info] Connected to controller localhost:6633/0 using OFP v4
20:20:50.311 [info] Connected to controller localhost:6633/0 using OFP v4
20:20:50.312 [debug] Received message from the controller: {ofp_message,4,features_request,0,{ofp_features_request}}
20:20:50.312 [debug] Sent message to controller: {ofp_message,4,features_request,0,{ofp_features_reply,<<8,0,39,155,207,118>>,1,0,255,0,[flow_stats,table_stats,port_stats,group_stats,queue_stats]}}
20:20:50.312 [debug] Received message from the controller: {ofp_message,4,features_request,0,{ofp_features_request}}
20:20:50.313 [debug] Sent message to controller: {ofp_message,4,features_request,0,{ofp_features_reply,<<8,0,39,155,207,118>>,0,0,255,0,[flow_stats,table_stats,port_stats,group_stats,queue_stats]}}
20:20:50.324 [debug] Received message from the controller: {ofp_message,4,set_config,0,{ofp_set_config,[],no_buffer}}
20:20:50.325 [debug] Received message from the controller: {ofp_message,4,set_config,0,{ofp_set_config,[],no_buffer}}
20:20:50.363 [debug] Received message from the controller: {ofp_message,4,get_config_request,0,{ofp_get_config_request}}
20:20:50.363 [debug] Sent message to controller: {ofp_message,4,get_config_request,0,{ofp_get_config_reply,[],no_buffer}}
20:20:50.365 [debug] Received message from the controller: {ofp_message,4,get_config_request,0,{ofp_get_config_request}}
20:20:50.365 [debug] Sent message to controller: {ofp_message,4,get_config_request,0,{ofp_get_config_reply,[],no_buffer}}###Getting List of Switches
$ curl -d '{"show":"switches"}' http://localhost:8080/ff/of/controller/restapi20:24:33.115 [Restlet-728530265] INFO o.f.w.j.JController$ChannelHandler - WARP REST EVENT:
20:24:33.176 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - WARP REST API: INCOMING request
20:24:33.176 [ForkJoinPool-1-worker-2] INFO o.f.w.j.restapi.RestApiTask - Incoming JSON request: ADD {"show":"switches"}
20:24:33.177 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - WARP INFO: Switches connected
20:24:33.177 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - | 800279BCF76
20:24:33.177 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - | 10800279BCF76So we have two switches connected: 00:00:08:00:27:9B:CF:76 01:00:08:00:27:9B:CF:76
###Installing Flow
Let's install a simple flow to the Switch '00:00:08:00:27:9B:CF:76':
curl -d '{"switch":"00:00:08:00:27:9B:CF:76", "priority":"32768", "ingress-port":"1", "active":"true", "apply-actions":"output=1"}' http://localhost:8080/ff/of/controller/restapi20:28:23.208 [Restlet-1318894130] INFO o.f.w.j.JController$ChannelHandler - WARP REST EVENT:
20:28:23.210 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - WARP REST API: INCOMING request
20:28:23.210 [ForkJoinPool-1-worker-2] INFO o.f.w.j.restapi.RestApiTask - Incoming JSON request: ADD {"switch":"00:00:08:00:27:9B:CF:76", "priority":"32768", "ingress-port":"1", "active":"true", "apply-actions":"output=1"}
20:28:23.216 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - WARP OUT: FLOW_MOD, DPID = 00:00:08:00:27:9B:CF:76
2014-05-13 20:28:23 192.168.56.101 - - 8080 POST /ff/of/controller/restapi - 200 2 121 47 http://localhost:8080 curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 -
20:28:23.240 [ForkJoinPool-1-worker-1] INFO o.f.w.j.JController$ChannelHandler - WARP INFO: Switches connected
20:28:23.240 [ForkJoinPool-1-worker-1] INFO o.j.n.handler.logging.LoggingHandler - [id: 0x35ad7677, /192.168.56.101:56586 => /192.168.56.101:6633] WRITE: BigEndianHeapChannelBuffer(ridx=0, widx=88, cap=88)
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 04 0e 00 58 00 00 00 00 00 00 00 00 00 00 00 00 |...X............|
|00000010| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 |................|
|00000020| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
|00000030| 00 01 00 0c 80 00 00 04 00 00 00 01 00 00 00 00 |................|
|00000040| 00 04 00 18 00 00 00 00 00 00 00 10 00 00 00 01 |................|
|00000050| ff ff 00 00 00 00 00 00 |........ |
+--------+-------------------------------------------------+----------------+
20:28:23.241 [ForkJoinPool-1-worker-1] INFO o.j.n.handler.logging.LoggingHandler - [id: 0x35ad7677, /192.168.56.101:56586 => /192.168.56.101:6633] WRITE: BigEndianHeapChannelBuffer(ridx=0, widx=88, cap=88)20:28:23.243 [debug] Received message from the controller: {ofp_message,4,flow_mod,0,{ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,0,add,0,0,32768,0,0,0,[],{ofp_match,[{ofp_field,openflow_basic,in_port,false,<<0,0,0,1>>,undefined}]},[{ofp_instruction_apply_actions,2,[{ofp_action_output,16,1,no_buffer}]}]}}
20:28:23.244 [debug] [FLOWMOD] Added flow entry {32768,#Ref<0.0.0.692>} with: {flow_entry,{32768,#Ref<0.0.0.1108>},32768,{ofp_match,[{ofp_field,openflow_basic,in_port,false,<<0,0,0,1>>,undefined}]},<<0,0,0,0,0,0,0,0>>,[],{1400,2103,244040},{infinity,0,0},{infinity,0,0},[{ofp_instruction_apply_actions,2,[{ofp_action_output,16,1,no_buffer}]}]}
(linc@localhost)1> linc_us4_flow:get_flow_table(0,0).
[{flow_entry,{32768,#Ref<0.0.0.692>},
32768,
{ofp_match,[{ofp_field,openflow_basic,in_port,false,
<<0,0,0,1>>,
undefined}]},
<<0,0,0,0,0,0,0,0>>,
[],
{1400,2103,244040},
{infinity,0,0},
{infinity,0,0},
[{ofp_instruction_apply_actions,2,
[{ofp_action_output,16,1,no_buffer}]}]}]So we can see Flow installed in the Switch #0, Table #0
Then let's install a simple Flow to the Switch '00:01:08:00:27:9B:CF:76':
curl -d '{"switch":"00:01:08:00:27:9B:CF:76", "priority":"32768", "ingress-port":"2", "active":"true", "apply-actions":"output=1"}' http://localhost:8080/ff/of/controller/restapi20:32:36.549 [debug] Received message from the controller: {ofp_message,4,flow_mod,0,{ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,0,add,0,0,32768,0,0,0,[],{ofp_match,[{ofp_field,openflow_basic,in_port,false,<<0,0,0,1>>,undefined}]},[{ofp_instruction_apply_actions,2,[{ofp_action_output,16,2,no_buffer}]}]}}
20:32:36.549 [debug] [FLOWMOD] Added new flow entry with id {32768,#Ref<0.0.0.1751>}: {ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,0,add,0,0,32768,no_buffer,0,0,[],{ofp_match,[{ofp_field,openflow_basic,in_port,false,<<0,0,0,1>>,undefined}]},[{ofp_instruction_apply_actions,2,[{ofp_action_output,16,2,no_buffer}]}]}
(linc@localhost)3> linc_us4_flow:get_flow_table(1,0).
[{flow_entry,{32768,#Ref<0.0.0.1751>},
32768,
{ofp_match,[{ofp_field,openflow_basic,in_port,false,
<<0,0,0,1>>,
undefined}]},
<<0,0,0,0,0,0,0,0>>,
[],
{1400,2356,549282},
{infinity,0,0},
{infinity,0,0},
[{ofp_instruction_apply_actions,2,
[{ofp_action_output,16,2,no_buffer}]}]}]Some other REST API commands
curl -d '{"switch":"00:00:08:00:27:9B:CF:76", "priority":"32768", "ether-type":"0x0800", "dst-ip":"10.10.10.10","active":"true", "apply-actions":"output=1"}' http://localhost:8080/ff/of/controller/restapi
curl -d '{"switch":"00:01:08:00:27:9B:CF:76", "priority":"32768", "ether-type":"0x0800", "active":"true", "apply-actions":"output=1"}' http://localhost:8080/ff/of/controller/restapiSo we can see Flow installed in the Switch #1, Table #0
$ curl -X DELETE -d '{"switch":"00:0C:29:BD:37:38:00:00", "priority":"32768", "ingress-port":"1", "active":"true", "apply-actions":"output=1"}' http://localhost:8080/ff/of/controller/restapi
DELETEDReceived message from the controller: {ofp_message,4,flow_mod,0,{ofp_flow_mod,<<0,0,0,0,0,0,0,0>>,<<0,0,0,0,0,0,0,0>>,0,delete,0,0,32768,0,any,any,[],{ofp_match,[{ofp_field,openflow_basic,in_port,false,<<0,0,0,2>>,undefined}]},[{ofp_instruction_apply_actions,2,[{ofp_action_output,16,3,no_buffer}]}]}}
(linc@localhost)2> linc_us4_flow:get_flow_table(0,0).
[]