@@ -249,10 +249,12 @@ module ControllerProcess = struct
249
249
let ctl = create_from_chunk t in
250
250
Pipe. iter (Hub. listen_simple h) ~f: (fun (id , msg ) -> match msg with
251
251
| `Send (sw_id , msg ) -> begin
252
+ Log. debug ~tags " send (remote)" ;
252
253
send ctl sw_id msg
253
254
>> | fun resp -> Hub. send h id (`Send_resp resp)
254
255
end
255
256
| `Send_to_all msg ->
257
+ Log. debug ~tags " send_to_all (remote)" ;
256
258
return (send_to_all ctl msg)
257
259
| `Send_ignore_errors (sw_id , msg ) ->
258
260
return (send_ignore_errors ctl sw_id msg)
@@ -278,6 +280,7 @@ module ControllerProcess = struct
278
280
| `Set_idle_wait interval -> return (set_idle_wait ctl interval)
279
281
| `Set_kill_wait interval -> return (set_kill_wait ctl interval)
280
282
| `Get_switches ->
283
+ Log. debug ~tags " get_switches (remote)" ;
281
284
return (Hub. send h id (`Get_switches_resp (get_switches ctl)))
282
285
| `Clear_flows (pattern , sw_id ) -> clear_flows ~pattern ctl sw_id
283
286
>> | fun resp -> Hub. send h id (`Clear_flows_resp resp)
@@ -306,6 +309,9 @@ module Controller = struct
306
309
open Async.Std
307
310
open Async_parallel
308
311
312
+ module Log = Async_OpenFlow_Log
313
+ let tags = [(" openflow" , " openflow0x01" )]
314
+
309
315
module Client_id = ControllerProcess. Client_id
310
316
type t = ([ `Barrier of SwitchMap .key
311
317
| `Individual_stats of
@@ -359,68 +365,83 @@ module Controller = struct
359
365
]) Channel .t
360
366
361
367
let aggregate_stats ?(pattern =C. match_all) (t : t ) sw_id =
368
+ Log. debug ~tags " aggregate_stats (local)" ;
362
369
Channel. write t (`Aggregate_stats (pattern, sw_id));
363
370
Channel. read t >> | function
364
371
| `Aggregate_stats_resp resp -> resp
365
372
366
373
let send_pkt_out (t : t ) (sw_id :Client_id.t ) pkt_out =
374
+ Log. debug ~tags " send_pkt_out (local)" ;
367
375
Channel. write t (`Send_pkt_out (sw_id, pkt_out));
368
376
Channel. read t >> | function
369
377
| `Send_pkt_out_resp resp -> resp
370
378
371
379
let send_flow_mods ?(clear =true ) (t : t ) (sw_id :Client_id.t ) flow_mods =
380
+ Log. debug ~tags " send_flow_mods (local)" ;
372
381
Channel. write t (`Send_flow_mods (clear, sw_id, flow_mods));
373
382
Channel. read t >> | function
374
383
| `Send_flow_mods_resp resp -> resp
375
384
376
385
let clear_flows ?(pattern =C. match_all) (t : t ) (sw_id :Client_id.t ) =
386
+ Log. debug ~tags " clear_flows (local)" ;
377
387
Channel. write t (`Clear_flows (pattern, sw_id));
378
388
Channel. read t >> | function
379
389
| `Clear_flows_resp resp -> resp
380
390
381
391
let get_switches (t : t ) =
392
+ Log. debug ~tags " get_switches (local)" ;
382
393
Channel. write t `Get_switches ;
383
394
Channel. read t >> | function
384
395
| `Get_switches_resp resp -> resp
385
396
386
397
let set_kill_wait t (s :Time.Span.t ) =
398
+ Log. debug ~tags " set_kill_wait (local)" ;
387
399
Channel. write t (`Set_kill_wait s)
388
400
389
401
let set_monitor_interval t (s :Time.Span.t ) =
402
+ Log. debug ~tags " set_monitor_interval (local)" ;
390
403
Channel. write t (`Set_monitor_interval s)
391
404
392
405
let set_idle_wait t (s :Time.Span.t ) : unit =
406
+ Log. debug ~tags " set_idle_wait (local)" ;
393
407
Channel. write t (`Set_idle_wait s)
394
408
395
409
let listening_port (t : t ) =
410
+ Log. debug ~tags " set_listening_port (local)" ;
396
411
Channel. write t `Listening_port ;
397
412
Channel. read t >> | function
398
413
| `Listening_port_resp resp -> resp
399
414
400
415
let client_addr_port (t : t ) sw_id =
416
+ Log. debug ~tags " client_addr_port (local)" ;
401
417
Channel. write t (`Client_addr_port sw_id);
402
418
Channel. read t >> | function
403
419
| `Client_addr_port_resp resp -> resp
404
420
405
421
let send_to_all (t : t ) msg =
422
+ Log. debug ~tags " send_to_all (local)" ;
406
423
Channel. write t (`Send_to_all msg)
407
424
408
425
let send_ignore_errors (t : t ) sw_id msg =
426
+ Log. debug ~tags " send_ignore_errors (local)" ;
409
427
Channel. write t (`Send_ignore_errors (sw_id, msg))
410
428
411
429
let has_client_id (t : t ) sw_id =
430
+ Log. debug ~tags " has_client_id (local)" ;
412
431
Channel. write t (`Has_client_id sw_id);
413
432
Channel. read t >> | function
414
433
| `Has_client_id_resp resp -> resp
415
434
416
435
let close (t : t ) sw_id =
436
+ Log. debug ~tags " close (local)" ;
417
437
Channel. write t (`Close sw_id)
418
438
419
439
type e = ControllerProcess .e
420
440
type m = ControllerProcess .m
421
441
type c = ControllerProcess .c
422
442
423
443
let create_from_chunk chunk =
444
+ Log. debug ~tags " create_from_chunk (local)" ;
424
445
Intf. spawn (create_from_chunk_hub chunk) >> | fun (c ,_ ) ->
425
446
c
426
447
@@ -429,6 +450,7 @@ module Controller = struct
429
450
?log_disconnects
430
451
?buffer_age_limit
431
452
?monitor_connections ~port () : t Deferred.t =
453
+ Log. debug ~tags " create (local)" ;
432
454
Intf. spawn (create ?max_pending_connections
433
455
?verbose
434
456
?log_disconnects
@@ -437,6 +459,7 @@ module Controller = struct
437
459
c
438
460
439
461
let send (t : t ) sw_id msg =
462
+ Log. debug ~tags " send (local)" ;
440
463
Channel. write t (`Send (sw_id, msg));
441
464
Channel. read t >> | function
442
465
| `Send_resp resp -> resp
@@ -445,19 +468,24 @@ module Controller = struct
445
468
Deferred. forever () (fun _ -> Channel. read chan >> =
446
469
Pipe. write writer)
447
470
let listen (t : t ) =
471
+ Log. debug ~tags " listen (local)" ;
448
472
Channel. write t `Listen ;
449
473
let reader,writer = Pipe. create () in
450
474
don't_wait_for (
451
- Channel. read t >> | function
452
- | `Listen_resp resp -> channel_transfer resp writer);
475
+ Channel. read t >> = function
476
+ | `Listen_resp resp -> Log. debug ~tags " Listen channel returned (local)" ;
477
+ Log. flushed () >> |
478
+ fun () -> channel_transfer resp writer);
453
479
reader
454
480
455
481
let barrier (t : t ) sw_id =
482
+ Log. debug ~tags " barrier (local)" ;
456
483
Channel. write t (`Barrier sw_id);
457
484
Channel. read t >> | function
458
485
| `Barrier_resp resp -> resp
459
486
460
487
let individual_stats ?(pattern =C. match_all) (t : t ) sw_id =
488
+ Log. debug ~tags " individual_stats (local)" ;
461
489
Channel. write t (`Individual_stats (pattern, sw_id));
462
490
Channel. read t >> | function
463
491
| `Individual_stats_resp resp -> resp
0 commit comments