Search in sources :

Example 1 with GroupStatistics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics 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();
}
Also used : GroupStatisticsUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder) GroupStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsBuilder)

Example 2 with GroupStatistics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics in project openflowplugin by opendaylight.

the class StatisticsGatheringUtilsTest method testGatherStatistics_group.

@Test
public void testGatherStatistics_group() throws Exception {
    final MultipartType type = MultipartType.OFPMPGROUP;
    final long groupIdValue = 19L;
    final GroupStatsBuilder groupStatsBld = new GroupStatsBuilder().setBucketStats(Lists.newArrayList(createBucketStat(21L, 42L))).setByteCount(BigInteger.valueOf(84L)).setPacketCount(BigInteger.valueOf(63L)).setDurationSec(11L).setDurationNsec(12L).setRefCount(13L).setGroupId(new GroupId(groupIdValue));
    final MultipartReplyGroupBuilder mpReplyGroupBld = new MultipartReplyGroupBuilder();
    mpReplyGroupBld.setGroupStats(Lists.newArrayList(groupStatsBld.build()));
    final MultipartReplyGroupCaseBuilder mpReplyGroupCaseBld = new MultipartReplyGroupCaseBuilder();
    mpReplyGroupCaseBld.setMultipartReplyGroup(mpReplyGroupBld.build());
    final MultipartReply groupStatsUpdated = assembleMPReplyMessage(type, mpReplyGroupCaseBld.build());
    final List<MultipartReply> statsData = Collections.singletonList(groupStatsUpdated);
    fireAndCheck(type, statsData);
    final InstanceIdentifier<GroupStatistics> groupPath = dummyNodePath.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId(groupIdValue))).augmentation(NodeGroupStatistics.class).child(GroupStatistics.class);
    verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(groupPath), Matchers.any(GroupStatistics.class));
}
Also used : MultipartReplyGroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCaseBuilder) MultipartType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) MultipartReplyGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroupBuilder) GroupKey(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey) GroupStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStatsBuilder) NodeGroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId) NodeGroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics) GroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics) Test(org.junit.Test)

Example 3 with GroupStatistics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics in project openflowplugin by opendaylight.

the class GroupStatNotificationSupplierImplTest method testCreateChangeEvent.

@Test
public void testCreateChangeEvent() {
    final TestData testData = new TestData(createTestGroupStatPath(), null, createTestGroupStat(), DataObjectModification.ModificationType.WRITE);
    Collection<DataTreeModification<GroupStatistics>> collection = new ArrayList<>();
    collection.add(testData);
    notifSupplierImpl.onDataTreeChanged(collection);
    verify(notifProviderService, times(1)).publish(Matchers.any(GroupStatisticsUpdated.class));
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) GroupStatisticsUpdated(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated) TestData(org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with GroupStatistics

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method testTranslateGroupDesc.

@Test
public void testTranslateGroupDesc() {
    DeviceContext mockedDeviceContext = mock(DeviceContext.class);
    MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyGroupDesc(), MultipartType.OFPMPGROUPDESC);
    DataContainer result = MultipartReplyTranslatorUtil.translate(multipartReplyMessage, mockedDeviceContext.getDeviceInfo(), CONVERTOR_MANAGER, mockedDeviceContext.oook()).get();
    DataContainer dataObject = validateOutput(result);
    assertTrue(dataObject instanceof GroupDescStatsReply);
    GroupDescStatsReply groupStatistics = (GroupDescStatsReply) dataObject;
    List<GroupDescStats> groupDescStats = groupStatistics.getGroupDescStats();
    assertEquals(1, groupDescStats.size());
    GroupDescStats groupDescStat = groupDescStats.get(0);
    assertEquals(DUMMY_GROUP_ID.getValue(), groupDescStat.getGroupId().getValue());
    assertEquals(DUMMY_GROUPS_TYPE, groupDescStat.getGroupType());
}
Also used : DeviceContext(org.opendaylight.openflowplugin.api.openflow.device.DeviceContext) MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) DataContainer(org.opendaylight.yangtools.yang.binding.DataContainer) GroupDescStatsReply(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupDescStatsReply) GroupDescStats(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ArrayList (java.util.ArrayList)1 DataTreeModification (org.opendaylight.controller.md.sal.binding.api.DataTreeModification)1 DeviceContext (org.opendaylight.openflowplugin.api.openflow.device.DeviceContext)1 TestData (org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestData)1 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1 GroupStatisticsUpdated (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated)1 GroupStatisticsUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder)1 NodeGroupStatistics (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics)1 GroupStatistics (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics)1 GroupDescStatsReply (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupDescStatsReply)1 GroupDescStats (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats)1 GroupStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsBuilder)1 GroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey)1 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)1 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)1 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)1 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)1 MultipartReplyGroupCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCaseBuilder)1 MultipartReplyGroupBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroupBuilder)1