openflow usage - javimg89/openmano GitHub Wiki
#Table of Contents#
There are a tool for testing the openflow controller called "openflow" under "./openvim" folder. This tool uses the same 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
##General commands##
$ ./openflow -h|--help # show help message and exit
$ ./openflow --version # show program's version number and exit
$ ./openflow config # prints configuration values
##Setting environment variables##
These are the shell variables this tool uses
$ ./openflow config openflow.cfg # extract and prints configuration variables
export OPENVIM_HOST=localhost #used for "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
##Basic actions##
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:
-
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
-
delete FLOW: delete a concrete openflow rule, the name must be provided
-
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 [--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 ACT] [--out ACT] options, that can be inserted several times and they are applied by the appearance order.
-
install FILE : insert the rules stores in a file created by the "list" command
-
reinstall: call openvim to reinstall the rules (same as openvim openflow-net-reinstall)
#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 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.
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