|
1 |
| -# Fabric CLI |
2 | 1 |
|
3 |
| -!!! warning "" |
4 |
| - Under construction. |
| 2 | +# hhfabctl CLI Reference Guide |
5 | 3 |
|
6 |
| -Currently Fabric CLI is represented by a kubectl plugin `kubectl-fabric` automatically installed on the Control Node. |
7 |
| -It is a wrapper around `kubectl` and Kubernetes client which allows to manage Fabric resources in a more convenient way. |
8 |
| -Fabric CLI only provides a subset of the functionality available via Fabric API and is focused on simplifying objects |
9 |
| -creation and some manipulation with the already existing objects while main get/list/update operations are expected to |
10 |
| -be done using `kubectl`. |
| 4 | +The `hhfabctl` CLI is the Hedgehog Fabricator command-line interface (CLI) for managing Fabric resources. |
| 5 | +It provides an efficient way to create, manage, and inspect Fabric objects through a simplified CLI interface. |
| 6 | +This document serves as a reference guide for all available commands and options. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +```bash |
| 11 | +hhfabctl [global options] command [command options] |
| 12 | +``` |
| 13 | + |
| 14 | +## Version |
| 15 | + |
| 16 | +Check the version with: |
| 17 | + |
| 18 | +```bash |
| 19 | +hhfabctl --version |
| 20 | +``` |
| 21 | + |
| 22 | +## Commands and Options |
| 23 | + |
| 24 | +| Command | Subcommand | Options | Description | |
| 25 | +|---------|------------|---------|-------------| |
| 26 | +| **vpc** | create | `--name`, `--subnet` (required), `--vlan` (required), `--dhcp`, `--dhcp-range-start`, `--dhcp-range-end`, `--print` | Create a new VPC. | |
| 27 | +| | attach | `--name`, `--vpc-subnet` (required), `--connection` (required), `--print` | Attach VPC to a server connection. | |
| 28 | +| | peer | `--name`, `--vpc` (required), `--remote`, `--print` | Peer two VPCs. | |
| 29 | +| | wipe | `--yes` | Delete all VPCs and peerings. | |
| 30 | +| **switch** | ip | `--name`, `--username`, `--verbose` | Get switch management IP address. | |
| 31 | +| | ssh | `--name`, `--username`, `--verbose` | SSH into the switch. | |
| 32 | +| | serial | `--name`, `--username`, `--verbose` | Run serial console for the switch. | |
| 33 | +| | reboot | `--name`, `--yes`, `--verbose` | Reboot the switch. | |
| 34 | +| | power-reset | `--name`, `--yes`, `--verbose` | Power reset the switch. | |
| 35 | +| | reinstall | `--name`, `--yes`, `--verbose` | Reinstall the switch. | |
| 36 | +| **connection** | get | `--type` | Get details of existing connections. | |
| 37 | +| **switchgroup** | create | `--name`, `--print` | Create a new switch group. | |
| 38 | +| **external** | create | `--name`, `--ipv4-namespace`, `--inbound-community`, `--outbound-community`, `--print` | Create a new external connection. | |
| 39 | +| | peer | `--vpc`, `--external`, `--vpc-subnet`, `--external-prefix`, `--print` | Peer external and VPC. | |
| 40 | +| **wiring** | export | `--vpcs`, `--externals`, `--switch-profiles` | Export wiring diagram. | |
| 41 | +| **inspect** | fabric | `--verbose`, `--output` (default: "text") | Inspect overall Fabric state. | |
| 42 | +| | switch | `--name`, `--output` (default: "text") | Inspect switch status and ports. | |
| 43 | +| | port | `--name`, `--output` (default: "text") | Inspect switch port status. | |
| 44 | +| | server | `--name`, `--output` (default: "text") | Inspect server status. | |
| 45 | +| | connection | `--name`, `--output` (default: "text") | Inspect connection details. | |
| 46 | +| | vpc | `--name`, `--subnet`, `--output` (default: "text") | Inspect VPC details. | |
| 47 | +| | bgp | `--switch-name`, `--strict` | Inspect BGP neighbors. | |
| 48 | +| | lldp | `--switch-name`, `--strict`, `--fabric`, `--external`, `--server` | Inspect LLDP neighbors. | |
| 49 | +| | ip | `--address` | Inspect IP details. | |
| 50 | +| | mac | `--address` | Inspect MAC details. | |
| 51 | +| | access | `--source`, `--destination` | Inspect connectivity. | |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## Command Details |
| 56 | + |
| 57 | +### `vpc` |
| 58 | +VPC management commands. |
| 59 | + |
| 60 | +#### `create` |
| 61 | +Create a VPC: |
11 | 62 |
|
12 | 63 | ```bash
|
13 |
| -core@control-1 ~ $ kubectl fabric |
14 |
| -NAME: |
15 |
| - kubectl fabric - Hedgehog Fabric API kubectl plugin |
| 64 | +hhfabctl vpc create --name vpc-1 --subnet 10.0.1.0/24 --vlan 1001 --dhcp --dhcp-start 10.0.1.10 --dhcp-end 10.0.1.100 |
| 65 | +``` |
| 66 | + |
| 67 | +Options: |
| 68 | +- `--name` – VPC name. |
| 69 | +- `--subnet` – Subnet in CIDR format (**required**). |
| 70 | +- `--vlan` – VLAN ID (**required**). |
| 71 | +- `--dhcp` – Enable DHCP. |
| 72 | +- `--dhcp-range-start` – Start of DHCP range. |
| 73 | +- `--dhcp-range-end` – End of DHCP range. |
| 74 | +- `--print` – Print object as YAML. |
16 | 75 |
|
17 |
| -USAGE: |
18 |
| - kubectl fabric [global options] command [command options] |
| 76 | +#### `attach` |
| 77 | +Attach a VPC to a connection: |
| 78 | + |
| 79 | +```bash |
| 80 | +hhfabctl vpc attach --vpc-subnet vpc-1/default --connection server-01 |
| 81 | +``` |
19 | 82 |
|
20 |
| -VERSION: |
21 |
| - v0.53.1 |
| 83 | +Options: |
| 84 | +- `--vpc-subnet` – VPC subnet name (**required**). |
| 85 | +- `--connection` – Connection name (**required**). |
22 | 86 |
|
23 |
| -COMMANDS: |
24 |
| - vpc VPC commands |
25 |
| - switch, sw Switch commands |
26 |
| - connection, conn Connection commands |
27 |
| - switchgroup, sg SwitchGroup commands |
28 |
| - external, ext External commands |
29 |
| - inspect, i Inspect Fabric API Objects and Primitives |
30 |
| - help, h Shows a list of commands or help for one command |
| 87 | +#### `peer` |
| 88 | +Create a peering between VPCs: |
31 | 89 |
|
32 |
| -GLOBAL OPTIONS: |
33 |
| - --verbose, -v verbose output (includes debug) (default: true) |
34 |
| - --help, -h show help |
35 |
| - --version, -V print the version |
| 90 | +```bash |
| 91 | +hhfabctl vpc peer --vpc vpc-1 --vpc vpc-2 |
36 | 92 | ```
|
37 | 93 |
|
38 |
| -## VPC |
| 94 | +Options: |
| 95 | +- `--vpc` – VPC names (**required**). |
39 | 96 |
|
40 |
| -Create VPC named `vpc-1` with subnet `10.0.1.0/24` and VLAN `1001` with DHCP enabled and DHCP range starting from |
41 |
| -`10.0.1.10` (optional): |
| 97 | +#### `wipe` |
| 98 | +Delete all VPCs: |
42 | 99 |
|
43 | 100 | ```bash
|
44 |
| -core@control-1 ~ $ kubectl fabric vpc create --name vpc-1 --subnet 10.0.1.0/24 --vlan 1001 --dhcp --dhcp-start 10.0.1.10 |
| 101 | +hhfabctl vpc wipe --yes |
45 | 102 | ```
|
46 | 103 |
|
47 |
| -Attach previously created VPC to the server `server-01` (which is connected to the Fabric using the |
48 |
| -`server-01--mclag--leaf-01--leaf-02` Connection): |
| 104 | +Options: |
| 105 | +- `--yes` – Confirm deletion. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +### `switch` |
| 110 | +Switch management commands. |
| 111 | + |
| 112 | +#### `ip` |
| 113 | +Get switch IP: |
49 | 114 |
|
50 | 115 | ```bash
|
51 |
| -core@control-1 ~ $ kubectl fabric vpc attach --vpc-subnet vpc-1/default --connection server-01--mclag--leaf-01--leaf-02 |
| 116 | +hhfabctl switch ip --name switch-01 |
52 | 117 | ```
|
53 | 118 |
|
54 |
| -To peer VPC with another VPC (e.g. `vpc-2`) use the following command: |
| 119 | +Options: |
| 120 | +- `--name` – Switch name. |
| 121 | +- `--username` – SSH username (default: "admin"). |
| 122 | + |
| 123 | +#### `reboot` |
| 124 | +Reboot the switch: |
55 | 125 |
|
56 | 126 | ```bash
|
57 |
| -core@control-1 ~ $ kubectl fabric vpc peer --vpc vpc-1 --vpc vpc-2 |
| 127 | +hhfabctl switch reboot --name switch-01 --yes |
58 | 128 | ```
|
| 129 | + |
| 130 | +Options: |
| 131 | +- `--name` – Switch name. |
| 132 | +- `--yes` – Confirm reboot. |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +### `connection` |
| 137 | +Get connection details: |
| 138 | + |
| 139 | +```bash |
| 140 | +hhfabctl connection get management |
| 141 | +``` |
| 142 | + |
| 143 | +Options: |
| 144 | +- `--type` – Connection type (`management`, `fabric`, `vpc-loopback`). |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +### `switchgroup` |
| 149 | +Create a switch group: |
| 150 | + |
| 151 | +```bash |
| 152 | +hhfabctl switchgroup create --name sg-01 |
| 153 | +``` |
| 154 | + |
| 155 | +Options: |
| 156 | +- `--name` – Switch group name. |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +### `external` |
| 161 | +Create an external connection: |
| 162 | + |
| 163 | +```bash |
| 164 | +hhfabctl external create --name ext-01 --ipv4-namespace default |
| 165 | +``` |
| 166 | + |
| 167 | +Options: |
| 168 | +- `--name` – External name. |
| 169 | +- `--ipv4-namespace` – IPv4 namespace. |
| 170 | + |
| 171 | +--- |
| 172 | + |
| 173 | +### `wiring` |
| 174 | +Export wiring diagram: |
| 175 | + |
| 176 | +```bash |
| 177 | +hhfabctl wiring export --vpcs --externals |
| 178 | +``` |
| 179 | + |
| 180 | +Options: |
| 181 | +- `--vpcs` – Include VPCs (default: true). |
| 182 | +- `--externals` – Include externals (default: true). |
| 183 | + |
| 184 | +--- |
| 185 | + |
| 186 | +### `inspect` |
| 187 | +Inspect Fabric objects: |
| 188 | + |
| 189 | +```bash |
| 190 | +hhfabctl inspect fabric --output text |
| 191 | +``` |
| 192 | + |
| 193 | +Options: |
| 194 | +- `--output` – Output format (`text`, `yaml`, `json`). |
| 195 | + |
| 196 | +--- |
| 197 | + |
| 198 | +## Global Options |
| 199 | +- `--verbose`, `-v` – Enable verbose output (includes debug). |
| 200 | +- `--help`, `-h` – Show help. |
| 201 | +- `--version`, `-V` – Display version information. |
| 202 | +- `--yes`, `-y` – Confirm potentially dangerous actions. |
| 203 | + |
0 commit comments