-
Notifications
You must be signed in to change notification settings - Fork 192
Dpctl Documentation
Dpctl is a management utility that enable some control over the OpenFlow switch. With this tool it's possible to add flows to the flow table, query for switch features and status, and change other configurations.
A dpctl command has the following syntax
dpctl [OPTIONS] SWITCH COMMAND [ARG...]
The SWITCH argument should use one of the following active OpenFlow connection methods:
tcp:HOST[:PORT] PORT (default: 6633) on remote TCP HOST
unix:FILE Unix domain socket named FILE
fd:N File descriptor N
dpctl -h
The command above shows the available dpctl but some doubts may appear on how to use some of them. So lets's have a closer look at all commands with usage examples.
Dpctl sends a features request message to the switch, which answers with a features reply.
Usage Example
dpctl unix:/var/run/s1.sock features
The reply message should look like this.
feat_repl{dpid="0x000002d5e8cde975", buffs="256", tabs="64", aux_id="0", caps="0x4f"]}
Where dpid is the datapath identification, buffs is the number of packets the switch can buffer, tabs is the number of flow_tables, aux_id refers to the auxiliary connection id and caps is the value of the switch capabilities bitmask.
Dpctl can query and set switch configuration parameters.
Usage Example
We will query for the switch configuration. You should see the default values for the configuration flags and the maximum number of bytes of a packet, mlen, that the switch can send to the controller.
dpctl unix:/var/run/s1.sock get-config
SENDING:
conf_req
RECEIVED:
conf_repl{conf={flags="0x0", mlen="128"}}
Now we will set the switch configuration flags to 1, which means drop fragments, and increase the packet limit of bytes to send to the controller.
dpctl unix:/var/run/s1.sock set-config flags=0x1,miss=512
SENDING:
set_conf{conf={flags="0x1", mlen="512"}}
OK.
Now we query again to check the changes
dpctl unix:/var/run/s1.sock get-config
SENDING:
conf_req
RECEIVED:
conf_repl{conf={flags="0x1", mlen="512"}}
Query description of switch hardware and software, where mfr is the manufacturer description, hw is the hardware description, sw is the software description, sn is the serial number and, dp refers to the datapath description.
Usage Example
dpctl unix:/var/run/s1.sock
SENDING:
stat_req{type="desc", flags="0x0"}
RECEIVED:
stat_repl{type="desc", flags="0x0", mfr="Stanford University, Ericsson Research and CPqD Research",
hw="OpenFlow 1.3 Reference Userspace Switch", sw="Dec 14 2012 09:52:06", sn="1", dp="OpenFlow 1.3
Reference Userspace Switch Datapath"}
table-mod stats-table
stats-group group-mod stats-group-desc
meter-config stats-meter meter-mod
stats-port port-mod
queue-get-config stats-queue
stats-flow stats-aggr flow-mod
There are a few number of options to be passed to dpctl, which can be used for purposes of information, increase the switch verbosity level and change default command behaviors.
-v, --verbose=MODULE[:FACILITY[:LEVEL]] set logging levels
-v, --verbose set maximum verbosity level
--log-file[=FILE] enable logging to specified FILE
(default: /usr/local/var/log/openflow/dpctl.log)
--strict use strict match for flow commands
-t, --timeout=SECS give up after SECS seconds
-h, --help display this help message
-V, --version display version information