aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
AgeCommit message (Collapse)AuthorFilesLines
2017-09-04Fix Ixload KPIs collection & hang issues.Deepak S1-1/+1
Change-Id: If679333dc1cb9e041a332fb374c55f72eaab1b28 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-04Addition of Prox NSB changes in yardstickabhijitsinha11-823/+1209
JIRA: YARDSTICK-802 Addition of Prox L2Fwd, MPLS test cases for BM and Heat. updates: Most of tg_prox and prox_vnf were absorbed into the base classes. delete most of ProxDpdkVnfSetupEnvHelper, it is handled by DpdkVnfSetupEnvHelper baseclass use standard _build_pipeline_kwargs methods don't use terminate() use baseclass version add new method kill_vnf that runs pkill -x replace resource_helper.execute() with vnf_execture for dumping stats In order to share code between tg_prox and vnf_prox refactor to have tg_prox hold and wrap a ProxApproxVnf instance and call methods on that class. Do this instead of multiple-inheritance. Implement ProxApproxVnf.terminate() using prox socket command based exit, (stop_all, quit, force_quit). vnf_execute calls resource_helper.execute() which calls socket methods on the sut object. Since tg_prox wraps the VNF object, we can call terminate on the VNF object and it should work correctly. move prox config generation to parent process we need to get core number info from config file inside the TG processes, so we need to generate the config in the parent process so the data is copied to the child during the fork. moved more config file methods to the setup_helper class. we run force_quit after quit, so the socket should already be closed this will trigger socket error, so add _ignore_errors option for vnf_execute to ignore socket errors Fixed the terminate issue. Added MPLS tests. Added TG Stats in_packet/out_packet Fixed compile (pep8) issues Fixed MPLS TG port stats, in/out packets Added Grafana dashboards for L2FWD and MPLS Traffic profiles modified for tolerated loss and precision as per DATS tests. Added unit test case for Mpls Single port test stats collection support. Change-Id: Idd9493f597c668a3bb7d90e167e6a418546106e8 Signed-off-by: Abhijit Sinha <abhijit.sinha@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-03test_create_keypair: fix op_utils mock and mock paramikoRoss Brattain1-5/+6
Change-Id: I5c039c0d4f4ba651209c7d5ca4e748f9151b5630 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-03test_kubernetes: mock file operations in test_ssh_keyRoss Brattain1-1/+6
tests take too long and we should not be createing/deleting files during unittests, filesystems operations introduce too many external issues Change-Id: I989c9d0a84187becdf63497c0c1ac6e10c5eac70 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-03test_vsperf_dpdk: mock time to speedup unitestsRoss Brattain1-11/+14
If you put time.sleep(1) all over your code you need to mock time.sleep() in your unittests lest the unittests take forever. Change-Id: I9ebbf9e21c98e8c46bab727bbb22f33045db4361 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-01Merge "Adding support for updating the count/packetsize for given testcase"Ross Brattain2-11/+27
2017-09-01sample_vnf: default to 16GB of 2048Kb hugepagesRoss Brattain1-1/+1
8192 * 2048kB = 16GB Change-Id: I82bf420794e5174e88cfaea08b9fab0d77c2be7f Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-31Adding support for updating the count/packetsize for given testcaseDeepak S2-11/+27
Change-Id: I3ec1a6d3710d44df5ddac6bd8967d28ad58e8d33 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-09-01Merge "Added TC for vFW in heat context with ixia TG"Ross Brattain2-6/+11
2017-09-01Bugfix: ha test case criteria pass when sla not passrexlee87761-8/+37
ha test cases didn't store moniter info and report fail when sla didn't pass Change-Id: I0e5637e37a66e1bf03b47fe09d17e0a1acfa11c1 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-08-31Added TC for vFW in heat context with ixia TGMaciej Skrocki2-6/+11
- added common method to get relative paths - added 'Ixia' APP_NAME Change-Id: I7966798bab71af66d3efbeb1e13b07e8fbb41e88 Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com>
2017-08-31Enable update ip headers for given testcaseDeepak S1-12/+12
Change-Id: I008b3f09695f5e3f484b39d4e70b83e5942de863 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com>
2017-08-30_get_ip_flow_range: fix bug with single IP rangesRoss Brattain1-3/+3
If we have a /32 or for some reason find a range of IPs to use, we can default to the single IP specified on the interface. Change-Id: Ieaa1d57b04e1d57e8cef344d5a53bbca05e7887f Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-30ssh: fix unittest race conditionRoss Brattain1-2/+2
os.stat is being called multiple times for some reason we only care that is it called at some point. ====================================================================== FAIL: tests.unit.test_ssh.SSHRunTestCase.test__put_file_sftp tags: worker-1 ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/tests/unit/test_ssh.py", line 458, in test__put_file_sftp mock_stat.assert_called_once_with("localfile") File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/mock/mock.py", line 947, in assert_called_once_with raise AssertionError(msg) AssertionError: Expected 'stat' to be called once. Called 3 times. Ran 1209 tests in 2.618s FAILED (id=0, failures=1) error: testr failed (1) + testr failing ====================================================================== FAIL: tests.unit.test_ssh.SSHRunTestCase.test__put_file_sftp tags: worker-1 ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/mock/mock.py", line 1305, in patched return func(*args, **keywargs) File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/tests/unit/test_ssh.py", line 458, in test__put_file_sftp mock_stat.assert_called_once_with("localfile") File "/home/jenkins/opnfv/slave_root/workspace/yardstick-verify-master/.tox/py3/lib/python3.5/site-packages/mock/mock.py", line 947, in assert_called_once_with raise AssertionError(msg) AssertionError: Expected 'stat' to be called once. Called 3 times. Ran 1 tests in 0.110s FAILED (id=0, failures=1) Change-Id: I73370996e6e0543419eec8ecbe81be424ec15822 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-29Merge "DRAFT: model: remove vld_id not needed"Ross Brattain1-3/+0
2017-08-29Merge "Add common openstack opertation scenarios: router & port"Ross Brattain5-0/+179
2017-08-28DRAFT: model: remove vld_id not neededRoss Brattain1-3/+0
it seems vld_id is not needed now that we add it in _resolve_topology. Remove it from the model and Heat context first and see what happens Needs testing Change-Id: I30d13c80bd90246ee3be67a2bd3439db45e20bcd Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-26Merge "Test case: Fio volume benchmark testcase using job file"Jing Lu1-0/+14
2017-08-26Raise Exception if HA test case failedJingLu51-0/+1
Change-Id: Ia3677724075c1c1408f50bbfcebd3cbcde251d66 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-25Trex: fix KPI collectionRoss Brattain1-1/+1
return super result Change-Id: I723a37281da15c1887ae1b3cf91d7e957b1924d1 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-25Add common openstack opertation scenarios: router & portJingLu55-0/+179
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: Id436a201aa04f8f6b98576e8fbf599ca3654827c Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-24Merge "add ppm into result of pktgen to make result clear"Ross Brattain1-5/+5
2017-08-24Standardized TRex client library pathMaciej Skrocki26-1496/+134
- path should be defined via TREX_CLIENT_LIB environmental variable e.g. TREX_CLIENT_LIB=/opt/trex_client/stl - refactored unit tests Change-Id: I18767e48daf774432c010f1b88d18a4f0ee4e156 Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-24Merge "Add common openstack opertation scenarios: volume & floating ip"Jing Lu4-0/+143
2017-08-23Merge "samplevnf_helper: use network address"Ross Brattain1-0/+2
2017-08-23Merge "Re-define the framesize and flow dynamic define in testcase"Ross Brattain3-16/+49
2017-08-23Add common openstack opertation scenarios: volume & floating ipJingLu54-0/+143
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: I1300a61b389202242f112b6d280ab47746379546 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-22Test case: Fio volume benchmark testcase using job fileJingLu51-0/+14
JIRA: YARDSTICK-791 In some use cases, Fio is used with a job file instead of parameters. This work is about adding support for the job file and add a new test case for volume testing. Change-Id: I312d61bf6e7d95f23eedb0b6487f6103b7d76355 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-22Merge "Add common openstack opertation scenarios: subnet & port"Jing Lu5-0/+194
2017-08-22Merge "test_vsperf_dpdk: remove unused and incorrect mock open"Ross Brattain1-2/+0
2017-08-21samplevnf_helper: use network addressRoss Brattain1-0/+2
use network address with netmasks to be proper ports_mac_list is no longer valid, remove it nd_route_tbl needs to default to something otherwise the VNF will segfault if it receives IPv6 on the port, which it will because something in Neutron is sending out IPv6 packets. disable use of the routing table gateways to set arp add. We set the next hop IP to always be the TG IP address, so we need to always use the TG IP in arp add to send to the TG MAC address don't use gateways to get local addresses. we can't use gateways because with OpenStack if we define a gateway is breaks the default route and we can no longer connect to the instance via floating IP. Change-Id: I0ebefe8ac09812b6030046f73bf772edda1c7d27 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-21Re-define the framesize and flow dynamic define in testcaseDeepak S3-16/+49
This patch adds the framesize and flow into test option instead of adding a seperate file to avoid the multiple file update incase of ip change. Change-Id: Ic473c73773ad36422ecc02618b8c646a5336b70a Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-08-21Refactor to make file sys more like class inheritanceEdward MacGillivray10-18/+23
Change-Id: I5471d2e894ca78407a57f3ba01202264c69ad174 Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
2017-08-21add ppm into result of pktgen to make result clearrexlee87761-5/+5
Change-Id: I6649960dc9fbc61c22c9b7434805fc335634960b Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-08-20test_vsperf_dpdk: remove unused and incorrect mock openRoss Brattain1-2/+0
need to use create=True with mock open anyway Change-Id: I3a35688cf8c367434db9d0cf057030d49deddd0d Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-21Add common openstack opertation scenarios: subnet & portJingLu55-0/+194
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: Ie59f0d5ae0842f8347824c961436b889a95b1a72 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-21Merge "Add common openstack opertation scenarios: network"Jing Lu3-0/+102
2017-08-19Merge "import_modules_from_package: refactor with generators"Ross Brattain1-28/+7
2017-08-19Merge "Fix IxLoad traffic generator issue around running the traffic."Ross Brattain2-5/+27
2017-08-19Fix IxLoad traffic generator issue around running the traffic.Deepak S2-5/+27
Change-Id: Ic1f13c0d28c1a1b01bbf3c8a6a618a5b3ab5bbeb Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-19import_modules_from_package: refactor with generatorsRoss Brattain1-28/+7
remove ..... split and use os.path.relpath to remove prefix use set operations to find missing modules, so we don't need to check dict contains multiple times Change-Id: I9531360fb9b2999e83874f144f1d06d825b22b2c Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-19Fix parsing of the results from collectd pluginsDeepak S1-2/+2
Change-Id: I3f7b9ca17164564b11517116e7e73b47f42243b9 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-08-17Fix import error in IxNetworkDeepak S1-9/+4
This patch fixes import error related to ixnetwork and do not wait for TG server to start as IXIA is always running :) Change-Id: I49d6b100eadafad75431cb8974605a6faa496f23 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-17Merge "utils: create TASK_LOG_DIR if it doesn't exist"Ross Brattain1-1/+2
2017-08-17Merge "run_traffic: capture and exit gracefully if crash in trex run_traffic"Ross Brattain1-1/+1
2017-08-15YAML fixesRoss Brattain4-5/+87
There are multiple issues wiht YAML loading. 1. Jinja2 renders None values as a string 'None'. This is not valid YAML we need to render None values to '~' or 'null' which is the native YAML None value. 2. Jinja2 renders dict and lists that contain unicode with u'foo' values. This is not value YAML syntax. Because we are serializing dict and lists into YAML, we need to encode them as valid YAML. We can override Jinja2 finalize to use yaml.dump to dump inline YAML. We use yaml.safe_dump(elem, default_flow_style=True).replace('\n', '') to generate valid single-line YAML dict and list values. But this problem highlights the general difficulties with templating and loading files. We could avoid this Python->Jinja2->YAML->Python issue by directly injecting the list or dict after the YAML is loaded. I'm not sure of the real utility of these templates. 3. On Python 2 YAML loader is rendering all strings as unicode. This does not work for Trex because Trex is broken and badly coded. Trex does type checking against str() which is different for Python 2 and Python 3. The default YAML loader will return native string types, str() or unicode() for Python 2 and Python 3 respectively. The bad Trex codes is in convert_val: https://github.com/cisco-system-traffic-generator/trex-core/blob/master/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py#L674 def convert_val (val): if is_integer(val): return val if type(val) == str: return ipv4_str_to_num (is_valid_ipv4(val)) raise CTRexPacketBuildException(-11,("init val invalid %s ") % val ); This code is doing type(val) == str. This is bad and broken. We can't fix Trex, so we have to render all strings as native str() types The bug here was that the Heat template loader template_format.py was overriding the global YAML loader to always return unicode. We don't want this global override. To fix this we have to use local subclasses of the yaml.SafeLoader class. But in order to dynamically subclass from CSafeLoader or SafeLoader we have to use the type() builtin to define a new class at runtime. Once we have new classes defined, we can safely isolate different YAML constructors and return unicode or not depending on the case. To be consistent we implement a new yaml_loader.py module to centralize all non-Heat template yaml loading to ensure correct uncode/str conversion Change-Id: Iebf9cf78fbda390977c390436b0869e7bbf503eb Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-15run_traffic: capture and exit gracefully if crash in trex run_trafficDeepak S1-1/+1
new non-blocking code of run_traffic has raise condition which causes trex client to exit with STLError. This patches captures the exception and exit gracefully Traceback (most recent call last): File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(*self._args, **self._kwargs) File "/opt/nsb_bin/yardstick_venv/lib/python2.7/site-packages/yardstick-0.1.dev0-py2.7.egg/yardstick/network_services/vnf_generic/vnf/sample_vnf.py", line 945, in _traffic_runner self.resource_helper.run_traffic(traffic_profile) File "/opt/nsb_bin/yardstick_venv/lib/python2.7/site-packages/yardstick-0.1.dev0-py2.7.egg/yardstick/network_services/vnf_generic/vnf/sample_vnf.py", line 506, in run_traffic self._run_traffic_once(traffic_profile) File "/opt/nsb_bin/yardstick_venv/lib/python2.7/site-packages/yardstick-0.1.dev0-py2.7.egg/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_trex.py", line 63, in _run_traffic_once self.client.stop(self.my_ports) File "/opt/nsb_bin/trex/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py", line 1202, in wrap2 raise STLError("'{0}' - connection to the server had been lost: '{1}'".format(func_name, client.conn.get_disconnection_cause())) STLError: Change-Id: Ie5741339451e0a3f9c4bb48f64fd35d86d18e5d4 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-15Enable ixnet traffic generator to run trafficDeepak S1-1/+1
Change-Id: I8d7cea75aa864c37a058a154a38c9828ea5da434 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-15deepgetitem: try string index before intRoss Brattain1-0/+13
Change-Id: I3b353c5887db0ebbe33e37db505e72b85167b54e Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-14ACL: remove failing testingRoss Brattain1-24/+0
test_instantiate_panic fails randomly sometimes in Jenkins, the test doesn't really do anything useful, so remove it Change-Id: Ia44ebbe778b812ae1b4660d64e88bf029fed3701 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>