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();
}
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);
});
}
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);
}
});
}
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);
}
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;
}
Aggregations