use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10 in project openflowplugin by opendaylight.
the class OF10PortModInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("19 e9 08 00 27 00 b0 eb " + "00 00 00 15 00 00 00 62 00 00 02 8c 00 00 00 00 ");
PortModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
Assert.assertEquals("Wrong port", new PortNumber(6633L), deserializedMessage.getPortNo());
Assert.assertEquals("Wrong hwAddr", new MacAddress("08:00:27:00:b0:eb"), deserializedMessage.getHwAddress());
Assert.assertEquals("Wrong config", new PortConfigV10(true, false, false, true, false, false, true), deserializedMessage.getConfigV10());
Assert.assertEquals("Wrong mask", new PortConfigV10(false, true, true, false, false, true, false), deserializedMessage.getMaskV10());
Assert.assertEquals("Wrong advertise", new PortFeaturesV10(true, true, false, false, false, false, false, true, true, false, false, false), deserializedMessage.getAdvertiseV10());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10 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.openflow.common.types.rev130731.PortFeaturesV10 in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactoryTest method createPorts.
private static List<PhyPort> createPorts() {
final List<PhyPort> ports = new ArrayList<>();
PhyPortBuilder builder = new PhyPortBuilder();
builder.setPortNo(1L);
builder.setHwAddr(new MacAddress("94:de:80:a6:61:40"));
builder.setName("Port name");
builder.setConfigV10(new PortConfigV10(true, false, true, false, true, false, true));
builder.setStateV10(new PortStateV10(true, false, true, false, true, false, true, false));
builder.setCurrentFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
builder.setAdvertisedFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
builder.setSupportedFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
builder.setPeerFeaturesV10(new PortFeaturesV10(true, false, true, false, true, false, true, false, true, false, true, false));
ports.add(builder.build());
return ports;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10 in project openflowplugin by opendaylight.
the class PortUpdateTranslatorTest method assemblePortStatusMessage.
private PortStatusMessageBuilder assemblePortStatusMessage(long portNoValue, long speed) {
final PortFeatures portFeatures13 = PortFeatures.getDefaultInstance("_100gbFd");
final PortFeaturesV10 portFeatures10 = PortFeaturesV10.getDefaultInstance("_100mbFd");
final PortConfig portConfig13 = PortConfig.getDefaultInstance("noFwd");
final PortConfigV10 portConfig10 = PortConfigV10.getDefaultInstance("noFwd");
final PortState portState13 = PortState.getDefaultInstance("live");
final PortStateV10 portState10 = PortStateV10.getDefaultInstance("live");
return new PortStatusMessageBuilder().setPortNo(portNoValue).setReason(PortReason.OFPPRADD).setAdvertisedFeatures(portFeatures13).setAdvertisedFeaturesV10(portFeatures10).setConfig(portConfig13).setConfigV10(portConfig10).setCurrentFeatures(portFeatures13).setCurrentFeaturesV10(portFeatures10).setPeerFeatures(portFeatures13).setPeerFeaturesV10(portFeatures10).setState(portState13).setStateV10(portState10).setSupportedFeatures(portFeatures13).setSupportedFeaturesV10(portFeatures10).setCurrSpeed(speed).setHwAddr(new MacAddress("01:02:03:04:05:06")).setMaxSpeed(2 * speed).setName("utPortName:" + portNoValue);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10 in project openflowplugin by opendaylight.
the class OF10PortModInputMessageFactoryTest method testPortModInput.
/**
* Testing of {@link OF10PortModInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPortModInput() throws Exception {
PortModInputBuilder builder = new PortModInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setPortNo(new PortNumber(6633L));
builder.setHwAddress(new MacAddress("08:00:27:00:B0:EB"));
builder.setConfigV10(new PortConfigV10(true, false, false, true, false, false, true));
builder.setMaskV10(new PortConfigV10(false, true, true, false, false, true, false));
builder.setAdvertiseV10(new PortFeaturesV10(true, true, false, false, false, false, false, true, true, false, false, false));
PortModInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
portModFactory.serialize(message, out);
BufferHelper.checkHeaderV10(out, (byte) 15, 32);
Assert.assertEquals("Wrong PortNo", message.getPortNo().getValue().longValue(), out.readUnsignedShort());
byte[] address = new byte[6];
out.readBytes(address);
Assert.assertEquals("Wrong MacAddress", message.getHwAddress(), new MacAddress(ByteBufUtils.macAddressToString(address)));
Assert.assertEquals("Wrong config", 21, out.readUnsignedInt());
Assert.assertEquals("Wrong mask", 98, out.readUnsignedInt());
Assert.assertEquals("Wrong advertise", 652, out.readUnsignedInt());
out.skipBytes(4);
}
Aggregations