faucetsdn / ryu

Ryu component-based software defined networking framework

Home Page:https://ryu-sdn.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a flow entry together with table-miss when starting the Ryu controller!

chitsukhin opened this issue · comments

Hello! everyone advise me plz....
I wanna to add flow entry together with table miss entry in every switch in the topology when starting the ryu controller.
the flow entry that i want to added is

match = parser.OFPMatch(in_port=in_port, eth_dst=('33:33:00:00:00:fb'))
actions = drop

I edit the code to add a flow in simple-switch_13.py

_@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

    # install the table-miss flow entry.
    match = parser.OFPMatch()
    matchmulti = parser.OFPMatch(in_port=in_port, eth_dst=('33:33:00:00:00:fb'))
    actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
                                      ofproto.OFPCML_NO_BUFFER)]
    actionsmulti = [parser.OFPActionOutput(ofproto.OFPP_FLOOD)]        
    self.add_flow(datapath, 0, match, actions)
    self.add_flow(datapath, 0, matchmulti, actionsmulti)_

/home/chitsu/Pictures/1.jpg

but It's not okay the code.
plz, give me the correct code.
I'm poor in coding.

I can solve the error!
install the table-miss flow entry.
match = parser.OFPMatch()
matchmulti = parser.OFPMatch(eth_type=0x0800, eth_dst=('33:33:00:00:00:fb'))
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
ofproto.OFPCML_NO_BUFFER)]
actionsmulti = ""
self.add_flow(datapath, 0, match, actions)
self.add_flow(datapath, 1, matchmulti, actionsmulti)