aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common
AgeCommit message (Collapse)AuthorFilesLines
2017-10-17validate_non_string_sequence: use six.string_typesRoss Brattain1-1/+1
Change-Id: I7248d97a55974091daf20f0fba4b612101a0e4c5 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-10-03Merge "NSB PROX test hang fixes"Ross Brattain1-0/+47
2017-10-03NSB PROX test hang fixesRoss Brattain1-0/+47
The PROX tests were hanging in the duration runner. These are fixes for various errors: raise error in collect_kpi if VNF is down move prox dpdk_rebind after collectd stop fix dpdk nicbind rebind to group by drivers prox: raise error in collect_kpi if the VNF is down prox: add VNF_TYPE for consistency sample_vnf: debug and fix kill_vnf pkill is not matching some executable names, add some debug process dumps and try switching back to killall until we can find the issue sample_vnf: add default timeout, so we can override default 3600 SSH timeout collect_kpi is the point at which we check the VNFs and TGs for failures or exits queues are the problem make sure we aren't silently blocking on non-empty queues by canceling join thread in subprocess fixup duration runner to close queues and other attempt to stop duration runner from hanging VnfdHelper: memoize port_num resource: fail if ssh can't connect at the end of 3600 second test our ssh connection is dead, so we can't actually stop collectd unless we reconnect fix stop() logic to ignore ssh errors Change-Id: I6c8e682a80cb9d00362e2fef4a46df080f304e55 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-09-26Ensure that at least one handler is availableEdward MacGillivray2-16/+19
https://jira.opnfv.org/browse/YARDSTICK-773?filter=-3 Remove dependency of yardstick on utils methods Change-Id: Iadf502364a7f08c279a8f0d17d7e45e8047f4066 Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
2017-09-21Add service in kubernetes contextchenjiankun1-0/+59
JIRA: YARDSTICK-803 Currently kubernetes test case can only run in master node. We need to support it run in jump server. So I add service and use nodePort type. Then we can login the pod using nodePort. Change-Id: Ia7900d263f1c5323f132435addec27ad10547ef9 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-09-21Introduced timeout to post method of HttpClientMaciej Skrocki1-10/+14
We seen cases where grafana container bring-up code would fail, because of too quick access to the http api. Added 10sec timeout for the first query of the API. Change-Id: Ifc95a626d0ab5552a1f26fb167fc3f65791392d7 Signed-off-by: Maciej Skrocki <maciej.skrocki@intel.com>
2017-08-29Merge "utils: catch SyntaxError during import"Ross Brattain1-1/+1
2017-08-29Merge "Add common openstack opertation scenarios: router & port"Ross Brattain1-0/+40
2017-08-28utils: catch SyntaxError during importRoss Brattain1-1/+1
bad modules can also throw SyntaxError besides ImportError Change-Id: I4fa912505753cba3c06f127105354572b7f5ddd8 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-28Merge "DRAFT: update yardstick generic test cases dashboard"Ross Brattain1-1/+1
2017-08-25Merge "Add function to upload image from local/url in GUI"Jing Lu1-0/+1
2017-08-25Add common openstack opertation scenarios: router & portJingLu51-0/+40
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: Id436a201aa04f8f6b98576e8fbf599ca3654827c Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-24Add function to upload image from local/url in GUIchenjiankun1-0/+1
JIRA: YARDSTICK-782 As user, we need to upload image from local/url. If upload image from local, user need to choose local image, then we will load it to openstack. If upload image from url, we will download it and load it to openstack. Change-Id: Ia9a42fda15a1dfc91476643635343a2f77a94a6b Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-08-23Add common openstack opertation scenarios: volume & floating ipJingLu51-0/+49
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: I1300a61b389202242f112b6d280ab47746379546 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-22DRAFT: update yardstick generic test cases dashboardrexlee87761-1/+1
current dashboard is obselete and hard to understand add local grafana dashboard automatically import by "yardstick env grafana" update grafana version to latest steady Change-Id: Iffae9170231d3e0867a52a1f6b5e99c4650b7326 Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-08-21Add common openstack opertation scenarios: subnet & portJingLu51-0/+144
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 Lu1-0/+32
2017-08-19import_modules_from_package: refactor with generatorsRoss Brattain1-13/+13
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-16Merge "YAML fixes"Ross Brattain4-5/+58
2017-08-15YAML fixesRoss Brattain4-5/+58
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-15html_template: can't use iteritems, use itemsRoss Brattain1-2/+2
iteritems is not supported in Python 3 we have to use items() Change-Id: Ib923dfea4220eeab311949c9f6f420fef378e98a Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-15Merge "Add yardstick report for each task"Ross Brattain2-0/+61
2017-08-14PROX VNF and TGRoss Brattain1-25/+29
PROX was added to samplevnf project https://git.opnfv.org/samplevnf/tree/VNFs/DPPD-PROX JIRA: YARDSTICK-638 Change-Id: If9875b1130c6bed87deb8720b0d8b28ede9289d9 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-14Add yardstick report for each taskchenjiankun2-0/+61
JIRA: YARDSTICK-784 Currently we have yardstick report in GUI. But if users do not use GUI, they can't see this report. So we need generate a report each task. After run each test case, we can see report: http://ip:port/report/report.html Change-Id: Ic76cf57f55aa6680b91272e210135136f0225373 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-08-11Add Ansible executor class for node contextRoss Brattain2-0/+601
import the AnsibleCommon class to execute Ansible playbooks Update node context support to use AnsibleCommon needs unittests We must call ansible-playbook as an executable, so we must create temp files for inventory, and for the playbooks. AnsibleCommon has evolved to be quite flexible, it auto-generates the inventory from the context['nodes'] and generates groups from the node Role. We also support either a single playbook filename, or a list of filenames. If given a list we dynamically generate a playbook that includes the other playbooks. We support adding any number of extra_vars using a temp JSON file. Also designed to be extended by subclassing. Change-Id: I5bd0a2b4547feaadd70b7e2b8801f19371b99df0 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-11Add real time log view in GUIchenjiankun1-0/+1
JIRA: YARDSTICK-775 We have GUI now, but we can't see real time log in GUI view. So I add real time log view in GUI. Change-Id: Ie83f327ef0a94302afa6b3def764fec6ef5818d1 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-08-11Merge "Add common openstack opertation scenarios: image & volume"Jing Lu1-0/+60
2017-08-11Add common openstack opertation scenarios: networkJingLu51-0/+32
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: I854fc435a5c951245a5997cd4e3e63c5162030af Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-11Merge "Add common openstack opertation scenarios: flavor & server"Kubi1-62/+39
2017-08-11Add common openstack opertation scenarios: image & volumeJingLu51-0/+60
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: I3de7dbb30eaebac4feebcf07dd6a0d2bdcf428d9 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-11Add common openstack opertation scenarios: flavor & serverJingLu51-62/+39
JIRA: YARDSTICK-781 This patch adds some common openstack opertation scenarios Change-Id: I9e84a8894fe9b9c1754a45a0ddfdf93739164b9a Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-08-10Merge "constants: cache YAML config values"Ross Brattain2-16/+24
2017-08-08constants: cache YAML config valuesRoss Brattain2-16/+24
don't reparse the yardstick.yaml file each time we lookup an option. Since it is global data, just cache it in a global var Use pkg_resources.resource_filename to lookup the path of yardstick tests, intsead of using __file__ pkg_resources is slightly more proper than __file__ at least for packages Change-Id: I05d9748390a37bd45c53013fc084d23069ab7c51 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-08IXIA traffic generatorDeepak S1-0/+26
Change-Id: I09bcb3f2c4b945283070d442589d3bf00468abbc Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-08NSB updateDeepak S1-5/+93
Refactored main NSB VNF classes accroding to class diagram https://wiki.opnfv.org/display/yardstick/NSB+class+diagram All the SampleVNFs have been separated and placed under the SampleVNF class. Added AutoConnectSSH to automatically create SSH conneciton on demand. Added VnfdHelper class to wrap the VNFD dictionary in prepartion for class-based modeling. Extracted DpdkVnfSetupEnvHelper for DPDK based VNF setup. Extracted Stats and other client config to ResourceHelper Had to replace dict_key_flatten with deepgetitem due to Python 2.7 Jinja2 infinite recursion. Change-Id: Ia8840e9c44cdbdf39aab6b02e6d2176b31937dc9 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com> Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-08-01replace yaml.load with yaml.safe_loadRoss Brattain1-0/+1
yaml.safe_load is safer, obviously. anteater will check for this template_format use specialized constructor based on yaml.SafeLoader JIRA: YARDSTICK-760 Change-Id: Ia3b0b3aa0765385a0ee472a4d83f49d424b5a77f Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-29Heat: support create and attach volume in heat type contextJingLu51-0/+24
JIRA: YARDSTICK-756 Some test scenarios require VM with volume attached. This work is about supporting create and attach volume in heat type context. context: name: demo image: cirros-0.3.5 flavor: yardstick-flavor user: cirros placement_groups: pgrp1: policy: "availability" servers: athena: floating_ip: true # per-vm inline volume definition. if no volume size specified, then this # volume should be an existing volume in the openstack environment volume: yardstick-volume placement: "pgrp1" ares: # per-vm inline volume definition. if volume size is specified, then this # volume will be crated and attach to the vm volume: name: test-volume size: 10 # volume mountpoint is also configurable volume_mountpoint: /dev/vdb placement: "pgrp1" networks: test: cidr: '10.0.1.0/24' Change-Id: Ief87b313980a59eac229eb4780d93ffc929ceb66 Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-07-25Merge "yardstick env influxdb/grafana cmd support centos"Rex Lee2-1/+11
2017-07-19yardstick env influxdb/grafana cmd support centoschenjiankun2-1/+11
JIRA: YARDSTICK-714 Currently yardstick env influxdb/grafana command do not support centos. Because we use the gateway ip to get the service of influxdb and grafana. But in centos, we can not access influxdb/grafana service via gateway ip. In this patch, I use docker inspect to get the ip of influxdb and grafana. So these command can support centos. Change-Id: Ie4abcb8048b92d61bc62777dfc362bb29f354b2b Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-17Add API(v2) to create influxdbchenjiankun1-0/+11
JIRA: YARDSTICK-726 API: /api/v2/yardstick/containers/action METHOD: POST PARAMS: { 'action': 'create_influxdb', 'args': { 'environment_id': environment_id } } Change-Id: I20961fc6ae9918c894de7fabd3f81ca966bd24cd Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-17Kubernetes (k8s) supportchenjiankun3-0/+159
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-14Add API(v2) to upload openrcchenjiankun1-0/+2
JIRA: YARDSTICK-719 API: /api/v2/yardstick/environments/openrcs/action METHOD: POST PARAMS: { 'action': 'upload_openrc', 'args': { 'file': file, 'environment_id': environment_id } } Change-Id: If367904a2d0c2d4a192fdc87a8da21ac6549269e Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-13Add API to get environmentschenjiankun1-0/+10
JIRA: YARDSTICK-716 API: /api/v2/yardstick/environments METHOD: GET Change-Id: I46b7fb2b143fe76b6a0edbf1ecc8281187b85918 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-12Change endpoint to url in APIchenjiankun1-0/+1
There are come conflict with new architecture. Also it is more proper to use url as endpoint. Change-Id: Idce331e36d85d0720bbf3255dca29ba6022e18b2 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-07-12constants: default SERVER_IP to 127.0.0.1Ross Brattain1-1/+9
When running unittest while connected to P2P VPN, their is no default route, so we get None. Instead of using None, default to 127.0.0.1 Not sure why this was renamed to SERVER_IP either, what do we use this value for? Still getting py.test unittest failures all the time. The problem is we lookup influxdb.ip but SERVER_IP is None, so the lookup fails. INFLUXDB_IP = get_param('influxdb.ip', SERVER_IP) SERVER_IP can't ever be None Change-Id: Iedb09dc541137f7cdc6ef8d26dd312807985bfa8 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-07-11Yardstick API architecture improvementchenjiankun1-2/+22
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 utilsrexlee87761-0/+23
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-07-05Merge "Use "OS_INSECURE" variable as the insecure mode indicator"Kubi1-1/+2
2017-06-30Use "OS_INSECURE" variable as the insecure mode indicatorJingLu51-1/+2
Now we use "OS_CACERT" as the insecure mode indicator, it is better to use "OS_INSECURE". Change-Id: I1406193e27510390b4b8fd8f4751d8361560172f Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-06-30Add API to show test case documentationchenjiankun1-0/+1
JIRA: YARDSTICK-694 We need API to show test case documentation. API: /yardstick/testcases/<testcase_name>/docs method: GET example: http://192.168.131.2:8888/yardstick/testcases/opnfv_yardstick_tc002/docs Change-Id: Ib8d591f0ff5f91c4d0a740539727ec73ddd86249 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>