We can launch the API with this file
TODOs :
- - use POD name instead of id
- logging
- json args validation with schemes
- POST/PUT/DELETE for PODs
- POST/PUT/GET/DELETE for installers, platforms (enrich results info)
- count cases for GET on test_projects
- count results for GET on cases
- - provide filtering on requests
- include objects
- swagger documentation
- setup file
import argparse
from resources.handlers import VersionHandler, PodHandler, \
- TestProjectHandler, TestCasesHandler, TestResultsHandler
+ TestProjectHandler, TestCasesHandler, TestResultsHandler, DashboardHandler
from common.config import APIConfig
CONF = APIConfig().parse(args.config_file)
# connecting to MongoDB server, and choosing database
-db = motor.MotorClient(CONF.mongo_url)
+client = motor.MotorClient(CONF.mongo_url)
+db = client[CONF.mongo_dbname]
def make_app():
# GET /pods => Get all pods
# GET /pods/1 => Get details on POD 1
(r"/pods", PodHandler),
- (r"/pods/(\d*)", PodHandler),
+ (r"/pods/([^/]+)", PodHandler),
# few examples:
# GET /test_projects
# => get results with optional filters
# POST /results =>
# Push results with mandatory request payload parameters
- # (project, case, and pod_id)
+ # (project, case, and pod)
(r"/results", TestResultsHandler),
(r"/results([^/]*)", TestResultsHandler),
(r"/results/([^/]*)", TestResultsHandler),
+
+ # Method to manage Dashboard ready results
+ # GET /dashboard?project=functest&case=vPing&pod=opnfv-jump2
+ # => get results in dasboard ready format
+ # get /dashboard
+ # => get the list of project with dashboard ready results
+ (r"/dashboard", DashboardHandler),
+ (r"/dashboard([^/]*)", DashboardHandler),
+ (r"/dashboard/([^/]*)", DashboardHandler),
],
db=db,
debug=CONF.api_debug_on,