Skip to content

openflow usage

Gerardo García edited this page Nov 28, 2016 · 4 revisions

This page is obsolete.

The project OpenMANO has been contributed to the open source community project Open Source MANO (OSM), hosted by ETSI.

Go to the URL osm.etsi.org to know more about OSM.


#Table of Contents#

#openflow client#

The "openflow" tool is under "./openvim" folder. Its target is for testing the openflow controller. This tool uses the same "software connectors" as openvim, so that it is usefull to both testing these connectors (floodlight.py, ODL.py) and testing the openflow controller compatibility

##Getting help##

$ ./openflow -h
usage: openflow [-h] [--version]
{config,add,delete,switches,list,clear,install,reinstall,port-list}

You can get additional help for each command by running:

$ ./openflow <command> --help

And the version with:

$ ./openflow --version            # show program's version number and exit

##Configuration##

You must provide the openflow controller name/IP address, port, credential, etc. through shell variables.

$ ./openflow config  # prints configuration variables

These are the shell variables this tool uses with some examples:

export OPENVIM_HOST=localhost          #used for the "reinstall" command
export OPENVIM_ADMIN_PORT=8085
export OF_CONTROLLER_TYPE=floodlight   #'floodlight' or 'opendaylight'
export OF_CONTROLLER_USER=admin        #if needed
export OF_CONTROLLER_PASSWORD=admin
export OF_CONTROLLER_IP=localhost
export OF_CONTROLLER_PORT=8080
export OF_CONTROLLER_DPID=00:01:02:03:e4:05:e6:07

##Commands##

openflow acts directly over the openflow controller, except for the "reinstall" command that acts over the openvim to reinstall the openvim rules. The commands are (and this is the recomended order to test openflow controller/switch):

  • switches: list the DPID available at this openflow controller

  • port-list: list the ports (both physical switch naming and openflow naming) available for the concrete switch (OF CONTROLLER DPID)

  • list: list the openflow rules. Can be stored in a file for using later with "install"

  • clear: clear all the openflow rules

  • add ...: add a new rule

    Appart from the optional [--priority PRIORITY] [--matchmac MATCHMAC] [--matchvlan MATCHVLAN] options; you need to supply the [--inport port], and the actions. The actions can be inserted with one of this way:

  • [--actions ] followed by a comma separated list of ACTION=VALUE pairs, where:

         ACTION=VALUE can be
         vlan=null    for stripping the vlan
         vlan=<tag>   for adding the vlan tag
         out=<port>   to send this packet to this port
    
  • Alternativelly you can provide the actions with the [--stripvlan] [--setvlan TAG] [--out PORT] options, that can be inserted several times and they are applied by the appearance order.

  • delete FLOW: delete a concrete openflow rule, the name must be provided

  • install FILE : insert the rules stores in a file created by the "list" command

  • reinstall: call openvim to reinstall the rules (same as the openvim "openflow-net-reinstall" command)

#openflow connectors (for developers)#

Currently there are two connectors, for floodlight (floodlight.py) and for opendaylight (ODL.py).

In this version the controller run in proactive mode, where the rules are inserted beforehand for the interconnected ports. The openvim module in charge of this task is openflow_thread.py. It uses the well-known mac address, physical port and vlan tag of each one of the "openvim ports" that must be connected among them.

This module computes all the openflow rules that are inserted using the connectors. Each time a port (VM interface) is attached/detached to a network, this module computes the needed rules. It adds the new needed ones and deletes the existing not needed, in this order so that service is not interrupted.

The connectors are quite simple and implement a OF_conn class with the following methods:

  • --init-- constructor
  • get-of-switches list the DPID list
  • obtain-port-correspondence that retrieves and stores the translation between physical port name and openflow port name
  • get-of-rules get the installed openflow rules
  • del-flow to remove an openflow rule
  • new-flow to insert a new openflow rule
  • clear-all-flows to remove all openflow rules