@@ -2,7 +2,6 @@ module AL = SDN_Types
2
2
module Core = OpenFlow0x01_Core
3
3
module Msg = OpenFlow0x01. Message
4
4
5
-
6
5
exception Invalid_port of int32
7
6
8
7
let from_portId (pport_id : AL.portId ) : Core.portId =
@@ -51,19 +50,19 @@ let from_pattern (pat : AL.Pattern.t) : Core.pattern =
51
50
| None -> None
52
51
| Some (p ,m ) ->
53
52
let mo =
54
- if m = 32l then
55
- None
56
- else
57
- Some (Int32. sub 32l m) in
58
- Some { Core. m_value = p; Core. m_mask = mo })
53
+ if m = 32l then
54
+ None
55
+ else
56
+ Some (Int32. sub 32l m) in
57
+ Some { Core. m_value = p; Core. m_mask = mo })
59
58
; Core. nwDst = (match pat.AL.Pattern. nwDst with
60
59
| None -> None
61
60
| Some (p ,m ) ->
62
61
let mo =
63
- if m = 32l then
64
- None
65
- else
66
- Some (Int32. sub 32l m) in
62
+ if m = 32l then
63
+ None
64
+ else
65
+ Some (Int32. sub 32l m) in
67
66
Some { Core. m_value = p; Core. m_mask = mo })
68
67
; Core. nwProto = pat.AL.Pattern. nwProto
69
68
; Core. nwTos = None
@@ -92,11 +91,11 @@ module Common = HighLevelSwitch_common.Make (struct
92
91
| AL. All ->
93
92
(Mod. none, Output AllPorts )
94
93
| AL. Physical pport_id ->
95
- let pport_id = from_portId pport_id in
96
- if Some pport_id = inPort then
97
- (Mod. none, Output InPort )
98
- else
99
- (Mod. none, Output (PhysicalPort pport_id))
94
+ let pport_id = from_portId pport_id in
95
+ if Some pport_id = inPort then
96
+ (Mod. none, Output InPort )
97
+ else
98
+ (Mod. none, Output (PhysicalPort pport_id))
100
99
| AL. Controller n ->
101
100
(Mod. none, Output (Controller n))
102
101
| AL. Local ->
@@ -129,34 +128,34 @@ module Common = HighLevelSwitch_common.Make (struct
129
128
end
130
129
| AL. Modify (AL. SetVlanPcp pcp ) ->
131
130
(Mod. dlVlanPcp, SetDlVlanPcp (VInt. (get_int4 (Int4 pcp))))
132
- | AL. Modify (AL. SetEthTyp _ ) ->
133
- raise (Invalid_argument " cannot set Ethernet type" )
134
- | AL. Modify (AL. SetIPProto _ ) ->
135
- raise (Invalid_argument " cannot set IP protocol" )
131
+ | AL. Modify (AL. SetEthTyp _ ) ->
132
+ raise (Invalid_argument " cannot set Ethernet type" )
133
+ | AL. Modify (AL. SetIPProto _ ) ->
134
+ raise (Invalid_argument " cannot set IP protocol" )
136
135
| AL. Modify (AL. SetIP4Src nwAddr ) ->
137
136
(Mod. nwSrc, SetNwSrc nwAddr)
138
137
| AL. Modify (AL. SetIP4Dst nwAddr ) ->
139
138
(Mod. nwDst, SetNwDst nwAddr)
140
139
| AL. Modify (AL. SetTCPSrcPort tp ) ->
141
- (Mod. tpSrc, SetTpSrc VInt. (get_int16 (Int16 tp)))
140
+ (Mod. tpSrc, SetTpSrc VInt. (get_int16 (Int16 tp)))
142
141
| AL. Modify (AL. SetTCPDstPort tp ) ->
143
142
(Mod. tpDst, SetTpDst VInt. (get_int16 (Int16 tp)))
144
143
end )
145
144
146
145
let from_group (inPort : Core.portId option ) (group : AL.group )
147
- : Core.action list =
146
+ : Core.action list =
148
147
match group with
149
148
| [] -> []
150
149
| [par] -> Common. flatten_par inPort par
151
- | _ ->
150
+ | _ ->
152
151
raise (SDN_Types. Unsupported " OpenFlow 1.0 does not support fast-failover" )
153
152
154
153
let from_timeout (timeout : AL.timeout ) : Core.timeout =
155
154
match timeout with
156
155
| AL. Permanent -> Core. Permanent
157
156
| AL. ExpiresAfter n -> Core. ExpiresAfter n
158
157
159
- let from_flow (priority : int ) (flow : AL.flow ) : Core.flowMod =
158
+ let from_flow (priority : int ) (flow : AL.flow ) : Core.flowMod =
160
159
let open AL in
161
160
match flow with
162
161
| { pattern; action; cookie; idle_timeout; hard_timeout } ->
0 commit comments