Search in sources :

Example 1 with PhyPortBuilder

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);
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) PhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Before(org.junit.Before)

Example 2 with PhyPortBuilder

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;
}
Also used : PortConfigV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10) PortStateV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10) PortFeaturesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10) PhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder) ArrayList(java.util.ArrayList) PhyPort(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Example 3 with PhyPortBuilder

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();
}
Also used : PhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder)

Aggregations

PhyPortBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder)3 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)1 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)1 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1 PortConfigV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortConfigV10)1 PortFeaturesV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeaturesV10)1 PortStateV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortStateV10)1 PhyPort (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort)1