#NEWLINE# def create_scenario( self , descriptor = None , descriptor_format = None , **kwargs ) : #NEWLINE# #INDENT# "Creates a scenario\n        Params: must supply a descriptor\n            descriptor: with format {'scenario':{new_scenario_info}}\n                must be a dictionary or a json/yaml text.\n            Other parameters can be:\n                name: the scenario name. Overwrite descriptor name if any\n                description: scenario descriptor.. Overwrite descriptor description if any\n                public: boolean, available to other tenants\n                tenant_id. Propietary tenant\n        Return: Raises an exception on error\n                Obtain a dictionary with format {'scenario':{new_scenario_info}}\n        " #NEWLINE# if isinstance ( descriptor , str ) : #NEWLINE# #INDENT# descriptor = self . parse ( descriptor , param ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if descriptor : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise OpenmanoBadParamsException ( 'Missing descriptor' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( 'scenario' not in descriptor ) or ( len ( descriptor ) > 2 ) ) : #NEWLINE# #INDENT# raise OpenmanoBadParamsException ( "Descriptor must contain only one 'scenario' field, and an optional version" ) #NEWLINE# #UNINDENT# for param in kwargs : #NEWLINE# #INDENT# descriptor [ 'scenario' ] [ param ] = kwargs [ param ] #NEWLINE# #UNINDENT# return self . _create_item ( 'scenarios' , descriptor )