voltctl
- A command line tools to access VOLTHAIn today's VOLTHA implementation the operator interacts with VOLTHA via a CLI that is accessed by SSH
ing to the VOLTHA tool. While is can be convenent as it requires not external tool to be installed it is an abirtation in terms of industry trends for tools such as docker
and kubernetes
, which are both tools that VOLTHA leverages.
This repository contains a tool that attempts to provide a use model for VOLTHA that is similar to that of docker
and kubernetes
in that a simple control application is provided to invoke various funcs and the output can be displayed as a customized/filtered table or as JSON
.
To install the voltctl
command you can use the following:
mkdir myworkdir cd myworkdir export GOPATH=$(pwd) git clone http://github.com/ciena/voltctl src/github.com/ciena/voltctl cd src/github.com/ciena/voltctl make build cp ./voltctl <to any place you want in your path>
voltctl
has only been tested with go
version 1.12.x.
voltctl
supports shell completion for the bash
shell. To enable shell Completion you can use the following command on most *nix based system.
source <(voltctl completion bash)
If this does not work on your system, as is the case with the standard bash shell on MacOS, then you can try the following command:
source /dev/stdin <<<"$(voltctl completion bash)"
If you which to make bash
shell completion automatic when you login to your account you can append the output of voltctl completion bash
to your $HOME/.bashrc
:
voltctl completion base >> $HOME/.bashrc
Currently the configuration only supports the specification of the VOLTHA server. There is a sample configuration file name voltctl.config
. You can copy this to ~/.volt/config
and modify the server parameter to your environment. Alternatively you can specify the server on the command line as well, voltctl -server host:port ...
.
Currently only two commands are working
voltctl adapter list
- displays the installed adaptersvoltctl device list
- displays the devices in the systemvoltctl device create [-t type] [-i ipv4] [-m mac] [-H host_and_port]
- create or pre-provision a devicevoltctl delete DEVICE_ID [DEVICE_ID...]
- delete one or more devicesvoltctl enable DEVICE_ID [DEVICE_ID...]
- enable one or more devicesvoltctl disable DEVICE_ID [DEVICE_ID...]
- disable one or more devicesvoltctl version
- display the client and server versionEach command has a default output table format. This can be overriden from the command line using the voltctl --format=...
option. The specification of the format is roughly equivalent to the docker
or kubectl
command. If the prefix table
is specified a table with headers will be displayed, else each line will be output as specified.
The output of a command may also be written as JSON
or YAML
by using the --outputas
or -o
command line option. Valid values for this options are table
, json
, or yaml
.
The default format and ordering of commands can be overriden (specified) by the command line options, but they can also be set via a configuration file so that the overrides don't have to be specified on each invocation. By default the file ~/.volt/command_options
is loaded, but the file used can also be specified by the environment variable VOLTCTL_COMMAND_OPTIONS
or via the command line arguments. A samle of this file is include in the repository as voltctl_command_options.config
.
voltctl adapter list ID VENDOR VERSION acme Acme Inc. 0.1 adtran_olt ADTRAN, Inc. 1.36 adtran_onu ADTRAN, Inc. 1.25 asfvolt16_olt Edgecore 0.98 brcm_openomci_onu Voltha project 0.50 broadcom_onu Voltha project 0.46 cig_olt CIG Tech 0.11 cig_openomci_onu CIG Tech 0.10 dpoe_onu Sumitomo Electric, Inc. 0.1 maple_olt Voltha project 0.4 microsemi_olt Microsemi / Celestica 0.2 openolt OLT white box vendor 0.1 pmcs_onu PMCS 0.1 ponsim_olt Voltha project 0.4 ponsim_onu Voltha project 0.4 simulated_olt Voltha project 0.1 simulated_onu Voltha project 0.1 tellabs_olt Tellabs Inc. 0.1 tellabs_openomci_onu Tellabs Inc. 0.1 tibit_olt Tibit Communications Inc. 0.1 tibit_onu Tibit Communications Inc. 0.1 tlgs_onu TLGS 0.1
voltctl device list ID TYPE ROOT PARENTID SERIALNUMBER VLAN ADMINSTATE OPERSTATUS CONNECTSTATUS 00015bbbfdb3c068 ponsim_olt true 0001aabbccddeeff 10.1.4.4:50060 0 ENABLED ACTIVE REACHABLE 0001552615104a2c ponsim_onu false 00015bbbfdb3c068 PSMO12345678 128 ENABLED ACTIVE REACHABLE
voltctl device list --format 'table{{.Id}}\t{{.SerialNumber}}\t{{.ConnectStatus}}' ID SERIALNUMBER CONNECTSTATUS 00015bbbfdb3c068 10.1.4.4:50060 REACHABLE 0001552615104a2c PSMO12345678 REACHABLE
voltctl --server voltha:50555 device list --format '{{.Id}},{{.SerialNumber}},{{.ConnectStatus}}' 00015bbbfdb3c068,10.1.4.4:50060,REACHABLE 0001552615104a2c,PSMO12345678,REACHABLE
voltctl device list --outputas json [{"id":"00015bbbfdb3c068","type":"ponsim_olt","root":true,"parent_id":"0001aabbccddeeff","vendor":"ponsim","model":"n/a","serial_number":"10.1.4.4:50060","adapter":"ponsim_olt","Address":{"HostAndPort":"10.1.4.4:50060"},"admin_state":3,"oper_status":4,"connect_status":2},{"id":"0001552615104a2c","type":"ponsim_onu","parent_id":"00015bbbfdb3c068","parent_port_no":1,"vendor":"ponsim","model":"n/a","serial_number":"PSMO12345678","vlan":128,"Address":null,"proxy_address":{"device_id":"00015bbbfdb3c068","channel_id":128},"admin_state":3,"oper_status":4,"connect_status":2}]
WIP - just barely started