Bug 7192 - Inter-VPN link routes BGP leaking not working 59/47659/10
authorMiguel Perez <francisco.miguel.perez@ericsson.com>
Thu, 27 Oct 2016 09:15:14 +0000 (11:15 +0200)
committerMiguel Perez <francisco.miguel.perez@ericsson.com>
Tue, 22 Nov 2016 13:42:06 +0000 (14:42 +0100)
 + The error was setting the original vrfEntry's nexthop as the
   nexthop of the leaked route. This nexthop must be the other
   L3VPN's endpoint address

Change-Id: I37003321a595185afcf4e5df6f5d6d48e7fd4a62
Signed-off-by: Marcos López Samaniego <marcos.lopez.samaniego@ericsson.com>
Signed-off-by: Miguel Perez <francisco.miguel.perez@ericsson.com>
vpnservice/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpConfigurationManager.java [changed mode: 0644->0755]
vpnservice/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpUtil.java [changed mode: 0644->0755]
vpnservice/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/netvirt/fibmanager/VrfEntryListener.java
vpnservice/vpnmanager/vpnmanager-api/src/main/java/org/opendaylight/netvirt/vpnmanager/api/intervpnlink/InterVpnLinkDataComposite.java [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0b323c0..9a3622b
@@ -354,6 +354,7 @@ public class BgpConfigurationManager {
             super(ConfigServer.class, ConfigServerReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<ConfigServer> iid, ConfigServer val) {
             LOG.trace("received bgp connect config host {}", val.getHost().getValue());
@@ -385,6 +386,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(ConfigServer.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<ConfigServer> iid, ConfigServer val) {
             LOG.trace("received bgp disconnect");
@@ -396,6 +398,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<ConfigServer> iid,
                               ConfigServer oldval, ConfigServer newval) {
             LOG.trace("received bgp Connection update");
@@ -432,6 +435,7 @@ public class BgpConfigurationManager {
             super(AsId.class, AsIdReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<AsId> iid, AsId val) {
             LOG.error("received bgp add asid {}",val);
@@ -482,6 +486,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(AsId.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<AsId> iid, AsId val) {
             LOG.error("received delete router config asNum {}", val.getLocalAs().intValue());
@@ -508,6 +513,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<AsId> iid,
                               AsId oldval, AsId newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -536,6 +542,7 @@ public class BgpConfigurationManager {
             super(GracefulRestart.class, GracefulRestartReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<GracefulRestart> iid, GracefulRestart val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -564,6 +571,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(GracefulRestart.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<GracefulRestart> iid, GracefulRestart val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -584,6 +592,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<GracefulRestart> iid,
                               GracefulRestart oldval, GracefulRestart newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -623,6 +632,7 @@ public class BgpConfigurationManager {
             super(Logging.class, LoggingReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<Logging> iid, Logging val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -652,6 +662,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Logging.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<Logging> iid, Logging val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -672,6 +683,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<Logging> iid,
                               Logging oldval, Logging newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -711,6 +723,7 @@ public class BgpConfigurationManager {
             super(Neighbors.class, NeighborsReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<Neighbors> iid, Neighbors val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -745,6 +758,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Neighbors.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<Neighbors> iid, Neighbors val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -767,6 +781,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<Neighbors> iid,
                               Neighbors oldval, Neighbors newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -795,6 +810,7 @@ public class BgpConfigurationManager {
             super(EbgpMultihop.class, EbgpMultihopReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<EbgpMultihop> iid, EbgpMultihop val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -826,6 +842,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Neighbors.class).child(EbgpMultihop.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<EbgpMultihop> iid, EbgpMultihop val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -847,6 +864,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<EbgpMultihop> iid,
                               EbgpMultihop oldval, EbgpMultihop newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -875,6 +893,7 @@ public class BgpConfigurationManager {
             super(UpdateSource.class, UpdateSourceReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<UpdateSource> iid, UpdateSource val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -906,6 +925,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Neighbors.class).child(UpdateSource.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<UpdateSource> iid, UpdateSource val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -927,6 +947,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<UpdateSource> iid,
                               UpdateSource oldval, UpdateSource newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -955,6 +976,7 @@ public class BgpConfigurationManager {
             super(AddressFamilies.class, AddressFamiliesReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<AddressFamilies> iid, AddressFamilies val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -988,6 +1010,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Neighbors.class).child(AddressFamilies.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<AddressFamilies> iid, AddressFamilies val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1011,6 +1034,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<AddressFamilies> iid,
                               AddressFamilies oldval, AddressFamilies newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1043,6 +1067,7 @@ public class BgpConfigurationManager {
             return NetworksReactor.this;
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<Networks> iid, Networks val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1073,6 +1098,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Networks.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<Networks> iid, Networks val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1101,6 +1127,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(final InstanceIdentifier<Networks> iid,
                               final Networks oldval, final Networks newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1144,6 +1171,7 @@ public class BgpConfigurationManager {
             super(Vrfs.class, VrfsReactor.class);
         }
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<Vrfs> iid, Vrfs val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1175,6 +1203,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class).child(Vrfs.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<Vrfs> iid, Vrfs val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1195,6 +1224,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<Vrfs> iid,
                               Vrfs oldval, Vrfs newval) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1243,6 +1273,7 @@ public class BgpConfigurationManager {
         }
 
 
+        @Override
         protected synchronized void
         add(InstanceIdentifier<Bgp> iid, Bgp val) {
             LOG.error("received add Bgp config replaying the config");
@@ -1285,6 +1316,7 @@ public class BgpConfigurationManager {
             return InstanceIdentifier.create(Bgp.class);
         }
 
+        @Override
         protected synchronized void
         remove(InstanceIdentifier<Bgp> iid, Bgp val) {
             if (ignoreClusterDcnEventForFollower()) {
@@ -1296,6 +1328,7 @@ public class BgpConfigurationManager {
             }
         }
 
+        @Override
         protected void update(InstanceIdentifier<Bgp> iid,
                               Bgp oldval, Bgp newval) {
             if (ignoreClusterDcnEventForFollower()) {
index 68877823f3a3fe39e3ced6667de9c1145d4a8db8..362100b612eb1b92f5619de8592a1cae9352d8bb 100755 (executable)
@@ -441,12 +441,13 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
                                                        && interVpnLink.get().isBgpRoutesLeaking() );
 
         if ( proceed ) {
-            String theOtherVpnId = interVpnLink.get().getFirstEndpoint().getVpnUuid().getValue().equals(vpnUuid)
-                    ? interVpnLink.get().getSecondEndpoint().getVpnUuid().getValue()
-                    : vpnUuid;
+            boolean isVpnFirstEndpoint = interVpnLink.get().getFirstEndpoint().getVpnUuid().getValue().equals(vpnUuid);
 
+            String theOtherVpnId = isVpnFirstEndpoint ? interVpnLink.get().getSecondEndpoint().getVpnUuid().getValue()
+                                                      : vpnUuid;
             String dstVpnRd = FibUtil.getVpnRd(dataBroker, theOtherVpnId);
-            String endpointIp = vrfEntry.getNextHopAddressList().get(0);
+            String endpointIp = isVpnFirstEndpoint ? interVpnLink.get().getFirstEndpoint().getIpAddress().toString()
+                                                   : interVpnLink.get().getSecondEndpoint().getIpAddress().toString();
 
             InstanceIdentifier<VrfEntry> vrfEntryIidInOtherVpn =
                     InstanceIdentifier.builder(FibEntries.class)
old mode 100644 (file)
new mode 100755 (executable)
index 2ffef71..d58339a
@@ -11,7 +11,6 @@ package org.opendaylight.netvirt.vpnmanager.api.intervpnlink;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkState;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.links.InterVpnLink;
 import org.slf4j.Logger;