use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder in project openflowplugin by opendaylight.
the class OF10DeviceInitializerTest method setUp.
@Before
public void setUp() throws Exception {
final KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier = DeviceStateUtil.createNodeInstanceIdentifier(new NodeId("openflow:1"));
deviceInitializer = new OF10DeviceInitializer();
when(featuresReply.getCapabilitiesV10()).thenReturn(capabilitiesV10);
when(featuresReply.getPhyPort()).thenReturn(Collections.singletonList(new PhyPortBuilder().setPortNo(42L).build()));
when(connectionContext.getFeatures()).thenReturn(featuresReply);
when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(translatorLibrary.lookupTranslator(any())).thenReturn(messageTranslator);
when(deviceContext.oook()).thenReturn(translatorLibrary);
when(requestContext.getXid()).thenReturn(new Xid(42L));
when(requestContext.getFuture()).thenReturn(RpcResultBuilder.success().buildFuture());
when(deviceContext.createRequestContext()).thenReturn(requestContext);
when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactory method deserializePort.
private static PhyPort deserializePort(final ByteBuf rawMessage) {
PhyPortBuilder builder = new PhyPortBuilder();
builder.setPortNo((long) rawMessage.readUnsignedShort());
builder.setHwAddr(ByteBufUtils.readIetfMacAddress(rawMessage));
builder.setName(ByteBufUtils.decodeNullTerminatedString(rawMessage, EncodeConstants.MAX_PORT_NAME_LENGTH));
builder.setConfigV10(OpenflowUtils.createPortConfig(rawMessage.readUnsignedInt()));
builder.setStateV10(OpenflowUtils.createPortState(rawMessage.readUnsignedInt()));
builder.setCurrentFeaturesV10(OpenflowUtils.createPortFeatures(rawMessage.readUnsignedInt()));
builder.setAdvertisedFeaturesV10(OpenflowUtils.createPortFeatures(rawMessage.readUnsignedInt()));
builder.setSupportedFeaturesV10(OpenflowUtils.createPortFeatures(rawMessage.readUnsignedInt()));
builder.setPeerFeaturesV10(OpenflowUtils.createPortFeatures(rawMessage.readUnsignedInt()));
return builder.build();
}
Aggregations