summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-12-26 17:34:05 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-01-09 10:18:02 +0800
commit3064b88ccd222c18352ac8be042d98904ca3828c (patch)
tree603df298e5f03b449ad3adcd1bf79e1cc0e7a753 /utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
parent2210de45982fa7c33c1b96b691878b678ca2ecab (diff)
add scenario models and framework
JIRA: RELENG-163 Change-Id: I36a51022c087621d9539dc40f7d9acee4db95dfb Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py')
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
new file mode 100644
index 000000000..75754d8b9
--- /dev/null
+++ b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
@@ -0,0 +1,61 @@
+from opnfv_testapi.resources.handlers import GenericApiHandler
+from opnfv_testapi.resources.scenario_models import Scenario
+from opnfv_testapi.tornado_swagger import swagger
+
+
+class GenericScenarioHandler(GenericApiHandler):
+ def __init__(self, application, request, **kwargs):
+ super(GenericScenarioHandler, self).__init__(application,
+ request,
+ **kwargs)
+ self.table = self.db_scenarios
+ self.table_cls = Scenario
+
+
+class ScenariosCLHandler(GenericScenarioHandler):
+ @swagger.operation(nickname="List scenarios by queries")
+ def get(self):
+ """
+ @description: Retrieve scenario(s).
+ @notes: Retrieve scenario(s)
+ @return 200: all scenarios consist with query,
+ empty list if no scenario is found
+ @rtype: L{Scenarios}
+ """
+ self._list()
+
+ @swagger.operation(nickname="Create a new scenario")
+ def post(self):
+ """
+ @description: create a new scenario by name
+ @param body: scenario to be created
+ @type body: L{string}
+ @rtype: L{CreateResponse}
+ """
+ pass
+
+
+class ScenarioGURHandler(GenericScenarioHandler):
+ @swagger.operation(nickname='Get the scenario by name')
+ def get(self, name):
+ """
+ @description: get a single scenario by name
+ @rtype: L{Scenario}
+ @return 200: scenario exist
+ @raise 404: scenario not exist
+ """
+ pass
+
+ @swagger.operation(nickname="Update the scenario by name")
+ def put(self, name):
+ """
+ @description: update a single scenario by name
+ @param body: fields to be updated
+ @type body: L{string}
+ @in body: body
+ @rtype: L{Scenario}
+ @return 200: update success
+ @raise 404: scenario not exist
+ @raise 403: nothing to update
+ """
+ pass