aboutsummaryrefslogtreecommitdiffstats
path: root/legacy
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-02-21 01:28:51 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-21 01:28:51 +0000
commit829909bb55ac94422e4b20d6e9ddc4b20896f136 (patch)
treeba2894839adf3f8331eb6169e9e06105a6964b80 /legacy
parent59d85d2ae17d7ce6aabf8500c7cf9933df4e9ad3 (diff)
parentf8949b5139f5829b60f361896d5be5f6b7801554 (diff)
Merge "Move api server to legacy code."
Diffstat (limited to 'legacy')
-rw-r--r--legacy/api/cmd/__init__.py0
-rw-r--r--legacy/api/cmd/server.py31
-rw-r--r--legacy/api/router/mapper.py2
3 files changed, 32 insertions, 1 deletions
diff --git a/legacy/api/cmd/__init__.py b/legacy/api/cmd/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/legacy/api/cmd/__init__.py
diff --git a/legacy/api/cmd/server.py b/legacy/api/cmd/server.py
new file mode 100644
index 00000000..eea45ad3
--- /dev/null
+++ b/legacy/api/cmd/server.py
@@ -0,0 +1,31 @@
+##############################################################################
+# Copyright (c) 2016 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from flask import Flask
+from flask_restful import Api
+from flask_restful_swagger import swagger
+
+import legacy.api.router.mapper as mapper
+
+app = Flask(__name__)
+api = swagger.docs(Api(app), apiVersion='0.1', description='QTIP API specs')
+
+
+def add_routers():
+ for (handler, url) in mapper.mappers:
+ api.add_resource(handler, url)
+
+
+def main():
+ add_routers()
+ app.run(host='0.0.0.0')
+
+
+if __name__ == "__main__":
+ main()
diff --git a/legacy/api/router/mapper.py b/legacy/api/router/mapper.py
index 8839f3f5..cd21fbe1 100644
--- a/legacy/api/router/mapper.py
+++ b/legacy/api/router/mapper.py
@@ -1,4 +1,4 @@
-from legacy.api.handler import Job, JobList
+from legacy.api.handler.job_handler import Job, JobList
mappers = [