@bottle.route(url_base + '/<tenant_id>/scenarios/<scenario_id>/action', method='POST')
def http_post_scenario_action(tenant_id, scenario_id):
    '''take an action over a scenario'''
    #check valid tenant_id
    if not nfvo.check_tenant(mydb, tenant_id): 
        print 'httpserver.http_post_scenario_action() tenant %s not found' % tenant_id
        bottle.abort(HTTP_Not_Found, 'Tenant %s not found' % tenant_id)
        return
    #parse input data
    http_content,_ = format_in( scenario_action_schema )
    r = af.remove_extra_items(http_content, scenario_action_schema)
    if r is not None: print "http_post_scenario_action: Warning: remove extra items ", r
    if "start" in http_content:
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['start']['instance_name'], \
                    http_content['start'].get('description',http_content['start']['instance_name']),
                    http_content['start'].get('datacenter') )
        if result < 0:
            print "http_post_scenario_action start error %d: %s" % (-result, data)
            bottle.abort(-result, data)
        else:
            return format_out(data)
    elif "deploy" in http_content:   #Equivalent to start
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['deploy']['instance_name'],
                    http_content['deploy'].get('description',http_content['deploy']['instance_name']),
                    http_content['deploy'].get('datacenter') )
        if result < 0:
            print "http_post_scenario_action deploy error %d: %s" % (-result, data)
            bottle.abort(-result, data)
        else:
            return format_out(data)
    elif "reserve" in http_content:   #Reserve resources
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['reserve']['instance_name'],
                    http_content['reserve'].get('description',http_content['reserve']['instance_name']),
                    http_content['reserve'].get('datacenter'),  startvms=False )
        if result < 0:
            print "http_post_scenario_action reserve error %d: %s" % (-result, data)
            bottle.abort(-result, data)
        else:
            return format_out(data)
    elif "verify" in http_content:   #Equivalent to start and then delete
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['verify']['instance_name'],
                    http_content['verify'].get('description',http_content['verify']['instance_name']),
                    http_content['verify'].get('datacenter'), startvms=False )
        if result < 0 or result!=1:
            print "http_post_scenario_action verify error during start %d: %s" % (-result, data)
            bottle.abort(-result, data)
        instance_id = data['uuid']
        result, message = nfvo.delete_instance(mydb, tenant_id,instance_id)
        if result < 0:
            print "http_post_scenario_action verify error during start delete_instance_id %d %s" % (-result, message)
            bottle.abort(-result, message)
        else:
            #print json.dumps(data, indent=4)
            return format_out({"result":"Verify OK"})
dataset/ETHPy150Open nfvlabs/openmano/openmano/httpserver.py/http_post_scenario_action/original