<capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:spi?module=odl-pcep-spi-cfg&revision=2013-11-15</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:programming:spi?module=odl-programming-spi-cfg&revision=2013-11-15</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful02:cfg?module=odl-pcep-ietf-stateful02-cfg&revision=2014-02-21</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg?module=odl-pcep-ietf-stateful07-cfg&revision=2014-02-21</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg?module=odl-pcep-ietf-stateful07-cfg&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>
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);
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);
}
--- /dev/null
+/*
+ * 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();
+ }
+
+}
--- /dev/null
+/*
+ * 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 {
+
+}
/**
* 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) {
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;
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
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();
}
}
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;
+ }
}
--- /dev/null
+/*
+ * 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;
+ }
+}
--- /dev/null
+/*
+ * 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;
+ }
+}
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.";
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;
}
}
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'";
+ }
+ }
}
--- /dev/null
+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
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;
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;
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 };
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();
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;
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;
}
}
+ @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()) {
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());
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());
*/
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;
@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"));
@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"));
@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"));
@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"));
@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."));
@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();
}
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();
}
}
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);
mxBean.setInitiated(instant);
mxBean.setKeepAliveTimerValue(keepAlive);
mxBean.setStateful(stateful);
+ mxBean.setTriggeredInitialSync(triggeredInitialSync);
+ mxBean.setTriggeredResync(triggeredResync);
+ mxBean.setDeltaLspSyncCapability(deltaLspSyncCapability);
+ mxBean.setIncludeDbVersion(includeDbVersion);
return nameCreated;
}
.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));
}
}
--- /dev/null
+/*
+ * 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();
+ }
+}
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);
}
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);
}
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;
}
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.";
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;
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;
@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"));
@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"));
@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"));
@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"));
@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"));
@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."));
@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();
}
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);
mxBean.setKeepAliveTimerValue(keepAlive);
mxBean.setStateful(stateful);
mxBean.setSrCapable(srCapable);
+ mxBean.setTriggeredInitialSync(triggeredInitialSync);
+ mxBean.setTriggeredResync(triggeredResync);
+ mxBean.setDeltaLspSyncCapability(deltaLspSyncCapability);
+ mxBean.setIncludeDbVersion(includeDbVersion);
return nameCreated;
}
}
.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())
@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));
}
}
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);
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;
@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();
@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() {