Skip to content

Commit

Permalink
Currently trying to fix the ALREADY_HANDLED error
Browse files Browse the repository at this point in the history
  • Loading branch information
Aljonex committed Aug 17, 2022
1 parent 4cf8414 commit 10dcd5e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ Making use of several pieces of software, currently:
- Python 3.10.4
- Mininet

Datasets:
- First dataset taken from (dataset-small.csv): https://www.researchgate.net/publication/324716038_SOFTWARE-DEFINED_SECURITY
- Second dataset taken from (dataset-large.csv): https://github.com/dz43developer/sdn-network-ddos-detection-using-machine-learning
41 changes: 38 additions & 3 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,50 @@
The top line makes it possible to run the file as a script invoking the interpreter implicitly.
"""
#https://ryu.readthedocs.io/en/latest/writing_ryu_app.html
from ryu.base import app_manager # central management of Ryu apps
# Theses are imports from ~./local/lib/python3.10/site-packages/ryu and then the necessary things
# https://github.com/pymedusa/Medusa/issues/10253
import collections
try:
from collections import abc
collections.MutableMapping = abc.MutableMapping
except:
pass

from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER, CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ofproto_v1_5
from ryu.lib.packet import packet, ethernet, ether_types, in_proto, ipv4, icmp, tcp, udp


__author__ = "Alex Jones"
__maintainer__ = "Alex Jones"
__email__ = "[email protected]"
__status__ = "Production"
__status__ = "Production"

class RyuController(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_5.OFP_VERSION]

def __init__(self, *args, **kwargs):
super(RyuController, self).__init__(*args,**kwargs)
self.mac_to_port = {}

# Decorated event handler effectively, see docs above, openflow protocol api and then the related messages and structures version
@set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
def switch_features_handler(self,ev):
msg = ev.msg

self.logger.debug(
'OFPSwitchFeatures received: '
'datapath_id=0x%016x n_buffers=%d '
'n_tables=%d auxiliary_id=%d '
'capabilities=0x%08x',
msg.datapath_id, msg.n_buffers, msg._tables, msg.auxiliary_id, msg.capabilities
)
datapath = msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser

match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,ofproto.OFPCL_NO_BUFFER)]

1 comment on commit 10dcd5e

@Ajax-dev
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faucetsdn/ryu#169 talks about this issue and says that as I'm running python3.10 I will run into this error until running python3.9

Please sign in to comment.