Search in sources :

Example 1 with PortFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures in project openflowplugin by opendaylight.

the class PortTranslatorUtilTest method testTranslatePortFeatures.

/**
 * Test  method for
 * {@link PortTranslatorUtil#translatePortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight
 * .openflow.common.types.rev130731.PortFeatures)}.
 */
@Test
public void testTranslatePortFeatures() {
    for (int i = 0; i < pfBls.length; i++) {
        pfBls[i] = true;
        final PortFeatures apf = getPortFeatures();
        org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures npf = PortTranslatorUtil.translatePortFeatures(apf);
        assertEqualsPortFeatures(apf, npf);
        pfBls[i] = false;
    }
}
Also used : PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures) Test(org.junit.Test)

Example 2 with PortFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures in project openflowplugin by opendaylight.

the class SalPortServiceImplTest method dummyUpdatePortInput.

private UpdatePortInput dummyUpdatePortInput() {
    org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder concretePortBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder();
    concretePortBuilder.setConfiguration(new PortConfig(true, true, true, true));
    concretePortBuilder.setAdvertisedFeatures(new PortFeatures(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true));
    concretePortBuilder.setPortNumber(new PortNumberUni(DUMMY_PORT_NUMBER));
    concretePortBuilder.setHardwareAddress(new MacAddress(DUMMY_MAC_ADDRESS));
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port> ports = Lists.newArrayList(concretePortBuilder.build());
    Port port = new PortBuilder().setPort(ports).build();
    UpdatedPort updatePort = new UpdatedPortBuilder().setPort(port).build();
    return new UpdatePortInputBuilder().setUpdatedPort(updatePort).build();
}
Also used : PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) UpdatedPort(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPort) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.Port) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) UpdatedPort(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPort) PortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.PortBuilder) UpdatedPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures) UpdatePortInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInputBuilder) UpdatedPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)

Example 3 with PortFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactoryTest method createPortList.

private static List<Ports> createPortList() {
    PortsBuilder builder = new PortsBuilder();
    builder.setPortNo(1L);
    builder.setHwAddr(new MacAddress("94:de:80:a6:61:40"));
    builder.setName("Port name");
    builder.setConfig(new PortConfig(true, false, true, false));
    builder.setState(new PortState(true, false, true));
    builder.setCurrentFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setAdvertisedFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setSupportedFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setPeerFeatures(new PortFeatures(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false));
    builder.setCurrSpeed(1234L);
    builder.setMaxSpeed(1234L);
    List<Ports> list = new ArrayList<>();
    list.add(builder.build());
    return list;
}
Also used : PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures) ArrayList(java.util.ArrayList) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.PortsBuilder) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)

Example 4 with PortFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures 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());
}
Also used : PortState(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState) PortFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures) PortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage) ByteBuf(io.netty.buffer.ByteBuf) PortConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig) Test(org.junit.Test)

Example 5 with PortFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures in project openflowplugin by opendaylight.

the class PortUpdateTranslatorTest method testTranslate_13.

@Test
public void testTranslate_13() throws Exception {
    Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures portFeatures = org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures.getDefaultInstance("hundredGbFd");
    final FlowCapableNodeConnector nodeConnector = portUpdateTranslator.translate(portBld.build(), deviceInfo, null);
    commonCheck(nodeConnector);
    Assert.assertEquals(portConfig, nodeConnector.getConfiguration());
    Assert.assertEquals(portFeatures, nodeConnector.getCurrentFeature());
    Assert.assertEquals(portFeatures, nodeConnector.getAdvertisedFeatures());
    Assert.assertEquals(portFeatures, nodeConnector.getPeerFeatures());
    Assert.assertEquals(portFeatures, nodeConnector.getSupported());
    Assert.assertEquals(portStateBld.build(), nodeConnector.getState());
    Assert.assertTrue(nodeConnector.getQueue().isEmpty());
}
Also used : FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)10 PortFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures)10 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)8 PortConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfig)8 ByteBuf (io.netty.buffer.ByteBuf)6 PortState (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState)6 PortStatusMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)3 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)2 PortFeaturesV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10)2 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)2 PortModInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput)2 PortStatusMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder)2 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.Ports)2 ArrayList (java.util.ArrayList)1 PortConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig)1 PortFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures)1 PortNumberUni (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni)1 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.Port)1 PortBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.PortBuilder)1 PortConfigV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10)1