1 ##############################################################################
2 # Copyright (c) 2015 Orange
3 # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
15 We can launch the API with this file
19 - json args validation with schemes
20 - POST/PUT/DELETE for PODs
21 - POST/PUT/GET/DELETE for installers, platforms (enrich results info)
22 - count cases for GET on projects
23 - count results for GET on cases
25 - swagger documentation
38 from opnfv_testapi.common import config
39 from opnfv_testapi.router import url_mappings
40 from opnfv_testapi.tornado_swagger import swagger
45 def parse_config(argv=[]):
47 parser = argparse.ArgumentParser()
48 parser.add_argument("-c", "--config-file", dest='config_file',
49 help="Config file location")
50 args = parser.parse_args(argv)
51 CONF = config.APIConfig().parse(args.config_file)
55 return motor.MotorClient(CONF.mongo_url)[CONF.mongo_dbname]
59 swagger.docs(base_url=CONF.swagger_base_url)
60 return swagger.Application(
61 url_mappings.mappings,
63 debug=CONF.api_debug_on,
64 auth=CONF.api_authenticate_on
69 parse_config(sys.argv[1:])
70 application = make_app()
71 application.listen(CONF.api_port)
72 tornado.ioloop.IOLoop.current().start()
75 if __name__ == "__main__":