Compare capabilities during configuration apply 46/104046/4
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Jan 2023 18:29:03 +0000 (19:29 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Jan 2023 22:36:18 +0000 (23:36 +0100)
If capabilities change we want to create a new negotiation. This may be
improved later.

JIRA: BGPCEP-960
Change-Id: I89ca223e6456fa78bd71f6a64e4fe1c3ee538854
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologyProvider.java

index e9d48f49fd303225145416c97616846275a888ff..3281df9035f68628936d1828991645a86e5240bf 100644 (file)
@@ -169,6 +169,17 @@ final class PCEPTopologyProvider extends DefaultTopologyReference {
             return;
         }
 
+        // FIXME: can we apply this less aggressively to just routing it through manager to the negotiator factory?
+        final var currentCapabilities = currentConfig.getCapabilities();
+        final var newCapabilities = newConfiguration.getCapabilities();
+        if (!currentCapabilities.equals(newCapabilities)) {
+            LOG.info("Topology Provider {} capabilities changed from {} to {}, restarting", topologyId(),
+                currentCapabilities, newCapabilities);
+            applyConfiguration(null);
+            applyConfiguration(newConfiguration);
+            return;
+        }
+
         // TCP-MD5 configuration is propagated from the server channel to individual channels. For any node that has
         // changed this configuration we need to tear down any existing session.
         final var currentKeys = currentConfig.getKeys().asMap();