Testing and Debugging

Testing and Debugging

This page discusses the testing and debugging capabilities that come with Dragonflow.

Testing

After installing with devstack, there are a few tests that can be ran to verify Dragonflow was installed correctly.

Fullstack tests

The fullstack tests execute Neutron API commands, and then verifies the pipeline. This is done by creating relevant ports, simulating a plug-vif event, and then passing packets on these ports. The tests verify that packets are received if and only if they are supposed to, and that any necessary modification is done, e.g. replacing L2 addresses in L3 routing.

To run the tests:

tox -e fullstack

It is possible to have the fullstack tests take authentication information from the environment variable, using e.g. an openrc file, such as provided by devstack or openstack-ansible.

To do so, set the environment variable DF_FULLSTACK_USE_ENV

export DF_FULLSTACK_USE_ENV=1

Debugging

There are a few tools that exist to debug Dragonflow. Most of them are geared towards verifying the pipeline was installed correctly.

ovs-ofctl dump-flows

sudo ovs-ofctl dump-flows br-int -O OpenFlow13

This command will display the pipeline that has been installed in OVS. See the manual page for ovs-ofctl for more info.

It is worthwhile to note that each flow contains statistics such as how many packets matched this flow, and what is the cumulative size. The output shows the table IDs that the packets go through. In order to make the output more readable and add the table names, one can use the following script (relative path from the dragonflow project root): tools/add_table_names

The usage is very straight forward:

sudo ovs-ofctl dump-flows br-int -O OpenFlow13 | /opt/stack/dragonflow/tools/add_table_names

ovs-appctl ofproto/trace

sudo ovs-appctl ofproto/trace br-int <flow>

This command will simulate a packet matching the given flow through the pipeline. The perl script in [1] can be used to facilitate the use of this tool. The script also recirculates the packet when necessary, e.g. for connection tracking.

df-db

df-db

This utility will allow to inspect Dragonflow northbound database. You can dump db content, list db tables, list db table keys and print value of the specific key in the table. Use df-db –help to list and get details on supported sub-commands.

df-model

df-model

This utility will allow to print a representation of the DragonFlow model in different formats. Currently supported formats are: plaintext, PlantUML, rst and JsonSchema (OpenApiSchema 3.0). The output may be sent to the stdout or to a file.

Use the df-model –help command to get a detailed usage instructions.
  • PlantUML output may be visualized using the PlantUML Server [2]
  • rst output may be visualized using Online reStructuredText editor [3]

SimulateAndSendAction class

In the tests, you can have the above mentioned script run automatically for a packet you are about to send before actually sending it. This should be done by changing the SendAction for the packet to SimulateAndSendAction. Note that in order to use this functionality, you would have to add some rootwrap configuration so that the dragonflow controller will be able to launch the ovs-appctl command [4]. To have this configured automatically, add the following line to the local .conf before running the stack.sh script (for devstack only)

DF_INSTALL_DEBUG_ROOTWRAP_CONF=True

[1]https://gist.github.com/omeranson/5c731955edcf0517bfb0ce0ce511cc9b
[2]http://www.plantuml.com/plantuml/uml/
[3]http://rst.ninjs.org/?theme=nature
[4]http://docs.openvswitch.org/en/latest/topics/tracing/
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.