Skip to content

Commit

Permalink
Merge pull request #523 from frenetic-lang/multitable
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
jnfoster authored Aug 24, 2016
2 parents c6b04e1 + 13bb71c commit 8a8d863
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion async/Frenetic_OpenFlow0x04_Plugin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ let read_respond_loop (reader : Reader.t)
let header = Frenetic_OpenFlow_Header.parse (Cstruct.of_string header_buf) in
let message_len = header.length - Frenetic_OpenFlow_Header.size in
let message_buf = Bytes.create message_len in
Log.info "Got message %s" (Frenetic_OpenFlow_Header.to_string header);
Reader.really_read reader message_buf
>>= function
| `Eof _ ->
Expand Down
17 changes: 9 additions & 8 deletions lib/Frenetic_NetKAT_Compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -922,20 +922,20 @@ let flow_table_subtrees (layout : flow_layout) (t : t) : flow_subtrees =
let rec subtrees_for_table (table : Field.t list) (t : t)
(subtrees : t list) : t list =
match FDD.unget t with
| Leaf _ -> subtrees
| Leaf _ ->
t :: subtrees
| Branch ((field, _), tru, fls) ->
if (List.mem table field) then
t :: subtrees
else
subtrees_for_table table tru subtrees
|> subtrees_for_table table fls
in
|> subtrees_for_table table fls in
let meta_id = ref 0 in
List.map layout ~f:(fun table -> subtrees_for_table table t [])
|> List.filter ~f:(fun subtrees -> subtrees <> [])
|> List.foldi ~init:Map.Poly.empty ~f:(fun tbl_id accum subtrees ->
List.map layout ~f:(fun table -> subtrees_for_table table t [])
|> List.filter ~f:(fun subtrees -> subtrees <> [])
|> List.foldi ~init:Map.Poly.empty ~f:(fun tbl_id accum subtrees ->
List.fold_right subtrees ~init:accum ~f:(fun t accum ->
Map.add accum ~key:t ~data:(tbl_id,(post meta_id))))
Map.add accum ~key:t ~data:(tbl_id,(post meta_id))))

(* make a flow struct that includes the table and meta id of the flow *)
let mk_multitable_flow options (pattern : Frenetic_OpenFlow.Pattern.t)
Expand Down Expand Up @@ -972,7 +972,8 @@ let subtree_to_table options (subtrees : flow_subtrees) (subtree : (t * flowId))
| Branch (test, tru, fls) ->
List.filter_opt (List.append (dfs [test] subtrees tru flowId)
(dfs [] subtrees fls flowId))
| Leaf _ -> assert false (* each entry in the subtree map is a branch *)
| Leaf _ ->
List.filter_opt (dfs [] subtrees t flowId)

(* Collect the flow table rows for each subtree in one list. *)
let subtrees_to_multitable options (subtrees : flow_subtrees) : (multitable_flow list * Frenetic_GroupTable0x04.t) =
Expand Down

0 comments on commit 8a8d863

Please sign in to comment.