@@ -9,57 +9,154 @@ import (
99)
1010
1111const (
12- // Immutable messages.
12+ // TypeHello is used by either controller or switch during connection
13+ // setup. It is used for version negotiation. When the connection
14+ // is established, each side must immediately send a Hello message
15+ // with the version field set to the highest version supported by
16+ // the sender. If the version negotiation fails, an Error message
17+ // is sent with type HelloFailed and code Incompatible.
1318 TypeHello Type = iota
19+
20+ // TypeError can be sent by either the switch or the controller and
21+ // indicates the failure of an operation. The simplest failure pertain
22+ // to malformed messages or failed version negotiation, while more
23+ // complex scenarios desbie some failure in state change at the switch.
1424 TypeError
25+
26+ // TypeEchoRequest is used to exchange information about latency,
27+ // bandwidth and liveness. Echo request timeout indicates disconnection.
1528 TypeEchoRequest
29+
30+ // TypeEchoReply is used to exchange information about latency,
31+ // bandwidth and liveness. Echo reply is sent as a response to Echo
32+ // request.
1633 TypeEchoReply
34+
35+ // TypeExperiment is a mechanism for proprietary messages within the
36+ // protocol.
1737 TypeExperiment
1838
19- // Switch configuration messages.
39+ // TypeFeaturesRequest is used when a transport channel (TCP, SCTP,
40+ // TLS) is established between the switch and controller, the first
41+ // activity is feature determination. The controller will send a
42+ // feature request to the switch over the transport channel.
2043 TypeFeaturesRequest
44+
45+ // TypeFeaturesReply is the switch's reply to the controller
46+ // enumerating its abilities.
2147 TypeFeaturesReply
48+
49+ // TypeGetConfigRequest sequence is used to query and set the
50+ // fragmentation handling properties of the packet processing pipeline.
2251 TypeGetConfigRequest
52+
53+ // TypeGetConfigReply is the switch's reply to the controller
54+ // that acknowledges configuration requests.
2355 TypeGetConfigReply
56+
57+ // TypeSetConfig is used by the controller to alter the switch's
58+ // configuration. This message is unacknowledged.
2459 TypeSetConfig
2560
26- // Asynchronous messages.
61+ // TypePacketIn message is a way for the switch to send a captured
62+ // packet to the controller.
2763 TypePacketIn
64+
65+ // TypeFlowRemoved is sent to the controller by the switch when a
66+ // flow entry in a flow table is removed. It happens when a timeout
67+ // occurs, either due to inactivity or hard timeout. An idle timeout
68+ // happens when no packets are matched in a period of time. A hard
69+ // timeout happens when a certain period of time elapses, regardless
70+ // of the number of matching packets. Whether the switch sends a
71+ // TypeFlowRemoved message after a timeout is specified by the
72+ // TypeFlowMod. Flow entry removal with a TypeFlowMod message from
73+ // the controller can also lead to a TypeFlowRemoved message.
2874 TypeFlowRemoved
75+
76+ // TypePortStatus messages are asynchronous events sent from the
77+ // switch to the controller indicating a change of status for the
78+ // indicated port.
2979 TypePortStatus
3080
31- // Controller command messages.
81+ // TypePacketOut is used by the controller to inject packets into the
82+ // data plane of a particular switch. Such message can either carry a
83+ // raw packet to inject into the switch, or indicate a local buffer
84+ // on the switch containing a raw packet to release. Packets injected
85+ // into the data plane of a switch using this method are not treated
86+ // the same as packets that arrive on standard ports. The packet jumps
87+ // to the action set application stage in the standard packet processing
88+ // pipeline. If the action set indicates table processing is necessary
89+ // then the input port id is used as the arrival port of the raw packet.
3290 TypePacketOut
91+
92+ // TypeFlowMod is one of the main messages, it allows the controller
93+ // to modify the state of switch.
3394 TypeFlowMod
95+
96+ // TypeGroupMod is used by controller to modify group tables.
3497 TypeGroupMod
98+
99+ // TypePortMod is used by the controller to modify the state of port.
35100 TypePortMod
101+
102+ // TypeTableMod is used to determine a packet's fate when it misses
103+ // in the table. It can be forwarded to the controller, dropped, or
104+ // sent to the next table.
36105 TypeTableMod
37106
38- // Multipart messages
107+ // TypeMultipartRequest is used by the controller to request the
108+ // state of the datapath.
39109 TypeMultipartRequest
110+
111+ // TypeMultipartReply are the replies from the switch to controller
112+ // on TypeMultipartRequest messages.
40113 TypeMultipartReply
41114
42- // Barrier messages
115+ // TypeBarrierRequest can be used by the controller to set a
116+ // synchronization point, ensuring that all previous state messages
117+ // are completed before the barrier response is sent back to the
118+ // controller.
43119 TypeBarrierRequest
120+
121+ // TypeBarrierReply is a response from the switch to controller
122+ // on TypeBarrierRequest messages.
44123 TypeBarrierReply
45124
46- // Queue configuration messages.
125+ // TypeQueueGetConfigRequest can be used by the controller to
126+ // query the state of queues associated with various ports on switch.
47127 TypeQueueGetConfigRequest
128+
129+ // TypeQueueGetConfigReply is a response from the switch to controller
130+ // on TypeQueueGetConfigReply messages.
48131 TypeQueueGetConfigReply
49132
50- // Controller role change request messages.
133+ // TypeRoleRequest is the message used by the controller to
134+ // modify its role among multiple controllers on a switch.
51135 TypeRoleRequest
136+
137+ // TypeRoleReply is a response from the switch to controller on
138+ // TypeRoleRequest.
52139 TypeRoleReply
53140
54- // Asynchronous message configuration.
55- TypeAsynchRequest
56- TypeAsyncReply
141+ // TypeGetAsyncRequest is used by the controller to request the switch
142+ // which asynchronous events are enabled on the switch for the
143+ // communication channel.
144+ TypeGetAsyncRequest
145+
146+ // TypeGetAsyncReply is used by the switch as response to controller
147+ // on TypeAsyncRequest messages.
148+ TypeGetAsyncReply
149+
150+ // TypeSetAsync is used by the controller to set which asynchronous
151+ // messages it should send, as well as to query the switch for which
152+ // asynchronous messages it will send.
57153 TypeSetAsync
58154
59- // Meters and rate limiters configuration messages .
155+ // TypeMeterMod used by the controller to modify the meter .
60156 TypeMeterMod
61157)
62158
159+ // Type is an OpenFlow message type.
63160type Type uint8
64161
65162func (t Type ) String () string {
@@ -98,8 +195,8 @@ var typeText = map[Type]string{
98195 TypeQueueGetConfigReply : "TypeQueueGetConfigReply" ,
99196 TypeRoleRequest : "TypeRoleRequest" ,
100197 TypeRoleReply : "TypeRoleReply" ,
101- TypeAsynchRequest : "TypeAsynchRequest " ,
102- TypeAsyncReply : "TypeAsyncReply " ,
198+ TypeGetAsyncRequest : "TypeGetAsyncRequest " ,
199+ TypeGetAsyncReply : "TypeGetAsyncReply " ,
103200 TypeSetAsync : "TypeSetAsync" ,
104201 TypeMeterMod : "TypeMeterMod" ,
105202}
@@ -122,11 +219,12 @@ type Header struct {
122219 Transaction uint32
123220}
124221
222+ // Copy returns a copy of the request header.
125223func (h * Header ) Copy () * Header {
126224 return & Header {h .Version , h .Type , h .Length , h .Transaction }
127225}
128226
129- // Length of the packet payload including header.
227+ // Len of the packet payload including header.
130228func (h * Header ) Len () int {
131229 return int (h .Length )
132230}
0 commit comments