use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput in project openflowplugin by opendaylight.
the class MockPlugin method getSwitchFeatures.
protected void getSwitchFeatures() {
GetFeaturesInputBuilder featuresBuilder = new GetFeaturesInputBuilder();
featuresBuilder.setVersion((short) 4);
featuresBuilder.setXid(3L);
GetFeaturesInput featuresInput = featuresBuilder.build();
try {
LOGGER.debug("Requesting features ");
RpcResult<GetFeaturesOutput> rpcResult = adapter.getFeatures(featuresInput).get(2500, TimeUnit.MILLISECONDS);
if (rpcResult.isSuccessful()) {
byte[] byteArray = rpcResult.getResult().getDatapathId().toByteArray();
LOGGER.debug("DatapathId: {}", Arrays.toString(byteArray));
} else {
RpcError rpcError = rpcResult.getErrors().iterator().next();
LOGGER.warn("rpcResult failed", rpcError.getCause());
}
} catch (InterruptedException | ExecutionException | TimeoutException e) {
LOGGER.error("getSwitchFeatures() exception caught: ", e.getMessage(), e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput in project openflowplugin by opendaylight.
the class GetFeaturesInputMessageFactoryTest method testV13.
/**
* Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV13() throws Exception {
GetFeaturesInputBuilder gfib = new GetFeaturesInputBuilder();
BufferHelper.setupHeader(gfib, EncodeConstants.OF13_VERSION_ID);
GetFeaturesInput gfi = gfib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
featuresFactory.serialize(gfi, out);
BufferHelper.checkHeaderV13(out, FEATURES_REQUEST_MESSAGE_CODE_TYPE, 8);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput in project openflowplugin by opendaylight.
the class OF10FeaturesRequestMessageFactory method deserialize.
@Override
public GetFeaturesInput deserialize(ByteBuf rawMessage) {
GetFeaturesInputBuilder builder = new GetFeaturesInputBuilder();
builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput in project openflowplugin by opendaylight.
the class OF10FeaturesRequestMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer();
GetFeaturesInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput in project openflowplugin by opendaylight.
the class GetFeaturesInputMessageFactoryTest method testV10.
/**
* Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV10() throws Exception {
GetFeaturesInputBuilder gfib = new GetFeaturesInputBuilder();
BufferHelper.setupHeader(gfib, EncodeConstants.OF10_VERSION_ID);
GetFeaturesInput gfi = gfib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
featuresFactory.serialize(gfi, out);
BufferHelper.checkHeaderV10(out, FEATURES_REQUEST_MESSAGE_CODE_TYPE, 8);
}
Aggregations