base/frameworks/openflow/main.zeek
- OpenFlow
Zeek’s OpenFlow control framework.
This plugin-based framework allows to control OpenFlow capable switches by implementing communication to an OpenFlow controller via plugins. The framework has to be instantiated via the new function in one of the plugins. This framework only offers very low-level functionality; if you want to use OpenFlow capable switches, e.g., for shunting, please look at the NetControl framework, which provides higher level functions and can use the OpenFlow framework as a backend.
- Namespace
OpenFlow
- Imports
base/frameworks/openflow/consts.zeek, base/frameworks/openflow/types.zeek
Summary
Events
Event that is raised once a controller finishes initialization and is completely activated. |
|
Reports an error while installing a flow Rule. |
|
Event confirming successful modification of a flow rule. |
|
Reports that a flow was removed by the switch because of either the hard or the idle timeout. |
Functions
Function to signal that a controller finished activation and is ready to use. |
|
Clear the current flow table of the controller. |
|
Global flow_mod function. |
|
Function to generate a new cookie using our group id. |
|
Function to get the group id out of a given cookie. |
|
Function to get the unique id out of a given cookie. |
|
Function to lookup a controller instance by name. |
|
Convert a conn_id record into an ofp_match record that can be used to create match objects for OpenFlow. |
|
Function to register a controller instance. |
|
Function to unregister a controller instance. |
Detailed Interface
Events
- OpenFlow::controller_activated
- Type
event
(name:string
, controller:OpenFlow::Controller
)
Event that is raised once a controller finishes initialization and is completely activated.
- Name
Unique name of this controller instance.
- Controller
The controller that finished activation.
- OpenFlow::flow_mod_failure
- Type
event
(name:string
, match:OpenFlow::ofp_match
, flow_mod:OpenFlow::ofp_flow_mod
, msg:string
&default
=""
&optional
)
Reports an error while installing a flow Rule.
- Name
The unique name of the OpenFlow controller from which this event originated.
- Match
The ofp_match record which describes the flow to match.
- Flow_mod
The openflow flow_mod record which describes the action to take.
- Msg
Message to describe the event.
- OpenFlow::flow_mod_success
- Type
event
(name:string
, match:OpenFlow::ofp_match
, flow_mod:OpenFlow::ofp_flow_mod
, msg:string
&default
=""
&optional
)
Event confirming successful modification of a flow rule.
- Name
The unique name of the OpenFlow controller from which this event originated.
- Match
The ofp_match record which describes the flow to match.
- Flow_mod
The openflow flow_mod record which describes the action to take.
- Msg
An optional informational message by the plugin.
- OpenFlow::flow_removed
- Type
event
(name:string
, match:OpenFlow::ofp_match
, cookie:count
, priority:count
, reason:count
, duration_sec:count
, idle_timeout:count
, packet_count:count
, byte_count:count
)
Reports that a flow was removed by the switch because of either the hard or the idle timeout. This message is only generated by controllers that indicate that they support flow removal in supports_flow_removed.
- Name
The unique name of the OpenFlow controller from which this event originated.
- Match
The ofp_match record which was used to create the flow.
- Cookie
The cookie that was specified when creating the flow.
- Priority
The priority that was specified when creating the flow.
- Reason
The reason for flow removal (OFPRR_*).
- Duration_sec
Duration of the flow in seconds.
- Packet_count
Packet count of the flow.
- Byte_count
Byte count of the flow.
Functions
- OpenFlow::controller_init_done
- Type
function
(controller:OpenFlow::Controller
) :void
Function to signal that a controller finished activation and is ready to use. Will throw the
OpenFlow::controller_activated
event.
- OpenFlow::flow_clear
- Type
function
(controller:OpenFlow::Controller
) :bool
Clear the current flow table of the controller.
- Controller
The controller which should execute the flow modification.
- Returns
F on error or if the plugin does not support the operation, T when the operation was queued.
- OpenFlow::flow_mod
- Type
function
(controller:OpenFlow::Controller
, match:OpenFlow::ofp_match
, flow_mod:OpenFlow::ofp_flow_mod
) :bool
Global flow_mod function.
- Controller
The controller which should execute the flow modification.
- Match
The ofp_match record which describes the flow to match.
- Flow_mod
The openflow flow_mod record which describes the action to take.
- Returns
F on error or if the plugin does not support the operation, T when the operation was queued.
- OpenFlow::generate_cookie
-
Function to generate a new cookie using our group id.
- Cookie
The openflow match cookie.
- Returns
The cookie group id.
- OpenFlow::get_cookie_gid
-
Function to get the group id out of a given cookie.
- Cookie
The openflow match cookie.
- Returns
The cookie group id.
- OpenFlow::get_cookie_uid
-
Function to get the unique id out of a given cookie.
- Cookie
The openflow match cookie.
- Returns
The cookie unique id.
- OpenFlow::lookup_controller
- Type
function
(name:string
) :vector
ofOpenFlow::Controller
Function to lookup a controller instance by name.
- Name
Unique name of the controller to look up.
- Returns
One element vector with controller, if found. Empty vector otherwise.
- OpenFlow::match_conn
-
Convert a conn_id record into an ofp_match record that can be used to create match objects for OpenFlow.
- Id
The conn_id record that describes the record.
- Reverse
Reverse the sources and destinations when creating the match record (default F).
- Returns
ofp_match object for the conn_id record.
- OpenFlow::register_controller
- Type
function
(tpe:OpenFlow::Plugin
, name:string
, controller:OpenFlow::Controller
) :void
Function to register a controller instance. This function is called automatically by the plugin _new functions.
- Tpe
Type of this plugin.
- Name
Unique name of this controller instance.
- Controller
The controller to register.
- OpenFlow::unregister_controller
- Type
function
(controller:OpenFlow::Controller
) :void
Function to unregister a controller instance. This function should be called when a specific controller should no longer be used.
- Controller
The controller to unregister.