Luis Gomez, Principal SW Test Engineer, Brocade OpenFlow Tutorial Luis Gomez, Principal SW Test Engineer, Brocade
Agenda Introduction OpenFlow Plugin Architecture OpenFlow Plugin Installation OpenFlow Plugin Operation OpenFlow Plugin Troubleshooting
Introduction
OpenDaylight 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/
OpenFlow 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 Plugin Architecture
OpenFlow Plugin Architecture
OpenFlow Components 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 Plugin Installation
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.
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
Lab 1 – Install Tools VM 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 2 – Install Controller 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 3 – Start Network Simulation 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
OpenFlow Plugin Operation
OpenFlow REST API 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.
REST Tools 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
OpenFlow Information 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
Lab 4 – Read OpenFlow Information 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.
Flow Programming Add a Flow in Datastore: Add a Flow via RPC: 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 ID match function 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.
Lab 6 – Configure flows 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. Select Delete Flow RPC in POSTMAN and press Send button. Check flow is not in switch with Get Flow Operational.
OpenFlow Plugin Troubleshooting
Controller Log 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
Lab 7 – Enable OpenFlow Debug 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