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();
}
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();
}
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();
}
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));
}
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();
}
Aggregations