base/frameworks/openflow/main.bro

OpenFlow

Bro’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.bro, base/frameworks/openflow/types.bro
Source File:/scripts/base/frameworks/openflow/main.bro

Summary

Events

OpenFlow::controller_activated: event Event that is raised once a controller finishes initialization and is completely activated.
OpenFlow::flow_mod_failure: event Reports an error while installing a flow Rule.
OpenFlow::flow_mod_success: event Event confirming successful modification of a flow rule.
OpenFlow::flow_removed: event Reports that a flow was removed by the switch because of either the hard or the idle timeout.

Functions

OpenFlow::controller_init_done: function Function to signal that a controller finished activation and is ready to use.
OpenFlow::flow_clear: function Clear the current flow table of the controller.
OpenFlow::flow_mod: function Global flow_mod function.
OpenFlow::generate_cookie: function Function to generate a new cookie using our group id.
OpenFlow::get_cookie_gid: function Function to get the group id out of a given cookie.
OpenFlow::get_cookie_uid: function Function to get the unique id out of a given cookie.
OpenFlow::lookup_controller: function Function to lookup a controller instance by name.
OpenFlow::match_conn: function Convert a conn_id record into an ofp_match record that can be used to create match objects for OpenFlow.
OpenFlow::register_controller: function Function to register a controller instance.
OpenFlow::unregister_controller: function 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.
Type:function (cookie: count &default = 0 &optional) : count

Function to generate a new cookie using our group id.

Cookie:The openflow match cookie.
Returns:The cookie group id.
Type:function (cookie: count) : count

Function to get the group id out of a given cookie.

Cookie:The openflow match cookie.
Returns:The cookie group id.
Type:function (cookie: count) : count

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 of OpenFlow::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
Type:function (id: conn_id, reverse: bool &default = F &optional) : OpenFlow::ofp_match

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.
Copyright 2016, The Bro Project. Last updated on October 21, 2017. Created using Sphinx 1.5.2.