BUG-139: Implement PCEP state synchronization avoidance 86/24086/18
authorIveta Halanova <iveta.halanova@pantheon.sk>
Tue, 14 Jul 2015 08:17:10 +0000 (10:17 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 17 Jul 2015 08:24:07 +0000 (08:24 +0000)
Advertising Support of Synchronization Optimizations
- defined yang model for STATEFUL-PCE-CAPABILITY TLV
- implemented SyncOptimizationsCapabilityTlvParser
- parser/serializer Activator
- Config-subsystem integration
- tests: update and extension

Change-Id: Ief4a928a1cd3e6c18e35f13fa1e49053351eebd7
Signed-off-by: Iveta Halanova <iveta.halanova@pantheon.sk>
22 files changed:
pcep/controller-config/src/main/resources/initial/32-pcep.xml
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/Stateful07PCEPSessionProposalFactoryModule.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModule.java [new file with mode: 0644]
pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModuleFactory.java [new file with mode: 0644]
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated00/CInitiated00StatefulCapabilityTlvParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated00/Stateful07SessionProposalFactory.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/sync/optimizations/SyncOptimizationsActivator.java [new file with mode: 0644]
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/sync/optimizations/SyncOptimizationsCapabilityTlvParser.java [new file with mode: 0644]
pcep/ietf-stateful07/src/main/yang/odl-pcep-ietf-stateful07-cfg.yang
pcep/ietf-stateful07/src/main/yang/odl-pcep-sync-optimizations.yang [new file with mode: 0644]
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPTlvParserTest.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPValidatorTest.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/Stateful07SessionProposalFactoryModuleTest.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/Stateful07SessionProposalFactoryTest.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/SyncOptimizationsPCEPParserModuleTest.java [new file with mode: 0644]
pcep/segment-routing/src/main/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SrPCEPSessionProposalFactoryModule.java
pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SegmentRoutingSessionProposalFactory.java
pcep/segment-routing/src/main/yang/odl-pcep-segment-routing-cfg.yang
pcep/segment-routing/src/test/java/org/opendaylight/controller/config/yang/pcep/sr/cfg/SrPCEPSessionProposalFactoryModuleTest.java
pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SegmentRouting02SessionProposalTest.java
pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java
pcep/topology-provider/src/test/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListenerTest.java

index fd77fb11e706b0ae9f2199762b5af9e0d961c062..4ee3e11091e7fb9e6e2a2e435a66a420c805ab03 100644 (file)
@@ -15,7 +15,7 @@
         <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:spi?module=odl-pcep-spi-cfg&amp;revision=2013-11-15</capability>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:programming:spi?module=odl-programming-spi-cfg&amp;revision=2013-11-15</capability>
     <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful02:cfg?module=odl-pcep-ietf-stateful02-cfg&amp;revision=2014-02-21</capability>
-    <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg?module=odl-pcep-ietf-stateful07-cfg&amp;revision=2014-02-21</capability>
+    <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg?module=odl-pcep-ietf-stateful07-cfg&amp;revision=2015-07-14</capability>
     </required-capabilities>
     <configuration>
 
                         <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
                         <name>pcep-parser-ietf-initiated00</name>
                     </extension>
+                    <extension>
+                        <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
+                        <name>pcep-parser-sync-optimizations</name>
+                    </extension>
 
 
                     <!-- This block is draft-ietf-pce-stateful-pce-02 + draft-crabbe-pce-inititated-pce-00 -->
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-ietf-initiated00</type>
                     <name>pcep-parser-ietf-initiated00</name>
                 </module>
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-sync-optimizations</type>
+                    <name>pcep-parser-sync-optimizations</name>
+                </module>
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful02:cfg">prefix:pcep-parser-ietf-stateful02</type>
                     <name>pcep-parser-ietf-stateful02</name>
                         <name>pcep-parser-ietf-stateful02</name>
                         <provider>/config/modules/module[name='pcep-parser-ietf-stateful02']/instance[name='pcep-parser-ietf-stateful02']</provider>
                     </instance>
+                    <instance>
+                        <name>pcep-parser-sync-optimizations</name>
+                        <provider>/config/modules/module[name='pcep-parser-sync-optimizations']/instance[name='pcep-parser-sync-optimizations']</provider>
+                    </instance>
                 </service>
                 <service>
                     <type xmlns:pcep="urn:opendaylight:params:xml:ns:yang:controller:pcep">pcep:pcep-session-proposal-factory</type>
index 1b94444a13a7a6c585852593053bf5b9306492be..ee3d48b8964cbe70f2931a65f6918c650d3e3d54 100644 (file)
@@ -45,6 +45,10 @@ public final class Stateful07PCEPSessionProposalFactoryModule extends
         JmxAttributeValidationException.checkNotNull(getInitiated(), VALUE_IS_NOT_SET, initiatedJmxAttribute);
         JmxAttributeValidationException.checkNotNull(getDeadTimerValue(), VALUE_IS_NOT_SET, deadTimerValueJmxAttribute);
         JmxAttributeValidationException.checkNotNull(getKeepAliveTimerValue(), VALUE_IS_NOT_SET, keepAliveTimerValueJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getTriggeredInitialSync(), VALUE_IS_NOT_SET, triggeredInitialSyncJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getTriggeredResync(), VALUE_IS_NOT_SET, triggeredResyncJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getDeltaLspSyncCapability(), VALUE_IS_NOT_SET, deltaLspSyncCapabilityJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getIncludeDbVersion(), VALUE_IS_NOT_SET, includeDbVersionJmxAttribute);
         if (getKeepAliveTimerValue() != 0) {
             JmxAttributeValidationException.checkCondition(getKeepAliveTimerValue() >= 1, "minimum value is 1.",
                     keepAliveTimerValueJmxAttribute);
@@ -52,15 +56,19 @@ public final class Stateful07PCEPSessionProposalFactoryModule extends
                 LOG.warn("DeadTimerValue should be 4 times greater than KeepAliveTimerValue");
             }
         }
-        if (getActive() && !getStateful()) {
+        if ((getActive() || getTriggeredInitialSync() || getTriggeredResync() || getDeltaLspSyncCapability() || getIncludeDbVersion()) && !getStateful()) {
             setStateful(true);
         }
-        JmxAttributeValidationException.checkNotNull(getStateful(), "value is not set.", statefulJmxAttribute);
+        if ((getTriggeredInitialSync() || getDeltaLspSyncCapability()) && !getIncludeDbVersion()) {
+            setIncludeDbVersion(true);
+        }
+        JmxAttributeValidationException.checkNotNull(getStateful(), VALUE_IS_NOT_SET, statefulJmxAttribute);
     }
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        final Stateful07SessionProposalFactory inner = new Stateful07SessionProposalFactory(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getInitiated());
+        final Stateful07SessionProposalFactory inner = new Stateful07SessionProposalFactory(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getInitiated(),
+            getTriggeredInitialSync(), getTriggeredResync(), getDeltaLspSyncCapability(), getIncludeDbVersion());
         return new PCEPSessionProposalFactoryCloseable(inner);
     }
 
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModule.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModule.java
new file mode 100644 (file)
index 0000000..42db6cb
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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.controller.config.yang.pcep.stateful07.cfg;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator;
+
+public class SyncOptimizationsPCEPParserModule extends AbstractSyncOptimizationsPCEPParserModule {
+
+    public SyncOptimizationsPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public SyncOptimizationsPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
+        final SyncOptimizationsPCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected AutoCloseable createInstance() {
+        return new StatefulActivator();
+    }
+
+}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModuleFactory.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/controller/config/yang/pcep/stateful07/cfg/SyncOptimizationsPCEPParserModuleFactory.java
new file mode 100644 (file)
index 0000000..0b0c8ea
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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.controller.config.yang.pcep.stateful07.cfg;
+
+public class SyncOptimizationsPCEPParserModuleFactory extends AbstractSyncOptimizationsPCEPParserModuleFactory {
+
+}
index 1935c3a155862e12bb1372cbcad7ee89900fdae3..1de15363ec087ab57b5ba6fa5d35c6537ecfaa42 100644 (file)
@@ -18,9 +18,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.iet
 /**
  * Parser for {@link Stateful}
  */
-public final class CInitiated00StatefulCapabilityTlvParser extends Stateful07StatefulCapabilityTlvParser {
+public class CInitiated00StatefulCapabilityTlvParser extends Stateful07StatefulCapabilityTlvParser {
 
-    private static final int I_FLAG_OFFSET = 29;
+    protected static final int I_FLAG_OFFSET = 29;
 
     @Override
     protected void parseFlags(final StatefulBuilder sb, final ByteBuf buffer) {
index 010635da07164c1921e0c0a78a136dd9beb39ec1..60d03588217c1a72d96617744b38e9d618bc74f5 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.pcep.ietf.initiated00;
 
 import java.net.InetSocketAddress;
-
 import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.Stateful1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.Stateful1Builder;
@@ -19,14 +18,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 
 public class Stateful07SessionProposalFactory extends BasePCEPSessionProposalFactory {
 
-    private final boolean stateful, active, instant;
+    private final boolean stateful, active, instant, triggeredSync, triggeredResync, deltaLspSync, includeDbVersion;
 
     public Stateful07SessionProposalFactory(final int deadTimer, final int keepAlive, final boolean stateful, final boolean active,
-            final boolean instant) {
+            final boolean instant, final boolean triggeredSync, final boolean triggeredResync, final boolean deltaLspSync, final boolean includeDbVersion) {
         super(deadTimer, keepAlive);
         this.stateful = stateful;
         this.active = active;
         this.instant = instant;
+        this.triggeredSync = triggeredSync;
+        this.triggeredResync = triggeredResync;
+        this.deltaLspSync = deltaLspSync;
+        this.includeDbVersion = includeDbVersion;
     }
 
     @Override
@@ -35,8 +38,15 @@ public class Stateful07SessionProposalFactory extends BasePCEPSessionProposalFac
             builder.addAugmentation(
                     Tlvs1.class,
                     new Tlvs1Builder().setStateful(
-                            new StatefulBuilder().setLspUpdateCapability(this.active).addAugmentation(Stateful1.class,
-                                    new Stateful1Builder().setInitiation(this.instant).build()).build()).build()).build();
+                            new StatefulBuilder().setLspUpdateCapability(this.active)
+                            .addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(this.instant).build())
+                            .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder()
+                                .setTriggeredInitialSync(this.triggeredSync)
+                                .setTriggeredResync(this.triggeredResync)
+                                .setDeltaLspSyncCapability(this.deltaLspSync)
+                                .setIncludeDbVersion(this.includeDbVersion)
+                                .build())
+                            .build()).build()).build();
         }
     }
 
@@ -52,4 +62,19 @@ public class Stateful07SessionProposalFactory extends BasePCEPSessionProposalFac
         return this.instant;
     }
 
+    public boolean isTriggeredSync() {
+        return this.triggeredSync;
+    }
+
+    public boolean isTriggeredResync() {
+        return this.triggeredResync;
+    }
+
+    public boolean isDeltaLspSync() {
+        return this.deltaLspSync;
+    }
+
+    public boolean isIncludeDbVersion() {
+        return this.includeDbVersion;
+    }
 }
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/sync/optimizations/SyncOptimizationsActivator.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/sync/optimizations/SyncOptimizationsActivator.java
new file mode 100644 (file)
index 0000000..e5231cf
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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.protocol.pcep.sync.optimizations;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.opendaylight.protocol.pcep.spi.pojo.AbstractPCEPExtensionProviderActivator;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.stateful.capability.tlv.Stateful;
+
+public class SyncOptimizationsActivator extends AbstractPCEPExtensionProviderActivator {
+
+    @Override
+    protected List<AutoCloseable> startImpl(final PCEPExtensionProviderContext context) {
+        final List<AutoCloseable> regs = new ArrayList<>();
+
+        regs.add(context.registerTlvParser(SyncOptimizationsCapabilityTlvParser.TYPE, new SyncOptimizationsCapabilityTlvParser()));
+        regs.add(context.registerTlvSerializer(Stateful.class, new SyncOptimizationsCapabilityTlvParser()));
+
+        return regs;
+    }
+}
diff --git a/pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/sync/optimizations/SyncOptimizationsCapabilityTlvParser.java b/pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/sync/optimizations/SyncOptimizationsCapabilityTlvParser.java
new file mode 100644 (file)
index 0000000..b042a0a
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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.protocol.pcep.sync.optimizations;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.ietf.initiated00.CInitiated00StatefulCapabilityTlvParser;
+import org.opendaylight.protocol.util.BitArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.Stateful1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.Stateful1Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.stateful.capability.tlv.Stateful;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.stateful.capability.tlv.StatefulBuilder;
+
+public class SyncOptimizationsCapabilityTlvParser extends CInitiated00StatefulCapabilityTlvParser {
+
+    protected static final int S_FLAG_OFFSET = 30;
+    protected static final int T_FLAG_OFFSET = 28;
+    protected static final int D_FLAG_OFFSET = 27;
+    protected static final int F_FLAG_OFFSET = 26;
+
+    @Override
+    protected void parseFlags(final StatefulBuilder sb, final ByteBuf buffer) {
+        final BitArray flags = BitArray.valueOf(buffer, FLAGS_F_LENGTH);
+        sb.setLspUpdateCapability(flags.get(U_FLAG_OFFSET));
+        if (flags.get(I_FLAG_OFFSET)) {
+            sb.addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build());
+        }
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder syncOptBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder();
+        if (flags.get(S_FLAG_OFFSET)) {
+            syncOptBuilder.setIncludeDbVersion(Boolean.TRUE);
+        }
+        if (flags.get(T_FLAG_OFFSET)) {
+            syncOptBuilder.setTriggeredResync(Boolean.TRUE);
+        }
+        if (flags.get(D_FLAG_OFFSET)) {
+            syncOptBuilder.setDeltaLspSyncCapability(Boolean.TRUE);
+        }
+        if (flags.get(F_FLAG_OFFSET)) {
+            syncOptBuilder.setTriggeredInitialSync(Boolean.TRUE);
+        }
+        sb.addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class, syncOptBuilder.build());
+    }
+
+    @Override
+    protected BitArray serializeFlags(final Stateful sct) {
+        final BitArray flags = new BitArray(FLAGS_F_LENGTH);
+        final Stateful1 sfi = sct.getAugmentation(Stateful1.class);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1 sf2 = sct.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class);
+        if (sf2 != null) {
+            flags.set(F_FLAG_OFFSET, sf2.isTriggeredInitialSync());
+            flags.set(D_FLAG_OFFSET, sf2.isDeltaLspSyncCapability());
+            flags.set(T_FLAG_OFFSET, sf2.isTriggeredResync());
+            flags.set(S_FLAG_OFFSET, sf2.isIncludeDbVersion());
+        }
+        if (sfi != null) {
+            flags.set(I_FLAG_OFFSET, sfi.isInitiation());
+        }
+        flags.set(U_FLAG_OFFSET, sct.isLspUpdateCapability());
+        return flags;
+    }
+}
index 72df85f856099343564509401796064ced54c98f..9e0d22b644ba95666b440dafe2466db32ea78aed 100644 (file)
@@ -23,6 +23,11 @@ module odl-pcep-ietf-stateful07-cfg {
         accompanies this distribution, and is available at
         http://www.eclipse.org/legal/epl-v10.html";
 
+    revision "2015-07-14" {
+        description
+            "Extended stateful capabilities.";
+    }
+
     revision "2014-02-21" {
         description
             "Updated revision dates for imports.";
@@ -34,34 +39,57 @@ module odl-pcep-ietf-stateful07-cfg {
         config:provided-service pcep:pcep-session-proposal-factory;
     }
 
+    grouping stateful-capabilities {
+        leaf dead-timer-value {
+            type uint8;
+            default 120;
+        }
+
+        leaf keep-alive-timer-value {
+            type uint8;
+            default 30;
+        }
+
+        leaf initiated {
+            type boolean;
+            default true;
+        }
+
+        leaf stateful {
+            type boolean;
+            default true;
+        }
+
+        leaf active {
+            type boolean;
+            default true;
+        }
+
+        leaf triggered-initial-sync {
+            type boolean;
+            default false;
+        }
+
+        leaf delta-lsp-sync-capability {
+            type boolean;
+            default true;
+        }
+
+        leaf triggered-resync {
+            type boolean;
+            default true;
+        }
+
+        leaf include-db-version {
+            type boolean;
+            default true;
+        }
+    }
+
     augment "/config:modules/config:module/config:configuration" {
         case pcep-session-proposal-factory-stateful07 {
             when "/config:modules/config:module/config:type = 'pcep-session-proposal-factory-stateful07'";
-
-            leaf dead-timer-value {
-                type uint8;
-                default 120;
-            }
-
-            leaf keep-alive-timer-value {
-                type uint8;
-                default 30;
-            }
-
-            leaf initiated {
-                type boolean;
-                default true;
-            }
-
-            leaf stateful {
-                type boolean;
-                default true;
-            }
-
-            leaf active {
-                type boolean;
-                default true;
-            }
+            uses stateful-capabilities;
         }
     }
 
@@ -88,5 +116,17 @@ module odl-pcep-ietf-stateful07-cfg {
             when "/config:modules/config:module/config:type = 'pcep-parser-ietf-initiated00'";
         }
     }
+
+    identity pcep-parser-sync-optimizations {
+        base config:module-type;
+        config:provided-service spi:extension;
+        config:java-name-prefix SyncOptimizationsPCEPParser;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case pcep-parser-sync-optimizations {
+            when "/config:modules/config:module/config:type = 'pcep-parser-sync-optimizations'";
+        }
+    }
 }
 
diff --git a/pcep/ietf-stateful07/src/main/yang/odl-pcep-sync-optimizations.yang b/pcep/ietf-stateful07/src/main/yang/odl-pcep-sync-optimizations.yang
new file mode 100644 (file)
index 0000000..cd6551b
--- /dev/null
@@ -0,0 +1,59 @@
+module odl-pcep-sync-optimizations {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:sync:optimizations";
+    prefix "sync-optimizations";
+
+    import pcep-types { prefix pcep; revision-date 2013-10-05; }
+    import pcep-message { prefix msg; revision-date 2013-10-07; }
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import network-topology-pcep { prefix topo; revision-date 2013-10-24; }
+    import odl-pcep-ietf-stateful07 { prefix stateful; revision-date 2013-12-22; }
+
+    organization "Pantheon Technologies";
+    contact "Iveta Halanova <iveta.halanova@pantheon.sk>";
+
+    description
+        "This module contains the data model of PCEP extensions defined
+        in draft-ietf-pce-stateful-sync-optimizations-02.
+
+        Copyright (c)2015 Cisco Systems, Inc. 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";
+
+    revision "2015-07-14" {
+        description
+            "Initial revision.";
+        reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-sync-optimizations-02";
+    }
+
+    grouping sync-optimizations-capability-tlv {
+        reference "http://tools.ietf.org/html/draft-ietf-pce-pce-initiated-lsp-00#section-4.1";
+        leaf triggered-initial-sync {
+            type boolean;
+            default false;
+        }
+        leaf delta-lsp-sync-capability {
+            type boolean;
+            default false;
+        }
+        leaf triggered-resync {
+            type boolean;
+            default false;
+        }
+        leaf include-db-version {
+            type boolean;
+            default false;
+        }
+    }
+
+    augment "/msg:open/msg:open-message/msg:open/msg:tlvs/stateful:stateful" {
+        uses sync-optimizations-capability-tlv;
+    }
+
+    augment "/nt:network-topology/nt:topology/nt:node/topo:path-computation-client/topo:stateful-tlv/stateful:stateful" {
+        uses sync-optimizations-capability-tlv;
+    }
+}
\ No newline at end of file
index 0758a2999dd27a271ce718a035631dc1cba9ef9f..35ae4c6c091a5401895ab15493b9f24f4afe9219 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.pcep.ietf;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -22,6 +21,7 @@ import org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07LspUpdateErrorTl
 import org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07RSVPErrorSpecTlvParser;
 import org.opendaylight.protocol.pcep.ietf.stateful07.Stateful07StatefulCapabilityTlvParser;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsCapabilityTlvParser;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.protocol.util.Ipv6Util;
@@ -55,6 +55,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 public class PCEPTlvParserTest {
 
     private static final byte[] statefulBytes = { 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01 };
+    private static final byte[] STATEFUL_SYNC_OPT_BYTES = new byte[]{ 0x00, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x33 };
     private static final byte[] symbolicNameBytes = { 0x00, 0x11, 0x00, 0x1C, 0x4d, 0x65, 0x64, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x6f,
         0x66, 0x20, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x69, 0x63, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x65, 0x65, 0x65 };
     private static final byte[] lspUpdateErrorBytes = { 0x00, 0x14, 0x00, 0x04, 0x25, 0x68, (byte) 0x95, 0x03 };
@@ -83,6 +84,22 @@ public class PCEPTlvParserTest {
         assertArrayEquals(statefulBytes, ByteArray.getAllBytes(buff));
     }
 
+    @Test
+    public void testStatefulTlvSyncOptimizationExtension() throws PCEPDeserializerException {
+        final SyncOptimizationsCapabilityTlvParser parser = new SyncOptimizationsCapabilityTlvParser();
+        final Stateful tlv = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE)
+            .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder()
+                .setTriggeredInitialSync(Boolean.TRUE)
+                .setDeltaLspSyncCapability(Boolean.TRUE)
+                .setIncludeDbVersion(Boolean.TRUE)
+                .build())
+            .build();
+        assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(STATEFUL_SYNC_OPT_BYTES, 4))));
+        final ByteBuf buff = Unpooled.buffer();
+        parser.serializeTlv(tlv, buff);
+        assertArrayEquals(STATEFUL_SYNC_OPT_BYTES, ByteArray.getAllBytes(buff));
+    }
+
     @Test
     public void testSymbolicNameTlv() throws PCEPDeserializerException {
         final Stateful07LspSymbolicNameTlvParser parser = new Stateful07LspSymbolicNameTlvParser();
index 3e33bb869c328208bdceddd77cadd880f4c4b1ca..cb260f32477d2f5f282e600b7c44ef060c58e454 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.pcep.ietf;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -30,6 +29,7 @@ import org.opendaylight.protocol.pcep.impl.Activator;
 import org.opendaylight.protocol.pcep.impl.message.PCEPOpenMessageParser;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
+import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
@@ -233,6 +233,14 @@ public class PCEPValidatorTest {
         }
     }
 
+    @Test
+    public void testSyncOptActivator() {
+        try (SyncOptimizationsActivator a = new SyncOptimizationsActivator()) {
+            a.start(this.ctx);
+            a.close();
+        }
+    }
+
     @Test
     public void testUpdMsg() throws IOException, PCEPDeserializerException {
         try (CrabbeInitiatedActivator a = new CrabbeInitiatedActivator()) {
@@ -389,7 +397,7 @@ public class PCEPValidatorTest {
 
             PcerrMessageBuilder builder = new PcerrMessageBuilder();
             builder.setErrors(innerErr);
-            List<Srps> srps = new ArrayList<>();
+            final List<Srps> srps = new ArrayList<>();
             srps.add(new SrpsBuilder().setSrp(new SrpBuilder().setOperationId(new SrpIdNumber(3L)).setIgnore(false).setProcessingRule(false).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.srp.TlvsBuilder().build()).build()).build());
             builder.setErrorType(new StatefulCaseBuilder().setStateful(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcerr.pcerr.message.error.type.stateful._case.StatefulBuilder().setSrps(srps).build()).build());
 
@@ -488,7 +496,7 @@ public class PCEPValidatorTest {
         final PcerrBuilder builder = new PcerrBuilder();
         builder.setPcerrMessage(errMsgBuilder.build());
 
-        ByteBuf buf = Unpooled.wrappedBuffer(statefulMsg);
+        final ByteBuf buf = Unpooled.wrappedBuffer(statefulMsg);
         final List<Message> errors = Lists.<Message>newArrayList();
         parser.parseMessage(buf.slice(4, buf.readableBytes() - 4), errors);
         assertFalse(errors.isEmpty());
index 974c43f3c3dd247842863614f3d45dd378bd750d..20e3755779464d4157b57f9ccc88df6346fe89b3 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.protocol.pcep.ietf;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.ObjectName;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ValidationException;
@@ -30,13 +29,13 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
 
     @Before
     public void setUp() throws Exception {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new Stateful07PCEPSessionProposalFactoryModuleFactory()));
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new Stateful07PCEPSessionProposalFactoryModuleFactory()));
     }
 
     @Test
     public void testValidationExceptionDeadTimerValueNotSet() throws Exception {
         try {
-            createInstance(null, (short) 100, true, true, true);
+            createInstance(null, (short) 100, true, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("DeadTimerValue value is not set"));
@@ -46,7 +45,7 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
     @Test
     public void testValidationExceptionKeepAliveTimerNotSet() throws Exception {
         try {
-            createInstance((short) 200, null, true, true, true);
+            createInstance((short) 200, null, true, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("KeepAliveTimerValue value is not set"));
@@ -56,7 +55,7 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
     @Test
     public void testValidationExceptionStatefulNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, null, false, false);
+            createInstance((short) 200, (short) 100, null, false, false, false, false, false, false);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("Stateful value is not set"));
@@ -66,7 +65,7 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
     @Test
     public void testValidationExceptionActiveNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, true, null, true);
+            createInstance((short) 200, (short) 100, true, null, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("Active value is not set"));
@@ -76,17 +75,57 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
     @Test
     public void testValidationExceptionInstantiatedNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, true, true, null);
+            createInstance((short) 200, (short) 100, true, true, null, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("Initiated value is not set"));
         }
     }
 
+    @Test
+    public void testValidationExceptionTriggeredSyncNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, null, true, true, true);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("TriggeredInitialSync value is not set"));
+        }
+    }
+
+    @Test
+    public void testValidationExceptionTriggeredResyncNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, null, true, true);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("TriggeredResync value is not set"));
+        }
+    }
+
+    @Test
+    public void testValidationExceptionDeltaLspSyncNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, true, null, true);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("DeltaLspSyncCapability value is not set"));
+        }
+    }
+
+    @Test
+    public void testValidationExceptionIncludeDBVersionNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, true, true, null);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("IncludeDbVersion value is not set"));
+        }
+    }
+
     @Test
     public void testValidationExceptionKeepAliveTimerMinValue() throws Exception {
         try {
-            createInstance((short) 200, (short) -10, true, true, true);
+            createInstance((short) 200, (short) -10, true, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("minimum value is 1."));
@@ -95,13 +134,40 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
 
     @Test
     public void testStatefulAfterCommitted() throws Exception {
-        createInstance((short) 200, (short) 100, false, true, true);
+        createInstance((short) 200, (short) 100, false, true, true, true, false, true, true);
         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
         final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
                 FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
         assertTrue(mxBean.getStateful());
     }
 
+    @Test
+    public void testNotStatefulAfterCommitted() throws Exception {
+        createInstance((short) 200, (short) 100, false, false, false, false, false, false, false);
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
+                FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
+        assertFalse(mxBean.getStateful());
+    }
+
+    @Test
+    public void testIncludeDbVersionAfterCommitted() throws Exception {
+        createInstance((short) 200, (short) 100, false, false, false, false, false, true, false);
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
+                FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
+        assertTrue(mxBean.getIncludeDbVersion());
+    }
+
+    @Test
+    public void testNotIncludeDbVersionAfterCommitted() throws Exception {
+        createInstance((short) 200, (short) 100, false, false, false, false, false, false, false);
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
+                FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
+        assertFalse(mxBean.getIncludeDbVersion());
+    }
+
     @Test
     public void testCreateBean() throws Exception {
         final CommitStatus status = createInstance();
@@ -132,9 +198,9 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
     }
 
     private CommitStatus createInstance(final Short deadTimer, final Short keepAlive, final Boolean stateful, final Boolean active,
-            final Boolean instant) throws Exception {
+            final Boolean instant, final Boolean triggeredInitialSync, final Boolean triggeredResync, final Boolean deltaLspSyncCapability, final Boolean includeDbVersion) throws Exception {
         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        createInstance(transaction, deadTimer, keepAlive, stateful, active, instant);
+        createInstance(transaction, deadTimer, keepAlive, stateful, active, instant, triggeredInitialSync, triggeredResync, deltaLspSyncCapability, includeDbVersion);
         return transaction.commit();
     }
 
@@ -145,11 +211,12 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
     }
 
     public static ObjectName createStateful07SessionProposalInstance(final ConfigTransactionJMXClient transaction) throws Exception {
-        return createInstance(transaction, (short) 200, (short) 100, true, true, true);
+        return createInstance(transaction, (short) 200, (short) 100, true, true, true, true, true, true, true);
     }
 
     private static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final Short deadTimer, final Short keepAlive,
-            final Boolean stateful, final Boolean active, final Boolean instant) throws InstanceAlreadyExistsException {
+            final Boolean stateful, final Boolean active, final Boolean instant,
+            final Boolean triggeredInitialSync, final Boolean triggeredResync, final Boolean deltaLspSyncCapability, final Boolean includeDbVersion) throws InstanceAlreadyExistsException {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
         final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated,
                 Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
@@ -158,6 +225,10 @@ public class Stateful07SessionProposalFactoryModuleTest extends AbstractConfigTe
         mxBean.setInitiated(instant);
         mxBean.setKeepAliveTimerValue(keepAlive);
         mxBean.setStateful(stateful);
+        mxBean.setTriggeredInitialSync(triggeredInitialSync);
+        mxBean.setTriggeredResync(triggeredResync);
+        mxBean.setDeltaLspSyncCapability(deltaLspSyncCapability);
+        mxBean.setIncludeDbVersion(includeDbVersion);
         return nameCreated;
     }
 
index d52ed96699e713f7500952e8b0240ffbc26c44e3..498724baf8ea6f4bf95cda1a85628e05b36e7e35 100644 (file)
@@ -30,18 +30,30 @@ public class Stateful07SessionProposalFactoryTest {
             .setKeepalive((short) KEEP_ALIVE)
             .setSessionId((short) SESSION_ID)
             .setTlvs(new TlvsBuilder()
-                .addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder().addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(true).build()).setLspUpdateCapability(true).build()).build())
+                .addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder()
+                    .addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(true).build())
+                    .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder()
+                        .setTriggeredInitialSync(true)
+                        .setTriggeredResync(false)
+                        .setDeltaLspSyncCapability(true)
+                        .setIncludeDbVersion(false)
+                        .build())
+                    .setLspUpdateCapability(true).build()).build())
                 .build())
             .build();
 
     @Test
     public void testStateful07SessionProposalFactory() {
-        final Stateful07SessionProposalFactory sspf = new Stateful07SessionProposalFactory(DEAD_TIMER, KEEP_ALIVE, true, true, true);
+        final Stateful07SessionProposalFactory sspf = new Stateful07SessionProposalFactory(DEAD_TIMER, KEEP_ALIVE, true, true, true, true, false, true, false);
         Assert.assertEquals(DEAD_TIMER, sspf.getDeadTimer());
         Assert.assertEquals(KEEP_ALIVE, sspf.getKeepAlive());
         Assert.assertTrue(sspf.isActive());
         Assert.assertTrue(sspf.isInstant());
         Assert.assertTrue(sspf.isStateful());
+        Assert.assertFalse(sspf.isTriggeredResync());
+        Assert.assertTrue(sspf.isTriggeredSync());
+        Assert.assertTrue(sspf.isDeltaLspSync());
+        Assert.assertFalse(sspf.isIncludeDbVersion());
         Assert.assertEquals(OPEN_MSG, sspf.getSessionProposal(null, SESSION_ID));
     }
 }
diff --git a/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/SyncOptimizationsPCEPParserModuleTest.java b/pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/SyncOptimizationsPCEPParserModuleTest.java
new file mode 100644 (file)
index 0000000..7129085
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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.protocol.pcep.ietf;
+
+import com.google.common.collect.Lists;
+import javax.management.ObjectName;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.config.api.jmx.CommitStatus;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
+import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
+import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.SyncOptimizationsPCEPParserModuleFactory;
+
+public class SyncOptimizationsPCEPParserModuleTest extends AbstractConfigTest {
+
+    private static final String FACTORY_NAME = SyncOptimizationsPCEPParserModuleFactory.NAME;
+    private static final String INSTANCE_NAME = "pcep-parser-sync-optimizations-instance";
+
+    @Before
+    public void setUp() {
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new SyncOptimizationsPCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
+    }
+
+    @Test
+    public void testCreateBean() throws Exception {
+        final CommitStatus status = createSyncOptimizationsPCEPParserModuleInstance();
+        assertBeanCount(1, FACTORY_NAME);
+        assertStatus(status, 2, 0, 0);
+    }
+
+    @Test
+    public void testReusingOldInstance() throws Exception {
+        createSyncOptimizationsPCEPParserModuleInstance();
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        assertBeanCount(1, FACTORY_NAME);
+        final CommitStatus status = transaction.commit();
+        assertBeanCount(1, FACTORY_NAME);
+        assertStatus(status, 0, 0, 2);
+    }
+
+    private CommitStatus createSyncOptimizationsPCEPParserModuleInstance() throws Exception {
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
+
+        SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
+        return transaction.commit();
+    }
+}
index dc64b7259a1abd386bdb7dff4c0339b8f1ea9d44..ddca82573c22ccc94f6b0a7d0154b84c7b1080e8 100644 (file)
@@ -25,11 +25,11 @@ public class SrPCEPSessionProposalFactoryModule extends org.opendaylight.control
 
     private static final Logger LOG = LoggerFactory.getLogger(SrPCEPSessionProposalFactoryModule.class);
 
-    public SrPCEPSessionProposalFactoryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    public SrPCEPSessionProposalFactoryModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
 
-    public SrPCEPSessionProposalFactoryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.pcep.sr.cfg.SrPCEPSessionProposalFactoryModule oldModule, java.lang.AutoCloseable oldInstance) {
+    public SrPCEPSessionProposalFactoryModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.pcep.sr.cfg.SrPCEPSessionProposalFactoryModule oldModule, final java.lang.AutoCloseable oldInstance) {
         super(identifier, dependencyResolver, oldModule, oldInstance);
     }
 
@@ -39,23 +39,30 @@ public class SrPCEPSessionProposalFactoryModule extends org.opendaylight.control
         JmxAttributeValidationException.checkNotNull(getInitiated(), VALUE_IS_NOT_SET, initiatedJmxAttribute);
         JmxAttributeValidationException.checkNotNull(getDeadTimerValue(), VALUE_IS_NOT_SET, deadTimerValueJmxAttribute);
         JmxAttributeValidationException.checkNotNull(getKeepAliveTimerValue(), VALUE_IS_NOT_SET, keepAliveTimerValueJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getTriggeredInitialSync(), VALUE_IS_NOT_SET, triggeredInitialSyncJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getTriggeredResync(), VALUE_IS_NOT_SET, triggeredResyncJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getDeltaLspSyncCapability(), VALUE_IS_NOT_SET, deltaLspSyncCapabilityJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getIncludeDbVersion(), VALUE_IS_NOT_SET, includeDbVersionJmxAttribute);
         if (getKeepAliveTimerValue() != 0) {
-            JmxAttributeValidationException.checkCondition(getKeepAliveTimerValue() >= 1, "minimum value is 1.",
-                    keepAliveTimerValueJmxAttribute);
+            JmxAttributeValidationException.checkCondition(getKeepAliveTimerValue() >= 1, "minimum value is 1.", keepAliveTimerValueJmxAttribute);
             if (getDeadTimerValue() != 0 && (getDeadTimerValue() / getKeepAliveTimerValue() != DEADTIMER_KEEPALIVE_RATIO)) {
                 LOG.warn("DeadTimerValue should be 4 times greater than KeepAliveTimerValue");
             }
         }
-        if (getActive() && !getStateful()) {
+        if ((getActive() || getTriggeredInitialSync() || getTriggeredResync() || getDeltaLspSyncCapability() || getIncludeDbVersion()) && !getStateful()) {
             setStateful(true);
         }
+        if ((getTriggeredInitialSync() || getDeltaLspSyncCapability()) && !getIncludeDbVersion()) {
+            setIncludeDbVersion(true);
+        }
         JmxAttributeValidationException.checkNotNull(getStateful(), VALUE_IS_NOT_SET, statefulJmxAttribute);
         JmxAttributeValidationException.checkNotNull(getSrCapable(), VALUE_IS_NOT_SET, srCapableJmxAttribute);
     }
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        final SegmentRoutingSessionProposalFactory inner = new SegmentRoutingSessionProposalFactory(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getInitiated(), getSrCapable());
+        final SegmentRoutingSessionProposalFactory inner = new SegmentRoutingSessionProposalFactory(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getInitiated(), getSrCapable(),
+            getTriggeredInitialSync(), getTriggeredResync(), getDeltaLspSyncCapability(), getIncludeDbVersion());
         return new PCEPSessionProposalFactoryCloseable(inner);
     }
 
index 54188d84762483c0a3ae5fbee2941e0f4e82ef45..48876cdc45a5562b1ee3211bd47690440ca6ae76 100644 (file)
@@ -20,8 +20,8 @@ public class SegmentRoutingSessionProposalFactory extends Stateful07SessionPropo
     private final boolean isSegmentRoutingCapable;
 
     public SegmentRoutingSessionProposalFactory(final int deadTimer, final int keepAlive, final boolean stateful, final boolean active,
-            final boolean instant, final boolean isSegmentRoutingCapable) {
-        super(deadTimer, keepAlive, stateful, active, instant);
+            final boolean instant, final boolean isSegmentRoutingCapable, final boolean triggeredSync, final boolean triggeredResync, final boolean deltaLspSync, final boolean includeDbVersion) {
+        super(deadTimer, keepAlive, stateful, active, instant, triggeredSync, triggeredResync, deltaLspSync, includeDbVersion);
         this.isSegmentRoutingCapable = isSegmentRoutingCapable;
     }
 
index b56bac65324ec29419375d2c88b99e9febda36f0..314ffbc003a3ea02a1f4703d687d10c6c4666c57 100644 (file)
@@ -7,6 +7,7 @@ module odl-pcep-segment-routing-cfg {
     import config { prefix config; revision-date 2013-04-05; }
     import odl-pcep-api-cfg { prefix pcep; revision-date 2013-04-09; }
     import odl-pcep-spi-cfg { prefix spi; revision-date 2013-11-15; }
+    import odl-pcep-ietf-stateful07-cfg { prefix pcep-stateful07; revision-date 2015-07-14; }
 
     organization "Cisco Systems, Inc.";
 
@@ -49,32 +50,7 @@ module odl-pcep-segment-routing-cfg {
     augment "/config:modules/config:module/config:configuration" {
         case pcep-session-proposal-factory-sr {
             when "/config:modules/config:module/config:type = 'pcep-session-proposal-factory-sr'";
-
-            leaf dead-timer-value {
-                type uint8;
-                default 120;
-            }
-
-            leaf keep-alive-timer-value {
-                type uint8;
-                default 30;
-            }
-
-            leaf initiated {
-                type boolean;
-                default true;
-            }
-
-            leaf stateful {
-                type boolean;
-                default true;
-            }
-
-            leaf active {
-                type boolean;
-                default true;
-            }
-
+            uses pcep-stateful07:stateful-capabilities;
             leaf sr-capable {
                 type boolean;
                 default true;
index 0b5867e7281ce8a56b5bca876274622e68008675..f5fae1fdf008819188f7da33edc1e841d35ea368 100644 (file)
@@ -8,9 +8,9 @@
 
 package org.opendaylight.controller.config.yang.pcep.sr.cfg;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.ObjectName;
 import org.junit.Before;
@@ -29,13 +29,13 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
 
     @Before
     public void setUp() throws Exception {
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new SrPCEPSessionProposalFactoryModuleFactory()));
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new SrPCEPSessionProposalFactoryModuleFactory()));
     }
 
     @Test
     public void testValidationExceptionDeadTimerValueNotSet() throws Exception {
         try {
-            createInstance(null, (short) 100, true, true, true, true);
+            createInstance(null, (short) 100, true, true, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("DeadTimerValue value is not set"));
@@ -45,7 +45,7 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
     @Test
     public void testValidationExceptionKeepAliveTimerNotSet() throws Exception {
         try {
-            createInstance((short) 200, null, true, true, true, true);
+            createInstance((short) 200, null, true, true, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("KeepAliveTimerValue value is not set"));
@@ -55,7 +55,7 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
     @Test
     public void testValidationExceptionStatefulNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, null, false, false, true);
+            createInstance((short) 200, (short) 100, null, false, false, false, false, false, false, false);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("Stateful value is not set"));
@@ -65,7 +65,7 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
     @Test
     public void testValidationExceptionActiveNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, true, null, true, true);
+            createInstance((short) 200, (short) 100, true, null, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("Active value is not set"));
@@ -75,7 +75,7 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
     @Test
     public void testValidationExceptionInstantiatedNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, true, true, null, true);
+            createInstance((short) 200, (short) 100, true, true, null, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("Initiated value is not set"));
@@ -85,7 +85,7 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
     @Test
     public void testValidationExceptionKeepAliveTimerMinValue() throws Exception {
         try {
-            createInstance((short) 200, (short) -10, true, true, true, true);
+            createInstance((short) 200, (short) -10, true, true, true, true, true, true, true, true);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("minimum value is 1."));
@@ -94,23 +94,90 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
 
     @Test
     public void testStatefulAfterCommitted() throws Exception {
-        createInstance((short) 200, (short) 100, false, true, true, true);
+        createInstance((short) 200, (short) 100, false, true, true, true, true, true, true, true);
         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
         final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
                 FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
         assertTrue(mxBean.getStateful());
     }
 
+    @Test
+    public void testNotStatefulAfterCommitted() throws Exception {
+        createInstance((short) 200, (short) 100, false, false, false, false, false, false, false, false);
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
+                FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
+        assertFalse(mxBean.getStateful());
+    }
+
+    @Test
+    public void testIncludeDbVersionAfterCommitted() throws Exception {
+        createInstance((short) 200, (short) 100, false, false, false, false, false, false, true, false);
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
+                FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
+        assertTrue(mxBean.getIncludeDbVersion());
+    }
+
+    @Test
+    public void testNotIncludeDbVersionAfterCommitted() throws Exception {
+        createInstance((short) 200, (short) 100, false, false, false, false, false, false, false, false);
+        final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+        final Stateful07PCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(
+                FACTORY_NAME, INSTANCE_NAME), Stateful07PCEPSessionProposalFactoryModuleMXBean.class);
+        assertFalse(mxBean.getIncludeDbVersion());
+    }
+
     @Test
     public void testValidationExceptionSrCapableValueNotSet() throws Exception {
         try {
-            createInstance((short) 200, (short) 100, true, true, true, null);
+            createInstance((short) 200, (short) 100, true, true, true, null, false, false, false, false);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("SrCapable value is not set"));
         }
     }
 
+    @Test
+    public void testValidationExceptionTriggeredSyncNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, null, true, true, true);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("TriggeredInitialSync value is not set"));
+        }
+    }
+
+    @Test
+    public void testValidationExceptionTriggeredResyncNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, true, null, true, true);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("TriggeredResync value is not set"));
+        }
+    }
+
+    @Test
+    public void testValidationExceptionDeltaLspSyncNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, true, true, null, true);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("DeltaLspSyncCapability value is not set"));
+        }
+    }
+
+    @Test
+    public void testValidationExceptionIncludeDBVersionNotSet() throws Exception {
+        try {
+            createInstance((short) 200, (short) 100, true, true, true, true, true, true, true, null);
+            fail();
+        } catch (final ValidationException e) {
+            assertTrue(e.getMessage().contains("IncludeDbVersion value is not set"));
+        }
+    }
+
     @Test
     public void testCreateBean() throws Exception {
         final CommitStatus status = createInstance();
@@ -141,18 +208,20 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
     }
 
     private CommitStatus createInstance() throws Exception {
-        return createInstance((short) 200, (short) 100, true, true, true, true);
+        return createInstance((short) 200, (short) 100, true, true, true, true, true, true, true, true);
     }
 
     private CommitStatus createInstance(final Short deadTimer, final Short keepAlive,
-            final Boolean stateful, final Boolean active, final Boolean instant, final Boolean srCapable) throws Exception {
+            final Boolean stateful, final Boolean active, final Boolean instant, final Boolean srCapable,
+            final Boolean triggeredInitialSync, final Boolean triggeredResync, final Boolean deltaLspSyncCapability, final Boolean includeDbVersion) throws Exception {
         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
-        createInstance(transaction, deadTimer, keepAlive, stateful, active, instant, srCapable);
+        createInstance(transaction, deadTimer, keepAlive, stateful, active, instant, srCapable, triggeredInitialSync, triggeredResync, deltaLspSyncCapability, includeDbVersion);
         return transaction.commit();
     }
 
     private ObjectName createInstance(final ConfigTransactionJMXClient transaction, final Short deadTimer, final Short keepAlive,
-            final Boolean stateful, final Boolean active, final Boolean instant, final Boolean srCapable) throws InstanceAlreadyExistsException {
+            final Boolean stateful, final Boolean active, final Boolean instant, final Boolean srCapable,
+            final Boolean triggeredInitialSync, final Boolean triggeredResync, final Boolean deltaLspSyncCapability, final Boolean includeDbVersion) throws InstanceAlreadyExistsException {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
         final SrPCEPSessionProposalFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated,
                 SrPCEPSessionProposalFactoryModuleMXBean.class);
@@ -162,6 +231,10 @@ public class SrPCEPSessionProposalFactoryModuleTest extends AbstractConfigTest {
         mxBean.setKeepAliveTimerValue(keepAlive);
         mxBean.setStateful(stateful);
         mxBean.setSrCapable(srCapable);
+        mxBean.setTriggeredInitialSync(triggeredInitialSync);
+        mxBean.setTriggeredResync(triggeredResync);
+        mxBean.setDeltaLspSyncCapability(deltaLspSyncCapability);
+        mxBean.setIncludeDbVersion(includeDbVersion);
         return nameCreated;
     }
 }
index e8c47ce13820bc861a87933e057c03b9e5cef854..b4d29986c7f1176ea960ba766f1c9e60ebf2d1cc 100644 (file)
@@ -30,8 +30,15 @@ public class SegmentRouting02SessionProposalTest {
             .setKeepalive((short) KEEP_ALIVE)
             .setSessionId((short) SESSION_ID)
             .setTlvs(new TlvsBuilder()
-                .addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder().addAugmentation(Stateful1.class,
-                        new Stateful1Builder().setInitiation(true).build()).setLspUpdateCapability(true).build()).build())
+                .addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder()
+                    .addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(true).build())
+                    .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder()
+                        .setTriggeredInitialSync(true)
+                        .setTriggeredResync(false)
+                        .setDeltaLspSyncCapability(true)
+                        .setIncludeDbVersion(false)
+                        .build())
+                    .setLspUpdateCapability(true).build()).build())
                 .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev150112.Tlvs1.class,
                         new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev150112.Tlvs1Builder()
                         .setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 0).build()).build())
@@ -40,13 +47,17 @@ public class SegmentRouting02SessionProposalTest {
 
     @Test
     public void testSegmentRouting02SessionProposalFactory() {
-        final SegmentRoutingSessionProposalFactory sspf = new SegmentRoutingSessionProposalFactory(DEAD_TIMER, KEEP_ALIVE, true, true, true, true);
+        final SegmentRoutingSessionProposalFactory sspf = new SegmentRoutingSessionProposalFactory(DEAD_TIMER, KEEP_ALIVE, true, true, true, true, true, false, true, false);
         Assert.assertEquals(DEAD_TIMER, sspf.getDeadTimer());
         Assert.assertEquals(KEEP_ALIVE, sspf.getKeepAlive());
         Assert.assertTrue(sspf.isActive());
         Assert.assertTrue(sspf.isInstant());
         Assert.assertTrue(sspf.isStateful());
         Assert.assertTrue(sspf.isSegmentRoutingCapable());
+        Assert.assertFalse(sspf.isTriggeredResync());
+        Assert.assertTrue(sspf.isTriggeredSync());
+        Assert.assertTrue(sspf.isDeltaLspSync());
+        Assert.assertFalse(sspf.isIncludeDbVersion());
         Assert.assertEquals(OPEN_MSG, sspf.getSessionProposal(null, SESSION_ID));
     }
 }
index d73813517e9d38e2e27e7ddcd3b9dfb758d2edb8..8d7168c873a34674029a7e39390f31a168659f26 100644 (file)
@@ -117,7 +117,7 @@ public final class Main {
             deadTimerValue = keepAliveValue * KA_TO_DEADTIMER_RATIO;
         }
 
-        final PCEPSessionProposalFactory spf = new Stateful07SessionProposalFactory(deadTimerValue, keepAliveValue, stateful, active, instant);
+        final PCEPSessionProposalFactory spf = new Stateful07SessionProposalFactory(deadTimerValue, keepAliveValue, stateful, active, instant, false, false, false, false);
 
         final Open prefs = spf.getSessionProposal(address, 0);
 
index ab00b1490332371072e0f2d40cf98e315c18ef19..02392a415bc23c6233fee556d17df53947ecd9fc 100644 (file)
@@ -14,7 +14,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.opendaylight.protocol.pcep.pcc.mock.MsgBuilderUtil.createLspTlvs;
-
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import java.net.UnknownHostException;
@@ -312,7 +311,7 @@ public class Stateful07TopologySessionListenerTest extends AbstractPCEPSessionTe
     @Test
     public void testUpdateUnknownLsp() throws InterruptedException, ExecutionException {
         this.listener.onSessionUp(this.session);
-        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder updArgsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder updArgsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder();
         updArgsBuilder.setEro(createEroWithIpPrefixes(Lists.newArrayList(ERO_IP_PREFIX, DST_IP_PREFIX)));
         updArgsBuilder.addAugmentation(Arguments3.class, new Arguments3Builder().setLsp(new LspBuilder().setDelegate(true).setAdministrative(true).build()).build());
         final UpdateLspInput update = new UpdateLspInputBuilder().setArguments(updArgsBuilder.build()).setName(TUNNEL_NAME).setNetworkTopologyRef(new NetworkTopologyRef(TOPO_IID)).setNode(NODE_ID).build();
@@ -361,7 +360,10 @@ public class Stateful07TopologySessionListenerTest extends AbstractPCEPSessionTe
 
     @Override
     protected Open getLocalPref() {
-        return new OpenBuilder(super.getLocalPref()).setTlvs(new TlvsBuilder().addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder().addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build()).build()).build()).build()).build();
+        return new OpenBuilder(super.getLocalPref()).setTlvs(new TlvsBuilder().addAugmentation(Tlvs1.class, new Tlvs1Builder().setStateful(new StatefulBuilder()
+            .addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build())
+            .addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Stateful1Builder().setTriggeredInitialSync(Boolean.TRUE).build())
+            .build()).build()).build()).build();
     }
 
     private AddLspInput createAddLspInput() {