1 from opnfv_testapi.resources.handlers import GenericApiHandler
2 from opnfv_testapi.resources.scenario_models import Scenario
3 from opnfv_testapi.tornado_swagger import swagger
6 class GenericScenarioHandler(GenericApiHandler):
7 def __init__(self, application, request, **kwargs):
8 super(GenericScenarioHandler, self).__init__(application,
11 self.table = self.db_scenarios
12 self.table_cls = Scenario
15 class ScenariosCLHandler(GenericScenarioHandler):
16 @swagger.operation(nickname="List scenarios by queries")
19 @description: Retrieve scenario(s).
20 @notes: Retrieve scenario(s)
21 @return 200: all scenarios consist with query,
22 empty list if no scenario is found
27 @swagger.operation(nickname="Create a new scenario")
30 @description: create a new scenario by name
31 @param body: scenario to be created
33 @rtype: L{CreateResponse}
38 class ScenarioGURHandler(GenericScenarioHandler):
39 @swagger.operation(nickname='Get the scenario by name')
42 @description: get a single scenario by name
44 @return 200: scenario exist
45 @raise 404: scenario not exist
49 @swagger.operation(nickname="Update the scenario by name")
52 @description: update a single scenario by name
53 @param body: fields to be updated
57 @return 200: update success
58 @raise 404: scenario not exist
59 @raise 403: nothing to update