directflow

DirectFlow management and status module

DirectFlow is a software feature that allows OpenFlow-like rules to be programmed in switch hardware manually. Because a DirectFlow enabled switch allows normal forwarding features to operate, it gives operators a reliable way of building for the exceptional “just this one feature” parts of their network in a flexible manner. This module allows for the management of DirectFlow configuration as well as reactions to changes in status of flows.

namespace eos
class flow_handler
#include <directflow.h>

Flow handler.

A flow handler is notified when the status of configured flows changes.

Public Functions

flow_handler(directflow_mgr *)
directflow_mgr * get_directflow_mgr() const
void watch_all_flows(bool)

Registers this class to receive updates on changes to flow state. Expects a boolean signifying whether notifications should be propagated to this instance or not.

void watch_flow(std::string const &, bool)

Registers this class to receive updates on changes to flow state for the given flow name. Expects the name of the flow to watch and a boolean signifying whether notifications should be propagated to this instance or not.

virtual void on_flow_status(std::string const &, flow_status_t)

Handler called when flow status changes.

class flow_entry_iter_t
#include <directflow.h>

An iterator providing forwards iteration through the configured flows.

Private Functions

flow_entry_iter_t(flow_entry_iter_impl * const)

Friends

friend class flow_entry_iter_impl
class directflow_mgr
#include <directflow.h>

DirectFlow configuration and status manager.

Public Functions

virtual ~directflow_mgr()
virtual flow_entry_iter_t flow_entry_iter() const = 0

Iterate across all configured flows.

virtual bool exists(std::string const &) const = 0

Tests for existence of a flow entry with the given name.

virtual flow_entry_t flow_entry(std::string const &) const = 0

Return the flow entry with the given name.

virtual void flow_entry_set(flow_entry_t const &) = 0

Insert or update a flow.

virtual void flow_entry_del(std::string const &) = 0

Delete a flow.

virtual flow_status_t flow_status(std::string const & name) const = 0

Return the status of the given flow.

virtual flow_rejected_reason_t flow_rejected_reason(std::string const & name) const = 0

The reason a flow was not programmed. Only valid if the flow’s status is FLOW_REJECTED

virtual flow_counters_t flow_counters(std::string const & name) const = 0

Return the counters for a flow.

Protected Functions

directflow_mgr()

Private Members

directflow_mgr

Friends

friend class flow_handler

Type definitions in directflow

namespace eos

Typedefs

typedef uint16_t flow_priority_t
typedef uint16_t eth_type_t
typedef uint8_t cos_t

Enums

flow_status_t enum

Flow entry status.

Values:

  • FLOW_STATUS_UNKNOWN -
  • FLOW_CREATED -

    Flow created or modified in hardware.

  • FLOW_DELETED -

    Flow removed from hardware.

  • FLOW_REJECTED -

    Flow not created.

flow_rejected_reason_t enum

Reason why a flow was not successfully created in hardware.

Values:

  • FLOW_REJECTED_BAD_MATCH -

    Flow not created due to bad match criteria.

  • FLOW_REJECTED_BAD_ACTION -

    Flow not created due to bad action criteria.

  • FLOW_REJECTED_HW_TABLE_FULL -

    Flow not created due to insufficient resources.

  • FLOW_REJECTED_OTHER -

    Flow not created for some other reason.

class flow_match_field_set_t
#include <directflow.h>

Defines the set of fields to match on flow.

Public Functions

flow_match_field_set_t()
void input_intfs_is(bool enabled)
bool input_intfs() const
void eth_src_is(bool enabled)
bool eth_src() const
void eth_dst_is(bool enabled)
bool eth_dst() const
void eth_type_is(bool enabled)
bool eth_type() const
void vlan_id_is(bool enabled)
bool vlan_id() const
void cos_is(bool enabled)
bool cos() const
void ip_src_is(bool enabled)
bool ip_src() const
void ip_dst_is(bool enabled)
bool ip_dst() const
bool operator==(flow_match_field_set_t const & other) const
bool operator!=(flow_match_field_set_t const & other) const
bool operator<(flow_match_field_set_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

uint32_t match_bitset_

Friends

friend class flow_helper
friend std::ostream & operator<<

A utility stream operator that adds a string representation of flow_match_field_set_t to the ostream.

class flow_match_t
#include <directflow.h>

Match criteria for a flow.

Public Functions

flow_match_t()
flow_match_field_set_t match_field_set() const

Getter for ‘match_field_set’: the fields to match on.

void match_field_set_is(flow_match_field_set_t match_field_set)

Setter for ‘match_field_set’.

std::set< intf_id_t > const & input_intfs() const

Getter for ‘input_intfs’: the input interfaces to match on.

void input_intfs_is(std::set< intf_id_t > const & input_intfs)

Setter for ‘input_intfs’.

void input_intf_set(intf_id_t const & value)

inserts one input_intf of ‘value’ to the set.

void input_intf_del(intf_id_t const & value)

deletes one input_intf of ‘value’ from the set.

eth_addr_t eth_src() const

Getter for ‘eth_src’: the source Ethernet address to match on.

void eth_src_is(eth_addr_t eth_src)

Setter for ‘eth_src’.

void eth_src_is(eth_addr_t src, eth_addr_t mask)
eth_addr_t eth_src_mask() const
void eth_src_mask_is(eth_addr_t eth_src_mask)
eth_addr_t eth_dst() const

Getter for ‘eth_dst’: the destination Ethernet address to match on.

void eth_dst_is(eth_addr_t eth_dst)

Setter for ‘eth_dst’.

void eth_dst_is(eth_addr_t dst, eth_addr_t mask)
eth_addr_t eth_dst_mask() const
void eth_dst_mask_is(eth_addr_t eth_dst_mask)
eth_type_t eth_type() const

Getter for ‘eth_type’: the Ethernet type to match on.

void eth_type_is(eth_type_t eth_type)

Setter for ‘eth_type’.

vlan_id_t vlan_id() const

Getter for ‘vlan_id’: the VLAN id to match.

void vlan_id_is(vlan_id_t vlan_id)

Setter for ‘vlan_id’.

void vlan_id_is(vlan_id_t vlan_id, uint16_t mask)
vlan_id_t vlan_id_mask() const
void vlan_id_mask_is(vlan_id_t vlan_id_mask)
cos_t cos() const

Getter for ‘cos’: the class of service to match on, only used if vlan_id is set to something other than 0.

void cos_is(cos_t cos)

Setter for ‘cos’.

ip_addr_t ip_src() const

Getter for ‘ip_src’: the source IPv4 address to match on.

void ip_src_is(ip_addr_t const & ip_src)

Setter for ‘ip_src’.

void ip_src_is(ip_addr_t const & src, ip_addr_t const & mask)
ip_addr_t ip_src_mask() const
void ip_src_mask_is(ip_addr_t const & ip_src_mask)
ip_addr_t ip_dst() const

Getter for ‘ip_dst’: the destination IPv4 address to match on.

void ip_dst_is(ip_addr_t const & ip_dst)

Setter for ‘ip_dst’.

void ip_dst_is(ip_addr_t const & dst, ip_addr_t const & mask)
ip_addr_t ip_dst_mask() const
void ip_dst_mask_is(ip_addr_t const & ip_dst_mask)
bool operator==(flow_match_t const & other) const
bool operator!=(flow_match_t const & other) const
bool operator<(flow_match_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

flow_match_field_set_t match_field_set_
std::set< intf_id_t > input_intfs_
eth_addr_t eth_src_
eth_addr_t eth_src_mask_
eth_addr_t eth_dst_
eth_addr_t eth_dst_mask_
eth_type_t eth_type_
vlan_id_t vlan_id_
vlan_id_t vlan_id_mask_
cos_t cos_
ip_addr_t ip_src_
ip_addr_t ip_src_mask_
ip_addr_t ip_dst_
ip_addr_t ip_dst_mask_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of flow_match_t to the ostream.

class flow_action_set_t
#include <directflow.h>

Defines the set of enabled actions.

Public Functions

flow_action_set_t()
void set_output_intfs_is(bool enabled)
bool set_output_intfs() const
void set_vlan_id_is(bool enabled)
bool set_vlan_id() const
void set_cos_is(bool enabled)
bool set_cos() const
void set_eth_src_is(bool enabled)
bool set_eth_src() const
void set_eth_dst_is(bool enabled)
bool set_eth_dst() const
void set_ip_src_is(bool enabled)
bool set_ip_src() const
void set_ip_dst_is(bool enabled)
bool set_ip_dst() const
bool operator==(flow_action_set_t const & other) const
bool operator!=(flow_action_set_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

uint32_t action_bitset_

Friends

friend class flow_helper
friend std::ostream & operator<<

A utility stream operator that adds a string representation of flow_action_set_t to the ostream.

class flow_action_t
#include <directflow.h>

Defines the actions to take on a matching flow.

Public Functions

flow_action_t()
flow_action_set_t action_set() const

Getter for ‘action_set’: actions that are enabled.

void action_set_is(flow_action_set_t action_set)

Setter for ‘action_set’.

std::set< intf_id_t > const & output_intfs() const

Getter for ‘output_intfs’: 0 or more the output interfaces, passing in the empty set will cause the packet to be dropped.

void output_intfs_is(std::set< intf_id_t > const & output_intfs)

Setter for ‘output_intfs’.

void output_intf_set(intf_id_t const & value)

inserts one output_intf of ‘value’ to the set.

void output_intf_del(intf_id_t const & value)

deletes one output_intf of ‘value’ from the set.

vlan_id_t vlan_id() const
void vlan_id_is(vlan_id_t vlan_id)
cos_t cos() const

Getter for ‘cos’: the class of service.

void cos_is(cos_t cos)

Setter for ‘cos’.

eth_addr_t eth_src() const

Getter for ‘eth_src’: the source Ethernet address.

void eth_src_is(eth_addr_t eth_src)

Setter for ‘eth_src’.

eth_addr_t eth_dst() const

Getter for ‘eth_dst’: the destination Ethernet address.

void eth_dst_is(eth_addr_t eth_dst)

Setter for ‘eth_dst’.

ip_addr_t ip_src() const

Getter for ‘ip_src’: the source IPv4 address.

void ip_src_is(ip_addr_t const & ip_src)

Setter for ‘ip_src’.

ip_addr_t ip_dst() const

Getter for ‘ip_dst’: the destination IPv4 address.

void ip_dst_is(ip_addr_t const & ip_dst)

Setter for ‘ip_dst’.

bool operator==(flow_action_t const & other) const
bool operator!=(flow_action_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

flow_action_set_t action_set_
std::set< intf_id_t > output_intfs_
vlan_id_t vlan_id_
cos_t cos_
eth_addr_t eth_src_
eth_addr_t eth_dst_
ip_addr_t ip_src_
ip_addr_t ip_dst_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of flow_action_t to the ostream.

class flow_entry_t
#include <directflow.h>

Defines a flow entry.

Public Functions

flow_entry_t()
flow_entry_t(std::string const & name, flow_match_t match, flow_action_t action, flow_priority_t priority)
std::string name() const
flow_match_t match() const
flow_action_t action() const
flow_priority_t priority() const
bool operator==(flow_entry_t const & other) const
bool operator!=(flow_entry_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::string name_
flow_match_t match_
flow_action_t action_
flow_priority_t priority_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of flow_entry_t to the ostream.

class flow_counters_t
#include <directflow.h>

Defines counters for a flow.

Public Functions

flow_counters_t()
uint64_t bytes() const
uint64_t packets() const
bool operator==(flow_counters_t const & other) const
bool operator!=(flow_counters_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

uint64_t bytes_
uint64_t packets_

Friends

friend class flow_helper
friend std::ostream & operator<<

A utility stream operator that adds a string representation of flow_counters_t to the ostream.

Table Of Contents

Previous topic

decap_group

Next topic

eth