software defined networking coms 6998-10, fall 2014

86
Software Defined Networking COMS 6998-10, Fall 2014 Instructor: Li Erran Li ([email protected]) http://www.cs.columbia.edu/~li erranli/coms6998-10SDNFall2014 / 10/6/2014: SDN Verification

Upload: mackensie-acosta

Post on 03-Jan-2016

47 views

Category:

Documents


0 download

DESCRIPTION

Software Defined Networking COMS 6998-10, Fall 2014. Instructor: Li Erran Li ( [email protected] ) http://www.cs.columbia.edu/~lierranli/coms6998-10SDNFall2014/ 10/6/2014: SDN Verification. Outline. Review of previous lecture on SDN programming language - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Software Defined Networking COMS 6998-10, Fall 2014

Software Defined NetworkingCOMS 6998-10, Fall 2014

Instructor: Li Erran Li ([email protected])

http://www.cs.columbia.edu/~lierranli/coms6998-10SDNFall2014/

10/6/2014: SDN Verification

Page 2: Software Defined Networking COMS 6998-10, Fall 2014

Outline

• Review of previous lecture on SDN programming language– Maple: generic programming language syntax such as

Java, Python– Frenetic NetCore/NetKAT: domain specific

programming language• SDN Verification– Verification of network properties– Verification of controller correctness– Verification of software data plane

10/6/14 Software Defined Networking (COMS 6998-10) 2

Page 3: Software Defined Networking COMS 6998-10, Fall 2014

Review of Previous Lecture

What is algorithmic policies• Function in a general purpose language that describes

how a packet should be routed, not how flow tables are configured.

• Conceptually invoked on every packet entering the network; may also access network environment state; hence it has the form:

• Written in a familiar language such as Java, Python, or Haskell

10/6/14 Software Defined Networking (COMS 6998-10) 3Source: Andreas Voellmy, Yale

Page 4: Software Defined Networking COMS 6998-10, Fall 2014

Example Algorithmic Policy in Java

if (p.tcpDstIs(22)) return null(); else { Location sloc = e.location(p.ethSrc()); Location dloc = e.location(p.ethDst()); Path path =shortestPath(e.links(),sloc,dloc); if (p.ethDstIs(2)) return null();

else return unicast(sloc,dloc,path); }}

Does not specify flow table configutation

10/6/14 Software Defined Networking (COMS 6998-10) 4Source: Andreas Voellmy, Yale

Review of Previous Lecture (Cont’d)

Page 5: Software Defined Networking COMS 6998-10, Fall 2014

Route f(Packet p, Env e) {

if (p.tcpDstIs(22))

return null();

else {

Location dloc = e.location(p.ethDst());

Location sloc = e.location(p.ethSrc());

Path path = shortestPath( e.links(),sloc,dloc);

if (p.ethDstIs(2)) return null();

else return unicast(sloc,dloc,path); }}

EthDest:1,TcpDst:80

Assert(TcpDst,22)

false

Read(EthDst)

Read(EthSrc)

path1

4

6

Policy

5Source: Andreas Voellmy, Yale10/6/14 Software Defined Networking (COMS 6998-10)

Page 6: Software Defined Networking COMS 6998-10, Fall 2014

EthDst:1,TcpDst:22

4

6

?

true

null

true

Assert(TcpDst,22)

Policy Trace Tree

false

Route f(Packet p, Env e) {

if (p.tcpDstIs(22))

return null();

else { Location dloc = e.location(p.ethDst());

Location sloc = e.location(p.ethSrc());

Path path = shortestPath( e.links(),sloc,dloc);

if (p.ethDstIs(2)) return null();

else return unicast(sloc,dloc,path); }}

Assert(TcpDst,22)

Read(EthDst)

Read(EthSrc)

path1

6Source: Andreas Voellmy, Yale10/6/14 Software Defined Networking (COMS 6998-10)

Page 7: Software Defined Networking COMS 6998-10, Fall 2014

Compile recorded executions into flow table

tcpDst==22

False

ethDst

2

drop

4

port 30

ethSrc

6

drop

True

match:{tcpDst==22}

action:ToController

match:{ethDst:4,ethSrc:6}action:[port 30]

Priority

barrier rule:

1

2

3

7Source: Andreas Voellmy, Yale10/6/14 Software Defined Networking (COMS 6998-10)

Review of Previous Lecture (Cont’d)

Page 8: Software Defined Networking COMS 6998-10, Fall 2014

Basic compilation: in-order traversal & barrier rulesNegative branch first!

accumulated match: {}

{tcpDst:22}

(prio:3,{tcpDst:22},action:drop)

{}

{ethDst:2}{ethDst:4}

{ethDst:4,ethSrc:6}

(prio:0,{ethDst:4, ethSrc:6},action:[port 30])

(prio:1,{ethDst:2},action:drop)

(prio:2,{tcpDst:22},action:ToController)

Priority := 0Priority := 1Priority := 2Priority := 3

barrier rule:

tcpDst==22

ethDst

2

null

4

port 30

6

null

True

ethSrc

False

8Source: Andreas Voellmy, Yale10/6/14 Software Defined Networking (COMS 6998-10)

Review of Previous Lecture (Cont’d)

Page 9: Software Defined Networking COMS 6998-10, Fall 2014

Modular programming abstraction

Design languages based on modular programming abstractions, and engineer efficient implementations using a compiler and run-time system

Compiler + Run-Time System

Controller Platform

Monitor Route Load Balance Firewall

9Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Review of Previous Lecture (Cont’d)

Page 10: Software Defined Networking COMS 6998-10, Fall 2014

Parallel Composition

Controller Platform

Monitor Route

Pattern Actionsdstip=3.4.5.6 Fwd 1

dstip=6.7.8.9 Fwd 2

Pattern Actionssrcip=1.2.3.4 Count

+

Pattern Actionssrcip=1.2.3.4, dstip=3.4.5.6 Fwd 1, Count

srcip=1.2.3.4, dstip=6.7.8.9 Fwd 2, Count

srcip=1.2.3.4 Count

dstip=3.4.5.6 Fwd 1

dstip=6.7.8.9 Fwd 210

Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Review of Previous Lecture (Cont’d)

Page 11: Software Defined Networking COMS 6998-10, Fall 2014

Sequential Composition

Controller Platform

Load Balance Route

Pattern Actionsdstip=10.0.0.1 Fwd 1

dstip=10.0.0.2 Fwd 2

Pattern Actionssrcip=*0 dstip:=10.0.0.1

srcip=*1 dstip:=10.0.0.2

;

Pattern Actionssrcip=*0 dstip:=10.0.0.1, Fwd 1

srcip=*1 dstip:=10.0.0.2, Fwd 2

11Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Review of Previous Lecture (Cont’d)

Page 12: Software Defined Networking COMS 6998-10, Fall 2014

Outline

• Review of previous lecture on SDN programming language– Maple: generic programming language syntax such as

Java, Python– Frenetic NetCore/NetKAT: domain specific

programming language• SDN Verification– Verification of network properties– Verification of controller correctness– Verification of software data plane

10/6/14 Software Defined Networking (COMS 6998-10) 12

Page 13: Software Defined Networking COMS 6998-10, Fall 2014

Verification of Network Properties

10/6/14 Software Defined Networking (COMS 6998-10) 13Source: P. Kazemian, Stanford

• Motivations• NetPlumber: Real time policy checking tool– How it works– How to check policy– How to parallelize

• Evaluation on Google WAN• Conclusions

Page 14: Software Defined Networking COMS 6998-10, Fall 2014

Network debugging is hard!

• Forwarding state is hard to analyze!

14

...

RuleRule

Rule

...

RuleRule

...

RuleRule

Rule

Rule

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 15: Software Defined Networking COMS 6998-10, Fall 2014

Network debugging is hard!

• Forwarding state is hard to analyze!1. Distributed across multiple tables and boxes2. Written to network by multiple independent

writers (different protocols, network admins)3. Presented in different formats by vendors4. Not directly observable or controllable

• Not constructed in a way that lend itself well to checking and verification

1510/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 16: Software Defined Networking COMS 6998-10, Fall 2014

Header Space Analysis: Snapshot-based Checking

TA

TB

TD

TC

a

bCan host a talk to host b?

Is there any forwarding loop in the network?

10/6/14 Software Defined Networking (COMS 6998-10) 16Source: P. Kazemian, Stanford

Page 17: Software Defined Networking COMS 6998-10, Fall 2014

Real-Time Incremental Checking

+ - +-

Time

10/6/14 Software Defined Networking (COMS 6998-10) 17Source: P. Kazemian, Stanford

Page 18: Software Defined Networking COMS 6998-10, Fall 2014

Real-Time Incremental Checking

+-

+

-

?

Set of Policies/Invariants

Yes/No

Time

Prevent errors before they hit networkReport a violation as soon as it happens

10/6/14 Software Defined Networking (COMS 6998-10) 18Source: P. Kazemian, Stanford

Page 19: Software Defined Networking COMS 6998-10, Fall 2014

Verification of Network Properties

• Motivations• NetPlumber: Real time policy checking tool– How it works– How to check policy– How to parallelize

• Evaluation on Google WAN• Conclusions

1910/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 20: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber

20

Controller

App App App App

NetPlumber

• The System for real time policy checking is called NetPlumber

State updatesLogically centralized location to observe the state changesSNMP Trap

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 21: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber

• The System we build for real time policy checking is called NetPlumber– Creates a dependency graph of all forwarding

rules in the network and uses it to verify policy– Nodes: forwarding rules in the network– Directed Edges: next hop dependency of rules

21

R1 R2

Switch 1 Switch 2

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 22: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber – Nodes and Edges

22

S

S

0 1 X X

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

1 0 0 1

1 0 X X

Page 23: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber – Intra table dependency

23

S

S

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 24: Software Defined Networking COMS 6998-10, Fall 2014

ProbeNode

NetPlumber – Computing Reachability

24

S

S

A

B

?

SourceNode

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 25: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber – Computing Reachability with Updates

25

S

S

A

B

?

SourceNode

1) Create directed edges

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

New rules installed

Page 26: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber – Computing Reachabilitywith Updates

26

S

S

A

B

?

SourceNode

-

1) Create directed edges2) Route flows 3) Update intra-table dependency

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 27: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber – Checking Policy

27

S

S

A

B

?

SourceNode

Policy: packets go through RED box. 10/6/14

Software Defined Networking (COMS 6998-10)

1) Back-tracing to check if 0010 packets go through RED box

Page 28: Software Defined Networking COMS 6998-10, Fall 2014

NetPlumber – Checking Policy

28

S

S

A

B

?

SourceNode

Policy: packets go through RED box. 10/6/14

Software Defined Networking (COMS 6998-10)

1) Back-tracing to check if 0010 packets go through RED box

2) Update policy checking with rule deletion

Page 29: Software Defined Networking COMS 6998-10, Fall 2014

Checking Policy with NetPlumber

29

...

...

...

......

...

...

...

Policy: Guests can not access Server S.

S

?

G1

G2

10/6/14 Software Defined Networking (COMS 6998-10)

Page 30: Software Defined Networking COMS 6998-10, Fall 2014

Checking Policy with NetPlumber

30

...

...

...

......

...

...

...

Policy: http traffic from client C to server S doesn’t go through more than 4 hops.

C

?

S

HTTP

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 31: Software Defined Networking COMS 6998-10, Fall 2014

Checking Policy with NetPlumber

31

...

...

...

......

...

...

...

Policy: traffic from client C to server S should go through middle box M.

C

?

S

M

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 32: Software Defined Networking COMS 6998-10, Fall 2014

Why the dependency graph helps

• Incremental update– Only have to trace through dependency sub-graph

affected by an update• Flexible policy expression– Probe and source nodes are flexible to place and

configure• Parallelization– Can partition dependency graph into clusters to

minimize inter-cluster dependences

3210/6/14 Software Defined Networking (COMS 6998-10)

Page 33: Software Defined Networking COMS 6998-10, Fall 2014

Distributed NetPlumber

33

S

?

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 34: Software Defined Networking COMS 6998-10, Fall 2014

Dependency Graph Clustering

34

S

?

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 35: Software Defined Networking COMS 6998-10, Fall 2014

?

35

?

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 36: Software Defined Networking COMS 6998-10, Fall 2014

Verification of Network Properties

• Motivations• NetPlumber: Real time policy checking tool– How it works– How to check policy– How to parallelize

• Evaluation on Google WAN• Conclusions

10/6/14 Software Defined Networking (COMS 6998-10) 36Source: P. Kazemian, Stanford

Page 37: Software Defined Networking COMS 6998-10, Fall 2014

Experiment On Google WAN

• Google Inter-datacenter WAN.– Largest deployed SDN, running OpenFlow– ~143,000 OF rules

3710/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 38: Software Defined Networking COMS 6998-10, Fall 2014

Experiment On Google WAN

• Policy check: all 52 edge switches can talk to each other

• More than 2500 pairwise reachability check

• Used two snapshots taken 6 weeks apart

• Used the first snapshot to create initial NetPlumber state and used the diff as a sequential update

3810/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 39: Software Defined Networking COMS 6998-10, Fall 2014

Experiment On Google WAN

39

Default/Aggregate Rules

Not much more benefit!

Run time with Hassel > 100s

10/6/14 Software Defined Networking (COMS 6998-10) Source: P. Kazemian, Stanford

Page 40: Software Defined Networking COMS 6998-10, Fall 2014

Conclusions

• Designed a protocol-independent system for real time network policy checking

• Key component: dependency graph of forwarding rule, capturing all flow paths– Incremental update– Flexible policy expressions– Parallelization by clustering

10/6/14 Software Defined Networking (COMS 6998-10) 40

Page 41: Software Defined Networking COMS 6998-10, Fall 2014

Outline

• Review of previous lecture on SDN programming language– Maple: generic programming language syntax such as

Java, Python– Frenetic NetCore/NetKAT: domain specific

programming language• SDN Verification– Verification of network properties– Verification of controller correctness– Verification of software data plane

10/6/14 Software Defined Networking (COMS 6998-10) 41

Page 42: Software Defined Networking COMS 6998-10, Fall 2014

Machine-Verified Controllers

42Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 43: Software Defined Networking COMS 6998-10, Fall 2014

Inductive pred : Type :=  | OnSwitch : Switch -> pred  | InPort : Port -> pred  | DlSrc : EthernetAddress -> pred  | DlDst : EthernetAddress -> pred  | DlVlan : option VLAN -> pred | ...   | And : pred -> pred -> pred  | Or : pred -> pred -> pred  | Not : pred -> pred  | All : pred  | None : pred

Inductive act : Type :=  | ForwardMod : Mod -> PseudoPort -> act | ...

Inductive pol : Type :=  | Policy : pred -> list act -> pol  | Union : pol -> pol -> pol  | Restrict : pol -> pred -> pol | ...

Certified Software Systems

Recent successes•seL4 [SOSP ’09]•CompCert [CACM ’09]•F* [ICFP ’11, POPL ’12, ’13]

Tools

Textbooks

Certified Programming with Dependent Types

Write code

 Lemma inter_wildcard_other : forall x,    Wildcard_inter WildcardAll x = x.  Proof.    intros; destruct x; auto.  Qed.    Lemma inter_wildcard_other1 : forall x,    Wildcard_inter x WildcardAll = x.  Proof.    intros; destruct x; auto.  Qed.    Lemma inter_exact_same : forall x,    Wildcard_inter (WildcardExact x) (WildcardExact x) = WildcardExact x.  Proof.    intros.    unfold Wildcard_inter. destruct (eqdec x x); intuition.   Qed.

Prove correct

Extract code

(** val handle_event : event -> unit Monad.m **) let handle_event = function | SwitchConnected swId -> handle_switch_connected swId | SwitchDisconnected swId -> handle_switch_disconnected swId | SwitchMessage (swId, xid0, msg) -> (match msg with | PacketInMsg pktIn -> handle_packet_in swId pktIn | _ -> Monad.ret ()) (** val main : unit Monad.m **) let main = Monad.forever (Monad.bind Monad.recv (fun evt -> handle_event evt))

Certifiedbinary

43Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 44: Software Defined Networking COMS 6998-10, Fall 2014

NetKAT

Flow tables

OpenFlow messages

Compiler

Run-time system

Optimizer

•Each level of abstraction formalized in Coq

•Machine-checked proofs that the transformations between levels preserve semantics

•Code extracted to OCaml and deployed with real switch hardware

Certified NetKAT Controller

44Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 45: Software Defined Networking COMS 6998-10, Fall 2014

NetKAT Compiler

Correctness Theorem

Overview•Compiler: maps NetKAT programs to flow tables

•Optimizer: eliminates “empty” and “shadowed” rules

Formalization Highlights

•Library of algebraic properties of flow tables

•New tactic for proving equalities on bags

•Key invariant: all packet patterns “natural”

Theorem compile_correct : forall opt pol sw pt pk bufId, SemanticsPreserving opt -> netcore_eval pol sw pt pk bufId = flowtable_eval (compile pol sw) sw pt pk bufId.

45Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 46: Software Defined Networking COMS 6998-10, Fall 2014

OpenFlow 1.0 Specification42 pages...

...of informal prose

...and C struct definitions

...diagrams and flow charts

46Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 47: Software Defined Networking COMS 6998-10, Fall 2014

Featherweight OpenFlowSyntax Semantics

Key Features:•Models all features related to

packet forwarding and all essential asynchrony

•Supports arbitrary controllers47Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 48: Software Defined Networking COMS 6998-10, Fall 2014

Forwarding

Definition Pattern_inter (p p':Pattern) :=  let dlSrc := Wildcard_inter EthernetAddress.eqdec (ptrnDlSrc p) (ptrnDlSrc p') in  let dlDst := Wildcard_inter EthernetAddress.eqdec (ptrnDlDst p) (ptrnDlDst p') in  let dlType := Wildcard_inter Word16.eqdec (ptrnDlType p) (ptrnDlType p') in  let dlVlan := Wildcard_inter Word16.eqdec (ptrnDlVlan p) (ptrnDlVlan p') in  let dlVlanPcp := Wildcard_inter Word8.eqdec (ptrnDlVlanPcp p) (ptrnDlVlanPcp p') in  let nwSrc := Wildcard_inter Word32.eqdec (ptrnNwSrc p) (ptrnNwSrc p') in  let nwDst := Wildcard_inter Word32.eqdec (ptrnNwDst p) (ptrnNwDst p') in  let nwProto := Wildcard_inter Word8.eqdec (ptrnNwProto p) (ptrnNwProto p') in  let nwTos := Wildcard_inter Word8.eqdec (ptrnNwTos p) (ptrnNwTos p') in  let tpSrc := Wildcard_inter Word16.eqdec (ptrnTpSrc p) (ptrnTpSrc p') in  let tpDst := Wildcard_inter Word16.eqdec (ptrnTpDst p) (ptrnTpDst p') in  let inPort := Wildcard_inter Word16.eqdec (ptrnInPort p) (ptrnInPort p') in    MkPattern dlSrc dlDst dlType dlVlan dlVlanPcp               nwSrc nwDst nwProto nwTos               tpSrc tpDst               inPort.Definition exact_pattern (pk : Packet) (pt : Word16.T) : Pattern :=  MkPattern    (WildcardExact (pktDlSrc pk)) (WildcardExact (pktDlDst pk)) (WildcardExact (pktDlTyp pk)) (WildcardExact (pktDlVlan pk)) (WildcardExact (pktDlVlanPcp pk))    (WildcardExact (pktNwSrc pk)) (WildcardExact (pktNwDst pk))    (WildcardExact (pktNwProto pk)) (WildcardExact (pktNwTos pk))    (Wildcard_of_option (pktTpSrc pk)) (Wildcard_of_option (pktTpDst pk))    (WildcardExact pt).Definition match_packet (pt : Word16.T) (pk : Packet) (pat : Pattern) : bool :=  negb (Pattern_is_empty (Pattern_inter (exact_pattern pk pt) pat)).

/* Fields to match against flows */struct ofp_match {    uint32_t wildcards; /* Wildcard fields. */    uint16_t in_port; /* Input switch port. */    uint8_t dl_src[OFP_ETH_ALEN]; /* Ethernet source address. */    uint8_t dl_dst[OFP_ETH_ALEN]; /* Ethernet destination address. */    uint16_t dl_vlan; /* Input VLAN. */    uint8_t dl_vlan_pcp; /* Input VLAN priority. */    uint8_t pad1[1]; /* Align to 64-bits. */    uint16_5 dl_type; /* Ethernet frame type. */    uint8_t nw_tos; /* IP ToS (DSCP field, 6 bits). */    uint8_t nw_proto; /* IP protocol or lower 8 bits of ARP opcode. */    uint8_t pad2[2]; /* Align to 64-bits. */    uint32_t nw_src; /* IP source address. */    uint32_t nw_dst; /* IP destination address. */    uint16_t tp_src; /* TCP/UDP source port. */    uint16_t tp_dst; /* TCP/UDP destination port. */};OFP_ASSERT(sizeof(struct ofp_match) == 40);

Record Pattern : Type := MkPattern {  dlSrc : Wildcard EthernetAddress;  dlDst : Wildcard EthernetAddress;  dlType : Wildcard EthernetType;  dlVlan : Wildcard VLAN;  dlVlanPcp : Wildcard VLANPriority;  nwSrc : Wildcard IPAddress;  nwDst : Wildcard IPAddress;  nwProto : Wildcard IPProtocol;  nwTos : Wildcard IPTypeOfService;  tpSrc : Wildcard TransportPort;  tpDst : Wildcard TransportPort;  inPort : Wildcard Port}.

Detailed model of matching, forwarding, and flow table update

48Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 49: Software Defined Networking COMS 6998-10, Fall 2014

Asynchrony“In the absence of barrier messages, switches may arbitrarily reorder messages to maximize performance.”

“There is no packet output ordering guaranteed within a port.”

  Definition InBuf := Bag Packet.  Definition OutBuf := Bag Packet.  Definition OFInBuf := Bag SwitchMsg.  Definition OFOutBuf := Bag CtrlMsg.

Essential asynchrony: packet buffers, message reordering, and barriers

49Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 50: Software Defined Networking COMS 6998-10, Fall 2014

Priority Predicate Action

Priority Predicate Action

10 SSH Drop

5 dst_ip = H1 Fwd 1

5 dst_ip = H2 Fwd 2

Priority Predicate Action

5 dst_ip = H1 Fwd 1

Priority Predicate Action

5 dst_ip = H1 Fwd 1

5 dst_ip = H2 Fwd 2

update re-ordering

Priority Predicate Action

10 SSH Drop

Priority Predicate Action

10 SSH Drop

5 dst_ip = H1 Fwd 1

Distributed Programming:non-atomic table updates

Asynchrony (Cont’d)

50Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 51: Software Defined Networking COMS 6998-10, Fall 2014

Controllers

: abstract type of controller statefin :

fout :

Controller Parameters

Ultimately we want to prove theorems about controllers that implement the NetKAT run-time system...

...but we didn’t want to bake specific controllers into Featherweight OpenFlow!

Controller model: fully abstract

51Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 52: Software Defined Networking COMS 6998-10, Fall 2014

(H1, ) (S1,pt1, ) (S2,pt1, ) (H2, )

≈ ≈

≈≈ ≈

add rules

add

rule

s

Weak Bisimulation

  Theorem fwof_abst_weak_bisim :    weak_bisimulation concreteStep abstractStep bisim_relation.

52Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 53: Software Defined Networking COMS 6998-10, Fall 2014

Frenetic

OX

implemented usingOCaml embedding• predicates and policies• queries

OCaml OpenFlow Platform• similar to Nox, Pox, Floodlight, etc.

predicatespoliciesqueries

stream of snapshots over time

predicatespoliciesqueries

predicatespoliciesqueries

Frenetic

Ox

The System

53Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 54: Software Defined Networking COMS 6998-10, Fall 2014

Frenetic DSL

Frenetic

OX

implemented using

implemented using

Domain-specific language• predicates and policies• monitoring• mac learning• network address translation

OCaml embedding• predicates and policies• queries

OCaml OpenFlow Platform• similar to Nox, Pox, Floodlight, etc.

Frenetic

Ox

The System

54Source: Nate Foster, Cornell10/6/14 Software Defined Networking (COMS 6998-10)

Page 55: Software Defined Networking COMS 6998-10, Fall 2014

Outline

• Review of previous lecture on SDN programming language– Maple: generic programming language syntax such as

Java, Python– Frenetic NetCore/NetKAT: domain specific

programming language• SDN Verification– Verification of network properties– Verification of controller correctness– Verification of software data plane

10/6/14 Software Defined Networking (COMS 6998-10) 55

Page 56: Software Defined Networking COMS 6998-10, Fall 2014

Software Dataplane Verification

Mihai DobrescuKaterina Argyraki

EPFL

Page 57: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

Software dataplanes

57

intrusion detection

IP forwarding

application acceleration

Page 58: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Flexibility- new intrusion detection, traffic filtering,

sampling, application acceleration, ...

‣ Unpredictability- special packet causes router to crash - or doubles per-packet latency

Software dataplanes

58

Page 59: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

Dataplane verification

59

intrusion detection IP forwarding

application acceleration

verification tool

D does (not) satisfy property P

target property P

dataplane executable D

Page 60: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 60

if (in.x < 0)out = ...;elseout = in;

if (in.y < 10)out = ...;elseout = in;

in.x < 0

in.x ≥ 0

in.y < 10

in.y ≥ 10

in.y < 10

in.y ≥ 10

DART, PLDI 2005Klee, OSDI 2008

Compositional Test Generation, POPL 2007

Page 61: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Define the domain- propose rules on how to write dataplanes- make it easy to apply composition

‣ Leverage the domain specificity- use it to sidestep path explosion- open the door to dataplane verification

Dataplane-specific verification

61

Page 62: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 62

‣ Pipeline

‣ Loops

‣ Data structures

‣ Results

Outline

Page 63: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 63

‣ Pipeline

‣ Loops

‣ Data structures

‣ Results

Outline

Page 64: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

m elements

64

intrusion detection

application acceleration

do not share mutable state

verification time 2∼ n m

n branches

per element

IP forwarding

Page 65: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 65

intrusion detection

application acceleration

do not share mutable state

verification time m 2∼ n

...assert(src != dst);...IP forwarding

Page 66: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Rule: pipeline structure- distinct packet-processing elements- do not share mutable state

‣ Effect: compose at the element level - can reduce #paths from ∼ 2 n m

- to ∼ m 2 n

Pipeline decomposition

66

Page 67: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 67

‣ Pipeline

‣ Loops

‣ Data structures

‣ Results

Outline

Page 68: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 68

IP options

Page 69: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

m options

69

...option #1 option #moption #2

verification time n∼ m

n option

types

Page 70: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

m options

70

option #1 option #moption #2 ...

...

verification time m n∼

n option

types

little state sharing across iterations

Page 71: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Rule: “mini-pipeline” structure- little state shared across iterations- made explicit by the programmer

‣ Effect: compose at the iteration level - can reduce #paths from ∼ n m

- to ∼ m n

Loop decomposition

71

Page 72: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 72

‣ Pipeline

‣ Loops

‣ Data structures

‣ Results

Outline

Page 73: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 73

IP lookup

Page 74: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 74

output_port = table[ dst_prefix ]

...

... ...

Page 75: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 75

output_port = table.read( dst prefix )

...

... ... table impl

Page 76: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Rule: data-structure interface- made explicit by the programmer

‣ Effect: abstract data-structure implementation - prevents data-structure size from contributing

to path explosion

Data-access decomposition

76

Page 77: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Use pre-allocated arrays- no dynamic memory (de)allocation- hash table, longest prefix match

‣ Trade-off memory for “verifiability” - at least as fast (array lookups)- but larger memory footprint (pre-allocation)

Verified data structures

77

Page 78: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

‣ Pipeline

‣ Loops

‣ Data structures

‣ Results

Outline

78

Page 79: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

Results

‣ Verified stateless & simple stateful pipelines- IP router, NAT box, traffic monitor

‣ Proved bounded execution - no more than X instructions per packet- disparity between worst-case and common path

‣ Proved crash-freedom- no packet will cause the pipeline to abort

79

Page 80: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 80

/* IPFragmenter:: optcopy */

for ( int i = 0; i < opts_len; ) {int opt = oin[i], optlen;if (opt == IPOPT_NOP)

optlen = 1;else if (opt == IPOPT_EOL || i == opts_len - 1

|| i + (optlen = oin[i+1]) > opts_len)break;

if (opt & 0x80) {//copy the optionmemcpy(...);

}i += optlen;

}

Page 81: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 81

/* IPFragmenter:: optcopy */

for ( int i = 0; i < opts_len; ) {int opt = oin[i], optlen;if (opt == IPOPT_NOP)

optlen = 1;else if (opt == IPOPT_EOL || i == opts_len - 1

|| i + (optlen = oin[i+1]) > opts_len)break;

if (opt & 0x80) {//copy the optionmemcpy(...);

}i += optlen;

}

Page 82: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 82

/* IPFragmenter:: optcopy */

for ( int i = 0; i < opts_len; ) {int opt = oin[i], optlen;if (opt == IPOPT_NOP)

optlen = 1;else if (opt == IPOPT_EOL || i == opts_len - 1

|| i + (optlen = oin[i+1]) > opts_len)break;

if (opt & 0x80) {//copy the optionmemcpy(...);

}i += optlen;

}

Page 83: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL 83

/* IPFragmenter:: optcopy */

for ( int i = 0; i < opts_len; ) {int opt = oin[i], optlen;if (opt == IPOPT_NOP)

optlen = 1;else if (opt == IPOPT_EOL || i == opts_len - 1

|| i + (optlen = oin[i+1]) > opts_len)break;

if (opt & 0x80) {//copy the optionmemcpy(...);

}i += optlen;

}

Page 84: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

Verification time for Click pipelines

84

Page 85: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

Homage

‣ Active networks- Tennenhouse & Wetherall, CCR 1996

‣ S2E software analyzer - Chipounov et al., ASPLOS 2011

‣ Compositional analysis- Godefroid, POPL 2007

‣ Click programming framework- Kohler, PhD thesis, 2000

85

Page 86: Software Defined Networking COMS 6998-10, Fall 2014

COMS6998-10 (Software Defined Networking)Oct 6, 2014 Source: K. Argyrati, EPFL

Conclusion

‣ Dataplane-specific verification- symbolic execution + composition- pipeline structure, limited loops,

pre-allocated key/value stores

‣ Enables dataplane verification in useful time- complete and sound analysis- of stateless and 2 simple stateful pipelines

86