summaryrefslogtreecommitdiffstats
path: root/api
AgeCommit message (Collapse)AuthorFilesLines
2017-04-20Yardstick virtualenv supportchenjiankun1-0/+3
JIRA: YARDSTICK-620 In the patch, I separate python-setuptools from install.sh and separate appdirs from requirements.txt because there will be error when install them in virtualenv. Also I will update the documentation when this patch merged; Change-Id: I99a532d1851983775869e7c5e8e65fd0229e86df Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-04-01Yardstick virtualenv supportchenjiankun10-95/+77
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>
2017-03-28Bugfix: improper license header in swagger docschenjiankun3-74/+50
JIRA: YARDSTICK-609 In the patch: https://gerrit.opnfv.org/gerrit/#/c/28833/ It update the license header, but it is improper to swagger yaml file. The license information will show in swagger docs. So I remove it. Change-Id: Ib87f0f43a95e3b2145c4b59059c4573000f1997c Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-03-09Merge "Record test case names when run a task using API"Rex Lee1-4/+21
2017-03-02env prepare check openrc already sourcedrexlee87761-5/+11
env prepare should check if openrc is sourced before using os_fetch_utils to fetch openrc JIRA: YARDSTICK-577 Change-Id: I0efb0bae3b408156b1133812c29583ab8c58d94b Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2017-02-24Add common method of openstack in openstack_utilschenjiankun1-1/+2
JIRA: YARDSTICK-569 We have much redundancy code when using nova/neutron/glance... python client. So I write this code in openstack_utils for calling. Change-Id: I322b7577de4933246a15e6742ae5a28bea16eb02 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-02-23Record test case names when run a task using APIchenjiankun1-4/+21
JIRA: YARDSTICK-509 Currently we use influxdb as database and will not record test case name when run a test suite. So if we must offer test case name if we want to get result from API. I will record test case name when run a test suite. So we needn't offer test case any more when call for get result API. Change-Id: I87ea4770422cbc46aa6671bfcc53bd4498825eef Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-02-23Merge "Update missing license headers"Rex Lee3-0/+24
2017-02-22Create Grafana dashboards according config file under root_path/dashboardchenjiankun1-4/+9
JIRA: YARDSTICK-570 Currently we only create ping Grafana dashboard when create Grafana docker container. Actually we need to create some default dashboards. Change-Id: Icee975ad8c1c960b27625274c775f1716edfa03e Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-02-17Update missing license headersDeepak S3-0/+24
Change-Id: I063fd37fe25754c94d164ae5a209d15b69322093 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
2017-02-16Merge "pylint fixes: remove redundant parens, fix comparison order"Rex Lee3-3/+3
2017-02-08uwsgi: move init_db to uwsgi entry pointRoss Brattain2-4/+9
uwsgi will call the 'callable' function which should normally be Flask.__call__(). But we need to init the db first, so make a wrapper function that inits the db and then calls app() Also refactor add_resource into for loop instead of reduce. reduce is not really approriate here since we aren't consuming the return value JIRA: YARDSTICK-543 Change-Id: I692d6d42de09f7d6ecf1a67a22e3019d97a4f3ca Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-02-08pylint fixes: remove redundant parens, fix comparison orderRoss Brattain3-3/+3
removed redundant parens in if and while clauses use var != constant, not constant != var. Python doesn't allow for assignment in if statements, so we don't have to use the old C workarounds remove unwanted commas use raw strings for regexps with backslashes, e.g. r'\s' instead of '\s' Change-Id: I7aad645dd3d7f4b4b62f4e4510a425611c9d28f2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2017-01-20Create API to get a list of all test caseschenjiankun4-0/+64
JIRA: YARDSTICK-456 Currently we do not have a API to get a list of all test cases; Currently the test case info is from the comment; So I create a API to get a list of all test cases; And create a 'description' attribute to record info of a test case; And use the CLI call this API; Change-Id: Ife800600446683664097835c7b9f11899c85771d Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-01-17Add unittest framework for Yardstick APIchenjiankun3-4/+4
JIRA: YARDSTICK-538 Currently it is hard to test API, So I add a base class as flask document do. In this framework I will mock a temp sqlite database and a server. Change-Id: If881233cb22655617c07ad018201b8ee08492d06 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2017-01-12Add support for Python 3Ross Brattain15-27/+51
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-11Merge "Create API to run test suite"Rex Lee7-1/+142
2017-01-10Create API to run test suiteJingLu57-1/+142
JIRA: YARDSTICK-475 This API will be used to run test suite files in the test/opnfv/test_suites directory Change-Id: I208edf9abed62fd6436de988ac85bfe99c4d01bd Signed-off-by: JingLu5 <lvjing5@huawei.com>
2017-01-10Merge "Add API to get the status of async task"Jing Lu8-28/+174
2017-01-10Add API to get the status of async taskchenjiankun8-28/+174
JIRA: YARDSTICK-526 Currently there are many API run a task using sub thread. But we don't know the status of this task. So we need to offer a API to query the status of this task. Change-Id: I8d2cc558750bf9270aed4a7abb8bf35d17894d83 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-28Record test case names when run a task using APIchenjiankun7-66/+85
JIRA: YARDSTICK-509 Currently we use influxdb as database and will not record test case name when run a test case. So if we must offer test case name if we want to get result from API. Regarding future requirement, I create sqlite database and alchemy orm framework. And record test case name when run a test case. So we needn't offer test case any more when call for get result API. Change-Id: I7d7dc24543a33918546267591f7bdcd0742928cb Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-28Merge "Use ConfigParser to write yardstick.conf"Jing Lu1-22/+12
2016-12-26Use ConfigParser to write yardstick.confchenjiankun1-22/+12
JIRA: YARDSTICK-474 Currently, I use file.write() method to write config in yardstick.conf. But it is not recommended. So I change to use ConfigParser to write config in yardstick.conf Change-Id: Ia789cf09296afd5d1507bcf99f165378bf87c591 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-24Add sqlite and SQLAlchemy support for APIchenjiankun3-0/+63
JIRA: YARDSTICK-505 Now yardstick API need a database to store API data. And for future the yardstick GUI also need a self database. So I choose a light-weight database sqlite. And use SQLAlchemy to do ORM. Change-Id: I1edc350ec6f57ad67785de549c2135c86ea60a4a Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-24Merge "Bugfix: the load_image.sh script will load a image with the same name"Jing Lu1-0/+10
2016-12-24Merge "Move uwsgi.log and yardstick.sock to proper location"Jing Lu3-3/+9
2016-12-22Bugfix: the load_image.sh script will load a image with the same namechenjiankun1-0/+10
JIRA: YARDSTICK-471 Currently, if we execute the load_image.sh and the openstack already have this image in the cloud,this script will load another image with the same name. This will make yardstick run error. So I clean this related images before loading. Change-Id: If5b985ef9b2e890aa10453810fac36867d320a06 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-22Yardstick API refactorchenjiankun8-46/+72
JIRA: YARDSTICK-503 Now in api/views.py there are many redundant code. So I do some refactoring and make it to be a lightweight framework. Change-Id: Id7cecc95e60f5403b2d26239a3ef41d01bbb542a Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-21Move uwsgi.log and yardstick.sock to proper locationchenjiankun3-3/+9
JIRA: YARDSTICK-504 Now yardstick.sock and uwsgi.log is in yardstick/api directory. But it is not standard for they should not be put in the code path. So I move yardstick.sock to /var/run/yardstick.sock and move uwsgi.log to /var/log/yardstick/uwsgi.log Change-Id: I526ab011c0222255dfbae037f494edb5d8a88add Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-07env: convert file open to context managerRoss Brattain1-1/+2
always use context managers to open file Change-Id: I2c894ea87a94789edbed4a4da1fa906b28556664 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-12-06Bugfix: create stack failed due to not export EXTERNAL_NETWORK environment ↵chenjiankun1-0/+3
viarable JIRA: YARDSTICK-449 Now if we run prepare env, we will not source the EXTERNAL_NETWORK. I will source the EXTERNAL_NETWORK after I get it. Change-Id: I917fcecae2cac13b7511667c0687d10eccfac751 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-05Merge "Making nginx and uwsgi service start when run docker by using supervisor"Rex Lee1-6/+18
2016-12-05Merge "Bugfix: debug should be default off"Jing Lu1-1/+1
2016-12-04Add API and command support for yardstick env preparechenjiankun1-2/+95
JIRA: YARDSTICK-406 Change-Id: Icf837a6f34a22158203566a43a6446fc269c096f Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-03Making nginx and uwsgi service start when run docker by using supervisorchenjiankun1-6/+18
JIRA: YARDSTICK-444 We need web service start when docker run. But now we add command in bashrc, so the web service start only if we login in docker container. So I use supervisor to make the web service start when docker run. Change-Id: Ic77eb0e130ae7dbd82039c312649fed76b128513 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-02Add API to create Grafana containerchenjiankun1-12/+89
JIRA: YARDSTICK-441 Change-Id: Ia848c4af072915ef252e8e03100dd7a4e4a6c3c2 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-02Add support for sample testcase to get test resultchenjiankun1-3/+5
JIRA: YARDSTICK-440 Change-Id: I15234e833353a33b063993b96f1f787ddf649720 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-01Add swagger support for Rest APIchenjiankun6-0/+160
JIRA: YARDSTICK-439 Change-Id: I36ad0663455c51d635c4329f5cbb9da25d8042e1 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-01Add API to run test case under samples directorychenjiankun4-0/+53
JIRA: YARDSTICK-432 Change-Id: I8ca6409449e2b960ac9f48c8eb8a6ae9959a4fc8 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-12-01Merge "Modify url mapping to make API more Restful"Jing Lu2-4/+4
2016-12-01Merge "Use flask jsonify method to return json result"Jing Lu2-15/+6
2016-11-30Bugfix: debug should be default offrexlee87761-1/+1
JIRA: YARDSTICK-398 Change-Id: I8b2f776a9cf6d577150633999354db762fcb93ae Signed-off-by: rexlee8776 <limingjiang@huawei.com>
2016-11-30Modify url mapping to make API more Restfulchenjiankun2-4/+4
JIRA: YARDSTICK-435 Change-Id: Ief767ceca2979494ec0b4ea4d197fd399352b856 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-11-30Use flask jsonify method to return json resultchenjiankun2-15/+6
JIRA: YARDSTICK-433 Python json lib is very hard to parse when transport via network. Flask jsonfiy is more easier to use. Change-Id: I2afd5238d65bc474170c57d2f9307dc881ea4990 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-11-29centralize logging into root loggerRoss Brattain1-0/+3
If we setup root logger correctly and have each module logger propogate we shouldn't need individual logger configuration updates: lower paramiko to WARN level dispatcher/file.py was missing logging.handlers import purge all existing handlers and add our own handlers move everything back into yardstick/__init__.py so API can use it make _LOG_STREAM_HDLR global, so we can set loglevel on it whenever added api/server.py call to _init_logging removed old LOG_FORMATTER from cli.py only setLevel on yardstick logger Change-Id: If000799590379d3407655a7d54378481a96ea3d4 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
2016-11-30Merge "Bugfix: the API to get result do not work due to can't parse $"Jing Lu2-8/+14
2016-11-30Merge "Create API and command to create a influxDB container"Jing Lu4-32/+109
2016-11-30Bugfix: the API to get result do not work due to can't parse $chenjiankun2-8/+14
JIRA: YARDSTICK-429 The API to get result use $ to prevent sql injection. But it doesn't work. Change-Id: I130a847297f209fe26062317261f884c5665f5df Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-11-30Create API and command to create a influxDB containerchenjiankun4-32/+109
JIRA: YARDSTICK-425 This API is used to create a influxDB Container Add command line to create a influxDB Container, too Change-Id: If9c2d04b779924d492a5d5ea91f7968fa959570e Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
2016-11-29Bugfix: dict don't have startwith method error when use API to run test casechenjiankun1-1/+1
JIRA: YARDSTICK-431 When use API to run test case and set the task-args args, it will encounter a error of dict object do not have startwith method. The reason is yardstick will only accept the str type. So we need to change the dict to str. Change-Id: I26aac35c477842ab9cd692bdacd401e68673b01d Signed-off-by: chenjiankun <chenjiankun1@huawei.com>