Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet in handler #27

Open
MaysraMasri opened this issue Jun 12, 2018 · 2 comments
Open

Packet in handler #27

MaysraMasri opened this issue Jun 12, 2018 · 2 comments

Comments

@MaysraMasri
Copy link

MaysraMasri commented Jun 12, 2018

hello,
please I'm trying to write a python code which count number of packets received to pox controller by switch. But I have a problem when I wrote the Packet_in handler for example it doesn't invoked.
this is my code

standard includes

from pox.core import core
from pox.lib.util import dpidToStr
import pox.openflow.libopenflow_01 as of

log = core.getLogger()

class Packet_counter (object):
print("inside the function1")
def init (self, connection):
self.connection = connection
connection.addListeners(self)
print("inside the function222")

def _handle_PacketIn (self, event):
print("inside the packet_in handler")
#Num_packet = 0
#msg=of.ofp_packet_in()
#if msg == of.ofp_packet_in():
#log.warning("Ignoring incomplete packet")
#else:
#Num_packet = Num_packet+1
#print(" Number of (%s packets) are : ",Num_packet)

main function to launch the module

def launch ():
def start_switch (event):
log.debug("Controlling %s" % (event.connection))
Packet_counter(event.connection)

core.openflow.addListenerByName("ConnectionUp", start_switch)
@rersheed
Copy link

@MaysraMasri have you found a solution?

@lorenzomonta
Copy link

lorenzomonta commented Mar 10, 2021

@MaysraMasri @rersheed have you found a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants