package frenetic

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type order = [
  1. | `Default
  2. | `Static of Field.t list
  3. | `Heuristic
]
module FDD : sig ... end
type t = FDD.t

The type of the intermediate compiler representation (FDD).

val to_dot : t -> string
type cache = [
  1. | `Keep
  2. | `Empty
  3. | `Preserve of t
]
type compiler_options = {
  1. cache_prepare : cache;
  2. field_order : order;
  3. remove_tail_drops : bool;
  4. dedup_flows : bool;
  5. optimize : bool;
}

Compilation

exception Non_local

The exception that's thrown when the local compiler is given a policy with a Link term in it. To compile policies with Link terms, invoke global compiler.

val default_compiler_options : compiler_options
val prepare_compilation : options:compiler_options -> Frenetic_netkat.Syntax.policy -> unit
val compile : ?options:compiler_options -> Frenetic_netkat.Syntax.policy -> t

compile p returns the intermediate representation of the local policy p. You can generate a flowtable from t by passing it to the to_table function below.

restrict hv t returns the fragment of t that applies when the assignment hv is true. The result will no longer make any reference to the header named in hv. This is equivalent to traversing the original NetKAT syntax tree and replacing all occurrences of Test(hv) with True.

This function is called by to_table to restrict t to the portion that should run on a single switch.

to_table sw t returns a flowtable that implements t for switch sw.

Composition

val seq : t -> t -> t

seq p q returns the sequential composotion of the two intermediate representations p and q. The result is semantically equivalent to the seqential composition of the two policies from which p and q were derived.

val union : t -> t -> t

union p q returns the parallel composition of the two intermediate representations p and q. The result is semantically equivalent to the parallel composition of the two policies from which p and q were derived.

val star : t -> t

star p returns the star of the intermediate representation p. The result is semantically equivalent to the star of the policy from which p was derived.

Utilities

val dedup : t -> t
val pipes : t -> string list

pipes t returns the list of pipe names that occur in t.

val queries : t -> (string * Frenetic_netkat.Syntax.pred) list

queries t returns the list of queries that occur in t along with the predicates associated with the query. Frenetic_kernel.Packet and byte counts of flows that match the predicate should count towards its associated query.

val equal : t -> t -> bool

equal a b returns whether or not the two intermediate representations are structurally equal.

If the two representations are structurally equal, then the policies they derived from are semantically equivalent. However, if the two representations are not equal, the policies they were derived from may still be semantically equivalent.

val size : t -> int

size t returns the size of t.

val compression_ratio : t -> int * int
val to_local_pol : t -> Frenetic_netkat.Syntax.policy

to_local_pol t returns a NetKAT policy that is semantically equivalent to t. If was generated from compiling a policy p, it is not guarateed that to_local_pol t will be identical to p.

val to_string : t -> string

to_string t returns a string representation of t. This will be a representation of the Vlr diagram from the tdk package.

Interpreter

eval pkt t returns a PacketSet.t that is the result of the packet pkt being run through the policy represented by t.

eval_pipes pkt t returns the result of running the packet pkt through the policy represented by t, with packets grouped according to the type of location to which the policy assigns them. The result is a triple whose first component is a list of packets and corresponding pipe location, whose second is a list of packets and corresponding query location, and whose third is a list of packets that are at physical locations.

val to_dotfile : t -> string -> unit
val field_order_from_string : string -> order
val field_order_to_string : order -> string
val options_from_json_string : string -> compiler_options

options_from_json_string s returns a compiler_options type suitable. Mostly for HTTP servers

val options_to_json_string : compiler_options -> string
type flow_layout = Field.t list list
val sexp_of_flow_layout : flow_layout -> Ppx_sexp_conv_lib.Sexp.t
val flow_layout_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> flow_layout
type tableId = int
val sexp_of_tableId : tableId -> Ppx_sexp_conv_lib.Sexp.t
val tableId_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> tableId
type metaId = int
val sexp_of_metaId : metaId -> Ppx_sexp_conv_lib.Sexp.t
val metaId_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> metaId
type flowId = tableId * metaId
val sexp_of_flowId : flowId -> Ppx_sexp_conv_lib.Sexp.t
val flowId_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> flowId
type instruction = [
  1. | `Action of Frenetic_kernel.OpenFlow.group
  2. | `GotoTable of flowId
]
val sexp_of_instruction : instruction -> Ppx_sexp_conv_lib.Sexp.t
val instruction_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> instruction
val __instruction_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> instruction
type multitable_flow = {
  1. pattern : Frenetic_kernel.OpenFlow.Pattern.t;
  2. cookie : int64;
  3. idle_timeout : Frenetic_kernel.OpenFlow.timeout;
  4. hard_timeout : Frenetic_kernel.OpenFlow.timeout;
  5. instruction : instruction;
  6. flowId : flowId;
}
val sexp_of_multitable_flow : multitable_flow -> Ppx_sexp_conv_lib.Sexp.t
val multitable_flow_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> multitable_flow
val layout_to_string : flow_layout -> string