use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project openflowplugin by opendaylight.
the class FlowStatNotificationSupplierImpl method createNotification.
@Override
public FlowsStatisticsUpdate createNotification(final FlowStatistics flowStatistics, final InstanceIdentifier<FlowStatistics> path) {
Preconditions.checkArgument(flowStatistics != null);
Preconditions.checkArgument(path != null);
final FlowAndStatisticsMapListBuilder fsmlBuilder = new FlowAndStatisticsMapListBuilder(flowStatistics);
fsmlBuilder.setFlowId(new FlowId(path.firstKeyOf(Flow.class, FlowKey.class).getId().getValue()));
final FlowsStatisticsUpdateBuilder builder = new FlowsStatisticsUpdateBuilder();
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
// NOTE : fix if it needs, but we have to ask DataStore for the NodeConnector list
builder.setNodeConnector(Collections.<NodeConnector>emptyList());
builder.setFlowAndStatisticsMapList(Collections.singletonList(fsmlBuilder.build()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project openflowplugin by opendaylight.
the class GroupStatNotificationSupplierImpl method createNotification.
@Override
public GroupStatisticsUpdated createNotification(final GroupStatistics groupStatistics, final InstanceIdentifier<GroupStatistics> path) {
Preconditions.checkArgument(groupStatistics != null);
Preconditions.checkArgument(path != null);
final GroupStatisticsUpdatedBuilder builder = new GroupStatisticsUpdatedBuilder();
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
// TODO : fix if it needs, but we have to ask DataStore for the NodeConnector list
builder.setNodeConnector(Collections.<NodeConnector>emptyList());
builder.setGroupStats(Collections.singletonList(new GroupStatsBuilder(groupStatistics).build()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _portDescStats.
public void _portDescStats(CommandInterpreter ci) {
int nodeConnectorCount = 0;
int nodeConnectorDescStatsCount = 0;
List<Node> nodes = getNodes();
for (Node node2 : nodes) {
NodeKey nodeKey = node2.getKey();
InstanceIdentifier<Node> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
Node node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
if (node != null) {
if (node.getNodeConnector() != null) {
List<NodeConnector> ports = node.getNodeConnector();
for (NodeConnector nodeConnector2 : ports) {
nodeConnectorCount++;
NodeConnectorKey nodeConnectorKey = nodeConnector2.getKey();
InstanceIdentifier<FlowCapableNodeConnector> connectorRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).augmentation(FlowCapableNodeConnector.class);
FlowCapableNodeConnector nodeConnector = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, connectorRef);
if (nodeConnector != null) {
if (null != nodeConnector.getName() && null != nodeConnector.getCurrentFeature() && null != nodeConnector.getState() && null != nodeConnector.getHardwareAddress() && null != nodeConnector.getPortNumber()) {
nodeConnectorDescStatsCount++;
}
}
}
}
}
}
if (nodeConnectorCount == nodeConnectorDescStatsCount) {
LOG.debug("portDescStats - Success");
} else {
LOG.debug("portDescStats - Failed");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project openflowplugin by opendaylight.
the class PacketUtils method createNodeConnRef.
/**
* Returns the port wrapped into {@link NodeConnectorRef}.
*/
public static NodeConnectorRef createNodeConnRef(final InstanceIdentifier<Node> nodeInstId, final NodeKey nodeKey, final String port) {
StringBuilder builder = new StringBuilder(nodeKey.getId().getValue()).append(':').append(port);
NodeConnectorKey connKey = new NodeConnectorKey(new NodeConnectorId(builder.toString()));
InstanceIdentifier<NodeConnector> portPath = nodeInstId.child(NodeConnector.class, connKey);
return new NodeConnectorRef(portPath);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector in project openflowplugin by opendaylight.
the class NodeConnectorDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetNodeConnectorStatisticsInput input = mock(GetNodeConnectorStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getNodeConnectorId()).thenReturn(nodeConnectorId);
final MultipartRequestPortStatsCase body = (MultipartRequestPortStatsCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestPortStats nodeConnector = body.getMultipartRequestPortStats();
assertEquals(PORT_NO, nodeConnector.getPortNo());
}
Aggregations