aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrest Voznyy <orestx.voznyy@intel.com>2018-10-08 20:06:02 +0300
committerAbhijit Sinha <abhijit.sinha@intel.com>2018-10-30 10:12:50 +0000
commit50c1a91b2cb7441475f3cd2aae659b62210bcf1b (patch)
tree987ad793b7c73801920a360d8a2daefadeef24c6
parente0b7c0ad95d44eea4db4a3fb532f51688c97c8fc (diff)
Add traffic duration support in test case
Implement code to support traffic_duration field in test case options. This updates the 'duration' in Landslide session profile. traffic_duration should always be much less than runner duration/timeout. JIRA: YARDSTICK-1427 Change-Id: I51094bade683ca8758136ccb619e8894a2ecef72 Signed-off-by: Orest Voznyy <orestx.voznyy@intel.com> (cherry picked from commit ae2ceba66519555749c67eefe2170ea716a1411b)
-rw-r--r--samples/vnf_samples/nsut/vepc/tc_epc_default_bearer_create_landslide.yaml1
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_landslide.py7
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py21
3 files changed, 26 insertions, 3 deletions
diff --git a/samples/vnf_samples/nsut/vepc/tc_epc_default_bearer_create_landslide.yaml b/samples/vnf_samples/nsut/vepc/tc_epc_default_bearer_create_landslide.yaml
index 0b94d313f..ee17df138 100644
--- a/samples/vnf_samples/nsut/vepc/tc_epc_default_bearer_create_landslide.yaml
+++ b/samples/vnf_samples/nsut/vepc/tc_epc_default_bearer_create_landslide.yaml
@@ -27,6 +27,7 @@ scenarios:
tg__0: tg__0.traffic_gen
vnf__0: vnf__0.vnf_epc
options:
+ traffic_duration: 70
dmf:
transactionRate: 5
packetSize: 512
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_landslide.py b/yardstick/network_services/vnf_generic/vnf/tg_landslide.py
index a146b72ca..157568618 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_landslide.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_landslide.py
@@ -600,6 +600,13 @@ class LandslideResourceHelper(sample_vnf.ClientResourceHelper):
def create_test_session(self, test_session):
# Use tcl client to create session
test_session['library'] = self._user_id
+
+ # If no traffic duration set in test case, use predefined default value
+ # in session profile
+ test_session['duration'] = self.scenario_helper.all_options.get(
+ 'traffic_duration',
+ test_session['duration'])
+
LOG.debug("Creating session='%s'", test_session['name'])
self._tcl.create_test_session(test_session)
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py
index 53439972a..15f7b36c7 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_landslide.py
@@ -337,6 +337,7 @@ class TestLandslideTrafficGen(unittest.TestCase):
'traffic_profile': '../../traffic_profiles/landslide/'
'landslide_dmf_udp.yaml',
'options': {
+ 'traffic_duration': 71,
'test_cases': [
{
'BearerAddrPool': '2002::2',
@@ -1178,10 +1179,24 @@ class TestLandslideResourceHelper(unittest.TestCase):
def test_create_test_session_res_helper(self, *args):
self.res_helper._user_id = self.SUCCESS_RECORD_ID
self.res_helper._tcl = mock.Mock()
- test_session = {'name': 'test'}
- self.assertIsNone(self.res_helper.create_test_session(test_session))
+ self.res_helper.scenario_helper.all_options = {'traffic_duration': 71}
+ _session = {'name': 'test', 'duration': 60}
+ self.assertIsNone(self.res_helper.create_test_session(_session))
self.res_helper._tcl.create_test_session.assert_called_once_with(
- {'name': 'test', 'library': self.SUCCESS_RECORD_ID})
+ {'name': _session['name'],
+ 'duration': 71,
+ 'library': self.SUCCESS_RECORD_ID})
+
+ def test_create_test_session_res_helper_no_traffic_duration(self, *args):
+ self.res_helper._user_id = self.SUCCESS_RECORD_ID
+ self.res_helper._tcl = mock.Mock()
+ self.res_helper.scenario_helper.all_options = {}
+ _session = {'name': 'test', 'duration': 60}
+ self.assertIsNone(self.res_helper.create_test_session(_session))
+ self.res_helper._tcl.create_test_session.assert_called_once_with(
+ {'name': _session['name'],
+ 'duration': 60,
+ 'library': self.SUCCESS_RECORD_ID})
@mock.patch.object(tg_landslide.LandslideTclClient,
'resolve_test_server_name',
: type: OS::Nova::Flavor properties: ram: 4096 vcpus: 4 disk: 4 network: type: OS::Neutron::Net properties: name: dpdk_net subnet: type: OS::Neutron::Subnet properties: name: dpdk_subnet ip_version: 4 cidr: 192.168.0.0/24 network: { get_resource: network } management_router: type: OS::Neutron::Router properties: name: management_router external_gateway_info: network: { get_param: external_net_name } management_router_interface: type: OS::Neutron::RouterInterface properties: router: { get_resource: management_router } subnet: { get_resource: subnet } floating_ip: type: OS::Neutron::FloatingIP properties: floating_network: { get_param: external_net_name } floating_ip_association: type: OS::Nova::FloatingIPAssociation properties: floating_ip: { get_resource: floating_ip } server_id: {get_resource: dpdk_vm} keypair: type: OS::Nova::KeyPair properties: name: yardstick-key public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 yardstick@yardstick.opnfv.org wait_handle: type: OS::Heat::WaitConditionHandle wait_condition: type: OS::Heat::WaitCondition properties: handle: { get_resource: wait_handle } count: 1 timeout: { get_param: timeout } dpdk_vm: type: OS::Nova::Server depends_on: [subnet, keypair, flavor] properties: name: { get_param: "OS::stack_name" } image: { get_param: image } flavor: { get_resource: flavor } key_name: {get_resource: keypair} networks: - network: { get_resource: network } config_drive: True user_data_format : RAW user_data: str_replace: template: | #!/bin/sh cat <<'CEOF' > /tmp/dpdk_post_build.sh export RTE_SDK=/dpdk export RTE_TARGET=x86_64-native-linuxapp-gcc cd /dpdk make install T=x86_64-native-linuxapp-gcc DESTDIR=destdir modprobe uio insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko cd /pktgen-dpdk make RTE_SDK=/dpdk echo "PCKTGEN BUILT" rm -rf /var/lib/cloud/instances echo "rm succesfull" ls /dpdk/x86_64-native-linuxapp-gcc/kmod/ $NOTIFY --data-binary '{"status": "SUCCESS"}' CEOF chmod +x /tmp/dpdk_post_build.sh echo "chmod" nohup /tmp/dpdk_post_build.sh & params: $NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] } outputs: vm_uuid: description: uuid of the VM value: { get_attr: [ dpdk_vm, show,id ] }