Work around bug 3005: RoutingService needs special care to keep from rule coalescing 10/19410/1
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)
commitf5c7cce3e285cf6552571ef6257cb6568846c552
treecbb05a4af63f27028b882a26946d8fc2c042571b
parentf16cf374d5da6786dbd9a47921df4d3cd0a021b0
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