Hey there everyone,
I am working on this simple routing application where it proactively finds
the shortest and the longest paths from a source to a destination, and
installs the flow entries on the switches in a path.

It uses networkx.shortest_simple_paths() to calculate the paths (this
function calculates the paths and sort them from the shortest to the
longest). In small network topologies the app works fine. In denser
topologies (e.g. 3x3 torus topology) when I use shortest path to forward
traffic it works. However, when I try to install the flow entries for the
longest paths, nothing happens. Even though, the match and flow rules are
created and sent to the switches. They are not being installed and no error
is raised. When I use ovs-ofctl it shows that the flow tables are empty. I
would appreciate it, if someone could tell me what are some of the possible
causes of this behavior.


The function that installs the flow entries is as follows (I took this code
from this
<https://github.com/muzixing/ryu/blob/master/ryu/app/network_awareness/shortest_forwarding.py>
Ryu app, even in the original app I observe the same behavior).


def install_flow(self, datapaths, link_to_port, access_table, path,
flow_info, buffer_id, data=None):
'''
Install flow entires for roundtrip: go and back.
@parameter: path=[dpid1, dpid2...]
flow_info=(eth_type, src_ip, dst_ip, in_port)
'''
if path is None or len(path) == 0:
self.logger.info("Path error!")
return
in_port = flow_info[3]
first_dp = datapaths[path[0]]
out_port = first_dp.ofproto.OFPP_LOCAL
back_info = (flow_info[0], flow_info[2], flow_info[1])

self.logger.info("--------------[MAIN_APP][install_flow]\n"
"datapath %s,\n in_port %s,\n L2P %s,\n access_table %s,\n path %s,\n
flow_info %s\n, back_info %s"
"------------------------------------------------------- ",
datapaths, in_port, link_to_port, access_table, path, flow_info, back_info)

# inter_link
if len(path) > 2:

for i in xrange(1, len(path) - 1):
self.logger.info("[DEBUG][MAIN_APP][install_flow] path > 2 | i = %s, flow
%s, path %s, sw %s",
i, flow_info, path, path[i])

port = self.get_port_pair_from_link(link_to_port,
path[i - 1], path[i])
port_next = self.get_port_pair_from_link(link_to_port,
path[i], path[i + 1])
if port and port_next:
src_port, dst_port = port[1], port_next[0]
datapath = datapaths[path[i]]
self.send_flow_mod(datapath, flow_info, src_port, dst_port)
self.send_flow_mod(datapath, back_info, dst_port, src_port)
self.logger.info("[DEBUG][MAIN_APP][install_flow] path > 2 |inter_link flow
install")
if len(path) > 1:
# the last flow entry: tor -> host

port_pair = self.get_port_pair_from_link(link_to_port,
path[-2], path[-1])
self.logger.info("[DEBUG][MAIN_APP][install_flow] path > 1 | flow %s, path
%s, link(%s, %s)=port(%s)",
flow_info, path, path[-2], path[-1], port_pair)

if port_pair is None:
self.logger.info("Port is not found")
return
src_port = port_pair[1]

dst_port = self.get_port(flow_info[2], access_table)
if dst_port is None:
self.logger.info("Last port is not found.")
return

last_dp = datapaths[path[-1]]
self.send_flow_mod(last_dp, flow_info, src_port, dst_port)
self.send_flow_mod(last_dp, back_info, dst_port, src_port)

# the first flow entry
port_pair = self.get_port_pair_from_link(link_to_port,
path[0], path[1])
if port_pair is None:
self.logger.info("Port not found in first hop.")
return
out_port = port_pair[0]
self.send_flow_mod(first_dp, flow_info, in_port, out_port)
self.send_flow_mod(first_dp, back_info, out_port, in_port)
self.send_packet_out(first_dp, buffer_id, in_port, out_port, data)

# src and dst on the same datapath
else:
out_port = self.get_port(flow_info[2], access_table)
self.logger.info("[DEBUG][MAIN_APP][install_flow] esle: outport %s, dst_ip:
%s", out_port, flow_info[2])
if out_port is None:
self.logger.info("Out_port is None in same dp")
return
self.send_flow_mod(first_dp, flow_info, in_port, out_port)
self.send_flow_mod(first_dp, back_info, out_port, in_port)
self.send_packet_out(first_dp, buffer_id, in_port, out_port, data)
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to