Upgrade: Remote FIB entry missing for ext. gateway 85/66785/10
authorJosh <jhershbe@redhat.com>
Thu, 28 Dec 2017 10:28:15 +0000 (12:28 +0200)
committerSam Hague <shague@redhat.com>
Wed, 24 Jan 2018 18:48:13 +0000 (18:48 +0000)
Root cause of this is that the ARP to discover the
external gateway's mac is triggered at router/subnet
creation time and the code assumes the ovsdb models
are in place. However, in the case of upgrade they are
not yet present as the switches have not yet reconnected.

Fix: At the point where the upgrading flag is unset we
know that all switches have reconnected. Listen for that
transition and trigger the ARP for all routers.

Change-Id: I6cc6045937e2d9a936596e1a8bc36b7a0cbb70e3
Signed-off-by: Josh <jhershbe@redhat.com>
vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronSubnetGwMacResolver.java
vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/UpgradeStateListener.java [new file with mode: 0644]

index 8f62c06cc570931bd15c962859c13c3211798c23..f7566dfc0dd45deb0ce9e3eb152f1e2a20a1fc1a 100644 (file)
@@ -95,8 +95,8 @@ public class NeutronSubnetGwMacResolver {
                 TimeUnit.MILLISECONDS);
     }
 
-    private void sendArpRequestsToExtGateways() {
-        LOG.trace("Sending ARP requests to exteral gateways");
+    public void sendArpRequestsToExtGateways() {
+        LOG.trace("Sending ARP requests to external gateways");
         for (Router router : neutronvpnUtils.getAllRouters()) {
             sendArpRequestsToExtGateways(router);
         }
diff --git a/vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/UpgradeStateListener.java b/vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/UpgradeStateListener.java
new file mode 100644 (file)
index 0000000..9d164c8
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.netvirt.neutronvpn;
+
+import javax.annotation.Nonnull;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.datastoreutils.listeners.AbstractClusteredSyncDataTreeChangeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.Config;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Singleton
+public class UpgradeStateListener extends AbstractClusteredSyncDataTreeChangeListener<Config> {
+    private static final Logger LOG = LoggerFactory.getLogger(UpgradeStateListener.class);
+
+    private final NeutronSubnetGwMacResolver neutronSubnetGwMacResolver;
+
+    @Inject
+    public UpgradeStateListener(final DataBroker dataBroker,
+                                final NeutronSubnetGwMacResolver neutronSubnetGwMacResolver) {
+        super(dataBroker, new DataTreeIdentifier<>(
+                LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Config.class)));
+        LOG.trace("UpgradeStateListener (neutronvpn) initialized");
+        this.neutronSubnetGwMacResolver = neutronSubnetGwMacResolver;
+    }
+
+    @Override
+    public void add(@Nonnull Config newDataObject) {
+    }
+
+    @Override
+    public void remove(@Nonnull Config removedDataObject) {
+    }
+
+    @Override
+    public void update(@Nonnull Config original, Config updated) {
+        LOG.info("UpgradeStateListener update from {} to {}", original, updated);
+        neutronSubnetGwMacResolver.sendArpRequestsToExtGateways();
+    }
+}
\ No newline at end of file