vpcctl
A command-line interface tool for interacting locally with the Weave NetworkIsolation gRPC service. it is packaged as part of the DOCA weave image and can be executed from each DPU by exec from the corresponding weave-flow-controller pod.
Overview
vpcctl provides a simple CLI interface to manage virtual networks and attachments through the NetworkIsolation gRPC service. It allows you to create, update, delete, get, and list virtual networks and their attachments.
gRPC API shape: Virtual network and attachment resources use a spec/status structure. The spec holds the desired configuration. The status holds server-managed state (phase, reason, etc.). Create RPCs take a spec in the request; Get/List responses return the full resource with both spec and status.
Configuration
gRPC Target
The gRPC service is addressed via a --target endpoint in one of the following forms:
-
unix:///absolute/path/to.sock -
tcp://host:port
The target can be configured in the following ways (in order of precedence):
-
Command-line flag:
--target=unix:///path/to/socketor--target=tcp://host:port -
Environment variable:
VPCCTL_TARGET=unix:///path/to/socket -
Default:
-
NetworkIsolation commands:
unix:///var/run/dpf/weave/grpc/flow-controller.sock -
DHCP commands:
unix:///var/run/dpf/weave/grpc/dhcp.sock, falling back totcp://127.0.0.1:50222when that socket does not exist on disk
-
DHCP Auth Token File
DHCP commands require an auth token that is read from a file on disk. The token file path can be configured in the following ways (in order of precedence):
-
Command-line flag:
--dhcp-token-file=/path/to/token -
Environment variable:
DHCP_AUTH_TOKEN_PATH=/path/to/token -
Default:
/var/run/dpf/weave/grpc/weave-dhcp-agent.token
The token is transparently attached to every DHCP gRPC call as a bearer token.
Commands
Virtual Network Commands
create-vnet
Create a new virtual network.
vpcctl create-vnet [--id <id>] --vni <number> (--subnet-v4 <cidr> | --subnet-v6 <cidr>) [--user-data <key=value>...]
|
Flag |
Required |
Description |
|---|---|---|
|
|
No |
Unique identifier for the virtual network (server generates if not set) |
|
|
Yes |
VXLAN Network Identifier (1-1048575) |
|
|
One of |
IPv4 subnet in CIDR notation |
|
|
One of |
IPv6 subnet in CIDR notation |
|
|
No |
Arbitrary |
Pass the flag matching the deployment's address family, Weave runs one family at a time.
update-vnet
Update the user data of an existing virtual network.
vpcctl update-vnet --id <id> (--user-data <key=value>... | --clear-user-data) [--resource-version <version>]
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Virtual network identifier to update |
|
|
One of |
Replaces |
|
|
One of |
Removes all |
|
|
No |
Sets |
Note:
--user-datareplaces the stored map in its entirety, it does not merge into it. Keys that are not passed are removed. Exactly one of--user-dataor--clear-user-datamust be provided, so that clearing user data is always explicit.
delete-vnet
Delete an existing virtual network.
vpcctl delete-vnet --id <id>
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Virtual network identifier to delete |
get-vnet
Retrieve details of a virtual network.
vpcctl get-vnet --id <id>
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Virtual network identifier to retrieve |
list-vnet
List all virtual networks.
vpcctl list-vnet [--vni <number>]
|
Flag |
Required |
Description |
|---|---|---|
|
|
No |
Filter by VXLAN Network Identifier |
Attachment Commands
create-attachment
Create a new virtual network attachment.
vpcctl create-attachment [--id <id>] --vnet-id <id> --type <pf|vf|ovs> (--nic-id <id> --pf <mac> [--vf <index>] | --rep <rep-netdev>) [--user-data <key=value>...] [--ovs-bridge-name <name>] [--ovn-network-name <name>]
|
Flag |
Required |
Description |
|---|---|---|
|
|
No |
Unique identifier for the attachment (server generates if not set) |
|
|
Yes |
Virtual network identifier |
|
|
Yes (unless |
NIC identifier |
|
|
Yes |
Attachment type: |
|
|
If type=pf or vf (unless |
PF identifier (MAC address), required for |
|
|
If type=vf |
VF index (required when type is |
|
|
No (only for type=pf) |
Representor netdev of the host attachment. When set, |
|
|
No |
Arbitrary |
|
|
If type=ovs |
OVS bridge name to connect to via a patch port (max 32 chars); the bridge is created if it does not exist; required when type is |
|
|
No (only for type=ovs) |
OVN network name (letters, digits, |
update-attachment
Update the user data of an existing attachment.
vpcctl update-attachment --id <id> (--user-data <key=value>... | --clear-user-data) [--resource-version <version>]
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Attachment identifier to update |
|
|
One of |
Replaces |
|
|
One of |
Removes all |
|
|
No |
Sets |
Note:
--user-datareplaces the stored map in its entirety, it does not merge into it. Keys that are not passed are removed. Exactly one of--user-dataor--clear-user-datamust be provided, so that clearing user data is always explicit.
delete-attachment
Delete an existing attachment.
vpcctl delete-attachment --id <id>
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Attachment identifier to delete |
get-attachment
Retrieve details of an attachment.
vpcctl get-attachment --id <id>
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Attachment identifier to retrieve |
list-attachment
List all attachments.
vpcctl list-attachment [--vnet-id <id>] [--nic-id <id>]
|
Flag |
Required |
Description |
|---|---|---|
|
|
No |
Filter by virtual network identifier |
|
|
No |
Filter by NIC identifier |
DHCP Commands
get-dhcp-config
Retrieve the current DHCP agent configuration.
vpcctl get-dhcp-config
set-dhcp-config
Apply a DHCP agent configuration from a JSON file or from stdin. The input must be the protobuf JSON representation of DHCPAgentConfig.
# From file
vpcctl set-dhcp-config --config <path>
# From stdin (JSON config piped or redirected)
cat config.json | vpcctl set-dhcp-config --config -
vpcctl set-dhcp-config --config - < config.json
|
Flag |
Required |
Description |
|---|---|---|
|
|
Yes |
Path to the DHCP config JSON file, or |
Examples
Using with a custom target
# Via flag (unix socket)
vpcctl --target=unix:///tmp/weave/flow-controller.sock list-vnet
# Via environment variable
export VPCCTL_TARGET=unix:///tmp/weave/flow-controller.sock
vpcctl list-vnet
Using with a custom DHCP token file
# Via flag
vpcctl --dhcp-token-file=/tmp/weave-dhcp-agent.token get-dhcp-config
# Via environment variable
export DHCP_AUTH_TOKEN_PATH=/tmp/weave-dhcp-agent.token
vpcctl get-dhcp-config
Creating a virtual network
# With explicit ID
vpcctl \
create-vnet \
--id "my-vnet-001" \
--vni 100 \
--subnet-v4 "10.0.0.0/24"
# Without ID (server will generate one)
vpcctl \
create-vnet \
--vni 100 \
--subnet-v4 "10.0.0.0/24"
# With user-data (repeatable form)
vpcctl \
create-vnet \
--vni 100 \
--subnet-v4 "10.0.0.0/24" \
--user-data owner=alice \
--user-data env=dev
# With user-data (comma-separated form)
vpcctl \
create-vnet \
--vni 100 \
--subnet-v4 "10.0.0.0/24" \
--user-data owner=alice,env=dev
Output:
{
"virtualNetwork": {
"spec": {
"id": "my-vnet-001",
"vni": 100,
"subnetIpv4": "10.0.0.0/24"
},
"status": {
"state": {
"phase": "PHASE_READY"
}
}
}
}
On an IPv6 deployment, pass --subnet-v6 instead:
vpcctl \
create-vnet \
--id "my-vnet-v6-001" \
--vni 100 \
--subnet-v6 "f001::/24"
Output:
{
"virtualNetwork": {
"spec": {
"id": "my-vnet-v6-001",
"vni": 100,
"subnetIpv6": "f001::/24"
},
"status": {
"state": {
"phase": "PHASE_READY"
}
}
}
}
Creating a PF attachment
vpcctl \
create-attachment \
--id "att-pf-001" \
--vnet-id "my-vnet-001" \
--nic-id "00:11:22:33:44:55" \
--type pf \
--pf "00:11:22:33:44:55" \
--user-data owner=alice,team=net
Output:
{
"virtualNetworkAttachment": {
"spec": {
"id": "att-pf-001",
"vnetId": "my-vnet-001",
"nicId": "00:11:22:33:44:55",
"attachmentType": "ATTACHMENT_TYPE_PF",
"attachmentPf": {
"pfId": "00:11:22:33:44:55"
}
},
"status": {
"state": {
"phase": "PHASE_READY"
},
"hostIpv4": "10.0.0.1"
}
}
}
Attaching to the IPv6 virtual network created above:
vpcctl \
create-attachment \
--id "att-pf-v6-001" \
--vnet-id "my-vnet-v6-001" \
--nic-id "00:11:22:33:44:55" \
--type pf \
--pf "00:11:22:33:44:55" \
--user-data owner=alice,team=net
Output:
{
"virtualNetworkAttachment": {
"spec": {
"id": "att-pf-v6-001",
"vnetId": "my-vnet-v6-001",
"nicId": "00:11:22:33:44:55",
"attachmentType": "ATTACHMENT_TYPE_PF",
"attachmentPf": {
"pfId": "00:11:22:33:44:55"
}
},
"status": {
"state": {
"phase": "PHASE_READY"
}
}
}
}
The status carries no address because ipv6AssignmentMode defaults to slaac, where the host autoconfigures from Router Advertisements. Under dhcpv6 the leased address appears as hostIpv6.
Creating a VF attachment
vpcctl \
create-attachment \
--vnet-id "my-vnet-001" \
--nic-id "00:11:22:33:44:55" \
--type vf \
--pf "00:11:22:33:44:55" \
--vf 0
Creating a PF attachment from a representor netdev
Instead of passing --nic-id and --pf explicitly, a representor netdev can be provided via --rep. The NIC id and PF id are derived from it:
# PF attachment derived from a PF representor
vpcctl \
create-attachment \
--vnet-id "my-vnet-001" \
--type pf \
--rep "A1c1pf0"
Creating an OVS (ovs) attachment
vpcctl \
create-attachment \
--vnet-id "my-vnet-001" \
--nic-id "00:11:22:33:44:55" \
--type ovs \
--ovs-bridge-name "my-ovs-br" \
--ovn-network-name "my-ovn-net"
--ovn-network-name is optional; when omitted the attachment is a pure patch-port connection with no ovn-bridge-mappings entry.
Listing and filtering
# List all virtual networks
vpcctl list-vnet
# List virtual networks with specific VNI
vpcctl list-vnet --vni 100
# List all attachments
vpcctl list-attachment
# List attachments for a specific virtual network
vpcctl list-attachment --vnet-id "my-vnet-001"
# List attachments for a specific NIC
vpcctl list-attachment --nic-id "00:11:22:33:44:55"
# List attachments with multiple filters
vpcctl list-attachment --vnet-id "my-vnet-001" --nic-id "00:11:22:33:44:55"
Updating user data
# Replace the user-data of a virtual network. Keys that are not passed are removed
vpcctl update-vnet --id "my-vnet-001" --user-data owner=bob,env=prod
# Remove all user-data from a virtual network
vpcctl update-vnet --id "my-vnet-001" --clear-user-data
# Update with an optimistic concurrency precondition
vpcctl update-vnet --id "my-vnet-001" --user-data owner=bob --resource-version 3
# Replace the user-data of an attachment
vpcctl update-attachment --id "att-pf-001" --user-data owner=bob
# Remove all user-data from an attachment
vpcctl update-attachment --id "att-pf-001" --clear-user-data
# Update an attachment with an optimistic concurrency precondition
vpcctl update-attachment --id "att-pf-001" --user-data owner=bob --resource-version 2
To add a key while preserving the existing ones, read the current user-data first and pass the merged result:
vpcctl get-vnet --id "my-vnet-001" | jq '.virtualNetwork.metadata.userData'
vpcctl update-vnet --id "my-vnet-001" --user-data owner=alice,env=dev,team=net
Getting and deleting resources
# Get a virtual network
vpcctl get-vnet --id "my-vnet-001"
# Get an attachment
vpcctl get-attachment --id "att-pf-001"
# Delete an attachment
vpcctl delete-attachment --id "att-pf-001"
# Delete a virtual network
vpcctl delete-vnet --id "my-vnet-001"
Getting and setting DHCP agent configuration
# Get dhcp configuration (token read from default path)
vpcctl get-dhcp-config
# Get dhcp configuration with an explicit token file
vpcctl --dhcp-token-file=/path/to/weave-dhcp-agent.token get-dhcp-config
# Get dhcp configuration via environment variable
export DHCP_AUTH_TOKEN_PATH=/path/to/weave-dhcp-agent.token
vpcctl get-dhcp-config
# Get dhcp configuration with custom target
vpcctl --target tcp://127.0.0.1:50222 get-dhcp-config
# Set DHCP configuration
vpcctl set-dhcp-config --config /tmp/my-config.json
Sample dhcp configuration:
{
"interfaceConfigs": [
{
"name": "nic1",
"mac": "fe:00:10:00:00:00",
"ipv4Subnet": "10.0.0.0/31",
"ipsToServe": [
{
"mac": "02:ab:cc:11:22:33",
"ipv4": "10.0.0.1"
}
]
},
{
"name": "nic2",
"mac": "ff:00:10:01:00:00",
"ipv4Subnet": "10.1.0.0/31",
"ipsToServe": [
{
"mac": "02:ab:cc:11:22:55",
"ipv4": "10.1.0.1"
}
]
}
]
}
The full dhcp config is defined in the DHCP agent config gRPC Service (internal only).
Output Format
All command responses are returned as pretty-printed JSON, making it easy to parse with tools like jq:
# List virtual network IDs
vpcctl list-vnet | jq '.virtualNetworks[].spec.id'
# List attachment IDs
vpcctl list-attachment | jq '.virtualNetworkAttachments[].spec.id'
Shell Completion
vpcctl supports shell completion for bash, zsh, fish, and PowerShell:
# Bash
vpcctl completion bash > /etc/bash_completion.d/vpcctl
# Zsh
vpcctl completion zsh > "${fpath[1]}/_vpcctl"
# Fish
vpcctl completion fish > ~/.config/fish/completions/vpcctl.fish
Last updated: