csle_ryu.controllers package

Submodules

csle_ryu.controllers.learning_switch_controller module

class csle_ryu.controllers.learning_switch_controller.LearningSwitchController(*args, **kwargs)[source]

Bases: csle_ryu.monitor.flow_and_port_stats_monitor.FlowAndPortStatsMonitor

RYU Controller implementing a learning L2 switch for OpenFlow 1.3

add_flow(datapath, priority, match, actions, buffer_id=None) None[source]

Utility method for adding a flow to a switch

Parameters
  • datapath – the datapath, i.e., abstraction of the link to the switch

  • priority – the priority of the flow (higher priority are prioritized)

  • match – the pattern for matching packets to the flow based on the header

  • actions – the actions to take when the flow is matched, e.g., where to send the packet

  • buffer_id – the id of the buffer where packets for this flow are queued if they cannot be sent

Returns

None

switch_features_handler(ev)[source]

Handler called after OpenFlow handshake with switch completed. It adds teh Table-miss flow entry to the flow tables of the switch so that next packet which yield a flow-table-miss will be sent to the controller

Parameters

ev – the handshake complete event

Returns

csle_ryu.controllers.learning_switch_stp_controller module

class csle_ryu.controllers.learning_switch_stp_controller.LearningSwitchSTPController(*args, **kwargs)[source]

Bases: csle_ryu.monitor.flow_and_port_stats_monitor.FlowAndPortStatsMonitor

RYU Controller implementing a learning L2 switch for OpenFlow 1.3 with the STP spanning tree protocol

To avoid the problems associated with redundant links in a switched LAN, STP is implemented on switches to monitor the network topology. Every link between switches, and in particular redundant links, are catalogued. The spanning-tree algorithm then blocks forwarding on redundant links by setting up one preferred link between switches in the LAN. This preferred link is used for all Ethernet frames unless it fails, in which case a non-preferred redundant link is enabled. When implemented in a network, STP designates one layer-2 switch as root bridge. All switches then select their best connection towards the root bridge for forwarding and block other redundant links. All switches constantly communicate with their neighbors in the LAN using bridge protocol data units (BPDUs)

add_flow(datapath, priority, match, actions, buffer_id=None) None[source]

Utility method for adding a flow to a switch

Parameters
  • datapath – the datapath, i.e., abstraction of the link to the switch

  • priority – the priority of the flow (higher priority are prioritized)

  • match – the pattern for matching packets to the flow based on the header

  • actions – the actions to take when the flow is matched, e.g., where to send the packet

  • buffer_id – the id of the buffer where packets for this flow are queued if they cannot be sent

Returns

None

delete_flow(datapath) None[source]

Utility function for instructing a switch to delete all flows that have been installed

Parameters

datapath – the datapath, i.e., abstraction of the link to the switch

Returns

None

switch_features_handler(ev) None[source]

Handler called after OpenFlow handshake with switch completed. It adds teh Table-miss flow entry to the flow tables of the switch so that next packet which yield a flow-table-miss will be sent to the controller

Parameters

ev – the handshake complete event

Returns

None

Module contents