Dear Ryu support team,

I have a pretty simple Ryu app which should keep the datapath when
initialized and send a packet to the switch whenever the send_packet method
is triggered.

The problem is that the switch doesn't get the packet and whenever the
send_packet is triggered the datapath is being reset.

Here is the simplified version of my app:

class PacketTracingController(app_manager.RyuApp):

    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)

    def initialize_on_connect(self, ev):
        self._datapath = ev.msg.datapath

        self.log.info('set datapath: {}'.format(self._datapath.id))

    @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
    def handle_packet_in_user_space(self, ev):
        msg = ev.msg
        self.log.info("table_id: {}".format(msg.table_id))
        self.log.info("received data: {}".format(msg.data))

    def send_packet(self, packet):

        data = packet.data
        ofproto = self._datapath.ofproto
        ofp_parser = self._datapath.ofproto_parser
        req = ofp_parser.OFPPacketOut(datapath=self._datapath,
                                      buffer_id=ofproto.OFP_NO_BUFFER,
                                      in_port=ofproto.OFPP_LOCAL,
                                      actions=[],
                                      data=data)
    self._datapath.send_msg(req)
    self.log.info(
        'dp.id: {} pkt: {}'.format(self._datapath.id, packet))



Here is how I trigger the send_packet:

# ... Initialize with AppManager.run_apps and do some other initializations

# Create a sample packet
pkt = ethernet.ethernet(ethertype=ETH_TYPE_ARP) /\
    arp.arp(src_ip='192.168.70.2', dst_ip='192.168.70.3')
pkt.serialize()


manager = AppManager.get_instance()
manager.applications[PacketTracingController.__name__] \
.send_packet(pkt.data)

import time
time.sleep(5)



Here are all the flows installed on the switch:

NXST_FLOW reply (xid=0x4):
cookie=0x0, table=0, n_packets=0, n_bytes=0,
priority=5,ip,nw_dst=192.168.128.0/24 actions=CONTROLLER:65535
cookie=0x0, table=0, n_packets=0, n_bytes=0, priority=0 actions=resubmit(,1)
cookie=0x0, table=1, n_packets=0, n_bytes=0, priority=10,in_port=32768
actions=set_field:0x1->reg1,resubmit(,2),set_field:0->reg0
cookie=0x0, table=1, n_packets=0, n_bytes=0, priority=10,in_port=LOCAL
actions=set_field:0x10->reg1,resubmit(,2),set_field:0->reg0
cookie=0x0, table=2, n_packets=0, n_bytes=0,
priority=10,arp,reg1=0x10,arp_tpa=192.168.128.0/24
actions=move:NXM_OF_ETH_SRC[]->NXM_OF_ETH_DST[],mod_dl_src:7a:f5:18:a2:71:45,load:0x2->NXM_OF_ARP_OP[],move:NXM_NX_ARP_SHA[]->NXM_NX_ARP_THA[],load:0x7af518a27145->NXM_NX_ARP_SHA[],move:NXM_OF_ARP_TPA[]->NXM_NX_REG0[],move:NXM_OF_ARP_SPA[]->NXM_OF_ARP_TPA[],move:NXM_NX_REG0[]->NXM_OF_ARP_SPA[],IN_PORT
cookie=0x0, table=2, n_packets=0, n_bytes=0,
priority=7,arp,reg1=0x10,reg5=0x1 actions=CONTROLLER:65535
cookie=0x0, table=2, n_packets=0, n_bytes=0, priority=0,arp,reg1=0x10
actions=drop
cookie=0x0, table=2, n_packets=0, n_bytes=0, priority=0,ip,reg1=0x1
actions=set_field:7a:f5:18:a2:71:45->eth_dst,resubmit(,3),set_field:0->reg0
cookie=0x0, table=2, n_packets=0, n_bytes=0, priority=0
actions=resubmit(,3),set_field:0->reg0
cookie=0x0, table=3, n_packets=0, n_bytes=0, priority=0
actions=resubmit(,4),set_field:0->reg0
cookie=0x0, table=4, n_packets=0, n_bytes=0, priority=0
actions=resubmit(,5),set_field:0->reg0
cookie=0x1, table=5, n_packets=0, n_bytes=0,
priority=0,ip,reg1=0x10,metadata=0x1/0x1 actions=CONTROLLER:65535
cookie=0x1, table=5, n_packets=0, n_bytes=0,
priority=0,ip,reg1=0x1,metadata=0x1/0x1 actions=CONTROLLER:65535
cookie=0x0, table=6, n_packets=0, n_bytes=0, priority=0,ip,reg1=0x10
actions=resubmit(,7),set_field:0->reg0
cookie=0x0, table=6, n_packets=0, n_bytes=0, priority=0,ip,reg1=0x1
actions=resubmit(,7),set_field:0->reg0
cookie=0x0, table=7, n_packets=0, n_bytes=0, priority=0,ip,reg1=0x10
actions=resubmit(,20),set_field:0->reg0
cookie=0x0, table=7, n_packets=0, n_bytes=0, priority=0,ip,reg1=0x1
actions=resubmit(,20),set_field:0->reg0
cookie=0x0, table=20, n_packets=0, n_bytes=0, priority=0,reg1=0x10
actions=output:32768
cookie=0x0, table=20, n_packets=0, n_bytes=0, priority=0,reg1=0x1 actions=LOCAL


Here is what I see when triggering send_packet:

INFO:logger set datapath: 135193098875205
INFO:logger: dp.id: 135193098875205 pkt:
ethernet(dst='ff:ff:ff:ff:ff:ff',ethertype=2054,src='00:00:00:00:00:00'),
arp(dst_ip='0.0.0.0',dst_mac='ff:ff:ff:ff:ff:ff',hlen=6,hwtype=1,opcode=1,plen=4,proto=2048,src_ip='0.0.0.0',src_mac='ff:ff:ff:ff:ff:ff')
INFO:logger: disconnect
INFO:logger:ArpController:Setting default eth_dst to gtp_br0
INFO:logger set datapath: 135193098875205


Can you please point me to what I might be doing wrong?
Thanks

Best,
Martin
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to