+ {
+ # 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...
+ },