summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Beierl <mark.beierl@emc.com>2016-05-20 09:30:46 -0400
committerMark Beierl <mark.beierl@emc.com>2016-05-20 09:30:46 -0400
commit68b1262791f4d0e0ea5cf7caa16678ea72307527 (patch)
treeef866936240e9d16ea521336ed9c9575887468cd
parent3a179cd6fb3cc3358a2c78815e1a59f4ee68487b (diff)
Standardize the ReST API
Change-Id: I004824711abf17f06781302cf48a0b0e3d095ecb Signed-off-by: Mark Beierl <mark.beierl@emc.com>
-rw-r--r--cli.py13
-rw-r--r--rest_server.py13
-rw-r--r--storperf/test_executor.py2
3 files changed, 14 insertions, 14 deletions
diff --git a/cli.py b/cli.py
index 85ebcfd..fda05c2 100644
--- a/cli.py
+++ b/cli.py
@@ -17,12 +17,11 @@ import json
import logging
import logging.config
import logging.handlers
+import requests
import socket
import struct
import sys
-import requests
-
class Usage(Exception):
pass
@@ -132,7 +131,7 @@ def main(argv=None):
if (erase):
response = requests.delete(
- 'http://127.0.0.1:5000/api/v1.0/configure')
+ 'http://127.0.0.1:5000/api/v1.0/configurations')
if (response.status_code == 400):
content = json.loads(response.content)
raise Usage(content['message'])
@@ -140,7 +139,7 @@ def main(argv=None):
if (terminate):
response = requests.delete(
- 'http://127.0.0.1:5000/api/v1.0/job')
+ 'http://127.0.0.1:5000/api/v1.0/jobs')
if (response.status_code == 400):
content = json.loads(response.content)
raise Usage(content['message'])
@@ -148,7 +147,7 @@ def main(argv=None):
if (configuration is not None):
response = requests.post(
- 'http://127.0.0.1:5000/api/v1.0/configure', json=configuration)
+ 'http://127.0.0.1:5000/api/v1.0/configurations', json=configuration)
if (response.status_code == 400):
content = json.loads(response.content)
raise Usage(content['message'])
@@ -156,7 +155,7 @@ def main(argv=None):
if (report is not None):
print "Fetching report for %s..." % (report,)
response = requests.get(
- 'http://127.0.0.1:5000/api/v1.0/job?id=%s' % (report,))
+ 'http://127.0.0.1:5000/api/v1.0/jobs?id=%s' % (report,))
if (response.status_code == 400):
content = json.loads(response.content)
raise Usage(content['message'])
@@ -165,7 +164,7 @@ def main(argv=None):
else:
print "Calling start..."
response = requests.post(
- 'http://127.0.0.1:5000/api/v1.0/job', json=options)
+ 'http://127.0.0.1:5000/api/v1.0/jobs', json=options)
if (response.status_code == 400):
content = json.loads(response.content)
raise Usage(content['message'])
diff --git a/rest_server.py b/rest_server.py
index 7578f41..390cb8c 100644
--- a/rest_server.py
+++ b/rest_server.py
@@ -7,6 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from storperf.db.job_db import JobDB
+from storperf.plot.barchart import Barchart
+from storperf.storperf_master import StorPerfMaster
import io
import json
import logging
@@ -15,11 +18,7 @@ import os
from flask import abort, Flask, request, jsonify, send_from_directory
from flask_restful import Resource, Api, fields
-
from flask_restful_swagger import swagger
-from storperf.db.job_db import JobDB
-from storperf.plot.barchart import Barchart
-from storperf.storperf_master import StorPerfMaster
app = Flask(__name__, static_url_path="")
@@ -421,9 +420,9 @@ def setup_logging(default_path='storperf/logging.json',
rootLogger.addHandler(socketHandler)
-api.add_resource(Configure, "/api/v1.0/configure")
-api.add_resource(Quota, "/api/v1.0/quota")
-api.add_resource(Job, "/api/v1.0/job")
+api.add_resource(Configure, "/api/v1.0/configurations")
+api.add_resource(Quota, "/api/v1.0/quotas")
+api.add_resource(Job, "/api/v1.0/jobs")
if __name__ == "__main__":
setup_logging()
diff --git a/storperf/test_executor.py b/storperf/test_executor.py
index 592c33d..fc51adc 100644
--- a/storperf/test_executor.py
+++ b/storperf/test_executor.py
@@ -92,6 +92,8 @@ class TestExecutor(object):
self.metrics_emitter.transmit_metrics(carbon_metrics)
def register_workloads(self, workloads):
+ self.workload_modules = []
+
if (workloads is None or len(workloads) == 0):
workload_dir = os.path.normpath(
os.path.join(os.path.dirname(__file__), "workloads"))