You are on page 1of 22

Developing

OpenDaylight Apps
with MD-SAL
J. Medved, E. Warnicke, A. Tkacik. R. Varga
Cisco
Sample App: M. Rehak, Cisco
February 04, 2014

Controller Architecture
Management
GUI/CLI

Network Applica3ons
Orchestra3on & Services

D4A Protec3on

OpenDaylight APIs (REST)

Base Network Service Func3ons


Topology
Mgr

Switch
Mgr

Stats
Mgr

FRM

Host
Tracker

ARP
Handler

Anity
Service

LISP
Service

Controller Pla?orm

Service Abstrac3on Layer (SAL)


(plug-in mgr., capability abstrac3ons, ow programming, inventory, )

OpenFlow
1.0

1.3

NETCONF

OpenFlow Enabled Devices

OVSDB

SNMP

Open vSwitches

BGP

PCEP

LISP

Addi2onal Virtual & Physical


Devices

Example: Service Provider Edi2on

Southbound Interfaces
& Protocol Plugins

Data Plane Elements


(Virtual Switches,
Physical Device Interfaces)

Hydrogen Implementation
Management
GUI/CLI

REST

REST

LISP
Service

Anity
Service

REST

Topology
Mgr

REST

REST

REST

REST

Base Network Service Func3ons



Stats
Mgr

Switch
Mgr

FRM

Host
Tracker

REST

D4A Protec3on

Cong
Subsystem
ARP
Handler

NSF AAdapters
dapters
NSF
NSF
Adapters

API-Driven SAL (AD-SAL)


OpenFlow
1.0

OVSDB

LISP

OpenFlow Enabled Devices

RESTCONF

NETCONF

Service Func3ons
Stats
Mgr

FRM

PCEP

Base Network Func3ons



Topology
Topology
Topology

Exporter
Exporter
Exporter

Topology
Topology
Inventor
Exporter
Exporter

y
Manager

Model-Driven SAL (MD-SAL)


OpenFlow
1.0
1.3

SNMP

Open vSwitches

BGP-LS

PCEP

Addi2onal Virtual & Physical


Devices

Example: Service Provider Edi2on

NETCONF

MD-SAL Motivation &


Requirements
Flexibility, but common framework and programming model
Support API governance
Func2onally equivalent APIs for dierent language bindings

Run-2me Extensibility:
Augment exis2ng func2onality
Load new models (extends controllers func2onality)

Avoid module/sub-system hotspots


Performance & scale

From AD-SAL to MD-SAL


SB Plugin Model

NB Service Model

Is generated from

Controller PlaPorm

Controller PlaPorm

REST API

Plugin NB Java API

Service
Plugin 1

Adapta3on
Plugin

SB Plugin 2

AD-SAL key services:


Request rou2ng
Service Adapta2on

AD-SAL

MD-SAL

Service
Plugin 1

Modeled Service NB Java API

Request
Rou2ng

Adapta2on

Plugin SB Java API

...

Service
Plugin 1

Service NB Java API

Request Rou2ng

SB Plugin 1

RESTCONF

REST API

...

Service
Plugin 1

Is generated from

Modeled SB Java API

SB Plugin 1

...

SB Model
NB Model
Data
Data
Data Store

SB Plugin 2

MD-SAL key services:

Request (RPC) and no2ca2on rou2ng


Data Storage

MD-SAL Key Tenets Summary


Modeling language: YANG (rfc6020)
Used also as IDL
A couple of minor extensions

Dynamic late binding


Run2me & Compile 2me code genera2on

Creating the View of the Network


Controller PlaPorm
BGP-LS Topology
Exporter

Model

OpenFlow Topology
Exporter

Model

...

Flow-Capable Node
Inventory Manager

Model

Sta3s3cs Manager

Model

/Opera2onal /Cong
network-topo

n1

BGP-LS

BGPv6

BGPv4

nodes
n2

...

links
nx

nodes

l1 l2

OpenFlow
prexes

...

lx p1

p2

...

px

of:1

...

of:2

Groups

Tables

Table/1

Table/2

Table-stats

Flow/1

Meters

Of:n
Ports

Table/n

...

Flow/n

Flow/2

MD-SAL

Flow-stats

BGP-LS
Protocol Plugin

Flow-stats

NETCONF

nc:1

nc:2

MD-SAL: Software Architecture View


Network Devices

...

App

Protocol Plugin

Model

...

Protocol Plugin

Model

App

Data Plane Elements

RESTCONF

NETCONF

Cong
Subsystem

Network Applica3ons
Orchestra3on & Services

Service/App
Plugin

Model

...

Service/App
Plugin

Model

Controller Pla?orm
Southbound Interfaces
& Protocol Plugins

Model-Driven SAL (MD-SAL)

Message Bus

Data Store

Remote Container Instance

Remote Container Instance

Clustering

Building a Plugin/Application
Model
Model
Yang Model

Generate APIs
1

Yang Tools

Java API Deni2on


Java
API Deni2on
Generated
API
Deni2on

Create API Bundle


Maven
Build Tools

API
OSGI Bundle

Deploy
4

Controller
Maven
Build Tools
Module
Module
Implementa2ons

Implementa2ons
Plugin
source code

Plugin
OSGI Bundle

3
Create Plugin Bundle

4
Deploy

The Learning Switch Application


Inspired by OpenDaylight Applica2on Developers Tutorial:
hdp://sdnhub.org/tutorials/opendaylight/
ODL Wiki: TBD.
Func2onality:
Create a HashMap called mac_to_port
On packet_in, Pprse packet to get src and dst MAC address
Store in a hashmap mapping between src_mac and in_port
Lookup dst_mac in mac_to_port map to nd next hop
If next hop is found, create ow_mod and send
Else, ood like hub.

Under the Hood: How it Works


Flow-capable Node Model
(Flow programming)

RESTCONF
Controller PlaPorm

The Learning Switch


Applica3on
4

FRM

10
9

3 No2ca2on
Delivery

MD-SAL

Request
Rou2ng

NoBcaBon

/cong
Flow

Request 11
Rou2ng

RPC

Openow Protocol Model


(Pkt in,Pkt out)

RPC

OpenFlow 1.0/1.3 Plugin


12

6
2

OpenFlow Java Library


13

7
PktOut

PktIn
1

Switch

FlowMod

Building the Sample Application


Prerequisites:

Java 7, Maven 3.0.5 or later, Linux or Mac


Mininet 2.1 with OpenFlow 1.3 virtual switches or CPQD (pointers)
OpenDaylight Base Edi2on (download & installa2on instruc2ons)

Download the applica2on code from ODL OpenFlow Plugin repo:


> git clone https://git.opendaylight.org/gerrit/p/openflowplugin.git

Build the applica2on:


> cd openflowplugin/samples/learning-switch/
> mvn clean install

The build creates the learning-switch-0.0.3-SNAPSHOT.jar bundle in


openowplugin/samples/learning-switch/target
Analyzing code in Eclipse:
Prerequisites: Install maven plugin for Eclipse

More informa2on:

hdps://wiki.opendaylight.org/view/OpenDaylight_Controller:Hydrogen_Developer_Guide:MD-
SAL_App_Tutorial

Starting the Environment


Prequisites:

Java 7, Maven 3.0.5 or later, on Linux or Mac


Mininet 2.1 with OpenFlow 1.3 virtual switches: or CPQD

Download OpenDaylight Base Edi2on: hdps://nexus.opendaylight.org/content/


repositories/opendaylight.release/org/opendaylight/integra2on/distribu2ons-
base/0.1.1/
Prepare the controller & applica2on:
Unzip the downloaded controller package
Delete the Simple Forwarding Applica2on bundle from the distribu2on:

> rm opendaylight/plugins/
org.opendaylight.controller.samples.simpleforwarding-0.4.1.jar

Upload the created bundle:

Put the learning-switch-0.0.3-SNAPSHOT.jar bundle into the opendaylight/plugins folder

Update logger congura2on:

Op2onally, add the following line to congura2on/logback.xml le:


<logger name="org.opendaylight.openflowplugin.learningswitch" level="TRACE"/>

Starting the Environment (Continued)


Run the controller:
> ./run.sh -of13

Check that the applica2on bundle is ac2ve. On the controller console, type:
osgi > lb learn

You should see something like:


START LEVEL 6
ID|State |Level|Name
103|Active | 4|learning-switch (0.0.3.SNAPSHOT)
osgi>

Op2onally, check that the controller is listening on Ports 6633 and 6653.
On a Linux console, type:

> netstat -lnp | grep 'java

On a Mac OSX console, type:

> lsof -i | grep LISTEN |grep java

Start Mininet:
> sudo mn --topo single,10 --controller 'remote,ip=<controller-ip-
address>,port=6633' --switch ovsk,protocols=OpenFlow13

Core Concepts: Instance Identifier


Unique iden2er of an element (loca2on) in the yang data
tree;
Basically, the path to the node that uniquely iden2es all the
node's parent nodes

Examples:
Java:
InstanceIdentifier<Node> identifier =
InstanceIdentifier.builder(Nodes.class).child(Node.class,new
NodeKey("foo")).build();

REST:
http://localhost:8080/restconf/config/inventory:nodes/node/foo

Running & Troubleshooting the App


Use RESTCONF to validate that the app started and installed
the ini2al ow into the switch:
On a REST console, issue:
GET http://<contr-ip-address>:8080/restconf/operational/
opendaylight-inventory:nodes/node/openflow:1/table/0
Accept Header: application/xml

There should be one ow on the switch forwarding all packets to the


controller

On Mininet, issue pings between each pair of hosts:


mininet> pingall

6 more ows should be installed in the host.

Other Things to Explore


Try a network of switches; start Mininet with:
sudo mn --topo tree,3 --controller 'remote,ip=192.168.4.1:6653' --
switch ovsk,protocols=OpenFlow13

Summary
OpenDaylight:
Controller PlaPorm
Model-Driven Applica2on Development Environment

Backup

BGP-LS Flow
Flow-capable Node Model
(Flow programming)

RESTCONF
Controller PlaPorm

BGP-LS Topology Exporter


MD-SAL Set

MD-SAL NoBcaBon

/oper

MD-SAL

BGP-RIB

MD-SAL Set

Openow Protocol Model


(Pkt in,Pkt out)

BGP-LS Plugin
6
2
3

4
5

BGP PDU

/oper
BGP-LS Topology

BGP-LS System Flow

[Sub-Section
Title]

You might also like