Work around bug 3005: RoutingService needs special care to keep from rule coalescing
authorFlavio Fernandes <ffernand@redhat.com>
Thu, 30 Apr 2015 20:17:58 +0000 (16:17 -0400)
committerFlavio Fernandes <ffernand@redhat.com>
Thu, 30 Apr 2015 20:35:57 +0000 (16:35 -0400)
commit23db3b447c5530f7539c7e358a0443f1454ea5c9
tree69c17545f19cc1c4cf5598fa5d2d4ad4216cef77
parentbdad3ca03c353f8d7e051019e208e419012853aa
Work around bug 3005: RoutingService needs special care to keep from rule coalescing

When rules with for RoutingService only differ on match for tun_id, the existing openflow implementation does
not distinguish them as separate rules and overrides them into a single OF entry. That is very bad for L3
forwarding, when there are more than 2 subnets, or when multiple tenants use overlapping prefixes.

Until bug 3005 is fixed, we will leverage cookie to force openflow to treat the rule as unique. Fortunately
this is easily done by using the src_tun_id itself as the cookie (i.e. no cache is needed).

Also, add segmentation info in logs for when router interface is being programmed.

vagrant@devstack-control:/vagrant/puppet/scripts$ sudo ovs-ofctl -O OpenFlow13 dump-flows br-int | grep table=60
 cookie=0x0, duration=561.894s, table=60, n_packets=219, n_bytes=26397, priority=0 actions=goto_table:70
 cookie=0x3ea, duration=468.025s, table=60, n_packets=0, n_bytes=0, priority=2048,ip,tun_id=0x3ea,nw_dst=3.0.0.0/24 actions=set_field:fa:16:3e:d6:0c:aa->eth_src,dec_ttl,set_field:0x3eb->tun_id,goto_table:70
 cookie=0x3e9, duration=470.048s, table=60, n_packets=0, n_bytes=0, priority=2048,ip,tun_id=0x3e9,nw_dst=3.0.0.0/24 actions=set_field:fa:16:3e:d6:0c:aa->eth_src,dec_ttl,set_field:0x3eb->tun_id,goto_table:70
 cookie=0x3eb, duration=467.009s, table=60, n_packets=0, n_bytes=0, priority=2048,ip,tun_id=0x3eb,nw_dst=2.0.0.0/24 actions=set_field:fa:16:3e:2d:28:89->eth_src,dec_ttl,set_field:0x3ea->tun_id,goto_table:70
 cookie=0x3eb, duration=469.035s, table=60, n_packets=0, n_bytes=0, priority=2048,ip,tun_id=0x3eb,nw_dst=1.0.0.0/24 actions=set_field:fa:16:3e:25:0d:1b->eth_src,dec_ttl,set_field:0x3e9->tun_id,goto_table:70
 cookie=0x3e9, duration=489.275s, table=60, n_packets=0, n_bytes=0, priority=2048,ip,tun_id=0x3e9,nw_dst=2.0.0.0/24 actions=set_field:fa:16:3e:2d:28:89->eth_src,dec_ttl,set_field:0x3ea->tun_id,goto_table:70
 cookie=0x3ea, duration=488.184s, table=60, n_packets=0, n_bytes=0, priority=2048,ip,tun_id=0x3ea,nw_dst=1.0.0.0/24 actions=set_field:fa:16:3e:25:0d:1b->eth_src,dec_ttl,set_field:0x3e9->tun_id,goto_table:70

Ref: https://gist.github.com/f3ba1edbab72b26c8d97
Ref: http://www.flaviof.com/blog/work/how-to-odl-with-openstack-part2.html

Change-Id: I7eb43b141f26b09a1c5870a7d494bc9c2cebecd8
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/RoutingService.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java