Hi,

I am writing a Ryu controller with the same functionalities as the POX
controller i already have.
The code below is for POX:
def install_vf_video(self):
        for vf in VideoStream_Objs:
            msg = of.ofp_flow_mod()
            msg.match = of.ofp_match(dl_dst=VideoStream_Objs[vf].video_mac,
                                     dl_src=VideoStream_Objs[vf].server_mac)
            msg.idle_timeout = of.OFP_FLOW_PERMANENT
            msg.hard_timeout = of.OFP_FLOW_PERMANENT
            msg.priority = 100

msg.actions.append(of.ofp_action_dl_addr.set_dst(VideoStream_Objs[vf].final_v_dl_dst))

msg.actions.append(of.ofp_action_nw_addr.set_dst(VideoStream_Objs[vf].final_v_nw_dst))

msg.actions.append(of.ofp_action_tp_port.set_dst(VideoStream_Objs[vf].final_v_tp_dst))

msg.actions.append(of.ofp_action_tp_port.set_src(VideoStream_Objs[vf].final_v_tp_src))
            msg.actions.append(of.ofp_action_output(port=of.OFPP_FLOOD))
            core.openflow.sendToDPID(self.dpid, msg)  # send flow
modification
        log.info('Installed Video flow for switch %s', self.connection)

I tried doing this on Ryu but it doesn't work:
def install_vf_video(self):
    for vf in VideoStream_Objs: #eth_type=0x08000
        match = parser.OFPMatch(eth_dst=VideoStream_Objs[vf].video_mac,
                       eth_src=VideoStream_Objs[vf].server_mac)
actions = [
   parser.OFPActionSetField(eth_dst=VideoStream_Objs[vf].final_v_dl_dst),
   parser.OFPActionSetField(ip_dst=VideoStream_Objs[vf].final_v_nw_dst),
   parser.OFPActionSetField(tcp_dst=VideStream_Objs[vf].final_v_tp_dst),
   parser.OFPActionSetField(tcp_src=VideoStream_Objs[vf].final_v_tp_src),
   parser.OFPActionOutput(ofproto.OFPP_FLOOD)]

        self.add_flow(datapath, 100, match, actions)
    self.logger.info("Installed Video flow for switch %s",
dpid_to_str(dpid))

If someone could help me I would greatly appreciate it.
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to