OpenFlow switch configuration
The status and configuration of an OpenFlow datapath and its parts
(ports, queues) is represented by instances of the classes below. All
these classes are named tuple classes (cf. Python’s
collections), i.e. configuration objects are also tuples whose
elements each correspond to an attribute. To create a configuration
object, its attributes can be given in positional order, or using
keywords, i.e.:
from openfaucet import ofconfig
port_config = ofconfig.PortConfig(
port_down=False, no_stp=True, no_recv=True, no_recv_stp=True,
no_flood=False, no_fwd=False, no_packet_in=False)
is equivalent to:
from openfaucet import ofconfig
port_config = ofconfig.PortConfig(False, True, True, True, False,
False, False)
Likewise, attributes can be accessed by position or by name, i.e.:
is equivalent to:
no_stp = port_config.no_stp
Attribute access by name is recommended for readability. Every
configuration object, just like any tuple, is immutable and
hashable. A copy of an existing configuration object with some of its
attributes modified can be created by calling _replace(), for
instance:
new_port_config = port_config._replace(port_down=True, no_packet_in=True)
Datapath configuration
-
class openfaucet.ofconfig.SwitchFeatures
Describes the features of a datapath.
-
datapath_id
- The datapath’s unique ID, as a binary string.
-
n_buffers
- The maximum number of buffers that can be used at once, each to
buffer a packet.
-
n_tables
- The number of tables supported by the datapath.
cap_*: Boolean flags indicating each the support of not of a capability:
-
cap_flow_stats
- A boolean flag which if True indicates that flow statistics are
supported by the datapath.
-
cap_table_stats
- A boolean flag which if True indicates that table statistics are
supported by the datapath.
-
cap_port_stats
- A boolean flag which if True indicates that port statistics are
supported by the datapath.
-
cap_stp
- A boolean flag which if True indicates that the 802.1d Spanning
Tree Protocol is supported by the datapath.
-
cap_ip_reasm
- A boolean flag which if True indicates that the datapath can
reassemble IP fragments.
-
cap_queue_stats
- A boolean flag which if True indicates that queue statistics are
supported by the datapath.
-
cap_arp_match_ip
- A boolean flag which if True indicates that the datapath can match
IP addresses in ARP packets.
-
actions
- The frozenset of standard action type codes that is
supported by the switch. See ofaction for the
list of standard action types.
-
ports
- A tuple of PhyPort objects defining
the physical ports of the switch.
-
class openfaucet.ofconfig.SwitchConfig
The configuration of an OpenFlow switch.
-
config_frag
- Indicates how IP fragments should be treated, either
OFPC_FRAG_NORMAL (no special
handling for fragments),
OFPC_FRAG_DROP (drop fragments), or
OFPC_FRAG_REASM (reassemble, only if
supported,
cf. cap_ip_reasm).
-
miss_send_len
- The maximum number of bytes of new flow packets that the datapath
should send to the controller in OFPT_PACKET_IN messages.
Port configuration
-
class openfaucet.ofconfig.PhyPort
The description of a physical port of an OpenFlow switch.
-
port_no
- The port’s unique number, as a 16-bit unsigned integer. Must be
between 1 and OFPP_MAX.
-
hw_addr
- The port’s MAC address, as a binary string.
-
name
- The port’s human-readable name, limited to 16 characters.
-
config
- A PortConfig object indicating the
configuration of the port.
-
state_link_down
- A boolean value indicating that no physical link is present.
-
state_stp
- Indicates the Spanning Tree Protocol state, either
OFPPS_STP_LISTEN (not learning or
relaying frames), OFPPS_STP_LEARN
(learning but not relaying frames),
OFPPS_STP_FORWARD (learning and
relaying frames), or OFPPS_STP_BLOCK
(not part of spanning tree).
-
curr
- A PortFeatures object defining the
current features of the port.
-
advertised
- A PortFeatures object defining the
features being advertised by the port.
-
supported
- A PortFeatures object defining the
features supported by the port.
-
peer
- A PortFeatures object defining the
features advertised by the peer connected to the port.
-
class openfaucet.ofconfig.PortConfig
The description of the configuration of a physical port.
-
port_down
- A boolean flag which if True indicates that the port is
administratively down.
-
no_stp
- A boolean flag which if True indicates that 802.1D Spanning Tree
Protocol is disabled on the port.
-
no_recv
- A boolean flag which if True indicates that all received packets
are dropped except 802.1D Spanning Tree Protocol packets.
-
no_recv_stp
- A boolean flag which if True indicates that all received 802.1D
STP packets are dropped.
-
no_flood
- A boolean flag which if True indicates that this port is not
included when flooding.
-
no_fwd
- A boolean flag which if True indicates that packets forwarded to
the port are dropped.
-
no_packet_in
- A boolean flag which if True indicates that no packet-in messages
are sent by the datapath for packets received on the port.
-
class openfaucet.ofconfig.PortFeatures
Boolean attributes describing the features of a physical port.
-
mode_10mb_hd
- If True, 10 Mbps half-duplex rate is supported.
-
mode_10mb_fd
- If True, 10 Mbps full-duplex rate is supported.
-
mode_100mb_hd
- If True, 100 Mbps half-duplex rate is supported.
-
mode_100mb_fd
- If True, 100 Mbps full-duplex rate is supported.
-
mode_1gb_hd
- If True, 1 Gbps half-duplex rate is supported.
-
mode_1gb_fd
- If True, 1 Gbps full-duplex rate is supported.
-
mode_10gb_fd
- If True, 10 Gbps full-duplex rate is supported.
-
copper
- If True, a copper medium is supported as the link type.
-
fiber
- If True, a fiber medium is supported as the link type.
-
autoneg
- If True, the auto-negotiation feature is supported.
-
pause
- If True, the pause feature is supported.
-
pause_asym
- If True, the asymmetric pause feature is supported.
Queue configuration
-
class openfaucet.ofconfig.PacketQueue
The description of a packet queue.
-
queue_id
- The queue’s ID, as 32-bit unsigned integer.
-
min_rate
- If specified for this queue, the minimum data rate guaranteed, as
a 16-bit unsigned integer. This value is given in 1/10 of a
percent. If >1000, the queuing is disabled. If None, this property
is not available for this queue.