From eabc66eef336b3c47c366027b205d26db10a3c21 Mon Sep 17 00:00:00 2001
From: Martin Klozik <martinx.klozik@intel.com>
Date: Mon, 24 Oct 2016 12:37:26 +0100
Subject: cli: Modify configuration via CLI

In the past, only a few configuration parameters could be
modified via --test-params CLI argument and it was not easy
to find out their complete list.
This patch adds support for generic modification of any
configuration parameter via CLI argument --test-params
or by "Parameters" section of testcase definition.
Thus it is possible to customize a vsperf configuration
environment per testcase or for each vsperf execution.
Old CLI parameters duration, pkt_sizes, rfc2544_tests
and rfc2889_trials were renamed to TRAFFICGEN_DURATION,
TRAFFICGEN_PKT_SIZES, TRAFFICGEN_RFC2544_TESTS and
TRAFFICGEN_RFC2889_TRIALS to be consistent with
other configuration parameters.

JIRA: VSPERF-375

Change-Id: I50a1f4ff7250d754aa8af0295a9c7c1be8151175
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: Bill Michalowski <bmichalo@redhat.com>
Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com>
Reviewed-by: <sridhar.rao@spirent.com>
---
 vnfs/qemu/qemu.py                 | 34 +++++++++-------------------------
 vnfs/qemu/qemu_dpdk_vhost_user.py |  5 -----
 2 files changed, 9 insertions(+), 30 deletions(-)

(limited to 'vnfs')

diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index 51553277..997f93e0 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -24,7 +24,6 @@ import time
 import pexpect
 
 from conf import settings as S
-from conf import get_test_param
 from vnfs.vnf.vnf import IVnf
 
 class IVnfQemu(IVnf):
@@ -69,7 +68,6 @@ class IVnfQemu(IVnf):
         self._nics = S.getValue('GUEST_NICS')[self._number][:nics_nr]
 
         # set guest loopback application based on VNF configuration
-        # cli option take precedence to config file values
         self._guest_loopback = S.getValue('GUEST_LOOPBACK')[self._number]
 
         self._testpmd_fwd_mode = S.getValue('GUEST_TESTPMD_FWD_MODE')[self._number]
@@ -81,11 +79,6 @@ class IVnfQemu(IVnf):
                               self._testpmd_fwd_mode, 'io')
             self._testpmd_fwd_mode = 'io'
 
-        guest_smp = int(get_test_param('guest_smp', 0))
-        if guest_smp:
-            override_list = [guest_smp] * (self._number + 1)
-            S.setValue('GUEST_SMP', override_list)
-
         name = 'Client%d' % self._number
         vnc = ':%d' % self._number
         # NOTE: affinization of main qemu process can cause hangup of 2nd VM
@@ -238,18 +231,14 @@ class IVnfQemu(IVnf):
             stdin=proc.stdout)
         proc.wait()
 
-        guest_core_binding = int(get_test_param('guest_core_binding', 0))
         for cpu in range(0, int(S.getValue('GUEST_SMP')[self._number])):
             match = None
             for line in output.decode(cur_locale).split('\n'):
                 match = re.search(thread_id % cpu, line)
                 if match:
-                    if guest_core_binding:
-                        self._affinitize_pid(guest_core_binding, match.group(1))
-                    else:
-                        self._affinitize_pid(
-                            S.getValue('GUEST_CORE_BINDING')[self._number][cpu],
-                            match.group(1))
+                    self._affinitize_pid(
+                        S.getValue('GUEST_CORE_BINDING')[self._number][cpu],
+                        match.group(1))
                     break
 
             if not match:
@@ -397,10 +386,9 @@ class IVnfQemu(IVnf):
         self.execute_and_wait('make')
 
         # get testpmd settings from CLI
-        testpmd_params = get_test_param('guest_testpmd_params',
-                                        S.getValue('GUEST_TESTPMD_PARAMS')[self._number])
+        testpmd_params = S.getValue('GUEST_TESTPMD_PARAMS')[self._number]
 
-        self.execute_and_wait( './testpmd {}'.format(testpmd_params), 60, "Done")
+        self.execute_and_wait('./testpmd {}'.format(testpmd_params), 60, "Done")
         self.execute('set fwd ' + self._testpmd_fwd_mode, 1)
         self.execute_and_wait('start', 20, 'testpmd>')
 
@@ -458,17 +446,13 @@ class IVnfQemu(IVnf):
 
         # Add the arp entries for the IXIA ports and the bridge you are using.
         # Use command line values if provided.
-        trafficgen_mac = get_test_param('vanilla_tgen_port1_mac',
-                                        S.getValue('VANILLA_TGEN_PORT1_MAC'))
-        trafficgen_ip = get_test_param('vanilla_tgen_port1_ip',
-                                       S.getValue('VANILLA_TGEN_PORT1_IP'))
+        trafficgen_mac = S.getValue('VANILLA_TGEN_PORT1_MAC')
+        trafficgen_ip = S.getValue('VANILLA_TGEN_PORT1_IP')
 
         self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
 
-        trafficgen_mac = get_test_param('vanilla_tgen_port2_mac',
-                                        S.getValue('VANILLA_TGEN_PORT2_MAC'))
-        trafficgen_ip = get_test_param('vanilla_tgen_port2_ip',
-                                       S.getValue('VANILLA_TGEN_PORT2_IP'))
+        trafficgen_mac = S.getValue('VANILLA_TGEN_PORT2_MAC')
+        trafficgen_ip = S.getValue('VANILLA_TGEN_PORT2_IP')
 
         self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
 
diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py
index a25c61ef..51c10242 100644
--- a/vnfs/qemu/qemu_dpdk_vhost_user.py
+++ b/vnfs/qemu/qemu_dpdk_vhost_user.py
@@ -18,7 +18,6 @@
 import logging
 
 from conf import settings as S
-from conf import get_test_param
 from vnfs.qemu.qemu import IVnfQemu
 
 class QemuDpdkVhostUser(IVnfQemu):
@@ -33,10 +32,6 @@ class QemuDpdkVhostUser(IVnfQemu):
         self._logger = logging.getLogger(__name__)
 
         # multi-queue values
-        guest_nic_queues = int(get_test_param('guest_nic_queues', 0))
-        if guest_nic_queues:
-            override_list = [guest_nic_queues] * (self._number + 1)
-            S.setValue('GUEST_NIC_QUEUES', override_list)
         if int(S.getValue('GUEST_NIC_QUEUES')[self._number]):
             queue_str = ',queues={}'.format(S.getValue('GUEST_NIC_QUEUES')[self._number])
             mq_vector_str = ',mq=on,vectors={}'.format(
-- 
cgit