[![PyPI](https://img.shields.io/pypi/v/fabrictestbed?style=plastic)](https://pypi.org/project/fabrictestbed/)
# 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+
## 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
```
### Pre-requisites for the install example above
Ensure that following are installed
- `virtualenv`
- `virtualenvwrapper`
NOTE: Any of the virtual environment tools (`venv`, `virtualenv`, or `virtualenvwrapper`) should work.
## Usage (API)
User API supports token and orchestrator commands. Please refer to Jupyter Notebooks [here](https://github.com/fabric-testbed/jupyter-examples/tree/master/fabric_examples/beta_functionality) 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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "fabrictestbed",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Swagger, FABRIC Python Client Library with CLI",
"author": null,
"author_email": "Komal Thareja <kthare10@renci.org>",
"download_url": "https://files.pythonhosted.org/packages/ad/24/2243fa4446b5755dd9ea1428445e3cc26bf3ed7a2ab30a65b6c4b33bab14/fabrictestbed-1.8.0.tar.gz",
"platform": null,
"description": "[![PyPI](https://img.shields.io/pypi/v/fabrictestbed?style=plastic)](https://pypi.org/project/fabrictestbed/)\n\n\n# FABRIC TESTBED USER LIBRARY AND CLI\n\nFabric User CLI for experiments\n\n## Overview\nThis package supports User facing APIs as well as CLI.\n- Tokens: Token management\n- Slices: Slice management\n- Slivers: Sliver management\n- Resources: Resource management\n\n### CLI Commands\nCommand | SubCommand | Action | Input | Output\n:--------|:----:|:----:|:---:|:---:\n`tokens` | `issue`| Issue token with projectId and scope | `projectId` Project Id, `scope` Scope | Points user to Credential Manager to generate the tokens\n`token` | `refresh`| Refresh token | `projectId` Project Id, `scope` Scope, `refreshtoken` Refresh Token | Returns new identity and refresh tokens\n`token` | `revoke` | Revoke token | `refreshtoken` Refresh Token | Success or Failure status\n`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\n`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\n`slices` | `delete` | Delete user slice | `idtoken` Identity Token, `refreshtoken` Refresh Token, `projectId` Project Id, `scope` Scope, `sliceid` Slice Id | Success or Failure Status\n`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\n`resources` | `query` | Query resources | `idtoken` Identity Token, `refreshtoken` Refresh Token, `projectId` Project Id, `scope` Scope | Graph ML representing the available resources\n\n### API\n`SliceManager` class implements the API supporting the operations listed above. Check example in Usage below.\n\n## Requirements\nPython 3.9+\n\n## Installation\nMultiple installation options possible. For CF development the recommended method is to install from GitHub MASTER branch:\n```\n$ mkvirtualenv fabrictestbed\n$ workon fabrictestbed\n$ pip install git+https://github.com/fabric-testbed/fabric-cli.git\n```\nFor inclusion in tools, etc, use PyPi\n```\n$ mkvirtualenv fabrictestbed\n$ workon fabrictestbed\n$ pip install fabrictestbed\n```\n\n### Pre-requisites for the install example above\nEnsure that following are installed\n- `virtualenv`\n- `virtualenvwrapper`\n\nNOTE: Any of the virtual environment tools (`venv`, `virtualenv`, or `virtualenvwrapper`) should work.\n\n## Usage (API)\nUser API supports token and orchestrator commands. Please refer to Jupyter Notebooks [here](https://github.com/fabric-testbed/jupyter-examples/tree/master/fabric_examples/beta_functionality) for examples.\n\n## Usage (CLI)\n### Configuration\nUser CLI expects the user to set following environment variables:\n```\nexport FABRIC_ORCHESTRATOR_HOST=orchestrator.fabric-testbed.net\nexport FABRIC_CREDMGR_HOST=cm.fabric-testbed.net\nexport FABRIC_TOKEN_LOCATION=<location of the token file downloaded from the Portal>\nexport FABRIC_PROJECT_ID=<Project Id of the project for which resources are being provisioned>\n```\n\nAlternatively, user can pass these as parameters to the commands.\n\n#### To enable CLI auto-completion, add following line to your ~/.bashrc\n```\neval \"$(_FABRIC_CLI_COMPLETE=source_bash fabric-cli)\"\n```\nOpen a new shell to enable completion.\nOr run the eval command directly in your current shell to enable it temporarily.\n\nUser CLI supports token and orchestrator commands:\n```\n(usercli) $ fabric-cli\nUsage: fabric-cli [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n -v, --verbose\n --help Show this message and exit.\n\nCommands:\n resources Resource management (set $FABRIC_ORCHESTRATOR_HOST to the...\n slices Slice management (set $FABRIC_ORCHESTRATOR_HOST to the...\n slivers Sliver management (set $FABRIC_ORCHESTRATOR_HOST to the...\n tokens Token management (set $FABRIC_CREDMGR_HOST to the Credential...\n```\n\n### Token Management Commands\nList of the token commands supported can be found below:\n```\n(usercli) $ fabric-cli tokens\nUsage: fabric-cli tokens [OPTIONS] COMMAND [ARGS]...\n\n Token management (set $FABRIC_CREDMGR_HOST to the Credential Manager\n Server)\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n issue Issue token with projectId and scope\n refresh Refresh token\n revoke Revoke token\n```\n\n### Resource Management Commands\nList of the resource commands supported can be found below:\n```\n$ fabric-cli resources\nUsage: fabric-cli resources [OPTIONS] COMMAND [ARGS]...\n\n Query Resources (set $FABRIC_ORCHESTRATOR_HOST to the Control Framework\n Orchestrator)\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n query issue token with projectId and scope\n```\n### Slice Management Commands\n```\n(usercli) $ fabric-cli slices\nUsage: fabric-cli slices [OPTIONS] COMMAND [ARGS]...\n\n Slice management (set $FABRIC_ORCHESTRATOR_HOST to the Orchestrator)\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n create Create user slice\n delete Delete user slice\n query Query user slice(s)\n```\n### Sliver Management Commands\n```\n(usercli) $ fabric-cli slivers\nUsage: fabric-cli slivers [OPTIONS] COMMAND [ARGS]...\n\n Sliver management (set $FABRIC_ORCHESTRATOR_HOST to the Orchestrator)\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n query Query user slice sliver(s)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "FABRIC Python Client Library with CLI",
"version": "1.8.0",
"project_urls": {
"Home": "https://fabric-testbed.net/",
"Sources": "https://github.com/fabric-testbed/fabric-cli"
},
"split_keywords": [
"swagger",
" fabric python client library with cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1f92c913dd397226cfc76c676050906297ce8bc21b0bd5f88a7a264b144be79b",
"md5": "e1b16e99531c867c4157c2a6c92500ec",
"sha256": "43d91a67b1db5cb1de272fff49a197be01c224ad7a6def10018d57b112b695f6"
},
"downloads": -1,
"filename": "fabrictestbed-1.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e1b16e99531c867c4157c2a6c92500ec",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 32388,
"upload_time": "2025-01-07T19:56:39",
"upload_time_iso_8601": "2025-01-07T19:56:39.150528Z",
"url": "https://files.pythonhosted.org/packages/1f/92/c913dd397226cfc76c676050906297ce8bc21b0bd5f88a7a264b144be79b/fabrictestbed-1.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ad242243fa4446b5755dd9ea1428445e3cc26bf3ed7a2ab30a65b6c4b33bab14",
"md5": "e82dffef4d8ddb27287832684a24528e",
"sha256": "54774361588e6e9ef5364fc5776911974184e471b5765cadb657644e033ad7db"
},
"downloads": -1,
"filename": "fabrictestbed-1.8.0.tar.gz",
"has_sig": false,
"md5_digest": "e82dffef4d8ddb27287832684a24528e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 24408,
"upload_time": "2025-01-07T19:56:40",
"upload_time_iso_8601": "2025-01-07T19:56:40.519983Z",
"url": "https://files.pythonhosted.org/packages/ad/24/2243fa4446b5755dd9ea1428445e3cc26bf3ed7a2ab30a65b6c4b33bab14/fabrictestbed-1.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-07 19:56:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fabric-testbed",
"github_project": "fabric-cli",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "fabrictestbed"
}