Postman is a tool that we use extensively to access the Ryu REST API (ryu.app.ofctl_rest). It has been an indispensable component of our development tool chain.

Postman, a Chrome-based application (either as a Chrome App or a standalone application),  is a web browser technology that simplifies accessing the the Ryu REST API by providing an environment to craft, send HTTP requests and receive replays. Postman is especially helpful in working with the long JSON  structures required by the Ryu REST API to query OpenFlow switches.

The key features that we use every day:

  • Send requests quickly
    Create and send any HTTP request using the awesome Postman request builder
  • Organize using Collections
    Create collections and folders to group your requests logically
  • Save requests
    Every request you send is saved to the history and can be replayed later
  • Customize with scripts
    Change the request parameters at runtime using your custom scripts
  • Robust testing framework
    Write your own test cases to validate response data, response times, and more!
  • Automate Collections
    Run entire collections or folders with a single click, and view all test results on one screen

Download at Postman Download Page

Postman in Action with Ryu API

Here are some examples of postman being used to probe an active OpenFlow switch.

REST Get Example

The image below shows a simple REST Get request that will return a description of the the Group Table in a JSON format. (click to see full view)

intro-groupdesc

The left side panel is showing a history for recent HTTP requests conducted via Postman. The right hand panel is where a HTTP request in constructed and then sent. It is also the area that results are displayed.

In this example, a Ryu REST Get is being constructed. A Get is a URL-based request. In the image the URL request constructed is http://192.168.2.105:8080/stats/groupdesc/.

The request displayed is ready to go. The next step is to click the Send button. The result set, a description of the flow entries – group_id, buckets, actions, etc – of the Group Table .

In this example the request structure is a simple URL. The real value of Postman is in presenting the complex JSON result file is a readable form

REST Post Example

The image below shows a complex REST Post request that will add a flow to a switch. (click to see full view)

intro-addflow

Ryu REST Post requests are complex to construct because they have both a URL and a message body that is a complex JSON file.

In this example, a Ryu Post request is being constructed. The URL – http://192.168.2.105:8080/stats/flowentry/add – is asking the Ryu controller to add a flow. The details of which switch to flow is being added to, the flow table, and the specifics of the flow rule are embedded in the message bode, JSON file.

In the above graphic, you can see the JSON message being constructed. Postman understands JSON and formats the data in an easy to read structure. The request is fully formed and ready for the Send button to be clicked.

The Value of request History

The Ryu REST Post request above provides a perfect example of why the request history is so valuable. The history saves both the URL and the message components of a request. So, in the case above, after adding the first flow it is easy to use that request as a “template” for the next flow entry that you want to test.

First Build Understanding of OF-DPA via the interactive Ryu REST API

The Postman request history make the learning process of probing a Ryu controlled switch to see how it works much easier. This should be the starting point of everyone new to the OF-DPA pipeline. Get hands-on experience thorough the Ryu REST API. Only move to crafting Ryu Python script to after you have a good understanding of the OF-DPA environment build via the Ryu REST API.