odl summit openflow tutorial - schedschd.ws/.../0f/odl_summit_openflow_tutorial.pdf · (sdn) and...

25
OpenFlow Tutorial Luis Gomez, Principal SW Test Engineer, Brocade

Upload: dangdieu

Post on 05-Apr-2018

234 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Tutorial

Luis Gomez, Principal SW Test Engineer, Brocade

Page 2: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Introduction • OpenFlow Plugin Architecture • OpenFlow Plugin Installation • OpenFlow Plugin Operation • OpenFlow Plugin Troubleshooting

Agenda

Page 3: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

Introduction

Page 4: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• The OpenDaylight project is a collaborative open source project that aims to accelerate adoption of Software-Defined Networking (SDN) and Network Functions Virtualization (NFV) with a transparent approach that fosters new innovation.

• Main page: http://www.opendaylight.org • Wiki page: https://wiki.opendaylight.org/ • Documentation: https://docs.opendaylight.org/

OpenDaylight

Page 5: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• OpenFlow is the first standard communications interface defined between the control and forwarding layers of an SDN architecture. OpenFlow allows direct access to and manipulation of the forwarding plane of network devices such as switches and routers, both physical and virtual (hypervisor-based).

• ONF page: http://www.opennetworking.org/sdn-resources/openflow

OpenFlow

Page 6: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Architecture

Page 7: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Architecture

Page 8: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• OpenFlowJava is a library that implements the OpenFlow codec – it translates OpenFlow messages into their respective internal representations and vice versa.

• OpenFlow Plugin: terminates sessions to OpenFlow switches, provides a per-switch low-level OpenFlow service API (add-modify-flow, delete-flow, etc.)

• Statistics Manager: is responsible for collecting statistics/status from attached OpenFlow switches and storing them into the operational data store for applications’ use.

• Topology Manager: is responsible for discovering the OpenFlow topology using LLDP and putting them into the operational data store for applications’ use.

• Forwarding Rules Manager: the “top level” OpenFlow module that exposes the OF functionality to controller apps, provides the app-level API. Main entity that manages the OpenFlow switch inventory and the configuration (programming) of flows in switches. It also reconciles user configuration with network state discovered by the OpenFlow plugin.

OpenFlow Components

Page 9: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Installation

Page 10: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Features

• Normal user features • odl-openflowplugin-flow-services-rest -> OF plugin with REST API. • odl-openflowplugin-flow-services-ui -> OF plugin with REST API + GUI. • odl-openflowplugin-app-table-miss-enforcer -> Adds default flow to controller. • odl-openflowplugin-nxm-extensions -> Nicira extensions for OVS.

• Test features: • odl-openflowplugin-drop-test -> Test application for pushing flows on packet-in. • odl-openflowplugin-app-bulk-o-matic -> Test application for pushing bulk flows.

Page 11: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Configuration

• New configuration is in: <distribution-folder>/etc/org.opendaylight.openflowplugin.cfg • Old configuration is in: <distribution-folder>/etc/opendaylight/karaf/42-openflowplugin-Li.xml

Page 12: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Plug USB stick in your laptop. • Install VirtualBox. • Import VM image: tools-vm-ubuntu.ova • Check VM specs (2 Cores/4 GB RAM) fit in your system. • Start VM (user:vagrant/pwd:vagrant)

Lab 1 – Install Tools VM

Page 13: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Open a terminal window: • Click on the black terminal icon on the left quick launch menu.

• Extract the distribution: • unzip distribution-karaf-0.5.0-Boron.zip

• Start the controller: • cd distribution-karaf-0.5.0-Lithium • bin/karaf

• Install openflow main feature: • feature:install odl-openflowplugin-flow-services-ui

Lab 2 – Install Controller

Page 14: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Open a terminal window: • Click on the terminal icon on the left menu or open a new tab on existing

terminal window. • Start mininet simulation and ping all hosts:

• sudo mn --controller=remote,ip=127.0.0.1 --topo tree,2 • Open the controller GUI at http://localhost:8181/index.html

• Default user/pasw is admin/admin. • Install table miss feature (this is required for link discovery):

• feature:install odl-openflowplugin-app-table-miss-enforcer

Lab 3 – Start Network Simulation

Page 15: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Operation

Page 16: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• OpenFlow REST API is automatically generated from internal yang models. Models support for Datastore read/write and RPC operations.

• Datastore read only API: • Topology operational: contains link information discovered by topology manager. • Inventory operational: contains nodes, ports, tables, flows, groups and meters information

and statistics collected by the OpenFlow plugin. • Datastore write/read API:

• Inventory config: allows user to configure flows, groups and meters. The configuration is stored, persisted in disk and replicated in cluster.

• RPC Operations API: • Sal-flow operations: allows user to configure flows, groups and meters. The configuration

goes directy to the OpenFlow plugin.

OpenFlow REST API

Page 17: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• YangUI application in controller GUI. • Allows to browse controller URLs and methods.

• Chrome POSTMAN extension. • Easy create and share REST collections.

• cURL command in Linux systems. • Easy write shell script.

• REST libraries are available for most programming languages. • IMPORTANT: In all tools set the following headers:

• Authorization (basic): admin/admin • Accept (answer body): application/xml or application/json • Content-Type (request body): application/xml or application/json

REST Tools

Page 18: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Read Topology Operational Information: • GET http://localhost:8181/restconf/operational/network-topology:network-topology/

• Read Inventory Information: • GET http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/

• Read Node information: • GET http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/

openflow:1 • Read Table information:

• GET http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0

OpenFlow Information

Page 19: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Open Chrome POSTMAN extension. • Click on the white “applications” icon on the left quick launch menu.

• On the left select Collections and click on OpenFlow. • Select Get Topology and press Send button.

• Check Topology operational information. • Select Get Inventory and press Send button.

• Check Inventory operational information. • Modify request URL to retrieve specific node or table information.

Lab 4 – Read OpenFlow Information

Page 20: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Add a Flow in Datastore: • PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/

table/0/flow/1 • Add a Flow via RPC:

• POST http://localhost:8181/restconf/operations/sal-flow:add-flow

• Comments: • Examples of flow configuration are available in: https://wiki.opendaylight.org/view/

Editing_OpenDaylight_OpenFlow_Plugin:End_to_End_Flows:Example_Flows • Flow configuration can be expressed in json or xml. • It is possible to add multiple flows to Datastore in a single REST request. • RPC call returns flow installation errors.

Flow Programming

Page 21: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• When the controller receives flow information from a switch, this information is compared with all flows stored in config, in case of a match the flow ID of the flow config is automatically added to the flow operational information. This way we can easily relate flows stored in controller with flows received from the switch.

• In case of flows added via RPC or in general when the controller cannot match received flow information with any flow in datastore, it adds an alien ID in the flow operational information.

Flow ID match function

Page 22: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Select Add Flow in POSTMAN and press Send button. • Check flow operational information with Get Flow Operational. • Check Flow ID in the flow operational information.

• Select Delete Flow in POSTMAN and press Send button. • Check flow is no in switch with Get Flow Operational.

• Select Add Flow RPC in POSTMAN and press Send button. • Check flow operational information with Get Flow Operational. • Check Flow ID in the flow operational information.

• Select Delete Flow RPC in POSTMAN and press Send button. • Check flow is not in switch with Get Flow Operational.

Lab 6 – Configure flows

Page 23: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

OpenFlow Plugin Troubleshooting

Page 24: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Controller log is in: <distribution-folder>/data/log/karaf.log • It can be also displayed on karaf console:

• log:display • For troubleshooting do:

• log:set TRACE org.opendaylight.openflowplugin.openflow.md.core • log:set TRACE org.opendaylight.openflowplugin.impl

• To restore log settings: • log:set INFO org.opendaylight.openflowplugin.openflow.md.core • log:set INFO org.opendaylight.openflowplugin.impl

Controller Log

Page 25: ODL Summit OpenFlow Tutorial - Schedschd.ws/.../0f/ODL_Summit_OpenFlow_Tutorial.pdf · (SDN) and Network Functions Virtualization ... of flows in switches. ... ODL_Summit_OpenFlow_Tutorial

• Enable debug in controller karaf console: • log:set TRACE org.opendaylight.openflowplugin.openflow.md.core • log:set TRACE org.opendaylight.openflowplugin.impl

• Display controller log: • log:display

Lab 7 – Enable OpenFlow Debug