From e5fbd2135b3f361d5383ed6f15aca6b1206ee715 Mon Sep 17 00:00:00 2001 From: "Claudio D. Gasparini" Date: Tue, 6 Oct 2015 11:19:43 +0200 Subject: [PATCH] BUG 4409: Routes to be withdrawn ignored. 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 --- .../java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java | 1 - .../org/opendaylight/protocol/bgp/rib/impl/PeerTest.java | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java index 5ab0d92b90..4bb8759824 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java @@ -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) { diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java index 2dda31f3e5..a26ec3c1f6 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java @@ -138,10 +138,11 @@ public class PeerTest extends AbstractRIBTestSetup { assertNotNull(testingPeer.getBgpSessionState()); } - ub.setNlri(null); + final List 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( -- 2.36.6