aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/contexts
AgeCommit message (Collapse)AuthorFilesLines
2017-06-28Add SRIOV supportJing Zhang2-3/+9
A generic provider network solution is introduced. To identify whether a network specified in the test case is a provider network new attributes are introduced in the test case network section: networks: test-net: cidr: '192.168.1.0/24' provider: "sriov" physical_network: 'physnet1' If the "provider" attribute is present, the network is an existing provider network. If the value is "sriov", binding:vnic_type=direct is added to the interface in the heat deployment template. In orchestrator/heat.py, the interface creating functions are given a new parameter that tells if the network in use is a provider network. The benchmark/contexts/model.py is changed to store the value of the provider attribute from the test case and function calls to port creation is updated with the provider parameter. The same change is made in contexts/heat.py as well. Also calls for creating a new tenant network is replaced for creating a new provider network if the provider attribute is present. Update-1: Change test_model.py Update-2: Per comment, change comment style to """" Update-3: Change test_heat.py Update-4: Add unit test cases to pass coverage test Update-5: Add SRIOV provider network example in opnfv_yardstick_tc008.yaml Update-6: Per comment, remove empty line in orchestrator/test_heat.py Update-7: Per comment, change comment lines in orchestrator/test_heat.py Update-8: Add more unit test cases to pass coverage test Update-9: Change to create SRIOV provider network on the fly so as to support co-current test runs Update-10: Per comment, init physical_network to 'physnet1' Change-Id: I76004c4fcc9bffcfd8ed021fd647e0cecb346ef4 JIRA: YARDSTICK-612 Signed-off-by: Jing Zhang <jing.c.zhang@nokia.com> (cherry picked from commit f51ba41255d6ab2c03fd62a044d372b73b496459)
2017-05-04standardize ssh authRoss Brattain1-15/+1
we need to be following defautl paramiko rules, first use pkey, then key_filenames (autodetecting ~/.ssh/ keys), then password We have too much boilerplate redudant code everywhere, we need to standardize on a factory function that takes a node dict. Using Python3 ChainMap we can layer overrides and defaults. VNF descriptors have to default key_filename, password to Python None. The only way to do this is to omit key values if the variable is not defined, this way the dict will not have the value and it will default to Python None Add python2 chainmap backport Updated unittest mocking to use ssh.SSH.from_node Change-Id: I80b0cb606e593b33e317c9e5e8ed0b74da591514 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com> (cherry picked from commit 99abbb424007da2e01762f3c040a39c0157cbe1f)
2017-04-06Yardstick virtualenv supportchenjiankun3-7/+6
JIRA: YARDSTICK-620 Currently we recommend using docker to run yardstick. And it is hard to use virtualenv to install yardstick. So I modify install.sh in yardstick root path. It will support using virtualenv to install yardstick(including API) in linux. In this patch, I make yardstick support read yardstick configuration have priority over constants. Change-Id: I9ea1241b228532a6497451e6c8f232173ddb783e Signed-off-by: chenjiankun <chenjiankun1@huawei.com> (cherry picked from commit b74d875134b988a26441d559a9e700aaa68d6a0c)
2017-03-20Add CPU pinning support for node contextJingLu51-8/+29
JIRA: YARDSTICK-573 Since the yardstick framework now has supported an improved node type context, this patch adds support for VM vcpu pinning ability in the node type context. It provides several scripts that can be used to configurate the controller and compute nodes. Change-Id: If2c6e7b1b85ff78b9d2a5997bf03bdc6877aaf74 Signed-off-by: JingLu5 <lvjing5@huawei.com> (cherry picked from commit f138b480ea4c9954d107555d7a46ec3d4375653f)
2017-03-09Merge "move external_network auto-assign to Heat context"Rex Lee1-3/+14
2017-03-08Bugfix: yardstick will create stacks with the same name when run using API ↵chenjiankun5-2/+10
in parallel JIRA: YARDSTICK-575 Currently yardstick will create stacks with the same name when run using API in parallel. The reason is there is a global variable in context base and the core will always deploy the first context in Context.list. When run in parallel, it will run in the one process. So yardstick will deploy stacks with the same name. The solution is do not use Context.list in yardstick core. And using a local variable instead. BTW, if we use API to call yardstick core, we can not config the output way. So I parse yardstick.conf when task start. And I think we can include scenario_cfg, context_cfg, yardstick_cfg in one config object later so that we can get all config in one object. Change-Id: I1ada4ef486bd252e78c3a2e49c6a39b3f8f16a7c Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-02-28move external_network auto-assign to Heat contextRoss Brattain1-3/+14
if there are no external networks defined then assign the external network to the first network as determined by standard sorting Change-Id: I9d32eca258f8e7de3d44cec4124c0e8c020c0b85 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-02-26heat: replace dict key checking with .get()Ross Brattain1-9/+6
We init all the fields to None, so the default value is None, which is what .get() returns when the key is not present it the dictionary. Replace if key in dict: self.val = dict[key] with self.val = dict.get(key) This also has the added beneifit of re-initializing default values to None. In idiomatic Python we do not check a dictionary twice if we can avoid it. Either use dict.get() with a default value or catch the KeyError and do the correct thing. Change-Id: If8d1caeb7288f888f02622d62e8db9f59f50717a Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-02-26heat context support affinity and anti-affinityrexlee87762-17/+63
JIRA: YARDSTICK-566 Current Heat context support affinity and availability arguments but not support affinity and anti-affinity. Enhance Heat context to support affinity and anti-affinity: 1. can create heat server group with affinity/anti-affinity 2. each server could be specified which server group they are in Change-Id: I46e7376fd116c6e109cb5dcb1c168460918e6d43 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-02-21improving if conditions :)Deepak S1-2/+2
Change-Id: I2fad46b07b252f898acfe116dd6542946b8a26a8 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-02-16Context improvement: add support for configing node environmentchenjiankun1-6/+76
JIRA: YARDSTICK-556 Currently we do can not config the node environment before heat create a stack. But in lots of scene, we need to config node environment before heat. So I add support for it. Change-Id: Iac1b74dc780eb40e6ab2c9cf04ed14e2b8f91ca8 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-02-14Merge "heat: minor fixes, don't use len > 0 and use next instead of [0]"Kubi1-2/+2
2017-02-14Merge "fix super() calls, must use explicit class name"Rex Lee5-7/+7
2017-02-14Merge "heat: convert open to context manager"Rex Lee1-3/+4
2017-02-09fix super() calls, must use explicit class nameRoss Brattain5-7/+7
self.__class__ is not correct. For Python 2 we have to explicitly use the class name see http://stackoverflow.com/questions/4235078/how-to-avoid-infinite-recursion-with-super Change-Id: I584ca565707b7331c1742fb33c8b524f7b7c9bf9 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-19Introducing Standalone context for running test in non-managed environment.Deepak S1-0/+116
This patch introduces standalone virtualization context to deploy/undeploy NFVi infrastructure to run the VNF Supported NFVi Type: - vswitch - ovs - ovs-dpdk - sr-iov - testpmd - linuxbridge This patches inits the function stubs to enable the standalone context. Actual deploy/undeploy code will be added in later check-in v2: Added unit tests to keep test coverage :) JIRA: YARDSTICK-479 Change-Id: I6ab3ac3335f40eabc4efb0af7d5addc20c122d65 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-01-19Re-factor Node.py to use better python inbuilt functionsDeepak S1-21/+35
1. don't use sys.exit() to exit when there is an exception, it will hide the underlying error 2. use the Abstract Base Classes for type checking. 3. don't have to build list, can use next JIRA: YARDSTICK-541 Change-Id: Id4485acb21e7e02bbc22d3e689cbf0699363098a Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-01-17heat: minor fixes, don't use len > 0 and use nextRoss Brattain1-2/+2
instead of [0] Change-Id: I1785b7ca3543a8d44eb68de61f4f29063a9c61c7 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-17heat: convert open to context managerRoss Brattain1-3/+4
Change-Id: I5ce6c77839f4104d305d66238bb2c6cbdc39a28c Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-16Use """ to replace ''' in docstringchenjiankun5-45/+45
JIRA: YARDSTICK-525 For consistency, we always use """triple double quotes""" around docstrings. Change-Id: I47a20bbd8b55bc544b4841ea4006929af0a044ac Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-01-12Add support for Python 3Ross Brattain5-14/+29
Porting to Python3 using Openstack guidelines: https://wiki.openstack.org/wiki/Python3 This passes unittests on Python 3.5 and passes opnfv_smoke suite Updates: use six for urlparse and urlopen fix exception.message attribute removal run unittests on python3 use unitest.mock on python 3 fix open mock for vsperf fix float division by using delta/eplison comparison use unicode in StringIO use plugin/sample_config.yaml relative path from test case fixed apexlake unittests upgraded to mock 2.0.0 to match python3 unittest.mock features fixed flake8 issues implement safe JSON decode with oslo_serialization.jsonutils.dump_as_bytes() implement safe unicode encode/decode with oslo_utils.encodeutils heat: convert pub key file from bytes to unicode pkg_resources returns raw bytes, in python3 we have to decode this to utf-8 unicode so JSON can encode it for heat template JIRA: YARDSTICK-452 Change-Id: Ib80dd1d0c0eb0592acd832b82f6a7f8f7c20bfda Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-12heat: fix key_uuid formatRoss Brattain1-5/+6
The .format() won't work, since it can't slice the uuid We have to convert the uuid to string before we slice it. I thought .format() would implicitly call __str__() before applying width, but that is not the case. 'files/yardstick_key-{:.{width}}'.format(self.key_uuid, width=8)) We also need to define a constant short uuid lenght, we can't hardcode the length to 8 everywhere. Create a helper function to standardize the generation of the short key uuid and use that helper function everywhere Change-Id: I59e051bfe697587e967f93f5b8f209e0e7daa5c7 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-10associate an uuid to yardstick_key and yardstick_key.pubJingLu51-7/+8
JIRA: YARDSTICK-527 This work is to support yardstick parallel tasks in the future. Currently, the RSA key we generated and used to access the VM is named 'yardstick_key'. If more than two tasks are running paralleled, the later 'yardstick_key' will cover the former. We want associate an uuid to identify differnets for each tasks. So the key files won't conflict. The first 8 digits will be used, as there is no need to used a full-length uuid. Change-Id: If8eaf47ae527cf9b3bd50f37ab3051fbdccf5f03 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2016-11-30switch logging to proper usageRoss Brattain1-1/+1
The logging methods do string interpolation themselves From the reference: https://docs.python.org/2/library/logging.html#logging.Logger.debug Logger.debug(msg, *args, **kwargs) Logs a message with level DEBUG on this logger. The msg is the message format string, and the args are the arguments which are merged into msg using the string formatting operator. (Note that this means that you can use keywords in the format string, together with a single dictionary argument.) There are two keyword arguments in kwargs which are inspected: exc_info which, if it does not evaluate as false, causes exception information to be added to the logging message. If an exception tuple (in the format returned by sys.exc_info()) is provided, it is used; otherwise, sys.exc_info() is called to get the exception informatio The reason logging does string interpolation itselfs is to implement deferred interpolation. String interpolation involves evaluating arguments, so it can introduce significant computation. The logging module tries to be smart about deferring interpolation until the last possible moment. The logging methods check isEnabledFor for the log level and won't interpolate if the level is not enabled. https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L1178 def warning(self, msg, *args, **kwargs): if self.isEnabledFor(WARNING): self._log(WARNING, msg, args, **kwargs) logging actually waits to interpolate the string in LogRecord.getMessage() https://github.com/python/cpython/blob/2.7/Lib/logging/__init__.py#L328 if self.args: msg = msg % self.args Change-Id: Ie09efe0a66881e19bd8119caa376075e605627a2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-11-10contexts/node: default to pod.yamlRoss Brattain1-2/+2
We used to default to /etc/yardstick/nodes/pod.yaml but this was changed Recently I got a weird error 2016-11-10 01:18:03,404 - INFO - yardstick.benchmark.contexts.node - Parsing pod file: /root/isb/yardstick/ [Errno 21] Is a directory: '/root/isb/yardstick/' It looks like if file attr is not defined we default to self.file_path = "" which leads to a path ending with a '/' which is a directory so we get the weird Errno 21 error. I think we want to default to pod.yaml in YARDSTICK_ROOT_PATH JIRA: YARDSTICK-364 Change-Id: Iab1a2b935d1e380edc208af3ce4e4758e8424bfe Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-11-01Bugfix:fix a bug that yardstick_key.pub cannot be found in Yardstick dockerJingLu51-1/+3
JIRA: YARDSTICK-379 Change-Id: I8416a38c94e07f0f83cb74d920a7c4d22a0cd04a Signed-off-by: JingLu5 <lvjing5@huawei.com>
2016-10-25remove yardstick_key from the repoJingLu51-0/+21
JIRA: YARDSTICK-370 private key should not be in the repo. yardstick image now use yardstick_key in the repo to log in the vm, so it should be change to automatic generate it. also the userguide should be updated to generate yardstick_key before the test. Change-Id: I61775bb429a8fddb9b8d312203f10ec369a1f801 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2016-10-10Bugfix: no pod.yaml file error when run test case not in the root pathchenjiankun1-1/+5
JIRA: YARDSTICK-364 Change-Id: I8c460064c058f77971140f69689ba638179f89d9 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-07-28Bugfix: Only add keyword "external_network" to the first networkwu.zhihui1-6/+6
In test case yaml file, when vm need three networks and enable floating ip true, it should only add keyword "external_network" to the first one. 'networks': {'test': {'cidr': '10.0.1.0/24', 'external_network': 'admin_floating_net'}, 'test3': {'cidr': '10.0.3.0/24'}, 'test2': {'cidr': '10.0.2.0/24'}} JIRA:YARDSTICK-309 Change-Id: I1126955749b598b8c5460ac75843c1939b4f8443 Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
2016-07-21Fix a bug for node contextSongnon1-1/+3
Change-Id: Idff42e95f5ade160c00adc13c158dc1746e8d049 Signed-off-by: Songnon <songnon.zhang@ericsson.com>
2016-06-01Change floating ip association methodAkos Farago1-1/+1
Change-Id: I694fbce4470a14893310334a39e15b61fbe8905a Signed-off-by: Akos Farago <akos.farago@ericsson.com>
2016-02-18Add heat template workaround for odl-l3Jo¶rgen Karlsson1-0/+8
Change-Id: I476fdd4d0e0e97cb1457ae15f92442c42aa77b4e Signed-off-by: Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>
2016-02-09Revert "Test: Workaround for ODL Lithium"Jörgen Karlsson1-12/+1
This reverts commit 912fe3bb9877456cb8ef363f9304bfab733eaffd. Change-Id: I82e032ae43e49edff78cb8f7a0881a5ecd3f54db
2016-02-05Test: Workaround for ODL LithiumJörgen Karlsson1-1/+12
Change-Id: I9db7f95beb618e2a3125b5252a79bf1a400b6af1
2016-01-27Revert "Test: Workaround for ODL scenarios"Jörgen Karlsson1-10/+1
This reverts commit 8236c94ecef8aa25af073c50f7a0eaafae9b4bc6. Change-Id: I4652efe4f75e7f2605945e9896b33379eff059d1
2016-01-27Test: Workaround for ODL scenariosJo¶rgen Karlsson1-1/+10
Temporarily removing security group from generated heat template. This patch is pushed through for testing purposes and should be reverted when a proper solution is found. Change-Id: I64c86f41664499d46d8317bb1ebbe304083554ab Signed-off-by: Jo¶rgen Karlsson <jorgen.w.karlsson@ericsson.com>
2016-01-15HeatContext model update to match heat code updateQiLiang1-0/+2
In Heat Liberty release OS::Nova::Server will always use the user pre-configured in the image (e.g. "fedora" for stock Fedora cloud images, "ubuntu" for stock Ubuntu cloud images, "cloud-user" for stock CentOS cloud images etc) Change all ec2-user -> ubuntu Add admin-user in Heat model for backwards compatibility. Refer below links for detalis: https://etherpad.opnfv.org/p/yardstick_release_b_troubleshooting https://github.com/openstack/heat/commit/e423bec7f10b0f5d07f05d195b3b7860f6bceb00 http://blog.scottlowe.org/2015/04/23/ubuntu-openstack-heat-cloud-init/ JIRA: - Change-Id: I6b8b2b21daf113a3a86aee1126b0c3e74737ef4f Signed-off-by: QiLiang <liangqi1@huawei.com>
2016-01-12Workround for openstack nova bugQiLiang1-2/+21
Notes: if placement_groups policy is "availability" and > 2 servers in this group may still have this issue. JIRA: YARDSTICK-200 Signed-off-by: QiLiang <liangqi1@huawei.com>
2016-01-08support for ipv6kubi1-9/+2
JIRA:YARDSTICK-187 Change-Id: I1cecd400b4449a09d22d43f4a42e889f00dd4fe7 Signed-off-by: kubi <jean.gaoliang@huawei.com>
2015-12-31Add Dummy context and scenario typeQiLiang1-0/+38
Dummy Context Usage: - if no context specified in the task file then automatically use Dummy Context - or specify the context with type Dummy in the task file, like context: type: Dummy Note: context without type name default use Heat Context. (e.g. samples/fio.yaml) JIRA: - Change-Id: I7f798a7260bdd6ac24902e2c835a3b121319fd8c Signed-off-by: QiLiang <liangqi1@huawei.com>
2015-11-01Support NodeContext typeQiLiang1-0/+94
Initial NodeContext implementation to support BareMetal, Controller, Compute scenarios. Usage: 0) install yardstick 1) mkdir -p /etc/yardstick/nodes 2) cp <yardstick_repo>/etc/yardstick/nodes/pod.yaml.sample \ /etc/yardstick/nodes/pod.yaml 3) edit /etc/yardstick/nodes/pod.yaml (make show ip, username, ssh key are configured correctly) 4) yardstick -d task start \ <yardstick_repo>/samples/ping-node-context.yaml 5) cat /tmp/yardstick.out Design etherpad link: https://etherpad.opnfv.org/p/yardstick_framework JIRA: YARDSTICK-169 Change-Id: I3f6ade8243e68d88326f23ed213edb32c638ed32 Signed-off-by: QiLiang <liangqi1@huawei.com>
2015-10-27Heat context code refactor part 2QiLiang2-7/+24
Heat context code refactor to cater for the evolution of the Yardstick framework. Refactor runner_cfg host/target info handle, as specified at https://etherpad.opnfv.org/p/yardstick_framework step 4. Get general Context info (use Context.get). Before this refactor host and target vm must have the same user name and ssh key, that is not general enough for later extension. test_case.yaml do NOT need to change. JIRA: YARDSTICK-168 Change-Id: I5cfe868f3c6f633214ef550bc9676fe1de0709db Signed-off-by: QiLiang <liangqi1@huawei.com>
2015-10-20Heat context code refactorQiLiang4-0/+531
Heat context code refactor to cater for the evolution of the Yardstick framework. At test_case.yaml context segment add "type" to indicate the context type, see samples/ping-heat-context.yaml for an example. And the default context type is Heat, so the existing yaml file do not need to change. JIRA: YARDSTICK-168 Change-Id: Ida0ce12c17cd9b88d7acfb4c9eb1ac6986394b38 Signed-off-by: QiLiang <liangqi1@huawei.com>