예제 #1
0
def http_post_deploy(tenant_id):
    '''post topology deploy.'''
    print "http_post_deploy by tenant " + tenant_id

    http_content, used_schema = format_in(nsd_schema_v01, ("version", ),
                                          {"v0.2": nsd_schema_v02})
    #r = af.remove_extra_items(http_content, used_schema)
    #if r is not None: print "http_post_deploy: Warning: remove extra items ", r
    print "http_post_deploy input: ", http_content

    result, scenario_uuid = nfvo.new_scenario(mydb, tenant_id, http_content)
    if result < 0:
        print "http_post_deploy error creating the scenario %d %s" % (
            -result, scenario_uuid)
        bottle.abort(-result, scenario_uuid)

    result, data = nfvo.start_scenario(mydb, tenant_id, scenario_uuid,
                                       http_content['name'],
                                       http_content['name'])
    if result < 0:
        print "http_post_deploy error launching the scenario %d %s" % (-result,
                                                                       data)
        bottle.abort(-result, data)
    else:
        print json.dumps(data, indent=4)
        return format_out(data)
예제 #2
0
def http_post_scenarios(tenant_id):
    '''add a scenario into the catalogue. Creates the scenario and its internal structure in the OPENMANO DB'''
    print "http_post_scenarios by tenant " + tenant_id 
    http_content,_ = format_in( scenario_new_schema )
    #r = af.remove_extra_items(http_content, scenario_new_schema)
    #if r is not None: print "http_post_deploy: Warning: remove extra items ", r
    print "http_post_scenarios input: ",  http_content
    
    result, data = nfvo.new_scenario(mydb, tenant_id, http_content)
    if result < 0:
        print "http_post_scenarios error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        #print json.dumps(data, indent=4)
        #return format_out(data)
        return http_get_scenario_id(tenant_id,data)
예제 #3
0
def http_post_scenarios(tenant_id):
    '''add a scenario into the catalogue. Creates the scenario and its internal structure in the OPENMANO DB'''
    print "http_post_scenarios by tenant " + tenant_id 
    http_content = format_in( scenario_new_schema )
    #r = af.remove_extra_items(http_content, scenario_new_schema)
    #if r is not None: print "http_post_deploy: Warning: remove extra items ", r
    print "http_post_scenarios input: ",  http_content
    
    result, data = nfvo.new_scenario(mydb, tenant_id, http_content)
    if result < 0:
        print "http_post_scenarios error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        #print json.dumps(data, indent=4)
        #return format_out(data)
        return http_get_scenario_id(tenant_id,data)
예제 #4
0
def http_post_scenarios(tenant_id):
    '''add a scenario into the catalogue. Creates the scenario and its internal structure in the OPENMANO DB'''
    print "http_post_scenarios by tenant " + tenant_id 
    http_content, used_schema = format_in( nsd_schema_v01, ("schema_version",), {"0.2": nsd_schema_v02})
    #r = af.remove_extra_items(http_content, used_schema)
    #if r is not None: print "http_post_scenarios: Warning: remove extra items ", r
    print "http_post_scenarios input: ",  http_content
    if http_content.get("schema_version") == None:
        result, data = nfvo.new_scenario(mydb, tenant_id, http_content)
    else:
        result, data = nfvo.new_scenario_v02(mydb, tenant_id, http_content)
    if result < 0:
        print "http_post_scenarios error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        #print json.dumps(data, indent=4)
        #return format_out(data)
        return http_get_scenario_id(tenant_id,data)
예제 #5
0
def http_post_scenarios(tenant_id):
    '''add a scenario into the catalogue. Creates the scenario and its internal structure in the OPENMANO DB'''
    print "http_post_scenarios by tenant " + tenant_id 
    http_content, used_schema = format_in( nsd_schema_v01, ("schema_version",), {2: nsd_schema_v02})
    #r = utils.remove_extra_items(http_content, used_schema)
    #if r is not None: print "http_post_scenarios: Warning: remove extra items ", r
    print "http_post_scenarios input: ",  http_content
    if http_content.get("schema_version") == None:
        result, data = nfvo.new_scenario(mydb, tenant_id, http_content)
    else:
        result, data = nfvo.new_scenario_v02(mydb, tenant_id, http_content)
    if result < 0:
        print "http_post_scenarios error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        #print json.dumps(data, indent=4)
        #return format_out(data)
        return http_get_scenario_id(tenant_id,data)
예제 #6
0
def http_post_deploy(tenant_id):
    '''post topology deploy.'''
    print "http_post_deploy by tenant " + tenant_id 
    http_content,_ = format_in( scenario_new_schema )
    #r = af.remove_extra_items(http_content, scenario_new_schema)
    #if r is not None: print "http_post_deploy: Warning: remove extra items ", r
    print "http_post_deploy input: ",  http_content
    
    result, scenario_uuid = nfvo.new_scenario(mydb, tenant_id, http_content)
    if result < 0:
        print "http_post_deploy error creating the scenario %d %s" % (-result, scenario_uuid)
        bottle.abort(-result, scenario_uuid)

    result, data = nfvo.start_scenario(mydb, tenant_id, scenario_uuid, http_content['name'], http_content['name'])
    if result < 0:
        print "http_post_deploy error launching the scenario %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        print json.dumps(data, indent=4)
        return format_out(data)