[![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/76/72/4e218ead56a8d6b9321a613d7b73c456030d7435c0660bcc67139285154d/fabrictestbed-1.6.9.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.6.9",
"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": "28db823ef95f171cde61cdf57a34168f66daf04460391505e04d6032c825fda4",
"md5": "fec818157049997e38c244f8fc00c675",
"sha256": "11d91eb972ae6782e88221dc72a4c0725b65046c948244448d867d6ec08ff66a"
},
"downloads": -1,
"filename": "fabrictestbed-1.6.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fec818157049997e38c244f8fc00c675",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 23137,
"upload_time": "2024-03-05T20:10:16",
"upload_time_iso_8601": "2024-03-05T20:10:16.026604Z",
"url": "https://files.pythonhosted.org/packages/28/db/823ef95f171cde61cdf57a34168f66daf04460391505e04d6032c825fda4/fabrictestbed-1.6.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "76724e218ead56a8d6b9321a613d7b73c456030d7435c0660bcc67139285154d",
"md5": "25722c3be8989e1fd45efe20aa0ee3bb",
"sha256": "872239b2958773a1951aad88429efb8b1f133c94525792e90abdceaf6431bcb3"
},
"downloads": -1,
"filename": "fabrictestbed-1.6.9.tar.gz",
"has_sig": false,
"md5_digest": "25722c3be8989e1fd45efe20aa0ee3bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 19932,
"upload_time": "2024-03-05T20:10:28",
"upload_time_iso_8601": "2024-03-05T20:10:28.419376Z",
"url": "https://files.pythonhosted.org/packages/76/72/4e218ead56a8d6b9321a613d7b73c456030d7435c0660bcc67139285154d/fabrictestbed-1.6.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-05 20:10:28",
"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"
}