Search in sources :

Example 1 with PortStateV10

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;
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder) ArrayList(java.util.ArrayList) PhyPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Example 2 with PortStateV10

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);
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortStatusMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)

Example 3 with PortStateV10

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());
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage) ByteBuf(io.netty.buffer.ByteBuf) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test)

Example 4 with PortStateV10

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());
}
Also used : ActionTypeV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionTypeV10) GetFeaturesOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput) PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PhyPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort) ByteBuf(io.netty.buffer.ByteBuf) CapabilitiesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test)

Example 5 with PortStateV10

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());
}
Also used : GetFeaturesOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput) PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PhyPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort) ByteBuf(io.netty.buffer.ByteBuf) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Test(org.junit.Test)

Aggregations

PortStateV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10)7 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)6 PortConfigV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10)6 Test (org.junit.Test)5 PortFeaturesV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10)5 ByteBuf (io.netty.buffer.ByteBuf)4 PhyPort (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort)3 GetFeaturesOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput)2 PortStatusMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)2 PortStatusMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder)2 ArrayList (java.util.ArrayList)1 StateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder)1 ActionTypeV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionTypeV10)1 CapabilitiesV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10)1 PortConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)1 PortFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures)1 PortState (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState)1 PhyPortBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder)1