That's the reason; the jsonmsg_event isn't exposed in python on zaku. I'd really encourage you to try to migrate to destiny. Not only because this will work, but more importantly because destiny is a far more developed branch by now, with many fixes and added features.
If you really don't want to switch to destiny, maybe you could just grab jsonmsg_event.i from destiny and stick it in your zaku tree. (I can't remember if this is going to just work or you'll need to hack something, but give it a try and see what breaks?) On Thu, Jan 26, 2012 at 1:37 PM, Giorgio Mazza <giorgio.mazza...@gmail.com>wrote: > ** > Yes, I'm using zaku... > And I do not have any file called "jsonmsg_event.i". > Any idea about how can I receive json messages and handle them in order to > install flow entries? > Do I have to use destiny branch? > I don't know if it could be simple to switch from zaku to destiny, but i'd > rather to keep zaku, as I already worked a bit on it in order to extend it > with other classes and with the component I am try to improve. > Is it possible to implement those functionalities going on with zaku? > > Giorgio > > > On 26/01/2012 21:38, Kyriakos Zarifis wrote: > > Hi Girogio, > > I forgot to ask, but, are you using the destiny branch or zaku? It looks > like you're using zaku. > > In your _source_ directory, not the build dir, (so: > nox/src/nox/coreapps/messenger), you should have a file called > "jsonmsg_event.i", which creates the module you're missing. That exists > only in destiny > > On Thu, Jan 26, 2012 at 5:27 AM, Giorgio Mazza <giorgio.mazza...@gmail.com > > wrote: > >> Actually I get the same error, because I do not have neither >> pyjsonmsgevent nor pymsgevent in messenger folder... >> This is the list of what I have in messenger folder: >> >> giorgio@controller:~/nox/build/src$ ls -a nox/coreapps/messenger/ >> . jsonmessenger.la >> messenger.la >> .. jsonmessenger_la-jsonmessenger.lo >> messenger_la-messenger.lo >> cacert.pem .libs >> messenger.py >> .deps Makefile >> meta.json >> __init__.py messenger_core.la >> servercert.pem >> __init__.pyc messenger_core_la-messenger_core.lo serverkey.pem >> >> >> Do I miss anything in my folders or did I make something wrong? >> >> Giorgio >> >> >> On 26/01/2012 13:05, Murphy McCauley wrote: >> >> Oops, that was my bad -- as I said, I had adapted that from another >> message. >> The correct import should be: >> from nox.coreapps.messenger.pyjsonmsgevent import JSONMsg_event >> >> -- Murphy >> >> On Jan 26, 2012, at 3:40 AM, Giorgio Mazza wrote: >> >> Thanks, I think I will specify a port. >> >> Another question... >> At the moment I get an error while importing the JSON_Msg event in the >> install() of my component. >> >> "in install >> from nox.coreapps.messenger.pymsgevent import JSONMsg_event >> ImportError: No module named pymsgevent " >> >> I blindly followed your instructions at first, but then I looked in my >> messenger folder without finding where this event is defined. >> Could you please tell me where is it, so that I can insert the correct >> path in my install function? I'm using the standard message folder. >> Thank you. >> Regards, >> >> Giorgio >> >> On 25/01/2012 22:28, Murphy McCauley wrote: >> >> I believe it defaults to port 2703. You should be able to set the port >> number by specifying it on the commandline... >> ./nox_core -i ptcp: jsonmessenger=tcpport=4096 your_app_here >> >> It listens on all IP addresses; there is currently no way to specify >> just one. >> >> -- Murphy >> >> On Jan 25, 2012, at 1:11 PM, Giorgio Mazza wrote: >> >> A question about the socket opened when invoking jsonmessenger. >> What are the IP address, the tcp port and the interface that this socket >> refers to? Is there any way to set them? >> I undersotood the mechanism, but I don't know where to send my messages >> from the external application. >> Thank you. >> Regards, >> >> Giorgio >> >> On 24/01/2012 13:49, Murphy McCauley wrote: >> >> The minimum to get up and going should be something like this: >> >> 1) In your component's install function: >> from nox.coreapps.messenger.pymsgevent import JSONMsg_event >> JSONMsg_event.register_event_converter(self.ctxt) >> self.register_handler(JSONMsg_event.static_get_name(), myHandler) >> >> 2) Implement a handler: >> def myHandler (e): >> import json >> print json.loads(e.jsonstring) >> e.reply(json.dumps({"msg":"Hello world"})) >> >> 3) Include jsonmessenger on the commandline or as a dependency >> >> >> That may not be exactly correct -- it's adapted from a quick writeup I >> did in December about using the new Python support for the "regular" >> messenger (as opposed to the JSON messenger), which has not yet been pushed >> to the repository. For reference, that post was: >> http://noxrepo.org/pipermail/nox-dev/2011-December/008382.html >> >> (If using the new version of messenger that I linked to in that post, >> you remove the register_event_converter() call from step 1 and include >> pyjsonmessenger instead of jsonmessenger in step 3.) >> >> Invoking the jsonmessenger component (on the commandline or by >> including it as a dependency in your app's meta.json) will create the >> server socket for you. >> >> You absolutely do not have to use the messenger.py class. I'm removing >> it from that directory, because all it ever does is confuse people -- it >> really doesn't belong there. messenger.py is a library for writing JSON >> messenger *clients* (external programs) in Python. That may be useful to >> you, but you don't need it for the NOX side of things. >> >> Hope that helps. >> >> -- Murphy >> >> On Jan 24, 2012, at 4:12 AM, Giorgio Mazza wrote: >> >> Thank you. >> I try to sum up the operations I need to perform, to see if I understood >> correctly. >> Basically in my external application I have to set up a socket that sends >> json messages and this would be quite simple. >> In my nox component, instead, I have to import the "JSONMsg_event" and, >> within the "install()" instruction, to handle it with my specific method, >> that, in my case, would only save these json messages into a dictionary, >> for using them later, according to some conditions. >> Is that correct? >> >> A couple of things that I didn't understand: >> - I assume I also have to set up a server socket in my nox component, in >> order to receive json messages and handle JSONMsg_events. So, I think this >> socket has to be already up and running when I handle the event. So, when >> do I have to create it and how? Do I have to use messenger.py channel class? >> - Second question, probably related to the first. I think to be pretty >> confused about jsonmessenger: what are the jsonmessenger files I could look >> into in order to understand fields and methods that I would need to use? >> Are the jsonmessenger.cc and jsonmessenger.hh in >> nox/src/nox/coreapps/messenger? And, if it is the case, how can I integrate >> them into a python component? >> >> Thanks again, >> >> Giorgio >> >> On 24/01/2012 12:28, Kyriakos Zarifis wrote: >> >> Hi Giorgio, >> >> yes, I think using jsonmessenger would be the best approach for this. >> >> you need to implement a send/receive interface on the external >> application and in your nox component. For the external application, it's >> pretty straightforward - Connect to the jsonmessenger socket and send json >> strings. In your nox application you need to register for JSON messages, >> and handle them appropriately. >> >> The wiki explains the communication in a few steps (specifically for >> the GUI<->NOX, but it will be similar and simpler for any external app) >> here<http://noxrepo.org/noxwiki/index.php/NOX_GUI#Connecting_a_subview_to_a_NOX_component> >> : >> >> If you want to see a full example, the GUI <http://tinyurl.com/6p2yl5o> and >> the monitoring <http://tinyurl.com/6nv83a3> component in destiny could >> be a place to look. I'm afraid it's much more complex than what you need, >> but the bits you need are in there if you dig in the code a bit. >> >> >> On Tue, Jan 24, 2012 at 2:16 AM, Giorgio Mazza < >> giorgio.mazza...@gmail.com> wrote: >> >>> Hi all! >>> I have written a simple component in python that works fine. >>> Now I would to improve it, making it to install flow entries depending >>> on parameters received from an external application. >>> In particular I want to pass those parameters via json messages to my >>> component, which, in my thougths, has to open a "permanent" socket >>> listening for them, save those parameters in a dictionary and, as a >>> consequence, decide the desired switch behaviour (whether install or not a >>> flow entry for the received parameters). >>> In previous threads I found that I have to use jsonmessenger (even in >>> python?) or to have a look to discovery.py, but I am not sure to have >>> understood what I have to do and where in order to realize such a behaviour. >>> Could anyone, please, help me? >>> Thank you in advance, >>> >>> Giorgio Mazza >>> _______________________________________________ >>> nox-dev mailing list >>> nox-dev@noxrepo.org >>> http://noxrepo.org/mailman/listinfo/nox-dev >>> >> >> >> _______________________________________________ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev >> >> >> >> _______________________________________________ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev >> >> >> >> _______________________________________________ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev >> >> >> >> >> _______________________________________________ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev >> >> > > > _______________________________________________ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev > >
_______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev