summaryrefslogtreecommitdiffstats
path: root/src/ovs/ofctl.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-05-18 10:18:38 +0100
committerMartin Klozik <martinx.klozik@intel.com>2017-06-02 13:39:21 +0100
commitde6fc4b670fc42fc96f27f375fbcf7a099629434 (patch)
tree4b2b87baef82fffee6645d428794ee83a09da893 /src/ovs/ofctl.py
parent862ef28b808aca4dd75cc44a83023362dcce1969 (diff)
tests: Improvement of step driven testcases
A set of improvements was introduced to enhance step driven testcases capabilities. Details: * delay among test steps is configurable by TEST_STEP_DELAY parameter * step driven tool function exec was renamed to exec_shell * new step driven tool function exec_python was introduced to execute a python code * new step driven object sleep was introduced to pause test execution for defined number of seconds. * fixed bug in settings.validate_getValue() to correctly validate access of parameters modified by TEST_PARAMS * new #PARAM() macro was introduced to allow references among configuration parameters * multistream support has been added into ixnetrfc2544v2.tcl, which is used for tunneling protocols test (op2p deployment) * fixed bug in op2p deployment to list interfaces and flows from both bridges involved in the test * test report updated to state exact rfcxxxx type of traffic type, e.g. rfc2544_continuous * test report of step driven testcases was updated to contain measured values from traffic generator in CSV report * method for ovs flow comparison was modified to normalize IPv4 CIDR network addr (e.g. 10.0.0.5/8 => 10.0.0.0/8) JIRA: VSPERF-512 Change-Id: Ib4f38dcdfbf3820dd766b25520da0ad0c81f3293 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com> Reviewed-by: Trevor Cooper <trevor.cooper@intel.com> Reviewed-by: Ciara Loftus <ciara.loftus@intel.com>
Diffstat (limited to 'src/ovs/ofctl.py')
-rw-r--r--src/ovs/ofctl.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py
index f0d116da..64d54466 100644
--- a/src/ovs/ofctl.py
+++ b/src/ovs/ofctl.py
@@ -22,6 +22,7 @@ https://github.com/openstack/neutron/blob/6eac1dc99124ca024d6a69b3abfa3bc69c7356
import logging
import string
import re
+import netaddr
from tools import tasks
from conf import settings
@@ -31,6 +32,9 @@ _OVS_CMD_TIMEOUT = settings.getValue('OVS_CMD_TIMEOUT')
_CACHE_FILE_NAME = '/tmp/vsperf_flows_cache'
+# only simple regex is used; validity of IPv4 is not checked by regex
+_IPV4_REGEX = r"([0-9]{1,3}(\.[0-9]{1,3}){3}(\/[0-9]{1,2})?)"
+
class OFBase(object):
"""Add/remove/show datapaths using ``ovs-ofctl``.
"""
@@ -446,10 +450,17 @@ def flow_match(flow_dump, flow_src):
flow_src = flow_src.replace('udp_dst', 'tp_dst')
flow_src = flow_src.replace('tcp_src', 'tp_src')
flow_src = flow_src.replace('tcp_dst', 'tp_dst')
+ flow_src = flow_src.replace('0x800', '0x0800')
+
+ # modify IPv4 CIDR to real network addresses
+ for ipv4_cidr in re.findall(_IPV4_REGEX, flow_src):
+ if ipv4_cidr[2]:
+ tmp_cidr = str(netaddr.IPNetwork(ipv4_cidr[0]).cidr)
+ flow_src = flow_src.replace(ipv4_cidr[0], tmp_cidr)
# split flow strings into lists of comparable elements
- flow_dump_list = re.findall(r"[\w.:=()]+", flow_dump)
- flow_src_list = re.findall(r"[\w.:=()]+", flow_src)
+ flow_dump_list = re.findall(r"[\w.:=()/]+", flow_dump)
+ flow_src_list = re.findall(r"[\w.:=()/]+", flow_src)
# check if all items from source flow are present in dump flow
flow_src_ctrl = list(flow_src_list)