use of org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability in project bgpcep by opendaylight.
the class PCCSyncAvoidanceProcedureTest method getCapabilities.
@Override
protected List<PCEPCapability> getCapabilities() {
final List<PCEPCapability> caps = new ArrayList<>();
caps.add(new PCEPStatefulCapability(true, true, true, false, false, false, true));
return caps;
}
use of org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability in project bgpcep by opendaylight.
the class PCCTriggeredLspResyncTest method getCapabilities.
@Override
protected List<PCEPCapability> getCapabilities() {
final List<PCEPCapability> caps = new ArrayList<>();
caps.add(new PCEPStatefulCapability(true, true, true, false, true, false, true));
return caps;
}
use of org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability in project bgpcep by opendaylight.
the class PCCTriggeredSyncTest method getCapabilities.
@Override
protected List<PCEPCapability> getCapabilities() {
final List<PCEPCapability> caps = new ArrayList<>();
caps.add(new PCEPStatefulCapability(true, true, true, true, false, false, true));
return caps;
}
use of org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability in project bgpcep by opendaylight.
the class Main method main.
public static void main(final String[] args) throws UnknownHostException, InterruptedException, ExecutionException {
if (args.length == 0 || (args.length == 1 && args[0].equalsIgnoreCase("--help"))) {
LOG.info(Main.USAGE);
return;
}
InetSocketAddress address = null;
int keepAliveValue = KA_DEFAULT;
int deadTimerValue = 0;
boolean stateful = false;
boolean active = false;
boolean instant = false;
int pos = 0;
while (pos < args.length) {
if (args[pos].equalsIgnoreCase("-a") || args[pos].equalsIgnoreCase("--address")) {
final String[] ip = args[pos + 1].split(":");
address = new InetSocketAddress(InetAddress.getByName(ip[0]), Integer.parseInt(ip[1]));
pos++;
} else if (args[pos].equalsIgnoreCase("-d") || args[pos].equalsIgnoreCase("--deadtimer")) {
deadTimerValue = Integer.parseInt(args[pos + 1]);
pos++;
} else if (args[pos].equalsIgnoreCase("-ka") || args[pos].equalsIgnoreCase("--keepalive")) {
keepAliveValue = Integer.parseInt(args[pos + 1]);
pos++;
} else if (args[pos].equalsIgnoreCase("--stateful")) {
stateful = true;
} else if (args[pos].equalsIgnoreCase("--active")) {
stateful = true;
active = true;
} else if (args[pos].equalsIgnoreCase("--instant")) {
stateful = true;
instant = true;
} else {
LOG.warn("WARNING: Unrecognized argument: {}", args[pos]);
}
pos++;
}
if (deadTimerValue != 0 && deadTimerValue != keepAliveValue * KA_TO_DEADTIMER_RATIO) {
LOG.warn("WARNING: The value of DeadTimer should be 4 times the value of KeepAlive.");
}
if (deadTimerValue == 0) {
deadTimerValue = keepAliveValue * KA_TO_DEADTIMER_RATIO;
}
final List<PCEPCapability> caps = new ArrayList<>();
caps.add(new PCEPStatefulCapability(stateful, active, instant, false, false, false, false));
final PCEPSessionProposalFactory spf = new BasePCEPSessionProposalFactory(deadTimerValue, keepAliveValue, caps);
try (StatefulActivator activator07 = new StatefulActivator()) {
activator07.start(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance());
final PCEPDispatcherImpl dispatcher = new PCEPDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry(), new DefaultPCEPSessionNegotiatorFactory(spf, MAX_UNKNOWN_MESSAGES), new NioEventLoopGroup(), new NioEventLoopGroup());
dispatcher.createServer(new TestToolPCEPDispatcherDependencies(address)).get();
}
}
use of org.opendaylight.protocol.pcep.ietf.stateful07.PCEPStatefulCapability in project bgpcep by opendaylight.
the class PCEPStatefulCapabilityTest method testPCEPStatefulCapability.
@Test
public void testPCEPStatefulCapability() {
final PCEPStatefulCapability sspf = new PCEPStatefulCapability(true, true, true, true, false, true, false);
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.assertTrue(sspf.isIncludeDbVersion());
final TlvsBuilder builder = new TlvsBuilder();
sspf.setCapabilityProposal(null, builder);
Assert.assertEquals(EXPECTED_TLVS, builder.build());
}
Aggregations