cbench controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf ·...

28
Cbench Controller Fundamentals for designing a practical controller

Upload: others

Post on 13-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Cbench Controller

Fundamentals for designing a practical controller

Page 2: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

The 3 important messages of OpenFlow

FlowMod・PacketIn・PacketOut

Page 3: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Controller

192.168.0.1

00:00:..:01192.168.0.2

00:00:..:02host1 host2

Flow Table

Page 4: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Flow TableA kind of DB to manage rules/actions of processing packets

Very Slow (Software)

Fast(Hardware)

Hosts Switch

Flow table

Controller

Page 5: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Flow Entries

Match field Action Counter

Src IP address = 192.168.1.0 Forward packets to port 8 80

VLAN ID = 10 Forward packets to port 10 64

Src MAC address = 00:50:56:c0:00:08 Attach VLAN ID 2 to packets and forward them to port 8 24

Src IP address = 203.0.113.0/16 Discard packets 10

Packet conditions Transactions Number of Packets

Page 6: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

FlowMod

# add a flow entry

send_flow_mod_add(

dpid, # Switch ID

match: Match.new( … ) # Match field

actions: … # Action

)

Modify (add, replace, delete) flow entries

Page 7: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Match Field

Match field Action Counter

Src IP address = 192.168.1.0 Forward packets to port 8 80

VLAN ID = 10 Forward packets to port 10 64

Src MAC address = 00:50:56:c0:00:08 Attach VLAN ID 2 to packets and forward them to port 8 24

Src IP address = 203.0.113.0/16 Discard packets 10

Packet conditions Transactions Number of Packets

Page 8: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• Match packets coming from port 1

send_flow_mod_add( datapath_id, match: Match.new(in_port: 1) # …

Page 9: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• Match packets whose destination IP address and port number are 192.168.0.30 and 80, respectively.

send_flow_mod_add( datapath_id, match: Match.new( ip_destination_address: ’192.168.0.30’, transport_destination_port: 80 ) # …

Page 10: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Conditions for Match Field

•Ingress port

•Ether src

•Ether dst

•Ether type

•IP src

•IP dst

•IP proto

•IP ToS bits

•TCP/UCP src port

•TCP/UDP dst port

•VLAN id

•VLAN priority

Page 11: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• ExactMatch: match packets that is identical to“message”in terms of all the 12 conditions listed in the previous page

send_flow_mod_add(

datapath_id,

match: ExactMatch.new(message),

# …

)

Page 12: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

ActionActions for packets that match the match field

# Add a flow entry

send_flow_mod_add(

dpid, # Switch ID

match: Match.new( … ) # Match Field

actions: … # Action

)

Page 13: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Action

Match field Action Counter

Src IP address = 192.168.1.0 Forward packets to port 8 80

VLAN ID = 10 Forward packets to port 10 64

Src MAC address = 00:50:56:c0:00:08 Attach VLAN ID 2 to packets and forward them to port 8 24

Src IP address = 203.0.113.0/16 Discard packets 10

Page 14: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

ActionForwarding packets

• SendOutPort.new(Port ID)

Rewrite content in packet header (the same fields as the 12 header fields for match fields)

• SetEtherDestinationAddress.new(New destination MAC address)

• SetIpDestinationAddress.new(New destination IP address)

• Etc.

Page 15: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

1. Match: If packets come from port 1

2. Actions: Send packets out port 4

send_flow_mod_add( datapath_id, match: Match.new(in_port: 1), actions: SendOutPort.new(4), # …

Page 16: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• Multiple actions can be specified • e.g., rewrite two header fields, and then forward packets

send_flow_mod_add( datapath_id, match: Match.new(in_port: 1), actions: [SetEtherDestinationAddress.new(…), SetIpDestinationAddress.new(…), SendOutPort.new(4)] # …

Page 17: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

PacketInA message to notify a controller of arrivals of packets that does not match any match fields.

(i.e., a switch cannot determine how to process the packets)

Hosts Switch

Flow table

Controller

Page 18: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Controller

192.168.0.1

00:00:..:01192.168.0.2

00:00:..:02host1 host2

Flow Table

Page 19: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Controller

192.168.0.1

00:00:..:01192.168.0.2

00:00:..:02host1 host2

Flow TablePacket In

Arrival of an unknown packet

Page 20: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• A handler catch the PacketIn event

• message = PacketIn object

def packet_in(dpid, message)

# Inspect the message

# Do something

end

Page 21: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

PacketOutSend out packets

that trigger the PacketIn event

Hosts Switch

Flow table

Controller

PacketOut

Page 22: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Controller

192.168.0.1

00:00:..:01192.168.0.2

00:00:..:02host1 host2

Flow TablePacket In

Arrival of an unknown packet

Packet Out

Page 23: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• Send the packet triggers the PacketIn event from port 1 (without any modifications)

def packet_in(dpid, message)

send_packet_out(

datapath_id,

in_port: message.in_port,

raw_data: message.raw_data,

actions: SendOutPort.new(1)

)

Page 24: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• Flood the packet to all ports (except for the incoming port)

def packet_in(dpid, message)

send_packet_out(

datapath_id,

in_port: message.in_port,

raw_data: message.raw_data,

actions: SendOutPort.new(:flood)

)

Page 25: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

cbench

A (micro) benchmark tool for OpenFlow (controllers)

PacketIn

FlowMod

Switch

Flow table

Controller

Page 26: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Cbench

A (micro) benchmark tool for OpenFlow (controllers)

• Cbench connects to Trema (a controller), and then sends PacketIn messages to Trema

• Trema replies FlowMod messages and cbench measures the number of the FlowMod messages

• A better controller returns more messages than a poor one

Page 27: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

• The FlowMod message sent to cbench

send_flow_mod_add(

datapath_id,

match: ExactMatch.new(message),

buffer_id: message.buffer_id,

actions: SendOutPort.new(message.in_port + 1)

)

Page 28: Cbench Controller - handai-trema.github.iohandai-trema.github.io/deck/week2/cbench_english.pdf · Flow Table A kind of DB to manage rules/actions of processing packets Very Slow (Software)

Conclusion• The three fundamental messages of OpenFlow

• FlowMod

• PacketIn

• PacketOut

• Cbench is a benchmark tool for an OpenFlow controller

• Cbench sends PacketIn messages and measures the number of FlowMod replies from the controller