Clean up capability container 45/104045/4
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Jan 2023 18:22:15 +0000 (19:22 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Jan 2023 22:36:18 +0000 (23:36 +0100)
We want to preserve the capability of adding configuration options
without breaking API. For that each capability should be its own
container.

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

index aa901a17cfb939f5af4a375bd8011c042ded8225..bb82494fc407767e647166dc819d6442b823904b 100644 (file)
@@ -111,10 +111,10 @@ final class PCEPTopologyConfiguration implements Immutable {
 
         final var builder = ImmutableList.<PCEPCapability>builder()
             .add(new PCEPStatefulCapability(capabilities.nonnullStateful()));
-        if (capabilities.requireP2mp()) {
+        if (capabilities.nonnullP2mp().requireEnabled()) {
             builder.add(P2MPTeLspCapability.of());
         }
-        if (capabilities.requireSegmentRouting()) {
+        if (capabilities.nonnullSegmentRouting().requireEnabled()) {
             builder.add(PCEPSegmentRoutingCapability.of());
         }
         return builder.build();
index a43686f5d7f336b52b098f48a2ac26db0d724033..6ef14ff0adfe96edb469965ef1efa06135d5db0a 100644 (file)
@@ -31,13 +31,17 @@ module odl-pcep-topology-provider {
 
                 uses opisc:stateful-capabilities;
             }
-            leaf p2mp {
-                type boolean;
-                default true;
+            container p2mp {
+                leaf enabled {
+                    type boolean;
+                    default true;
+                }
             }
-            leaf segment-routing {
-                type boolean;
-                default true;
+            container segment-routing {
+                leaf enabled {
+                    type boolean;
+                    default true;
+                }
             }
         }
     }