use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder in project openflowplugin by opendaylight.
the class PortStatusMessageFactory method deserialize.
@Override
public PortStatusMessage deserialize(final ByteBuf rawMessage) {
PortStatusMessageBuilder builder = new PortStatusMessageBuilder();
builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
builder.setReason(PortReason.forValue(rawMessage.readUnsignedByte()));
rawMessage.skipBytes(PADDING_IN_PORT_STATUS_HEADER);
builder.setPortNo(rawMessage.readUnsignedInt());
rawMessage.skipBytes(PADDING_IN_OFP_PORT_HEADER_1);
builder.setHwAddr(ByteBufUtils.readIetfMacAddress(rawMessage));
rawMessage.skipBytes(PADDING_IN_OFP_PORT_HEADER_2);
builder.setName(ByteBufUtils.decodeNullTerminatedString(rawMessage, EncodeConstants.MAX_PORT_NAME_LENGTH));
builder.setConfig(createPortConfig(rawMessage.readUnsignedInt()));
builder.setState(createPortState(rawMessage.readUnsignedInt()));
builder.setCurrentFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
builder.setAdvertisedFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
builder.setSupportedFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
builder.setPeerFeatures(createPortFeatures(rawMessage.readUnsignedInt()));
builder.setCurrSpeed(rawMessage.readUnsignedInt());
builder.setMaxSpeed(rawMessage.readUnsignedInt());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder in project openflowplugin by opendaylight.
the class OpenflowProtocolListenerFullImplTest method testOnPortStatusMessage.
/**
* Test method for
* {@link OpenflowProtocolListenerFullImpl#onPortStatusMessage(
* org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)}.
*/
@Test
public void testOnPortStatusMessage() {
PortStatusMessage portStatusMessage = new PortStatusMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_3).setXid(xid).build();
ofProtocolListener.onPortStatusMessage(portStatusMessage);
Mockito.verify(deviceReplyProcessor).processPortStatusMessage(Matchers.any(PortStatusMessage.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder in project openflowplugin by opendaylight.
the class ConnectionAdapterImplTest method testConsume.
/**
* Tests {@link ConnectionAdapterImpl#consume(DataObject)} with notifications.
*/
@Test
public void testConsume() {
DataObject message = new EchoRequestMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
message = new ErrorMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onErrorMessage((ErrorMessage) message);
message = new ExperimenterMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onExperimenterMessage((ExperimenterMessage) message);
message = new FlowRemovedMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onFlowRemovedMessage((FlowRemovedMessage) message);
message = new HelloMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onHelloMessage((HelloMessage) message);
message = new MultipartReplyMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onMultipartReplyMessage((MultipartReplyMessage) message);
message = new PacketInMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onPacketInMessage((PacketInMessage) message);
message = new PortStatusMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onPortStatusMessage((PortStatusMessage) message);
message = new SwitchIdleEventBuilder().build();
adapter.consume(message);
verify(systemListener, times(1)).onSwitchIdleEvent((SwitchIdleEvent) message);
message = new DisconnectEventBuilder().build();
adapter.consume(message);
verify(systemListener, times(1)).onDisconnectEvent((DisconnectEvent) message);
message = new EchoRequestMessageBuilder().build();
adapter.consume(message);
verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder in project openflowplugin by opendaylight.
the class OF10PortStatusMessageFactory method deserialize.
@Override
public PortStatusMessage deserialize(final ByteBuf rawMessage) {
PortStatusMessageBuilder builder = new PortStatusMessageBuilder();
builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
builder.setReason(PortReason.forValue(rawMessage.readUnsignedByte()));
rawMessage.skipBytes(PADDING_IN_PORT_STATUS_HEADER);
deserializePort(rawMessage, builder);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder 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);
}
Aggregations