Hello,

I’m new to Ryu controller, currently I’m trying to add a small function to the 
simple_switch_l3.py in ryu app.  Testbed I'm using is mininet + openvswitch + 
openflow 1.3.

Function I want to implement is write a rule to modify the destination ip 
address for matching packet(Match packet whose destination ip add is 10.0.4 and 
rewrite that to 10.0.0.3). I'm trying to implement this based on existing 
simple_switch_13.py code. But now I get a error which indicate the rules is 
unable to write into the switch.

    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
    def switch_features_handler(self, ev):
        datapath = ev.msg.datapath
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        match = parser.OFPMatch()
        actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
                                          ofproto.OFPCML_NO_BUFFER)]
        self.add_flow(datapath, 0, match, actions)

#Here is what I add 
        match1 = parser.OFPMatch(ipv4_dst="10.0.0.5")
        action1 = [parser.OFPActionSetField(ipv4_dst="10.0.0.3")]
        
        self.add_flow(datapath, 2, match1, action1)

    def add_flow(self, datapath, priority, match, actions):
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
                                             actions)]

        mod = parser.OFPFlowMod(datapath=datapath, priority=priority,
                                match=match, instructions=inst)
        datapath.send_msg(mod)

After I run this code I get 

error msg ev version: 0x4 msg_type 0x1 xid 0x9168c30a 
OFPErrorMsg(code=9,data='\x04\x0e\x00X\x91h\xc3\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x0c\x80\x00\x18\x04\n\x00\x00\x05\x00\x00\x00\x00',type=4)
 type 0x4 code 0x9 0x4 0xe 0x0 0x58 0x91 0x68 0xc3 0xa 0x0 0x0 0x0 0x0 0x0 0x0 
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1 0xff 
0xff 0xff 0xff 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1 0x0 0xc 
0x80 0x0 0x18 0x4 0xa 0x0 0x0 0x5 0x0 0x0 0x0 0x0

Anyone could tell me how can I correctly write this rule to openvswitch in Ryu?

Thank you very much!

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to