BUG 4409: Routes to be withdrawn ignored. 51/27951/1
authorClaudio D. Gasparini <cgaspari@cisco.com>
Tue, 6 Oct 2015 09:19:43 +0000 (11:19 +0200)
committerClaudio D. Gasparini <cgaspari@cisco.com>
Tue, 6 Oct 2015 09:19:43 +0000 (11:19 +0200)
Routes to be withdrawn ignored when UPDATE contains both
WITHDRAWN ROUTES and NLRI fields. RFC4271 specify that
an UPDATE message MAY simultaneously advertise a feasible route and
withdraw multiple unfeasible routes from service.

Change-Id: I77c810ed7ddb1eda55021ddd05414198f66ec7ec
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java

index 5ab0d92b90369904cf0214f77386dd0c52bec8b3..4bb87598245fcd5757aff1dee9e7968465277605 100644 (file)
@@ -122,7 +122,6 @@ public class BGPPeer implements ReusableBGPPeer, Peer, AutoCloseable, BGPPeerRun
         }
         if (mpReach != null) {
             this.ribWriter.updateRoutes(mpReach, nextHopToAttribute(attrs, mpReach));
-            return;
         }
         MpUnreachNlri mpUnreach = null;
         if (message.getWithdrawnRoutes() != null) {
index 2dda31f3e5cc16c7b6b27a44aa1939e1ddf8d940..a26ec3c1f6a4a95d38f3697750f89344be2b3865 100644 (file)
@@ -138,10 +138,11 @@ public class PeerTest extends AbstractRIBTestSetup {
             assertNotNull(testingPeer.getBgpSessionState());
         }
 
-        ub.setNlri(null);
+        final List<Ipv4Prefix> prefs2 = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"), new Ipv4Prefix("8.0.1.16/28"));
+        ub.setNlri(new NlriBuilder().setNlri(prefs2).build());
         ub.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setWithdrawnRoutes(prefs).build());
         this.classic.onMessage(this.session, ub.build());
-        assertEquals(0, this.routes.size());
+        assertEquals(2, this.routes.size());
         this.classic.onMessage(this.session, new KeepaliveBuilder().build());
         this.classic.onMessage(this.session, new UpdateBuilder().setAttributes(
             new AttributesBuilder().addAugmentation(