@@ -9,7 +9,7 @@ platform. Most of the controllers we built followed a two-step recipe:
9
9
* Write a ` packet_in ` handler that implements the desired
10
10
packet-processing functionality.
11
11
12
- * Use ` flow__mod ` messages to configure the switch flow tables to
12
+ * Use ` flow_mod ` messages to configure the switch flow tables to
13
13
implement the same functionality efficiently.
14
14
15
15
In the next few chapters, we will explore a completely different
@@ -18,12 +18,11 @@ programming language, and let a compiler and run-time system handle
18
18
the details related to configuring switch flow tables (as well as
19
19
sending requests for statistics, accumulating replies, etc.)
20
20
21
- The templates for this part of the tutorial are in the
22
- ` netkat-tutorial-workspace ` directory, and the solutions are in
23
- ` netkat-tutorial-solutions ` .
21
+ The templates for this part are in
22
+ ` src/netkat-tutorial-solutions ` .
24
23
25
24
~~~
26
- $ cd tutorials /netkat-tutorial-solutions
25
+ $ cd src /netkat-tutorial-solutions
27
26
~~~
28
27
29
28
### Example 1: A Repeater (Redux)
@@ -39,7 +38,9 @@ of a single switch with four ports, numbered 1 through 4:
39
38
The following program implements a repeater in NetKAT:
40
39
41
40
~~~ ocaml
42
- open NetKAT.Std
41
+ open Frenetic_NetKAT
42
+ open Core.Std
43
+ open Async.Std
43
44
44
45
(* a simple repeater *)
45
46
let repeater : policy =
@@ -51,7 +52,12 @@ let repeater : policy =
51
52
else drop
52
53
>>
53
54
54
- let _ = run_static repeater
55
+ let _ =
56
+ let module Controller = Frenetic_NetKAT_Controller.Make in
57
+ Controller.start 6633;
58
+ Controller.update_policy repeater;
59
+ never_returns (Scheduler.go ());
60
+
55
61
~~~
56
62
57
63
This main part of this code uses a Camlp4 quotation,
@@ -67,13 +73,16 @@ the switch with a static NetKAT policy.
67
73
68
74
To run the repeater, type the code above into a file
69
75
<code >Repeater.ml</code > within the
70
- <code >netkat-tutorial-workspace </code > directory. Then compile and
76
+ <code >netkat-tutorial-solutionbs </code > directory. Then compile and
71
77
start the repeater controller using the following commands.
78
+
72
79
~~~
73
- $ netkatbuild Repeater.native
74
- $ ./Repeater.native
80
+ $ netkat-build Repeater
81
+ $ ./Repeater.d.byte
75
82
~~~
83
+
76
84
Next, in a separate terminal, start up mininet.
85
+
77
86
~~~
78
87
$ sudo mn --controller=remote --topology=single,4 --mac --arp
79
88
~~~
@@ -111,7 +120,9 @@ wanted to implement repeaters on switches with different numbers of
111
120
ports.
112
121
113
122
~~~ ocaml
114
- open NetKAT.Std
123
+ open Frenetic_NetKAT
124
+ open Core.Std
125
+ open Async.Std
115
126
116
127
(* a simple repeater *)
117
128
let all_ports : int list = [1; 2; 3; 4]
@@ -125,5 +136,5 @@ let repeater : policy =
125
136
List.fold_right
126
137
(fun m pol -> <:netkat<let p = flood m in if port = $m then $p else $pol>>)
127
138
all_ports <:netkat<drop>>
128
- >>
139
+
129
140
~~~
0 commit comments