use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10 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.PortStateV10 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.PortStateV10 in project openflowplugin by opendaylight.
the class OF10PortStatusMessageFactoryTest method test.
/**
* Testing {@link OF10PortStatusMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00 00 00 00 00 " + "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 15 00 00 00 01 00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88");
PortStatusMessage builtByFactory = BufferHelper.deserialize(statusFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong reason", PortReason.OFPPRADD, builtByFactory.getReason());
Assert.assertEquals("Wrong port - port-no", 16, builtByFactory.getPortNo().intValue());
Assert.assertEquals("Wrong builtByFactory - hw-addr", new MacAddress("01:01:05:01:04:02"), builtByFactory.getHwAddr());
Assert.assertEquals("Wrong builtByFactory - name", new String("ALOHA"), builtByFactory.getName());
Assert.assertEquals("Wrong builtByFactory - config", new PortConfigV10(true, false, false, true, false, false, true), builtByFactory.getConfigV10());
Assert.assertEquals("Wrong builtByFactory - state", new PortStateV10(false, true, false, false, false, false, true, false), builtByFactory.getStateV10());
Assert.assertEquals("Wrong builtByFactory - curr", new PortFeaturesV10(false, false, false, false, true, true, true, false, false, false, false, false), builtByFactory.getCurrentFeaturesV10());
Assert.assertEquals("Wrong builtByFactory - advertised", new PortFeaturesV10(false, false, true, true, false, false, false, false, false, false, true, false), builtByFactory.getAdvertisedFeaturesV10());
Assert.assertEquals("Wrong builtByFactory - supbuiltByFactoryed", new PortFeaturesV10(true, true, false, false, false, false, false, true, false, true, false, false), builtByFactory.getSupportedFeaturesV10());
Assert.assertEquals("Wrong builtByFactory - peer", new PortFeaturesV10(true, false, false, false, false, false, false, false, true, false, false, true), builtByFactory.getPeerFeaturesV10());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10 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.PortStateV10 in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactoryTest method testWithTwoPortsSet.
/**
* Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithTwoPortsSet() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 00 00 00 " + "00 00 00 8B 00 00 03 B5 " + "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 00 00 00 07 01 " + "00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88 " + "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 15 00 00 00 00 " + "00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong ports size", 2, builtByFactory.getPhyPort().size());
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(false, false, false, false, false, false, false), port.getConfigV10());
Assert.assertEquals("Wrong port - state", new PortStateV10(false, true, false, true, true, true, false, true), port.getStateV10());
port = builtByFactory.getPhyPort().get(1);
Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, false, false, true, false), port.getStateV10());
}
Aggregations