use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open in project bgpcep by opendaylight.
the class Stateful07ErrorMessageParser method insertObject.
private static State insertObject(final State state, final Object obj, final List<Errors> errorObjects, final List<Rps> requestParameters, final List<Srps> srps, final PcerrMessageBuilder b) {
switch(state) {
case ERROR_IN:
if (obj instanceof ErrorObject) {
final ErrorObject o = (ErrorObject) obj;
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR_IN;
}
case RP_IN:
if (obj instanceof Rp) {
final Rp o = (Rp) obj;
requestParameters.add(new RpsBuilder().setRp(o).build());
return State.RP_IN;
}
case SRP_IN:
if (obj instanceof Srp) {
final Srp o = (Srp) obj;
srps.add(new SrpsBuilder().setSrp(o).build());
return State.SRP_IN;
}
case OPEN:
if (obj instanceof Open) {
b.setErrorType(new SessionCaseBuilder().setSession(new SessionBuilder().setOpen((Open) obj).build()).build());
return State.OPEN_IN;
}
case ERROR:
if (obj instanceof ErrorObject) {
final ErrorObject o = (ErrorObject) obj;
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR;
}
case OPEN_IN:
case END:
return State.END;
default:
return state;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open in project bgpcep by opendaylight.
the class PCEPSessionState method getLocalPref.
private static LocalPref getLocalPref(final Open open, final Channel channel) {
final LocalPrefBuilder peerBuilder = new LocalPrefBuilder();
peerBuilder.setDeadtimer(open.getDeadTimer());
peerBuilder.setKeepalive(open.getKeepalive());
peerBuilder.setIpAddress(((InetSocketAddress) channel.localAddress()).getAddress().getHostAddress());
peerBuilder.setSessionId(open.getSessionId().intValue());
return peerBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open in project bgpcep by opendaylight.
the class FiniteStateMachineTest method testEstablishTLS.
/**
* Establish PCEPS TLS connection with peer
*/
@Test
public void testEstablishTLS() {
final DefaultPCEPSessionNegotiator negotiator = new DefaultPCEPSessionNegotiator(new DefaultPromise<>(GlobalEventExecutor.INSTANCE), this.channel, this.listener, (short) 1, 20, new OpenBuilder().setKeepalive((short) 1).build(), SslContextFactoryTest.createTlsConfig());
negotiator.channelActive(null);
assertEquals(1, this.msgsSend.size());
assertTrue(this.msgsSend.get(0) instanceof Starttls);
assertEquals(DefaultPCEPSessionNegotiator.State.START_TLS_WAIT, negotiator.getState());
negotiator.handleMessage(this.startTlsMsg);
assertEquals(DefaultPCEPSessionNegotiator.State.OPEN_WAIT, negotiator.getState());
assertEquals(2, this.msgsSend.size());
assertTrue(this.msgsSend.get(1) instanceof Open);
negotiator.handleMessage(this.openMsg);
assertEquals(DefaultPCEPSessionNegotiator.State.KEEP_WAIT, negotiator.getState());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open in project controller by opendaylight.
the class CrossBrokerRpcTest method bindingRpcInvoker_DomRoutedProviderTest.
@Test
public void bindingRpcInvoker_DomRoutedProviderTest() throws Exception {
KnockKnockOutputBuilder builder = new KnockKnockOutputBuilder();
builder.setAnswer("open");
final KnockKnockOutput output = builder.build();
provisionRegistry.registerRpcImplementation((rpc, input) -> {
ContainerNode result = testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(output);
return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
}, DOMRpcIdentifier.create(KNOCK_KNOCK_PATH, BI_NODE_C_ID));
OpendaylightOfMigrationTestModelService baKnockInvoker = providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
Future<RpcResult<KnockKnockOutput>> baResult = baKnockInvoker.knockKnock((knockKnock(BA_NODE_C_ID).setQuestion("Who's there?").build()));
assertNotNull(baResult);
assertEquals(output, baResult.get().getResult());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open in project controller by opendaylight.
the class CrossBrokerRpcTest method bindingRoutedRpcProvider_DomInvokerTest.
@Test
public void bindingRoutedRpcProvider_DomInvokerTest() throws Exception {
//
knockService.registerPath(TestContext.class, //
BA_NODE_A_ID).registerPath(TestContext.class, //
BA_NODE_B_ID).setKnockKnockResult(knockResult(true, "open"));
OpendaylightOfMigrationTestModelService baKnockInvoker = providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
assertNotSame(knockService, baKnockInvoker);
KnockKnockInput knockKnockA = //
knockKnock(BA_NODE_A_ID).setQuestion("who's there?").build();
ContainerNode knockKnockDom = toDomRpc(KNOCK_KNOCK_QNAME, knockKnockA);
assertNotNull(knockKnockDom);
DOMRpcResult domResult = biRpcInvoker.invokeRpc(KNOCK_KNOCK_PATH, knockKnockDom).get();
assertNotNull(domResult);
assertNotNull("DOM result is successful.", domResult.getResult());
assertTrue("Bidning Add Flow RPC was captured.", knockService.getReceivedKnocks().containsKey(BA_NODE_A_ID));
assertEquals(knockKnockA, knockService.getReceivedKnocks().get(BA_NODE_A_ID).iterator().next());
}
Aggregations