[![Requirements Status](https://requires.io/github/fabric-testbed/ManagementCli/requirements.svg?branch=main)](https://requires.io/github/fabric-testbed/ManagementCli/requirements/?branch=main)
[![PyPI](https://img.shields.io/pypi/v/fabric-mgmt-cli?style=plastic)](https://pypi.org/project/fabric-mgmt-cli/)
# ManagementCli
Fabric Control Framework Management CLI for administrative operations over Kafka
## Overview
Management CLI talks to various CF components over Kafka to query and perform various administrative operations.
Below is the list of the operations supported so far
Command | SubCommand | Action | Input | Output
:--------|:----:|:----:|:---:|:---:
`delegations` | `claim`| Claim delegation(s) from AM to Broker | `broker` Broker, `am` Aggregate Manager, `did` [Delegation Id] | Delegation Id of delegation claimed
`delegations` | `reclaim`| Reclaim delegation(s) from Broker to AM | `broker` Broker, `am` Aggregate Manager, `did` [Delegation Id] | Delegation Id of delegation reclaimed
`delegations` | `query`| Get delegation(s) from an actor | `actor` Actor, `did` [Delegation Id] | Delegations for an actor or Delegation identified by Delegation Id
`slices` | `close` | Closes slice for an actor | `actor` Actor, `sliceid` [Slice Id] | Success or Failure status
`slices` | `remove` | Removes slice for an actor | `actor` Actor, `sliceid` [Slice Id] | Success or Failure status
`slices` | `query`| Get slice(s) from an actor | `actor` Actor, `sliceid` [Slice Id] | Slices for an actor or Slice identified by Slice Id
`slivers` | `remove` | Closes sliver for an actor | `actor` Actor, `sliverid` [Sliver Id] | Success or Failure status
`slivers` | `close` | Removes sliver for an actor | `actor` Actor, `sliverid` [Sliver Id] | Success or Failure status
`slivers` | `query`| Get sliver(s) from an actor | `actor` Actor, `sliverid` [Sliver Id] | Reservations for an actor or Sliver identified by Sliver Id
## Requirements
Python 3.7+
## Pre-requisites
Ensure that following are installed
- `virtualenv`
- `virtualenvwrapper`
## Installation
Multiple installation options possible. For CF development the recommended method is to install from GitHub MASTER branch:
```
$ mkvirtualenv mgmtcli
$ workon mgmtcli
$ pip install git+https://github.com/fabric-testbed/ManagementCli.git
```
For inclusion in tools, etc, use PyPi
```
$ mkvirtualenv mgmtcli
$ workon mgmtcli
$ pip install fabric-mgmt-cli
```
## Configuration
Management CLI expects the user to set `FABRIC_MGMT_CLI_CONFIG_PATH` environment variable from where `config.yml` to be picked.
If the environment variable is not set, it will try to look for `config.yml` in users home directory.
In addition, User is expected to pass either Fabric Identity Token or Fabric Refresh Token to all the commands.
Alternatively, user is expected to set atleast one of the environment variables `FABRIC_ID_TOKEN` and `FABRIC_REFRESH_TOKEN`.
Create config.yml with default content as shown below.
User is expected to update the following parameters:
- Kafka Cluster Parameters
- CF Peers with Kafka topics
- Log File Location
```
runtime:
- kafka-topic: managecli-topic
- kafka-server: broker1:9092
- kafka-schema-registry-url: http://schemaregistry:8081
- kafka-key-schema: /etc/fabric/message_bus/schema/key.avsc
- kafka-value-schema: /etc/fabric/message_bus/schema/message.avsc
- kafka-ssl-ca-location: /etc/fabric/message_bus/ssl/cacert.pem
- kafka-ssl-certificate-location: /etc/fabric/message_bus/ssl/client.pem
- kafka-ssl-key-location: /etc/fabric/message_bus/ssl/client.key
- kafka-ssl-key-password: fabric
- kafka-security-protocol: SSL
- kafka-group-id: fabric-cf
- kafka-sasl-mechanism:
- kafka-sasl-producer-username:
- kafka-sasl-producer-password:
- kafka-sasl-consumer-username:
- kafka-sasl-consumer-password:
logging:
## The directory in which actor should create log files.
## This directory will be automatically created if it does not exist.
- log-directory: /var/log/managecli
## The filename to be used for actor's log file.
- log-file: manage.log
## The default log level for actor.
- log-level: DEBUG
## actor rotates log files. You may specify how many archived log files to keep here.
- log-retain: 5
## actor rotates log files after they exceed a certain size.
## You may specify the file size that results in a log file being rotated here.
- log-size: 5000000
- logger: managecli
auth:
- name: managecli
- guid: managecli-guid
- credmgr-host: https://dev-2.fabric_mgmt_cli-testbed.net/
peers:
- peer:
- name: orchestrator
- type: orchestrator
- guid: orchestrator-guid
- kafka-topic: orchestrator-topic
- peer:
- name: net1-am
- guid: net1-am-guid
- type: authority
- kafka-topic: net1-am-topic
- peer:
- name: site1-am
- guid: site1-am-guid
- type: authority
- kafka-topic: site1-am-topic
- peer:
- name: broker
- guid: broker-guid
- type: broker
- kafka-topic: broker-topic
```
## Usage
Management CLI supports show and manage commands:
```
$ fabric-mgmt-cli
Usage: fabric-mgmt-cli [OPTIONS] COMMAND [ARGS]...
Options:
-v, --verbose
--help Show this message and exit.
Commands:
delegations Delegation management
maintenance Maintenance Operations
net Dataplane network management
slices Slice management
slivers Sliver management
```
### Delegation Commands
List of the delegation commands supported can be found below:
```
$ fabric-mgmt-cli delegations
Usage: fabric-mgmt-cli delegations [OPTIONS] COMMAND [ARGS]...
Delegation management
Options:
--help Show this message and exit.
Commands:
claim Claim delegation(s) from AM to Broker
close Closes delegation for an actor
query Get delegation(s) from an actor
reclaim Reclaim delegation(s) from Broker to AM
remove Removes sliver for an actor
```
### Slice Commands
List of the Slice commands supported can be found below:
```
$ fabric-mgmt-cli slices
Usage: fabric-mgmt-cli slices [OPTIONS] COMMAND [ARGS]...
Slice management
Options:
--help Show this message and exit.
Commands:
close Closes slice for an actor
query Get slice(s) from an actor
remove Removes slice for an actor
removealldead Removes slice for an actor
```
### Sliver Commands
List of the Sliver commands supported can be found below:
```
$ fabric-mgmt-cli slivers
Usage: fabric-mgmt-cli slivers [OPTIONS] COMMAND [ARGS]...
Sliver management
Options:
--help Show this message and exit.
Commands:
close Closes sliver for an actor
query Get sliver(s) from an actor
remove Removes sliver for an actor
```
### Maintenance Commands
List of the Maintenance commands supported can be found below:
```
$ fabric-mgmt-cli maintenance
Usage: fabric-mgmt-cli maintenance [OPTIONS] COMMAND [ARGS]...
Maintenance Operations
Options:
--help Show this message and exit.
Commands:
site Change Maintenance modes (PreMaint, Maint, Active) for a
specific...
testbed Change Maintenance modes (PreMaint, Maint, Active) for the...
```
#### Examples
NOTE: Specific projects/users can still be allowed to provision by passing:
- Comma separated list of email addresses of the allowed users in the argument `--users`
- Command separated list of the allowed project ids in the argument `--projects`
##### Change Testbed Maintenance Mode
Move Testbed in Pre-Maintenance Mode.
```
$ fabric-mgmt-cli maintenance testbed --actor orchestrator --mode PreMaint --deadline '2022-12-26T22:29:51.214418+00:00' --end '2022-12-30T22:29:51.214418+00:00'
```
Move Testbed in Maintenance Mode.
```
$ fabric-mgmt-cli maintenance testbed --actor orchestrator --mode Maint
```
Move Testbed in Active Mode
```
$ fabric-mgmt-cli maintenance testbed --actor orchestrator --mode Active
```
##### Change Site Maintenance Mode
Move Site in Pre-Maintenance Mode.
```
$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode PreMaint --deadline '2022-12-26T22:29:51.214418+00:00' --end '2022-12-30T22:29:51.214418+00:00'
```
Move Site in Maintenance Mode.
```
$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Maint
```
Move Site in Active Mode
```
$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Active
```
##### Change Worker Maintenance Mode
Move Worker in Pre-Maintenance Mode.
```
$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode PreMaint --deadline '2022-12-26T22:29:51.214418+00:00' --end '2022-12-30T22:29:51.214418+00:00' --workers renc-w1.fabric-testbed.net
```
Move Worker in Maintenance Mode.
```
$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Maint --workers renc-w1.fabric-testbed.net
```
Move Worker in Active Mode
```
$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Active --workers renc-w1.fabric-testbed.net
```
### Network Management Commands
List of the Network Management commands supported can be found below:
```
$ fabric-mgmt-cli net
Usage: fabric-mgmt-cli net [OPTIONS] COMMAND [ARGS]...
Dataplane network management
Options:
--help Show this message and exit.
Commands:
create Create a new network service
delete Delete an existing network service by name
show Subgroup for network information commands
sync Control NSO device synchronization
```
Raw data
{
"_id": null,
"home_page": null,
"name": "fabric-mgmt-cli",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Swagger,Fabric Management Cli",
"author": null,
"author_email": "Komal Thareja <kthare10@renci.org>",
"download_url": "https://files.pythonhosted.org/packages/54/42/8c65923ab50db5a279f890eff84c06d4a417b3a0aaa671f21cbc89c14498/fabric-mgmt-cli-1.6.0.tar.gz",
"platform": null,
"description": "[![Requirements Status](https://requires.io/github/fabric-testbed/ManagementCli/requirements.svg?branch=main)](https://requires.io/github/fabric-testbed/ManagementCli/requirements/?branch=main)\n\n[![PyPI](https://img.shields.io/pypi/v/fabric-mgmt-cli?style=plastic)](https://pypi.org/project/fabric-mgmt-cli/)\n\n# ManagementCli\nFabric Control Framework Management CLI for administrative operations over Kafka\n\n## Overview\nManagement CLI talks to various CF components over Kafka to query and perform various administrative operations.\nBelow is the list of the operations supported so far\n\nCommand | SubCommand | Action | Input | Output\n:--------|:----:|:----:|:---:|:---:\n`delegations` | `claim`| Claim delegation(s) from AM to Broker | `broker` Broker, `am` Aggregate Manager, `did` [Delegation Id] | Delegation Id of delegation claimed\n`delegations` | `reclaim`| Reclaim delegation(s) from Broker to AM | `broker` Broker, `am` Aggregate Manager, `did` [Delegation Id] | Delegation Id of delegation reclaimed\n`delegations` | `query`| Get delegation(s) from an actor | `actor` Actor, `did` [Delegation Id] | Delegations for an actor or Delegation identified by Delegation Id\n`slices` | `close` | Closes slice for an actor | `actor` Actor, `sliceid` [Slice Id] | Success or Failure status\n`slices` | `remove` | Removes slice for an actor | `actor` Actor, `sliceid` [Slice Id] | Success or Failure status\n`slices` | `query`| Get slice(s) from an actor | `actor` Actor, `sliceid` [Slice Id] | Slices for an actor or Slice identified by Slice Id\n`slivers` | `remove` | Closes sliver for an actor | `actor` Actor, `sliverid` [Sliver Id] | Success or Failure status\n`slivers` | `close` | Removes sliver for an actor | `actor` Actor, `sliverid` [Sliver Id] | Success or Failure status\n`slivers` | `query`| Get sliver(s) from an actor | `actor` Actor, `sliverid` [Sliver Id] | Reservations for an actor or Sliver identified by Sliver Id\n\n## Requirements\nPython 3.7+\n\n## Pre-requisites\nEnsure that following are installed\n- `virtualenv`\n- `virtualenvwrapper`\n\n## Installation\nMultiple installation options possible. For CF development the recommended method is to install from GitHub MASTER branch:\n```\n$ mkvirtualenv mgmtcli\n$ workon mgmtcli\n$ pip install git+https://github.com/fabric-testbed/ManagementCli.git\n```\nFor inclusion in tools, etc, use PyPi\n```\n$ mkvirtualenv mgmtcli\n$ workon mgmtcli\n$ pip install fabric-mgmt-cli\n```\n## Configuration\nManagement CLI expects the user to set `FABRIC_MGMT_CLI_CONFIG_PATH` environment variable from where `config.yml` to be picked. \nIf the environment variable is not set, it will try to look for `config.yml` in users home directory.\n\nIn addition, User is expected to pass either Fabric Identity Token or Fabric Refresh Token to all the commands. \nAlternatively, user is expected to set atleast one of the environment variables `FABRIC_ID_TOKEN` and `FABRIC_REFRESH_TOKEN`.\n\nCreate config.yml with default content as shown below. \n\nUser is expected to update the following parameters:\n - Kafka Cluster Parameters\n - CF Peers with Kafka topics \n - Log File Location\n\n```\nruntime:\n - kafka-topic: managecli-topic\n - kafka-server: broker1:9092\n - kafka-schema-registry-url: http://schemaregistry:8081\n - kafka-key-schema: /etc/fabric/message_bus/schema/key.avsc\n - kafka-value-schema: /etc/fabric/message_bus/schema/message.avsc\n - kafka-ssl-ca-location: /etc/fabric/message_bus/ssl/cacert.pem\n - kafka-ssl-certificate-location: /etc/fabric/message_bus/ssl/client.pem\n - kafka-ssl-key-location: /etc/fabric/message_bus/ssl/client.key\n - kafka-ssl-key-password: fabric\n - kafka-security-protocol: SSL\n - kafka-group-id: fabric-cf\n - kafka-sasl-mechanism:\n - kafka-sasl-producer-username:\n - kafka-sasl-producer-password:\n - kafka-sasl-consumer-username:\n - kafka-sasl-consumer-password:\n\nlogging:\n ## The directory in which actor should create log files.\n ## This directory will be automatically created if it does not exist.\n - log-directory: /var/log/managecli\n\n ## The filename to be used for actor's log file.\n - log-file: manage.log\n\n ## The default log level for actor.\n - log-level: DEBUG\n\n ## actor rotates log files. You may specify how many archived log files to keep here.\n - log-retain: 5\n\n ## actor rotates log files after they exceed a certain size.\n ## You may specify the file size that results in a log file being rotated here.\n - log-size: 5000000\n\n - logger: managecli\nauth:\n - name: managecli\n - guid: managecli-guid\n - credmgr-host: https://dev-2.fabric_mgmt_cli-testbed.net/\n\npeers:\n - peer:\n - name: orchestrator\n - type: orchestrator\n - guid: orchestrator-guid\n - kafka-topic: orchestrator-topic\n - peer:\n - name: net1-am\n - guid: net1-am-guid\n - type: authority\n - kafka-topic: net1-am-topic\n - peer:\n - name: site1-am\n - guid: site1-am-guid\n - type: authority\n - kafka-topic: site1-am-topic\n - peer:\n - name: broker\n - guid: broker-guid\n - type: broker\n - kafka-topic: broker-topic\n```\n\n## Usage\nManagement CLI supports show and manage commands:\n```\n$ fabric-mgmt-cli\nUsage: fabric-mgmt-cli [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n -v, --verbose\n --help Show this message and exit.\n\nCommands:\n delegations Delegation management\n maintenance Maintenance Operations\n net Dataplane network management\n slices Slice management\n slivers Sliver management\n```\n### Delegation Commands\nList of the delegation commands supported can be found below:\n```\n$ fabric-mgmt-cli delegations\nUsage: fabric-mgmt-cli delegations [OPTIONS] COMMAND [ARGS]...\n\n Delegation management\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n claim Claim delegation(s) from AM to Broker\n close Closes delegation for an actor\n query Get delegation(s) from an actor\n reclaim Reclaim delegation(s) from Broker to AM\n remove Removes sliver for an actor\n```\n### Slice Commands\nList of the Slice commands supported can be found below:\n```\n$ fabric-mgmt-cli slices\nUsage: fabric-mgmt-cli slices [OPTIONS] COMMAND [ARGS]...\n\n Slice management\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n close Closes slice for an actor\n query Get slice(s) from an actor\n remove Removes slice for an actor\n removealldead Removes slice for an actor\n```\n### Sliver Commands\nList of the Sliver commands supported can be found below:\n```\n$ fabric-mgmt-cli slivers\nUsage: fabric-mgmt-cli slivers [OPTIONS] COMMAND [ARGS]...\n\n Sliver management\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n close Closes sliver for an actor\n query Get sliver(s) from an actor\n remove Removes sliver for an actor\n```\n\n### Maintenance Commands\nList of the Maintenance commands supported can be found below:\n```\n$ fabric-mgmt-cli maintenance\nUsage: fabric-mgmt-cli maintenance [OPTIONS] COMMAND [ARGS]...\n\n Maintenance Operations\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n site Change Maintenance modes (PreMaint, Maint, Active) for a\n specific...\n\n testbed Change Maintenance modes (PreMaint, Maint, Active) for the...\n```\n\n#### Examples\nNOTE: Specific projects/users can still be allowed to provision by passing:\n- Comma separated list of email addresses of the allowed users in the argument `--users`\n- Command separated list of the allowed project ids in the argument `--projects`\n##### Change Testbed Maintenance Mode\nMove Testbed in Pre-Maintenance Mode.\n```\n$ fabric-mgmt-cli maintenance testbed --actor orchestrator --mode PreMaint --deadline '2022-12-26T22:29:51.214418+00:00' --end '2022-12-30T22:29:51.214418+00:00'\n```\nMove Testbed in Maintenance Mode.\n```\n$ fabric-mgmt-cli maintenance testbed --actor orchestrator --mode Maint\n```\nMove Testbed in Active Mode\n```\n$ fabric-mgmt-cli maintenance testbed --actor orchestrator --mode Active\n```\n##### Change Site Maintenance Mode\nMove Site in Pre-Maintenance Mode.\n```\n$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode PreMaint --deadline '2022-12-26T22:29:51.214418+00:00' --end '2022-12-30T22:29:51.214418+00:00'\n```\nMove Site in Maintenance Mode.\n```\n$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Maint\n```\nMove Site in Active Mode\n```\n$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Active\n```\n\n##### Change Worker Maintenance Mode\nMove Worker in Pre-Maintenance Mode.\n```\n$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode PreMaint --deadline '2022-12-26T22:29:51.214418+00:00' --end '2022-12-30T22:29:51.214418+00:00' --workers renc-w1.fabric-testbed.net\n```\nMove Worker in Maintenance Mode.\n```\n$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Maint --workers renc-w1.fabric-testbed.net\n```\nMove Worker in Active Mode\n```\n$ fabric-mgmt-cli maintenance site --name RENC --actor orchestrator --mode Active --workers renc-w1.fabric-testbed.net\n```\n\n### Network Management Commands\nList of the Network Management commands supported can be found below:\n```\n$ fabric-mgmt-cli net\nUsage: fabric-mgmt-cli net [OPTIONS] COMMAND [ARGS]...\n\n Dataplane network management\n\nOptions:\n --help Show this message and exit.\n\nCommands:\n create Create a new network service\n delete Delete an existing network service by name\n show Subgroup for network information commands\n sync Control NSO device synchronization\n```",
"bugtrack_url": null,
"license": null,
"summary": "FABRIC Management CLI",
"version": "1.6.0",
"project_urls": {
"Home": "https://fabric-testbed.net/",
"Sources": "https://github.com/fabric-testbed/ManagementCli"
},
"split_keywords": [
"swagger",
"fabric management cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "13175303e92f39a721af6a2632d3b50d2eecb31cc41bf2e47f09968f143a8090",
"md5": "d92412aedf3434836ff9635c86a5b003",
"sha256": "4853662ef13c4ec1db734884823c56ba86718b8ffa7caa6f122a06155730955c"
},
"downloads": -1,
"filename": "fabric_mgmt_cli-1.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d92412aedf3434836ff9635c86a5b003",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 40229,
"upload_time": "2024-01-16T14:10:44",
"upload_time_iso_8601": "2024-01-16T14:10:44.667554Z",
"url": "https://files.pythonhosted.org/packages/13/17/5303e92f39a721af6a2632d3b50d2eecb31cc41bf2e47f09968f143a8090/fabric_mgmt_cli-1.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "54428c65923ab50db5a279f890eff84c06d4a417b3a0aaa671f21cbc89c14498",
"md5": "f0a5ce122f99ac253cd91b37310700f9",
"sha256": "2be26f5407931d77919407ee8d1da5617af623b06ee34cc78d742287d5a48186"
},
"downloads": -1,
"filename": "fabric-mgmt-cli-1.6.0.tar.gz",
"has_sig": false,
"md5_digest": "f0a5ce122f99ac253cd91b37310700f9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 33113,
"upload_time": "2024-01-16T14:10:50",
"upload_time_iso_8601": "2024-01-16T14:10:50.795244Z",
"url": "https://files.pythonhosted.org/packages/54/42/8c65923ab50db5a279f890eff84c06d4a417b3a0aaa671f21cbc89c14498/fabric-mgmt-cli-1.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-16 14:10:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fabric-testbed",
"github_project": "ManagementCli",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "fabric-mgmt-cli"
}