Hi Alan,

> Is there a technique/utility that is used to convert a Ryu class instance 
> into JSON and possibly back again?

Does "Ryu class instance" mean "OpenFlow message class instance"?
Then, As far as I know it is possible.

The example is as follows:

    ins = parser.OFPFlowMod(datapath=datapath, priority=priority,
                            match=match, instructions=inst)
    # to_jsondict
    json = ins.to_jsondict()
    
    # from_jsondict
    ins2 = ofproto_parser.ofp_msg_from_jsondict(datapath, json)
    
    print str(ins)
    print str(ins2)

note:
  str(ins) and str(ins2) will be shown at the same results.

More detail is described in the following document.

[to_jsondict]
https://ryu.readthedocs.org/en/latest/ofproto_base.html?highlight=to_jsondict#ryu.ofproto.ofproto_parser.MsgBase.to_jsondict

[ofp_msg_from_jsondict]
https://ryu.readthedocs.org/en/latest/ofproto_base.html?highlight=json#ryu.ofproto.ofproto_parser.ofp_msg_from_jsondict

thanks,

On 2016年02月09日 08:27, Alan Deikman wrote:
> Is there a technique/utility that is used to convert a Ryu class instance 
> into JSON and possibly back again?   For example an OFPFlowMod.  
> 
> I have been writing dual track: one in Python and one in JSON.  It would be a 
> big labor saver if there were some programmatic way to do this.  
> 
> ----------------------------
> Alan Deikman
> ZNYX Networks, Inc.
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to