def http_post_nss(tenant_id): '''add a ns into the catalogue. Creates the ns and its internal structure in the playnetmano DB''' print "http_post_nss 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_nss: Warning: remove extra items ", r print "http_post_nss input: ", http_content result, data = nfvo.new_ns(mydb, tenant_id, http_content) if result < 0: print "http_post_nss error %d %s" % (-result, data) bottle.abort(-result, data) else: #print json.dumps(data, indent=4) #return format_out(data) return http_get_ns_id(tenant_id,data)
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, ns_uuid = nfvo.new_ns(mydb, tenant_id, http_content) if result < 0: print "http_post_deploy error creating the ns %d %s" % (-result, ns_uuid) bottle.abort(-result, ns_uuid) result, data = nfvo.start_ns(mydb, tenant_id, ns_uuid, http_content['name'], http_content['name']) if result < 0: print "http_post_deploy error launching the ns %d %s" % (-result, data) bottle.abort(-result, data) else: print json.dumps(data, indent=4) return format_out(data)