34
Formal Verification of Computer Switch Networks Sharad Malik; Department of Electrical Engineering; Princeton Univeristy (with Shuyuan Zhang (Princeton), Rick McGeer (HP Labs)) 1

Formal Verification of Computer Switch Networks - DIMACS

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Formal Verification of Computer Switch Networks - DIMACS

Formal Verification of Computer Switch Networks

Sharad Malik; Department of Electrical Engineering; Princeton Univeristy(with Shuyuan Zhang (Princeton), Rick McGeer (HP Labs))

1

Page 2: Formal Verification of Computer Switch Networks - DIMACS

SDN: So what changes for verification? SDN: So what changes for verification? Previously

System complexity precluded formal modeling and verification R li d l i l t ti b d t h i Relied exclusively on testing based techniques

traceroute, ping, tcpdump, wireshark

Now Hardware Hardware

Switch network is purely hardware (finite state) Can apply hardware verification techniques

Software Centralized control algorithm, easier to analyze

However Hardware

Large network size Switches: From tens to hundreds Rules per switch: From hundreds to thousands

Software Interacts with distributed hardware

2

Page 3: Formal Verification of Computer Switch Networks - DIMACS

Hardware Snapshot VerificationHardware Snapshot Verification Verify the static network state at a single instance of time A snapshot of a dynamic systemp y y Do not consider network performance, e.g. delay, bandwidth, …

Verify consistency of updates separately Reitblatt, Foster, Rexford, and Walker. 2011. Consistent updates for

software-defined networks: change you can believe in!. In Proceedings of the 10th ACM Workshop on Hot Topics in Networks (HotNets-X)

Rationale Network state change (rule deletion/addition/change at a switch)[1]

Tens of events per second Tens of events per second

Packet arrival rate Millions of arrivals per second

3 [1] Gude, N., Koponen, T., Pettit, J., Pfa, B., Casado, M., McKeown, N., Shenker, S.: “Nox: towards an operating system for networks”

Page 4: Formal Verification of Computer Switch Networks - DIMACS

Talk Goals/OutlineTalk Goals/Outline Review specific verification efforts Formalisms Formalisms

Modeling Verification Tasks

Emphasis on verification engines Model checking Symbolic simulationy SAT based propositional logic verification

With insights on their applicability

From verification to design synthesis Formal methods based optimal synthesis of network

componentscomponents

4

Page 5: Formal Verification of Computer Switch Networks - DIMACS

Packet State System StatePacket State System State Verification is packet centric Packet State (packet header, packet location)

(h,p) Ignore payload

P k d k l Packet state transitions during network traversal State Space Size Packet Header

Bit # 0~31 32~63 64~79 80~95 96~103 104~207

Pkt Src IP Dst IP Src port Dst port Protocol Src IP’, …… , Proto’

Packet Location Global Port ID

Stanford campus network: 47 ports, 6 bit encoding

5

Page 6: Formal Verification of Computer Switch Networks - DIMACS

Network StateNetwork State Switch State Set of rules defining how a packet is processed Set of rules defining how a packet is processed Routing Information Base, Forwarding Information Base, Access

Control List, Forwarding Table, Configuration Policies…

R l i i i d Rules are prioritized

Network State The combination of all switch states

Match packet header

Match packet header

Modify/route

packets

Modify/route

packets The combination of all switch states Fixed → Snapshot verification

6

Page 7: Formal Verification of Computer Switch Networks - DIMACS

Talk Goals/OutlineTalk Goals/Outline Review specific verification efforts Formalisms Formalisms

Modeling Verification Tasks

Emphasis on verification engines Model checking Symbolic simulationy SAT based propositional logic verification

With insights on their applicability

From verification to design synthesis Formal methods based optimal synthesis of network

componentscomponents

7

Page 8: Formal Verification of Computer Switch Networks - DIMACS

Network PropertiesNetwork Properties Reachability Checking:

Check if a packet can always reach B A Bp yfrom A.

No Forwarding Loop:

B

No Forwarding Loop: Make sure there is no packet that can

reach the same switch/port more than once during its lifetime

Packet

once during its lifetime.

Packet Destination Control: Make sure a packet can/cannot go

through certain switches/hosts. A B

X C

8

Page 9: Formal Verification of Computer Switch Networks - DIMACS

Slice IsolationSlice Isolation

Slice 1

X

A B

X

C D

Slice 2

9 [2] Kazemian, P., Varghese, G., McKeown, N.: “Header space analysis: static checking for networks”

Page 10: Formal Verification of Computer Switch Networks - DIMACS

Talk Goals/OutlineTalk Goals/Outline Review specific verification efforts Formalisms Formalisms

Modeling Verification Tasks

Emphasis on verification engines Model checking Symbolic simulationy SAT based propositional logic verification

With insights on their applicability

From verification to design synthesis Formal methods based optimal synthesis of network

componentscomponents

10

Page 11: Formal Verification of Computer Switch Networks - DIMACS

Model Checking Based VerificationModel Checking Based Verification Transition of packet states Given a packet, FSM based approaches model how the packet

transitions during its lifetime.

(h2, p2)

Time 1 Time 2 Time 3

Switch 2

(h1, p1) (h2, p4)Switch 1 Switch 4

(h2, p3)Switch 3

Real Network Transition Model

Properties specified using temporal logic formulas

11

Properties specified using temporal logic formulas CTL: Computation Tree Logic

Page 12: Formal Verification of Computer Switch Networks - DIMACS

Header Space Analysis: Ternary Symbolic Simulation ImplementationTernary Symbolic Simulation Implementation Can follow a symbolic packet through the network Example: Example:

** 001

*R l 1

* *0

000

1

Rule 1

Rule 1

Rule 2

1 11

Rule 2 Rule 1

Limitation

The whole header space *0

11

Rule 2

12

No clean formalism to express/check properties

Page 13: Formal Verification of Computer Switch Networks - DIMACS

Reachability AnalysisReachability Analysis Packets can reach from A to B Model Checking Based Approach

AF: Along All paths there Model Checking Based Approach CTL Property

(p=A) →AF (p=B)

some Future state

Ternary Symbolic Simulation Follow the symbolic packet along all possible paths

13

Page 14: Formal Verification of Computer Switch Networks - DIMACS

Forwarding LoopForwarding Loop

drop, outside world areencoded as some port IDdrop, outside world areencoded as some port ID

Inject1

3

4Visit:{1,2}

Visit:{1,2,3}Visit:{1,2,3,4}Loop!

Packet 1

2Visit:{}

Visit:{1}

14

Page 15: Formal Verification of Computer Switch Networks - DIMACS

Packet Destination ControlPacket Destination Control Example: All packets from A get to B without reaching C.

A B

XC

p g g

B

15

Page 16: Formal Verification of Computer Switch Networks - DIMACS

Experimental Evidence: BDD Based Model Checking BDD: Binary Decision DiagramBDD Based Model Checking Scalability:

# of variables in transition relation H d bit O Fl 1 1 15 t hi fi ld 356 t hi bit Header bits: OpenFlow v1.1 → 15 matching fields → 356 matching bits Network size: 47 ports (as in Stanford campus) → 6 bits

Experimental Result: ConfigChecker: 111 bits for header + (largest) 4000 nodes ConfigChecker: 111 bits for header + (largest) 4000 nodes Atomic Update: 64 bits header + Hundreds of switches + hundreds of

thousands of rules → over an hour Why does this even work?y

Space: Largest part of the system is the rules BDD variables only for packet state bits

Packet stateTransition

Rules

Packet state

16

Time: Shallow transition systems. Packets go through relatively few hops.

Page 17: Formal Verification of Computer Switch Networks - DIMACS

Experimental Evidence:Ternary Symbolic Simulation Potential Difficulty:

Ternary Symbolic Simulation

Packet: h

H2=(h-k1)

H (H k )

H3=(H2-k2)

Operation “-” is expensive in ternary symbolic simulation

Hn=(Hn-1–kn-1)

p p y y It is equivalent to DNF complementation.

17

Page 18: Formal Verification of Computer Switch Networks - DIMACS

Experimental Evidence:Ternary Symbolic SimulationTernary Symbolic Simulation Experimental result: Stanford campus network: Stanford campus network:

2 backbone routers + 14 zone routers + 10 switches # of forwarding rules after compression: 4,200 (originally 757,000)

Loop Detection on 30 ports: 560 seconds

Why does this even work? Shallow transition system: A packet Shallow transition system: A packet

reaches its destination in a few hops. Rule overlaps are small Limited number of packet trajectories Limited number of packet trajectories

Exploited in incremental verification Khurshid, Zhou, Caesar, and Godfrey.

2012. VeriFlow: verifying network-wide

18

y ginvariants in real time. HotSDN '12

Page 19: Formal Verification of Computer Switch Networks - DIMACS

Talk Goals/OutlineTalk Goals/Outline Review specific verification efforts Formalisms Formalisms

Modeling Verification Tasks

Emphasis on verification engines Model checking Symbolic simulationy SAT based propositional logic verification

With insights on their applicability

From verification to design synthesis Formal methods based optimal synthesis of network

componentscomponents

19

Page 20: Formal Verification of Computer Switch Networks - DIMACS

From Model Checking to SATFrom Model Checking to SAT Model Checking vs. SAT Higher in the complexity hierarchy Higher in the complexity hierarchy

Ternary Symbolic Simulation Properties are hard to specifyp p y Book-keeping overhead (e.g. check forwarding loop)

Can we model the network as a combinational circuit? Propositional logic model SAT based property checking

20

Page 21: Formal Verification of Computer Switch Networks - DIMACS

SAT Based Verification: An OverviewSAT Based Verification: An Overview

Split one bidirectional link into two unidirectional links

Switch can be modeled as acyclic combinational logic

Use traditional hardware verification techniques.

SAT Formula

21

Page 22: Formal Verification of Computer Switch Networks - DIMACS

Encoding Property: Find A Forwarding LoopEncoding Property: Find A Forwarding Loop Forwarding Loop:

The same packet shows up at the same switch twice, not necessarily with the same header format

0 0

0

Assumption: There is a packet entering the

0…network

Constraint: No packet gets out

0

1

No packet gets out. No packet is dropped.

Return:

0… SAT: find forwarding loop

UNSAT: no forwarding loop

22

0…

Page 23: Formal Verification of Computer Switch Networks - DIMACS

Encoding Property: Reachability CheckingEncoding Property: Reachability Checking

Example properties: Packets with format h=10xx will always get to B from A Packets with format h=10xx… will always get to B from A.

Constraint: Packet h=10xx… enters

the network at port A No packet shows up at

port B

h

Port A

port B

Return: SAT: Reachability fails

0Port B

SAT: Reachability fails UNSAT: Reachability holds

23

Page 24: Formal Verification of Computer Switch Networks - DIMACS

Preliminary ResultsPreliminary Results Forwarding Loop

Waxman topology 10 switches+1000 hosts Policy: shortest path between certain port pairs Policy: shortest path between certain port pairs Property: Check if there is forwarding loop.

200 switches + 1000 hosts + 300,000 rules → 11 minutes 200 switches + 1000 hosts + 750,000 rules → 3 hours and 48 minutes 200 switches + 1000 hosts + 2,700,000 rules → Run out of memory

708090

100

SAT Atomic Update[5]

Ti

3040506070Time

(second)

01020

10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 110000 120000 130000 140000 150000 160000 170000 180000 190000 200000

24

# Rule

[5] Reitblatt, M., et al..: “Abstractions for network update”

Page 25: Formal Verification of Computer Switch Networks - DIMACS

SAT Based Firewall VerificationSAT Based Firewall Verification Firewall Inputs: Incoming packet Outputs: “accept” or “reject” action

Firewall Encoding

Rule #1

Rule

Permit

PacketEncoding

Rule #2

PacketPkt bit 1Pkt bit 2

True

Rule #n

RejectPrev Match

Match (10X)

25

Page 26: Formal Verification of Computer Switch Networks - DIMACS

Firewall Equivalence CheckFirewall Equivalence Check Feed the same input to the two firewalls and check if the

two outputs can differtwo outputs can differ.

Permit

Experimental Result

Firewall 1

pRejecti1 !=

i2

i1Input packet

Firewall Permit

i2i2

2Reject

26

Classbench for firewall generation

Page 27: Formal Verification of Computer Switch Networks - DIMACS

Firewall Inclusion CheckFirewall Inclusion Check

Permit

Experimental Result

Firewall 1

pReject i1Input packet

Firewall Permit

i2

2Reject

27

Classbench for firewall generation

Page 28: Formal Verification of Computer Switch Networks - DIMACS

Firewall Redundancy RemovalFirewall Redundancy Removal Single rule redundancy checking Delete it and check the equivalence of the new firewall with the old

old If they are equivalent, delete the rule

Sequentially iterate over all rulesq y

70.00%

80.00%

90.00%

5000

6000 Execution Time (seconds)Redundancy

40.00%

50.00%

60.00%

3000

4000 RedundancyExecution

Time

10.00%

20.00%

30.00%

1000

2000

28

0.00%0130 286 438 702 887 1007 1135 1355 1753 1932

# Rules

Page 29: Formal Verification of Computer Switch Networks - DIMACS

Other SAT Formulations: Anteater[6]Other SAT Formulations: Anteater

A B C

29 [6] Mai, H., Khurshid, A., Agarwal, R., Caesar, M., Godfrey, P.B., King, S.T.: “Debugging the data plane with anteater”

Page 30: Formal Verification of Computer Switch Networks - DIMACS

Property Checking for AnteaterProperty Checking for Anteater

A B C

A

A’A B C B CA’

30

Page 31: Formal Verification of Computer Switch Networks - DIMACS

Talk Goals/OutlineTalk Goals/Outline Review specific verification efforts Formalisms Formalisms

Modeling Verification Tasks

Emphasis on verification engines Model checking Symbolic simulationy SAT based propositional logic verification

With insights on their applicability

From verification to design synthesis Formal methods based optimal synthesis of network

componentscomponents

31

Page 32: Formal Verification of Computer Switch Networks - DIMACS

Firewall SynthesisFirewall Synthesis

PermitGiven

Firewall Spec

Permit

RejectPacket X={x1, x2, x3,…} f(x, r)

Reject

i1 != i2

Symbolic Rule Variables

SymbolicFirewall

with

Permit

Symbolic Rule VariablesR={r1, r2, r3…} k rules Reject

Solve using a QBF Solver

32

Current QBF Solvers don’t scale

Page 33: Formal Verification of Computer Switch Networks - DIMACS

Wrap UpWrap Up Summary Reviewed emerging Symbolic Simulation/Model Checking/SAT based

approaches. Challenges Speedp

Ternary Symbolic Simulation: 10 switches + 2 backbone router,s a total of 4,200 forwarding rules (after compression) → 10 minutes.

Model Checking Based (using NuSMV): Hundreds of switches + hundreds of thousands of rules → Over an hour.

Current SAT Based Propositional Property Checking: Similar in scale What we need:

Verification between two network updates → continuous verification Explore incremental verification techniques

Network Application Verification Opportunities for tailored software verification techniques

33

Page 34: Formal Verification of Computer Switch Networks - DIMACS

ReferencesReferences[1] Kazemian, P., Varghese, G., McKeown, N.: “Header space analysis: static checking for networks”[2] Al-Shaer, E., Marrero, W., El-Atawy, A., ElBadawi, K.: “Network configuration in a box: towards end-to-end verification of network reachability and security”y y[3] Al-Shaer, E., Al-Haj, S.: “FlowChecker: configuration analysis and verification of federated OpenFlow infrastructures”[4] Reitblatt M F ster N Re f rd J Schlesin er C Walker D : [4] Reitblatt, M., Foster, N., Rexford, J., Schlesinger, C., Walker, D.: “Abstractions for network update”[5] Mai, H., Khurshid, A., Agarwal, R., Caesar, M., Godfrey, P.B., King, S.T.: “Debugging the data plane with anteater”[6] Gude, N., Koponen, T., Pettit, J., Pfa, B., Casado, M., McKeown, N., Shenker, S.: “Nox: towards an operating system for networks”, , p g y

34