Skip to content

Commit 5f4296f

Browse files
committed
mulit: implement aggregate stats request for 0x01
1 parent 8121a28 commit 5f4296f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

async/Async_OpenFlow.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ module OpenFlow0x01 : sig
201201

202202
val send_pkt_out : t -> Client_id.t -> OpenFlow0x01_Core.packetOut -> (unit, exn) Deferred.Result.t
203203
val barrier : t -> Client_id.t -> (unit, exn) Result.t Deferred.t
204+
val stats : t -> Client_id.t -> OpenFlow0x01_Core.pattern -> (OpenFlow0x01_Stats.aggregateStats, exn) Deferred.Result.t
204205
end
205206

206207
end
@@ -225,7 +226,6 @@ module OpenFlow0x04 : sig
225226

226227
val send_pkt_out : t -> Client_id.t -> OpenFlow0x04_Core.packetOut -> (unit, exn) Deferred.Result.t
227228
val barrier : t -> Client_id.t -> (unit, exn) Result.t Deferred.t
228-
229229
end
230230

231231
end

async/Async_OpenFlow0x01.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,15 @@ module Controller = struct
224224
send_txn_with t sw_id M.BarrierRequest (function
225225
| M.BarrierReply -> Result.Ok ()
226226
| _ -> assert false)
227+
228+
let stats t sw_id pattern =
229+
let open OpenFlow0x01_Stats in
230+
let msg = AggregateRequest
231+
{ as_of_match = pattern
232+
; as_table_id = 0xff
233+
; as_out_port = None }
234+
in
235+
send_txn_with t sw_id (M.StatsRequestMsg msg) (function
236+
| M.StatsReplyMsg (AggregateFlowRep r) -> Result.Ok r
237+
| _ -> assert false)
227238
end

0 commit comments

Comments
 (0)