The idea is to calculate which rules in the old flowtable will be
overwritten by rules in the new table because they have the same pattern
and priority. If a rule is going to be overwritten, we shouldn't send a
delete command for the old rule, because it will actually delete the new
rule instead. As long as this pattern equality is the same as OF pattern
equality, I think it should be correct.


On Sat, May 31, 2014 at 4:43 PM, Spiros Eliopoulos <notifications@github.com
> wrote:

> In async/Async_NetKAT_Controller.ml:
>
> > +        | None ->
> > +          {r with pattern = {r.pattern with dlVlan = Some vlan_none}} :: acc
> > +      end)
> > +  in
> > +  List.fold match_table ~init:[] ~f:(fun acc r ->
> > +      {r with action = List.map r.action ~f:(fun x -> List.map x ~f:(fix_actions))} :: acc)
> > +
> > +(* Comparison should be made based on patterns only, not actions *)
> > +(* Assumes both FT are sorted in descending order by priority *)
> > +let rec flowtable_diff (ft1 : (SDN_Types.flow*int) list) (ft2 : (SDN_Types.flow*int) list) =
> > +  let open SDN_Types in
> > +  match ft1,ft2 with
> > +  | (flow1,pri1)::ft1, (flow2,pri2)::ft2 ->
> > +    if pri1 > pri2
> > +    then (flow1, pri1) :: flowtable_diff ft1 ((flow2,pri2)::ft2)
> > +    else if pri1 = pri2 && flow1.pattern = flow2.pattern
>
> I'm getting some strange behavior in another branch that I merged
> consistent updates into. I'm getting connectivity but everything's going to
> the controller. I suspect this function. @reitblatt
> <https://github.com/reitblatt> can you explain what's going on in the
> function in general? In particular, is the equality here correct?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/frenetic-lang/frenetic/pull/298/files#r13264336>.
>