use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class OpenflowUtilsTest method testPortFeatures.
/**
* Tests {@link OpenflowUtils#createPortFeatures(long)}.
*/
@Test
public void testPortFeatures() {
PortFeaturesV10 features = OpenflowUtils.createPortFeatures(4095L);
Assert.assertEquals("Wrong port features", new PortFeaturesV10(true, true, true, true, true, true, true, true, true, true, true, true), features);
features = OpenflowUtils.createPortFeatures(0L);
Assert.assertEquals("Wrong port features", new PortFeaturesV10(false, false, false, false, false, false, false, false, false, false, false, false), features);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features 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.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class PortStatusMessageFactoryTest method testWithDifferentBitmaps.
/**
* Testing {@link PortStatusMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithDifferentBitmaps() {
ByteBuf bb = BufferHelper.buildBuffer(// reason, padding
"01 00 00 00 00 00 00 00 " + // port no, padding
"00 01 02 03 00 00 00 00 " + // mac address, padding
"08 00 27 00 B0 EB 00 00 " + // port name, String "s1-eth1"
"73 31 2d 65 74 68 31 00 00 00 00 00 00 00 00 00 " + // port config
"00 00 00 24 " + // port state
"00 00 00 02 " + // current + advertised features
"00 00 00 81 00 00 00 A1 " + // supported + peer features
"00 00 FF FF 00 00 00 00 " + // curr speed, max speed
"00 00 00 81 00 00 00 80");
PortStatusMessage message = BufferHelper.deserialize(statusFactory, bb);
Assert.assertEquals("Wrong portConfig", new PortConfig(true, false, true, false), message.getConfig());
Assert.assertEquals("Wrong portState", new PortState(true, false, false), message.getState());
Assert.assertEquals("Wrong supportedFeatures", new PortFeatures(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true), message.getSupportedFeatures());
Assert.assertEquals("Wrong peerFeatures", new PortFeatures(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getPeerFeatures());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesTest method testMultipartReplyTableFeatures.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyTableFeatures() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 0C 00 00 00 00 00 00 " + // first table feature
"00 40 01 00 00 00 00 00 " + // length, tableId, padding
"4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 " + //
"00 00 00 00 00 00 00 00 00 00 00 00 00 " + // name
"00 00 00 00 00 00 00 01 " + // metadata match
"00 00 00 00 00 00 00 02 " + // metadata write
"00 00 00 00 " + // config
"00 00 00 2A " + // second table feature
"00 40 02 00 00 00 00 00 " + // length, tableId, padding
"4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00" + // name
" 00 00 00 00 00 00 00 00 00 00 00 00 00 " + // metadata match
"00 00 00 00 00 00 00 03 " + // metadata write
"00 00 00 00 00 00 00 04 " + // config
"00 00 00 03 " + // max entries
"00 00 00 2B");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
Assert.assertEquals("Wrong table features size", 2, message.getTableFeatures().size());
TableFeatures feature = message.getTableFeatures().get(0);
Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
Assert.assertArrayEquals("Wrong metadata match", new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, feature.getMetadataMatch());
Assert.assertArrayEquals("Wrong metadata write", new byte[] { 0, 0, 0, 0, 0, 0, 0, 2 }, feature.getMetadataWrite());
Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
feature = message.getTableFeatures().get(1);
Assert.assertEquals("Wrong table id", 2, feature.getTableId().intValue());
Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
Assert.assertArrayEquals("Wrong metadata match", new byte[] { 0, 0, 0, 0, 0, 0, 0, 3 }, feature.getMetadataMatch());
Assert.assertArrayEquals("Wrong metadata write", new byte[] { 0, 0, 0, 0, 0, 0, 0, 4 }, feature.getMetadataWrite());
Assert.assertEquals("Wrong config", true, feature.getConfig().isOFPTCDEPRECATEDMASK());
Assert.assertEquals("Wrong max entries", 43, feature.getMaxEntries().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesTest method testEmptyMultipartReplyTableFeatures.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testEmptyMultipartReplyTableFeatures() {
ByteBuf bb = BufferHelper.buildBuffer("00 0C 00 00 00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
Assert.assertEquals("Wrong table features size", 0, message.getTableFeatures().size());
}
Aggregations