From f437566cf8c52619d062dd05447e6d512a138ce9 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Tue, 20 Sep 2016 15:49:46 +0100 Subject: integration: Test vHost User numa awareness Open vSwitch with DPDK can optimize memory usage in case of NUMA architecture to avoid unnecessary memory access across NUMA slots. In a nutshell, PMD threads serving virtual NICs are co-located at the same NUMA slot as QEMU instance, which is using these NICs. This patch adds new (functional) integration testcase, which verifies OVS vHost User numa awareness feature. Step driven test objects were updated to allow a call of OS utilies and evaluation of conditions. Also the documentation was updated with the list of supported test objects and their methods. JIRA: VSPERF-377 Change-Id: I184e71e066d27b5b9fc9e6a9f7e240e2d1b5a0fa Signed-off-by: Martin Klozik Reviewed-by: Maryam Tahhan Reviewed-by: Ciara Loftus Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Bill Michalowski Reviewed-by: Antonio Fischetti --- conf/__init__.py | 15 ++++++++ conf/integration/01_testcases.conf | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) (limited to 'conf') diff --git a/conf/__init__.py b/conf/__init__.py index 88e8cec6..4d6f57fe 100644 --- a/conf/__init__.py +++ b/conf/__init__.py @@ -170,6 +170,7 @@ class Settings(object): for macro, args, param, _, step in re.findall(_PARSE_PATTERN, value): multi = int(step) if len(step) and int(step) else 1 if macro == '#EVAL': + # pylint: disable=eval-used tmp_result = str(eval(param)) elif macro == '#MAC': mac_value = netaddr.EUI(param).value @@ -204,6 +205,20 @@ class Settings(object): """ return pprint.pformat(self.__dict__) + # + # validation methods used by step driven testcases + # + def validate_getValue(self, result, attr): + """Verifies, that correct value was returned + """ + assert result == self.__dict__[attr] + return True + + def validate_setValue(self, dummy_result, name, value): + """Verifies, that value was correctly set + """ + assert value == self.__dict__[name] + return True settings = Settings() diff --git a/conf/integration/01_testcases.conf b/conf/integration/01_testcases.conf index a67702f8..084323b2 100644 --- a/conf/integration/01_testcases.conf +++ b/conf/integration/01_testcases.conf @@ -649,6 +649,79 @@ INTEGRATION_TESTS = [ ] + STEP_VSWITCH_FLOWS_FINIT + STEP_VSWITCH_2PHY_6VM_FINIT }, + { + # Testcase for verification of vHost User NUMA awareness feature + # introduced in DPDK v2.2. Test case will execute two VNFs, each + # pinned to different NUMA slot. After that it will verify that + # QEMU and PMD threads serving its interfaces are co-located + # at the same NUMA slot. + # + # Prerequisites: + # * architecture with at least 2 NUMA slots + # * OVS with DPDK support and DPDK v2.2 and newer + # * OVS configuration utilizing both NUMA slots + # + # Example of OVS configuration valid for DPDK v16.04 and cores + # split between NUMA slots as follows: + # node 0 cpus: 0 1 2 3 4 5 6 7 8 9 + # node 1 cpus: 10 11 12 13 14 15 16 17 18 19 + # + # VSWITCH_PMD_CPU_MASK = '1010' + # VSWITCHD_DPDK_CONFIG = { + # 'dpdk-init' : 'true', + # 'dpdk-lcore-mask' : '0x4004', + # 'pmd-cpu-mask' : 'FF0FF', + # 'dpdk-socket-mem' : '1024,1024', + # } + # + "Name": "vhost_numa_awareness", + "Deployment": "clean", + "Description": "vSwitch DPDK - verify that PMD threads are served " + "by the same NUMA slot as QEMU instances", + "vSwitch" : "OvsDpdkVhost", + "TestSteps": STEP_VSWITCH_PVVP_INIT + # STEP 0-6 + [ + # check that at least 2 numa slots are available + ['tools', 'exec', 'numactl -H', 'available: ([0-9]+)'], # STEP 7 + ['tools', 'assert', '#STEP[-1][0]>1'], # STEP 8 + # store last 2 cores from numa slot 0 + ['tools', 'exec', 'numactl -H', 'node 0 cpus:.*\s+(\\d+) (\\d+)$'], # STEP 9 + # store last 2 cores from numa slot 1 + ['tools', 'exec', 'numactl -H', 'node 1 cpus:.*\s+(\\d+) (\\d+)$'], # STEP 10 + # pin VNF1 to 1st NUMA slot and VNF2 to 2nd NUMA slot + ['settings', 'setValue', 'GUEST_CORE_BINDING', # STEP 11 + [("#STEP[-2][0][0]", "#STEP[-2][0][1]"), + ("#STEP[-1][0][0]", "#STEP[-1][0][1]")] + ], + # start 2 VNFs + ['vnf1', 'start'], # STEP 12 + ['vnf2', 'start'], # STEP 13 + # read paths to ovs utilities + ['settings', 'getValue', 'TOOLS'], # STEP 14 + # check that PMD thread serving VNF1 runs at NUMA slot 0 + ## i.e. get numa slot ID serving dpdhvhostuser0... + ['tools', 'exec', "sudo #STEP[-1]['ovs-appctl'] " # STEP 15 + "dpif-netdev/pmd-rxq-show | " + "sed -e '/dpdkvhostuser0/,$d' | tac", + 'pmd thread numa_id ([0-9])+' + ], + ## ...and check that it is NUMA slot 0 + ['tools', 'assert', '#STEP[-1][0]==0'], # STEP 16 + # check that PMD thread serving VNF2 runs at NUMA slot 1 + ## i.e. get numa slot ID serving dpdhvhostuser2... + ['tools', 'exec', "sudo #STEP[-3]['ovs-appctl'] " # STEP 17 + "dpif-netdev/pmd-rxq-show | " + "sed -e '/dpdkvhostuser2/,$d' | tac", + 'pmd thread numa_id ([0-9])+' + ], + ## ...and check that it is NUMA slot 1 + ['tools', 'assert', '#STEP[-1][0]==1'], # STEP 18 + # clean up + ['vnf2', 'stop'], # STEP 19 + ['vnf1', 'stop'], # STEP 20 + ] + + STEP_VSWITCH_PVVP_FINIT # STEP 21... + }, ] # Example of TC definition with exact vSwitch, VNF and TRAFFICGEN values. -- cgit 1.2.3-korg