Skip to content

Commit

Permalink
ovs-test: A new tool that allows to diagnose connectivity and perform…
Browse files Browse the repository at this point in the history
…ance issues

This tool will be a replacement for the current ovs-vlan-test
utility. Besides from connectivity issues it will also be able
to detect performance related issues in Open vSwitch setups.
Currently it uses UDP and TCP protocols for stressing.

Issue #6976
  • Loading branch information
Ansis Atteka committed Nov 18, 2011
1 parent 5e9cecc commit 0be6140
Show file tree
Hide file tree
Showing 20 changed files with 976 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ include vswitchd/automake.mk
include ovsdb/automake.mk
include rhel/automake.mk
include xenserver/automake.mk
include python/ovs/automake.mk
include python/automake.mk
include python/compat/automake.mk
7 changes: 6 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ post-v1.3.0
- Added ability to modify TTL in IPv4.
- ovs-appctl:
- New "fdb/flush" command to flush bridge's MAC learning table.
- ovs-test:
- A new distributed testing tool that allows one to diagnose performance
and connectivity issues. This tool currently is not included in RH or
Xen packages.
- RHEL packaging now supports integration with Red Hat network scripts.


v1.3.0 - xx xxx xxxx
------------------------
- OpenFlow:
Expand Down Expand Up @@ -88,7 +93,7 @@ v1.2.0 - 03 Aug 2011
datapath/linux-2.6/compat-2.6 directories.
- Feature removals:
- Dropped support for "tun_id_from_cookie" OpenFlow extension.
Please use the extensible match extensions instead.
Please use the extensible match extensions instead.
- Removed the Maintenance_Point and Monitor tables in an effort
to simplify 802.1ag configuration.
- Performance and scalability improvements
Expand Down
3 changes: 3 additions & 0 deletions debian/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ EXTRA_DIST += \
debian/openvswitch-switch.postinst \
debian/openvswitch-switch.postrm \
debian/openvswitch-switch.template \
debian/openvswitch-test.dirs \
debian/openvswitch-test.install \
debian/openvswitch-test.manpages \
debian/ovsdbmonitor.install \
debian/ovsdbmonitor.manpages \
debian/ovs-monitor-ipsec \
Expand Down
9 changes: 9 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,12 @@ Description: Open vSwitch graphical monitoring tool
to "ovs-vsctl list <table>").
.
Open vSwitch is a full-featured software-based Ethernet switch.

Package: openvswitch-test
Architecture: all
Depends: python-twisted-web, python-argparse
Description: Open vSwitch test package
This package contains utilities that are useful to diagnose
performance and connectivity issues in Open vSwitch setup.
.
Open vSwitch is a full-featured software-based Ethernet switch.
1 change: 1 addition & 0 deletions debian/openvswitch-test.dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/share/pyshared/ovstest/
2 changes: 2 additions & 0 deletions debian/openvswitch-test.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usr/share/openvswitch/python/ovstest usr/lib/python2.4/site-packages/
usr/bin/ovs-test
1 change: 1 addition & 0 deletions debian/openvswitch-test.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_debian/utilities/ovs-test.8
2 changes: 1 addition & 1 deletion debian/python-openvswitch.install
Original file line number Diff line number Diff line change
@@ -1 +1 @@
usr/share/openvswitch/python/* usr/lib/python2.4/site-packages/
usr/share/openvswitch/python/ovs usr/lib/python2.4/site-packages/
10 changes: 10 additions & 0 deletions manpages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ utilities/ovs-tcpundump.1.in:
lib/common-syn.man:
lib/common.man:

utilities/ovs-test.8: \
utilities/ovs-test.8.in \
lib/common-syn.man \
lib/common.man \
utilities/ovs-vlan-bugs.man
utilities/ovs-test.8.in:
lib/common-syn.man:
lib/common.man:
utilities/ovs-vlan-bugs.man:

utilities/ovs-vlan-bug-workaround.8: \
utilities/ovs-vlan-bug-workaround.8.in \
lib/common.man \
Expand Down
12 changes: 10 additions & 2 deletions python/ovs/automake.mk → python/automake.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
run_python = PYTHONPATH=$(top_srcdir)/python:$$PYTHON_PATH $(PYTHON)

ovstest_pyfiles = \
python/ovstest/__init__.py \
python/ovstest/args.py \
python/ovstest/rpcserver.py \
python/ovstest/tcp.py \
python/ovstest/udp.py \
python/ovstest/util.py

ovs_pyfiles = \
python/ovs/__init__.py \
python/ovs/daemon.py \
Expand All @@ -22,10 +30,10 @@ ovs_pyfiles = \
python/ovs/timeval.py \
python/ovs/vlog.py \
python/ovs/util.py
EXTRA_DIST += $(ovs_pyfiles) python/ovs/dirs.py
EXTRA_DIST += $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)

if HAVE_PYTHON
nobase_pkgdata_DATA = $(ovs_pyfiles)
nobase_pkgdata_DATA = $(ovs_pyfiles) $(ovstest_pyfiles)
ovs-install-data-local:
$(MKDIR_P) python/ovs
(echo "import os" && \
Expand Down
1 change: 1 addition & 0 deletions python/ovstest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file intentionally left blank.
115 changes: 115 additions & 0 deletions python/ovstest/args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Copyright (c) 2011 Nicira Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
ovsargs provide argument parsing for ovs-test utility
"""

import argparse
import socket
import re


def ip(string):
"""Verifies if string is a valid IP address"""
try:
socket.inet_aton(string)
except socket.error:
raise argparse.ArgumentTypeError("Not a valid IPv4 address")
return string


def port(string):
"""Convert a string into a Port (integer)"""
try:
port_number = int(string)
if port_number < 1 or port_number > 65535:
raise argparse.ArgumentTypeError("Port is out of range")
except ValueError:
raise argparse.ArgumentTypeError("Port is not an integer")
return port_number


def ip_optional_port(string, default_port):
"""Convert a string into IP and Port pair. If port was absent then use
default_port as the port"""
value = string.split(':')
if len(value) == 1:
return (ip(value[0]), default_port)
elif len(value) == 2:
return (ip(value[0]), port(value[1]))
else:
raise argparse.ArgumentTypeError("IP address from the optional Port "
"must be colon-separated")



def server_endpoint(string):
"""Converts a string in ControlIP[:ControlPort][,TestIP[:TestPort]] format
into a 4-tuple, where:
1. First element is ControlIP
2. Second element is ControlPort (if omitted will use default value 15531)
3 Third element is TestIP (if omitted will be the same as ControlIP)
4. Fourth element is TestPort (if omitted will use default value 15532)"""
value = string.split(',')
if len(value) == 1: # TestIP and TestPort are not present
ret = ip_optional_port(value[0], 15531)
return (ret[0], ret[1], ret[0], 15532)
elif len(value) == 2:
ret1 = ip_optional_port(value[0], 15531)
ret2 = ip_optional_port(value[1], 15532)
return (ret1[0], ret1[1], ret2[0], ret2[1])
else:
raise argparse.ArgumentTypeError("ControlIP:ControlPort and TestIP:"
"TestPort must be comma "
"separated")


def bandwidth(string):
"""Convert a string (given in bits/second with optional magnitude for
units) into a long (bytes/second)"""
if re.match("^[1-9][0-9]*[MK]?$", string) == None:
raise argparse.ArgumentTypeError("Not a valid target bandwidth")
bwidth = string.replace("M", "000000")
bwidth = bwidth.replace("K", "000")
return long(bwidth) / 8 # Convert from bits to bytes


def ovs_initialize_args():
"""Initialize args for ovstest utility"""
parser = argparse.ArgumentParser(description = 'Test ovs connectivity')
parser.add_argument('-v', '--version', action = 'version',
version = 'ovs-test (Open vSwitch) @VERSION@')
parser.add_argument("-b", "--bandwidth", action = 'store',
dest = "targetBandwidth", default = "1M", type = bandwidth,
help = 'target bandwidth for UDP tests in bits/second. Use '
'postfix M or K to alter unit magnitude.')
group = parser.add_mutually_exclusive_group(required = True)
group.add_argument("-s", "--server", action = "store", dest = "port",
type = port,
help = 'run in server mode and wait client to connect to this '
'port')
group.add_argument('-c', "--client", action = "store", nargs = 2,
dest = "servers", type = server_endpoint,
metavar = ("SERVER1", "SERVER2"),
help = 'run in client mode and do tests between these '
'two servers. Each server must be specified in following '
'format - ControlIP[:ControlPort][,TestIP[:TestPort]]. If '
'TestIP is omitted then ovs-test server will also use the '
'ControlIP for testing purposes. ControlPort is TCP port '
'where server will listen for incoming XML/RPC control '
'connections to schedule tests (by default 15531). TestPort '
'is port which will be used by server to send test traffic '
'(by default 15532)')
return parser.parse_args()
Loading

0 comments on commit 0be6140

Please sign in to comment.