Skip to content

SDN Programming using High Level Programming Abstractions

Jensen Zhang edited this page Sep 21, 2016 · 1 revision

Category:RECENTDOC

Table of Contents

Introduction

This tutorial is about FAST Maple during ODL Summit 2016.

At various points when slides are referred to, those slides can be found attached here: File:TODO.pptx and uploaded online on Google Drive

Also mentioned is a "USB key" with VMs and other items. That USB Key Image can be found here

Finally, after this tutorial is recorded at the ODL Summit 2016, we will post the video clips at YouTube.

Conceptual Intro: The X SDN programming model

We will go over this part of the slides together as a group.

Conceptual Intro: The semantic gap problem, and the Maple approach

We will also go over this part of the slides as a group, in particular we will discuss the issues of low-level datapath programming, the access library wrapper idea of Maple, and the basic Maple programming model: How to access input, and specify output.

Getting started [May]

Basic structure

You need three components to do your programming: (1) an OpenDaylight controller; (2) a VM in which you can create a mininet, and the switches in the mininet will be controlled OpenDaylight controller; and (3) an environment which allows you to write your programs, upload your program to the OpenDaylight controller, and query the OpenDaylight controller to show status. For simplicity, we design a single VM containing (1) and (2), and we provide a browser IDE to realize (3).

Install the VM

You have been provided with a USB key with [TODO]:

  • VirtualBox 5.1.6 Installer
  • ODL.ova - A dev VM as your dev environment
  • m2.zip - a zip of the m2 used in ODL.ova should you choose to use your own local dev env instead of the VM.
  • #opendaylight-tutorial - IRC channel for this tutorial
  • For Ubuntu Linux USB key fix: sudo apt-get install exfat-fuse exfat-utils
  • For Fedora Linux USB key fix: sudo yum install fuse-exfat exfat-utils
Please install the dev VM and start it.

Create a project

We first will use the browser IDE to create a project [TODO:].

Create a test mininet

Next we use the IDE to create a mininet. To achieve the goal, [TODO]

  • create a mininet (which will be used later: May/Jensen: please see below for the topology to create; It needs to have enough complexity to support the use cases below)
We specify the mininet as the network to be controlled in our tutorial. [TODO]

Exercise M1: Write your first Maple app

Objective: Understand basic Maple programming, on input access (pkt attributes), output construction (route action, set-packet-header actions):

Write M1

The first program is simple, and [More]

From the IDE, [TODO]...

Type the following code to [TODO]

 code

Build and deploy M1

Before we build and deploy the app, first use the IDE to see flow tables at switches before any deployment. [TODO:]. We should see that the flow tables at the switches are empty, with an output as:

Flow tables

Now, we build and deploy the app. The IDE makes this job quite easy. [TODO:]

Now, watch the flow tables at the switch again. You should see that the flow tables are still empty. As no packets have been triggered. Remember, Maple by default is a reactive design.

Now, let's have some triggering packets. At the mininet terminal, type

ping 

Now, display the flow tables at switches again, and you should see:

Flow tables 

Wow, entries are inserted into the flow tables by Maple automatically!

For those who are curious, which of course includes everyone, let's see a bit how Maple generates the flow tables.

Conceptual Intro: Maple Magic using trace tree =

We will go over this part of the slides as a group. With the concept in mind, let's see the trace tree using our IDE. [TODO:]

You should see that the trace tree of M1 looks like [TODO:].

Exercise M2: Maple app with generic shortest path routing

Objective: basic IO + state access

Real programs cannot use manual specification of routes, they need to read topology (collected by LLDP, or other protocols) to compute the route. This exercise shows you how to do this.

Revise M1

We will invoke a generic shortestPath algorithm to compute the route. No worry, we will not ask you to write such a method on spot, which you should know if you are planning to interview for a job. In this tutorial, we use this prewritten version [TODO:]. [Note:] [Part]

Now, invoke the shortestPath library call, by modifying M1 as follows [TODO]:

Code

Deploy and see

[TODO]

Exercise M3: Maple app with load balanced routing

Objective: basic IO + state access + complete instruction

Design M3

M3 extends M2 with simple load balancing, by conducting the following:

  • Using a hash on src IP/Mac Rewrite to split traffic into two servers sharing the same VIP
  • Rewrite VIP to RIPs for two servers
In particular, please type the following:
Code

Deploy and see

  • Show that pkts will be automatically rewritten with given dst IP, and have correct routes

Exercise M4: Maple app with ACL and load balancing

Objective: basic IO + state access + compound action + user policy composition

Write the code

Revise M3 to compose ACL and load balancing routing. In particular, first add an implementation of a boolean method called allow(), which parses an acl list to decide allow or drop :



Now, the main Maple app composes these two as:

 code

Deploy and see

Conceptual Intro: Maple app composition, packet triggered state changes

The Maple programming framework supports a lot more cool features than we can cover in this tutorial. We will show you two features: (1) composition of system apps, and (2) packet triggered state changes.

  • Link to ARP code [TODO]
Despite the list of cool features, you may have some fundamental questions on Maple programming, in particular, the following two:
* If a program/state changes, how can Maple maintain consistency w/ state (e.g., how can Maple recompute routes after failure of a link on a used path)?
* What if you want proactive rule installation, not reactive?

Now we transition to the next part of the tutorial, to show that the preceding issues can be systematically solved by another programming abstraction, the FAST function store.

Conceptual Intro: Why and what is FAST?

We will go over this part of the slides together as a team. We will cover the basic ideas of FAST: why function store, automatic data access tracking, automatic re-execution scheduling. [TODO]



Maple as function instances in FAST

Exercise F1: FAST host-to-host intent =

To demonstrate how powerful FAST is, but also how simple it is to use FAST, we will [TODO]

Write the code

Need to describe the steps [TODO]. First, create the FAST function that computes [TODO]

PathIntentImp extends FastFunction {
   PathIntentImp(src, dst) { record src, dst}
   execute() {
       if (hostTable[src] == null || hostTable[dst] == null)
         return;  // allow detection of incomplete info; may include 
                      // the check in shortestPath but here for explicit reading
       route = shortestPath(src, dst);
       flowRules = route2FlowRules( route ); // this should be a common utility
       write flowRules to data store to be pushed to switches by ODL
   } // execute
}

Now, we need to create instances. There are quite a few ways to achieve the goal. One is that FAST provides an RPC to allow remote submission of FAST instances. In this exercise, we use the FASTMain initialization to create them. Still, we allow the src-dst pairs to be managed by ODL data store. Modify FASTMapleMain

TutorialMain extends FASTMapleMain {
  srcDstPairs[] = {...}   // use data store to specify the pairs
  
  onCreate() {
    foreach srcDstPair in srcDstPairs {
       Create one PathIntentImp( srcDstPair one direction );
       Create one PathIntentImp( srcDstPair reverse direction); 
       Make them the same group
       Call parent onCreate
    } // foreach
  } // onCreate

 } // FASTMain

Build and Deploy

It is slightly complex to demonstrate the effects of FAST. Hence, we use the following steps.

First, deploy F1 using IDE. This is easy. [TODO:]

Now, let's use the IDE to see if the instances are created. First, let's see if they are there [TODO]. You should see an output like: [TODO]

FAST supports the concept of group, and you can see the grouping using the Instance Relation Display: [TODO:]. You should see a following display:

A magic provided by FAST is automatic tracking of data access. Let's see what data have been read by your instances. [TODO:]. You should see:

Ping an src-dst pair in the spec, e.g., h1 ping h2

  • [IMPORTANT:]Missing ARP entries at host p1 is a major issue since we want simple demos; No result as ARP is not handled [hardcode]; also hostTable does not have src/dst
[TODO] Why the preceding does not work? It is because that the hostTable does not have h1 and h2.

See re-execution

Ping and use IDE to display FAST status

Trigger automatic re-execution

Now let's trigger. To do this, we can simply generate a topology event. Use [TODO] to shutdown a mininet link, and the route should be re-executed.

First

command to modify a link in mininet

Now, let's see the effect [TODO:]

Write a better F1

Transition question: extra semantic dependency (the 2, 2, 1, 1 link weights example); the basic shortest path algorithm invokes topology transformation on each invocation, which is inefficient anyway. Fix, refactor the shortestPath to use the transformed topology

Code

== FAST programming F2: Efficient tracking and grouping [Attendees]==

Write program

 code

IDE deploy

IDE display table of instances (status, and dependency);

IDE display instance relationship graph

IDE display of data access [all]

UI to modify the topology (e.g., a link that is not dependent), and see no re-execution

FAST Programming F3: See the source code of Maple, to understand how it is implemented

FAST Programming F4:Proactive Intent and Reactive Maple App composition

(Proactive) Host intent and (Reactive) Maple integration

FAST static paths as in F2

Add simple MapleApp using shortestPath for other traffic




[FAST]

This is optional, and needs a lot more thinking

Summary and next steps

Summary of what we learned

  • Maple: datapath oblivious programming [e.g.,]
  • FAST: data-driven, modular programming
Extensions
  • Maple: only a single table; see Magellan for ongoing work
  • FAST: …