summaryrefslogtreecommitdiffstats
path: root/tests/unit
AgeCommit message (Collapse)AuthorFilesLines
2017-07-24Setup OVS-DPDK Standalone ContextBindya Narayan10-122/+1281
This patch performs following tasks - getting dpdk_nic_bind path - setup ovs,dpdk ports,vhostuserports, - creation of vm, - apache2 licence - test cases for ovsdpdk - Changes to standalone context - update unit test cases Change-Id: I54e4062eb440b8677625e4abe6e0579d9fd54d41 Signed-off-by: Bindya N <bindya.narayan@intel.com>
2017-07-24Adding new SRIOV Standalone ContextNeha Vadnere7-34/+898
This patch adds new SRIOV context to run VNFs with - random uuid generation, - mac address generation, - getting dpdk_nic_bind path, - ssh key based authentication, - printing log messages, - added apache2 licence JIRA: YARDSTICK-480 Change-Id: Ic8317eb9e7e4ecf270091c18be4782d1299ff087 Signed-off-by: Neha Vadnere <neha.r.vadnere@intel.com> Signed-off-by: Bindya N <bindya.narayan@intel.com>
2017-07-19heat: port_security_enabled, allowed_address_pairs, disable gateway_ipRoss Brattain1-7/+28
xe0: cidr: '10.0.2.0/24' vld_id: public allowed_address_pairs: - ip_address: '0.0.0.0/0' xe1: cidr: '10.0.3.0/24' vld_id: private allowed_address_pairs: - ip_address: '0.0.0.0/0' We need to disable gateways on data plane interfaces With TGs and VFNs we probably don't need gateway on data interfaces Change-Id: I276a7d591a0a3ff03877c4f525303fc2874de683 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-17Merge "test_base: speedup unittest, wait for queue not empty"Ross Brattain1-2/+8
2017-07-17Merge "test_nstat: speedup unittests, sleep for 0 seconds"Ross Brattain1-3/+3
2017-07-17Merge "pktgen: speedup unittest, mock time.sleep"Ross Brattain1-9/+10
2017-07-17Merge "tg: speedup unittests, mock time.sleep"Ross Brattain3-8/+12
2017-07-17Merge "test_pktgen_dpdk_throughput: speedup unittest, mock time.sleep()"Ross Brattain1-8/+9
2017-07-17test_nstat: speedup unittests, sleep for 0 secondsRoss Brattain1-3/+3
Change-Id: I3f961e26fb045ea7501dc3a5b630b3ef94fec3ee Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-17test_heat: ipaddress expects unicode inputsRoss Brattain1-14/+14
weird error E AddressValueError: '10.20.0.0/15' does not appear to be an IPv4 or IPv6 network. Did you pass in a bytes (str in Python 2) instead of a unicode object? I guess we need to convert the stack.outputs mock to unicode FAILED tests/unit/benchmark/contexts/test_heat.py:137 (HeatContextTestCase.test_add_server_port) self = <tests.unit.benchmark.contexts.test_heat.HeatContextTestCase testMethod=test_add_server_port> def test_add_server_port(self): network1 = mock.MagicMock() network1.vld_id = 'vld111' network2 = mock.MagicMock() network2.vld_id = 'vld777' self.test_context.name = 'foo' self.test_context.stack = mock.MagicMock() self.test_context.networks = { 'a': network1, 'c': network2, } self.test_context.stack.outputs = { 'b': '10.20.30.45', 'b-subnet_id': 1, 'foo-a-subnet-cidr': '10.20.0.0/15', 'foo-a-subnet-gateway_ip': '10.20.30.1', 'b-mac_address': '00:01', 'b-device_id': 'dev21', 'b-network_id': 'net789', 'd': '40.30.20.15', 'd-subnet_id': 2, 'foo-c-subnet-cidr': '40.30.0.0/18', 'foo-c-subnet-gateway_ip': '40.30.20.254', 'd-mac_address': '00:10', 'd-device_id': 'dev43', 'd-network_id': 'net987', } server = mock.MagicMock() server.ports = OrderedDict([ ('a', {'stack_name': 'b'}), ('c', {'stack_name': 'd'}), ]) expected = { "private_ip": '10.20.30.45', "subnet_id": 1, "subnet_cidr": '10.20.0.0/15', "network": '10.20.0.0', "netmask": '255.254.0.0', "gateway_ip": '10.20.30.1', "mac_address": '00:01', "device_id": 'dev21', "network_id": 'net789', "network_name": 'a', "local_mac": '00:01', "local_ip": '10.20.30.45', "vld_id": 'vld111', } > self.test_context.add_server_port(server) tests/unit/benchmark/contexts/test_heat.py:186: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ yardstick/benchmark/contexts/heat.py:307: in add_server_port network_name, port['stack_name'], self.stack.outputs) yardstick/benchmark/contexts/heat.py:315: in make_interface_dict subnet_ip = ipaddress.ip_network(subnet_cidr) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = '10.20.0.0/15', strict = True def ip_network(address, strict=True): """Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. """ try: return IPv4Network(address, strict) except (AddressValueError, NetmaskValueError): pass try: return IPv6Network(address, strict) except (AddressValueError, NetmaskValueError): pass if isinstance(address, bytes): raise AddressValueError( '%r does not appear to be an IPv4 or IPv6 network. ' 'Did you pass in a bytes (str in Python 2) instead of' > ' a unicode object?' % address) E AddressValueError: '10.20.0.0/15' does not appear to be an IPv4 or IPv6 network. Did you pass in a bytes (str in Python 2) instead of a unicode object? ../../yardstick/yardstick_venv/lib/python2.7/site-packages/ipaddress.py:199: AddressValueError Change-Id: Ie3b087a26a054203573eaa9b13c3e90152bba6a9 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-17Merge "test_tg_rfc2544_trex: speedup unittest, set time.sleep(0)"Ross Brattain1-4/+5
2017-07-17test_tg_rfc2544_trex: speedup unittest, set time.sleep(0)Ross Brattain1-4/+5
Change-Id: I6fdae629bdbd45cba715a838c41613b914a3abcb Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-17test_delete_all_calls_delete: fix delete mockRoss Brattain1-4/+6
we need to mock HeatStack.delete() before we instantiate otherwise we can't reach the instantiated objects delete() method we need to patch the class so we patch all instances Change-Id: I36f9476dcfb83e2d583c5a9f72dc27fce57258eb Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-16test_heat: don't waste 2 seconds in unittestRoss Brattain1-12/+2
remove duration checks and test with sleep 0 Change-Id: I22516cde56ac3a02358ca9c3e652cead10580d76 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-17Merge "test_attacker_baremetal: don't run local commands"Ross Brattain1-14/+12
2017-07-17Merge "Kubernetes (k8s) support"Jing Lu3-0/+294
2017-07-17Merge "add network info to topology"Rex Lee6-214/+596
2017-07-17Kubernetes (k8s) supportchenjiankun3-0/+294
JIRA: YARDSTICK-682 We decide to support k8s in E release. We need to discuss with openretriver team and then rewrite the ping test case under k8s as the first step. Change-Id: I3f81ebca8de5c1f3a8b7d42581cd7342dc320239 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-13test_attacker_baremetal: don't run local commandsRoss Brattain1-14/+12
these tests were failing to mock subprocess.check_output and thus were trying to run sudo commands on the local system. This is dangerous. Add the subprocess mock. Also mock the LOG object so we don't print bogus Runtime error tracebacks in the unittest logs when we test assertRaises() Change-Id: I01535f9952fbd95ce2f5972b641c51ff836e7e8c Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_monitor_command: mock LOG so we don't output errorRoss Brattain1-2/+6
Don't print fake tracebacks to the unittest logs Change-Id: I8a468b8c6566f02be88a9dd222567c14c66b0956 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-14Merge "Add API to get environments"Rex Lee1-0/+13
2017-07-14Merge "test_monitor_multi: speedup unittests, sleep less"Ross Brattain1-1/+1
2017-07-14Merge "test_storperf: speedup unittest, use time.sleep(0)"Ross Brattain1-2/+2
2017-07-13add network info to topologyRoss Brattain6-214/+596
we need to know which network each port is connected to so we can find VLAN or VXLAN ID. To do this we implement a new method for Contexts, Context.get_network(). This method is similar to Context.get_server(), it searches for a given network name in all the contexts. From this we generate a context_cfg["networks"] dict that stores all the network info for the nodes in the scenario. Then when we generate the topology for VNFD, we can lookup a given network by the vld_id and get the network_type, segmentation_id, etc. Then if we need to for example generated traffic on a given VLAN or VXLAN, we have this info available. Define default nd_route_tbl for ACL VNF we need default empty nd_route_tbl for IPv6 route. Change-Id: I9f9cfbd6acabeb4ae4675ca7354390efa57b29e7 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
2017-07-13test_monitor_multi: speedup unittests, sleep lessRoss Brattain1-1/+1
Change-Id: I306e8e5525c3722179a5321988cad76190b93951 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_storperf: speedup unittest, use time.sleep(0)Ross Brattain1-2/+2
Change-Id: I3923d75c1ae7974c7803b0ad6997a5ad0fece11d Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_pktgen_dpdk_throughput: speedup unittest, mock time.sleep()Ross Brattain1-8/+9
Change-Id: I74bbdee1a503ef9bad32db7d4444921f6730f465 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_vpe_vnf: speedup unittest, mock timeRoss Brattain1-19/+25
Change-Id: I046fae81c23555573df7d9e2e80995499062cf38 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13tg: speedup unittests, mock time.sleepRoss Brattain3-8/+12
Change-Id: Ia6207c898653c3ba21b22e9c309e7abb25d5cd32 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13pktgen: speedup unittest, mock time.sleepRoss Brattain1-9/+10
Change-Id: I0c6f6b68b30ae72887666a3b9e994dabf7c6a71d Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13test_base: speedup unittest, wait for queue not emptyRoss Brattain1-2/+8
Change-Id: I41a72b1fd7099e404a1cf832de39f15bbc7b46e0 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-13Add API to get environmentschenjiankun1-0/+13
JIRA: YARDSTICK-716 API: /api/v2/yardstick/environments METHOD: GET Change-Id: I46b7fb2b143fe76b6a0edbf1ecc8281187b85918 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-13Merge "NSBperf: fix bad sigint handler"Ross Brattain1-1/+1
2017-07-12NSBperf: fix bad sigint handlerRoss Brattain1-1/+1
This is why we don't do things at module import time. when we import this module it makes a bad sigint handler. Only load signal handlers at runtime. Also fix handler to take *args, **kwargs. Unittest failures: > time.sleep(0.01) E TypeError: handler() takes 0 positional arguments but 2 were given Change-Id: I4296a4bdef0e5f4d58b0503dcbc834f3bef0feeb Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-12test_nstat: decrease sleep time for unittestRoss Brattain1-3/+3
there is no reason to sleep for a whole minute during unittest Change-Id: I206229bcaa7a50af1859f7b04e521955bb6217d4 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-11Yardstick API architecture improvementchenjiankun2-41/+23
JIRA: YARDSTICK-710 Since we have the plan to upload api v2 and gui. We need to add put and delete method. So the architecture need to be improved. Change-Id: Ie20a79c26ef6c581897ce4e63980fa2895b162d2 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-06move flatten dict key to common utilsrexlee87766-42/+51
So it can easily be used by other testcase to unify result JIRA: YARDSTICK-702 Change-Id: Id4fde38a9a0c2a87a6c870bdb7b0c8f3a3b371ac Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-06-30Change prepareYardstickEnv to prepare_env and add log infochenjiankun3-27/+2
JIRA: YARDSTICK-697 Currently the action in env like prepareYardstickEnv, createGrafanaContainer, createInfluxDBContainer, this is not python style. So I do some change: prepareYardstickEnv->prepare_env createGrafanaContainer->create_grafana createInfluxDBContainer->create_influxdb And also add some log info in env_action. Change-Id: Ia91576b975f3de76b96e312779fda4911e7cac24 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-06-24Merge "Yardstick output format unified"Jing Lu3-21/+20
2017-06-22Merge "Acquire NSB specific data from Heat."Ross Brattain3-77/+409
2017-06-22HA testcase improvementJingLu51-0/+2
This patch improve HA test case in the following aspects: 1. the "GeneralHA" type now will check if the target service process in the controller node. 2. support ignore server certificate 3. add debug log for recovering service failed 4. improve method to kill keystone process Change-Id: I9ae7ab54391fe41d5d7f3e4951a7ac2e3ba75968 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-06-22Yardstick output format unifiedchenjiankun3-21/+20
JIRA: YARDSTICK-658 Currently the yardstick have three dispatcher: file, influxdb, mongodb. (influxdb using API to get result and mongodb using testAPI to get result) But their output format is different. It is hard to use. In this patch, make all dispatchers using the same data source. And make the output format of file and influxdb unified. As for mongodb, since it is related to testAPI, so I make it push data every test case. The unified output format is: http://paste.openstack.org/show/610125/ Change-Id: I854ac4f03e6f904469b07b0c924c7d850545ae5b Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-06-20Acquire NSB specific data from Heat.Edward MacGillivray3-77/+409
First we add mac_address, subnet_cidr to Heat template outputs Then we convert those into a form for NSB and add vld_id. NSB also requires PCI Bus ID, kernel driver and dpdk_port_num. We get this by ssh-ing into instance and dumping sysfs We also need to fix allow for ssh key auth, and implement relative path file loading so NSB can find all its YAML files JIRA: YARDSTICK-580 Change history: don't hide heat create tracebacks we need tracebacks for debug vnf_generic: add task_path to scenario so we can load relative paths for vnf_generic we want to be able to load yaml relative to the task path For example: traffic_profile: ../../traffic_profiles/fixed.yaml topology: ping_tg_topology.yaml # TODO: look in relative path where the tc.yaml is found These need to be relative to samples/vnf_samples/nsut/ping/tc_ping_heat_context.yaml Add a scenario["task_path"] entry heat: log actual exception vnf_generic: replace list with set and iterate over values() some general refactors to remove redundact lookups and type conversions heat: provide mac_address, device_id and network_id from outputs We may need more information to dynamically determine test topology. Towards this end return more info in the heat template. We can return mac_address, device_id and network_id. Once we have this info we can add it to the context_cfg as an interfaces dict. add sample vnf ping multi-network test this test requires 3 network, one for mgmt and the other two for NSB traffic tests We have to make sure we don't use DPDK on mgmt interface because DPDK unbinds the driver heat: convert networks to OrderedDict so we can lookups networks as well as iterate over them in consisitent order heat: and vld_id to networks for vnf_generic vnf_generic uses vld_id Virtual Link Descriptor ID to identify interfaces Add the key to the networks dict and store in Networks object implement relative path file loading in vnf_generic in multiple places we need to load a file relative to the task path, so add open_relative_file_path and modify load_vnf_model to include the scenario_cfg parameter so we have access to task_path DRAFT: heat timeout support Heat stack in CI job failed due to some Nova issue. But then apparently yardstick kept running and took 180mins to timeout https://build.opnfv.org/ci/view/bottlenecks/job/bottlenecks-compass-posca_stress_ping-baremetal-daily-master/16/console We can add a Heat create timeout and fail faster if there is an error. The question is how long should we wait for a Heat stack to deploy. We can set a default and allow override in the heat context config, if users make complicated stacks heat: get netmask and gateway from heat outputs we have do some tricky business with finding the subnet cidr and converting it into netmask vnf_generic: get vpci, driver and dpdk_port_num use a big old find command to dump all the sysfs netdev info nicely. This was re-used from autotest FCoE tests. r"""find /sys/devices/pci* -type d -name net -exec sh -c '{ grep -sH ^ \ +$1/ifindex $1/address $1/operstate $1/device/vendor $1/device/device \ +$1/device/subsystem_vendor $1/device/subsystem_device ; \ +printf "%s/driver:" $1 ; basename $(readlink -s $1/device/driver); } \ +' sh \{\}/* \; This finds all PCI devices that are network devices, then dumps all the relevant info using /bin/sh. Then we parse this into a 'netdevs' dict inside the node_dict and also convert into VNF fields we need. vnf_generic: set node name for kpis node is a dict, so we have to use node_name vnfdgen: we CANNOT use TaskTemplate.render because it does not allow for missing variables, we need to allow password for key_filename to be undefined remove default ssh password hack, once rendering is fixed add new example tc_external_ping_heat_context Change-Id: If1fe0c1a2ab0a5be17e40790a66f28f706fa44d6 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
2017-06-06fix No handler warning by calling _init_loggingRoss Brattain1-0/+4
No handlers could be found for logger It looks like we need to call _init_logging to properly setup the logging during unittests. This should fix the influxdb unittest warning. JIRA: YARDSTICK-506 Change-Id: I57f6e4088005a691d6587fc68b85455ff257a66c Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-06-05Merge "Pass parameters between scenarios"Rex Lee3-0/+73
2017-05-27Imporve monitor_process pass criteriaJingLu56-17/+17
JIRA: YARDSTICK-660 The monitor func()'s criteria in the monitor_process.py now is whether at least one process of the specific controller node service is recovered. But in reality is more resonable to use whether processes have been recoverd to it's original amount. This patch is aiming at improving the isssue Change-Id: I950ce2a89555801b96092735b0d670e892049927 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-05-26Pass parameters between scenarioschenjiankun3-0/+73
JIRA: YARDSTICK-641 Allowing parameters to pass between scenarios so that the one test case can be combination of several scenarios. Change-Id: I55a00855e77d5b719a27a069a3ea195d6bbd0ef8 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-05-16fix multi-monitor unitest hangRoss Brattain1-8/+8
need to mock SSH.from_node().execute.return_value because we switch most SSH calls to use from_node() factory function Change-Id: Ibea525c2fcc243d41de8ccbcd40bc98532d69006 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-05-16Merge "Add a new monitor type: MultiMonitor that can run any number of other ↵Ross Brattain1-0/+61
monitors at the same time."
2017-05-12Create flavor from heat contextDanielMartinBuckley3-3/+181
JIRA: YARDSTICK-582 Create a customizable flavor via heat context. All heat parameters are configurable including Core Affinity. The default flavor name is XXXX-flavor where XXXX is stackname. Flavor attributes are taken from the heat context file. If a flavor attribute is not used it takes default attribute value. If flavor name is not specified it uses the server name + "-flavor" or stack-name + "-flavor". Compute node specific attributes are configurable via "extra_specs" attribute. See https://docs.openstack.org/admin-guide/compute-flavors.html for details. Change-Id: If4015970b889b0b95bfa8eba9491ebf31e92f2c7 Signed-off-by: DanielMartinBuckley <daniel.m.buckley@intel.com>