On Fri, 01 Mar 2019 10:55:21 +0900,
David Christensen wrote:
>
> I'm trying to create a ryu application for a Mellanox Switch-X switch
> which supports Openflow 1.0. In my test setup I have a single server
> connected to two ports of the switch and I'd like the switch to
> perform the following actions:
>
> 1) If a packet is received on port 104, send it to port 102
> 2) If a packet is received on port 102, send it to port 104
> 3) Drop any other packets from any other interfaces
>
> The resulting behavior should be the same as if I had connected a
> cable from port 1 to port 2 of the server's NIC (i.e. a loopback
> configuration), but I'm having some issues and I can't tell if it's
> the ryu script or the Mellanox switch operation.
>
> I've adapted the simple_switch.py application and send my flow rules
> to the switch as soon as I receive the OFPSwitchFeatures message from
> the switch. (Some of the log output is included below.)
>
> The switch seems to be accepting the rules (see switch output even
> further below) but no packets are ever forwarded. Can anyone comment
> on what I might be doing wrong in my application or point to an
> example that performs a similar function?
I'm not familiar with that hardware.
> ======================================================================
> === Log output from host_loopback.py
> ======================================================================
> loading app /src/host_loopback.py
> loading app ryu.controller.ofp_handler
> instantiating app /src/host_loopback.py of HostLoopback
> instantiating app ryu.controller.ofp_handler of OFPHandler
> BRICK HostLoopback
> CONSUMES EventOFPPortStatus
> CONSUMES EventOFPSwitchFeatures
> CONSUMES EventOFPPacketIn
> CONSUMES EventOFPStateChange
> BRICK ofp_event
> PROVIDES EventOFPPortStatus TO {'HostLoopback': set(['main'])}
> PROVIDES EventOFPSwitchFeatures TO {'HostLoopback': set(['config'])}
> PROVIDES EventOFPPacketIn TO {'HostLoopback': set(['main'])}
> PROVIDES EventOFPStateChange TO {'HostLoopback': set(['main', 'dead'])}
> CONSUMES EventOFPPortStatus
> CONSUMES EventOFPEchoReply
> CONSUMES EventOFPSwitchFeatures
> CONSUMES EventOFPPortDescStatsReply
> CONSUMES EventOFPHello
> CONSUMES EventOFPErrorMsg
> CONSUMES EventOFPEchoRequest
> connected socket:<eventlet.greenio.base.GreenSocket object at
> 0x7f5fbd3c2050> address:('9.114.219.191', 51133)
> hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x7f5fbd3c2950>
> move onto config mode
> EVENT ofp_event->HostLoopback EventOFPSwitchFeatures
> switch features ev
> version=0x1,msg_type=0x6,msg_len=0x80,xid=0x439c6c3c,OFPSwitchFeatures(actions=15,capabilities=11,datapath_id=16045481059359733200L,n_buffers=0,n_tables=1,ports={104:
> OFPPhyPort(port_no=104,hw_addr='00:02:c9:65:35:a7',name='Eth1/6',config=0,state=0,curr=0,advertised=0,supported=0,peer=0),
> 102:
> OFPPhyPort(port_no=102,hw_addr='00:02:c9:65:35:a5',name='Eth1/5',config=0,state=0,curr=0,advertised=0,supported=0,peer=0)})
> move onto main mode
> EVENT ofp_event->HostLoopback EventOFPStateChange
> ======================================================================
> === This OFPFlowMod is intended to route packets from
> === port 104 to port 102
> ======================================================================
> mod:
> version=None,msg_type=None,msg_len=None,xid=None,OFPFlowMod(actions=[OFPActionOutput(max_len=65509,port=102)],buffer_id=4294967295,command=0,cookie=0,flags=1,hard_timeout=0,idle_timeout=0,match=OFPMatch(dl_dst='\x00\x00\x00\x00\x00\x00',dl_src='\x00\x00\x00\x00\x00\x00',dl_type=0,dl_vlan=0,dl_vlan_pcp=0,in_port=104,nw_dst=0,nw_proto=0,nw_src=0,nw_tos=0,tp_dst=0,tp_src=0,wildcards=4194302),out_port=102,priority=32768)
I think out_port should be OFPP_NONE,
and max_len in the OFPActionOutput should be meaningless as the
specified output port isn't the controller.
> match:
> OFPMatch(dl_dst='\x00\x00\x00\x00\x00\x00',dl_src='\x00\x00\x00\x00\x00\x00',dl_type=0,dl_vlan=0,dl_vlan_pcp=0,in_port=102,nw_dst=0,nw_proto=0,nw_src=0,nw_tos=0,tp_dst=0,tp_src=0,wildcards=4194302),
> actions: [OFPActionOutput(max_len=65509,port=104)]
> ======================================================================
> === This OFPFlowMod is intended to route packets from
> === port 102 to port 104
> ======================================================================
> mod:
> version=None,msg_type=None,msg_len=None,xid=None,OFPFlowMod(actions=[OFPActionOutput(max_len=65509,port=104)],buffer_id=4294967295,command=0,cookie=0,flags=1,hard_timeout=0,idle_timeout=0,match=OFPMatch(dl_dst='\x00\x00\x00\x00\x00\x00',dl_src='\x00\x00\x00\x00\x00\x00',dl_type=0,dl_vlan=0,dl_vlan_pcp=0,in_port=102,nw_dst=0,nw_proto=0,nw_src=0,nw_tos=0,tp_dst=0,tp_src=0,wildcards=4194302),out_port=104,priority=32768)
> ======================================================================
> === This OFPFlowMod is intended to drop all other traffic that doesn't
> === match the previous two rules
> ======================================================================
> mod:
> version=None,msg_type=None,msg_len=None,xid=None,OFPFlowMod(actions=[],buffer_id=4294967295,command=0,cookie=0,flags=1,hard_timeout=0,idle_timeout=0,match=OFPMatch(dl_dst='\x00\x00\x00\x00\x00\x00',dl_src='\x00\x00\x00\x00\x00\x00',dl_type=0,dl_vlan=0,dl_vlan_pcp=0,in_port=0,nw_dst=0,nw_proto=0,nw_src=0,nw_tos=0,tp_dst=0,tp_src=0,wildcards=4194303),out_port=65535,priority=0)
> switch is running
>
>
> ======================================================================
> === Mellanox switch output
> ======================================================================
> switch-5ecae6 (config) # enable
> switch-5ecae6 (config) # configure terminal
> switch-5ecae6 (config) # show openflow flows
>
> Flow id: 52
> priority: 32768
> hard timeout: infinite
> idle timeout: 0 sec
> ingress interface: Eth1/6
> actions:
> output port Eth1/5
> statistics:
> 0 packets, 0 bytes
>
> Flow id: 53
> priority: 32768
> hard timeout: infinite
> idle timeout: 0 sec
> ingress interface: Eth1/5
> actions:
> output port Eth1/6
> statistics:
> 558740 packets, 0 bytes
The statistics suggests that packets are matched, at least.
> Flow id: 54
> priority: 0
> hard timeout: infinite
> idle timeout: 0 sec
> actions:
> output drop
> statistics:
> 0 packets, 0 bytes
>
>
--
IWAMOTO Toshihiro
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel