Search in sources :

Example 1 with NodeConnectorBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder in project openflowplugin by opendaylight.

the class QueueStatNotificationSupplierImpl method createNotification.

@Override
public QueueStatisticsUpdate createNotification(final FlowCapableNodeConnectorQueueStatisticsData statisticsDataTreeItem, final InstanceIdentifier<FlowCapableNodeConnectorQueueStatisticsData> path) {
    Preconditions.checkArgument(statisticsDataTreeItem != null);
    Preconditions.checkArgument(path != null);
    final NodeConnectorBuilder connBuilder = new NodeConnectorBuilder();
    final NodeConnectorKey key = path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
    connBuilder.setId(key.getId());
    connBuilder.setKey(key);
    final QueueIdAndStatisticsMapBuilder queueStatMapBuilder = new QueueIdAndStatisticsMapBuilder(statisticsDataTreeItem.getFlowCapableNodeConnectorQueueStatistics());
    final QueueStatisticsUpdateBuilder builder = new QueueStatisticsUpdateBuilder();
    builder.setId(getNodeId(path));
    builder.setMoreReplies(Boolean.FALSE);
    builder.setQueueIdAndStatisticsMap(Collections.singletonList(queueStatMapBuilder.build()));
    builder.setNodeConnector(Collections.singletonList(connBuilder.build()));
    return builder.build();
}
Also used : NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) QueueIdAndStatisticsMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey) QueueStatisticsUpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdateBuilder)

Example 2 with NodeConnectorBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder in project openflowplugin by opendaylight.

the class PortDescMultipartWriter method storeStatistics.

@Override
public void storeStatistics(final MultipartReplyPortDesc statistics, final boolean withParents) {
    statistics.getPorts().forEach(stat -> {
        final NodeConnectorId id = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(features.getDatapathId(), OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.get(features.getVersion()), stat.getPortNumber()), OpenflowVersion.get(features.getVersion()));
        writeToTransaction(getInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(id)), new NodeConnectorBuilder().setId(id).addAugmentation(FlowCapableNodeConnector.class, new FlowCapableNodeConnectorBuilder(stat).build()).addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build()).build(), withParents);
    });
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnectorStatisticsDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 3 with NodeConnectorBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder in project openflowplugin by opendaylight.

the class OF10DeviceInitializer method writePhyPortInformation.

@SuppressWarnings("checkstyle:IllegalCatch")
private static void writePhyPortInformation(final DeviceContext deviceContext) {
    final DeviceInfo deviceInfo = deviceContext.getDeviceInfo();
    final ConnectionContext connectionContext = deviceContext.getPrimaryConnectionContext();
    final MessageTranslator<PortGrouping, FlowCapableNodeConnector> translator = deviceContext.oook().lookupTranslator(new TranslatorKey(deviceInfo.getVersion(), PortGrouping.class.getName()));
    connectionContext.getFeatures().getPhyPort().forEach(port -> {
        final NodeConnectorId nodeConnectorId = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), port.getPortNo(), OpenflowVersion.get(deviceInfo.getVersion()));
        try {
            deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, deviceInfo.getNodeInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(nodeConnectorId)), new NodeConnectorBuilder().setId(nodeConnectorId).addAugmentation(FlowCapableNodeConnector.class, translator.translate(port, deviceInfo, null)).addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build()).build());
        } catch (final Exception e) {
            LOG.debug("Failed to write node {} to DS ", deviceInfo, e);
        }
    });
}
Also used : FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnectorStatisticsDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) DeviceInfo(org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo) PortGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping) TranslatorKey(org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey) ConnectionContext(org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Example 4 with NodeConnectorBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder in project openflowplugin by opendaylight.

the class InventoryDataServiceUtilTest method testNodeConnectorBuilderFromDatapathIdPortNo.

/**
 * Test method for {@link InventoryDataServiceUtil#nodeConnectorBuilderFromDatapathIdPortNo(BigInteger datapathId,
 * Long portNo, org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion ofVersion)}.
 */
@Test
public void testNodeConnectorBuilderFromDatapathIdPortNo() {
    NodeConnectorBuilder nodeConnectorBuilder = InventoryDataServiceUtil.nodeConnectorBuilderFromDatapathIdPortNo(PATH_ID, PORT_NO, OpenflowVersion.OF10);
    assertNotNull(nodeConnectorBuilder);
    nodeConnectorBuilder = InventoryDataServiceUtil.nodeConnectorBuilderFromDatapathIdPortNo(PATH_ID, PORT_NO, OpenflowVersion.OF13);
    assertNotNull(nodeConnectorBuilder);
    nodeConnectorBuilder = InventoryDataServiceUtil.nodeConnectorBuilderFromDatapathIdPortNo(PATH_ID, PORT_NO, OpenflowVersion.UNSUPPORTED);
    assertNotNull(nodeConnectorBuilder);
}
Also used : NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) Test(org.junit.Test)

Example 5 with NodeConnectorBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder in project netvirt by opendaylight.

the class CounterRetriever method getNodeConnectorStatisticsInputBuilder.

private GetNodeConnectorStatisticsInput getNodeConnectorStatisticsInputBuilder(NodeId nodeId, NodeConnectorId nodeConnectorId) {
    NodeRef nodeRef = new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(nodeId)).toInstance());
    GetNodeConnectorStatisticsInputBuilder nodeConnectorBuilder = new GetNodeConnectorStatisticsInputBuilder().setNode(nodeRef).setNodeConnectorId(nodeConnectorId);
    GetNodeConnectorStatisticsInput gncsi = nodeConnectorBuilder.build();
    return gncsi;
}
Also used : GetNodeConnectorStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInputBuilder) NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) GetNodeConnectorStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInput) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Aggregations

NodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder)8 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)6 FlowCapableNodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector)3 NodeConnector (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector)3 FlowCapableNodeConnectorStatisticsDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder)3 FlowCapableNodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 Test (org.junit.Test)1 ConnectionContext (org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext)1 DeviceInfo (org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo)1 TranslatorKey (org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey)1 GetNodeConnectorStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInput)1 GetNodeConnectorStatisticsInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInputBuilder)1 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)1 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)1 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)1 PortGrouping (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping)1 FlowCapableNodeConnectorStatisticsData (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData)1 NodeConnectorStatisticsUpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder)1 NodeConnectorStatisticsAndPortNumberMapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder)1