}
}
- grouping lsp-db-version-tlv {
- description "LSP State Database Version TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.1.2";
-
- container lsp-db-version {
- uses pcep:tlv;
- leaf version {
- type uint64;
- mandatory true;
- }
- }
- }
-
grouping lsp-identifiers-tlv {
description "LSP Identifiers TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.3.1";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.1";
container lsp-identifiers {
uses pcep:tlv;
leaf lsp-id {
type rsvp:ipv4-extended-tunnel-id;
mandatory true;
}
+ leaf ipv4-tunnel-endpoint-address {
+ type inet:ipv4-address;
+ mandatory true;
+ }
}
}
case ipv6-case {
type rsvp:ipv6-extended-tunnel-id;
mandatory true;
}
+ leaf ipv6-tunnel-endpoint-address {
+ type inet:ipv6-address;
+ mandatory true;
+ }
}
}
}
grouping lsp-error-code-tlv {
description "LSP Error Code TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.3.3";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.3";
container lsp-error-code {
uses pcep:tlv;
leaf error-code {
grouping rsvp-error-spec-tlv {
description "RSVP Error Spec TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.3.4";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.4";
container rsvp-error-spec {
uses pcep:tlv;
choice error-type {
grouping stateful-capability-tlv {
description "Stateful PCE Capability TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.1.1";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.1.1";
container stateful {
uses pcep:tlv;
type boolean;
default false;
}
- leaf include-db-version {
- type boolean;
- default false;
- }
}
}
grouping symbolic-path-name-tlv {
description "Symbolic Path Name TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.3.2";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.2";
container symbolic-path-name {
uses pcep:tlv;
leaf path-name {
}
}
- grouping predundancy-group-id-tlv {
- description "PCE Redundancy Group Identifier TLV";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.1.3";
-
- container predundancy-group-id {
- uses pcep:tlv;
- leaf identifier {
- type binary;
- mandatory true;
- }
- }
- }
-
grouping lsp-object {
description "LSP Object";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.3";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3";
container lsp {
uses pcep:object;
grouping srp-object {
description "SRP Object";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-7.2";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.2";
container srp {
uses pcep:object;
+ container "tlvs" {
+ uses symbolic-path-name-tlv;
+ }
+
leaf operation-id {
type srp-id-number;
mandatory true;
}
-
- leaf flags {
- type bits {
- bit lsp-remove {
- position 31;
- }
- }
- }
}
}
container pcupd-message {
description "State Update Request Message";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-6.2";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-6.2";
uses pcep:message-header;
container pcrpt-message {
description "State Report Message";
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-6.1";
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-6.1";
uses pcep:message-header;
}
augment "/msg:open/msg:open-message/msg:open/msg:tlvs" {
- uses lsp-db-version-tlv;
-
- uses predundancy-group-id-tlv;
-
uses stateful-capability-tlv;
}
augment "/msg:pcerr/msg:pcerr-message/msg:error-type/msg:session-case/msg:session/msg:open/msg:tlvs" {
- uses lsp-db-version-tlv;
-
- uses predundancy-group-id-tlv;
-
uses stateful-capability-tlv;
}
- augment "/msg:pcreq/msg:pcreq-message/msg:requests/msg:segment-computation/msg:p2p" {
- uses lsp-object;
- }
-
- augment "/msg:pcrep/msg:pcrep-message/msg:replies" {
- uses lsp-object;
- }
-
augment "/msg:pcerr/msg:pcerr-message/msg:error-type" {
+ reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-6.3";
case stateful-case {
container stateful {
- reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-05#section-6.3";
- uses srp-object;
+ list srps {
+ uses srp-object;
+ }
}
}
}
public void validate() {
super.validate();
JmxAttributeValidationException.checkNotNull(getActive(), "value is not set.", this.activeJmxAttribute);
- JmxAttributeValidationException.checkNotNull(getVersioned(), "value is not set.", this.versionedJmxAttribute);
JmxAttributeValidationException.checkNotNull(getInitiated(), "value is not set.", this.initiatedJmxAttribute);
JmxAttributeValidationException.checkNotNull(getDeadTimerValue(), "value is not set.", this.deadTimerValueJmxAttribute);
JmxAttributeValidationException.checkNotNull(getKeepAliveTimerValue(), "value is not set.", this.keepAliveTimerValueJmxAttribute);
LOG.warn("DeadTimerValue should be 4 times greater than KeepAliveTimerValue");
}
}
- if ((getActive() || getVersioned()) && !getStateful()) {
+ if (getActive() && !getStateful()) {
setStateful(true);
}
JmxAttributeValidationException.checkNotNull(getStateful(), "value is not set.", this.statefulJmxAttribute);
@Override
public java.lang.AutoCloseable createInstance() {
- final PCEPSessionProposalFactoryImpl inner = new PCEPSessionProposalFactoryImpl(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getVersioned(), getInitiated());
+ final PCEPSessionProposalFactoryImpl inner = new PCEPSessionProposalFactoryImpl(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getInitiated());
return new PCEPSessionProposalFactoryCloseable(inner);
}
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-public class PCEPSessionProposalFactoryImplModuleTest extends
-AbstractConfigTest {
+public class PCEPSessionProposalFactoryImplModuleTest extends AbstractConfigTest {
private final String instanceName = "pcep-proposal";
@Before
public void setUp() throws Exception {
this.factory = new PCEPSessionProposalFactoryImplModuleFactory();
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
- factory));
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory));
}
@Test
- public void testValidationExceptionDeadTimerValueNotSet()
- throws InstanceAlreadyExistsException {
+ public void testValidationExceptionDeadTimerValueNotSet() throws InstanceAlreadyExistsException {
try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, null, 100, true, true, true, true);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, null, 100, true, true, true, true);
transaction.validateConfig();
fail();
- } catch (ValidationException e) {
- assertTrue(e.getMessage().contains(
- "DeadTimerValue value is not set"));
+ } catch (final ValidationException e) {
+ assertTrue(e.getMessage().contains("DeadTimerValue value is not set"));
}
}
@Test
- public void testValidationExceptionKeepAliveTimerNotSet()
- throws InstanceAlreadyExistsException {
+ public void testValidationExceptionKeepAliveTimerNotSet() throws InstanceAlreadyExistsException {
try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, null, true, true, true, true);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, null, true, true, true, true);
transaction.validateConfig();
fail();
- } catch (ValidationException e) {
- assertTrue(e.getMessage().contains(
- "KeepAliveTimerValue value is not set"));
+ } catch (final ValidationException e) {
+ assertTrue(e.getMessage().contains("KeepAliveTimerValue value is not set"));
}
}
@Test
- public void testValidationExceptionStatefulNotSet()
- throws InstanceAlreadyExistsException {
+ public void testValidationExceptionStatefulNotSet() throws InstanceAlreadyExistsException {
try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, null, false, false, false);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, 100, null, false, false, false);
transaction.validateConfig();
fail();
- } catch (ValidationException e) {
+ } catch (final ValidationException e) {
assertTrue(e.getMessage().contains("Stateful value is not set"));
}
}
@Test
- public void testValidationExceptionActiveNotSet()
- throws InstanceAlreadyExistsException {
+ public void testValidationExceptionActiveNotSet() throws InstanceAlreadyExistsException {
try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, null, true, true);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, 100, true, null, true, true);
transaction.validateConfig();
fail();
- } catch (ValidationException e) {
+ } catch (final ValidationException e) {
assertTrue(e.getMessage().contains("Active value is not set"));
}
}
@Test
- public void testValidationExceptionVersionedNotSet()
- throws InstanceAlreadyExistsException {
+ public void testValidationExceptionInstantiatedNotSet() throws InstanceAlreadyExistsException {
try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, null, true);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, 100, true, true, true, null);
transaction.validateConfig();
fail();
- } catch (ValidationException e) {
- assertTrue(e.getMessage().contains("Versioned value is not set"));
- }
- }
-
- @Test
- public void testValidationExceptionInstantiatedNotSet()
- throws InstanceAlreadyExistsException {
- try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, null);
- transaction.validateConfig();
- fail();
- } catch (ValidationException e) {
+ } catch (final ValidationException e) {
assertTrue(e.getMessage().contains("Initiated value is not set"));
}
}
@Test
- public void testValidationExceptionKeepAliveTimerMinValue()
- throws InstanceAlreadyExistsException {
+ public void testValidationExceptionKeepAliveTimerMinValue() throws InstanceAlreadyExistsException {
try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, -10, true, true, true, true);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, -10, true, true, true, true);
transaction.validateConfig();
fail();
- } catch (ValidationException e) {
+ } catch (final ValidationException e) {
assertTrue(e.getMessage().contains("minimum value is 1."));
}
}
@Test
- public void testStatefulAfterCommitted()
- throws InstanceAlreadyExistsException, InstanceNotFoundException {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, false, true, true, true);
+ public void testStatefulAfterCommitted() throws InstanceAlreadyExistsException, InstanceNotFoundException {
+ ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, 100, false, true, true, true);
transaction.validateConfig();
transaction.commit();
- transaction = configRegistryClient.createTransaction();
- PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction
- .newMBeanProxy(
- transaction
- .lookupConfigBean(
- AbstractPCEPSessionProposalFactoryImplModuleFactory.NAME,
- instanceName),
- PCEPSessionProposalFactoryImplModuleMXBean.class);
+ transaction = this.configRegistryClient.createTransaction();
+ final PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction.newMBeanProxy(
+ transaction.lookupConfigBean(AbstractPCEPSessionProposalFactoryImplModuleFactory.NAME, this.instanceName),
+ PCEPSessionProposalFactoryImplModuleMXBean.class);
assertTrue(mxBean.getStateful());
}
@Test
public void testCreateBean() throws Exception {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 0, 0, true, true, true, true);
+ final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 0, 0, true, true, true, true);
transaction.validateConfig();
- CommitStatus status = transaction.commit();
- assertBeanCount(1, factory.getImplementationName());
+ final CommitStatus status = transaction.commit();
+ assertBeanCount(1, this.factory.getImplementationName());
assertStatus(status, 1, 0, 0);
}
@Test
- public void testReusingOldInstance() throws InstanceAlreadyExistsException,
- ConflictingVersionException, ValidationException {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, true);
+ public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
+ ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, 100, true, true, true, true);
transaction.commit();
- transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, factory.getImplementationName());
- CommitStatus status = transaction.commit();
- assertBeanCount(1, factory.getImplementationName());
+ transaction = this.configRegistryClient.createTransaction();
+ assertBeanCount(1, this.factory.getImplementationName());
+ final CommitStatus status = transaction.commit();
+ assertBeanCount(1, this.factory.getImplementationName());
assertStatus(status, 0, 0, 1);
}
@Test
- public void testReconfigure() throws InstanceAlreadyExistsException,
- ConflictingVersionException, ValidationException,
- InstanceNotFoundException {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, true);
+ public void testReconfigure() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException,
+ InstanceNotFoundException {
+ ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
+ createInstance(transaction, this.factory.getImplementationName(), this.instanceName, 400, 100, true, true, true, true);
transaction.commit();
- transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, factory.getImplementationName());
- PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction
- .newMBeanProxy(
- transaction
- .lookupConfigBean(
- AbstractPCEPSessionProposalFactoryImplModuleFactory.NAME,
- instanceName),
- PCEPSessionProposalFactoryImplModuleMXBean.class);
- CommitStatus status = transaction.commit();
- assertBeanCount(1, factory.getImplementationName());
+ transaction = this.configRegistryClient.createTransaction();
+ assertBeanCount(1, this.factory.getImplementationName());
+ final PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction.newMBeanProxy(
+ transaction.lookupConfigBean(AbstractPCEPSessionProposalFactoryImplModuleFactory.NAME, this.instanceName),
+ PCEPSessionProposalFactoryImplModuleMXBean.class);
+ final CommitStatus status = transaction.commit();
+ assertBeanCount(1, this.factory.getImplementationName());
assertStatus(status, 0, 0, 1);
}
- public static ObjectName createInstance(
- final ConfigTransactionJMXClient transaction,
- final String moduleName, final String instanceName,
- final Integer deadTimer, final Integer keepAlive,
- final Boolean stateful, final Boolean active,
+ public static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
+ final String instanceName, final Integer deadTimer, final Integer keepAlive, final Boolean stateful, final Boolean active,
final Boolean versioned, final Boolean instant) throws InstanceAlreadyExistsException {
- ObjectName nameCreated = transaction.createModule(moduleName,
- instanceName);
- PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction
- .newMBeanProxy(nameCreated,
- PCEPSessionProposalFactoryImplModuleMXBean.class);
+ final ObjectName nameCreated = transaction.createModule(moduleName, instanceName);
+ final PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+ PCEPSessionProposalFactoryImplModuleMXBean.class);
mxBean.setActive(active);
mxBean.setDeadTimerValue(deadTimer);
mxBean.setInitiated(instant);
import org.opendaylight.protocol.pcep.PCEPSessionListener;
import org.opendaylight.protocol.pcep.TerminationReason;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.CloseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
import org.slf4j.LoggerFactory;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Charsets;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.base.Preconditions;
@Override
public String getNodeIdentifier() {
- if (this.remoteOpen.getTlvs() == null && this.remoteOpen.getTlvs().getAugmentation(Tlvs2.class).getPredundancyGroupId() != null) {
- return new String(this.remoteOpen.getTlvs().getAugmentation(Tlvs2.class).getPredundancyGroupId().getIdentifier(), Charsets.UTF_8);
- }
return "";
}
}
private final int keepAlive, deadTimer;
- private final boolean stateful, active, versioned, instant;
+ private final boolean stateful, active, instant;
public PCEPSessionProposalFactoryImpl(final int deadTimer, final int keepAlive, final boolean stateful, final boolean active,
- final boolean versioned, final boolean instant) {
+ final boolean instant) {
this.deadTimer = deadTimer;
this.keepAlive = keepAlive;
this.stateful = stateful;
this.active = active;
- this.versioned = versioned;
this.instant = instant;
}
builder.addAugmentation(
Tlvs2.class,
new Tlvs2Builder().setStateful(
- new StatefulBuilder().setIncludeDbVersion(this.versioned).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()).build()).build()).build();
}
final OpenBuilder oBuilder = new OpenBuilder();
oBuilder.setSessionId((short) sessionId);
return this.active;
}
+ @Deprecated
public boolean isVersioned() {
- return this.versioned;
+ return false;
}
public boolean isInstant() {
import org.opendaylight.protocol.pcep.impl.object.PCEPSrpObjectParser;
import org.opendaylight.protocol.pcep.impl.tlv.LSPIdentifierIpv4TlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.LSPIdentifierIpv6TlvParser;
-import org.opendaylight.protocol.pcep.impl.tlv.LspDbVersionTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.LspSymbolicNameTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.LspUpdateErrorTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.PCEStatefulCapabilityTlvParser;
-import org.opendaylight.protocol.pcep.impl.tlv.PredundancyGroupTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.RSVPErrorSpecTlvParser;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
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.Pcrpt;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Pcupd;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersion;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.error.code.tlv.LspErrorCode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.identifiers.tlv.LspIdentifiers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.Lsp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.rsvp.error.spec.tlv.RsvpErrorSpec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.stateful.capability.tlv.Stateful;
regs.add(context.registerObjectParser(PCEPOpenObjectParser.CLASS, PCEPOpenObjectParser.TYPE, new PCEPOpenObjectParser(tlvReg)));
regs.add(context.registerObjectSerializer(Open.class, new PCEPOpenObjectParser(tlvReg)));
- regs.add(context.registerTlvParser(LspDbVersionTlvParser.TYPE, new LspDbVersionTlvParser()));
- regs.add(context.registerTlvSerializer(LspDbVersion.class, new LspDbVersionTlvParser()));
regs.add(context.registerTlvParser(LSPIdentifierIpv4TlvParser.TYPE, new LSPIdentifierIpv4TlvParser()));
regs.add(context.registerTlvParser(LSPIdentifierIpv6TlvParser.TYPE, new LSPIdentifierIpv6TlvParser()));
regs.add(context.registerTlvSerializer(LspIdentifiers.class, new LSPIdentifierIpv4TlvParser()));
regs.add(context.registerTlvSerializer(Stateful.class, new PCEStatefulCapabilityTlvParser()));
regs.add(context.registerTlvParser(LspSymbolicNameTlvParser.TYPE, new LspSymbolicNameTlvParser()));
regs.add(context.registerTlvSerializer(SymbolicPathName.class, new LspSymbolicNameTlvParser()));
- regs.add(context.registerTlvParser(PredundancyGroupTlvParser.TYPE, new PredundancyGroupTlvParser()));
- regs.add(context.registerTlvSerializer(PredundancyGroupId.class, new PredundancyGroupTlvParser()));
return regs;
}
import io.netty.buffer.ByteBuf;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcerr.pcerr.message.error.type.StatefulCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcerr.pcerr.message.error.type.stateful._case.stateful.Srps;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcerr.pcerr.message.error.type.stateful._case.stateful.SrpsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.error.type.session._case.SessionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.Rp;
-import com.google.common.collect.Lists;
-
/**
* Parser for {@link PcerrMessage}
*/
}
}
+ if (err.getErrorType() instanceof StatefulCase) {
+ final List<Srps> srps = ((StatefulCase) err.getErrorType()).getStateful().getSrps();
+ for (final Srps s : srps) {
+ buffer.writeBytes(serializeObject(s.getSrp()));
+ }
+ }
+
for (final Errors e : err.getErrors()) {
buffer.writeBytes(serializeObject(e.getErrorObject()));
}
throw new PCEPDeserializerException("Error message is empty.");
}
- final List<Rps> requestParameters = Lists.newArrayList();
- final List<Errors> errorObjects = Lists.newArrayList();
+ final List<Rps> requestParameters = new ArrayList<>();
+ final List<Srps> srps = new ArrayList<>();
+ final List<Errors> errorObjects = new ArrayList<>();
final PcerrMessageBuilder b = new PcerrMessageBuilder();
Object obj;
state = State.ErrorIn;
objects.remove(0);
} else if (obj instanceof Rp) {
- final Rp o = ((Rp) obj);
+ final Rp o = (Rp) obj;
if (o.isProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET));
return null;
requestParameters.add(new RpsBuilder().setRp(o).build());
state = State.RpIn;
objects.remove(0);
+ } else if (obj instanceof Srp) {
+ final Srp s = (Srp) obj;
+ srps.add(new SrpsBuilder().setSrp(s).build());
+ state = State.SrpIn;
+ objects.remove(0);
}
while (!objects.isEmpty()) {
state = State.RpIn;
break;
}
+ case SrpIn:
+ state = State.Error;
+ if (obj instanceof Srp) {
+ final Srp o = ((Srp) obj);
+ srps.add(new SrpsBuilder().setSrp(o).build());
+ state = State.SrpIn;
+ break;
+ }
case Open:
state = State.OpenIn;
if (obj instanceof Open) {
}
private enum State {
- Init, ErrorIn, RpIn, Open, Error, OpenIn, End
+ Init, ErrorIn, RpIn, SrpIn, Open, Error, OpenIn, End
}
@Override
buffer.writeBytes(serializeObject(report.getLsp()));
final Path p = report.getPath();
if (p != null) {
- if (p.getEro() != null) {
- buffer.writeBytes(serializeObject(p.getEro()));
- }
+ buffer.writeBytes(serializeObject(p.getEro()));
if (p.getLspa() != null) {
buffer.writeBytes(serializeObject(p.getLspa()));
}
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.P2p1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.P2p1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.Lsp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcreq;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcreqBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
if (p2p.getClassType() != null) {
buffer.writeBytes(serializeObject(p2p.getClassType()));
}
-
- final P2p1 stateful = p2p.getAugmentation(P2p1.class);
- if (stateful != null && stateful.getLsp() != null) {
- buffer.writeBytes(serializeObject(stateful.getLsp()));
- }
}
@Override
break;
}
case CtIn:
- state = State.LspIn;
- if (obj instanceof Lsp) {
- builder.addAugmentation(P2p1.class, new P2p1Builder().setLsp((Lsp)obj).build());
- break;
- }
- case LspIn:
state = State.End;
break;
case End:
&& builder.getBandwidth() != null
&& builder.getReportedRoute().getBandwidth().getBandwidth() != new BandwidthBuilder().setBandwidth(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth(new byte[] { 0 })).build()
- && builder.getReportedRoute().getRro() == null) {
+ && builder.getReportedRoute().getRro() == null) {
errors.add(createErrorMsg(PCEPErrors.RRO_MISSING, rp));
return null;
}
}
private enum State {
- Init, ReportedIn, LoadBIn, LspaIn, BandwidthIn, MetricIn, IroIn, RroIn, XroIn, OfIn, CtIn, LspIn, End
+ Init, ReportedIn, LoadBIn, LspaIn, BandwidthIn, MetricIn, IroIn, RroIn, XroIn, OfIn, CtIn, End
}
private Svec getValidSvec(final SvecBuilder builder, final List<Object> objects) {
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupId;
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.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
final Tlvs2Builder statefulBuilder = new Tlvs2Builder();
if (tbuilder.getAugmentation(Tlvs2.class) != null) {
final Tlvs2 t = tbuilder.getAugmentation(Tlvs2.class);
- if (t.getLspDbVersion() != null) {
- statefulBuilder.setLspDbVersion(t.getLspDbVersion());
- }
- if (t.getPredundancyGroupId() != null) {
- statefulBuilder.setPredundancyGroupId(t.getPredundancyGroupId());
- }
if (t.getClass() != null) {
statefulBuilder.setStateful(t.getStateful());
}
tbuilder.setOfList((OfList) tlv);
} else if (tlv instanceof Stateful) {
statefulBuilder.setStateful((Stateful) tlv);
- } else if (tlv instanceof PredundancyGroupId) {
- statefulBuilder.setPredundancyGroupId((PredundancyGroupId) tlv);
- } else if (tlv instanceof LspDbVersion) {
- statefulBuilder.setLspDbVersion((LspDbVersion) tlv);
}
tbuilder.addAugmentation(Tlvs2.class, statefulBuilder.build());
}
int finalLength = 0;
byte[] ofListBytes = null;
byte[] statefulBytes = null;
- byte[] predundancyBytes = null;
- byte[] lspDbBytes = null;
if (tlvs.getOfList() != null) {
ofListBytes = serializeTlv(tlvs.getOfList());
finalLength += ofListBytes.length;
statefulBytes = serializeTlv(statefulTlvs.getStateful());
finalLength += statefulBytes.length;
}
- if (statefulTlvs.getPredundancyGroupId() != null) {
- predundancyBytes = serializeTlv(statefulTlvs.getPredundancyGroupId());
- finalLength += predundancyBytes.length;
- }
- if (statefulTlvs.getLspDbVersion() != null) {
- lspDbBytes = serializeTlv(statefulTlvs.getLspDbVersion());
- finalLength += lspDbBytes.length;
- }
}
int offset = 0;
ByteArray.copyWhole(statefulBytes, result, offset);
offset += statefulBytes.length;
}
- if (lspDbBytes != null) {
- ByteArray.copyWhole(lspDbBytes, result, offset);
- offset += lspDbBytes.length;
- }
- if (predundancyBytes != null) {
- ByteArray.copyWhole(predundancyBytes, result, offset);
- offset += predundancyBytes.length;
- }
return result;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SrpIdNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.SrpBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.srp.Tlvs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.srp.TlvsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.symbolic.path.name.tlv.SymbolicPathName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
private static final int SRP_ID_SIZE = 4;
+ private static final int TLVS_OFFSET = FLAGS_SIZE + SRP_ID_SIZE;
+
private static final int MIN_SIZE = FLAGS_SIZE + SRP_ID_SIZE;
public PCEPSrpObjectParser(final TlvHandlerRegistry tlvReg) {
@Override
public void addTlv(final SrpBuilder builder, final Tlv tlv) {
- // No tlvs defined
+ if (tlv instanceof SymbolicPathName) {
+ builder.setTlvs(new TlvsBuilder().setSymbolicPathName((SymbolicPathName) tlv).build());
+ }
}
@Override
throw new IllegalArgumentException("Wrong instance of PCEPObject. Passed " + object.getClass() + ". Needed SrpObject.");
}
final Srp srp = (Srp) object;
+ final byte[] tlvs = serializeTlvs(srp.getTlvs());
final Long id = srp.getOperationId().getValue();
if (id == 0 || id == 0xFFFFFFFFL) {
throw new IllegalArgumentException("Min/Max values for SRP ID are reserved.");
}
final byte[] retBytes = new byte[MIN_SIZE];
+ if (tlvs != null) {
+ ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
+ }
System.arraycopy(ByteArray.intToBytes(id.intValue(), SRP_ID_SIZE), 0, retBytes, FLAGS_SIZE, SRP_ID_SIZE);
+ ByteArray.copyWhole(tlvs, retBytes, TLVS_OFFSET);
return ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), retBytes);
}
+ public byte[] serializeTlvs(final Tlvs tlvs) {
+ if (tlvs == null) {
+ return new byte[0];
+ } else if (tlvs.getSymbolicPathName() != null) {
+ return serializeTlv(tlvs.getSymbolicPathName());
+ }
+ return new byte[0];
+ }
+
@Override
public int getObjectType() {
return TYPE;
private static final int LSP_ID_F_LENGTH = 2;
private static final int TUNNEL_ID_F_LENGTH = 2;
- private static final int V4_LENGTH = 12;
+ private static final int V4_LENGTH = 16;
@Override
public LspIdentifiers parseTlv(final byte[] valueBytes) throws PCEPDeserializerException {
position += TUNNEL_ID_F_LENGTH;
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForBytes(ByteArray.subByte(valueBytes, position,
EX_TUNNEL_ID4_F_LENGTH))));
- final AddressFamily afi = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
position += EX_TUNNEL_ID4_F_LENGTH;
+ builder.setIpv4TunnelEndpointAddress(Ipv4Util.addressForBytes(ByteArray.subByte(valueBytes, position, IP4_F_LENGTH)));
+ final AddressFamily afi = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
return new LspIdentifiersBuilder().setAddressFamily(afi).setLspId(lspId).setTunnelId(tunnelId).build();
}
ByteArray.copyWhole(ByteArray.intToBytes(lsp.getTunnelId().getValue(), TUNNEL_ID_F_LENGTH), bytes, offset);
offset += TUNNEL_ID_F_LENGTH;
ByteArray.copyWhole(Ipv4Util.bytesForAddress(ipv4.getIpv4ExtendedTunnelId()), bytes, offset);
+ offset += EX_TUNNEL_ID4_F_LENGTH;
+ ByteArray.copyWhole(Ipv4Util.bytesForAddress(ipv4.getIpv4TunnelEndpointAddress()), bytes, offset);
return bytes;
}
private static final int LSP_ID_F_LENGTH = 2;
private static final int TUNNEL_ID_F_LENGTH = 2;
- private static final int V6_LENGTH = 36;
+ private static final int V6_LENGTH = 52;
@Override
public LspIdentifiers parseTlv(final byte[] valueBytes) throws PCEPDeserializerException {
position += TUNNEL_ID_F_LENGTH;
builder.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForBytes(ByteArray.subByte(valueBytes, position,
EX_TUNNEL_ID6_F_LENGTH))));
- final AddressFamily afi = new Ipv6CaseBuilder().setIpv6(builder.build()).build();
position += EX_TUNNEL_ID6_F_LENGTH;
+ builder.setIpv6TunnelEndpointAddress(Ipv6Util.addressForBytes(ByteArray.subByte(valueBytes, position, IP6_F_LENGTH)));
+ final AddressFamily afi = new Ipv6CaseBuilder().setIpv6(builder.build()).build();
return new LspIdentifiersBuilder().setAddressFamily(afi).setLspId(lspId).setTunnelId(tunnelId).build();
}
ByteArray.copyWhole(ByteArray.intToBytes(lsp.getTunnelId().getValue(), TUNNEL_ID_F_LENGTH), bytes, offset);
offset += TUNNEL_ID_F_LENGTH;
ByteArray.copyWhole(Ipv6Util.bytesForAddress(ipv6.getIpv6ExtendedTunnelId()), bytes, offset);
+ offset += EX_TUNNEL_ID6_F_LENGTH;
+ ByteArray.copyWhole(Ipv6Util.bytesForAddress(ipv6.getIpv6TunnelEndpointAddress()), bytes, offset);
return bytes;
}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.impl.tlv;
-
-import java.util.Arrays;
-
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-
-import com.google.common.primitives.UnsignedLong;
-
-/**
- * Parser for {@link LspDbVersion}
- */
-public class LspDbVersionTlvParser implements TlvParser, TlvSerializer {
-
- public static final int TYPE = 23;
-
- private static final int DBV_F_LENGTH = 8;
-
- @Override
- public LspDbVersion parseTlv(final byte[] buffer) throws PCEPDeserializerException {
- return new LspDbVersionBuilder().setVersion(
- UnsignedLong.fromLongBits(ByteArray.bytesToLong(ByteArray.subByte(buffer, 0, DBV_F_LENGTH))).bigIntegerValue()).build();
- }
-
- @Override
- public byte[] serializeTlv(final Tlv tlv) {
- if (tlv == null) {
- throw new IllegalArgumentException("LspDbVersionTlv is mandatory.");
- }
- final LspDbVersion lsp = (LspDbVersion) tlv;
- final byte[] array = ByteArray.longToBytes(UnsignedLong.valueOf(lsp.getVersion()).longValue(), DBV_F_LENGTH);
- if (array.length > DBV_F_LENGTH) {
- throw new IllegalArgumentException("LspDBVersion too big.");
- }
- final byte[] result = new byte[DBV_F_LENGTH];
- Arrays.fill(result, (byte) 0);
- int j = 7;
- for (int i = array.length - 1; i >= 0; i--) {
- result[j] |= array[i];
- j--;
- }
- return result;
- }
-
- @Override
- public int getType() {
- return TYPE;
- }
-}
private static final int FLAGS_F_LENGTH = 4;
private static final int I_FLAG_OFFSET = 29;
- private static final int S_FLAG_OFFSET = 30;
private static final int U_FLAG_OFFSET = 31;
@Override
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.length + "; Expected: >= "
+ FLAGS_F_LENGTH + ".");
}
-
final BitSet flags = ByteArray.bytesToBitSet(ByteArray.subByte(buffer, 0, FLAGS_F_LENGTH));
final StatefulBuilder sb = new StatefulBuilder();
- sb.setIncludeDbVersion(flags.get(S_FLAG_OFFSET));
sb.setLspUpdateCapability(flags.get(U_FLAG_OFFSET));
if (flags.get(I_FLAG_OFFSET)) {
sb.addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build());
}
-
return sb.build();
}
if (sfi != null) {
flags.set(I_FLAG_OFFSET, sfi.isInitiation());
}
-
flags.set(U_FLAG_OFFSET, sct.isLspUpdateCapability());
- flags.set(S_FLAG_OFFSET, sct.isIncludeDbVersion());
-
return ByteArray.bitSetToBytes(flags, FLAGS_F_LENGTH);
}
+++ /dev/null
-/*
- * Copyright (c) 2013 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.impl.tlv;
-
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-
-/**
- * Parser for {@link PredundancyGroupId}
- */
-public class PredundancyGroupTlvParser implements TlvParser, TlvSerializer {
-
- public static final int TYPE = 24;
-
- @Override
- public PredundancyGroupId parseTlv(final byte[] buffer) throws PCEPDeserializerException {
- return new PredundancyGroupIdBuilder().setIdentifier(buffer).build();
- }
-
- @Override
- public byte[] serializeTlv(final Tlv tlv) {
- if (tlv == null) {
- throw new IllegalArgumentException("PredundancyGroupIdTlv is mandatory.");
- }
- final PredundancyGroupId pgt = (PredundancyGroupId) tlv;
- return pgt.getIdentifier();
- }
-
- @Override
- public int getType() {
- return TYPE;
- }
-}
import static org.junit.Assert.assertEquals;
import java.io.IOException;
-import java.math.BigInteger;
import java.util.List;
import org.junit.Before;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SrpIdNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.error.code.tlv.LspErrorCode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.error.code.tlv.LspErrorCodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.LspBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.SrpBuilder;
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;
builder.setDeadTimer((short) 120);
builder.setSessionId((short) 1);
- final Stateful tlv1 = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).setIncludeDbVersion(Boolean.TRUE).build();
- final LspDbVersion tlv2 = new LspDbVersionBuilder().setVersion(BigInteger.valueOf(0x80L)).build();
- final byte[] predundancyBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc, (byte) 0xde,
- (byte) 0xf0 };
- final PredundancyGroupId tlv3 = new PredundancyGroupIdBuilder().setIdentifier(predundancyBytes).build();
+ final Stateful tlv1 = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).build();
final Tlvs2Builder statBuilder = new Tlvs2Builder();
statBuilder.setStateful(tlv1);
- statBuilder.setLspDbVersion(tlv2);
- statBuilder.setPredundancyGroupId(tlv3);
builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder().addAugmentation(
Tlvs2.class, statBuilder.build()).build());
import org.opendaylight.protocol.concepts.Ipv6Util;
import org.opendaylight.protocol.pcep.impl.tlv.LSPIdentifierIpv4TlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.LSPIdentifierIpv6TlvParser;
-import org.opendaylight.protocol.pcep.impl.tlv.LspDbVersionTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.LspSymbolicNameTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.LspUpdateErrorTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.NoPathVectorTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.OrderTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.OverloadedDurationTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.PCEStatefulCapabilityTlvParser;
-import org.opendaylight.protocol.pcep.impl.tlv.PredundancyGroupTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.RSVPErrorSpecTlvParser;
import org.opendaylight.protocol.pcep.impl.tlv.ReqMissingTlvParser;
import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.error.code.tlv.LspErrorCode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.error.code.tlv.LspErrorCodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.identifiers.tlv.LspIdentifiers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv6CaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.rsvp.error.spec.tlv.RsvpErrorSpec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.rsvp.error.spec.tlv.RsvpErrorSpecBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.rsvp.error.spec.tlv.rsvp.error.spec.error.type.RsvpCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.TunnelId;
import com.google.common.collect.Lists;
-import com.google.common.primitives.UnsignedLong;
public class PCEPTlvParserTest {
- private static final byte[] statefulBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02 };
- private static final byte[] DbVersionBytes = { (byte) 0xff, (byte) 0x00, (byte) 0xff, (byte) 0xaa, (byte) 0xb2, (byte) 0xf5,
- (byte) 0xf2, (byte) 0xcf };
+ private static final byte[] statefulBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
private static final byte[] noPathVectorBytes = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xa7 };
private static final byte[] overloadedBytes = { (byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff };
private static final byte[] symbolicNameBytes = { (byte) 0x4d, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x74, (byte) 0x65,
(byte) 0x65 };
private static final byte[] lspUpdateErrorBytes = { (byte) 0x25, (byte) 0x68, (byte) 0x95, (byte) 0x03 };
private static final byte[] lspIdentifiers4Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0xFF, (byte) 0xFF,
- (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
+ (byte) 0x12, (byte) 0x34, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x12, (byte) 0x34, (byte) 0x56,
+ (byte) 0x78 };
private static final byte[] lspIdentifiers6Bytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC,
(byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
(byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0xFF, (byte) 0xFF, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
(byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x01,
- (byte) 0x23, (byte) 0x45, (byte) 0x67 };
+ (byte) 0x23, (byte) 0x45, (byte) 0x67, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC,
+ (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A, (byte) 0xBC, (byte) 0xDE,
+ (byte) 0xF0 };
private static final byte[] rsvpErrorBytes = { (byte) 0x06, (byte) 0x01, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
(byte) 0x02, (byte) 0x92, (byte) 0x16, (byte) 0x02 };
private static final byte[] rsvpError6Bytes = { (byte) 0x06, (byte) 0x02, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
private static final byte[] orderBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x01 };
private static final byte[] ofListBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
- private static final byte[] predundancyBytes = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 };
@Test
public void testStatefulTlv() throws PCEPDeserializerException {
final PCEStatefulCapabilityTlvParser parser = new PCEStatefulCapabilityTlvParser();
- final Stateful tlv = new StatefulBuilder().setLspUpdateCapability(Boolean.FALSE).setIncludeDbVersion(Boolean.TRUE).build();
+ final Stateful tlv = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).build();
assertEquals(tlv, parser.parseTlv(statefulBytes));
assertArrayEquals(statefulBytes, parser.serializeTlv(tlv));
}
- @Test
- public void testStateDbVersionTlv() throws PCEPDeserializerException {
- final LspDbVersionTlvParser parser = new LspDbVersionTlvParser();
- final LspDbVersion tlv = new LspDbVersionBuilder().setVersion(UnsignedLong.fromLongBits(0xFF00FFAAB2F5F2CFL).bigIntegerValue()).build();
- assertEquals(tlv, parser.parseTlv(DbVersionBytes));
- assertArrayEquals(DbVersionBytes, parser.serializeTlv(tlv));
- }
-
@Test
public void testNoPathVectorTlv() throws PCEPDeserializerException {
final NoPathVectorTlvParser parser = new NoPathVectorTlvParser();
afi.setIpv4TunnelSenderAddress(Ipv4Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }));
afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
(byte) 0x78 })));
+ afi.setIpv4TunnelEndpointAddress(Ipv4Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }));
final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(new Ipv4CaseBuilder().setIpv4(afi.build()).build()).setLspId(
new LspId(65535L)).setTunnelId(new TunnelId(4660)).build();
assertEquals(tlv, parser.parseTlv(lspIdentifiers4Bytes));
afi.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
(byte) 0x78, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67,
(byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67 })));
+ afi.setIpv6TunnelEndpointAddress(Ipv6Util.addressForBytes(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
+ (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A,
+ (byte) 0xBC, (byte) 0xDE, (byte) 0xF0 }));
final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(new Ipv6CaseBuilder().setIpv6(afi.build()).build()).setLspId(
new LspId(4660L)).setTunnelId(new TunnelId(65535)).build();
assertEquals(tlv, parser.parseTlv(lspIdentifiers6Bytes));
assertEquals(tlv, parser.parseTlv(ofListBytes));
assertArrayEquals(ofListBytes, parser.serializeTlv(tlv));
}
-
- @Test
- public void testPredundancyTlv() throws PCEPDeserializerException {
- final PredundancyGroupTlvParser parser = new PredundancyGroupTlvParser();
- final PredundancyGroupId tlv = new PredundancyGroupIdBuilder().setIdentifier(predundancyBytes).build();
- assertEquals(tlv, parser.parseTlv(predundancyBytes));
- assertArrayEquals(predundancyBytes, parser.serializeTlv(tlv));
- }
}
import io.netty.buffer.Unpooled;
import java.io.IOException;
-import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.pcinitiate.message.Requests;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.pcinitiate.message.RequestsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.OperationalStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.P2p1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.P2p1Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.PcrptBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.PcupdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.PlspId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SrpIdNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersion;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.db.version.tlv.LspDbVersionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.Lsp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.LspBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.TlvsBuilder;
b.setKeepalive((short) 30);
b.setDeadTimer((short) 120);
b.setSessionId((short) 1);
- final Stateful tlv1 = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).setIncludeDbVersion(Boolean.TRUE).build();
- final LspDbVersion tlv2 = new LspDbVersionBuilder().setVersion(BigInteger.valueOf(0x80L)).build();
+ final Stateful tlv1 = new StatefulBuilder().setLspUpdateCapability(Boolean.TRUE).build();
b.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder().addAugmentation(
- Tlvs2.class, new Tlvs2Builder().setStateful(tlv1).setLspDbVersion(tlv2).build()).build());
+ Tlvs2.class, new Tlvs2Builder().setStateful(tlv1).build()).build());
builder.setOpen(b.build());
assertEquals(new OpenBuilder().setOpenMessage(builder.build()).build(),
rBuilder1.setRp(this.rpTrue);
final P2pBuilder p2pBuilder = new P2pBuilder();
p2pBuilder.setEndpointsObj(this.endpoints);
- p2pBuilder.addAugmentation(P2p1.class, new P2p1Builder().setLsp(this.lsp).build());
p2pBuilder.setMetrics(Lists.newArrayList(this.metrics));
p2pBuilder.setIro(this.iro);
rBuilder1.setSegmentComputation(new SegmentComputationBuilder().setP2p(p2pBuilder.build()).build());
private static final Logger LOG = LoggerFactory.getLogger(Main.class);
public static final String USAGE = "DESCRIPTION:\n"
- + "\tCreates a server with given parameters. As long as it runs, it accepts connections "
- + "from PCCs.\n" + "USAGE:\n" + "\t-a, --address\n" + "\t\tthe ip address to which is this server bound.\n"
+ + "\tCreates a server with given parameters. As long as it runs, it accepts connections " + "from PCCs.\n" + "USAGE:\n"
+ + "\t-a, --address\n" + "\t\tthe ip address to which is this server bound.\n"
+ "\t\tFormat: x.x.x.x:y where y is port number.\n\n" +
"\t-d, --deadtimer\n" + "\t\tin seconds, value of the desired deadtimer\n"
"\t--active\n" + "\t\tactive stateful (implies --stateful)\n\n" +
- "\t--versioned\n" + "\t\tversioned stateful (implies --stateful)\n\n" +
-
"\t--instant\n"
+ "\t\tinstantiated stateful, <seconds> cleanup timeout (default value, if not included = 0) (implies --stateful)\n\n" +
int deadTimerValue = 0;
boolean stateful = false;
boolean active = false;
- boolean versioned = false;
+ final boolean versioned = false;
boolean instant = false;
int i = 0;
} else if (args[i].equalsIgnoreCase("--active")) {
stateful = true;
active = true;
- } else if (args[i].equalsIgnoreCase("--versioned")) {
- stateful = true;
- versioned = true;
} else if (args[i].equalsIgnoreCase("--instant")) {
stateful = true;
instant = true;
deadTimerValue = keepAliveValue * 4;
}
- final PCEPSessionProposalFactory spf = new PCEPSessionProposalFactoryImpl(deadTimerValue, keepAliveValue, stateful, active, versioned, instant);
+ final PCEPSessionProposalFactory spf = new PCEPSessionProposalFactoryImpl(deadTimerValue, keepAliveValue, stateful, active, instant);
final Open prefs = spf.getSessionProposal(address, 0);
import org.opendaylight.protocol.pcep.impl.PCEPHandlerFactory;
import org.opendaylight.protocol.pcep.impl.PCEPSessionImpl;
import org.opendaylight.protocol.pcep.spi.pojo.ServiceLoaderPCEPExtensionProviderContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.predundancy.group.id.tlv.PredundancyGroupIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder;
import com.google.common.base.Preconditions;
}
public static void main(final String[] args) throws Exception {
- final TlvsBuilder builder = new TlvsBuilder();
- builder.addAugmentation(
- Tlvs2.class,
- new Tlvs2Builder().setPredundancyGroupId(
- new PredundancyGroupIdBuilder().setIdentifier(new byte[] { (byte) 127, (byte) 2, (byte) 3, (byte) 7 }).build()).build());
-
final SessionNegotiatorFactory<Message, PCEPSessionImpl, PCEPSessionListener> snf = new DefaultPCEPSessionNegotiatorFactory(new HashedWheelTimer(), new OpenBuilder().setKeepalive(
- (short) 30).setDeadTimer((short) 120).setSessionId((short) 0).setTlvs(builder.build()).build(), 0);
+ (short) 30).setDeadTimer((short) 120).setSessionId((short) 0).build(), 0);
final PCCMock<Message, PCEPSessionImpl, PCEPSessionListener> pcc = new PCCMock<>(snf, new PCEPHandlerFactory(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry()), new DefaultPromise<PCEPSessionImpl>(GlobalEventExecutor.INSTANCE));
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcupd.message.pcupd.message.UpdatesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcupd.message.pcupd.message.updates.PathBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp.Flags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.SrpBuilder;
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.symbolic.path.name.tlv.SymbolicPathName;
}
private InstanceIdentifierBuilder<ReportedLsp> lspIdentifier(final ReportedLspKey key) {
- return InstanceIdentifier.builder(this.topologyAugment).child(PathComputationClient.class).child(ReportedLsp.class,
- key);
+ return InstanceIdentifier.builder(this.topologyAugment).child(PathComputationClient.class).child(ReportedLsp.class, key);
}
@Override
trans.putOperationalData(this.topologyAugment, this.topologyAugmentBuilder.build());
// The node has completed synchronization, cleanup metadata no longer reported back
- this.nodeState.cleanupExcept(Collections2.transform(this.lsps.values(), new Function<SymbolicPathName, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SymbolicPathName>() {
- @Override
- public org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SymbolicPathName apply(final SymbolicPathName input) {
- return input.getPathName();
- }
- }));
+ this.nodeState.cleanupExcept(Collections2.transform(
+ this.lsps.values(),
+ new Function<SymbolicPathName, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SymbolicPathName>() {
+ @Override
+ public org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SymbolicPathName apply(
+ final SymbolicPathName input) {
+ return input.getPathName();
+ }
+ }));
LOG.debug("Session {} achieved synchronized state", session);
return;
}
break;
case GoingDown:
case GoingUp:
- // These are transitive states, so we don't have to do anything, as they will be followed up...
+ // These are transitive states, so we don't have to do anything, as they will be followed
+ // up...
break;
}
}
// If this is an unsolicited update. We need to make sure we retain the metadata already present
if (solicited) {
- nodeState.setLspMetadata(rlb.getName(), rlb.getMetadata());
+ this.nodeState.setLspMetadata(rlb.getName(), rlb.getMetadata());
} else {
- rlb.setMetadata(nodeState.getLspMetadata(rlb.getName()));
+ rlb.setMetadata(this.nodeState.getLspMetadata(rlb.getName()));
}
trans.putOperationalData(lspIdentifier(rlb.getKey()).build(), rlb.build());
}
}
- private synchronized ListenableFuture<OperationResult> sendMessage(final Message message, final SrpIdNumber requestId, final Metadata metadata) {
+ private synchronized ListenableFuture<OperationResult> sendMessage(final Message message, final SrpIdNumber requestId,
+ final Metadata metadata) {
final io.netty.util.concurrent.Future<Void> f = this.session.sendMessage(message);
final PCEPRequest req = new PCEPRequest(metadata);
new TopologyBuilder().setKey(k).setTopologyId(k.getTopologyId()).setTopologyTypes(
new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class,
new TopologyTypes1Builder().setTopologyPcep(new TopologyPcepBuilder().build()).build()).build()).setNode(
- new ArrayList<Node>()).build());
+ new ArrayList<Node>()).build());
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(t.commit()), new FutureCallback<RpcResult<TransactionStatus>>() {
@Override
public void releaseNodeState(final TopologyNodeState nodeState) {
LOG.debug("Node {} unbound", nodeState.getNodeId());
- nodes.remove(nodeState.getNodeId());
+ this.nodes.remove(nodeState.getNodeId());
nodeState.released();
}
ib.setRequests(ImmutableList.of(rb.build()));
// Send the message
- return l.sendMessage(new PcinitiateBuilder().setPcinitiateMessage(ib.build()).build(), rb.getSrp().getOperationId(), input.getArguments().getMetadata());
+ return l.sendMessage(new PcinitiateBuilder().setPcinitiateMessage(ib.build()).build(), rb.getSrp().getOperationId(),
+ input.getArguments().getMetadata());
}
private static OperationResult createOperationResult(final FailureType type) {
// Build the request and send it
final RequestsBuilder rb = new RequestsBuilder();
- rb.setSrp(new SrpBuilder().setOperationId(l.nextRequest()).setProcessingRule(Boolean.TRUE).setFlags(new Flags(Boolean.TRUE)).build());
+ rb.setSrp(new SrpBuilder().setOperationId(l.nextRequest()).setProcessingRule(Boolean.TRUE).build());
rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(rep.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(MESSAGE_HEADER);
final PcupdMessageBuilder ub = new PcupdMessageBuilder(MESSAGE_HEADER);
ub.setUpdates(ImmutableList.of(rb.build()));
- return l.sendMessage(new PcupdBuilder().setPcupdMessage(ub.build()).build(), rb.getSrp().getOperationId(), input.getArguments().getMetadata());
+ return l.sendMessage(new PcupdBuilder().setPcupdMessage(ub.build()).build(), rb.getSrp().getOperationId(),
+ input.getArguments().getMetadata());
}
synchronized ListenableFuture<OperationResult> realEnsureLspOperational(final EnsureLspOperationalInput input) {