import org.slf4j.LoggerFactory;
/**
-*
-*/
+ *
+ */
public final class PCEPSessionProposalFactoryImplModule
- extends
- org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPSessionProposalFactoryImplModule {
-
+extends
+org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPSessionProposalFactoryImplModule {
+
private static final Logger LOG = LoggerFactory.getLogger(PCEPSessionProposalFactoryImplModule.class);
public PCEPSessionProposalFactoryImplModule(
- org.opendaylight.controller.config.api.ModuleIdentifier name,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ final org.opendaylight.controller.config.api.ModuleIdentifier name,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(name, dependencyResolver);
}
public PCEPSessionProposalFactoryImplModule(
- org.opendaylight.controller.config.api.ModuleIdentifier name,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- PCEPSessionProposalFactoryImplModule oldModule,
- java.lang.AutoCloseable oldInstance) {
+ final org.opendaylight.controller.config.api.ModuleIdentifier name,
+ final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ final PCEPSessionProposalFactoryImplModule oldModule,
+ final java.lang.AutoCloseable oldInstance) {
super(name, dependencyResolver, oldModule, oldInstance);
}
"value is not set.", activeJmxAttribute);
JmxAttributeValidationException.checkNotNull(getVersioned(),
"value is not set.", versionedJmxAttribute);
- JmxAttributeValidationException.checkNotNull(getTimeout(),
- "value is not set.", timeoutJmxAttribute);
- JmxAttributeValidationException.checkNotNull(getInstantiated(),
- "value is not set.", instantiatedJmxAttribute);
+ JmxAttributeValidationException.checkNotNull(getInitiated(),
+ "value is not set.", initiatedJmxAttribute);
JmxAttributeValidationException.checkNotNull(getDeadTimerValue(),
"value is not set.", deadTimerValueJmxAttribute);
JmxAttributeValidationException.checkNotNull(getKeepAliveTimerValue(),
LOG.warn("DeadTimerValue should be 4 times greater than KeepAliveTimerValue");
}
}
- if ((getActive() || getVersioned() || getTimeout() > 0)
- && !getStateful()) {
+ if ((getActive() || getVersioned()) && !getStateful()) {
setStateful(true);
}
JmxAttributeValidationException.checkNotNull(getStateful(),
public java.lang.AutoCloseable createInstance() {
PCEPSessionProposalFactoryImpl inner = new PCEPSessionProposalFactoryImpl(
getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(),
- getActive(), getVersioned(), getInstantiated(), getTimeout());
+ getActive(), getVersioned(), getInitiated());
return new PCEPSessionProposalFactoryCloseable(inner);
}
private static final class PCEPSessionProposalFactoryCloseable implements
- PCEPSessionProposalFactory, AutoCloseable {
+ PCEPSessionProposalFactory, AutoCloseable {
- private PCEPSessionProposalFactoryImpl inner;
+ private final PCEPSessionProposalFactoryImpl inner;
public PCEPSessionProposalFactoryCloseable(
- PCEPSessionProposalFactoryImpl inner) {
+ final PCEPSessionProposalFactoryImpl inner) {
this.inner = inner;
}
}
@Override
- public Open getSessionProposal(InetSocketAddress inetSocketAddress,
- int i) {
+ public Open getSessionProposal(final InetSocketAddress inetSocketAddress,
+ final int i) {
return inner.getSessionProposal(inetSocketAddress, i);
}
}
PCEP implementation.
Copyright (c)2013 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";
+ 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 "2013-06-27" {
+ revision "2013-06-27" {
description
"Updated revision dates for imports.";
}
config:java-name-prefix PCEPDispatcherImpl;
}
- augment "/config:modules/config:module/config:configuration" {
- case pcep-dispatcher-impl {
- when "/config:modules/config:module/config:type = 'pcep-dispatcher-impl'";
-
- leaf max-unknown-messages {
- type uint16;
- }
-
- container extensions {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity spi:consumer-extensions;
- }
- }
- }
-
- container pcep-session-proposal-factory {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity pcep:pcep-session-proposal-factory;
- }
- }
- }
-
- container boss-group {
+ augment "/config:modules/config:module/config:configuration" {
+ case pcep-dispatcher-impl {
+ when "/config:modules/config:module/config:type = 'pcep-dispatcher-impl'";
+
+ leaf max-unknown-messages {
+ type uint16;
+ }
+
+ container extensions {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity spi:consumer-extensions;
+ }
+ }
+ }
+
+ container pcep-session-proposal-factory {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity pcep:pcep-session-proposal-factory;
+ }
+ }
+ }
+
+ container boss-group {
uses config:service-ref {
refine type {
mandatory true;
}
}
}
-
+
container worker-group {
uses config:service-ref {
refine type {
}
}
}
-
+
container timer {
uses config:service-ref {
refine type {
}
}
- identity pcep-session-proposal-factory-impl {
+ identity pcep-session-proposal-factory-impl {
base config:module-type;
config:java-name-prefix "PCEPSessionProposalFactoryImpl";
config:provided-service pcep:pcep-session-proposal-factory;
}
- augment "/config:modules/config:module/config:configuration" {
- case pcep-session-proposal-factory-impl {
- when "/config:modules/config:module/config:type = 'pcep-session-proposal-factory-impl'";
-
+ augment "/config:modules/config:module/config:configuration" {
+ case pcep-session-proposal-factory-impl {
+ when "/config:modules/config:module/config:type = 'pcep-session-proposal-factory-impl'";
- leaf dead-timer-value {
- type uint16;
- default 120;
- }
- leaf keep-alive-timer-value {
- type uint16;
- default 30;
- }
+ leaf dead-timer-value {
+ type uint16;
+ default 120;
+ }
- leaf instantiated {
- type boolean;
- }
+ leaf keep-alive-timer-value {
+ type uint16;
+ default 30;
+ }
- leaf timeout {
- type uint16;
- }
+ leaf initiated {
+ type boolean;
+ default false;
+ }
- leaf stateful {
- type boolean;
- }
+ leaf stateful {
+ type boolean;
+ default true;
+ }
- leaf active {
- type boolean;
- }
+ leaf active {
+ type boolean;
+ default true;
+ }
- leaf versioned {
- type boolean;
- }
- }
- }
+ leaf versioned {
+ type boolean;
+ default false;
+ }
+ }
+ }
}
@Test
public void testReusingOldInstance() throws InstanceAlreadyExistsException,
- ConflictingVersionException, ValidationException {
+ ConflictingVersionException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
@Test
public void testReconfigure() throws InstanceAlreadyExistsException,
- ConflictingVersionException, ValidationException,
- InstanceNotFoundException {
+ ConflictingVersionException, ValidationException,
+ InstanceNotFoundException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
PCEPDispatcherImplModuleMXBean mxBean = transaction.newMBeanProxy(
transaction.lookupConfigBean(
this.factory.getImplementationName(), instanceName),
- PCEPDispatcherImplModuleMXBean.class);
+ PCEPDispatcherImplModuleMXBean.class);
mxBean.setMaxUnknownMessages(10);
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
final String sessionFactoryImplName,
final String threadGroupFactoryImplName,
final String extensionsImplName, final String timerFactoryImplName)
- throws InstanceAlreadyExistsException {
+ throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(moduleName,
instanceName);
PCEPDispatcherImplModuleMXBean mxBean = transaction.newMBeanProxy(
nameCreated, PCEPDispatcherImplModuleMXBean.class);
mxBean.setPcepSessionProposalFactory(PCEPSessionProposalFactoryImplModuleTest
.createInstance(transaction, sessionFactoryImplName,
- "pcep-proposal", 0, 0, true, true, true, true, 1000));
+ "pcep-proposal", 0, 0, true, true, true, true));
mxBean.setMaxUnknownMessages(maxUnknownMessages);
mxBean.setBossGroup(createThreadGroupInstance(transaction,
threadGroupFactoryImplName, "boss-group", 10));
public static ObjectName createExtensionsInstance(
final ConfigTransactionJMXClient transaction,
final String moduleName, final String instanceName)
- throws InstanceAlreadyExistsException {
+ throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(moduleName,
instanceName);
transaction.newMBeanProxy(nameCreated,
public static ObjectName createTimerInstance(
final ConfigTransactionJMXClient transaction,
final String moduleName, final String instanceName)
- throws InstanceAlreadyExistsException {
+ throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(moduleName,
instanceName);
transaction.newMBeanProxy(nameCreated,
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
public class PCEPSessionProposalFactoryImplModuleTest extends
- AbstractConfigTest {
+AbstractConfigTest {
private final String instanceName = "pcep-proposal";
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, null, 100, true, true, true, true, 1000);
+ instanceName, null, 100, true, true, true, true);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, null, true, true, true, true, 1000);
+ instanceName, 400, null, true, true, true, true);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, null, false, false, false, -1);
+ instanceName, 400, 100, null, false, false, false);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, null, true, true, 1000);
+ instanceName, 400, 100, true, null, true, true);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, null, true, 1000);
+ instanceName, 400, 100, true, true, null, true);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, null, 1000);
+ instanceName, 400, 100, true, true, true, null);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
- assertTrue(e.getMessage().contains("Instantiated value is not set"));
- }
- }
-
- @Test
- public void testValidationExceptionTimeoutNotSet()
- throws InstanceAlreadyExistsException {
- try {
- ConfigTransactionJMXClient transaction = configRegistryClient
- .createTransaction();
- createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, true, null);
- transaction.validateConfig();
- fail();
- } catch (ValidationException e) {
- assertTrue(e.getMessage().contains("Timeout value is not set"));
+ assertTrue(e.getMessage().contains("Initiated value is not set"));
}
}
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, -10, true, true, true, true, 1000);
+ instanceName, 400, -10, true, true, true, true);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, false, true, true, true, 1000);
+ 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);
+ .lookupConfigBean(
+ AbstractPCEPSessionProposalFactoryImplModuleFactory.NAME,
+ instanceName),
+ PCEPSessionProposalFactoryImplModuleMXBean.class);
assertTrue(mxBean.getStateful());
}
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 0, 0, true, true, true, true, 1000);
+ instanceName, 0, 0, true, true, true, true);
transaction.validateConfig();
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
@Test
public void testReusingOldInstance() throws InstanceAlreadyExistsException,
- ConflictingVersionException, ValidationException {
+ ConflictingVersionException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, true, 1000);
+ instanceName, 400, 100, true, true, true, true);
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
@Test
public void testReconfigure() throws InstanceAlreadyExistsException,
- ConflictingVersionException, ValidationException,
- InstanceNotFoundException {
+ ConflictingVersionException, ValidationException,
+ InstanceNotFoundException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(),
- instanceName, 400, 100, true, true, true, true, 1000);
+ 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);
- mxBean.setTimeout(200);
+ .lookupConfigBean(
+ AbstractPCEPSessionProposalFactoryImplModuleFactory.NAME,
+ instanceName),
+ PCEPSessionProposalFactoryImplModuleMXBean.class);
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
- assertStatus(status, 0, 1, 0);
+ assertStatus(status, 0, 0, 1);
}
public static ObjectName createInstance(
final String moduleName, final String instanceName,
final Integer deadTimer, final Integer keepAlive,
final Boolean stateful, final Boolean active,
- final Boolean versioned, final Boolean instant,
- final Integer timeout) throws InstanceAlreadyExistsException {
+ final Boolean versioned, final Boolean instant) throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(moduleName,
instanceName);
PCEPSessionProposalFactoryImplModuleMXBean mxBean = transaction
PCEPSessionProposalFactoryImplModuleMXBean.class);
mxBean.setActive(active);
mxBean.setDeadTimerValue(deadTimer);
- mxBean.setInstantiated(instant);
+ mxBean.setInitiated(instant);
mxBean.setKeepAliveTimerValue(keepAlive);
mxBean.setStateful(stateful);
- mxBean.setTimeout(timeout);
mxBean.setVersioned(versioned);
return nameCreated;
}
public class PCEPSessionProposalFactoryImpl implements PCEPSessionProposalFactory {
- private final int keepAlive, deadTimer, timeout;
+ private final int keepAlive, deadTimer;
private final boolean stateful, active, versioned, instant;
public PCEPSessionProposalFactoryImpl(final int deadTimer, final int keepAlive, final boolean stateful, final boolean active,
- final boolean versioned, final boolean instant, final int timeout) {
+ final boolean versioned, final boolean instant) {
this.deadTimer = deadTimer;
this.keepAlive = keepAlive;
this.stateful = stateful;
this.active = active;
this.versioned = versioned;
this.instant = instant;
- this.timeout = timeout;
}
@Override
return this.instant;
}
- public int getTimeout() {
- return this.timeout;
- }
}
boolean active = false;
boolean versioned = false;
boolean instant = false;
- int timeout = 0;
int i = 0;
while (i < args.length) {
} else if (args[i].equalsIgnoreCase("--instant")) {
stateful = true;
instant = true;
- if (i == args.length - 1) {
- timeout = 0;
- } else if (Integer.valueOf(args[i + 1]) > 0 && Integer.valueOf(args[i + 1]) < Integer.MAX_VALUE) {
- timeout = Integer.valueOf(args[i + 1]);
- i++;
- }
} else {
LOG.warn("WARNING: Unrecognized argument: {}", args[i]);
}
deadTimerValue = keepAliveValue * 4;
}
- final PCEPSessionProposalFactory spf = new PCEPSessionProposalFactoryImpl(deadTimerValue, keepAliveValue, stateful, active, versioned, instant, timeout);
+ final PCEPSessionProposalFactory spf = new PCEPSessionProposalFactoryImpl(deadTimerValue, keepAliveValue, stateful, active, versioned, instant);
final Open prefs = spf.getSessionProposal(address, 0);