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