Thank you Fujimoto for your response!,
controller is indeed connecting to the OVS. Both the data traffic and
the control traffic are on the same in-port interface . Yes you are
right about that. Please see the response from the controller:
egistered VCS backend: hg
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Registered VCS backend: svn
Registered VCS backend: bzr
loading app ..\ryu\app\sdnclient.py
loading app ryu.controller.ofp_handler
instantiating app ..\ryu\app\sdnclient.py of ExampleSwitch13
instantiating app ryu.controller.ofp_handler of OFPHandler
BRICK ExampleSwitch13
CONSUMES EventOFPPacketIn
CONSUMES EventOFPSwitchFeatures
BRICK ofp_event
PROVIDES EventOFPPacketIn TO {'ExampleSwitch13': {'main'}}
PROVIDES EventOFPSwitchFeatures TO {'ExampleSwitch13': {'config'}}
CONSUMES EventOFPEchoReply
CONSUMES EventOFPEchoRequest
CONSUMES EventOFPErrorMsg
CONSUMES EventOFPHello
CONSUMES EventOFPPortDescStatsReply
CONSUMES EventOFPPortStatus
CONSUMES EventOFPSwitchFeatures
I am getting the following PacketIN messages:- ( the comment below
are some prints and actions I am taking to extract just the TCP flows
only.. )
Traffic udp: src_port, dst_port 53658 1900
EVENT ofp_event->ExampleSwitch13 EventOFPPacketIn
i am here.: 1
printing src, dst ip address, protocol id: 192.168.0.222
239.255.255.250 17
ignoring the packet...
Traffic udp: src_port, dst_port 53658 1900
EVENT ofp_event->ExampleSwitch13 EventOFPPacketIn
i am here.: 1
printing src, dst ip address, protocol id: 192.168.0.222
239.255.255.250 17
ignoring the packet...
Traffic udp: src_port, dst_port 53658 1900
EVENT ofp_event->ExampleSwitch13 EventOFPPacketIn
i am here.: 1
printing src, dst ip address, protocol id: 192.168.0.222
239.255.255.250 17
ignoring the packet...
Traffic udp: src_port, dst_port 53658 1900
EVENT ofp_event->ExampleSwitch13 EventOFPPacketIn
i am here.: 1
printing src, dst ip address, protocol id: 192.168.0.222
239.255.255.250 17
ignoring the packet...
Traffic udp: src_port, dst_port 53658 1900
EVENT ofp_event->ExampleSwitch13 EventOFPPacketIn
i am here.: 1
printing src, dst ip address, protocol id: 192.168.0.222
239.255.255.250 17
ignoring the packet...
Traffic udp: src_port, dst_port 53658 1900
On running the fail-mode command, i don't see any fail mode when I ran
the above command with ovs-vsctl.
summing up :-
a. controller does connect to the OVS from the same client that is
initiating a data traffic.
b. The default sample code that did layer-2 mac based flow table
provisioning does work.
c. The challenge is when I want to do detailed flow entries with tcp
port details. I also added the following code to create flow table
entry ( see the code in bold) , but it did not work:-
def _handle_tcp(self, datapath,ipv4_pkt,eth_pkt,tcp_pkt, in_port):
pkt=packet.Packet()
pkt.add_protocol(ethernet.ethernet(ethertype=eth_pkt.ethertype,
src=eth_pkt.src,
dst=eth_pkt.dst))
pkt.add_protocol(ipv4.ipv4(src=ipv4_pkt.src,dst=ipv4_pkt.dst,
proto=ipv4_pkt.proto))
pkt.add_protocol(tcp.tcp(dst_port=tcp_pkt.dst_port,
src_port=tcp_pkt.src_port))
# learn a mac address to avoid FLOOD next time.
self.mac_to_port[datapath.id
<http://datapath.id>][eth_pkt.src] = in_port
# if the destination mac address is already learned,
# decide which port to output the packet, otherwise FLOOD.
if eth_pkt.dst in self.mac_to_port[datapath.id
<http://datapath.id>]:
out_port = self.mac_to_port[datapath.id
<http://datapath.id>][eth_pkt.dst]
else:
out_port = datapath.ofproto.OFPP_FLOOD
parser=datapath.ofproto_parser
*action=[parser.OFPActionOutput(port=out_port)]*
*if out_port != datapath.ofproto.OFPP_FLOOD:*
* match = parser.OFPMatch(in_port=in_port,
eth_dst=eth_pkt.dst)*
* '''*
*eth_src=eth_pkt.src,ipv4_src=ipv4_pkt.src,*
*ipv4_dst=ipv4_pkt.dst,tcp_src=tcp_pkt.src_port,*
*tcp_dst=tcp_pkt.dst_port,ip_proto=ipv4_pkt.proto)*
* '''*
* self.add_flow(datapath, 1, match, action)*
*
*
*
*
*My goal is simple:-*
*create explicit flow table entries based on select tcp ports -
bi-directional . everything else is blocked. How do i do that ?*
*
*
*thanks a ton for your response*
*
*
*best regards*
*Sunil*
On Mon, Aug 28, 2017 at 5:34 PM, Fujimoto Satoshi
<satoshi.fujimo...@gmail.com <mailto:satoshi.fujimo...@gmail.com>> wrote:
Hi, Sunil
I guess that the controller could not connect to the OVS.
Please confirm it by running controller with "--verbose" option.
If connected, you will see "move onto config mode" message in stdout.
$ryu-manager ryu/app/simple_switch_13.py --verbose
Registered VCS backend: git
Registered VCS backend: hg
(...snip...)
connected socket:<eventlet.greenio.base.GreenSocket object at
0x7f20c43efd68> address:('127.0.0.1', 33670)
hello ev <ryu.controller.ofp_event.EventOFPHello object at
0x7f20c43ef0b8>
move onto config mode
EVENT ofp_event->SimpleSwitch13 EventOFPSwitchFeatures
I think the client and the controller cannot share one interface.
So you need another port to connect the controller and OVS.
(for controller)
┌------------┐
PC ----------- OVS -------- Server
(for client)
FYI, fail mode of OVS may be the cause of the packet passing
without flow entries.
If the fail mode is "standalone" and OVS cannot connect to its
controller, OVS works as an L2 switch, so the packet will be passed.
You can see the current fail mode by running this command:
$ovs-vsctl get-fail-mode [bridge]
Thanks,
Fujimoto
On 2017年08月28日 15:25, Sunil wrote:
Hello Ryu experts!,
I am trying to create a simple PacketOut for a TCP packet and I
had followed the example code provided for the ICMP. I modified
the sample_switch_13 application . Please find the code below. I
am not sure why the flow table is not created and my traffic is
passed. I am fairly new to the controller and therefore
requesting some help. I have an raspberry pi running OVS and it
has 2 ports. One input ( eth0 -port1 and one output eth1-port2).
Both are defined as part of the br-int bridge.
My topology has a edge device ( PC) connected to the OVS (
rasberry pi). The other end of the Raspberry pi is connected to
the server. I am running a simple client ( PC) to the server (
Linux) via the Raspberry pi ( OVS). Client is connected to eth0 (
port 1) and server is connected to eth1 ( port 2).
My controller is also running the edge device (PC). what am I
doing wrong ?.
Also, do I need to create 2 separate flow entries - one for
client to server and other for server to client or it is created
as part of the PacketOut ( once the below code is fixed ).
Your help will be greatly appreciated here!
def _handle_tcp(self, datapath,ipv4_pkt,eth_pkt,tcp_pkt, in_port):
pkt=packet.Packet()
pkt.add_protocol(ethernet.ethernet(ethertype=eth_pkt.ethertype,
src=eth_pkt.src,
dst=eth_pkt.dst))
pkt.add_protocol(ipv4.ipv4(src=ipv4_pkt.src,dst=ipv4_pkt.dst,
proto=ipv4_pkt.proto))
pkt.add_protocol(tcp.tcp(dst_port=tcp_pkt.dst_port,
src_port=tcp_pkt.src_port))
# learn a mac address to avoid FLOOD next time.
self.mac_to_port[datapath.id
<http://datapath.id>][eth_pkt.src] = in_port
# if the destination mac address is already learned,
# decide which port to output the packet, otherwise FLOOD.
if eth_pkt.dst in self.mac_to_port[datapath.id
<http://datapath.id>]:
out_port = self.mac_to_port[datapath.id
<http://datapath.id>][eth_pkt.dst]
else:
out_port = datapath.ofproto.OFPP_FLOOD
self._send_packet(datapath, in_port
,pkt,out_port)
def _send_packet(self,datapath, port, pkt,out_port):
print( "PRINTING INPORT AND OUTPORT......:",port,out_port)
ofproto=datapath.ofproto
parser=datapath.ofproto_parser
pkt.serialize()
data=pkt.data
action=[parser.OFPActionOutput(port=port)]
out=parser.OFPPacketOut(datapath=datapath,
buffer_id=ofproto.OFP_NO_BUFFER,
in_port=ofproto.OFPP_CONTROLLER,actions=action,
data=data)
datapath.send_msg(out)
------------------------------------------------------------------------------
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
<mailto:Ryu-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/ryu-devel
<https://lists.sourceforge.net/lists/listinfo/ryu-devel>
------------------------------------------------------------------------------
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