use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class MultipartReplyGroupFeaturesTest method testMultipartReplyGroupFeatures.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyGroupFeatures() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 08 00 01 00 00 00 00 " + // types
"00 00 00 0F " + // capabilities
"00 00 00 0F " + // max groups
"00 00 00 01 " + // max groups
"00 00 00 02 " + // max groups
"00 00 00 03 " + // max groups
"00 00 00 04 " + // actions bitmap (all actions included)
"0F FF 98 01 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupFeaturesCase messageCase = (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());
Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true), message.getCapabilities());
Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());
Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());
Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());
Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());
Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class BuildSwitchCapabilitiesOF10 method build.
@Override
public SwitchFeatures build(GetFeaturesOutput features) {
SwitchFeaturesBuilder builderSwFeatures = new SwitchFeaturesBuilder();
builderSwFeatures.setMaxBuffers(features.getBuffers());
builderSwFeatures.setMaxTables(features.getTables());
List<Class<? extends FeatureCapability>> capabilities = new ArrayList<>();
if (features.getCapabilitiesV10().isOFPCARPMATCHIP()) {
capabilities.add(FlowFeatureCapabilityArpMatchIp.class);
}
if (features.getCapabilitiesV10().isOFPCFLOWSTATS()) {
capabilities.add(FlowFeatureCapabilityFlowStats.class);
}
if (features.getCapabilitiesV10().isOFPCIPREASM()) {
capabilities.add(FlowFeatureCapabilityIpReasm.class);
}
if (features.getCapabilitiesV10().isOFPCPORTSTATS()) {
capabilities.add(FlowFeatureCapabilityPortStats.class);
}
if (features.getCapabilitiesV10().isOFPCQUEUESTATS()) {
capabilities.add(FlowFeatureCapabilityQueueStats.class);
}
if (features.getCapabilitiesV10().isOFPCRESERVED()) {
capabilities.add(FlowFeatureCapabilityReserved.class);
}
if (features.getCapabilitiesV10().isOFPCSTP()) {
capabilities.add(FlowFeatureCapabilityStp.class);
}
if (features.getCapabilitiesV10().isOFPCTABLESTATS()) {
capabilities.add(FlowFeatureCapabilityTableStats.class);
}
builderSwFeatures.setCapabilities(capabilities);
return builderSwFeatures.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class DeviceInitializationUtilTest method setUp.
@Before
public void setUp() throws Exception {
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(NODE_II);
when(writeTransaction.submit()).thenReturn(Futures.immediateCheckedFuture(null));
when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction);
when(connectionAdapter.getRemoteAddress()).thenReturn(INET_SOCKET_ADDRESS);
when(featuresReply.getTables()).thenReturn(TABLES);
when(featuresReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(featuresReply.getCapabilities()).thenReturn(new Capabilities(false, false, false, false, false, false, false));
when(connectionContext.getFeatures()).thenReturn(featuresReply);
when(connectionContext.getConnectionAdapter()).thenReturn(connectionAdapter);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactoryTest method test.
/**
* Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 00 00 00 " + "00 00 00 FF 00 00 0F FF " + "00 10 01 01 05 01 04 02 41 4C 4F 48 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7F 00 00 02 00 " + "00 00 0F FF 00 00 00 00 00 00 03 0C 00 00 08 88");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong datapathId", 0x0001020304050607L, builtByFactory.getDatapathId().longValue());
Assert.assertEquals("Wrong n-buffers", 0x00010203L, builtByFactory.getBuffers().longValue());
Assert.assertEquals("Wrong n-tables", 0x01, builtByFactory.getTables().shortValue());
Assert.assertEquals("Wrong capabilities", new CapabilitiesV10(true, true, true, true, true, true, true, true), builtByFactory.getCapabilitiesV10());
Assert.assertEquals("Wrong actions", new ActionTypeV10(true, true, true, true, true, true, true, true, true, true, true, true, false), builtByFactory.getActionsV10());
PhyPort port = builtByFactory.getPhyPort().get(0);
Assert.assertEquals("Wrong port - port-no", 16, port.getPortNo().intValue());
Assert.assertEquals("Wrong port - hw-addr", new MacAddress("01:01:05:01:04:02"), port.getHwAddr());
Assert.assertEquals("Wrong port - name", new String("ALOHA"), port.getName());
Assert.assertEquals("Wrong port - config", new PortConfigV10(true, true, true, true, true, true, true), port.getConfigV10());
Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, true, false, true, false), port.getStateV10());
Assert.assertEquals("Wrong port - curr", new PortFeaturesV10(true, true, true, true, true, true, true, true, true, true, true, true), port.getCurrentFeaturesV10());
Assert.assertEquals("Wrong port - advertised", new PortFeaturesV10(false, false, false, false, false, false, false, false, false, false, false, false), port.getAdvertisedFeaturesV10());
Assert.assertEquals("Wrong port - supported", new PortFeaturesV10(true, true, false, false, false, false, false, true, false, true, false, false), port.getSupportedFeaturesV10());
Assert.assertEquals("Wrong port - peer", new PortFeaturesV10(true, false, false, false, false, false, false, false, true, false, false, true), port.getPeerFeaturesV10());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactoryTest method testWithNoPortsSet.
/**
* Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithNoPortsSet() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 00 00 00 " + "00 00 00 00 00 00 00 00");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong capabilities", new CapabilitiesV10(false, false, false, false, false, false, false, false), builtByFactory.getCapabilitiesV10());
Assert.assertEquals("Wrong actions", new ActionTypeV10(false, false, false, false, false, false, false, false, false, false, false, false, false), builtByFactory.getActionsV10());
Assert.assertEquals("Wrong ports size", 0, builtByFactory.getPhyPort().size());
}
Aggregations