Compare capabilities during configuration apply
[bgpcep.git] / 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();