Search in sources :

Example 1 with PortNumberUni

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni 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 2 with PortNumberUni

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

the class MultipartReplyPortDescDeserializer method deserialize.

@Override
public MultipartReplyBody deserialize(ByteBuf message) {
    final MultipartReplyPortDescBuilder builder = new MultipartReplyPortDescBuilder();
    final List<Ports> items = new ArrayList<>();
    while (message.readableBytes() > 0) {
        final PortsBuilder itemBuilder = new PortsBuilder();
        itemBuilder.setPortNumber(new PortNumberUni(message.readUnsignedInt()));
        message.skipBytes(PADDING_IN_PORT_DESC_HEADER_01);
        itemBuilder.setHardwareAddress(ByteBufUtils.readIetfMacAddress(message));
        message.skipBytes(PADDING_IN_PORT_DESC_HEADER_02);
        items.add(itemBuilder.setName(ByteBufUtils.decodeNullTerminatedString(message, EncodeConstants.MAX_PORT_NAME_LENGTH)).setConfiguration(readPortConfig(message)).setState(readPortState(message)).setCurrentFeature(readPortFeatures(message)).setAdvertisedFeatures(readPortFeatures(message)).setSupported(readPortFeatures(message)).setPeerFeatures(readPortFeatures(message)).setCurrentSpeed(message.readUnsignedInt()).setMaximumSpeed(message.readUnsignedInt()).build());
    }
    return builder.setPorts(items).build();
}
Also used : MultipartReplyPortDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.MultipartReplyPortDescBuilder) PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) ArrayList(java.util.ArrayList) Ports(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.PortsBuilder)

Example 3 with PortNumberUni

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

the class PortUpdateTranslator method translate.

@Override
public FlowCapableNodeConnector translate(final PortGrouping input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
    final FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
    // OF1.0
    if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_0) {
        builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeaturesV10()));
        builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfigV10()));
        builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeaturesV10()));
        builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeaturesV10()));
        builder.setState(PortTranslatorUtil.translatePortState(input.getStateV10()));
        builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeaturesV10()));
    } else if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_3) {
        builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeatures()));
        builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfig()));
        builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeatures()));
        builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeatures()));
        builder.setState(PortTranslatorUtil.translatePortState(input.getState()));
        builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeatures()));
        builder.setQueue(Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
    }
    if (input instanceof PortStatusMessage) {
        if (((PortStatusMessage) input).getReason() != null) {
            builder.setReason(PortReason.forValue(((PortStatusMessage) input).getReason().getIntValue()));
        } else {
            LOG.debug("PortStatus Message has reason as null");
        }
    }
    builder.setCurrentSpeed(input.getCurrSpeed());
    builder.setHardwareAddress(input.getHwAddr());
    builder.setMaximumSpeed(input.getMaxSpeed());
    builder.setName(input.getName());
    builder.setPortNumber(new PortNumberUni(input.getPortNo()));
    return builder.build();
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) PortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage) PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni)

Example 4 with PortNumberUni

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

the class LLDPSpeakerTest method testLocalNodeConnectorCreation.

/**
 * Test that checks if LLDPSpeaker working fine with local ports.
 */
@Test
public void testLocalNodeConnectorCreation() {
    // Call nodeConnectorAdded with local port
    FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector().setPortNumber(new PortNumberUni("LOCAL")).build();
    lldpSpeaker.nodeConnectorAdded(ID, fcnc);
    // Verify that nothing happened for local port
    verify(packetProcessingService, never()).transmitPacket(any(TransmitPacketInput.class));
}
Also used : PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) Test(org.junit.Test)

Example 5 with PortNumberUni

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

the class PortMessageDeserializer method deserialize.

@Override
public PortMessage deserialize(ByteBuf message) {
    final PortMessageBuilder builder = new PortMessageBuilder().setVersion((short) EncodeConstants.OF13_VERSION_ID).setXid(message.readUnsignedInt()).setPortNumber(new PortNumberUni(message.readUnsignedInt()));
    message.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_1);
    builder.setHardwareAddress(ByteBufUtils.readIetfMacAddress(message));
    message.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_2);
    builder.setConfiguration(readPortConfig(message));
    // Skip mask
    message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
    builder.setAdvertisedFeatures(readPortFeatures(message));
    message.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_3);
    return builder.build();
}
Also used : PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni) PortMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessageBuilder)

Aggregations

PortNumberUni (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni)10 Test (org.junit.Test)5 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)3 FlowCapableNodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder)2 PortBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder)2 ArrayList (java.util.ArrayList)1 OpenflowVersion (org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion)1 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)1 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)1 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder)1 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)1 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)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 PortMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage)1 PortMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessageBuilder)1 State (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State)1 StateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.StateBuilder)1 MultipartReplyPortDescBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.MultipartReplyPortDescBuilder)1 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.reply.multipart.reply.body.multipart.reply.port.desc.Ports)1