POX Web Interfaces

September 12, 2012 in POX

NOX-Classic has had a Qt based GUI for quite a while now, and in slightly modified form, it made it into POX as well.  However, I do hear requests for a web-based GUI from time to time.  I’d like to briefly discuss three relevant items: my own extensible web-based GUI for POX (POXDesk), POX-based JSON-RPC webservices, and Sam Russell’s work using POX with Django.  And if you’re not that interested in the technology behind it, I’ll post some pretty pictures too.

Sam Russell’s Django POX UI

Django and POX

I’ll actually go in reverse order here, so I’ll start by mentioning that POX user Sam Russell (who has been posting on his blog about POX) has written a couple nice posts about integrating POX with Django to get a POX web interface.  This works out pretty well, since POX and Django are both Python frameworks and just sort of snap together.

His blog posts are actually pretty much a crash course on getting started with Django for POX/OpenFlow developers, and if this is the sort of thing you’re interested in, you should absolutely give it a read.

POX Webservices

The development branch of POX (which will soon be getting put in the main repository) has better support for the web built in.  [Update: This has now happened: it’s the betta branch of the POX repository.] This comes in two forms.


The first is that there’s some infrastructure in POX now to ease the implementation of JSON-RPC-over-HTTP webservices.  This will hopefully make it fairly straightforward to expose your applications’ capabilities to web clients.

POX also includes a sample webservice built using this: the OpenFlow webservice.  This currently allows a number of operations, such as querying this list of switches, getting some switch statistics, and both querying and setting flow tables.  The last one means that if you really want to, you can construct OpenFlow table entries in JSON and push them to a switch from the web.  For example, you can turn a switch into a hub by issuing the following HTTP POST:


The “flows” mentioned above are a fairly straightforward translation of the OpenFlow spec into JSON.  The rule above matches all traffic (unspecified fields are wildcards) and outputs matching packets to all ports — Presto.

Improved Web Messenger

POX’s messenger system is a mechanism to help ease the burden of communication between POX and external systems (including POX-to-other-POX communication).  The system is transport agnostic, and has had an HTTP-based transport for a while (used by POX-at-Home, for example).  Messenger has gotten a substantial makeover recently, though, and the web messenger has gotten some fixes and improvements along with it.  While the web_transport uses an ad hoc communication, we’ve also introduced a new ajax_transport.  While the name is silly, this latter one is really just long-polling JSON-RPC over HTTP interfacing with a few methods to let you interact with the messenger.

Along with the actual transport improvements, there have also been improvements and additions to services implemented atop the messenger, and you can now use those over web_transport or ajax_transport (or the straight socket tcp_transport, course).  One such addition is an OpenFlow service similar to the special-purpose OpenFlow webservice mentioned above.  Unlike that one, though, the messenger service supports notifications (I’ll come back to that in a moment).


The POX Menu opened to show current POXDesk applications

Utilizing the new OpenFlow messenger service, the new messenger’s features in general, the Qooxdoo JavaScript famework, and some repurposed code I wrote a couple of years ago, I’ve also started hacking up my own web-based POX GUI.  This also contains the start of a decent JavaScript “client side” implementation of the AJAX messenger.  POXDesk is written in a modular and multi-modal way, which I hope will make it easy for people to add on features specific to their own needs and POX-side applications.

I’ve also got a few applications to start out with.  These include some of the obvious things, such as a POX log viewer (using the log messenger service), an OpenFlow table inspector (using the new OpenFlow messenger service), and a simple force-directed topology viewer (using openflow.discovery).  There are also a couple of non-obvious ones.  As I said, the OpenFlow messenger service actually supports notifications — and this includes packet-ins.  So POXDesk also includes a reactive L2 learning switch implemented in JavaScript; it’s kind of nice, because it has a little display that shows the entries it has learned.  Secondly, POXDesk has a JavaScript terminal emulator (a heavily modified version of the one by Frank Bi).  I think there are a number of potential uses for this.  At the moment, it just gives you a bash shell, which this actually is kind of nice if you are, for example, running the Mininet VM on Windows: no need for PuTTY and a Windows X server — just a web browser.

Here’s some additional screenshots for you:

L2 Learning Switches

TopoViewer (tree)

Terminal (Mininet)

POXDesk is still really rough around the edges, and I haven’t released the code yet, but I think it’s coming along.  [Update: It’s still really rough around the edges, but the code is now public on my github account if you want it!] Likewise, it’s still early days for the new messenger stuff in POX, though that should be getting moved to the mainline quite soon. [Update: This has happened in the betta branch.]

At any rate, I hope those of you interested in doing web based GUIs with POX have found this informative, and maybe even found something you’d like to use as a base for your own work.  And please let me know if I’ve missed anything that should be mentioned here!

31 responses to POX Web Interfaces

  1. Hi,
    I’m trying to use poxdesk with POX. I probed with qooxdoo 4.1, 3.5 and 2.0.2 versions.
    With all versions I have the same problem.
    When I run the terminal in PoxDesk, the terminal saids: “Connecting to channel terminalf2k5LJBF…” and POX shows this message: “A nonexistent bot (TerminalBot) was invited to a channel”. I can’t use the terminal inside PoxDesk.
    Do you have any idea what happend?

  2. Hi,

    Thanks for the instruction. I got a problem that when open the topoViewer, all shown in the window is the dpid of the openflow switches, without the connection line between the switches. My topology is that switch2 connects to the controller through switch1 on the openflow enable port. Note that the experiment switches is openwrt devices and the controller is POX. So my question is how the topoViewer detects the line, and why there’s no line in the experiment?


  3. hi

    I am trying to use the poxdesk, but i have some errors like this.

    did i miss something?

    thank u~

    Exception happened during processing of request from (‘’, 56807)
    Traceback (most recent call last):
    File “/usr/lib/python2.7/SocketServer.py”, line 582, in process_request_thread
    self.finish_request(request, client_address)
    File “/usr/lib/python2.7/SocketServer.py”, line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    File “/home/sdn/pox/pox/web/webcore.py”, line 354, in __init__
    BaseHTTPRequestHandler.__init__(self, *args, **kw)
    File “/usr/lib/python2.7/SocketServer.py”, line 640, in __init__
    File “/usr/lib/python2.7/SocketServer.py”, line 693, in finish
    File “/usr/lib/python2.7/socket.py”, line 303, in flush
    error: [Errno 32] Broken pipe

    • I don’t think that error is necessarily fatal. It looks like your browser is closing connections when POX isn’t expecting them to be closed. POXDesk uses “long polling” — it leaves connections open and silent for potentially quite a while before sending something. My first guess is that the problem is related to this. Most modern browsers are fine with this, but things like middleboxes could certainly cause problems.

      What browser are you using? And are you using it from the same machine as the controller, or remotely? Does the UI seem to load, but things don’t work? Or… ?

      • I’m using the firefox.
        The pox and poxdesk is in the same machine.
        The UI seemed to load. when I use the ” ./pox.py forwarding.l2_learning ” , there are right flows in the openvswitch. but the l2 learning switch in poxdesk looked like it was not working.

        • The learning switch in POXDesk is a separate learning switch — it is not intended to be run at the same time as forwarding.l2_learning. You also have to explicitly connect an instance of the POXDesk learning switch to a particular switch (by selecting a switch in the Switch menu).

          If you run forwarding.l2_learning, then open the POXDesk table viewer, connect the TableViewer to one of the OpenFlow switches (again, using the Switch menu), do you see flows get added and expire?

          • Yes, when I select a switch, the flows are appearing.
            u are right, It seemed that there are some delays by using the poxdest.

            But I still get some errors like this.
            How can I fix it ?

            [web.jsonrpc ] While handling send…
            Traceback (most recent call last):
            File “/home/sdn/pox/pox/web/jsonrpc.py”, line 164, in _handle
            r = method(*params,**kw)
            File “/home/sdn/pox/pox/messenger/ajax_transport.py”, line 290, in _exec_send
            r = ses.rx(msg, seq)
            File “/home/sdn/pox/pox/messenger/ajax_transport.py”, line 246, in rx
            while self._rx_buffer[0][0] == self._rx_seq:
            IndexError: list index out of range

            [90-e2-ba-0a-bc-8e 2] Error: header:
            [90-e2-ba-0a-bc-8e 2] Error: version: 1
            [90-e2-ba-0a-bc-8e 2] Error: type: 1 (OFPT_ERROR)
            [90-e2-ba-0a-bc-8e 2] Error: length: 36
            [90-e2-ba-0a-bc-8e 2] Error: xid: 2817
            [90-e2-ba-0a-bc-8e 2] Error: type: OFPET_BAD_REQUEST (1)
            [90-e2-ba-0a-bc-8e 2] Error: code: OFPBRC_BUFFER_EMPTY (7)
            [90-e2-ba-0a-bc-8e 2] Error: datalen: 24
            [90-e2-ba-0a-bc-8e 2] Error: 0000: 01 0d 00 18 00 00 0b 01 00 00 0b a2 00 02 00 08 …………….
            [90-e2-ba-0a-bc-8e 2] Error: 0010: 00 00 00 08 ff fb 00 00

          • When you get that error, are you running both forwarding.l2_learning and the POXDesk Learning Switch? As I said, they are not meant to be run at the same time — they are two different things which try to do more or less the same thing.

  4. HI McCauley !
    When I open terminal, it appeared: connecting to channel terminalASJGHS4…. , after few minutes on logviewer appeared: code 404 message file not found on codehandler. What I should do now ?

    • Was anything working before you saw the 404 (e.g., could you use the terminal)? Was there a message on the POX console? Can you copy/paste or provide a screenshot?

      (Sidenote: the pox-dev mailing list or the forums might be a better place for this discussion.)

  5. hello,

    i successfully run poxdesk. however, when i run the following command i cant seem to get enough information like the screenshots u display on this page. the command is

    ./pox.py forwarding.l2_learning openflow.discovery samples.pretty_log web messenger messenger.log_service messenger.ajax_transport openflow.of_service poxdesk poxdesk.terminal


    • What *do* you get? If you open a browser aimed at the POX web server (localhost:8000), do you get the POXDesk interface? Can you open POXDesk “applications” from the POX menu?

      • yes i do get the poxdesk interface and i can open the applications but i get nothing in the table viewer, i can see a row in L2LS and the log viewer is empty as well

        is the controller working fine ? am i missing something ?


        • L2LS is a JavaScript learning switch — you wouldn’t want to run it at the same time you’re running l2_forwarding or some other forwarding application.

          As for the table viewer, are you selecting the switch you’d like to see the table for in the Switch menu?

          I don’t immediately know why you wouldn’t see anything in the log viewer… unless there aren’t any log messages.

  6. Hey Murphy – I’m giving the JSON-RPC a whirl from the betta branch, as such the only component I call with pox.py web.jsonrpc. Right now I’m just pushing a simple JSON HTTP POST like the one above, locally on the controller. The web.webcore.server kicks back a 501, unsupported method POST. Is there something else I need to be doing on the controller side?

    • Nevermind, just realized I need to load the openflow.webservice module instead.

      • Glad you got it figured out. :)

        The other major way to work with OpenFlow over the web is via the OpenFlow messenger service (openflow.of_service) coupled with one of the messenger’s web transports (e.g., ajax_transport). This is what POXDesk does — you can use it as an example if you want to check it out. As far as I recall, the only real reason to do this now is that it supports notifications like packet_ins.

  7. HI,begging for some help.I couldn`t read the blog of Sam Russell about how to run the web interface,becase my network is limited.So ,could u tell me at here how to work on the web interce in his way.
    Really really thank you .

    • As far as I know, his blog is really more like a how-to for building your own web interface using Django, and not a complete project with code available on github or anything. Sorry I can’t be of more help.

  8. root@long-laptop:/home/long/pox# ./pox.py samples.pretty_log web messenger messenger.log_service messenger.ajax_transport openflow.of_service poxdesk
    POX 0.0.0 / Copyright 2011-2012 James McCauley, et al.
    Traceback (most recent call last):
    File “/home/long/pox/pox/boot.py”, line 458, in boot
    if _do_launch(argv):
    File “/home/long/pox/pox/boot.py”, line 198, in _do_launch
    File “/home/long/pox/pox/web/__init__.py”, line 25, in launch
    import pox.web.webcore as wc
    File “/home/long/pox/pox/web/webcore.py”, line 71, in
    weblog = log.getChild(“server”)
    AttributeError: Logger instance has no attribute ‘getChild’
    it`s not working well.Could you help me ?Waiting for your rely online.Thank you!

  9. Hello,

    I am trying to use poxdesk with POX.
    I found the command (./pox.py samples.pretty_log web messenger messenger.log_service messenger.ajax_transport openflow.of_service poxdesk) in POXDESK wiki and tried it. But I encountered error messages.
    So I tried to modify command on reference to POX wiki “./pox.py samples.pretty_log web.webcore web.webmessenger poxdesk.tinytopo”. However I also encountered error messages as below.

    $ ./pox.py samples.pretty_log web.webcore web.webmessenger poxdesk.tinytopo
    POX 0.0.0 / Copyright 2011 James McCauley
    Traceback (most recent call last):
    File “./pox.py”, line 68, in doImport
    __import__(name, globals(), locals())
    File “/home/trident/Projects/SDN/pox/ext/poxdesk/tinytopo.py”, line 30, in
    class TinyTopo (messenger.ChannelBot):
    AttributeError: ‘module’ object has no attribute ‘ChannelBot’
    Could not import module: poxdesk.tinytopo

    How can I fix it?

    • As mentioned in the article above, POXDesk requires features from the active branch of POX, which is called betta. You are trying to use it with an older branch, which simply won’t work.

      The “Getting Started” page on the POXDesk wiki — from which you got the commandline you first tried — illustrates switching to the betta branch, so you should just go back and follow its directions (this may be as simple as doing “git checkout betta”).

      Good luck and hope that helps!

  10. Hi There,

    Can you help me in deploying web interfaces for nox controller? Because I have recently setup a nox controller with OpenFlow switch, the both of them can connect. However, I do not know how to set up a web interfaces. I tried using this command “./pox.py web.webcore –address=xxx.xxx.x.xx –port=xxxx”. However, when I run it it my switch will be disconnected :( why?


Leave a reply

You must be logged in to post a comment.

Sign in using...

Skip to toolbar