Skip to main content

FABRIC Python Client Library with CLI

Project description

PyPI

FABRIC TESTBED USER LIBRARY AND CLI

Fabric User CLI for experiments

Overview

This package supports User facing APIs as well as CLI.

  • Tokens: Token management
  • Slices: Slice management
  • Slivers: Sliver management
  • Resources: Resource management

CLI Commands

Command SubCommand Action Input Output
tokens issue Issue token with projectId and scope projectId Project Id, scope Scope Points user to Credential Manager to generate the tokens
token refresh Refresh token projectId Project Id, scope Scope, refreshtoken Refresh Token Returns new identity and refresh tokens
token revoke Revoke token refreshtoken Refresh Token Success or Failure status
slices query Query user slice(s) idtoken Identity Token, refreshtoken Refresh Token, projectId Project Id, scope Scope, sliceid Slice Id List of Slices or Graph ML representing slice identified by Slice Id
slices create Create user slice idtoken Identity Token, refreshtoken Refresh Token, projectId Project Id, scope Scope, slicename Slice Name, slicegraph Slice graph List of Slivers created for the Slice
slices delete Delete user slice idtoken Identity Token, refreshtoken Refresh Token, projectId Project Id, scope Scope, sliceid Slice Id Success or Failure Status
slivers query Query user sliver(s) idtoken Identity Token, refreshtoken Refresh Token, projectId Project Id, scope Scope, sliceid Slice Id, sliverid Sliver Id List of Slivers for the slice identified by Slice Id or Sliver identified by Sliver Id
resources query Query resources idtoken Identity Token, refreshtoken Refresh Token, projectId Project Id, scope Scope Graph ML representing the available resources

API

SliceManager class implements the API supporting the operations listed above. Check example in Usage below.

Requirements

Python 3.9+

Pre-requisites

Ensure that following are installed

  • virtualenv
  • virtualenvwrapper

NOTE: Any of the virtual environment tools ([venv], [virtualenv], or [virtualenvwrapper]) should work.

Installation

Multiple installation options possible. For CF development the recommended method is to install from GitHub MASTER branch:

$ mkvirtualenv fabrictestbed
$ workon fabrictestbed
$ pip install git+https://github.com/fabric-testbed/fabric-cli.git

For inclusion in tools, etc, use PyPi

$ mkvirtualenv fabrictestbed
$ workon fabrictestbed
$ pip install fabrictestbed

Usage (API)

User API supports token and orchestrator commands. Please refer to Jupyter Notebooks here for examples.

Usage (CLI)

Configuration

User CLI expects the user to set following environment variables:

export FABRIC_ORCHESTRATOR_HOST=orchestrator.fabric-testbed.net
export FABRIC_CREDMGR_HOST=cm.fabric-testbed.net
export FABRIC_TOKEN_LOCATION=<location of the token file downloaded from the Portal>
export FABRIC_PROJECT_ID=<Project Id of the project for which resources are being provisioned>

Alternatively, user can pass these as parameters to the commands.

To enable CLI auto-completion, add following line to your ~/.bashrc

eval "$(_FABRIC_CLI_COMPLETE=source_bash fabric-cli)"

Open a new shell to enable completion. Or run the eval command directly in your current shell to enable it temporarily.

User CLI supports token and orchestrator commands:

(usercli) $ fabric-cli
Usage: fabric-cli [OPTIONS] COMMAND [ARGS]...

Options:
  -v, --verbose
  --help         Show this message and exit.

Commands:
  resources  Resource management (set $FABRIC_ORCHESTRATOR_HOST to the...
  slices     Slice management (set $FABRIC_ORCHESTRATOR_HOST to the...
  slivers    Sliver management (set $FABRIC_ORCHESTRATOR_HOST to the...
  tokens     Token management (set $FABRIC_CREDMGR_HOST to the Credential...

Token Management Commands

List of the token commands supported can be found below:

(usercli) $ fabric-cli tokens
Usage: fabric-cli tokens [OPTIONS] COMMAND [ARGS]...

  Token management (set $FABRIC_CREDMGR_HOST to the Credential Manager
  Server)

Options:
  --help  Show this message and exit.

Commands:
  issue    Issue token with projectId and scope
  refresh  Refresh token
  revoke   Revoke token

Resource Management Commands

List of the resource commands supported can be found below:

$ fabric-cli resources
Usage: fabric-cli resources [OPTIONS] COMMAND [ARGS]...

  Query Resources (set $FABRIC_ORCHESTRATOR_HOST to the Control Framework
  Orchestrator)

Options:
  --help  Show this message and exit.

Commands:
  query  issue token with projectId and scope

Slice Management Commands

(usercli) $ fabric-cli slices
Usage: fabric-cli slices [OPTIONS] COMMAND [ARGS]...

  Slice management (set $FABRIC_ORCHESTRATOR_HOST to the Orchestrator)

Options:
  --help  Show this message and exit.

Commands:
  create  Create user slice
  delete  Delete user slice
  query   Query user slice(s)

Sliver Management Commands

(usercli) $ fabric-cli slivers
Usage: fabric-cli slivers [OPTIONS] COMMAND [ARGS]...

  Sliver management (set $FABRIC_ORCHESTRATOR_HOST to the Orchestrator)

Options:
  --help  Show this message and exit.

Commands:
  query  Query user slice sliver(s)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabrictestbed-1.4.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabrictestbed-1.4.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file fabrictestbed-1.4.2.tar.gz.

File metadata

  • Download URL: fabrictestbed-1.4.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.54.1 importlib-metadata/3.7.3 keyring/21.5.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for fabrictestbed-1.4.2.tar.gz
Algorithm Hash digest
SHA256 e2c1f532d052f181093f9042136f693263c9e717efe8503e668b4f7ed4231da2
MD5 55191bed7baaa7af79ba50e30cf55c98
BLAKE2b-256 c3a26d63a075f3073486f126550dc1abb88c6403da700bb0974f700f0f68e430

See more details on using hashes here.

File details

Details for the file fabrictestbed-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: fabrictestbed-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.54.1 importlib-metadata/3.7.3 keyring/21.5.0 rfc3986/1.4.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for fabrictestbed-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac853e06f524aef90cdcd2b211ee780c5abe47264e4747b2a0a55e77971a5140
MD5 04a278ee9739661ae055dfbcadfa2dd6
BLAKE2b-256 ea5a20a8ecf641da0c4c01fdf8aad06eea8edb9c5e81d2207475fb471b16764b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page