Package: fabric-orchestrator-client
Fabric Orchestrator swagger-clientThis is Fabric Orchestrator APIThis Python package is automatically generated by theSwagger Codegenproject:API version: 1.0.1Package version: 1.0.0Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegenGenerating the Client CodeDue to a BUG in swagger-code-gen, Please follow the steps belowThat said, there's a bug in the Python generator of Swagger Codegen 3.x, it doesn't generate the code for Bearer authentication in OpenAPI 3.0 definitions.
As a workaround, edit your OpenAPI YAML file and replace this partsecuritySchemes:
    bearerAuth:     
      type: http
      scheme: bearer
      bearerFormat: JWTtosecuritySchemes:
    sso_auth:
      type: apiKey
      in: header
      name: AuthorizationThen generate a new Python client from the modified API definition.Reference for more detailshereRequirements.Python 3.9+Installation & Usagepip installIf the python package is hosted on Github, you can install directly from Githubpipinstallgit+https://github.com/fabric-testbed/OrchestratorClient.git(you may need to runpipwith root permission:sudo pip install git+https://github.com/fabric-testbed/OrchestratorClient.git)Then import the package:importfabric_cf.orchestrator.swagger_clientSetuptoolsInstall viaSetuptools.pythonsetup.pyinstall--user(orsudo python setup.py installto install the package for all users)Then import the package:importfabric_cf.orchestrator.swagger_clientGetting StartedPlease follow theinstallation procedureand then run the following:from__future__importprint_functionimporttimefromfabric_cf.orchestrator.swagger_client.api.version_apiimportVersionApifromfabric_cf.orchestrator.swagger_clientimportConfiguration,ApiClientfromfabric_cf.orchestrator.swagger_client.restimportApiExceptionfrompprintimportpprint# Configure API key authorization: bearerAuthconfiguration=Configuration()configuration.api_key['Authorization']='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Authorization'] = 'Bearer'# create_slices an instance of the API classapi_instance=VersionApi(ApiClient(configuration))try:# versionapi_response=api_instance.version_get()pprint(api_response)exceptApiExceptionase:print("Exception when calling VersionApi->version_get:%s\n"%e)Documentation for API EndpointsAll URIs are relative tohttp://127.0.0.1:8700/ClassMethodHTTP requestDescriptionPoasApipoas_create_sliver_id_postPOST/poas/create/{sliver_id}Perform an operational action on a sliver.PoasApipoas_getGET/poas/Request get the status of the POAs.PoasApipoas_poa_id_getGET/poas/{poa_id}Perform an operational action on a sliver.ResourcesApiportalresources_getGET/portalresourcesRetrieve a listing and description of available resources for portalResourcesApiresources_getGET/resourcesRetrieve a listing and description of available resources. By default, a cached available resource information is returned. User can force to request the current available resources.SlicesApislices_create_postPOST/slices/createCreate sliceSlicesApislices_delete_deleteDELETE/slices/deleteDelete all slices for a User within a project.SlicesApislices_delete_slice_id_deleteDELETE/slices/delete/{slice_id}Delete slice.SlicesApislices_getGET/slicesRetrieve a listing of user slicesSlicesApislices_modify_slice_id_accept_postPOST/slices/modify/{slice_id}/acceptAccept the last modify an existing sliceSlicesApislices_modify_slice_id_putPUT/slices/modify/{slice_id}Modify an existing sliceSlicesApislices_renew_slice_id_postPOST/slices/renew/{slice_id}Renew sliceSlicesApislices_slice_id_getGET/slices/{slice_id}slice propertiesSliversApislivers_getGET/sliversRetrieve a listing of user sliversSliversApislivers_sliver_id_getGET/slivers/{sliver_id}slivers propertiesVersionApiversion_getGET/versionVersionDocumentation For ModelsPoaPoaDataPoaPostPoaPostDataPoaPostDataVcpuCpuMapResourceResourcesSliceSliceDetailsSlicesSlicesPostSliverSliversStatus200OkNoContentStatus200OkNoContentDataStatus200OkPaginatedStatus200OkSingleStatus400BadRequestStatus400BadRequestErrorsStatus401UnauthorizedStatus401UnauthorizedErrorsStatus403ForbiddenStatus403ForbiddenErrorsStatus404NotFoundStatus404NotFoundErrorsStatus500InternalServerErrorStatus500InternalServerErrorErrorsVersionVersionDataDocumentation For AuthorizationbearerAuthType: API keyAPI key parameter name: AuthorizationLocation: HTTP headerDocumentation For Orchestrator ProxyUsers are recommended to use Orchestrator Proxy class for any orchestrator operations. Examples are shown below.Get Resourcesorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
resources = proxy.resources(token=token)Create Sliceimport fim.user as fu
 t = fu.ExperimentTopology()
 n1 = t.add_node(name='n1', site='RENC')
 cap = fu.Capacities()
 cap.set_fields(core=4, ram=64, disk=500)
 n1.set_properties(capacities=cap, image_type='qcow2', image_ref='default_centos_8')
 n1.add_component(ctype=fu.ComponentType.SmartNIC, model='ConnectX-6', name='nic1')

 n2 = t.add_node(name='n2', site='RENC')
 n2.set_properties(capacities=cap, image_type='qcow2', image_ref='default_centos_8')
 n2.add_component(ctype=fu.ComponentType.GPU, model='Tesla T4', name='nic2')

 slice_graph = t.serialize()
 sss_key = "<user public key>"
 orchestrator_host = "dev-3.fabric-testbed.net"
 proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
 status, reservation_list = proxy.create(token=token, slice_name=name, slice_graph=slice_graph, ssh_key=ssh_key)Get Slicesorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, slice_list = proxy.slices(token=token)Get Sliceorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, slice_topology = proxy.get_slice(token=token, slice_id=slice_id)Get Sliversorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, reservation_list = proxy.slivers(token=token, slice_id=slice_id)Get Sliverorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, reservation = proxy.slivers(token=token, slice_id=slice_id, sliver_id=sliver_id)Delete Slice by slice_idorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, result = proxy.delete(token=token, slice_id=slice_id)Delete Slices by emailorchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, result = proxy.delete(token=token, email=email)Renew Slicenow = datetime.now(timezone.utc)
new_time = now + timedelta(days=2)
orchestrator_host = "dev-3.fabric-testbed.net"
proxy = OrchestratorProxy(orchestrator_host=orchestrator_host)
status, reservation = proxy.renew_slice(token=token, slice_id=slice_id,
                                        new_lease_end_time=new_time.strftime('%Y-%m-%d %H:%M:%S %z'))Authorkthare10@unc.edu