Hi,

Im having some issues to send a packet out message between 2 ovs. Im have 3
PCs. 2 of them act like an ovs and the third one has the Ryu controller. Im
have a vlan (vid=44) por signal traffic between both ovs and the controller
and a vlan (vid=10) just for transport between both ovs. I also have the 3
PCs physically connected by a Cisco Catalyst 2960 switch. Im figuring out
how to send a packet out from one ovs (172.16.10.10) to the other ovs
(172.16.10.20) without receiving a packet in message first. Now im sending
the packet out in the switch features handler as follows:

Switch features handler:

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

    match_miss = parser.OFPMatch()
    actions_miss = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
                                           ofproto.OFPCML_NO_BUFFER)]

    self.add_flow(datapath, 0, match_miss, actions_miss)
    match_2 = parser.OFPMatch(in_port=1, eth_type=0x800,
ipv4_dst='172.16.10.20')

    actions_out = [parser.OFPActionOutput(port=1)]
    self.add_flow(datapath, 1, match_2, actions_out)

    #I send the packet out just from one ovs:
    if msg.datapath_id == 233669375027733:
        p = packet.Packet()
        ip = ipv4.ipv4(src='172.16.10.10', dst='172.16.10.20')
        p.add_protocol(ip)
        p.serialize()
        match_out = parser.OFPMatch(in_port=1)
        out = parser.OFPPacketOut(datapath=msg.datapath,
                                buffer_id=ofproto.OFP_NO_BUFFER,
                                match=match_out, actions=actions_out,
data=p.data)
        datapath.send_msg(out)

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)

Packet in handler:

@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def packet_in_handler(self, ev):
    msg = ev.msg
    dp = msg.datapath
    ofp = dp.ofproto

    if msg.reason == ofp.OFPR_TABLE_MISS:
        reason = 'TABLE MISS'
    elif msg.reason == ofp.OFPR_APPLY_ACTION:
        reason = 'APPLY ACTION'
    elif msg.reason == ofp.OFPR_INVALID_TTL:
        reason = 'INVALID TTL'
    elif msg.reason == ofp.OFPR_ACTION_SET:
        reason = 'ACTION SET'
    elif msg.reason == ofp.OFPR_GROUP:
        reason = 'GROUP'
    elif msg.reason == ofp.OFPR_PACKET_OUT:
        reason = 'PACKET OUT'
    else:
        reason = 'unknown'

    if reason == 'PACKET OUT':
        self.logger.debug('OFPPacketIn received: '
                          'buffer_id=%x total_len=%d reason=%s '
                          'table_id=%d cookie=%d match=%s ',
                          msg.buffer_id, msg.total_len, reason,
                          msg.table_id, msg.cookie, msg.match)
        self.logger.debug('DATAPATH ADDRESS:%s', dp.address)

I never recieve a packet in message due o a packet out message. Any
help will be appreciated.

Thanks in advance.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to