The Frenetic Network Controller Arjun Guha, Nate Foster, Mark - - PowerPoint PPT Presentation

the frenetic network controller
SMART_READER_LITE
LIVE PREVIEW

The Frenetic Network Controller Arjun Guha, Nate Foster, Mark - - PowerPoint PPT Presentation

The Frenetic Network Controller Arjun Guha, Nate Foster, Mark Reitblatt, Cole Schlesinger, and others: www.github.com/frenetic-lang/frenetic/contributors UMass Amherst Cornell Princeton 1 networks today hosts 2 networks today


slide-1
SLIDE 1

The Frenetic Network Controller

Arjun Guha, Nate Foster, Mark Reitblatt, Cole Schlesinger, and others:

1

www.github.com/frenetic-­‑lang/frenetic/contributors

UMass Amherst Cornell Princeton

slide-2
SLIDE 2

hosts

2

networks today

slide-3
SLIDE 3

switches hosts

2

networks today

slide-4
SLIDE 4

switches hosts servers

2

networks today

slide-5
SLIDE 5

switches routers hosts servers

2

networks today

slide-6
SLIDE 6

switches routers hosts servers firewalls

3

networks today

slide-7
SLIDE 7

switches routers hosts servers firewalls load balancers

4

networks today

slide-8
SLIDE 8

switches routers hosts servers firewalls load balancers wireless access points

4

networks today

slide-9
SLIDE 9

networks today

switches routers hosts servers firewalls load balancers wireless access points

wireless authentication server

5

slide-10
SLIDE 10

networks today

switches routers hosts servers firewalls load balancers wireless access points

wireless authentication server

Each box:

  • Runs specialized, vendor-

defined software

  • Configured independently via a

command-line interface Difficult to configure, difficult to reason about

5

slide-11
SLIDE 11

Service outage was due to a series of internal network events that corrupted router data tables A network change was […] executed incorrectly […] more “stuck” volumes and added more requests to the re-mirroring storm Experienced a network connectivity issue […] interrupted the airline's flight departures, airport processing and reservations systems

Recent Network Outages

We discovered a misconfiguration on this pair of switches that caused what's called a “bridge loop” in the network.

slide-12
SLIDE 12

7

software-defined networking (SDN)

slide-13
SLIDE 13 OpenFlow Switch OpenFlow Switch OpenFlow Switch OpenFlow Switch OpenFlow Switch OpenFlow Switch OpenFlow Switch OpenFlow Switch OpenFlow Switch

standardized, programmable network devices (“switches”)

7

software-defined networking (SDN)

slide-14
SLIDE 14

O p e n F l

  • w

S w i t c h O p e n F l

  • w

S w i t c h O p e n F l

  • w

S w i t c h

8

slide-15
SLIDE 15

Key Features and Advantages of SDN

  • Standardized, programmable network devices

easy to deploy new in-network features

O p e n F l

  • w

S w i t c h O p e n F l

  • w

S w i t c h O p e n F l

  • w

S w i t c h

8

slide-16
SLIDE 16

Key Features and Advantages of SDN

  • Standardized, programmable network devices

easy to deploy new in-network features

  • Logically centralized controller (beefy server)

enables reasoning about whole-network behavior

O p e n F l

  • w

S w i t c h

Controller

O p e n F l

  • w

S w i t c h O p e n F l

  • w

S w i t c h

8

f : switch ⨉ port ⨉ packet ➞ { (port1,packet1), ..., (portn, packetn) }

slide-17
SLIDE 17

Lots of SDN Interest

  • By startups and established players

can buy commercial hardware and software

  • 200+ attendees at HotSDN ’13
  • Six (out of 40) papers at SIGCOMM’13 on SDN

9

slide-18
SLIDE 18

10

industry-standard SDN protocol

slide-19
SLIDE 19

10

industry-standard SDN protocol

Java

slide-20
SLIDE 20

10

industry-standard SDN protocol

Java C++ Python

slide-21
SLIDE 21

10

industry-standard SDN protocol

Java C++ Python Haskell

slide-22
SLIDE 22

10

industry-standard SDN protocol

Java C++ Python Haskell OCaml

slide-23
SLIDE 23

11

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

Example

slide-24
SLIDE 24

11

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

Example

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡actions ¡= ¡ ¡ ¡ ¡ ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡ ¡ ¡ ¡ ¡ ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡actions ¡}

slide-25
SLIDE 25

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡actions ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡ ¡ ¡ ¡ ¡ ¡ ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡actions ¡}

12

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

Example

slide-26
SLIDE 26

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡actions ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡ ¡ ¡ ¡ ¡ ¡ ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡actions ¡}

12

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

Example

slide-27
SLIDE 27

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡actions ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡ ¡ ¡ ¡ ¡ ¡ ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡actions ¡}

12

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

Generic packet parser

Example

slide-28
SLIDE 28

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡actions ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡ ¡ ¡ ¡ ¡ ¡ ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡actions ¡}

12

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

OpenFlow protocol parser Generic packet parser

Example

slide-29
SLIDE 29

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡actions ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡ ¡ ¡ ¡ ¡ ¡ ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡actions ¡}

12

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

OpenFlow protocol parser Generic packet parser Runtime system to manage connections to switches

Example

slide-30
SLIDE 30

13

  • caml-packet
slide-31
SLIDE 31

13

  • caml-packet
  • Serialization / deserialization for several packet formats

TCP, IP, ARP, ICMP, Ethernet, 802.1Q

slide-32
SLIDE 32

13

  • caml-packet
  • Serialization / deserialization for several packet formats

TCP, IP, ARP, ICMP, Ethernet, 802.1Q

  • Only depends on cstruct

by Anil Madhavapeddy et al.

slide-33
SLIDE 33

13

  • caml-packet
  • Serialization / deserialization for several packet formats

TCP, IP, ARP, ICMP, Ethernet, 802.1Q

  • Only depends on cstruct

by Anil Madhavapeddy et al.

¡ ¡cstruct ¡ip ¡{ ¡ ¡ ¡ ¡ ¡uint8_t ¡vhl; ¡ ¡ ¡ ¡uint8_t ¡tos; ¡ ¡ ¡ ¡ ¡uint16_t ¡len; ¡ ¡ ¡ ¡uint16_t ¡ident; ¡ ¡ ¡ ¡uint16_t ¡frag; ¡ ¡ ¡ ¡uint8_t ¡ttl; ¡ ¡ ¡ ¡uint8_t ¡proto; ¡ ¡ ¡ ¡uint16_t ¡chksum; ¡ ¡ ¡ ¡uint32_t ¡src; ¡ ¡ ¡ ¡uint32_t ¡dst; ¡ ¡ ¡ ¡uint32_t ¡options ¡ ¡} ¡as ¡big_endian

slide-34
SLIDE 34

13

  • caml-packet
  • Serialization / deserialization for several packet formats

TCP, IP, ARP, ICMP, Ethernet, 802.1Q

  • Only depends on cstruct

by Anil Madhavapeddy et al.

¡ ¡cstruct ¡ip ¡{ ¡ ¡ ¡ ¡ ¡uint8_t ¡vhl; ¡ ¡ ¡ ¡uint8_t ¡tos; ¡ ¡ ¡ ¡ ¡uint16_t ¡len; ¡ ¡ ¡ ¡uint16_t ¡ident; ¡ ¡ ¡ ¡uint16_t ¡frag; ¡ ¡ ¡ ¡uint8_t ¡ttl; ¡ ¡ ¡ ¡uint8_t ¡proto; ¡ ¡ ¡ ¡uint16_t ¡chksum; ¡ ¡ ¡ ¡uint32_t ¡src; ¡ ¡ ¡ ¡uint32_t ¡dst; ¡ ¡ ¡ ¡uint32_t ¡options ¡ ¡} ¡as ¡big_endian

network byte order for free

slide-35
SLIDE 35
  • caml-openflow

14

slide-36
SLIDE 36
  • caml-openflow

14

  • Serialization for OpenFlow 1.0 and 1.3
  • OpenFlow 1.0 support based on mirage-openflow, using ideas from

Nettle (Haskell)

  • OpenFlow 1.3 is less complete, but still usable
  • Cstruct-based serialization
slide-37
SLIDE 37
  • caml-openflow

14

  • Serialization for OpenFlow 1.0 and 1.3
  • OpenFlow 1.0 support based on mirage-openflow, using ideas from

Nettle (Haskell)

  • OpenFlow 1.3 is less complete, but still usable
  • Cstruct-based serialization
  • Runtime systems for OpenFlow 1.0 and 1.3
  • Listens for TCP connections from switches
  • Does the OpenFlow handshake, keeps connections to switches alive
slide-38
SLIDE 38
  • caml-openflow

14

  • Serialization for OpenFlow 1.0 and 1.3
  • OpenFlow 1.0 support based on mirage-openflow, using ideas from

Nettle (Haskell)

  • OpenFlow 1.3 is less complete, but still usable
  • Cstruct-based serialization
  • Runtime systems for OpenFlow 1.0 and 1.3
  • Listens for TCP connections from switches
  • Does the OpenFlow handshake, keeps connections to switches alive

type ¡t ¡(* ¡A ¡handle ¡to ¡an ¡OpenFlow ¡switch. ¡*) val ¡connect ¡: ¡Lwt_unix.file_descr ¡-­‑> ¡t ¡option ¡Lwt.t val ¡send ¡: ¡t ¡-­‑> ¡xid ¡-­‑> ¡message ¡-­‑> ¡unit ¡Lwt.t val ¡recv ¡: ¡t ¡-­‑> ¡(xid ¡* ¡message) ¡Lwt.t val ¡disconnect ¡: ¡t ¡-­‑> ¡unit ¡Lwt.t val ¡wait_disconnect ¡: ¡t ¡-­‑> ¡unit ¡Lwt.t

slide-39
SLIDE 39
  • caml-openflow

14

  • Serialization for OpenFlow 1.0 and 1.3
  • OpenFlow 1.0 support based on mirage-openflow, using ideas from

Nettle (Haskell)

  • OpenFlow 1.3 is less complete, but still usable
  • Cstruct-based serialization
  • Runtime systems for OpenFlow 1.0 and 1.3
  • Listens for TCP connections from switches
  • Does the OpenFlow handshake, keeps connections to switches alive

type ¡t ¡(* ¡A ¡handle ¡to ¡an ¡OpenFlow ¡switch. ¡*) val ¡connect ¡: ¡Lwt_unix.file_descr ¡-­‑> ¡t ¡option ¡Lwt.t val ¡send ¡: ¡t ¡-­‑> ¡xid ¡-­‑> ¡message ¡-­‑> ¡unit ¡Lwt.t val ¡recv ¡: ¡t ¡-­‑> ¡(xid ¡* ¡message) ¡Lwt.t val ¡disconnect ¡: ¡t ¡-­‑> ¡unit ¡Lwt.t val ¡wait_disconnect ¡: ¡t ¡-­‑> ¡unit ¡Lwt.t

slide-40
SLIDE 40

OX

15

slide-41
SLIDE 41

OX

15

  • Based on popular OpenFlow platforms
  • Inspired by POX (Python) and NOX (Python/C++)
slide-42
SLIDE 42

OX

15

  • Based on popular OpenFlow platforms
  • Inspired by POX (Python) and NOX (Python/C++)
  • Simple, single-threaded OpenFlow interface
  • Uses LWT and ocaml-openflow internally
slide-43
SLIDE 43

OX

15

  • Based on popular OpenFlow platforms
  • Inspired by POX (Python) and NOX (Python/C++)
  • Simple, single-threaded OpenFlow interface
  • Uses LWT and ocaml-openflow internally
  • caml-openflow
  • caml-packet

OX cstruct LWT Advanced Controllers e.g., Frenetic, HotSwap Simple Controllers e.g., our OpenFlow tutorial

slide-44
SLIDE 44

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡action ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡action ¡}

16

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch
slide-45
SLIDE 45

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡action ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡action ¡}

16

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

let ¡switch_connected ¡(sw ¡: ¡switchId) ¡: ¡unit ¡= ¡ ¡send_flow_mod ¡sw ¡0l ¡(add_flow ¡200 ¡match_ssh_src ¡[]); ¡ ¡send_flow_mod ¡sw ¡0l ¡(add_flow ¡200 ¡match_ssh_dst ¡[]); ¡ ¡send_flow_mod ¡sw ¡0l ¡ ¡ ¡ ¡ ¡(add_flow ¡199 ¡match_from_1 ¡[Output ¡(PhysicalPort ¡1)]); ¡ ¡send_flow_mod ¡sw ¡0l ¡ ¡ ¡ ¡(add_flow ¡198 ¡match_from_2 ¡[Output ¡(PhysicalPort ¡2)]); ¡ ¡send_flow_mod ¡sw ¡0l ¡(add_flow ¡197 ¡match_all ¡[])

slide-46
SLIDE 46

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡action ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡action ¡}

16

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

Priority Pattern Actions 200 dlType:0x800, nwProto: 6, tpSrc: 22 drop 200 dlType:0x800, nwProto: 6, tpDst: 22 drop 199 inPort: 1 Fwd 2 198 inPort: 2 Fwd 1

slide-47
SLIDE 47

16

Controller Host 1 Host 2 Port 1 Port 2

Controller OpenFlow Switch

let ¡packet_in ¡(sw ¡: ¡switchId) ¡(xid ¡: ¡xid) ¡(pktIn ¡: ¡packetIn) ¡: ¡unit ¡= ¡ ¡let ¡pk ¡= ¡parse_payload ¡pktIn.input_payload ¡in ¡ ¡let ¡action ¡= ¡ ¡ ¡ ¡ ¡if ¡Packet.dlTyp ¡pk ¡= ¡0x800 ¡&& ¡Packet.nwProto ¡= ¡6 ¡&& ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡(Packet.tpDst ¡= ¡22 ¡|| ¡Packet.tpSrc ¡= ¡22) ¡then ¡ ¡ ¡ ¡ ¡ ¡[] ¡(* ¡no ¡action ¡(i.e., ¡drop) ¡SSH ¡packets ¡*) ¡ ¡ ¡ ¡else ¡if ¡pktIn.port ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡2)] ¡ ¡ ¡ ¡else ¡ ¡ ¡ ¡ ¡ ¡[Output ¡(PhysicalPort ¡1)] ¡in ¡ ¡send_packet_out ¡sw ¡0l ¡ ¡ ¡ ¡{ ¡output_payload ¡= ¡pktIn.input_payload; ¡port_id ¡= ¡None; ¡ ¡ ¡ ¡ ¡ ¡ ¡apply_actions ¡= ¡action ¡}

Priority Pattern Actions 200 dlType:0x800, nwProto: 6, tpSrc: 22 drop 200 dlType:0x800, nwProto: 6, tpDst: 22 drop 199 inPort: 1 Fwd 2 198 inPort: 2 Fwd 1

slide-48
SLIDE 48

17

Priority Pattern Actions 65535 SSH Monitor

+

Priority Pattern Actions 65535 dstIP: H1 Forward

Monsanto et al., POPL 2012

slide-49
SLIDE 49

17

Priority Pattern Actions 65535 SSH Monitor

+

Priority Pattern Actions 65535 dstIP: H1 Forward Priority Pattern Actions 65535 SSH, dstIP: H1 Forward, Monitor 65534 dstIP: H1 Forward 65533 SSH Monitor

Monsanto et al., POPL 2012

slide-50
SLIDE 50

17

Priority Pattern Actions 65535 SSH Monitor

+

Priority Pattern Actions 65535 dstIP: H1 Forward Priority Pattern Actions 65535 SSH, dstIP: H1 Forward, Monitor 65534 dstIP: H1 Forward 65533 SSH Monitor

Monsanto et al., POPL 2012

  • Other issues:
  • Well-formedness criteria on patterns; rules applied non-deterministically

in certain situations (Guha et al., PLDI 2013)

  • Cannot atomically update all switches (Rietblatt et al., SIGCOMM 2012)
slide-51
SLIDE 51

18

slide-52
SLIDE 52

18

  • DSL for programming OpenFlow networks
  • Boolean predicates to match packets
  • Several policy composition operators
  • All compile to OpenFlow tables
  • Abstractions address several fundamental problems of SDN
slide-53
SLIDE 53

18

  • DSL for programming OpenFlow networks
  • Boolean predicates to match packets
  • Several policy composition operators
  • All compile to OpenFlow tables
  • Abstractions address several fundamental problems of SDN
  • Embedded in OCaml
  • Access to standard OCaml data structures and functions
  • Must use LWT for concurrency
slide-54
SLIDE 54

18

  • DSL for programming OpenFlow networks
  • Boolean predicates to match packets
  • Several policy composition operators
  • All compile to OpenFlow tables
  • Abstractions address several fundamental problems of SDN
  • Embedded in OCaml
  • Access to standard OCaml data structures and functions
  • Must use LWT for concurrency
  • Surface syntax

if ¡tpSrc ¡= ¡22 ¡|| ¡tpDst ¡= ¡22 ¡then ¡ ¡ ¡ ¡drop ¡ ¡else ¡if ¡inPort ¡= ¡1 ¡then ¡ ¡ ¡ ¡fwd(2) ¡ ¡else ¡ ¡ ¡ ¡fwd(1)

slide-55
SLIDE 55

19

slide-56
SLIDE 56

19

  • Implements key ideas from several published papers
  • ICFP’11, POPL’12, SIGCOMM’11, PLDI’13, HotSDN’12, HotSDN’13
  • Open source development of current work
slide-57
SLIDE 57

19

  • Implements key ideas from several published papers
  • ICFP’11, POPL’12, SIGCOMM’11, PLDI’13, HotSDN’12, HotSDN’13
  • Open source development of current work
  • Frenetic and OpenFlow tutorial in OCaml
slide-58
SLIDE 58

From Haskell to OCaml :)

20

slide-59
SLIDE 59

From Haskell to OCaml :)

20

  • Core compiler and runtime system done in Coq
  • Extracting to Haskell is much more painful
  • Haskell extraction made us abandon some Coq functors
slide-60
SLIDE 60

From Haskell to OCaml :)

20

  • Core compiler and runtime system done in Coq
  • Extracting to Haskell is much more painful
  • Haskell extraction made us abandon some Coq functors
  • Functors helped us discover key algebraic properties
  • Helped establish connection to Kleene Algebra with Tests (KAT)
  • Basis of a paper in submission
slide-61
SLIDE 61

From Haskell to OCaml :)

20

  • Core compiler and runtime system done in Coq
  • Extracting to Haskell is much more painful
  • Haskell extraction made us abandon some Coq functors
  • Functors helped us discover key algebraic properties
  • Helped establish connection to Kleene Algebra with Tests (KAT)
  • Basis of a paper in submission
  • Easier for our networking collaborators to grok OCaml
  • Design discussions over .mli files with networking collaborators
slide-62
SLIDE 62

From Haskell to OCaml :)

20

  • Core compiler and runtime system done in Coq
  • Extracting to Haskell is much more painful
  • Haskell extraction made us abandon some Coq functors
  • Functors helped us discover key algebraic properties
  • Helped establish connection to Kleene Algebra with Tests (KAT)
  • Basis of a paper in submission
  • Easier for our networking collaborators to grok OCaml
  • Design discussions over .mli files with networking collaborators
  • OPAM and oasis are great
  • All our packages are on OPAM
  • OPAM overlays provide stability
slide-63
SLIDE 63

From Haskell to OCaml :(

21

slide-64
SLIDE 64

From Haskell to OCaml :(

21

  • Lwt programming is mind-boggling for beginners
  • Syntax extension helps a lot
  • E.g., very difficult to reason about exceptions
slide-65
SLIDE 65

From Haskell to OCaml :(

21

  • Lwt programming is mind-boggling for beginners
  • Syntax extension helps a lot
  • E.g., very difficult to reason about exceptions
  • No more multicore
  • Needed for large networks (Voellmy et al. at Haskell ’13)
  • Needed to compile fast-changing policies (Ferguson et al. at SIGCOMM’13)
slide-66
SLIDE 66

22

Hack your Network in OCaml

Frenetic

slide-67
SLIDE 67

Hack at any layer

  • Packet serialization
  • OpenFlow serialization
  • Ox controller
  • Frenetic

22

Hack your Network in OCaml

Frenetic

slide-68
SLIDE 68

Hack at any layer

  • Packet serialization
  • OpenFlow serialization
  • Ox controller
  • Frenetic

22

Hack your Network in OCaml

Frenetic

Ongoing work in OCaml

  • Network Hypervisor

Laurent Vanbever, et al.

  • Datalog-based SDN language

Tim Nelson, et al.

  • Fault Tolerant Frenetic

Mark Reitblatt, et al.

  • Property-checking Frenetic

Rebecca Coombes, Matthew Milano, et al.