Search in sources :

Example 1 with FlowCapableNodeConnectorStatisticsDataBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder 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 2 with FlowCapableNodeConnectorStatisticsDataBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder 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 3 with FlowCapableNodeConnectorStatisticsDataBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder in project openflowplugin by opendaylight.

the class DeviceContextImpl method writePortStatusMessage.

private void writePortStatusMessage(final PortStatus portStatusMessage) {
    final FlowCapableNodeConnector flowCapableNodeConnector = portStatusTranslator.translate(portStatusMessage, getDeviceInfo(), null);
    final KeyedInstanceIdentifier<NodeConnector, NodeConnectorKey> iiToNodeConnector = getDeviceInfo().getNodeInstanceIdentifier().child(NodeConnector.class, new NodeConnectorKey(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), portStatusMessage.getPortNo(), OpenflowVersion.get(deviceInfo.getVersion()))));
    writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector, new NodeConnectorBuilder().setKey(iiToNodeConnector.getKey()).addAugmentation(FlowCapableNodeConnectorStatisticsData.class, new FlowCapableNodeConnectorStatisticsDataBuilder().build()).addAugmentation(FlowCapableNodeConnector.class, flowCapableNodeConnector).build());
    submitTransaction();
    if (PortReason.OFPPRDELETE.equals(portStatusMessage.getReason())) {
        addDeleteToTxChain(LogicalDatastoreType.OPERATIONAL, iiToNodeConnector);
        submitTransaction();
    }
}
Also used : NodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) FlowCapableNodeConnectorStatisticsDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder) NodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder) FlowCapableNodeConnector(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector) FlowCapableNodeConnectorStatisticsData(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData) NodeConnectorKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)

Aggregations

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 NodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder)3 NodeConnectorKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey)3 FlowCapableNodeConnectorStatisticsDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder)3 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 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 FlowCapableNodeConnectorBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder)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