Openflow - Switch, Specifications and Working
Openflow - Switch, Specifications and Working
Data Plane
From Foundations of Modern Networking: SDN, NFV, QoE, IoT, and Cloud by William Stallings (0134175395)
Copyright © 2016 Pearson Education, Inc. All rights reserved.
Principle Functions of Network Device
Control Support Function
• Interacts with the SDN control layer to
support programmability via resource-control
interfaces.
• The switch communicates with the controller
and the controller manages the switch via the
OpenFlow switch protocol.
Data Forwarding Function
• Accepts incoming data flows from other
devices and forwards them along the data
forwarding paths established according to
the rules defined by the SDN applications.
OpenFlow Switch Context
From Foundations of Modern Networking: SDN, NFV, QoE, IoT, and Cloud by William Stallings (0134175395)
Copyright © 2016 Pearson Education, Inc. All rights reserved.
Types
A given OpenFlow switch implementation is
either OpenFlow-only or OpenFlow-hybrid.
An OpenFlow-only switch is one that forwards
packets only according to the OpenFlow logic
described above.
An OpenFlow hybrid is a switch that can also
switch packets in its legacy mode as an
Ethernet Switch or IP router.
A hybrid switch requires a preprocessing
classification mechanism that directs packets
to either OpenFlow processing or the
traditional packet processing.
OpenFlow V.1.0 switch
After a Match:
Fundamental Packet Paths
A match with a particular entry in that table,
the logic directs the now matched packet to
an action box on the right.
This action box has three fundamental
options for the disposition of this arriving
packet:
•
A: Forward the packet out a local port,
possibly modifying certain header fields first.
•
B: Drop the packet.
•
C: Pass the packet to the controller.
Packet to Controller
In the case of path C, the packet is passed
to the controller over the secure channel
shown in the figure.
If the controller has either a control
message or a data packet to give to the
switch, the controller uses this same
secure channel in the reverse direction.
Packet_Out
When the controller has a data packet to
forward out through the switch, it uses the
OpenFlow PACKET_OUT message.
Such a data packet coming from the
controller may take two different paths
through the OpenFlow logic, both denoted Y.
In the right side case, the controller directly
specifies the output port and the packet is
passed to port N.
In the left side path Y case, the controller
indicates that it wishes to defer the forwarding
decision to the packet matching logic.
OpenFlow Switch
From Foundations of Modern Networking: SDN, NFV, QoE, IoT, and Cloud by William Stallings (0134175395)
Copyright © 2016 Pearson Education, Inc. All rights reserved.
Basic Operation of An OpenFlow
Solution
1.The controller populates the switch with flow
table entries.
2.The switch evaluates the header(s) of
incoming packets and finds a matching flow,
then performs the associated action.
3.Depending on the match criteria, this
evaluation would begin with the layer two
header, and then potentially continue to the
layer three and even layer four headers in
some cases.
Basic Operation of An OpenFlow
Solution
4.If no match is found, the switch forwards the
packet to the controller for instructions on how
to deal with the packet.
5.Typically the controller will update the switch
with new flow entries as new packet patterns
are received, so that the switch can deal with
them locally.
6.It is also possible that the controller will
program wildcard rules that will govern many
flows at once.
IP Packet Header: Recap
0 4 8 16 19 24 31
Source IP Address
Destination IP Address
Options Padding
Internet header length (IHL): length of the header in 32-bit words. Minimum 20
bytes, Up to 40 bytes in options fields
Type of service (TOS): traditionally priority of packet at each router. Recent
Differentiated Services redefines TOS field to include other services besides best
effort.
Differentiated Services(DS)
• 8 bits to provide desired quality of service (QoS) to
packets depending upon traffic type.
• Leftmost 6 bit are used a codepoint (DSCP) to
select per-hop behavior (PHB), a packet
experience at each node.
• Remaining 2 bits on right are called explicit
congestion notification (ECN) field and are used to
indicate congestion in the network.
• 00: Non-ECN-capable transport-Non-ECT
• 10: ECN capable transport-ECT(0)
• 01: ECN capable transport-ECT(1)
• 11: Congestion encountered-CE
Openflow Context
• An SDN controller communicates with
OpenFlow-compatible switches using the
OpenFlow protocol running over Transport
Layer Security (TLS).
• Each switch connects to other OpenFlow
switches and, possibly, to end-user devices
that are the sources and destinations of
packet flows.
Openflow Context
• On the switch side, the interface is known as
an OpenFlow channel.
• These connections are via OpenFlow ports.
• An OpenFlow port also connects the switch
to the SDN controller.
Openflow Ports
1)Physical port: Corresponds to a hardware
interface of the switch.
2)Logical port: Does not correspond directly to
a hardware interface of the switch.
Logical ports may include packet
encapsulation and may map to various
physical ports.
3)Reserved port: Defined by the OpenFlow
specification.
Ports and Port Queues
Sophisticated switches support multiple
queues per physical port.
These queues are generally served by
scheduling algorithms that allow the
provisioning of different Quality of Service
(QoS) levels for different types of packets.
OpenFlow follows this concept and permits a
flow to be mapped to an already-defined
queue at an output port.
Openflow Support for Multiple
Queues Per Port
OpenFlow embraces this
concept and permits a
flow to be mapped to an
already-defined queue at
an output port.
Action box specifies how
to enqueue the packet
being processed a
particular queue on to a
port.
OpenFlow Table Entry Formats
From Foundations of Modern Networking: SDN, NFV, QoE, IoT, and Cloud by William Stallings (0134175395)
Copyright © 2016 Pearson Education, Inc. All rights reserved.
What is a flow?
A flow is a set of packets transferred from one
network endpoint (or set of endpoints) to
another endpoint (or set of endpoints).
The endpoints may be defined as IP address
TCP/UDP port pairs, VLAN endpoints, layer
three tunnel endpoints, and input port among
other things.
Flow
• From the point of view of an individual
switch, a flow is a sequence of packets that
matches a specific entry in a flow table.
• Flow is a function of the values of header
fields of the packets that constitute the flow,
and not a function of the path they follow
through the network.
• A combination of flow entries on multiple
switches defines a flow that is bound to a
specific path.
Flow Table: First Four Entries
• Match fields: Used to select packets that
match the values in the fields. Used as match
• criteria to determine if an incoming packet
matches this entry.
• Priority: Relative priority of table entries. 16-
bit field with 0 corresponding to the lowest
priority. In principle, there could be 216
priority levels.
• Counters: Updated for matching packets.
• Instructions: Instructions to be performed if a
match occurs.
Flow Table Entry: Timeout
• Timeouts: Maximum amount of idle time
before a flow is expired by the switch.
• Each flow entry has an idle_timeout and a
hard_timeout associated with it.
• A nonzero hard_timeout field causes the flow
entry to be removed after the given number of
seconds, regardless of how many packets it has
matched.
• A nonzero idle_timeout field causes the flow entry
to be removed when it has matched no packets in
the given number of seconds.
Flow Table Entry: Cookie
• Cookie: 64-bit opaque data value chosen by
the controller. It may be used by the
controller to filter flow statistics, flow
modification and flow deletion; not used
when processing packets.
• Flags: Flags alter the way flow entries are
managed; for example, the flag
OFPFF_SEND_FLOW_REM triggers flow
removed messages for that flow entry
Required OpenFlow Counters
Instructions Component
• The instructions component of a table entry
consists of a set of instructions that are
executed if the packet matches the entry.
• Actions describe packet forwarding, packet
modification, and group table processing
operations.
Openflow Actions
• Output: Forward packet to specified port.
• The port could be an output port to another
switch or the port to the controller.
• In the latter case, the packet is encapsulated
in a message to the controller.
Openflow Actions
• Set-Queue: Sets the queue ID for a packet.
• When the packet is forwarded to a port using
the output action, the queue ID determines
which queue attached to this port is used for
scheduling and forwarding the packet.
• Forwarding behavior is dictated by the
configuration of the queue and is used to
provide basic QoS support.
OpenFlow Actions
• Group: Process packet through specified
group.
• Push-Tag/Pop-Tag: Push or pop a tag field for
a VLAN or Multiprotocol Label Switching
(MPLS) packet.
• Set-Field: The various Set-Field actions are
identified by their field type and modify the
values of respective header fields in the
packet.
OpenFlow Actions
• Change-TTL: The various Change-TTL
actions modify the values of the IPv4 TTL,
IPv6 hop limit, or MPLS TTL in the packet.
• Drop: Packets whose action sets have no
output action should be dropped.
/* * Overridden IOFMessageListener's receive() function. */
@Override
public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext
cntx) {
switch (msg.getType()) {
case PACKET_IN: /* Retrieve the deserialized packet in message */
Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
/** Check the ethertype of the Ethernet frame and retrieve the
appropriate payload. EthType caches and reuses instances for valid
types. */
if (eth.getEtherType() == EthType.IPv4) {
/* We got an IPv4 packet; get the payload from Ethernet */
IPv4 ipv4 = (IPv4) eth.getPayload();