summaryrefslogtreecommitdiffstats
path: root/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
diff options
context:
space:
mode:
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